[lld] 5cbec88 - [ELF] Try appeasing --target=armv7-linux-androideabi24 sanitizer symbolization tests

Fangrui Song via llvm-commits llvm-commits at lists.llvm.org
Tue Nov 2 18:57:09 PDT 2021


Author: Fangrui Song
Date: 2021-11-02T18:57:04-07:00
New Revision: 5cbec88cbf1c8d06030b84ebf17f5eebc3e3f1f9

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

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

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 ff16922d80fd6..819ca7ada7cef 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().startswith(".L") &&
+  if ((sym.getName().empty() || 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 716b94d92d032..8b45342b4530a 100644
--- a/llvm/include/llvm/Object/ELFObjectFile.h
+++ b/llvm/include/llvm/Object/ELFObjectFile.h
@@ -733,8 +733,7 @@ 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;
-      // TODO Investigate why empty name symbols need to be marked.
-      if (Name.empty() || Name.startswith("$d") || Name.startswith("$t") ||
+      if (Name.startswith("$d") || Name.startswith("$t") ||
           Name.startswith("$a"))
         Result |= SymbolRef::SF_FormatSpecific;
     } else {


        


More information about the llvm-commits mailing list