From 8d8f56da3038dd8e36713f8a4926aeffd0f1f80b Mon Sep 17 00:00:00 2001 From: Fangrui Song Date: Fri, 16 Aug 2024 18:01:47 -0700 Subject: [PATCH] [MC,AArch64] Remove unneeded STT_NOTYPE/STB_LOCAL code for mapping symbols and improve tests --- .../AArch64/MCTargetDesc/AArch64ELFStreamer.cpp | 2 -- llvm/test/MC/AArch64/mapping-within-section.s | 17 ++++++++++------- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/llvm/lib/Target/AArch64/MCTargetDesc/AArch64ELFStreamer.cpp b/llvm/lib/Target/AArch64/MCTargetDesc/AArch64ELFStreamer.cpp index ed670bce594ec60..c69c87c685303c7 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(getContext().createLocalSymbol(Name)); emitLabel(Symbol); - Symbol->setType(ELF::STT_NOTYPE); - Symbol->setBinding(ELF::STB_LOCAL); } DenseMap LastMappingSymbols; diff --git a/llvm/test/MC/AArch64/mapping-within-section.s b/llvm/test/MC/AArch64/mapping-within-section.s index c84e3a4d2fe647e..791d63b1c65b890 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: {{.}}