diff options
author | mengqinggang <mengqinggang@loongson.cn> | 2023-12-08 15:15:50 +0800 |
---|---|---|
committer | liuzhensong <liuzhensong@loongson.cn> | 2023-12-22 14:20:18 +0800 |
commit | c3d507aba3ec2c9b3f9aa105a01cf80ecc0b8c9b (patch) | |
tree | 46b9a5155634c7e2122319f6adeba51d6ded0c03 /ld | |
parent | 866a2ad35b75cbc60260c00b82bec2243877355f (diff) | |
download | gdb-c3d507aba3ec2c9b3f9aa105a01cf80ecc0b8c9b.zip gdb-c3d507aba3ec2c9b3f9aa105a01cf80ecc0b8c9b.tar.gz gdb-c3d507aba3ec2c9b3f9aa105a01cf80ecc0b8c9b.tar.bz2 |
LoongArch: Add support for the third expression of .align for R_LARCH_ALIGN
If the symbol index is not zero, the addend is used to represent
the first and the third expressions of the .align.
The lowest 8 bits are used to represent the first expression.
Other bits are used to represent the third expression.
The addend of R_LARCH_ALIGN for ".align 5, ,4" is 0x405.
The addend of R_LARCH_ALIGN for ".balign 32, ,4" is 0x405.
Diffstat (limited to 'ld')
-rw-r--r-- | ld/testsuite/ld-elf/anno-sym.d | 2 | ||||
-rw-r--r-- | ld/testsuite/ld-loongarch-elf/anno-sym.d | 7 | ||||
-rw-r--r-- | ld/testsuite/ld-loongarch-elf/anno-sym.l | 4 | ||||
-rw-r--r-- | ld/testsuite/ld-loongarch-elf/anno-sym.s | 13 | ||||
-rw-r--r-- | ld/testsuite/ld-loongarch-elf/ld-loongarch-elf.exp | 1 | ||||
-rw-r--r-- | ld/testsuite/ld-loongarch-elf/relax-align.dd | 5 | ||||
-rw-r--r-- | ld/testsuite/ld-loongarch-elf/relax-align.s | 5 | ||||
-rw-r--r-- | ld/testsuite/ld-loongarch-elf/relax.exp | 2 |
8 files changed, 35 insertions, 4 deletions
diff --git a/ld/testsuite/ld-elf/anno-sym.d b/ld/testsuite/ld-elf/anno-sym.d index 9e53c4a..f1ce21f 100644 --- a/ld/testsuite/ld-elf/anno-sym.d +++ b/ld/testsuite/ld-elf/anno-sym.d @@ -3,3 +3,5 @@ #error_output: anno-sym.l # The mips-irix6 target fails this test because it does not find any function symbols. Not sure why. #skip: *-*-irix* +# The .align generate a local symbol .Lla-relax-align. +#skip: loongarch*-*-* diff --git a/ld/testsuite/ld-loongarch-elf/anno-sym.d b/ld/testsuite/ld-loongarch-elf/anno-sym.d new file mode 100644 index 0000000..a58f4a6 --- /dev/null +++ b/ld/testsuite/ld-loongarch-elf/anno-sym.d @@ -0,0 +1,7 @@ +# Copied from ld-elf, add -mno-relax to prevent generate .Lla-relax-align symbol +# Check that linking anno-sym.o produces an undefined reference message referring to '_start' and not 'annobin_hello.c' +#as: -mno-relax +#ld: -e _start +#error_output: anno-sym.l +# The mips-irix6 target fails this test because it does not find any function symbols. Not sure why. +#skip: *-*-irix* diff --git a/ld/testsuite/ld-loongarch-elf/anno-sym.l b/ld/testsuite/ld-loongarch-elf/anno-sym.l new file mode 100644 index 0000000..ee9611a --- /dev/null +++ b/ld/testsuite/ld-loongarch-elf/anno-sym.l @@ -0,0 +1,4 @@ +#... +.*: in function `(|_)start': +.*: undefined reference to `foo' +#pass diff --git a/ld/testsuite/ld-loongarch-elf/anno-sym.s b/ld/testsuite/ld-loongarch-elf/anno-sym.s new file mode 100644 index 0000000..92016a8 --- /dev/null +++ b/ld/testsuite/ld-loongarch-elf/anno-sym.s @@ -0,0 +1,13 @@ + .text + + .hidden .annobin_hello.c + .type .annobin_hello.c, STT_NOTYPE + .equiv .annobin_hello.c, . + .size .annobin_hello.c, 0 + + .global _start +_start: + .nop + .align 4 + .dc.a foo + diff --git a/ld/testsuite/ld-loongarch-elf/ld-loongarch-elf.exp b/ld/testsuite/ld-loongarch-elf/ld-loongarch-elf.exp index 1fc70d0..b43a518 100644 --- a/ld/testsuite/ld-loongarch-elf/ld-loongarch-elf.exp +++ b/ld/testsuite/ld-loongarch-elf/ld-loongarch-elf.exp @@ -32,6 +32,7 @@ if [istarget "loongarch64-*-*"] { run_dump_test "syscall" run_dump_test "disas-jirl" run_dump_test "local-ifunc-reloc" + run_dump_test "anno-sym" } if [istarget "loongarch32-*-*"] { diff --git a/ld/testsuite/ld-loongarch-elf/relax-align.dd b/ld/testsuite/ld-loongarch-elf/relax-align.dd index 5fce225..37fdab1 100644 --- a/ld/testsuite/ld-loongarch-elf/relax-align.dd +++ b/ld/testsuite/ld-loongarch-elf/relax-align.dd @@ -1,7 +1,8 @@ #... .*pcaddi.* -.*pcaddi.* .*nop.* +.*pcaddi.* .*nop.* -.*0:.*pcaddi.* +.*pcaddi.* +.*pcaddi.* #pass diff --git a/ld/testsuite/ld-loongarch-elf/relax-align.s b/ld/testsuite/ld-loongarch-elf/relax-align.s index 9617c02..66dfea8 100644 --- a/ld/testsuite/ld-loongarch-elf/relax-align.s +++ b/ld/testsuite/ld-loongarch-elf/relax-align.s @@ -4,6 +4,9 @@ .text L1: la.local $a0, L1 + .align 3 la.local $a0, L1 - .align 4 + .align 3, ,4 + la.local $a0, L1 + .align 3, ,2 la.local $a0, L1 diff --git a/ld/testsuite/ld-loongarch-elf/relax.exp b/ld/testsuite/ld-loongarch-elf/relax.exp index 24d79ed..77323d8 100644 --- a/ld/testsuite/ld-loongarch-elf/relax.exp +++ b/ld/testsuite/ld-loongarch-elf/relax.exp @@ -121,7 +121,7 @@ if [istarget loongarch64-*-*] { [list \ "loongarch relax-align" \ "-e 0x0 -z relro" "" \ - "" \ + "--no-warn" \ {relax-align.s} \ [list \ [list objdump -d relax-align.dd] \ |