-
Notifications
You must be signed in to change notification settings - Fork 13.6k
[MC,AArch64] Create mapping symbols with non-unique names #99836
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[MC,AArch64] Create mapping symbols with non-unique names #99836
Conversation
Created using spr 1.3.5-bogner
@llvm/pr-subscribers-debuginfo @llvm/pr-subscribers-mc Author: Fangrui Song (MaskRay) ChangesAdd Utilizing Full diff: https://github.com/llvm/llvm-project/pull/99836.diff 18 Files Affected:
diff --git a/lld/test/ELF/aarch64-cortex-a53-843419-abs-mapsyms.s b/lld/test/ELF/aarch64-cortex-a53-843419-abs-mapsyms.s
index 608b1aceb0a00..a9b95b1a63ef6 100644
--- a/lld/test/ELF/aarch64-cortex-a53-843419-abs-mapsyms.s
+++ b/lld/test/ELF/aarch64-cortex-a53-843419-abs-mapsyms.s
@@ -12,7 +12,7 @@
.type _start, %function
_start: ret
-// CHECK: Name: $x.0
+// CHECK: Name: $x
// CHECK-NEXT: Value: 0x0
// CHECK-NEXT: Size: 0
// CHECK-NEXT: Binding: Local (0x0)
diff --git a/lld/test/ELF/aarch64-gnu-ifunc.s b/lld/test/ELF/aarch64-gnu-ifunc.s
index d76b54eabf8a4..f39ae0cd84934 100644
--- a/lld/test/ELF/aarch64-gnu-ifunc.s
+++ b/lld/test/ELF/aarch64-gnu-ifunc.s
@@ -37,7 +37,7 @@
// CHECK-NEXT: Section: Undefined
// CHECK-NEXT: }
// CHECK-NEXT: Symbol {
-// CHECK-NEXT: Name: $x.0
+// CHECK-NEXT: Name: $x
// CHECK-NEXT: Value: 0x210188
// CHECK-NEXT: Size: 0
// CHECK-NEXT: Binding: Local
diff --git a/lld/test/ELF/aarch64-reloc-pauth.s b/lld/test/ELF/aarch64-reloc-pauth.s
index 19493fcfa1365..6b4d23d37babc 100644
--- a/lld/test/ELF/aarch64-reloc-pauth.s
+++ b/lld/test/ELF/aarch64-reloc-pauth.s
@@ -68,11 +68,11 @@
# RELR-EMPTY:
# RELR-NEXT: Relocation section '.relr.auth.dyn' at offset 0x[[ADDR2]] contains 5 entries:
# RELR-NEXT: Index: Entry Address Symbolic Address
-# RELR-NEXT: 0000: 0000000000030440 0000000000030440 $d.0
-# RELR-NEXT: 0001: 000000000000000f 0000000000030448 $d.0 + 0x8
-# RELR-NEXT: 0000000000030450 $d.0 + 0x10
-# RELR-NEXT: 0000000000030458 $d.0 + 0x18
-# RELR-NEXT: 0002: 0000000000030492 0000000000030492 $d.0 + 0x52
+# RELR-NEXT: 0000: 0000000000030440 0000000000030440 $d
+# RELR-NEXT: 0001: 000000000000000f 0000000000030448 $d + 0x8
+# RELR-NEXT: 0000000000030450 $d + 0x10
+# RELR-NEXT: 0000000000030458 $d + 0x18
+# RELR-NEXT: 0002: 0000000000030492 0000000000030492 $d + 0x52
# HEX: Hex dump of section '.test':
# HEX-NEXT: 0x00030440 01000000 2a000020 42040300 2b000000
@@ -201,7 +201,7 @@
# EMPTY-RELA-EMPTY:
# EMPTY-RELA-NEXT: Relocation section '.relr.auth.dyn' at offset {{.+}} contains 1 entries:
# EMPTY-RELA-NEXT: Index: Entry Address Symbolic Address
-# EMPTY-RELA-NEXT: 0000: 0000000000030310 0000000000030310 $d.0
+# EMPTY-RELA-NEXT: 0000: 0000000000030310 0000000000030310 $d
# EMPTY-RELA-RO-NOT: .rela.dyn
diff --git a/lld/test/ELF/aarch64-thunk-script.s b/lld/test/ELF/aarch64-thunk-script.s
index 08ff4e9871180..a6c524f548288 100644
--- a/lld/test/ELF/aarch64-thunk-script.s
+++ b/lld/test/ELF/aarch64-thunk-script.s
@@ -43,8 +43,8 @@ high_target:
// CHECK-NEXT: ret
/// Local symbols copied from %t.o
-// NM: t $x.0
-// NM-NEXT: t $x.1
+// NM: t $x
+// NM-NEXT: t $x
/// Local thunk symbols.
// NM-NEXT: t __AArch64AbsLongThunk_high_target
// NM-NEXT: t $x
diff --git a/lld/test/ELF/basic-aarch64.s b/lld/test/ELF/basic-aarch64.s
index 6b109e8da2c3e..1f59d33c4230b 100644
--- a/lld/test/ELF/basic-aarch64.s
+++ b/lld/test/ELF/basic-aarch64.s
@@ -119,7 +119,7 @@ _start:
# CHECK-NEXT: ]
# CHECK-NEXT: Address: 0x0
# CHECK-NEXT: Offset: 0x1AA
-# CHECK-NEXT: Size: 13
+# CHECK-NEXT: Size: 11
# CHECK-NEXT: Link: 0
# CHECK-NEXT: Info: 0
# CHECK-NEXT: AddressAlignment: 1
@@ -189,7 +189,7 @@ _start:
# CHECK-NEXT: Section: Undefined (0x0)
# CHECK-NEXT: }
# CHECK-NEXT: Symbol {
-# CHECK-NEXT: Name: $x.0
+# CHECK-NEXT: Name: $x
# CHECK-NEXT: Value: 0x210120
# CHECK-NEXT: Size: 0
# CHECK-NEXT: Binding: Local (0x0)
diff --git a/lld/test/ELF/pack-dyn-relocs.s b/lld/test/ELF/pack-dyn-relocs.s
index 3cbba68716972..dd18c92c7352e 100644
--- a/lld/test/ELF/pack-dyn-relocs.s
+++ b/lld/test/ELF/pack-dyn-relocs.s
@@ -264,30 +264,30 @@
// RELR64-EMPTY:
// RELR64-NEXT: Relocation section '.relr.dyn' at offset {{.*}} contains 24 entries:
// RELR64-NEXT: Symbolic Address
-// RELR64-NEXT: $d.0{{$}}
-// RELR64-NEXT: $d.0 + 0x8
-// RELR64-NEXT: $d.0 + 0x10
-// RELR64-NEXT: $d.0 + 0x18
-// RELR64-NEXT: $d.0 + 0x20
-// RELR64-NEXT: $d.0 + 0x28
-// RELR64-NEXT: $d.0 + 0x30
-// RELR64-NEXT: $d.0 + 0x38
-// RELR64-NEXT: $d.0 + 0x48
-// RELR64-NEXT: $d.0 + 0x50
-// RELR64-NEXT: $d.0 + 0x58
-// RELR64-NEXT: $d.0 + 0x60
-// RELR64-NEXT: $d.0 + 0x68
-// RELR64-NEXT: $d.0 + 0x70
-// RELR64-NEXT: $d.0 + 0x78
-// RELR64-NEXT: $d.0 + 0x90
-// RELR64-NEXT: $d.0 + 0x98
-// RELR64-NEXT: $d.0 + 0xa0
-// RELR64-NEXT: $d.0 + 0xa8
-// RELR64-NEXT: $d.0 + 0xb0
-// RELR64-NEXT: $d.0 + 0xb8
-// RELR64-NEXT: $d.0 + 0xc0
-// RELR64-NEXT: $d.0 + 0xc8
-// RELR64-NEXT: $d.0 + 0xd0
+// RELR64-NEXT: $d{{$}}
+// RELR64-NEXT: $d + 0x8
+// RELR64-NEXT: $d + 0x10
+// RELR64-NEXT: $d + 0x18
+// RELR64-NEXT: $d + 0x20
+// RELR64-NEXT: $d + 0x28
+// RELR64-NEXT: $d + 0x30
+// RELR64-NEXT: $d + 0x38
+// RELR64-NEXT: $d + 0x48
+// RELR64-NEXT: $d + 0x50
+// RELR64-NEXT: $d + 0x58
+// RELR64-NEXT: $d + 0x60
+// RELR64-NEXT: $d + 0x68
+// RELR64-NEXT: $d + 0x70
+// RELR64-NEXT: $d + 0x78
+// RELR64-NEXT: $d + 0x90
+// RELR64-NEXT: $d + 0x98
+// RELR64-NEXT: $d + 0xa0
+// RELR64-NEXT: $d + 0xa8
+// RELR64-NEXT: $d + 0xb0
+// RELR64-NEXT: $d + 0xb8
+// RELR64-NEXT: $d + 0xc0
+// RELR64-NEXT: $d + 0xc8
+// RELR64-NEXT: $d + 0xd0
// RELR64-EMPTY:
// RELR64-NEXT: Hex dump of section '.data':
// RELR64-NEXT: 0x00030490 90040300 00000000 91040300 00000000 .
diff --git a/llvm/include/llvm/MC/MCContext.h b/llvm/include/llvm/MC/MCContext.h
index 73fe6361cb866..b59a2ca88eff1 100644
--- a/llvm/include/llvm/MC/MCContext.h
+++ b/llvm/include/llvm/MC/MCContext.h
@@ -468,6 +468,10 @@ class MCContext {
/// true, behaves like getOrCreateSymbol, prefixed with PrivateLabelPrefix.
MCSymbol *createBlockSymbol(const Twine &Name, bool AlwaysEmit = false);
+ /// Create a local, non-temporary symbol like an ELF mapping symbol. Calling
+ /// the function with the same name will generate new, unique instances.
+ MCSymbol *createLocalSymbol(StringRef Name);
+
/// Create the definition of a directional local symbol for numbered label
/// (used for "1:" definitions).
MCSymbol *createDirectionalLocalSymbol(unsigned LocalLabelVal);
diff --git a/llvm/lib/MC/MCContext.cpp b/llvm/lib/MC/MCContext.cpp
index 2fe8369016440..58a580643d7ad 100644
--- a/llvm/lib/MC/MCContext.cpp
+++ b/llvm/lib/MC/MCContext.cpp
@@ -349,6 +349,11 @@ MCSymbol *MCContext::createNamedTempSymbol() {
return createNamedTempSymbol("tmp");
}
+MCSymbol *MCContext::createLocalSymbol(StringRef Name) {
+ MCSymbolTableEntry &NameEntry = getSymbolTableEntry(Name);
+ return createSymbolImpl(&NameEntry, /*IsTemporary=*/false);
+}
+
unsigned MCContext::NextInstance(unsigned LocalLabelVal) {
MCLabel *&Label = Instances[LocalLabelVal];
if (!Label)
diff --git a/llvm/lib/Target/AArch64/MCTargetDesc/AArch64ELFStreamer.cpp b/llvm/lib/Target/AArch64/MCTargetDesc/AArch64ELFStreamer.cpp
index 27751633017ca..b639e2f6eb17f 100644
--- a/llvm/lib/Target/AArch64/MCTargetDesc/AArch64ELFStreamer.cpp
+++ b/llvm/lib/Target/AArch64/MCTargetDesc/AArch64ELFStreamer.cpp
@@ -271,8 +271,7 @@ class AArch64ELFStreamer : public MCELFStreamer {
}
void emitMappingSymbol(StringRef Name) {
- auto *Symbol = cast<MCSymbolELF>(getContext().getOrCreateSymbol(
- Name + "." + Twine(MappingSymbolCounter++)));
+ auto *Symbol = cast<MCSymbolELF>(getContext().createLocalSymbol(Name));
emitLabel(Symbol);
Symbol->setType(ELF::STT_NOTYPE);
Symbol->setBinding(ELF::STB_LOCAL);
diff --git a/llvm/test/CodeGen/AArch64/callbr-asm-obj-file.ll b/llvm/test/CodeGen/AArch64/callbr-asm-obj-file.ll
index e601f03d524a4..8b6740667a229 100644
--- a/llvm/test/CodeGen/AArch64/callbr-asm-obj-file.ll
+++ b/llvm/test/CodeGen/AArch64/callbr-asm-obj-file.ll
@@ -7,10 +7,10 @@
@l = common hidden local_unnamed_addr global i32 0, align 4
; CHECK-LABEL: <test1>:
-; CHECK-LABEL: <$d.1>:
-; CHECK-LABEL: <$x.2>:
+; CHECK-LABEL: <$d>:
+; CHECK-LABEL: <$x>:
; CHECK-NEXT: b 0x2c <test1+0x2c>
-; CHECK-LABEL: <$x.4>:
+; CHECK-LABEL: <$x>:
; CHECK-NEXT: mov w0, wzr
; CHECK-NEXT: ldr x30, [sp], #16
; CHECK-NEXT: ret
@@ -41,8 +41,8 @@ declare dso_local i32 @i(...) local_unnamed_addr
; CHECK-LABEL: <test2>:
; CHECK: b {{.*}} <test2+0x1c>
-; CHECK-LABEL: <$d.5>:
-; CHECK-LABEL: <$x.6>:
+; CHECK-LABEL: <$d>:
+; CHECK-LABEL: <$x>:
; CHECK-NEXT: b {{.*}} <test2+0x18>
define hidden i32 @test2() local_unnamed_addr {
%1 = load i32, ptr @l, align 4
@@ -70,10 +70,10 @@ define hidden i32 @test2() local_unnamed_addr {
}
; CHECK-LABEL: <test3>:
-; CHECK-LABEL: <$d.9>:
-; CHECK-LABEL: <$x.10>:
+; CHECK-LABEL: <$d>:
+; CHECK-LABEL: <$x>:
; CHECK-NEXT: b {{.*}} <test3+0x34>
-; CHECK-LABEL: <$x.12>:
+; CHECK-LABEL: <$x>:
; CHECK-NEXT: ldr x30, [sp], #16
; CHECK-NEXT: ret
define internal i1 @test3() {
diff --git a/llvm/test/CodeGen/AArch64/inlineasm-ldr-pseudo.ll b/llvm/test/CodeGen/AArch64/inlineasm-ldr-pseudo.ll
index f2b5e5f0064b7..f3623928d67bf 100644
--- a/llvm/test/CodeGen/AArch64/inlineasm-ldr-pseudo.ll
+++ b/llvm/test/CodeGen/AArch64/inlineasm-ldr-pseudo.ll
@@ -16,7 +16,7 @@ entry:
; CHECK: 58000040 ldr x0, 0x10
; CHECK: d65f03c0 ret
; Make sure the constant pool entry comes after the return
-; CHECK-LABEL: <$d.1>:
+; CHECK-LABEL: <$d>:
define i32 @bar() nounwind {
entry:
%0 = tail call i32 asm sideeffect "ldr $0,=0x10001", "=r"() nounwind
diff --git a/llvm/test/DebugInfo/Symbolize/ELF/aarch64-mapping-symbol.s b/llvm/test/DebugInfo/Symbolize/ELF/aarch64-mapping-symbol.s
index 2f1140cf62910..6990a82c4acfe 100644
--- a/llvm/test/DebugInfo/Symbolize/ELF/aarch64-mapping-symbol.s
+++ b/llvm/test/DebugInfo/Symbolize/ELF/aarch64-mapping-symbol.s
@@ -7,9 +7,9 @@
## addresses.
# RUN: llvm-nm --special-syms %t | FileCheck %s -check-prefix MAPPING_SYM
-# MAPPING_SYM: 0000000000000000 t $d.0
-# MAPPING_SYM-NEXT: 000000000000000c t $d.2
-# MAPPING_SYM-NEXT: 0000000000000004 t $x.1
+# MAPPING_SYM: 0000000000000000 t $d
+# MAPPING_SYM-NEXT: 000000000000000c t $d
+# MAPPING_SYM-NEXT: 0000000000000004 t $x
# MAPPING_SYM-NEXT: 0000000000000000 T foo
# RUN: llvm-symbolizer --obj=%t 0 4 0xc | FileCheck %s -check-prefix SYMBOL
diff --git a/llvm/test/MC/AArch64/CheckDataSymbol.s b/llvm/test/MC/AArch64/CheckDataSymbol.s
index baa1158984386..13d1db7da091b 100644
--- a/llvm/test/MC/AArch64/CheckDataSymbol.s
+++ b/llvm/test/MC/AArch64/CheckDataSymbol.s
@@ -1,7 +1,7 @@
# RUN: llvm-mc -filetype=obj -assemble \
# RUN: -triple=aarch64- %s -o - \
# RUN: | llvm-readobj -S --symbols - | FileCheck %s
-# CHECK: Name: $d.1 ({{[1-9][0-9]+}})
+# CHECK: Name: $d ({{[1-9][0-9]+}})
# CHECK-NEXT: Value: 0x4
# CHECK-NEXT: Size: 0
# CHECK-NEXT: Binding: Local (0x0)
diff --git a/llvm/test/MC/AArch64/mapping-across-sections.s b/llvm/test/MC/AArch64/mapping-across-sections.s
index 6bb5a8811b57d..f453c86d45fb6 100644
--- a/llvm/test/MC/AArch64/mapping-across-sections.s
+++ b/llvm/test/MC/AArch64/mapping-across-sections.s
@@ -1,4 +1,4 @@
-// RUN: llvm-mc -triple=aarch64 -filetype=obj %s | llvm-objdump -t - | FileCheck %s
+// RUN: llvm-mc -triple=aarch64 -filetype=obj %s | llvm-objdump -t - | FileCheck %s --match-full-lines
.section .text1,"ax"
add w0, w0, w0
@@ -28,13 +28,13 @@ add w0, w0, w0
.section ".note.GNU-stack","",@progbits
// CHECK: SYMBOL TABLE:
-// CHECK-NEXT: 0000000000000000 l .text1 0000000000000000 $x.0
-// CHECK-NEXT: 0000000000000000 l .text 0000000000000000 $x.1
-// CHECK-NEXT: 0000000000000004 l .text 0000000000000000 $d.2
-// CHECK-NEXT: 0000000000000000 l .data 0000000000000000 $d.3
-// CHECK-NEXT: 0000000000000008 l .text 0000000000000000 $x.4
-// CHECK-NEXT: 000000000000000c l .text 0000000000000000 $d.5
-// CHECK-NEXT: 0000000000000000 l .rodata 0000000000000000 $d.6
-// CHECK-NEXT: 0000000000000004 l .rodata 0000000000000000 $x.7
-// CHECK-NEXT: 0000000000000000 l .comment 0000000000000000 $d.8
+// CHECK-NEXT: 0000000000000000 l .text1 0000000000000000 $x
+// CHECK-NEXT: 0000000000000000 l .text 0000000000000000 $x
+// CHECK-NEXT: 0000000000000004 l .text 0000000000000000 $d
+// CHECK-NEXT: 0000000000000000 l .data 0000000000000000 $d
+// CHECK-NEXT: 0000000000000008 l .text 0000000000000000 $x
+// CHECK-NEXT: 000000000000000c l .text 0000000000000000 $d
+// CHECK-NEXT: 0000000000000000 l .rodata 0000000000000000 $d
+// CHECK-NEXT: 0000000000000004 l .rodata 0000000000000000 $x
+// CHECK-NEXT: 0000000000000000 l .comment 0000000000000000 $d
// CHECK-NOT: {{.}}
diff --git a/llvm/test/MC/AArch64/mapping-within-section.s b/llvm/test/MC/AArch64/mapping-within-section.s
index 07a2d3cc0fed9..c84e3a4d2fe64 100644
--- a/llvm/test/MC/AArch64/mapping-within-section.s
+++ b/llvm/test/MC/AArch64/mapping-within-section.s
@@ -1,4 +1,4 @@
-// RUN: llvm-mc -triple=aarch64-none-linux-gnu -filetype=obj %s | llvm-nm --special-syms - | FileCheck %s
+// RUN: llvm-mc -triple=aarch64-none-linux-gnu -filetype=obj %s | llvm-nm --no-sort --special-syms - | FileCheck %s --match-full-lines
.text
// $x at 0x0000
@@ -18,6 +18,13 @@
// $x at 0x0018
add x0, x0, x0
-// CHECK: 0000000000000004 t $d.1
-// CHECK-NEXT: 0000000000000000 t $x.0
-// CHECK-NEXT: 0000000000000064 t $x.2
+.globl $d
+$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: {{.}}
diff --git a/llvm/test/MC/AArch64/size-directive.s b/llvm/test/MC/AArch64/size-directive.s
index 0b19cda4eaa1e..d9bdf970cf68b 100644
--- a/llvm/test/MC/AArch64/size-directive.s
+++ b/llvm/test/MC/AArch64/size-directive.s
@@ -32,7 +32,7 @@ aarch64_size:
// CHECK-OBJ-NEXT: )
// SYMS: Type Bind Vis Ndx Name
-// SYMS: NOTYPE LOCAL DEFAULT 3 $d.0
+// SYMS: NOTYPE LOCAL DEFAULT 3 $d{{$}}
// SYMS-NEXT: FUNC GLOBAL DEFAULT 3 aarch64_size
// SYMS-NEXT: NOTYPE GLOBAL DEFAULT UND half_word
// SYMS-NEXT: NOTYPE GLOBAL DEFAULT UND full_word
diff --git a/llvm/test/MC/ELF/AArch64/cfi.s b/llvm/test/MC/ELF/AArch64/cfi.s
index 033c8d9c04094..6bdf03cc7bb85 100644
--- a/llvm/test/MC/ELF/AArch64/cfi.s
+++ b/llvm/test/MC/ELF/AArch64/cfi.s
@@ -227,7 +227,7 @@ f37:
.cfi_endproc
// CHECK: Section {
-// CHECK: Name: .eh_frame (20)
+// CHECK: Name: .eh_frame
// CHECK-NEXT: Type: SHT_PROGBITS (0x1)
// CHECK-NEXT: Flags [ (0x2)
// CHECK-NEXT: SHF_ALLOC (0x2)
@@ -355,7 +355,7 @@ f37:
// CHECK-NEXT: )
// CHECK-NEXT: }
// CHECK: Section {
-// CHECK: Name: .rela.eh_frame (15)
+// CHECK: Name: .rela.eh_frame
// CHECK-NEXT: Type: SHT_RELA (0x4)
// CHECK-NEXT: Flags [ (0x40)
// CHECK-NEXT: SHF_INFO_LINK (0x40)
diff --git a/llvm/test/tools/llvm-objdump/ELF/AArch64/elf-aarch64-mapping-symbols.test b/llvm/test/tools/llvm-objdump/ELF/AArch64/elf-aarch64-mapping-symbols.test
index cf24952a2d8d4..011e67cda8c32 100644
--- a/llvm/test/tools/llvm-objdump/ELF/AArch64/elf-aarch64-mapping-symbols.test
+++ b/llvm/test/tools/llvm-objdump/ELF/AArch64/elf-aarch64-mapping-symbols.test
@@ -4,11 +4,11 @@
# CHECK: Disassembly of section .mysection:
# CHECK-EMPTY:
-# ALL-NEXT: <$x.0>:
+# ALL-NEXT: <$x>:
# CHECK-NEXT: <_start>:
# CHECK-NEXT: 0: 10000021 adr x1, 0x4
# CHECK-EMPTY:
-# ALL-NEXT: <$d.1>:
+# ALL-NEXT: <$d>:
# CHECK-NEXT: <msg>:
# CHECK-NEXT: 4: 48 65 6c 6c .word
# CHECK-NEXT: 8: 6f 2c 20 77 .word
@@ -18,10 +18,10 @@
# CHECK-NEXT: Disassembly of section .myothersection:
# CHECK-EMPTY:
# NOALL-NEXT: <.myothersection>:
-# ALL-NEXT: <$x.2>:
+# ALL-NEXT: <$x>:
# CHECK-NEXT: 0: 90000001 adrp x1, 0x0
# CHECK-EMPTY:
-# ALL-NEXT: <$d.3>:
+# ALL-NEXT: <$d>:
# CHECK-NEXT: <mystr>:
# CHECK-NEXT: 4: 62 6c 61 68 .word
# CHECK-NEXT: 8: 9a .byte 0x9a
|
@llvm/pr-subscribers-backend-aarch64 Author: Fangrui Song (MaskRay) ChangesAdd Utilizing Full diff: https://github.com/llvm/llvm-project/pull/99836.diff 18 Files Affected:
diff --git a/lld/test/ELF/aarch64-cortex-a53-843419-abs-mapsyms.s b/lld/test/ELF/aarch64-cortex-a53-843419-abs-mapsyms.s
index 608b1aceb0a00..a9b95b1a63ef6 100644
--- a/lld/test/ELF/aarch64-cortex-a53-843419-abs-mapsyms.s
+++ b/lld/test/ELF/aarch64-cortex-a53-843419-abs-mapsyms.s
@@ -12,7 +12,7 @@
.type _start, %function
_start: ret
-// CHECK: Name: $x.0
+// CHECK: Name: $x
// CHECK-NEXT: Value: 0x0
// CHECK-NEXT: Size: 0
// CHECK-NEXT: Binding: Local (0x0)
diff --git a/lld/test/ELF/aarch64-gnu-ifunc.s b/lld/test/ELF/aarch64-gnu-ifunc.s
index d76b54eabf8a4..f39ae0cd84934 100644
--- a/lld/test/ELF/aarch64-gnu-ifunc.s
+++ b/lld/test/ELF/aarch64-gnu-ifunc.s
@@ -37,7 +37,7 @@
// CHECK-NEXT: Section: Undefined
// CHECK-NEXT: }
// CHECK-NEXT: Symbol {
-// CHECK-NEXT: Name: $x.0
+// CHECK-NEXT: Name: $x
// CHECK-NEXT: Value: 0x210188
// CHECK-NEXT: Size: 0
// CHECK-NEXT: Binding: Local
diff --git a/lld/test/ELF/aarch64-reloc-pauth.s b/lld/test/ELF/aarch64-reloc-pauth.s
index 19493fcfa1365..6b4d23d37babc 100644
--- a/lld/test/ELF/aarch64-reloc-pauth.s
+++ b/lld/test/ELF/aarch64-reloc-pauth.s
@@ -68,11 +68,11 @@
# RELR-EMPTY:
# RELR-NEXT: Relocation section '.relr.auth.dyn' at offset 0x[[ADDR2]] contains 5 entries:
# RELR-NEXT: Index: Entry Address Symbolic Address
-# RELR-NEXT: 0000: 0000000000030440 0000000000030440 $d.0
-# RELR-NEXT: 0001: 000000000000000f 0000000000030448 $d.0 + 0x8
-# RELR-NEXT: 0000000000030450 $d.0 + 0x10
-# RELR-NEXT: 0000000000030458 $d.0 + 0x18
-# RELR-NEXT: 0002: 0000000000030492 0000000000030492 $d.0 + 0x52
+# RELR-NEXT: 0000: 0000000000030440 0000000000030440 $d
+# RELR-NEXT: 0001: 000000000000000f 0000000000030448 $d + 0x8
+# RELR-NEXT: 0000000000030450 $d + 0x10
+# RELR-NEXT: 0000000000030458 $d + 0x18
+# RELR-NEXT: 0002: 0000000000030492 0000000000030492 $d + 0x52
# HEX: Hex dump of section '.test':
# HEX-NEXT: 0x00030440 01000000 2a000020 42040300 2b000000
@@ -201,7 +201,7 @@
# EMPTY-RELA-EMPTY:
# EMPTY-RELA-NEXT: Relocation section '.relr.auth.dyn' at offset {{.+}} contains 1 entries:
# EMPTY-RELA-NEXT: Index: Entry Address Symbolic Address
-# EMPTY-RELA-NEXT: 0000: 0000000000030310 0000000000030310 $d.0
+# EMPTY-RELA-NEXT: 0000: 0000000000030310 0000000000030310 $d
# EMPTY-RELA-RO-NOT: .rela.dyn
diff --git a/lld/test/ELF/aarch64-thunk-script.s b/lld/test/ELF/aarch64-thunk-script.s
index 08ff4e9871180..a6c524f548288 100644
--- a/lld/test/ELF/aarch64-thunk-script.s
+++ b/lld/test/ELF/aarch64-thunk-script.s
@@ -43,8 +43,8 @@ high_target:
// CHECK-NEXT: ret
/// Local symbols copied from %t.o
-// NM: t $x.0
-// NM-NEXT: t $x.1
+// NM: t $x
+// NM-NEXT: t $x
/// Local thunk symbols.
// NM-NEXT: t __AArch64AbsLongThunk_high_target
// NM-NEXT: t $x
diff --git a/lld/test/ELF/basic-aarch64.s b/lld/test/ELF/basic-aarch64.s
index 6b109e8da2c3e..1f59d33c4230b 100644
--- a/lld/test/ELF/basic-aarch64.s
+++ b/lld/test/ELF/basic-aarch64.s
@@ -119,7 +119,7 @@ _start:
# CHECK-NEXT: ]
# CHECK-NEXT: Address: 0x0
# CHECK-NEXT: Offset: 0x1AA
-# CHECK-NEXT: Size: 13
+# CHECK-NEXT: Size: 11
# CHECK-NEXT: Link: 0
# CHECK-NEXT: Info: 0
# CHECK-NEXT: AddressAlignment: 1
@@ -189,7 +189,7 @@ _start:
# CHECK-NEXT: Section: Undefined (0x0)
# CHECK-NEXT: }
# CHECK-NEXT: Symbol {
-# CHECK-NEXT: Name: $x.0
+# CHECK-NEXT: Name: $x
# CHECK-NEXT: Value: 0x210120
# CHECK-NEXT: Size: 0
# CHECK-NEXT: Binding: Local (0x0)
diff --git a/lld/test/ELF/pack-dyn-relocs.s b/lld/test/ELF/pack-dyn-relocs.s
index 3cbba68716972..dd18c92c7352e 100644
--- a/lld/test/ELF/pack-dyn-relocs.s
+++ b/lld/test/ELF/pack-dyn-relocs.s
@@ -264,30 +264,30 @@
// RELR64-EMPTY:
// RELR64-NEXT: Relocation section '.relr.dyn' at offset {{.*}} contains 24 entries:
// RELR64-NEXT: Symbolic Address
-// RELR64-NEXT: $d.0{{$}}
-// RELR64-NEXT: $d.0 + 0x8
-// RELR64-NEXT: $d.0 + 0x10
-// RELR64-NEXT: $d.0 + 0x18
-// RELR64-NEXT: $d.0 + 0x20
-// RELR64-NEXT: $d.0 + 0x28
-// RELR64-NEXT: $d.0 + 0x30
-// RELR64-NEXT: $d.0 + 0x38
-// RELR64-NEXT: $d.0 + 0x48
-// RELR64-NEXT: $d.0 + 0x50
-// RELR64-NEXT: $d.0 + 0x58
-// RELR64-NEXT: $d.0 + 0x60
-// RELR64-NEXT: $d.0 + 0x68
-// RELR64-NEXT: $d.0 + 0x70
-// RELR64-NEXT: $d.0 + 0x78
-// RELR64-NEXT: $d.0 + 0x90
-// RELR64-NEXT: $d.0 + 0x98
-// RELR64-NEXT: $d.0 + 0xa0
-// RELR64-NEXT: $d.0 + 0xa8
-// RELR64-NEXT: $d.0 + 0xb0
-// RELR64-NEXT: $d.0 + 0xb8
-// RELR64-NEXT: $d.0 + 0xc0
-// RELR64-NEXT: $d.0 + 0xc8
-// RELR64-NEXT: $d.0 + 0xd0
+// RELR64-NEXT: $d{{$}}
+// RELR64-NEXT: $d + 0x8
+// RELR64-NEXT: $d + 0x10
+// RELR64-NEXT: $d + 0x18
+// RELR64-NEXT: $d + 0x20
+// RELR64-NEXT: $d + 0x28
+// RELR64-NEXT: $d + 0x30
+// RELR64-NEXT: $d + 0x38
+// RELR64-NEXT: $d + 0x48
+// RELR64-NEXT: $d + 0x50
+// RELR64-NEXT: $d + 0x58
+// RELR64-NEXT: $d + 0x60
+// RELR64-NEXT: $d + 0x68
+// RELR64-NEXT: $d + 0x70
+// RELR64-NEXT: $d + 0x78
+// RELR64-NEXT: $d + 0x90
+// RELR64-NEXT: $d + 0x98
+// RELR64-NEXT: $d + 0xa0
+// RELR64-NEXT: $d + 0xa8
+// RELR64-NEXT: $d + 0xb0
+// RELR64-NEXT: $d + 0xb8
+// RELR64-NEXT: $d + 0xc0
+// RELR64-NEXT: $d + 0xc8
+// RELR64-NEXT: $d + 0xd0
// RELR64-EMPTY:
// RELR64-NEXT: Hex dump of section '.data':
// RELR64-NEXT: 0x00030490 90040300 00000000 91040300 00000000 .
diff --git a/llvm/include/llvm/MC/MCContext.h b/llvm/include/llvm/MC/MCContext.h
index 73fe6361cb866..b59a2ca88eff1 100644
--- a/llvm/include/llvm/MC/MCContext.h
+++ b/llvm/include/llvm/MC/MCContext.h
@@ -468,6 +468,10 @@ class MCContext {
/// true, behaves like getOrCreateSymbol, prefixed with PrivateLabelPrefix.
MCSymbol *createBlockSymbol(const Twine &Name, bool AlwaysEmit = false);
+ /// Create a local, non-temporary symbol like an ELF mapping symbol. Calling
+ /// the function with the same name will generate new, unique instances.
+ MCSymbol *createLocalSymbol(StringRef Name);
+
/// Create the definition of a directional local symbol for numbered label
/// (used for "1:" definitions).
MCSymbol *createDirectionalLocalSymbol(unsigned LocalLabelVal);
diff --git a/llvm/lib/MC/MCContext.cpp b/llvm/lib/MC/MCContext.cpp
index 2fe8369016440..58a580643d7ad 100644
--- a/llvm/lib/MC/MCContext.cpp
+++ b/llvm/lib/MC/MCContext.cpp
@@ -349,6 +349,11 @@ MCSymbol *MCContext::createNamedTempSymbol() {
return createNamedTempSymbol("tmp");
}
+MCSymbol *MCContext::createLocalSymbol(StringRef Name) {
+ MCSymbolTableEntry &NameEntry = getSymbolTableEntry(Name);
+ return createSymbolImpl(&NameEntry, /*IsTemporary=*/false);
+}
+
unsigned MCContext::NextInstance(unsigned LocalLabelVal) {
MCLabel *&Label = Instances[LocalLabelVal];
if (!Label)
diff --git a/llvm/lib/Target/AArch64/MCTargetDesc/AArch64ELFStreamer.cpp b/llvm/lib/Target/AArch64/MCTargetDesc/AArch64ELFStreamer.cpp
index 27751633017ca..b639e2f6eb17f 100644
--- a/llvm/lib/Target/AArch64/MCTargetDesc/AArch64ELFStreamer.cpp
+++ b/llvm/lib/Target/AArch64/MCTargetDesc/AArch64ELFStreamer.cpp
@@ -271,8 +271,7 @@ class AArch64ELFStreamer : public MCELFStreamer {
}
void emitMappingSymbol(StringRef Name) {
- auto *Symbol = cast<MCSymbolELF>(getContext().getOrCreateSymbol(
- Name + "." + Twine(MappingSymbolCounter++)));
+ auto *Symbol = cast<MCSymbolELF>(getContext().createLocalSymbol(Name));
emitLabel(Symbol);
Symbol->setType(ELF::STT_NOTYPE);
Symbol->setBinding(ELF::STB_LOCAL);
diff --git a/llvm/test/CodeGen/AArch64/callbr-asm-obj-file.ll b/llvm/test/CodeGen/AArch64/callbr-asm-obj-file.ll
index e601f03d524a4..8b6740667a229 100644
--- a/llvm/test/CodeGen/AArch64/callbr-asm-obj-file.ll
+++ b/llvm/test/CodeGen/AArch64/callbr-asm-obj-file.ll
@@ -7,10 +7,10 @@
@l = common hidden local_unnamed_addr global i32 0, align 4
; CHECK-LABEL: <test1>:
-; CHECK-LABEL: <$d.1>:
-; CHECK-LABEL: <$x.2>:
+; CHECK-LABEL: <$d>:
+; CHECK-LABEL: <$x>:
; CHECK-NEXT: b 0x2c <test1+0x2c>
-; CHECK-LABEL: <$x.4>:
+; CHECK-LABEL: <$x>:
; CHECK-NEXT: mov w0, wzr
; CHECK-NEXT: ldr x30, [sp], #16
; CHECK-NEXT: ret
@@ -41,8 +41,8 @@ declare dso_local i32 @i(...) local_unnamed_addr
; CHECK-LABEL: <test2>:
; CHECK: b {{.*}} <test2+0x1c>
-; CHECK-LABEL: <$d.5>:
-; CHECK-LABEL: <$x.6>:
+; CHECK-LABEL: <$d>:
+; CHECK-LABEL: <$x>:
; CHECK-NEXT: b {{.*}} <test2+0x18>
define hidden i32 @test2() local_unnamed_addr {
%1 = load i32, ptr @l, align 4
@@ -70,10 +70,10 @@ define hidden i32 @test2() local_unnamed_addr {
}
; CHECK-LABEL: <test3>:
-; CHECK-LABEL: <$d.9>:
-; CHECK-LABEL: <$x.10>:
+; CHECK-LABEL: <$d>:
+; CHECK-LABEL: <$x>:
; CHECK-NEXT: b {{.*}} <test3+0x34>
-; CHECK-LABEL: <$x.12>:
+; CHECK-LABEL: <$x>:
; CHECK-NEXT: ldr x30, [sp], #16
; CHECK-NEXT: ret
define internal i1 @test3() {
diff --git a/llvm/test/CodeGen/AArch64/inlineasm-ldr-pseudo.ll b/llvm/test/CodeGen/AArch64/inlineasm-ldr-pseudo.ll
index f2b5e5f0064b7..f3623928d67bf 100644
--- a/llvm/test/CodeGen/AArch64/inlineasm-ldr-pseudo.ll
+++ b/llvm/test/CodeGen/AArch64/inlineasm-ldr-pseudo.ll
@@ -16,7 +16,7 @@ entry:
; CHECK: 58000040 ldr x0, 0x10
; CHECK: d65f03c0 ret
; Make sure the constant pool entry comes after the return
-; CHECK-LABEL: <$d.1>:
+; CHECK-LABEL: <$d>:
define i32 @bar() nounwind {
entry:
%0 = tail call i32 asm sideeffect "ldr $0,=0x10001", "=r"() nounwind
diff --git a/llvm/test/DebugInfo/Symbolize/ELF/aarch64-mapping-symbol.s b/llvm/test/DebugInfo/Symbolize/ELF/aarch64-mapping-symbol.s
index 2f1140cf62910..6990a82c4acfe 100644
--- a/llvm/test/DebugInfo/Symbolize/ELF/aarch64-mapping-symbol.s
+++ b/llvm/test/DebugInfo/Symbolize/ELF/aarch64-mapping-symbol.s
@@ -7,9 +7,9 @@
## addresses.
# RUN: llvm-nm --special-syms %t | FileCheck %s -check-prefix MAPPING_SYM
-# MAPPING_SYM: 0000000000000000 t $d.0
-# MAPPING_SYM-NEXT: 000000000000000c t $d.2
-# MAPPING_SYM-NEXT: 0000000000000004 t $x.1
+# MAPPING_SYM: 0000000000000000 t $d
+# MAPPING_SYM-NEXT: 000000000000000c t $d
+# MAPPING_SYM-NEXT: 0000000000000004 t $x
# MAPPING_SYM-NEXT: 0000000000000000 T foo
# RUN: llvm-symbolizer --obj=%t 0 4 0xc | FileCheck %s -check-prefix SYMBOL
diff --git a/llvm/test/MC/AArch64/CheckDataSymbol.s b/llvm/test/MC/AArch64/CheckDataSymbol.s
index baa1158984386..13d1db7da091b 100644
--- a/llvm/test/MC/AArch64/CheckDataSymbol.s
+++ b/llvm/test/MC/AArch64/CheckDataSymbol.s
@@ -1,7 +1,7 @@
# RUN: llvm-mc -filetype=obj -assemble \
# RUN: -triple=aarch64- %s -o - \
# RUN: | llvm-readobj -S --symbols - | FileCheck %s
-# CHECK: Name: $d.1 ({{[1-9][0-9]+}})
+# CHECK: Name: $d ({{[1-9][0-9]+}})
# CHECK-NEXT: Value: 0x4
# CHECK-NEXT: Size: 0
# CHECK-NEXT: Binding: Local (0x0)
diff --git a/llvm/test/MC/AArch64/mapping-across-sections.s b/llvm/test/MC/AArch64/mapping-across-sections.s
index 6bb5a8811b57d..f453c86d45fb6 100644
--- a/llvm/test/MC/AArch64/mapping-across-sections.s
+++ b/llvm/test/MC/AArch64/mapping-across-sections.s
@@ -1,4 +1,4 @@
-// RUN: llvm-mc -triple=aarch64 -filetype=obj %s | llvm-objdump -t - | FileCheck %s
+// RUN: llvm-mc -triple=aarch64 -filetype=obj %s | llvm-objdump -t - | FileCheck %s --match-full-lines
.section .text1,"ax"
add w0, w0, w0
@@ -28,13 +28,13 @@ add w0, w0, w0
.section ".note.GNU-stack","",@progbits
// CHECK: SYMBOL TABLE:
-// CHECK-NEXT: 0000000000000000 l .text1 0000000000000000 $x.0
-// CHECK-NEXT: 0000000000000000 l .text 0000000000000000 $x.1
-// CHECK-NEXT: 0000000000000004 l .text 0000000000000000 $d.2
-// CHECK-NEXT: 0000000000000000 l .data 0000000000000000 $d.3
-// CHECK-NEXT: 0000000000000008 l .text 0000000000000000 $x.4
-// CHECK-NEXT: 000000000000000c l .text 0000000000000000 $d.5
-// CHECK-NEXT: 0000000000000000 l .rodata 0000000000000000 $d.6
-// CHECK-NEXT: 0000000000000004 l .rodata 0000000000000000 $x.7
-// CHECK-NEXT: 0000000000000000 l .comment 0000000000000000 $d.8
+// CHECK-NEXT: 0000000000000000 l .text1 0000000000000000 $x
+// CHECK-NEXT: 0000000000000000 l .text 0000000000000000 $x
+// CHECK-NEXT: 0000000000000004 l .text 0000000000000000 $d
+// CHECK-NEXT: 0000000000000000 l .data 0000000000000000 $d
+// CHECK-NEXT: 0000000000000008 l .text 0000000000000000 $x
+// CHECK-NEXT: 000000000000000c l .text 0000000000000000 $d
+// CHECK-NEXT: 0000000000000000 l .rodata 0000000000000000 $d
+// CHECK-NEXT: 0000000000000004 l .rodata 0000000000000000 $x
+// CHECK-NEXT: 0000000000000000 l .comment 0000000000000000 $d
// CHECK-NOT: {{.}}
diff --git a/llvm/test/MC/AArch64/mapping-within-section.s b/llvm/test/MC/AArch64/mapping-within-section.s
index 07a2d3cc0fed9..c84e3a4d2fe64 100644
--- a/llvm/test/MC/AArch64/mapping-within-section.s
+++ b/llvm/test/MC/AArch64/mapping-within-section.s
@@ -1,4 +1,4 @@
-// RUN: llvm-mc -triple=aarch64-none-linux-gnu -filetype=obj %s | llvm-nm --special-syms - | FileCheck %s
+// RUN: llvm-mc -triple=aarch64-none-linux-gnu -filetype=obj %s | llvm-nm --no-sort --special-syms - | FileCheck %s --match-full-lines
.text
// $x at 0x0000
@@ -18,6 +18,13 @@
// $x at 0x0018
add x0, x0, x0
-// CHECK: 0000000000000004 t $d.1
-// CHECK-NEXT: 0000000000000000 t $x.0
-// CHECK-NEXT: 0000000000000064 t $x.2
+.globl $d
+$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: {{.}}
diff --git a/llvm/test/MC/AArch64/size-directive.s b/llvm/test/MC/AArch64/size-directive.s
index 0b19cda4eaa1e..d9bdf970cf68b 100644
--- a/llvm/test/MC/AArch64/size-directive.s
+++ b/llvm/test/MC/AArch64/size-directive.s
@@ -32,7 +32,7 @@ aarch64_size:
// CHECK-OBJ-NEXT: )
// SYMS: Type Bind Vis Ndx Name
-// SYMS: NOTYPE LOCAL DEFAULT 3 $d.0
+// SYMS: NOTYPE LOCAL DEFAULT 3 $d{{$}}
// SYMS-NEXT: FUNC GLOBAL DEFAULT 3 aarch64_size
// SYMS-NEXT: NOTYPE GLOBAL DEFAULT UND half_word
// SYMS-NEXT: NOTYPE GLOBAL DEFAULT UND full_word
diff --git a/llvm/test/MC/ELF/AArch64/cfi.s b/llvm/test/MC/ELF/AArch64/cfi.s
index 033c8d9c04094..6bdf03cc7bb85 100644
--- a/llvm/test/MC/ELF/AArch64/cfi.s
+++ b/llvm/test/MC/ELF/AArch64/cfi.s
@@ -227,7 +227,7 @@ f37:
.cfi_endproc
// CHECK: Section {
-// CHECK: Name: .eh_frame (20)
+// CHECK: Name: .eh_frame
// CHECK-NEXT: Type: SHT_PROGBITS (0x1)
// CHECK-NEXT: Flags [ (0x2)
// CHECK-NEXT: SHF_ALLOC (0x2)
@@ -355,7 +355,7 @@ f37:
// CHECK-NEXT: )
// CHECK-NEXT: }
// CHECK: Section {
-// CHECK: Name: .rela.eh_frame (15)
+// CHECK: Name: .rela.eh_frame
// CHECK-NEXT: Type: SHT_RELA (0x4)
// CHECK-NEXT: Flags [ (0x40)
// CHECK-NEXT: SHF_INFO_LINK (0x40)
diff --git a/llvm/test/tools/llvm-objdump/ELF/AArch64/elf-aarch64-mapping-symbols.test b/llvm/test/tools/llvm-objdump/ELF/AArch64/elf-aarch64-mapping-symbols.test
index cf24952a2d8d4..011e67cda8c32 100644
--- a/llvm/test/tools/llvm-objdump/ELF/AArch64/elf-aarch64-mapping-symbols.test
+++ b/llvm/test/tools/llvm-objdump/ELF/AArch64/elf-aarch64-mapping-symbols.test
@@ -4,11 +4,11 @@
# CHECK: Disassembly of section .mysection:
# CHECK-EMPTY:
-# ALL-NEXT: <$x.0>:
+# ALL-NEXT: <$x>:
# CHECK-NEXT: <_start>:
# CHECK-NEXT: 0: 10000021 adr x1, 0x4
# CHECK-EMPTY:
-# ALL-NEXT: <$d.1>:
+# ALL-NEXT: <$d>:
# CHECK-NEXT: <msg>:
# CHECK-NEXT: 4: 48 65 6c 6c .word
# CHECK-NEXT: 8: 6f 2c 20 77 .word
@@ -18,10 +18,10 @@
# CHECK-NEXT: Disassembly of section .myothersection:
# CHECK-EMPTY:
# NOALL-NEXT: <.myothersection>:
-# ALL-NEXT: <$x.2>:
+# ALL-NEXT: <$x>:
# CHECK-NEXT: 0: 90000001 adrp x1, 0x0
# CHECK-EMPTY:
-# ALL-NEXT: <$d.3>:
+# ALL-NEXT: <$d>:
# CHECK-NEXT: <mystr>:
# CHECK-NEXT: 4: 62 6c 61 68 .word
# CHECK-NEXT: 8: 9a .byte 0x9a
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, this now matches the behavior of GNU as.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think MappingSymbolCounter can be removed now, otherwise LGTM.
@@ -271,8 +271,7 @@ class AArch64ELFStreamer : public MCELFStreamer { | |||
} | |||
|
|||
void emitMappingSymbol(StringRef Name) { | |||
auto *Symbol = cast<MCSymbolELF>(getContext().getOrCreateSymbol( | |||
Name + "." + Twine(MappingSymbolCounter++))); | |||
auto *Symbol = cast<MCSymbolELF>(getContext().createLocalSymbol(Name)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the removed code is the only use for MappingSymbolCounter, can it be removed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed by the second commit. Thanks
Similar to #99836 for AArch64. Non-unique names save .strtab space and match GNU assembler.
Similar to llvm#99836 for AArch64. Non-unique names save .strtab space and match GNU assembler. Pull Request: llvm#99906 (cherry picked from commit 298a922)
Similar to llvm#99836 for AArch64. Non-unique names save .strtab space and match GNU assembler. Pull Request: llvm#99906 (cherry picked from commit 298a922)
Summary: Add `createLocalSymbol` to create a local, non-temporary symbol. Different from `createRenamableSymbol`, the `Used` bit is ignored, therefore multiple local symbols might share the same name. Utilizing `createLocalSymbol` in AArch64 allows for efficient mapping symbol creation with non-unique names, saving .strtab space. The behavior matches GNU assembler. Pull Request: #99836 Test Plan: Reviewers: Subscribers: Tasks: Tags: Differential Revision: https://phabricator.intern.facebook.com/D60251331
Summary: Similar to #99836 for AArch64. Non-unique names save .strtab space and match GNU assembler. Pull Request: #99903 Test Plan: Reviewers: Subscribers: Tasks: Tags: Differential Revision: https://phabricator.intern.facebook.com/D60251462
Similar to #99836 for AArch64. Non-unique names save .strtab space and match GNU assembler.
Add
createLocalSymbol
to create a local, non-temporary symbol.Different from
createRenamableSymbol
, theUsed
bit is ignored,therefore multiple local symbols might share the same name.
Utilizing
createLocalSymbol
in AArch64 allows for efficient mappingsymbol creation with non-unique names, saving .strtab space.
The behavior matches GNU assembler.