Revert "[ELF] Try appeasing --target=armv7-linux-androideabi24 sanitizer symbolizatio...
authorFangrui Song <i@maskray.me>
Wed, 3 Nov 2021 07:56:09 +0000 (00:56 -0700)
committerFangrui Song <i@maskray.me>
Wed, 3 Nov 2021 07:56:09 +0000 (00:56 -0700)
This reverts commit 5cbec88cbf1c8d06030b84ebf17f5eebc3e3f1f9.

Vitaly said that 2faac77f26dee2a1367f373180573ea9c56efed1 actually works.

Sanitizer's armv7-linux-androideabi24 configuration has other issues which haven't been identified yet, but that's unrelated to the empty symbol name issue.

lld/ELF/Writer.cpp
llvm/include/llvm/Object/ELFObjectFile.h

index 819ca7a..ff16922 100644 (file)
@@ -726,7 +726,7 @@ static bool shouldKeepInSymtab(const Defined &sym) {
   // * --discard-locals is used.
   // * The symbol is in a SHF_MERGE section, which is normally the reason for
   //   the assembler keeping the .L symbol.
-  if ((sym.getName().empty() || sym.getName().startswith(".L")) &&
+  if (sym.getName().startswith(".L") &&
       (config->discard == DiscardPolicy::Locals ||
        (sym.section && (sym.section->flags & SHF_MERGE))))
     return false;
index 8b45342..716b94d 100644 (file)
@@ -733,7 +733,8 @@ Expected<uint32_t> ELFObjectFile<ELFT>::getSymbolFlags(DataRefImpl Sym) const {
   } else if (EF.getHeader().e_machine == ELF::EM_ARM) {
     if (Expected<StringRef> NameOrErr = getSymbolName(Sym)) {
       StringRef Name = *NameOrErr;
-      if (Name.startswith("$d") || Name.startswith("$t") ||
+      // TODO Investigate why empty name symbols need to be marked.
+      if (Name.empty() || Name.startswith("$d") || Name.startswith("$t") ||
           Name.startswith("$a"))
         Result |= SymbolRef::SF_FormatSpecific;
     } else {