简体   繁体   English

GCC在用Clang++和LLD构建时还涉及到哪一部分?

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

I built a very simple program using Clang++/LLD:我使用 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 以确认 LLD 确实被用作 linker,如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.很好,用的linker确实是LDD。 But it makes me wonder why GCC is still mentioned there.但这让我想知道为什么那里仍然提到 GCC。 Maybe because the standard libraries were (presumably) build with GCC?也许是因为标准库(大概)是用 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).根据您构建 libc++的方式,您可能仍在使用 libgcc 和 libsupc++ 来提供一些由 libc++abi 和 libcxxrt 提供的例程(即便如此,可能仍然需要 libgcc 的某些部分才能使一切正常工作)。 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.根据平台的不同,可能仍有一些启动文件或链接的 libc 位,其中可能包含也可能不包含对 GCC 的字符串引用。

On Mac or BSD, for example nothing GCC should be involved anymore.例如,在 Mac 或 BSD 上,不应再涉及 GCC。

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. Clang 驱动程序还(过去)使用 GCC 来推断例如库和 header 搜索路径,但我认为它只是作为未知平台的后备。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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