[llvm] [AArch64, ELF] Allow implicit $d/$x at section beginning (PR #99718)
Peter Smith via llvm-commits
llvm-commits at lists.llvm.org
Wed Aug 21 08:48:48 PDT 2024
================
@@ -0,0 +1,45 @@
+# REQUIRES: aarch64
+# RUN: llvm-mc -filetype=obj -triple=aarch64 -implicit-mapsyms %s -o %t.o
+# RUN: ld.lld %t.o -z keep-text-section-prefix -o %t
+# RUN: llvm-objdump -d --no-print-imm-hex --show-all-symbols %t | FileCheck %s
+
+# CHECK: <_start>:
+# CHECK-NEXT: nop
+# CHECK-EMPTY:
+# CHECK-NEXT: <$d>:
+# CHECK-NEXT: .word 0x0000002a
+# CHECK-EMPTY:
+# CHECK-NEXT: <$x>:
+# CHECK-NEXT: nop
+# CHECK-EMPTY:
+# CHECK-NEXT: Disassembly of section .text.hot:
+# CHECK-EMPTY:
+# CHECK-NEXT: <.text.hot>:
+# CHECK-NEXT: nop
+# CHECK-EMPTY:
+# CHECK-NEXT: <$d>:
+# CHECK-NEXT: .word 0x0000002a
+# CHECK-EMPTY:
+# CHECK-NEXT: <$d>:
+# CHECK-NEXT: <$x>:
+# CHECK-NEXT: udf #42
----------------
smithp35 wrote:
This points at an issue in llvm-objdump. It could be sorting symbols at the same address by name.
Looking at `llvm-readelf --symbols` for 0x201134 I can see $x before $d as we would expect, however llvm-objdump has put the $d before $x.
```
Symbol table '.symtab' contains 8 entries:
Num: Value Size Type Bind Vis Ndx Name
0: 0000000000000000 0 NOTYPE LOCAL DEFAULT UND
1: 0000000000210124 0 NOTYPE LOCAL DEFAULT 1 $d
2: 0000000000210128 0 NOTYPE LOCAL DEFAULT 1 $x
3: 0000000000210130 0 NOTYPE LOCAL DEFAULT 2 $d
4: 0000000000210134 0 NOTYPE LOCAL DEFAULT 2 $x
5: 0000000000210134 0 NOTYPE LOCAL DEFAULT 2 $d
6: 0000000000210138 0 NOTYPE LOCAL DEFAULT 2 $x
7: 0000000000210120 0 NOTYPE GLOBAL DEFAULT 1 _start
```
This is unfortunate as it means every trailing `$x` is going to result in an incorrect disassembly when there's a leading `$d`.
https://github.com/llvm/llvm-project/pull/99718
More information about the llvm-commits
mailing list