简体   繁体   中英

Which part of GCC is still involved when building with Clang++ and LLD?

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.

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 eg library and header search paths, but I think it only does that as a fallback on unknown platforms.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM