diff options
Diffstat (limited to 'ld')
-rw-r--r-- | ld/testsuite/ld-loongarch-elf/abs-global.out | 1 | ||||
-rw-r--r-- | ld/testsuite/ld-loongarch-elf/abs-global.s | 5 | ||||
-rw-r--r-- | ld/testsuite/ld-loongarch-elf/get_abs_global_sym.c | 7 | ||||
-rw-r--r-- | ld/testsuite/ld-loongarch-elf/ld-loongarch-elf.exp | 12 |
4 files changed, 25 insertions, 0 deletions
diff --git a/ld/testsuite/ld-loongarch-elf/abs-global.out b/ld/testsuite/ld-loongarch-elf/abs-global.out new file mode 100644 index 00000000000..3656652b938 --- /dev/null +++ b/ld/testsuite/ld-loongarch-elf/abs-global.out @@ -0,0 +1 @@ +abba diff --git a/ld/testsuite/ld-loongarch-elf/abs-global.s b/ld/testsuite/ld-loongarch-elf/abs-global.s new file mode 100644 index 00000000000..93a5da6dd22 --- /dev/null +++ b/ld/testsuite/ld-loongarch-elf/abs-global.s @@ -0,0 +1,5 @@ +.text +.globl get_sym +get_sym: + la.global $a0, sym + ret diff --git a/ld/testsuite/ld-loongarch-elf/get_abs_global_sym.c b/ld/testsuite/ld-loongarch-elf/get_abs_global_sym.c new file mode 100644 index 00000000000..29781ad7703 --- /dev/null +++ b/ld/testsuite/ld-loongarch-elf/get_abs_global_sym.c @@ -0,0 +1,7 @@ +#include <stdio.h> + +extern int get_sym(); +int main() { + printf("%x\n", get_sym()); + return 0; +} diff --git a/ld/testsuite/ld-loongarch-elf/ld-loongarch-elf.exp b/ld/testsuite/ld-loongarch-elf/ld-loongarch-elf.exp index 4328f6e941e..6bef97c260f 100644 --- a/ld/testsuite/ld-loongarch-elf/ld-loongarch-elf.exp +++ b/ld/testsuite/ld-loongarch-elf/ld-loongarch-elf.exp @@ -130,6 +130,18 @@ if [istarget "loongarch64-*-*"] { "a.binary" \ ] \ ] + + + run_ld_link_exec_tests [list \ + [list \ + "get global abs symbol test" \ + "-Wl,-z norelro -Wl,--defsym sym=0xabba" \ + "" \ + { abs-global.s get_abs_global_sym.c} \ + "abs-global" \ + "abs-global.out" \ + ] \ + ] } if [istarget "loongarch64-*-*"] { |