[llvm] c977564 - Revert "[ELF] Try appeasing --target=armv7-linux-androideabi24 sanitizer symbolization tests"

Fangrui Song via llvm-commits llvm-commits at lists.llvm.org
Wed Nov 3 00:56:13 PDT 2021


Author: Fangrui Song
Date: 2021-11-03T00:56:09-07:00
New Revision: c977564fc2bad94022b3931365c549c8477831d9

URL: https://github.com/llvm/llvm-project/commit/c977564fc2bad94022b3931365c549c8477831d9
DIFF: https://github.com/llvm/llvm-project/commit/c977564fc2bad94022b3931365c549c8477831d9.diff

LOG: Revert "[ELF] Try appeasing --target=armv7-linux-androideabi24 sanitizer symbolization tests"

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.

Added: 
    

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

Removed: 
    


################################################################################
diff  --git a/lld/ELF/Writer.cpp b/lld/ELF/Writer.cpp
index 819ca7ada7cef..ff16922d80fd6 100644
--- a/lld/ELF/Writer.cpp
+++ b/lld/ELF/Writer.cpp
@@ -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;

diff  --git a/llvm/include/llvm/Object/ELFObjectFile.h b/llvm/include/llvm/Object/ELFObjectFile.h
index 8b45342b4530a..716b94d92d032 100644
--- a/llvm/include/llvm/Object/ELFObjectFile.h
+++ b/llvm/include/llvm/Object/ELFObjectFile.h
@@ -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 {


        


More information about the llvm-commits mailing list