Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"Illegal instruction" error after compiling oksh with zig cc and --no-thanks flag #76

Open
absolutelynothinghere opened this issue Oct 16, 2023 · 0 comments

Comments

@absolutelynothinghere
Copy link

I compiled oksh using the Zig CC compiler (clang wrapper with cross-compilation support and ubsan) once with the --no-thanks flag and once without. The binary compiled with --no-thanks causes an "Illegal instruction" error when attempting to compile other programs, meaning that undefined behavior was detected.

Here's an example:

mkdir -p /tmp/test && cd /tmp/test
wget https://github.com/ibara/oksh/releases/download/oksh-7.3/oksh-7.3.tar.gz
wget https://invisible-island.net/archives/byacc/byacc-20230521.tgz

# compile oksh with `--no-thanks` using zig cc
tar xf oksh-7.3.tar.gz && cd oksh-7.3
CC="zig cc -target x86_64-linux-musl" ./configure --no-thanks
make

# configure byacc using oksh as shell
cd /tmp/test
tar xf byacc-20230521.tgz && cd byacc-20230521
sed -i -e 's_/bin/sh_/tmp/test/oksh-7.3/oksh_' configure
./configure --help # Illegal instruction
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant