aboutsummaryrefslogtreecommitdiff
path: root/gas
diff options
context:
space:
mode:
authorLulu Cai <cailulu@loongson.cn>2025-08-26 17:19:47 +0800
committercailulu <cailulu@loongson.cn>2025-09-02 11:02:33 +0800
commit5c5e1e38a40083b695dd1e21c6d103a3c8e8a5ed (patch)
tree6167000ffc873120c27091ca1e33ae40bf4dde31 /gas
parentcb6580810b936c617eb36a94e1b851772d845228 (diff)
downloadbinutils-master.zip
binutils-master.tar.gz
binutils-master.tar.bz2
LoongArch: Fix incorrect display of FDEs address ranges when using objdump -WfHEADmaster
When parsing FDEs in `.eh_frame` using `objdump -Wf`, it is necessary to resolve `BFD_RELOC_LARCH_32_PCREL` to determine the address ranges of the FDEs. Set the `pcrel_offset` field of `BFD_RELOC_LARCH_32_PCREL` to help `objdump` correctly compute the address ranges of the FDEs. Apply the same modification to BFD_RELOC_LARCH_64_PCREL.
Diffstat (limited to 'gas')
-rw-r--r--gas/testsuite/gas/loongarch/dwarf-regnum.d2
-rw-r--r--gas/testsuite/gas/loongarch/frame_pc.d22
-rw-r--r--gas/testsuite/gas/loongarch/frame_pc.s20
3 files changed, 43 insertions, 1 deletions
diff --git a/gas/testsuite/gas/loongarch/dwarf-regnum.d b/gas/testsuite/gas/loongarch/dwarf-regnum.d
index 41956b1..bb8bacc 100644
--- a/gas/testsuite/gas/loongarch/dwarf-regnum.d
+++ b/gas/testsuite/gas/loongarch/dwarf-regnum.d
@@ -14,7 +14,7 @@ Contents of the .*:
Augmentation data: .*
#...
[a-zA-Z0-9]+ [a-zA-Z0-9]+ [a-zA-Z0-9]+ FDE cie=0+ pc=[a-zA-Z0-9]+\.\.[a-zA-Z0-9]+
- DW_CFA_advance_loc: 4 to 0+20
+ DW_CFA_advance_loc: 4 to 0+4
DW_CFA_offset_extended_sf: r0 \(\$zero\) at cfa\+8
DW_CFA_offset_extended_sf: r1 \(\$ra\) at cfa\+16
DW_CFA_offset_extended_sf: r2 \(\$tp\) at cfa\+24
diff --git a/gas/testsuite/gas/loongarch/frame_pc.d b/gas/testsuite/gas/loongarch/frame_pc.d
new file mode 100644
index 0000000..7bd862b
--- /dev/null
+++ b/gas/testsuite/gas/loongarch/frame_pc.d
@@ -0,0 +1,22 @@
+#objdump: -Wf -d -M no-aliases
+#skip: loongarch32-*-*
+
+.*: file format .*
+
+Contents of the .eh_frame section:
+#...
+00000014 0000000000000020 00000018 FDE cie=00000000 pc=0000000000000000..0000000000000020
+ DW_CFA_advance_loc: 4 to 0000000000000004
+#...
+
+Disassembly of section .text:
+
+0+0 <_start>:
+ 0: 02ffc063 addi.d \$sp, \$sp, -16
+ 4: 29c02076 st.d \$fp, \$sp, 8
+ 8: 02c04076 addi.d \$fp, \$sp, 16
+ c: 0015000c or \$t0, \$zero, \$zero
+ 10: 00150184 or \$a0, \$t0, \$zero
+ 14: 28c02076 ld.d \$fp, \$sp, 8
+ 18: 02c04063 addi.d \$sp, \$sp, 16
+ 1c: 4c000020 jirl \$zero, \$ra, 0
diff --git a/gas/testsuite/gas/loongarch/frame_pc.s b/gas/testsuite/gas/loongarch/frame_pc.s
new file mode 100644
index 0000000..8344d73
--- /dev/null
+++ b/gas/testsuite/gas/loongarch/frame_pc.s
@@ -0,0 +1,20 @@
+ .align 2
+ .globl _start
+ .type _start, @function
+_start:
+ .cfi_startproc
+ addi.d $sp,$sp,-16
+ .cfi_def_cfa_offset 16
+ st.d $fp,$sp,8
+ .cfi_offset 22, -8
+ addi.d $fp,$sp,16
+ .cfi_def_cfa 22, 0
+ or $t0,$zero,$zero
+ or $a0,$t0,$zero
+ ld.d $fp,$sp,8
+ .cfi_restore 22
+ addi.d $sp,$sp,16
+ .cfi_def_cfa_register 3
+ jr $ra
+ .cfi_endproc
+ .size _start, .-_start