~mcf/cproc#27:
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:

-DTARGET_QBE=
-DTARGET_AS=
-DTARGET_CPP=
Status
RESOLVED FIXED
Submitter
~ach
Assigned to
No-one
Submitted
10 months ago
Updated
8 months ago
Labels
No labels applied.

~mcf 8 months 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 8 months ago

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

~mcf REPORTED FIXED 8 months ago

~ach 8 months 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 8 months ago

~mcf 8 months ago

Hmm...

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 8 months 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
/nix/store/gqq2w8a0yb3ksx9h9iilp73x5hib3rwi-binutils-2.31.1

[ac@black:~/src/cc]$ cat $(dirname $(realpath $(which ld)))/../nix-support/dynamic-linker
/nix/store/sw54ph775lw7b9g4hlfvpx6fmlvdy8qi-glibc-2.27/lib/ld-linux-x86-64.so.2

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

~mcf 8 months 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 8 months 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.