-
-
Notifications
You must be signed in to change notification settings - Fork 255
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
Problem using linker options -L=-nostdlib and friends #780
Comments
This appears to already be an issue logged for DMD: https://issues.dlang.org/show_bug.cgi?id=6952 |
I think the proper solution is to have DMD use If LDC is striving for compatibility with DMD, then this is a DMD issue, not an LDC issue. Closing. |
I don't think so. We don't want to duplicate the logic for linking against the C standard library, as it would turn into a very platform-dependent mess – at least I think it would, didn't actually try to implement it so far. |
It would require DMD to become more knowledgeable of the underlying platform, and it would certainly make the command line in dmd.conf longer, but I don't think that qualifies as a "mess". I find the dependency natural for a native compiler. I think using I'm curious, though... if LDC is the LLVM D compiler, do you plan on using |
Update druntime submodule with core.internal.convert changes and start running its unit test again. This should resolve issue ldc-developers#780.
Consider the following:
Compiling with
ldc2 test.d -defaultlib= -L=-nostdlib -L=-nodefaultlibs -L=-nostartfiles -v
shows the command to the linker...... and the output below indicates that it is still linking to the default libs and the start files when it shouldn't.
This appears to be because
gcc
is used for the linker, but the linker options are further forwarded told
with the-Xlinker
option instead of being passed directly togcc
. So, either the options specified by-L={option}
should begcc
options, orld
should be used for the linker.Furthermore, I'd expect
-defaultlib=
to prevent the compiler from passing-lrt -ldl -lpthread -lm
to the linker, but that depends on how-defaultlib=
is defined.Compiling with
ldc2 -c test.d
and linking manually withgcc -nodefaultlibs -nostdlib -nostartfiles test.o
produces the correct result. And, of course, manually linking withld test.o
also produces the correct result.Documentation on these options can be found here: https://gcc.gnu.org/onlinedocs/gcc/Link-Options.html
Testing on Arch Linux 64 with LDC 0.14.0 (DMD v2.065, LLVM 3.4.2)
The text was updated successfully, but these errors were encountered: