[PATCH] D91884: clang+lld: Improve clang+ld.darwinnew.lld interaction, pass -demangle

Fangrui Song via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Nov 23 14:27:14 PST 2020


MaskRay added inline comments.


================
Comment at: clang/lib/Driver/ToolChain.cpp:551
 
-std::string ToolChain::GetLinkerPath() const {
+std::string ToolChain::GetLinkerPath(bool* LinkerIsLLD) const {
+  if (LinkerIsLLD)
----------------
`bool *`


================
Comment at: lld/Common/Strings.cpp:24
 std::string lld::demangleItanium(StringRef name) {
-  // itaniumDemangle can be used to demangle strings other than symbol
-  // names which do not necessarily start with "_Z". Name can be
-  // either a C or C++ symbol. Don't call demangle if the name
-  // does not look like a C++ symbol name to avoid getting unexpected
-  // result for a C symbol that happens to match a mangled type name.
-  if (!name.startswith("_Z"))
+  // itaniumDemangle() can be called for all symbols. Only demangle C++ symbols,
+  // to avoid getting unexpected result for a C symbol that happens to match a
----------------
The comment should be fixed.

Itanium mangling scheme does not allow `__Z`/`___Z`. They are Mach-O extensions and probably also COFF i386's (where symbols start with an additional `_`)


================
Comment at: lld/test/ELF/undef.s:83
   call _Z3fooi
   call _ZTV3Foo
----------------
> and removes one test added in D68014 that doesnt' seem all that useful

Can you keep the symbol and alter the error message instead? Keeping it has little maintenance burden but adds some coverage.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D91884/new/

https://reviews.llvm.org/D91884



More information about the llvm-commits mailing list