0

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.

Roel Schroeven
  • 1,778
  • 11
  • 12

1 Answers1

3

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.

rubenvb
  • 74,642
  • 33
  • 187
  • 332
  • The platform is Debian 10 (buster), with runtime built with GCC. So that confirms what I though. Thanks! – Roel Schroeven Jan 28 '21 at 16:51
  • If libstdc++ is available, I believe clang++ defaults to that, you have to explicitly tell it to use libc++. `-stdlib=libc++`. – sweenish Jan 28 '21 at 17:27