[llvm] 8d8f56d - [MC,AArch64] Remove unneeded STT_NOTYPE/STB_LOCAL code for mapping symbols and improve tests

Fangrui Song via llvm-commits llvm-commits at lists.llvm.org
Fri Aug 16 18:01:52 PDT 2024


Author: Fangrui Song
Date: 2024-08-16T18:01:47-07:00
New Revision: 8d8f56da3038dd8e36713f8a4926aeffd0f1f80b

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

LOG: [MC,AArch64] Remove unneeded STT_NOTYPE/STB_LOCAL code for mapping symbols and improve tests

Added: 
    

Modified: 
    llvm/lib/Target/AArch64/MCTargetDesc/AArch64ELFStreamer.cpp
    llvm/test/MC/AArch64/mapping-within-section.s

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Target/AArch64/MCTargetDesc/AArch64ELFStreamer.cpp b/llvm/lib/Target/AArch64/MCTargetDesc/AArch64ELFStreamer.cpp
index ed670bce594ec6..c69c87c685303c 100644
--- a/llvm/lib/Target/AArch64/MCTargetDesc/AArch64ELFStreamer.cpp
+++ b/llvm/lib/Target/AArch64/MCTargetDesc/AArch64ELFStreamer.cpp
@@ -272,8 +272,6 @@ class AArch64ELFStreamer : public MCELFStreamer {
   void emitMappingSymbol(StringRef Name) {
     auto *Symbol = cast<MCSymbolELF>(getContext().createLocalSymbol(Name));
     emitLabel(Symbol);
-    Symbol->setType(ELF::STT_NOTYPE);
-    Symbol->setBinding(ELF::STB_LOCAL);
   }
 
   DenseMap<const MCSection *, ElfMappingSymbol> LastMappingSymbols;

diff  --git a/llvm/test/MC/AArch64/mapping-within-section.s b/llvm/test/MC/AArch64/mapping-within-section.s
index c84e3a4d2fe647..791d63b1c65b89 100644
--- a/llvm/test/MC/AArch64/mapping-within-section.s
+++ b/llvm/test/MC/AArch64/mapping-within-section.s
@@ -1,4 +1,5 @@
-// RUN: llvm-mc -triple=aarch64-none-linux-gnu -filetype=obj %s | llvm-nm --no-sort --special-syms - | FileCheck %s --match-full-lines
+# RUN: llvm-mc -triple=aarch64-none-linux-gnu -filetype=obj %s -o %t
+# RUN: llvm-readelf -Ss %t | FileCheck %s
 
     .text
 // $x at 0x0000
@@ -22,9 +23,11 @@
 $d:
 $x:
 
-// CHECK:      0000000000000000 t $x
-// CHECK-NEXT: 0000000000000004 t $d
-// CHECK-NEXT: 0000000000000064 t $x
-// CHECK-NEXT: 0000000000000068 t $x
-// CHECK-NEXT: 0000000000000068 T $d
-// CHECK-NOT:  {{.}}
+# CHECK: [[#TEXT:]]] .text
+
+# CHECK:      1: 0000000000000000     0 NOTYPE  LOCAL  DEFAULT [[#TEXT]] $x
+# CHECK-NEXT: 2: 0000000000000004     0 NOTYPE  LOCAL  DEFAULT [[#TEXT]] $d
+# CHECK-NEXT: 3: 0000000000000064     0 NOTYPE  LOCAL  DEFAULT [[#TEXT]] $x
+# CHECK-NEXT: 4: 0000000000000068     0 NOTYPE  LOCAL  DEFAULT [[#TEXT]] $x
+# CHECK-NEXT: 5: 0000000000000068     0 NOTYPE  GLOBAL DEFAULT [[#TEXT]] $d
+# CHECK-NOT:  {{.}}


        


More information about the llvm-commits mailing list