Open Quuxplusone opened 8 years ago
(In reply to comment #0)
> Using clang-3.70 and gcc-5.2.0
>
> [clang appears hardcoded to look for the loader in /lib64 rather than lib]
Im not sure I understand this. Do you mean the loader path? You should be
able to override that with an explicit path passed to the linker.
> [ld.gold has to be renamed to ld]
This is not true. You should specify "-fuse-ld=gold" as part of your LDFLAGS
(you might be able to get away with it in CFLAGS/CXXFLAGS).
The errors that you have demonstrated deal with unresolved symbol dependencies.
It also seems like the symbol referenced are internal. It is possible that
there is some exploitation of gcc specific behavior that is permitting things
to work atm? It might be useful to actually build the file that provides the
internal symbol with gcc and the remainder with clang to see if that is the
case.
> Im not sure I understand this. Do you mean the loader path?
> You should be able to override that with an explicit path passed to the
linker.
clang was compiled on a pure 64-bit system, but when trying to run a simple
program compiled with clang, a.out fails looking for /lib64/ld-linux-x86-
64.so.2 when there is no /lib64, /usr/lib64, /usr/local/lib64.
> This is not true. You should specify "-fuse-ld=gold" as part of your LDFLAGS
> (you might be able to get away with it in CFLAGS/CXXFLAGS).
OK, but if clang requires ld.gold, can't it just use ld.gold?
(In reply to comment #2)
> > Im not sure I understand this. Do you mean the loader path?
> > You should be able to override that with an explicit path passed to the
linker.
>
> clang was compiled on a pure 64-bit system, but when trying to run a simple
> program compiled with clang, a.out fails looking for
> /lib64/ld-linux-x86-64.so.2 when there is no /lib64, /usr/lib64,
> /usr/local/lib64.
This sounds like a distribution integration issue. The loader paths are
defaulted, as they are the traditional paths. I know that debian has custom
patches for the default loader paths.
> > This is not true. You should specify "-fuse-ld=gold" as part of your LDFLAGS
> > (you might be able to get away with it in CFLAGS/CXXFLAGS).
>
> OK, but if clang requires ld.gold, can't it just use ld.gold?
It shouldn't require gold. It should be able to use either binutils or gold.
Why do you think it requires gold?
> It shouldn't require gold. It should be able to use either binutils or gold.
> Why do you think it requires gold?
As per config.log, the ./configure test fails like this:
"/usr/local/bin/ld" --eh-frame-hdr -m elf_x86_64 -dynamic-linker /lib64/ld-linux-x86-64.so.2 -o a.out /usr/lib/crt1.o /usr/lib/crti.o /usr/local/bin/../lib/gcc/x86_64-unknown-linux-gnu/5.2.0/crtbegin.o -L/usr/local/bin/../lib/gcc/x86_64-unknown-linux-gnu/5.2.0 -L/lib/../lib64 -L/usr/local/bin/../lib/gcc/x86_64-unknown-linux-gnu/5.2.0/../../.. -L/tmp/tcloop/clang/usr/local/bin/../lib -L/lib -L/usr/lib -plugin /tmp/tcloop/clang/usr/local/bin/../lib/LLVMgold.so -plugin-opt=mcpu=x86-64 /tmp/conftest-fe34b6.o -lstdc++ -lm -lgcc_s -lgcc -lc -lgcc_s -lgcc /usr/local/bin/../lib/gcc/x86_64-unknown-linux-gnu/5.2.0/crtend.o /usr/lib/crtn.o
/tmp/conftest-fe34b6.o: file not recognized: File format not recognized
clang: error: linker command failed with exit code 1
If I rename ld.gold or use "-fuse-ld=gold" then it passes
> The errors that you have demonstrated deal with unresolved symbol
dependencies. > It also seems like the symbol referenced are internal.
> It is possible that there is some exploitation of gcc specific behavior
> that is permitting things to work atm? It might be useful to actually build
> the file that provides the internal symbol with gcc and the remainder with
> clang to see if that is the case.
I substituted g++ for clang++ in tool/Makefile and gtkmm-3.16.0 compiles :)
I see "clang: warning: argument unused during compilation: '-pthread'" at the
final linking stage for libgtkmm-3.0, is this expected?
..and also, unlike with gcc-5.2/lto, clang/lto seems to have built libgtkmm-3.0
properly - see:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69953
(In reply to comment #4)
> > It shouldn't require gold. It should be able to use either binutils or gold.
> > Why do you think it requires gold?
>
> As per config.log, the ./configure test fails like this:
>
> "/usr/local/bin/ld" --eh-frame-hdr -m elf_x86_64 -dynamic-linker
> /lib64/ld-linux-x86-64.so.2 -o a.out /usr/lib/crt1.o /usr/lib/crti.o
> /usr/local/bin/../lib/gcc/x86_64-unknown-linux-gnu/5.2.0/crtbegin.o
> -L/usr/local/bin/../lib/gcc/x86_64-unknown-linux-gnu/5.2.0 -L/lib/../lib64
> -L/usr/local/bin/../lib/gcc/x86_64-unknown-linux-gnu/5.2.0/../../..
> -L/tmp/tcloop/clang/usr/local/bin/../lib -L/lib -L/usr/lib -plugin
> /tmp/tcloop/clang/usr/local/bin/../lib/LLVMgold.so -plugin-opt=mcpu=x86-64
> /tmp/conftest-fe34b6.o -lstdc++ -lm -lgcc_s -lgcc -lc -lgcc_s -lgcc
> /usr/local/bin/../lib/gcc/x86_64-unknown-linux-gnu/5.2.0/crtend.o
> /usr/lib/crtn.o
> /tmp/conftest-fe34b6.o: file not recognized: File format not recognized
> clang: error: linker command failed with exit code 1
>
> If I rename ld.gold or use "-fuse-ld=gold" then it passes
Ah, I think I missed this the first time around! The linker that it is using
is "/usr/local/bin/ld". This is most likely a build of GNU ld, however, it
seems that it does not support the object file, which means that it is possible
that it doesn't support ELF x86_64, whilst the gold that gets used does support
ELF x64. This is not a clang issue at all, but rather an issue with your
linker.
(In reply to comment #5)
The errors that you have demonstrated deal with unresolved symbol dependencies. > It also seems like the symbol referenced are internal. It is possible that there is some exploitation of gcc specific behavior that is permitting things to work atm? It might be useful to actually build the file that provides the internal symbol with gcc and the remainder with clang to see if that is the case.
I substituted g++ for clang++ in tool/Makefile and gtkmm-3.16.0 compiles :)
That means that we have something to go on then. Can you provide generate_defs_gdk.o built by clang and by gcc. Also, please provide the preprocessed output of the corresponding source file. Furthermore, can you provide the same set (.o files from clang and gcc and the preprocessed source code) for the file that contains get_defs(unsigned long, bool (*)(unsigned long)).
I see "clang: warning: argument unused during compilation: '-pthread'" at the final linking stage for libgtkmm-3.0, is this expected?
Sounds like it was part of the compilation. Currently, -pthread
does not change compilation behavior in clang. So, that warning is expected with clang.
..and also, unlike with gcc-5.2/lto, clang/lto seems to have built libgtkmm-3.0 properly - see:
Attached clang_gcc_comp.tar.xz
(330468 bytes, text/plain): clang gcc comparison
> Ah, I think I missed this the first time around! The linker that it is
> using is "/usr/local/bin/ld". This is most likely a build of GNU ld,
> however, it seems that it does not support the object file,
> which means that it is possible that it doesn't support ELF x86_64,
> whilst the gold that gets used does support ELF x64.
> This is not a clang issue at all, but rather an issue with your linker.
Maybe I misunderstand, but I deleted ld.gold and gcc compiles 64-bit without
problems...
> This sounds like a distribution integration issue. The loader paths are
> defaulted, as they are the traditional paths.
> I know that debian has custom patches for the default loader paths.
[rant]
To have a pure 64-bit system using /lib rather than /lib64 does not seem too
unusual - and I hear some major distros will soon stop providing 32-bit.
It would seem logical that clang checks where the loader is rather than relying
on the user to patch the source.
..and why doesn't LLVMgold.so compile and install by default?
[/rant]
(In reply to comment #9)
> > Ah, I think I missed this the first time around! The linker that it is
> > using is "/usr/local/bin/ld". This is most likely a build of GNU ld,
> > however, it seems that it does not support the object file,
> > which means that it is possible that it doesn't support ELF x86_64,
> > whilst the gold that gets used does support ELF x64.
> > This is not a clang issue at all, but rather an issue with your linker.
>
> Maybe I misunderstand, but I deleted ld.gold and gcc compiles 64-bit without
> problems...
Which linker is gcc actually using? Is it using /usr/local/bin/ld?
Yes, gcc is using /usr/local/bin/ld
clang_gcc_comp.tar.xz
(330468 bytes, text/plain)