Improve config.h

I would like to make it easier to replace cpp,as,qbe,ld and flag options from the config.h

Perhaps one way is to make all of them consistently use the preprocessor like the DYNAMIC_LINKER option.

Something like:

Assigned to
2 years ago
2 years ago
No labels applied.

~mcf 2 years ago

My plan is to write a simple configure script which will generate config.h and config.mk, hopefully providing a better out-of-box experience on other operating systems.

So you will be able to run

./configure --with-as=/path/to/as ...

~mcf 2 years ago

Done now. Let me know if this works for you.

~mcf REPORTED FIXED 2 years ago

~ach 2 years ago

I still have two problems with this, on nixos the dynamic linker is not installed at /lib64/ld-linux-x86-64.so.2 , So i need to either detect this, or pass it in somehow.

The related second problem is on nixos, gcc is actually a wrapper script that already specifies --dynamic-linker on it's own, so I get warnings about this flag being passed more than once.

Nixos is a bit of an oddity, so maybe it could have it it's own section in the configure script, however it is not visible from -dumpmachine , as it just appears as x86_64-unknown-linux-gnu.

I know it is a bit of a pain, but I only use nixos, which is why I care about this.

~mcf FIXED REPORTED 2 years ago

~mcf 2 years ago


For the first problem, I think adding a --with-dynamic-linker option should be fine.

Not sure about the second. Do you mean that ld is a wrapper script? Since we only invoke gcc as a preprocessor. Perhaps the wrapper script should have some extra logic to detect if the user manually specified the --dynamic-linker flag to avoid the duplicate parameter. Or, maybe we could define --with-dynamic-linker= to mean don't pass any flag to ld.

~ach 2 years ago

Those solutions would work - I should perhaps make a bug report to nixos for the wrapper script.

I just did some testing and I can get the unwrapped nixos binutils and the proper dynamic linker path from:

[ac@black:~/src/cc]$ cat $(dirname $(realpath $(which ld)))/../nix-support/orig-bintools

[ac@black:~/src/cc]$ cat $(dirname $(realpath $(which ld)))/../nix-support/dynamic-linker

Probably not necessary for the configure script to be aware of this crap.

~mcf 2 years ago

I added a --with-ldso flag and DEFAULT_DYNAMIC_LINKER. However, there isn't yet support for DEFAULT_DYNAMIC_LINKER= to mean "don't pass a --dynamic-linker flag". Shouldn't be too hard to do though.

~mcf REPORTED FIXED 2 years ago

Done now. I also added a NixOS continuous build to make sure things work.

Register here or Log in to comment, or comment via email.