0
votes

I built a very simple program using Clang++/LLD:

clang++ -fuse-ld=lld -o test test.cpp

I than ran readelf to confirm that LLD was indeed used as the linker, as mentioned on https://releases.llvm.org/11.0.0/tools/lld/docs/index.html:

$ readelf --string-dump .comment test

String dump of section '.comment':
  [     0]  Linker: LLD 7.0.1
  [    12]  clang version 7.0.1-8+deb10u2 (tags/RELEASE_701/final)
  [    49]  GCC: (Debian 8.3.0-6) 8.3.0

Very good, the linker used was indeed LDD. But it makes me wonder why GCC is still mentioned there. Maybe because the standard libraries were (presumably) build with GCC? Just wondering.

1

1 Answers

3
votes

Depending on how you built libc++, you may still be using libgcc and libsupc++ to provide some routines otherwise provided by libc++abi and libcxxrt (and even then, there may still be some parts of libgcc required to make everything work). Depending on the platform, there may still be some startup files or libc bits linked in which may or may not contain a string reference to GCC.

On Mac or BSD, for example nothing GCC should be involved anymore.

The Clang driver also (used to) use(s) GCC to infer e.g. library and header search paths, but I think it only does that as a fallback on unknown platforms.