diff options
Diffstat (limited to 'ld')
-rw-r--r-- | ld/emulparams/elf32lriscv.sh | 2 | ||||
-rw-r--r-- | ld/emulparams/elf32lriscv_ilp32.sh | 2 | ||||
-rw-r--r-- | ld/emulparams/elf32lriscv_ilp32f.sh | 2 | ||||
-rw-r--r-- | ld/emulparams/elf64lriscv.sh | 2 | ||||
-rw-r--r-- | ld/emulparams/elf64lriscv_lp64.sh | 2 | ||||
-rw-r--r-- | ld/emulparams/elf64lriscv_lp64f.sh | 2 | ||||
-rw-r--r-- | ld/ldlang.c | 4 | ||||
-rw-r--r-- | ld/ldwrite.c | 2 | ||||
-rw-r--r-- | ld/testsuite/ld-riscv-elf/ld-riscv-elf.exp | 3 | ||||
-rw-r--r-- | ld/testsuite/ld-riscv-elf/pie-bind-locally-a.s | 5 | ||||
-rw-r--r-- | ld/testsuite/ld-riscv-elf/pie-bind-locally-b.s | 8 | ||||
-rw-r--r-- | ld/testsuite/ld-riscv-elf/pie-bind-locally-rv32.d | 10 | ||||
-rw-r--r-- | ld/testsuite/ld-riscv-elf/pie-bind-locally-rv64.d | 10 |
13 files changed, 45 insertions, 9 deletions
diff --git a/ld/emulparams/elf32lriscv.sh b/ld/emulparams/elf32lriscv.sh index da0d7cf..4246013 100644 --- a/ld/emulparams/elf32lriscv.sh +++ b/ld/emulparams/elf32lriscv.sh @@ -6,7 +6,7 @@ OUTPUT_FORMAT="elf32-littleriscv" # On Linux, first look for 32 bit ILP32D target libraries in /lib/ilp32d as per # the glibc ABI. case "$target" in - riscv32*-linux*) + riscv*-linux*) case "$EMULATION_NAME" in *32*) LIBPATH_SUFFIX="32/ilp32d 32" ;; diff --git a/ld/emulparams/elf32lriscv_ilp32.sh b/ld/emulparams/elf32lriscv_ilp32.sh index 4935937..c773985 100644 --- a/ld/emulparams/elf32lriscv_ilp32.sh +++ b/ld/emulparams/elf32lriscv_ilp32.sh @@ -5,7 +5,7 @@ OUTPUT_FORMAT="elf32-littleriscv" # On Linux, first look for 32 bit ILP32 target libraries in /lib/ilp32 as per # the glibc ABI. case "$target" in - riscv32*-linux*) + riscv*-linux*) case "$EMULATION_NAME" in *32*) LIBPATH_SUFFIX="32/ilp32 32" ;; diff --git a/ld/emulparams/elf32lriscv_ilp32f.sh b/ld/emulparams/elf32lriscv_ilp32f.sh index c684bf8..a2f0c2a 100644 --- a/ld/emulparams/elf32lriscv_ilp32f.sh +++ b/ld/emulparams/elf32lriscv_ilp32f.sh @@ -5,7 +5,7 @@ OUTPUT_FORMAT="elf32-littleriscv" # On Linux, first look for 32 bit ILP32F target libraries in /lib/ilp32f as per # the glibc ABI. case "$target" in - riscv32*-linux*) + riscv*-linux*) case "$EMULATION_NAME" in *32*) LIBPATH_SUFFIX="32/ilp32f 32" ;; diff --git a/ld/emulparams/elf64lriscv.sh b/ld/emulparams/elf64lriscv.sh index e07a064..7958052 100644 --- a/ld/emulparams/elf64lriscv.sh +++ b/ld/emulparams/elf64lriscv.sh @@ -6,7 +6,7 @@ OUTPUT_FORMAT="elf64-littleriscv" # On Linux, first look for 64 bit LP64D target libraries in /lib64/lp64d as per # the glibc ABI, and then /lib64 for backward compatility. case "$target" in - riscv64*-linux*) + riscv*-linux*) case "$EMULATION_NAME" in *64*) LIBPATH_SUFFIX="64/lp64d 64";; diff --git a/ld/emulparams/elf64lriscv_lp64.sh b/ld/emulparams/elf64lriscv_lp64.sh index b1bb252..7c7feca 100644 --- a/ld/emulparams/elf64lriscv_lp64.sh +++ b/ld/emulparams/elf64lriscv_lp64.sh @@ -5,7 +5,7 @@ OUTPUT_FORMAT="elf64-littleriscv" # On Linux, first look for 64 bit LP64 target libraries in /lib64/lp64 as per # the glibc ABI, and then /lib64 for backward compatility. case "$target" in - riscv64*-linux*) + riscv*-linux*) case "$EMULATION_NAME" in *64*) LIBPATH_SUFFIX="64/lp64 64";; diff --git a/ld/emulparams/elf64lriscv_lp64f.sh b/ld/emulparams/elf64lriscv_lp64f.sh index 005f191..e036c2f 100644 --- a/ld/emulparams/elf64lriscv_lp64f.sh +++ b/ld/emulparams/elf64lriscv_lp64f.sh @@ -5,7 +5,7 @@ OUTPUT_FORMAT="elf64-littleriscv" # On Linux, first look for 64 bit LP64F target libraries in /lib64/lp64f as per # the glibc ABI, and then /lib64 for backward compatility. case "$target" in - riscv64*-linux*) + riscv*-linux*) case "$EMULATION_NAME" in *64*) LIBPATH_SUFFIX="64/lp64f 64";; diff --git a/ld/ldlang.c b/ld/ldlang.c index 32e6e7a..cd1825b 100644 --- a/ld/ldlang.c +++ b/ld/ldlang.c @@ -2874,7 +2874,7 @@ lang_add_section (lang_statement_list_type *ptr, /* This must happen after flags have been updated. The output section may have been created before we saw its first input section, eg. for a data statement. */ - bfd_init_private_section_data (section->owner, section, + bfd_copy_private_section_data (section->owner, section, link_info.output_bfd, output->bfd_section, &link_info); @@ -10494,7 +10494,7 @@ setup_section (bfd *ibfd, sec_ptr isection, void *p) /* Allow the BFD backend to copy any private data it understands from the input section to the output section. */ - if (!bfd_copy_private_section_data (ibfd, isection, obfd, osection)) + if (!bfd_copy_private_section_data (ibfd, isection, obfd, osection, NULL)) { err = _("failed to copy private data"); goto loser; diff --git a/ld/ldwrite.c b/ld/ldwrite.c index 7613def..974245f 100644 --- a/ld/ldwrite.c +++ b/ld/ldwrite.c @@ -366,7 +366,7 @@ clone_section (bfd *abfd, asection *s, const char *name, int *count) n->reloc_count = 0; n->alignment_power = s->alignment_power; - bfd_copy_private_section_data (abfd, s, abfd, n); + bfd_copy_private_section_data (abfd, s, abfd, n, NULL); return n; } diff --git a/ld/testsuite/ld-riscv-elf/ld-riscv-elf.exp b/ld/testsuite/ld-riscv-elf/ld-riscv-elf.exp index e103df6..70c9aa7 100644 --- a/ld/testsuite/ld-riscv-elf/ld-riscv-elf.exp +++ b/ld/testsuite/ld-riscv-elf/ld-riscv-elf.exp @@ -235,6 +235,9 @@ if [istarget "riscv*-*-*"] { run_dump_test "zicfilp-unlabeled-plt" + run_dump_test "pie-bind-locally-rv32" + run_dump_test "pie-bind-locally-rv64" + # IFUNC testcases. # Check IFUNC by single type relocs. run_dump_test_ifunc "ifunc-reloc-call-01" rv32 exe diff --git a/ld/testsuite/ld-riscv-elf/pie-bind-locally-a.s b/ld/testsuite/ld-riscv-elf/pie-bind-locally-a.s new file mode 100644 index 0000000..c1ff19b --- /dev/null +++ b/ld/testsuite/ld-riscv-elf/pie-bind-locally-a.s @@ -0,0 +1,5 @@ + .text + .global _start +_start: + .option pic + la a0, _start diff --git a/ld/testsuite/ld-riscv-elf/pie-bind-locally-b.s b/ld/testsuite/ld-riscv-elf/pie-bind-locally-b.s new file mode 100644 index 0000000..e5f16cd --- /dev/null +++ b/ld/testsuite/ld-riscv-elf/pie-bind-locally-b.s @@ -0,0 +1,8 @@ + .section .data.rel,"aw",%progbits + .type q, %object +q: +.ifdef __64_bit__ + .quad _start +.else + .word _start +.endif diff --git a/ld/testsuite/ld-riscv-elf/pie-bind-locally-rv32.d b/ld/testsuite/ld-riscv-elf/pie-bind-locally-rv32.d new file mode 100644 index 0000000..0133995 --- /dev/null +++ b/ld/testsuite/ld-riscv-elf/pie-bind-locally-rv32.d @@ -0,0 +1,10 @@ +#source: pie-bind-locally-a.s +#source: pie-bind-locally-b.s +#as: -march=rv32i -mabi=ilp32 +#ld: -m[riscv_choose_ilp32_emul] -pie +#readelf: -Wr + +Relocation section '\.rela\.dyn' at offset .* contains 2 entries: +[ ]+Offset[ ]+Info[ ]+Type[ ]+.* +[0-9a-f]+[ ]+[0-9a-f]+[ ]+R_RISCV_RELATIVE[ ].* +[0-9a-f]+[ ]+[0-9a-f]+[ ]+R_RISCV_RELATIVE[ ].* diff --git a/ld/testsuite/ld-riscv-elf/pie-bind-locally-rv64.d b/ld/testsuite/ld-riscv-elf/pie-bind-locally-rv64.d new file mode 100644 index 0000000..6ae627a --- /dev/null +++ b/ld/testsuite/ld-riscv-elf/pie-bind-locally-rv64.d @@ -0,0 +1,10 @@ +#source: pie-bind-locally-a.s +#source: pie-bind-locally-b.s +#as: -march=rv64i -mabi=lp64 -defsym __64_bit__=1 +#ld: -m[riscv_choose_lp64_emul] -pie +#readelf: -Wr + +Relocation section '\.rela\.dyn' at offset .* contains 2 entries: +[ ]+Offset[ ]+Info[ ]+Type[ ]+.* +[0-9a-f]+[ ]+[0-9a-f]+[ ]+R_RISCV_RELATIVE[ ].* +[0-9a-f]+[ ]+[0-9a-f]+[ ]+R_RISCV_RELATIVE[ ].* |