diff options
Diffstat (limited to 'ld')
47 files changed, 512 insertions, 88 deletions
@@ -1,10 +1,16 @@ -*- text -*- +* On s390 64-bit (s390x), generate SFrame stack trace information (.sframe) + for the linker generated .plt section. Enabled by default. Can be disabled + using linker option --no-ld-generated-unwind-info. + * All SFrame sections generated by the linker have the header flag SFRAME_F_FDE_FUNC_START_PCREL set to indicate the new encoding for sfde_func_start_address field in the SFrame section. Relocatable SFrame links are now fixed. + ELF SFrame sections now have section type set to SHT_GNU_SFRAME. + * On RISC-V, add new PLT formats, and GNU property merge rules for zicfiss and zicfilp extensions. @@ -31,6 +37,12 @@ * On s390, add support for linker option --[no-]ld-generated-unwind-info. +* On LoongArch, linker relaxation time complexity is no longer quadratic with + respect to relocation counts. Linking time of large software should be + improved. + +* On LoongArch, R_LARCH_32_PCREL records are now checked for overflow. + Changes in 2.44: * Support for Nios II target has been removed, as this architecture has been diff --git a/ld/emultempl/aarch64elf.em b/ld/emultempl/aarch64elf.em index afa91af..66eaf1c 100644 --- a/ld/emultempl/aarch64elf.em +++ b/ld/emultempl/aarch64elf.em @@ -42,6 +42,11 @@ static aarch64_protection_opts sw_protections = { .gcs_report_dynamic = MARKING_UNSET, }; +static aarch64_memtag_opts memtag_opts = { + .memtag_mode = AARCH64_MEMTAG_MODE_NONE, + .memtag_stack = 0, +}; + #define COMPILE_TIME_STRLEN(s) \ (sizeof(s) - 1) @@ -335,7 +340,8 @@ aarch64_elf_create_output_section_statements (void) pic_veneer, fix_erratum_835769, fix_erratum_843419, no_apply_dynamic_relocs, - &sw_protections); + &sw_protections, + &memtag_opts); stub_file = lang_add_input_file ("linker stubs", lang_input_file_is_fake_enum, @@ -440,6 +446,31 @@ aarch64_parse_gcs_option (const char *_optarg) #undef GCS #undef GCS_LEN } + +static bool +aarch64_parse_memtag_mode_option (const char *optarg) +{ + #define MEMTAG_MODE "memtag-mode" + #define MEMTAG_MODE_LEN COMPILE_TIME_STRLEN (MEMTAG_MODE) + + if (strncmp (optarg, MEMTAG_MODE, MEMTAG_MODE_LEN) != 0) + return false; + + if (strcmp (optarg + MEMTAG_MODE_LEN, "=none") == 0) + memtag_opts.memtag_mode = AARCH64_MEMTAG_MODE_NONE; + else if (strcmp (optarg + MEMTAG_MODE_LEN, "=sync") == 0) + memtag_opts.memtag_mode = AARCH64_MEMTAG_MODE_SYNC; + else if (strcmp (optarg + MEMTAG_MODE_LEN, "=async") == 0) + memtag_opts.memtag_mode = AARCH64_MEMTAG_MODE_ASYNC; + else + einfo (_("%X%P: error: unrecognized value '-z %s'\n"), optarg); + + return true; + + #undef MEMTAG_MODE + #undef MEMTAG_MODE_LEN +} + EOF # Define some shell vars to insert bits of code into the standard elf @@ -518,6 +549,17 @@ PARSE_AND_LIST_OPTIONS=' and output have GCS marking.\n\ error: Emit error when the input objects are missing GCS markings\n\ and output have GCS marking.\n")); + fprintf (file, _("\ + -z memtag-mode[=none|sync|async] Select Memory Tagging Extension mode of operation to use.\n\ + Emits a DT_AARCH64_MEMTAG_MODE dynamic tag for the binary.\n\ + This entry is only valid on the main executable. It is\n\ + ignored in the dynamically loaded objects by the loader.\n\ + none (default): Disable MTE checking of memory reads and writes.\n\ + sync: Enable precise exceptions when mismatched address and\n\ + allocation tags detected on load/store operations.\n\ + async: Enable imprecise exceptions.\n")); + fprintf (file, _("\ + -z memtag-stack Mark program stack with MTE protection.\n")); ' PARSE_AND_LIST_ARGS_CASE_Z_AARCH64=' @@ -533,6 +575,10 @@ PARSE_AND_LIST_ARGS_CASE_Z_AARCH64=' {} else if (aarch64_parse_gcs_option (optarg)) {} + else if (aarch64_parse_memtag_mode_option (optarg)) + {} + else if (strcmp (optarg, "memtag-stack") == 0) + memtag_opts.memtag_stack = 1; ' PARSE_AND_LIST_ARGS_CASE_Z="$PARSE_AND_LIST_ARGS_CASE_Z $PARSE_AND_LIST_ARGS_CASE_Z_AARCH64" @@ -8374,6 +8374,21 @@ GCS markings. If issues are found, a maximum of 20 messages will be emitted, and then a summary with the total number of issues will be displayed at the end. +@kindex -z memtag-mode=@var{mode} +@cindex MTE modes of operation +The @samp{-z memtag-mode=mode} specifies the MTE mode of operation. +The value of @samp{mode} can be one of @samp{none}, @samp{sync} or +@samp{async}. The specified modes determine the value of the +@samp{DT_AARCH64_MEMTAG_MODE} dynamic tag. The @samp{sync} mode +implies precise exceptions, with the runtime providing the exact +instruction where the fault occurred, and the exact faulting address. +The @samp{async} mode implies imprecise exceptions. + +@kindex -z memtag-stack +@cindex Mark program stack for MTE protection +The @samp{-z memtag-stack} specifies that output object uses MTE +instructions for stack memory usage. + @ifclear GENERIC @lowersections @end ifclear diff --git a/ld/testsuite/ld-aarch64/aarch64-elf.exp b/ld/testsuite/ld-aarch64/aarch64-elf.exp index 4de498f..8d56beb 100644 --- a/ld/testsuite/ld-aarch64/aarch64-elf.exp +++ b/ld/testsuite/ld-aarch64/aarch64-elf.exp @@ -376,6 +376,10 @@ run_dump_test_lp64 "variant_pcs-r" run_dump_test_lp64 "variant_pcs-shared" run_dump_test_lp64 "variant_pcs-now" +run_dump_test_lp64 "mte-tagged-frame" +run_dump_test_lp64 "dt-memtag-mode" +run_dump_test_lp64 "dt-memtag-stack" + set aarch64elflinktests { {"ld-aarch64/so with global symbol" "-shared" "" "" {copy-reloc-so.s} {} "copy-reloc-so.so"} diff --git a/ld/testsuite/ld-aarch64/dt-memtag-mode.d b/ld/testsuite/ld-aarch64/dt-memtag-mode.d new file mode 100644 index 0000000..21670bc --- /dev/null +++ b/ld/testsuite/ld-aarch64/dt-memtag-mode.d @@ -0,0 +1,7 @@ +#source: dt-memtag.s +#ld: -shared -z memtag-mode=async +#readelf: -d + +#... + 0x0000000070000009 \(AARCH64_MEMTAG_MODE\) 0x1 +#... diff --git a/ld/testsuite/ld-aarch64/dt-memtag-stack.d b/ld/testsuite/ld-aarch64/dt-memtag-stack.d new file mode 100644 index 0000000..242f61f --- /dev/null +++ b/ld/testsuite/ld-aarch64/dt-memtag-stack.d @@ -0,0 +1,7 @@ +#source: dt-memtag.s +#ld: -shared -z memtag-stack +#readelf: -d + +#... + 0x000000007000000c \(AARCH64_MEMTAG_STACK\) 0x1 +#... diff --git a/ld/testsuite/ld-aarch64/dt-memtag.s b/ld/testsuite/ld-aarch64/dt-memtag.s new file mode 100644 index 0000000..51f3ba5 --- /dev/null +++ b/ld/testsuite/ld-aarch64/dt-memtag.s @@ -0,0 +1,7 @@ +// Test DT_AARCH64_MEMTAG_MODE. + +.text +.p2align 3 +.global foo +foo: +.xword foo diff --git a/ld/testsuite/ld-aarch64/mte-tagged-frame-bar.s b/ld/testsuite/ld-aarch64/mte-tagged-frame-bar.s new file mode 100644 index 0000000..0bd5619 --- /dev/null +++ b/ld/testsuite/ld-aarch64/mte-tagged-frame-bar.s @@ -0,0 +1,17 @@ + .text + .global bar + .type bar, %function +bar: + .cfi_startproc + .cfi_mte_tagged_frame + stp x19, x20, [sp, -144]! + .cfi_def_cfa_offset 144 + .cfi_offset 19, -144 + .cfi_offset 20, -136 + ldp x19, x20, [sp], 144 + .cfi_restore 20 + .cfi_restore 19 + .cfi_def_cfa_offset 0 + ret + .cfi_endproc + .size bar, .-bar diff --git a/ld/testsuite/ld-aarch64/mte-tagged-frame-foo.s b/ld/testsuite/ld-aarch64/mte-tagged-frame-foo.s new file mode 100644 index 0000000..af5a8c4 --- /dev/null +++ b/ld/testsuite/ld-aarch64/mte-tagged-frame-foo.s @@ -0,0 +1,16 @@ + .text + .global foo + .type foo, %function +foo: + .cfi_startproc + stp x19, x20, [sp, -32]! + .cfi_def_cfa_offset 32 + .cfi_offset 19, -32 + .cfi_offset 20, -16 + ldp x19, x20, [sp], 32 + .cfi_restore 20 + .cfi_restore 19 + .cfi_def_cfa_offset 0 + ret + .cfi_endproc + .size foo, .-foo diff --git a/ld/testsuite/ld-aarch64/mte-tagged-frame.d b/ld/testsuite/ld-aarch64/mte-tagged-frame.d new file mode 100644 index 0000000..dd667fe --- /dev/null +++ b/ld/testsuite/ld-aarch64/mte-tagged-frame.d @@ -0,0 +1,35 @@ +#source: mte-tagged-frame-foo.s +#source: mte-tagged-frame-bar.s +#ld: -shared +#objdump: -Wf +#name: MTE tagged EH Frame FDE + +#... +Contents of the .eh_frame section: + +00000000 0000000000000010 00000000 CIE + Version: 1 + Augmentation: "zR" + Code alignment factor: 4 + Data alignment factor: -8 + Return address column: 30 + Augmentation data: 1b + DW_CFA_def_cfa: r31 \(sp\) ofs 0 + +00000014 0000000000000020 00000018 FDE cie=00000000 pc=[a-f0-9]+\.\.[a-f0-9]+ +#... + +00000038 0000000000000014 00000000 CIE + Version: 1 + Augmentation: "zRG" + Code alignment factor: 4 + Data alignment factor: -8 + Return address column: 30 + Augmentation data: 1b + DW_CFA_def_cfa: r31 \(sp\) ofs 0 + DW_CFA_nop + DW_CFA_nop + DW_CFA_nop + +00000050 000000000000001c 0000001c FDE cie=00000038 pc=[a-f0-9]+\.\.[a-f0-9]+ +#... diff --git a/ld/testsuite/ld-loongarch-elf/relax-after-alignment.d b/ld/testsuite/ld-loongarch-elf/relax-after-alignment.d index 844c518..08def25 100644 --- a/ld/testsuite/ld-loongarch-elf/relax-after-alignment.d +++ b/ld/testsuite/ld-loongarch-elf/relax-after-alignment.d @@ -2,6 +2,7 @@ #as: #ld: --defsym _start=0 #objdump: -d --no-show-raw-insn +#xfail: *-*-* .*:\s+file format .* diff --git a/ld/testsuite/ld-mips-elf/micromips-hilo-n32.d b/ld/testsuite/ld-mips-elf/micromips-hilo-n32.d deleted file mode 100644 index 1cb3d87..0000000 --- a/ld/testsuite/ld-mips-elf/micromips-hilo-n32.d +++ /dev/null @@ -1,8 +0,0 @@ -#name: R_MICROMIPS_HI16 and R_MICROMIPS_LO16 relocs n32 -#source: ../../../gas/testsuite/gas/mips/mips-hilo.s -#source: mips-hilo.s -#as: -mmicromips -march=mips64r2 -#objdump: -d -#ld: -Tmips-hilo.ld -e 0x500000 -N -#notarget: mips*el-ps2-elf* -#dump: micromips-hilo.d diff --git a/ld/testsuite/ld-mips-elf/micromips-hilo-n64.d b/ld/testsuite/ld-mips-elf/micromips-hilo-n64.d index 1243e91..b3d34a1 100644 --- a/ld/testsuite/ld-mips-elf/micromips-hilo-n64.d +++ b/ld/testsuite/ld-mips-elf/micromips-hilo-n64.d @@ -1,4 +1,4 @@ -#name: R_MICROMIPS_HI16 and R_MICROMIPS_LO16 relocs n64 +#name: R_MICROMIPS_HI16 and R_MICROMIPS_LO16 relocs (n64) #source: ../../../gas/testsuite/gas/mips/mips-hilo-n64.s #source: mips-hilo.s #as: -mmicromips -march=mips64r2 diff --git a/ld/testsuite/ld-mips-elf/micromips-hilo-srec-n32.d b/ld/testsuite/ld-mips-elf/micromips-hilo-srec-n32.d deleted file mode 100644 index 1ea7daa..0000000 --- a/ld/testsuite/ld-mips-elf/micromips-hilo-srec-n32.d +++ /dev/null @@ -1,8 +0,0 @@ -#name: R_MICROMIPS_HI16 and R_MICROMIPS_LO16 relocs srec n32 -#source: ../../../gas/testsuite/gas/mips/mips-hilo.s -#source: mips-hilo.s -#as: -mmicromips -march=mips64r2 -#objdump: -m mips:micromips -j .sec1 -D -#ld: --oformat=srec -Tmips-hilo.ld -e 0x500000 -N -#notarget: mips*el-ps2-elf* -#dump: micromips-hilo.d diff --git a/ld/testsuite/ld-mips-elf/micromips-hilo-srec-n64.d b/ld/testsuite/ld-mips-elf/micromips-hilo-srec-n64.d index c25fbe8..efbaaa5 100644 --- a/ld/testsuite/ld-mips-elf/micromips-hilo-srec-n64.d +++ b/ld/testsuite/ld-mips-elf/micromips-hilo-srec-n64.d @@ -1,4 +1,4 @@ -#name: R_MICROMIPS_HI16 and R_MICROMIPS_LO16 relocs srec n64 +#name: R_MICROMIPS_HI16 and R_MICROMIPS_LO16 relocs srec (n64) #source: ../../../gas/testsuite/gas/mips/mips-hilo-n64.s #source: mips-hilo.s #as: -mmicromips -march=mips64r2 diff --git a/ld/testsuite/ld-mips-elf/micromips-hilo-srec.d b/ld/testsuite/ld-mips-elf/micromips-hilo-srec.d index e6b8459..c8bee0a 100644 --- a/ld/testsuite/ld-mips-elf/micromips-hilo-srec.d +++ b/ld/testsuite/ld-mips-elf/micromips-hilo-srec.d @@ -1,7 +1,7 @@ #name: R_MICROMIPS_HI16 and R_MICROMIPS_LO16 relocs srec #source: ../../../gas/testsuite/gas/mips/mips-hilo.s #source: mips-hilo.s -#as: -mmicromips -march=mips32r2 +#as: -mmicromips -march=mips64r2 #objdump: -m mips:micromips -j .sec1 -D #ld: --oformat=srec -Tmips-hilo.ld -e 0x500000 -N #notarget: mips*el-ps2-elf* diff --git a/ld/testsuite/ld-mips-elf/micromips-hilo.d b/ld/testsuite/ld-mips-elf/micromips-hilo.d index d518dfb..ec5c9d1 100644 --- a/ld/testsuite/ld-mips-elf/micromips-hilo.d +++ b/ld/testsuite/ld-mips-elf/micromips-hilo.d @@ -1,7 +1,7 @@ #name: R_MICROMIPS_HI16 and R_MICROMIPS_LO16 relocs #source: ../../../gas/testsuite/gas/mips/mips-hilo.s #source: mips-hilo.s -#as: -mmicromips -march=mips32r2 +#as: -mmicromips -march=mips64r2 #objdump: -d #ld: -Tmips-hilo.ld -e 0x500000 -N #notarget: mips*el-ps2-elf* diff --git a/ld/testsuite/ld-mips-elf/mips-elf.exp b/ld/testsuite/ld-mips-elf/mips-elf.exp index d0919ea..e8a1d42 100644 --- a/ld/testsuite/ld-mips-elf/mips-elf.exp +++ b/ld/testsuite/ld-mips-elf/mips-elf.exp @@ -815,42 +815,67 @@ run_dump_test_n32 "jalbal" noarch run_dump_test "mode-change-error-1" run_dump_test_o32 "mips16-hilo" noarch -run_dump_test_n32 "mips16-hilo-n32" noarch +run_dump_test_n32 "mips16-hilo" [list noarch [list name (n32)]] run_dump_test_o32 "mips16-hilo-srec" \ [list noarch \ [list objdump [expr { [istarget *el-*-*] ? "-EL" : "-EB" }]]] -run_dump_test_n32 "mips16-hilo-srec-n32" \ +run_dump_test_n32 "mips16-hilo-srec" \ [list noarch \ + [list name (n32)] \ [list objdump [expr { [istarget *el-*-*] ? "-EL" : "-EB" }]]] run_dump_test_o32 "mips16e2-hilo" noarch -run_dump_test_n32 "mips16e2-hilo-n32" noarch +run_dump_test_n32 "mips16e2-hilo" [list noarch [list name (n32)]] run_dump_test_o32 "mips16e2-hilo-srec" \ [list noarch \ [list objdump [expr { [istarget *el-*-*] ? "-EL" : "-EB" }]]] -run_dump_test_n32 "mips16e2-hilo-srec-n32" \ +run_dump_test_n32 "mips16e2-hilo-srec" \ [list noarch \ + [list name (n32)] \ [list objdump [expr { [istarget *el-*-*] ? "-EL" : "-EB" }]]] run_dump_test_o32 "mips-hilo" -run_dump_test_n32 "mips-hilo-n32" +run_dump_test_n32 "mips-hilo" [list [list name (n32)]] run_dump_test_n64 "mips-hilo-n64" run_dump_test_o32 "mips-hilo-srec" \ [list [list objdump [expr { [istarget *el-*-*] ? "-EL" : "-EB" }]]] -run_dump_test_n32 "mips-hilo-srec-n32" \ - [list [list objdump [expr { [istarget *el-*-*] ? "-EL" : "-EB" }]]] +run_dump_test_n32 "mips-hilo-srec" \ + [list [list name (n32)] \ + [list objdump [expr { [istarget *el-*-*] ? "-EL" : "-EB" }]]] run_dump_test_n64 "mips-hilo-srec-n64" \ [list [list objdump [expr { [istarget *el-*-*] ? "-EL" : "-EB" }]]] run_dump_test_o32 "micromips-hilo" noarch -run_dump_test_n32 "micromips-hilo-n32" noarch +run_dump_test_n32 "micromips-hilo" [list noarch [list name (n32)]] run_dump_test_n64 "micromips-hilo-n64" noarch run_dump_test_o32 "micromips-hilo-srec" \ [list noarch \ [list objdump [expr { [istarget *el-*-*] ? "-EL" : "-EB" }]]] -run_dump_test_n32 "micromips-hilo-srec-n32" \ +run_dump_test_n32 "micromips-hilo-srec" \ [list noarch \ + [list name (n32)] \ [list objdump [expr { [istarget *el-*-*] ? "-EL" : "-EB" }]]] run_dump_test_n64 "micromips-hilo-srec-n64" \ [list noarch \ [list objdump [expr { [istarget *el-*-*] ? "-EL" : "-EB" }]]] +run_dump_test_o32 "pcrel-hilo" +run_dump_test_n32 "pcrel-hilo" [list [list name (n32)]] +run_dump_test_n64 "pcrel-hilo" [list [list name (n64)]] +run_dump_test_o32 "pcrel-hilo-srec" \ + [list [list objdump [expr { [istarget *el-*-*] ? "-EL" : "-EB" }]]] +run_dump_test_n32 "pcrel-hilo-srec" \ + [list [list name (n32)] \ + [list objdump [expr { [istarget *el-*-*] ? "-EL" : "-EB" }]]] +run_dump_test_n64 "pcrel-hilo-srec" \ + [list [list name (n64)] \ + [list objdump [expr { [istarget *el-*-*] ? "-EL" : "-EB" }]]] + +run_dump_test_o32 "pr19977" +run_dump_test_n32 "pr19977" [list [list name (n32)]] +run_dump_test_o32 "pr19977-mips16" noarch +run_dump_test_n32 "pr19977-mips16" [list noarch [list name (n32)]] +run_dump_test_o32 "pr19977-micromips" noarch +run_dump_test_n32 "pr19977-micromips" [list noarch [list name (n32)]] +run_dump_test_o32 "pr19977-r" +run_dump_test_o32 "pr19977-r-mips16" noarch +run_dump_test_o32 "pr19977-r-micromips" noarch if { $linux_gnu } { run_dump_test_n32 "textrel-1" diff --git a/ld/testsuite/ld-mips-elf/mips-hilo-n32.d b/ld/testsuite/ld-mips-elf/mips-hilo-n32.d deleted file mode 100644 index 012e1f0..0000000 --- a/ld/testsuite/ld-mips-elf/mips-hilo-n32.d +++ /dev/null @@ -1,6 +0,0 @@ -#name: R_MIPS_HI16 and R_MIPS_LO16 relocs n32 -#source: ../../../gas/testsuite/gas/mips/mips-hilo.s -#source: mips-hilo.s -#objdump: -d -#ld: -Tmips-hilo.ld -e 0x500000 -N -#dump: mips-hilo.d diff --git a/ld/testsuite/ld-mips-elf/mips-hilo-n64.d b/ld/testsuite/ld-mips-elf/mips-hilo-n64.d index 5a3f919..9cac1b3 100644 --- a/ld/testsuite/ld-mips-elf/mips-hilo-n64.d +++ b/ld/testsuite/ld-mips-elf/mips-hilo-n64.d @@ -1,4 +1,4 @@ -#name: R_MIPS_HI16 and R_MIPS_LO16 relocs n64 +#name: R_MIPS_HI16 and R_MIPS_LO16 relocs (n64) #source: ../../../gas/testsuite/gas/mips/mips-hilo-n64.s #source: mips-hilo.s #objdump: -d diff --git a/ld/testsuite/ld-mips-elf/mips-hilo-srec-n32.d b/ld/testsuite/ld-mips-elf/mips-hilo-srec-n32.d deleted file mode 100644 index ccd0195..0000000 --- a/ld/testsuite/ld-mips-elf/mips-hilo-srec-n32.d +++ /dev/null @@ -1,6 +0,0 @@ -#name: R_MIPS_HI16 and R_MIPS_LO16 relocs srec n32 -#source: ../../../gas/testsuite/gas/mips/mips-hilo.s -#source: mips-hilo.s -#objdump: -m mips:4000 -j .sec1 -D -#ld: --oformat=srec -Tmips-hilo.ld -e 0x500000 -N -#dump: mips-hilo.d diff --git a/ld/testsuite/ld-mips-elf/mips-hilo-srec-n64.d b/ld/testsuite/ld-mips-elf/mips-hilo-srec-n64.d index b02983e..19ba44c 100644 --- a/ld/testsuite/ld-mips-elf/mips-hilo-srec-n64.d +++ b/ld/testsuite/ld-mips-elf/mips-hilo-srec-n64.d @@ -1,4 +1,4 @@ -#name: R_MIPS_HI16 and R_MIPS_LO16 relocs srec n64 +#name: R_MIPS_HI16 and R_MIPS_LO16 relocs srec (n64) #source: ../../../gas/testsuite/gas/mips/mips-hilo-n64.s #source: mips-hilo.s #objdump: -m mips:4000 -j .sec1 -D diff --git a/ld/testsuite/ld-mips-elf/mips-hilo-srec.d b/ld/testsuite/ld-mips-elf/mips-hilo-srec.d index 59e5717..a6afb3f 100644 --- a/ld/testsuite/ld-mips-elf/mips-hilo-srec.d +++ b/ld/testsuite/ld-mips-elf/mips-hilo-srec.d @@ -1,6 +1,6 @@ #name: R_MIPS_HI16 and R_MIPS_LO16 relocs srec #source: ../../../gas/testsuite/gas/mips/mips-hilo.s #source: mips-hilo.s -#objdump: -m mips:3000 -j .sec1 -D +#objdump: -m mips:4000 -j .sec1 -D #ld: --oformat=srec -Tmips-hilo.ld -e 0x500000 -N #dump: mips-hilo.d diff --git a/ld/testsuite/ld-mips-elf/mips16-hilo-n32.d b/ld/testsuite/ld-mips-elf/mips16-hilo-n32.d deleted file mode 100644 index 08b591c..0000000 --- a/ld/testsuite/ld-mips-elf/mips16-hilo-n32.d +++ /dev/null @@ -1,7 +0,0 @@ -#name: R_MIPS16_HI16 and R_MIPS16_LO16 relocs n32 -#source: ../../../gas/testsuite/gas/mips/mips16-hilo.s -#source: mips-hilo.s -#as: -march=mips3 -#objdump: -mmips:16 -dr -#ld: -Tmips-hilo.ld -e 0x500000 -N -#dump: mips16-hilo.d diff --git a/ld/testsuite/ld-mips-elf/mips16-hilo-srec-n32.d b/ld/testsuite/ld-mips-elf/mips16-hilo-srec-n32.d deleted file mode 100644 index 724adcb..0000000 --- a/ld/testsuite/ld-mips-elf/mips16-hilo-srec-n32.d +++ /dev/null @@ -1,7 +0,0 @@ -#name: R_MIPS16_HI16 and R_MIPS16_LO16 relocs srec n32 -#source: ../../../gas/testsuite/gas/mips/mips16-hilo.s -#source: mips-hilo.s -#as: -march=mips3 -#objdump: -mmips:16 -j .sec1 -D -#ld: --oformat=srec -Tmips-hilo.ld -e 0x500000 -N -#dump: mips16-hilo.d diff --git a/ld/testsuite/ld-mips-elf/mips16-hilo-srec.d b/ld/testsuite/ld-mips-elf/mips16-hilo-srec.d index 9c41d9a..cd20d98 100644 --- a/ld/testsuite/ld-mips-elf/mips16-hilo-srec.d +++ b/ld/testsuite/ld-mips-elf/mips16-hilo-srec.d @@ -1,7 +1,7 @@ #name: R_MIPS16_HI16 and R_MIPS16_LO16 relocs srec #source: ../../../gas/testsuite/gas/mips/mips16-hilo.s #source: mips-hilo.s -#as: -march=mips1 +#as: -march=mips3 #objdump: -mmips:16 -j .sec1 -D #ld: --oformat=srec -Tmips-hilo.ld -e 0x500000 -N #dump: mips16-hilo.d diff --git a/ld/testsuite/ld-mips-elf/mips16-hilo.d b/ld/testsuite/ld-mips-elf/mips16-hilo.d index 1f01ca2..3a8dc71 100644 --- a/ld/testsuite/ld-mips-elf/mips16-hilo.d +++ b/ld/testsuite/ld-mips-elf/mips16-hilo.d @@ -1,8 +1,8 @@ #name: R_MIPS16_HI16 and R_MIPS16_LO16 relocs #source: ../../../gas/testsuite/gas/mips/mips16-hilo.s #source: mips-hilo.s -#as: -march=mips1 -#objdump: -mmips:16 -dr +#as: -march=mips3 +#objdump: -mmips:16 -d #ld: -Tmips-hilo.ld -e 0x500000 -N .*: file format (:?elf.*mips.*|srec) diff --git a/ld/testsuite/ld-mips-elf/mips16e2-hilo-n32.d b/ld/testsuite/ld-mips-elf/mips16e2-hilo-n32.d deleted file mode 100644 index e900e87..0000000 --- a/ld/testsuite/ld-mips-elf/mips16e2-hilo-n32.d +++ /dev/null @@ -1,8 +0,0 @@ -#name: MIPS16e2 R_MIPS16_HI16 and R_MIPS16_LO16 relocs n32 -#source: ../../../gas/testsuite/gas/mips/mips-hilo.s -#source: mips-hilo.s -#as: -mips16 -mmips16e2 -march=mips64r2 -#objdump: -d -#ld: -Tmips-hilo.ld -e 0x500000 -N -#notarget: mips*el-ps2-elf* -#dump: mips16e2-hilo.d diff --git a/ld/testsuite/ld-mips-elf/mips16e2-hilo-srec-n32.d b/ld/testsuite/ld-mips-elf/mips16e2-hilo-srec-n32.d deleted file mode 100644 index 0132fa8..0000000 --- a/ld/testsuite/ld-mips-elf/mips16e2-hilo-srec-n32.d +++ /dev/null @@ -1,8 +0,0 @@ -#name: MIPS16e2 R_MIPS16_HI16 and R_MIPS16_LO16 relocs srec n32 -#source: ../../../gas/testsuite/gas/mips/mips-hilo.s -#source: mips-hilo.s -#as: -mips16 -mmips16e2 -march=mips64r2 -#objdump: -mmips:16 -j .sec1 -D -#ld: --oformat=srec -Tmips-hilo.ld -e 0x500000 -N -#notarget: mips*el-ps2-elf* -#dump: mips16e2-hilo.d diff --git a/ld/testsuite/ld-mips-elf/mips16e2-hilo-srec.d b/ld/testsuite/ld-mips-elf/mips16e2-hilo-srec.d index e46708b..12a2d28 100644 --- a/ld/testsuite/ld-mips-elf/mips16e2-hilo-srec.d +++ b/ld/testsuite/ld-mips-elf/mips16e2-hilo-srec.d @@ -1,7 +1,7 @@ #name: MIPS16e2 R_MIPS16_HI16 and R_MIPS16_LO16 relocs srec #source: ../../../gas/testsuite/gas/mips/mips-hilo.s #source: mips-hilo.s -#as: -mips16 -mmips16e2 -march=mips32r2 +#as: -mips16 -mmips16e2 -march=mips64r2 #objdump: -mmips:16 -j .sec1 -D #ld: --oformat=srec -Tmips-hilo.ld -e 0x500000 -N #notarget: mips*el-ps2-elf* diff --git a/ld/testsuite/ld-mips-elf/mips16e2-hilo.d b/ld/testsuite/ld-mips-elf/mips16e2-hilo.d index eb93873..5aa1624 100644 --- a/ld/testsuite/ld-mips-elf/mips16e2-hilo.d +++ b/ld/testsuite/ld-mips-elf/mips16e2-hilo.d @@ -1,7 +1,7 @@ #name: MIPS16e2 R_MIPS16_HI16 and R_MIPS16_LO16 relocs #source: ../../../gas/testsuite/gas/mips/mips-hilo.s #source: mips-hilo.s -#as: -mips16 -mmips16e2 -march=mips32r2 +#as: -mips16 -mmips16e2 -march=mips64r2 #objdump: -d #ld: -Tmips-hilo.ld -e 0x500000 -N #notarget: mips*el-ps2-elf* diff --git a/ld/testsuite/ld-mips-elf/pcrel-hilo-srec.d b/ld/testsuite/ld-mips-elf/pcrel-hilo-srec.d new file mode 100644 index 0000000..e9b0956 --- /dev/null +++ b/ld/testsuite/ld-mips-elf/pcrel-hilo-srec.d @@ -0,0 +1,6 @@ +#name: MIPSr6 PCHI16/PCLO16 relocations srec +#as: -mno-pdr +#ld: -e 0 --defsym=baz=0xfedcba98 -T pcrel-hilo.ld --oformat=srec +#objdump: -m mips:isa64r6 -D -j .sec1 +#source: ../../../gas/testsuite/gas/mips/pcrel-hilo.s +#dump: pcrel-hilo.d diff --git a/ld/testsuite/ld-mips-elf/pcrel-hilo.d b/ld/testsuite/ld-mips-elf/pcrel-hilo.d new file mode 100644 index 0000000..ae5d052 --- /dev/null +++ b/ld/testsuite/ld-mips-elf/pcrel-hilo.d @@ -0,0 +1,42 @@ +#name: MIPSr6 PCHI16/PCLO16 relocations +#as: -mno-pdr +#ld: -e 0 --defsym=baz=0xfedcba98 -T pcrel-hilo.ld +#objdump: -m mips:isa64r6 -d +#source: ../../../gas/testsuite/gas/mips/pcrel-hilo.s + +.*: +file format (?:.*mips.*|srec) + +Disassembly of section \.(?:text|sec1): + +0*10000000 <[^>]*>: + *10000000: ec9e2456 auipc a0,0x2456 + *10000004: 3c05fedd lui a1,0xfedd + *10000008: ecde2456 auipc a2,0x2456 + *1000000c: ecfe2457 auipc a3,0x2457 + *10000010: 24847fec addiu a0,a0,32748 + *10000014: 24a5ba98 addiu a1,a1,-17768 + *10000018: 24c67ff0 addiu a2,a2,32752 + *1000001c: 24e7ffe4 addiu a3,a3,-28 + *10000020: ec9e2456 auipc a0,0x2456 + *10000024: 3c05fedd lui a1,0xfedd + *10000028: ecde2456 auipc a2,0x2456 + *1000002c: ecfe2457 auipc a3,0x2457 + \.\.\. + *10030030: 24847fec addiu a0,a0,32748 + *10030034: 24a5ba98 addiu a1,a1,-17768 + *10030038: 24c67ff0 addiu a2,a2,32752 + *1003003c: 24e7ffe4 addiu a3,a3,-28 + *10030040: 24107fec li s0,32748 + *10030044: 2411ba98 li s1,-17768 + *10030048: 24127ff0 li s2,32752 + *1003004c: 2413ffe4 li s3,-28 + *10030050: ec9e2456 auipc a0,0x2456 + *10030054: 3c05fedd lui a1,0xfedd + *10030058: ecde2456 auipc a2,0x2456 + *1003005c: ecfe2457 auipc a3,0x2457 + *10030060: 00902021 addu a0,a0,s0 + *10030064: 00b12821 addu a1,a1,s1 + *10030068: 00d23021 addu a2,a2,s2 + *1003006c: 00f33821 addu a3,a3,s3 + *10030070: d81f0000 jrc ra + \.\.\. diff --git a/ld/testsuite/ld-mips-elf/pcrel-hilo.ld b/ld/testsuite/ld-mips-elf/pcrel-hilo.ld new file mode 100644 index 0000000..77d361d --- /dev/null +++ b/ld/testsuite/ld-mips-elf/pcrel-hilo.ld @@ -0,0 +1,14 @@ +MEMORY +{ + text (rx) : ORIGIN = 0x10000000, LENGTH = 0x40000 + data (w) : ORIGIN = 0x34560000, LENGTH = 0x40000 +} +SECTIONS +{ + .text : { *(.text) } >text + .data : { *(.data) } >data + .symtab : { *(.symtab) } + .strtab : { *(.strtab) } + .shstrtab : { *(.shstrtab) } + /DISCARD/ : { *(*) } +} diff --git a/ld/testsuite/ld-mips-elf/pr19977-micromips.d b/ld/testsuite/ld-mips-elf/pr19977-micromips.d new file mode 100644 index 0000000..021b29c --- /dev/null +++ b/ld/testsuite/ld-mips-elf/pr19977-micromips.d @@ -0,0 +1,25 @@ +#name: pr19977 microMIPS +#source: ../../../gas/testsuite/gas/mips/pr19977.s +#as: -mmicromips -march=mips64r2 +#objdump: -d +#ld: -Tpr19977.ld -e 0 -N +#notarget: mips*el-ps2-elf* + +.*: file format elf.*mips.* + +Disassembly of section \.text: + +10000000 <[^>]*>: +10000000: 3060 1122 li v1,4386 +10000004: 0063 8000 sll v1,v1,0x10 +10000008: 3063 2988 addiu v1,v1,10632 +1000000c: 3060 1122 li v1,4386 +10000010: 0063 8000 sll v1,v1,0x10 +10000014: 3063 1988 addiu v1,v1,6536 +10000018: 3060 1122 li v1,4386 +1000001c: 0063 8000 sll v1,v1,0x10 +10000020: 3063 a988 addiu v1,v1,-22136 +10000024: 3060 1122 li v1,4386 +10000028: 0063 8000 sll v1,v1,0x10 +1000002c: 3063 9988 addiu v1,v1,-26232 +#pass diff --git a/ld/testsuite/ld-mips-elf/pr19977-mips16.d b/ld/testsuite/ld-mips-elf/pr19977-mips16.d new file mode 100644 index 0000000..c927357 --- /dev/null +++ b/ld/testsuite/ld-mips-elf/pr19977-mips16.d @@ -0,0 +1,24 @@ +#name: pr19977 MIPS16 +#source: ../../../gas/testsuite/gas/mips/pr19977.s +#as: -mips16 -march=mips3 +#objdump: -d +#ld: -Tpr19977.ld -e 0 -N + +.*: file format elf.*mips.* + +Disassembly of section \.text: + +10000000 <[^>]*>: +10000000: f122 6b02 li v1,4386 +10000004: f400 3360 sll v1,16 +10000008: f185 4b08 addiu v1,10632 +1000000c: f122 6b02 li v1,4386 +10000010: f400 3360 sll v1,16 +10000014: f183 4b08 addiu v1,6536 +10000018: f122 6b02 li v1,4386 +1000001c: f400 3360 sll v1,16 +10000020: f195 4b08 addiu v1,-22136 +10000024: f122 6b02 li v1,4386 +10000028: f400 3360 sll v1,16 +1000002c: f193 4b08 addiu v1,-26232 +#pass diff --git a/ld/testsuite/ld-mips-elf/pr19977-r-micromips.d b/ld/testsuite/ld-mips-elf/pr19977-r-micromips.d new file mode 100644 index 0000000..db99b97 --- /dev/null +++ b/ld/testsuite/ld-mips-elf/pr19977-r-micromips.d @@ -0,0 +1,8 @@ +#name: pr19977 microMIPS -r +#source: pr19977-r.s +#source: ../../../gas/testsuite/gas/mips/pr19977.s +#as: -mmicromips -march=mips64r2 +#objdump: -dr +#ld: -r +#notarget: mips*el-ps2-elf* +#dump: pr19977-r.d diff --git a/ld/testsuite/ld-mips-elf/pr19977-r-mips16.d b/ld/testsuite/ld-mips-elf/pr19977-r-mips16.d new file mode 100644 index 0000000..dafa793 --- /dev/null +++ b/ld/testsuite/ld-mips-elf/pr19977-r-mips16.d @@ -0,0 +1,7 @@ +#name: pr19977 MIPS16 -r +#source: pr19977-r.s +#source: ../../../gas/testsuite/gas/mips/pr19977.s +#as: -mips16 -march=mips3 +#objdump: -dr +#ld: -r +#dump: pr19977-r.d diff --git a/ld/testsuite/ld-mips-elf/pr19977-r.d b/ld/testsuite/ld-mips-elf/pr19977-r.d new file mode 100644 index 0000000..166194b --- /dev/null +++ b/ld/testsuite/ld-mips-elf/pr19977-r.d @@ -0,0 +1,32 @@ +#name: pr19977 MIPS -r +#source: pr19977-r.s +#source: ../../../gas/testsuite/gas/mips/pr19977.s +#objdump: -dr +#ld: -r + +.* + +Disassembly of section \.text: + +0+ <foo>: + 0: .* li v1,4387 + 0: R_(|MICRO)MIPS(|16)_TLS_TPREL_HI16 \$loc0 + 4: .* sll .* + 8: .* addiu v1(|,v1),-26232 + 8: R_(|MICRO)MIPS(|16)_TLS_TPREL_LO16 \$loc0 + c: .* li v1,4387 + c: R_(|MICRO)MIPS(|16)_TLS_DTPREL_HI16 \$loc0 + 10: .* sll .* + 14: .* addiu v1(|,v1),-26232 + 14: R_(|MICRO)MIPS(|16)_TLS_DTPREL_LO16 \$loc0 + 18: .* li v1,4387 + 18: R_(|MICRO)MIPS(|16)_TLS_TPREL_HI16 \.tdata + 1c: .* sll .* + 20: .* addiu v1(|,v1),-30328 + 20: R_(|MICRO)MIPS(|16)_TLS_TPREL_LO16 \.tdata + 24: .* li v1,4387 + 24: R_(|MICRO)MIPS(|16)_TLS_DTPREL_HI16 \.tdata + 28: .* sll .* + 2c: .* addiu v1(|,v1),-30328 + 2c: R_(|MICRO)MIPS(|16)_TLS_DTPREL_LO16 \.tdata +#pass diff --git a/ld/testsuite/ld-mips-elf/pr19977-r.s b/ld/testsuite/ld-mips-elf/pr19977-r.s new file mode 100644 index 0000000..4a46b30 --- /dev/null +++ b/ld/testsuite/ld-mips-elf/pr19977-r.s @@ -0,0 +1,2 @@ + .section .tdata,"awT",%progbits + .space 28672 diff --git a/ld/testsuite/ld-mips-elf/pr19977.d b/ld/testsuite/ld-mips-elf/pr19977.d new file mode 100644 index 0000000..145f697 --- /dev/null +++ b/ld/testsuite/ld-mips-elf/pr19977.d @@ -0,0 +1,23 @@ +#name: pr19977 MIPS +#source: ../../../gas/testsuite/gas/mips/pr19977.s +#objdump: -d +#ld: -Tpr19977.ld -e 0 -N + +.*: file format elf.*mips.* + +Disassembly of section \.text: + +10000000 <[^>]*>: +10000000: 24031122 li v1,4386 +10000004: 00031c00 sll v1,v1,0x10 +10000008: 24632988 addiu v1,v1,10632 +1000000c: 24031122 li v1,4386 +10000010: 00031c00 sll v1,v1,0x10 +10000014: 24631988 addiu v1,v1,6536 +10000018: 24031122 li v1,4386 +1000001c: 00031c00 sll v1,v1,0x10 +10000020: 2463a988 addiu v1,v1,-22136 +10000024: 24031122 li v1,4386 +10000028: 00031c00 sll v1,v1,0x10 +1000002c: 24639988 addiu v1,v1,-26232 +#pass diff --git a/ld/testsuite/ld-mips-elf/pr19977.ld b/ld/testsuite/ld-mips-elf/pr19977.ld new file mode 100644 index 0000000..0b2f7c1 --- /dev/null +++ b/ld/testsuite/ld-mips-elf/pr19977.ld @@ -0,0 +1,14 @@ +MEMORY +{ + text (rx) : ORIGIN = 0x10000000, LENGTH = 0x40000 + data (w) : ORIGIN = 0x34560000, LENGTH = 0x40000 +} +SECTIONS +{ + .text : { *(.text) } >text + .tdata : { *(.tdata) } >data + .symtab : { *(.symtab) } + .strtab : { *(.strtab) } + .shstrtab : { *(.shstrtab) } + /DISCARD/ : { *(*) } +} diff --git a/ld/testsuite/ld-s390/s390.exp b/ld/testsuite/ld-s390/s390.exp index aaba88d..452811d 100644 --- a/ld/testsuite/ld-s390/s390.exp +++ b/ld/testsuite/ld-s390/s390.exp @@ -135,18 +135,20 @@ set s390xtests { "pr32969_64-2"} } -if [istarget "s390-*-*"] { +if { [istarget "s390-*-*"] || [istarget "s390x-*-*"] } { run_ld_link_tests $s390tests + + run_dump_test "pr26918-1" + run_dump_test "reloccheck-1" + run_dump_test "reloctlsle-1" + } if [istarget "s390x-*-*"] { - run_ld_link_tests $s390tests run_ld_link_tests $s390xtests -} -set test_list [lsort [glob -nocomplain $srcdir/$subdir/*.d]] -foreach t $test_list { - # We need to strip the ".d", but can leave the dirname. - verbose [file rootname $t] - run_dump_test [file rootname $t] + if { ![skip_sframe_tests] } { + run_dump_test "sframe-simple-1" + run_dump_test "sframe-plt-1" + } } diff --git a/ld/testsuite/ld-s390/sframe-bar.s b/ld/testsuite/ld-s390/sframe-bar.s new file mode 100644 index 0000000..f707569 --- /dev/null +++ b/ld/testsuite/ld-s390/sframe-bar.s @@ -0,0 +1,21 @@ + .text + .globl bar + .type bar, @function +bar: + .cfi_startproc + stmg %r14,%r15,112(%r15) + .cfi_rel_offset %r14, 112 + .cfi_rel_offset %r15, 120 + lay %r15,-160(%r15) + .cfi_adjust_cfa_offset 160 + clgfi %r2,1000 + jle .Lreturn + brasl %r14,foo@PLT +.Lreturn: + lay %r15,160(%r15) + .cfi_adjust_cfa_offset -160 + lg %r14,112(%r15) + .cfi_restore %r14 + br %r14 + .cfi_endproc + .size bar, .-bar diff --git a/ld/testsuite/ld-s390/sframe-foo.s b/ld/testsuite/ld-s390/sframe-foo.s new file mode 100644 index 0000000..75657e9 --- /dev/null +++ b/ld/testsuite/ld-s390/sframe-foo.s @@ -0,0 +1,9 @@ + .text + .globl foo + .type foo, @function +foo: + .cfi_startproc + msgfi %r2,42 + br %r14 + .cfi_endproc + .size foo, .-foo diff --git a/ld/testsuite/ld-s390/sframe-plt-1.d b/ld/testsuite/ld-s390/sframe-plt-1.d new file mode 100644 index 0000000..db09030 --- /dev/null +++ b/ld/testsuite/ld-s390/sframe-plt-1.d @@ -0,0 +1,29 @@ +#as: --gsframe +#source: sframe-foo.s +#source: sframe-bar.s +#objdump: --sframe=.sframe +#ld: -shared --no-rosegment +#name: SFrame for plt0 and pltN + +.*: +file format .* + +Contents of the SFrame section .sframe: + Header : + + Version: SFRAME_VERSION_2 + Flags: SFRAME_F_FDE_SORTED, + SFRAME_F_FDE_FUNC_START_PCREL + Num FDEs: 4 + Num FREs: 8 + + Function Index : + + func idx \[0\]: pc = 0x1e8, size = 32 bytes + STARTPC +CFA +FP +RA + + 0+1e8 +sp\+160 +u +u + + + func idx \[1\]: pc = 0x208, size = 32 bytes + STARTPC\[m\] +CFA +FP +RA + + 0+0 +sp\+160 +u +u + + +#... diff --git a/ld/testsuite/ld-s390/sframe-simple-1.d b/ld/testsuite/ld-s390/sframe-simple-1.d new file mode 100644 index 0000000..1c1bf32 --- /dev/null +++ b/ld/testsuite/ld-s390/sframe-simple-1.d @@ -0,0 +1,32 @@ +#as: --gsframe +#source: sframe-foo.s +#source: sframe-bar.s +#objdump: --sframe=.sframe +#ld: -shared --no-rosegment +#name: SFrame simple link + +.*: +file format .* + +Contents of the SFrame section .sframe: + Header : + + Version: SFRAME_VERSION_2 + Flags: SFRAME_F_FDE_SORTED, + SFRAME_F_FDE_FUNC_START_PCREL + Num FDEs: 4 + Num FREs: 8 + + Function Index : + +#... + func idx \[2\]: pc = 0x228, size = 8 bytes + STARTPC +CFA +FP +RA + + 0+228 +sp\+160 +u +u + + + func idx \[3\]: pc = 0x230, size = 42 bytes + STARTPC +CFA +FP +RA + + 0+230 +sp\+160 +u +u + + 0+236 +sp\+160 +u +c-48 + + 0+23c +sp\+320 +u +c-48 + + 0+252 +sp\+160 +u +c-48 + + 0+258 +sp\+160 +u +u + |