[cfe-dev] Cleaning up the clang::driver::toolchains::Linux mess?

Anders Kaseorg andersk at mit.edu
Tue Jun 14 11:09:16 PDT 2011


On Tue, 14 Jun 2011, James Molloy wrote:
> (but LLVM/Clang is meant to be a GCC replacement - it shouldn't rely on 
> it!).

I do hope there was a better motivation for r118382 than that.  One can’t 
just switch from running

gcc -o foo foo.o

to running

"/usr/bin/ld" --eh-frame-hdr -m elf_x86_64 -dynamic-linker 
/lib64/ld-linux-x86-64.so.2 -o foo 
/usr/lib/gcc/x86_64-linux-gnu/4.6/../../../crt1.o 
/usr/lib/gcc/x86_64-linux-gnu/4.6/../../../crti.o 
/usr/lib/gcc/x86_64-linux-gnu/4.6/crtbegin.o 
-L/usr/lib/gcc/x86_64-linux-gnu/4.6 
-L/usr/lib/gcc/x86_64-linux-gnu/4.6/../../../../lib64 -L/lib/../lib64 
-L/usr/lib/../lib64 -L/usr/lib/gcc/x86_64-linux-gnu/4.6/../../.. foo.o 
-lgcc --as-needed -lgcc_s --no-as-needed -lc -lgcc --as-needed -lgcc_s 
--no-as-needed /usr/lib/gcc/x86_64-linux-gnu/4.6/crtend.o 
/usr/lib/gcc/x86_64-linux-gnu/4.6/../../../crtn.o

and call that “not relying on GCC”.  Not relying on GCC would mean that I 
don’t need to have any parts of GCC installed to use clang.  That might be 
possible in the bare-metal case, but it doesn’t make sense to talk about 
that in the Linux case until clang has its own replacements for 
crtbegin.o, crtend.o, libgcc.a, libgcc_s.so, and knows how to find crt1.o, 
crti.o, crtn.o, libc.so without backtracking from GCC’s internal paths.

Anders




More information about the cfe-dev mailing list