diff options
author | mengqinggang <mengqinggang@loongson.cn> | 2024-03-19 21:09:12 +0800 |
---|---|---|
committer | liuzhensong <liuzhensong@loongson.cn> | 2024-04-01 09:38:17 +0800 |
commit | 7918b183ec7844b7d54a2164a177898e2db59f2e (patch) | |
tree | aaf4dc118d2d7b9a3ec74c4450e124aea753ae60 /ld | |
parent | 4dae2621e0ab112bb2d6764f34253de0f4a181d0 (diff) | |
download | gdb-7918b183ec7844b7d54a2164a177898e2db59f2e.zip gdb-7918b183ec7844b7d54a2164a177898e2db59f2e.tar.gz gdb-7918b183ec7844b7d54a2164a177898e2db59f2e.tar.bz2 |
LoongArch: gas: Ignore .align if it is at the start of a section
Ignore .align if it is at the start of a section and the alignment
can be divided by the section alignment, the section alignment
can ensure this .align has a correct alignment.
Diffstat (limited to 'ld')
-rw-r--r-- | ld/testsuite/ld-loongarch-elf/relax-align-first.d | 15 | ||||
-rw-r--r-- | ld/testsuite/ld-loongarch-elf/relax-align-first.s | 13 | ||||
-rw-r--r-- | ld/testsuite/ld-loongarch-elf/relax.exp | 1 |
3 files changed, 29 insertions, 0 deletions
diff --git a/ld/testsuite/ld-loongarch-elf/relax-align-first.d b/ld/testsuite/ld-loongarch-elf/relax-align-first.d new file mode 100644 index 0000000..9a4fad8 --- /dev/null +++ b/ld/testsuite/ld-loongarch-elf/relax-align-first.d @@ -0,0 +1,15 @@ +#ld: -e0 +#objdump: -d + +.*:[ ]+file format .* + + +Disassembly of section aaa: +0000000120000078 <aaa>: +[ ]+120000078:[ ]+4c000020[ ]+ret +Disassembly of section bbb: +0000000120000080 <bbb>: +[ ]+120000080:[ ]+4c000020[ ]+ret +Disassembly of section ccc: +0000000120000090 <__bss_start-0x4004>: +[ ]+120000090:[ ]+4c000020[ ]+ret diff --git a/ld/testsuite/ld-loongarch-elf/relax-align-first.s b/ld/testsuite/ld-loongarch-elf/relax-align-first.s new file mode 100644 index 0000000..0a9115b --- /dev/null +++ b/ld/testsuite/ld-loongarch-elf/relax-align-first.s @@ -0,0 +1,13 @@ +# If .align at the start of a section, do not add NOP instructions +# and do not emit R_LARCH_ALIGN relocations. +# Section alignment can ensure correct alignment. +.section "aaa", "ax" +ret + +.section "bbb", "ax" +.align 3 +ret + +.section "ccc", "ax" +.align 4, ,4 +ret diff --git a/ld/testsuite/ld-loongarch-elf/relax.exp b/ld/testsuite/ld-loongarch-elf/relax.exp index ed71fb4..2345214 100644 --- a/ld/testsuite/ld-loongarch-elf/relax.exp +++ b/ld/testsuite/ld-loongarch-elf/relax.exp @@ -20,6 +20,7 @@ # if [istarget loongarch64-*-*] { + run_dump_test "relax-align-first" if [isbuild loongarch64-*-*] { set testname "loongarch relax .exe build" |