From 36068e2fa5460e6cfa1f5f359df6f37c497aab50 Mon Sep 17 00:00:00 2001 From: "H.J. Lu" Date: Wed, 16 Sep 2020 07:11:16 -0700 Subject: [PATCH] elf/x86-64: Adjust relocation for PE/x86-64 inputs PE linker calls _bfd_relocate_contents to resolve relocation, instead of bfd_perform_relocation. But ELF linker calls bfd_perform_relocation, not _bfd_relocate_contents. When linking PE/x86-64 inputs to generate ELF output, we need to adjust PE/x86-64 relocations in bfd_perform_relocation. Enable PE/x86-64 in bfd together with PEI/x86-64. Update run_ld_link_tests to handle bzip2 binary inputs. bfd/ PR ld/26583 * config.bfd (targ64_selvecs, targ_selvecs): Add x86_64_pe_vec to x86_64_pei_vec. * reloc.c: Include "coff/internal.h". (bfd_perform_relocation): Adjust relocation for PE/x86-64 inputs. ld/ PR ld/26583 * testsuite/ld-x86-64/pe-x86-64-1.od: New file. * testsuite/ld-x86-64/pe-x86-64-1a.obj.bz2: Likewise. * testsuite/ld-x86-64/pe-x86-64-1b.obj.bz2: Likewise. * testsuite/ld-x86-64/pe-x86-64-1c.obj.bz2: Likewise. * testsuite/ld-x86-64/pe-x86-64-2.od: Likewise. * testsuite/ld-x86-64/pe-x86-64-2a.obj.bz2: Likewise. * testsuite/ld-x86-64/pe-x86-64-2b.obj.bz2: Likewise. * testsuite/ld-x86-64/pe-x86-64-2c.obj.bz2: Likewise. * testsuite/ld-x86-64/pe-x86-64-3.od: Likewise. * testsuite/ld-x86-64/pe-x86-64-3a.obj.bz2: Likewise. * testsuite/ld-x86-64/pe-x86-64-3b.obj.bz2: Likewise. * testsuite/ld-x86-64/pe-x86-64-3c.obj.bz2: Likewise. * testsuite/ld-x86-64/pe-x86-64-3d.obj.bz2: Likewise. * testsuite/ld-x86-64/pe-x86-64-4.od: Likewise. * testsuite/ld-x86-64/pe-x86-64-4a.obj.bz2: Likewise. * testsuite/ld-x86-64/pe-x86-64-4b.obj.bz2: Likewise. * testsuite/ld-x86-64/pe-x86-64-4c.obj.bz2: Likewise. * testsuite/ld-x86-64/pe-x86-64-4d.obj.bz2: Likewise. * testsuite/ld-x86-64/pe-x86-64.exp: Likewise. * testsuite/lib/ld-lib.exp (run_ld_link_tests): Handle bz2 binary inputs. --- bfd/ChangeLog | 8 +++ bfd/config.bfd | 16 ++--- bfd/reloc.c | 18 ++++++ ld/ChangeLog | 25 ++++++++ ld/testsuite/ld-x86-64/pe-x86-64-1.od | 38 +++++++++++ ld/testsuite/ld-x86-64/pe-x86-64-1a.obj.bz2 | Bin 0 -> 536 bytes ld/testsuite/ld-x86-64/pe-x86-64-1b.obj.bz2 | Bin 0 -> 542 bytes ld/testsuite/ld-x86-64/pe-x86-64-1c.obj.bz2 | Bin 0 -> 710 bytes ld/testsuite/ld-x86-64/pe-x86-64-2.od | 38 +++++++++++ ld/testsuite/ld-x86-64/pe-x86-64-2a.obj.bz2 | Bin 0 -> 557 bytes ld/testsuite/ld-x86-64/pe-x86-64-2b.obj.bz2 | Bin 0 -> 537 bytes ld/testsuite/ld-x86-64/pe-x86-64-2c.obj.bz2 | Bin 0 -> 718 bytes ld/testsuite/ld-x86-64/pe-x86-64-3.od | 38 +++++++++++ ld/testsuite/ld-x86-64/pe-x86-64-3a.obj.bz2 | Bin 0 -> 538 bytes ld/testsuite/ld-x86-64/pe-x86-64-3b.obj.bz2 | Bin 0 -> 539 bytes ld/testsuite/ld-x86-64/pe-x86-64-3c.obj.bz2 | Bin 0 -> 716 bytes ld/testsuite/ld-x86-64/pe-x86-64-3d.obj.bz2 | Bin 0 -> 432 bytes ld/testsuite/ld-x86-64/pe-x86-64-4.od | 67 ++++++++++++++++++++ ld/testsuite/ld-x86-64/pe-x86-64-4a.obj.bz2 | Bin 0 -> 668 bytes ld/testsuite/ld-x86-64/pe-x86-64-4b.obj.bz2 | Bin 0 -> 536 bytes ld/testsuite/ld-x86-64/pe-x86-64-4c.obj.bz2 | Bin 0 -> 563 bytes ld/testsuite/ld-x86-64/pe-x86-64-4d.obj.bz2 | Bin 0 -> 438 bytes ld/testsuite/ld-x86-64/pe-x86-64.exp | 66 +++++++++++++++++++ ld/testsuite/lib/ld-lib.exp | 32 +++++++--- 24 files changed, 328 insertions(+), 18 deletions(-) create mode 100644 ld/testsuite/ld-x86-64/pe-x86-64-1.od create mode 100644 ld/testsuite/ld-x86-64/pe-x86-64-1a.obj.bz2 create mode 100644 ld/testsuite/ld-x86-64/pe-x86-64-1b.obj.bz2 create mode 100644 ld/testsuite/ld-x86-64/pe-x86-64-1c.obj.bz2 create mode 100644 ld/testsuite/ld-x86-64/pe-x86-64-2.od create mode 100644 ld/testsuite/ld-x86-64/pe-x86-64-2a.obj.bz2 create mode 100644 ld/testsuite/ld-x86-64/pe-x86-64-2b.obj.bz2 create mode 100644 ld/testsuite/ld-x86-64/pe-x86-64-2c.obj.bz2 create mode 100644 ld/testsuite/ld-x86-64/pe-x86-64-3.od create mode 100644 ld/testsuite/ld-x86-64/pe-x86-64-3a.obj.bz2 create mode 100644 ld/testsuite/ld-x86-64/pe-x86-64-3b.obj.bz2 create mode 100644 ld/testsuite/ld-x86-64/pe-x86-64-3c.obj.bz2 create mode 100644 ld/testsuite/ld-x86-64/pe-x86-64-3d.obj.bz2 create mode 100644 ld/testsuite/ld-x86-64/pe-x86-64-4.od create mode 100644 ld/testsuite/ld-x86-64/pe-x86-64-4a.obj.bz2 create mode 100644 ld/testsuite/ld-x86-64/pe-x86-64-4b.obj.bz2 create mode 100644 ld/testsuite/ld-x86-64/pe-x86-64-4c.obj.bz2 create mode 100644 ld/testsuite/ld-x86-64/pe-x86-64-4d.obj.bz2 create mode 100644 ld/testsuite/ld-x86-64/pe-x86-64.exp diff --git a/bfd/ChangeLog b/bfd/ChangeLog index b01cd958714..75904fe20b2 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,3 +1,11 @@ +2020-09-16 H.J. Lu + + PR ld/26583 + * config.bfd (targ64_selvecs, targ_selvecs): Add x86_64_pe_vec + to x86_64_pei_vec. + * reloc.c: Include "coff/internal.h". + (bfd_perform_relocation): Adjust relocation for PE/x86-64 inputs. + 2020-09-16 Alan Modra * elf-bfd.h (elf_symbol_from): Remove unused ABFD parameter. diff --git a/bfd/config.bfd b/bfd/config.bfd index 6c2919e47eb..49007359584 100644 --- a/bfd/config.bfd +++ b/bfd/config.bfd @@ -564,13 +564,13 @@ case "${targ}" in i[3-7]86-*-solaris2*) targ_defvec=i386_elf32_sol2_vec targ_selvecs="iamcu_elf32_vec i386_coff_vec i386_pei_vec" - targ64_selvecs="x86_64_elf64_sol2_vec l1om_elf64_vec k1om_elf64_vec x86_64_pei_vec" + targ64_selvecs="x86_64_elf64_sol2_vec l1om_elf64_vec k1om_elf64_vec x86_64_pe_vec x86_64_pei_vec" want64=true ;; #ifdef BFD64 x86_64-*-solaris2*) targ_defvec=i386_elf32_sol2_vec - targ_selvecs="x86_64_elf64_sol2_vec l1om_elf64_vec k1om_elf64_vec iamcu_elf32_vec i386_coff_vec i386_pei_vec x86_64_pei_vec" + targ_selvecs="x86_64_elf64_sol2_vec l1om_elf64_vec k1om_elf64_vec iamcu_elf32_vec i386_coff_vec i386_pei_vec x86_64_pe_vec x86_64_pei_vec" want64=true ;; #endif @@ -609,7 +609,7 @@ case "${targ}" in i[3-7]86-*-freebsd* | i[3-7]86-*-kfreebsd*-gnu) targ_defvec=i386_elf32_fbsd_vec targ_selvecs="i386_elf32_vec iamcu_elf32_vec i386_pei_vec i386_coff_vec" - targ64_selvecs="x86_64_elf64_fbsd_vec x86_64_elf64_vec x86_64_pei_vec l1om_elf64_vec l1om_elf64_fbsd_vec k1om_elf64_vec k1om_elf64_fbsd_vec" + targ64_selvecs="x86_64_elf64_fbsd_vec x86_64_elf64_vec x86_64_pe_vec x86_64_pei_vec l1om_elf64_vec l1om_elf64_fbsd_vec k1om_elf64_vec k1om_elf64_fbsd_vec" # FreeBSD <= 4.0 supports only the old nonstandard way of ABI labelling. case "${targ}" in i[3-7]86-*-freebsd3* | i[3-7]86-*-freebsd4 | i[3-7]86-*-freebsd4.0*) @@ -632,7 +632,7 @@ case "${targ}" in i[3-7]86-*-linux-*) targ_defvec=i386_elf32_vec targ_selvecs="iamcu_elf32_vec i386_pei_vec" - targ64_selvecs="x86_64_elf64_vec x86_64_elf32_vec x86_64_pei_vec l1om_elf64_vec k1om_elf64_vec" + targ64_selvecs="x86_64_elf64_vec x86_64_elf32_vec x86_64_pe_vec x86_64_pei_vec l1om_elf64_vec k1om_elf64_vec" ;; i[3-7]86-*-redox*) targ_defvec=i386_elf32_vec @@ -660,7 +660,7 @@ case "${targ}" in targ_selvecs="i386_elf32_vec iamcu_elf32_vec x86_64_elf32_vec l1om_elf64_vec k1om_elf64_vec" case "${targ}" in x86_64-*-rtems*) - targ_selvecs="${targ_selvecs} x86_64_pei_vec" + targ_selvecs="${targ_selvecs} x86_64_pe_vec x86_64_pei_vec" esac want64=true ;; @@ -671,17 +671,17 @@ case "${targ}" in ;; x86_64-*-freebsd* | x86_64-*-kfreebsd*-gnu) targ_defvec=x86_64_elf64_fbsd_vec - targ_selvecs="i386_elf32_fbsd_vec iamcu_elf32_vec i386_coff_vec i386_pei_vec x86_64_pei_vec i386_elf32_vec x86_64_elf64_vec l1om_elf64_vec l1om_elf64_fbsd_vec k1om_elf64_vec k1om_elf64_fbsd_vec" + targ_selvecs="i386_elf32_fbsd_vec iamcu_elf32_vec i386_coff_vec i386_pei_vec x86_64_pe_vec x86_64_pei_vec i386_elf32_vec x86_64_elf64_vec l1om_elf64_vec l1om_elf64_fbsd_vec k1om_elf64_vec k1om_elf64_fbsd_vec" want64=true ;; x86_64-*-netbsd* | x86_64-*-openbsd*) targ_defvec=x86_64_elf64_vec - targ_selvecs="i386_elf32_vec iamcu_elf32_vec i386_coff_vec i386_pei_vec x86_64_pei_vec l1om_elf64_vec k1om_elf64_vec" + targ_selvecs="i386_elf32_vec iamcu_elf32_vec i386_coff_vec i386_pei_vec x86_64_pe_vec x86_64_pei_vec l1om_elf64_vec k1om_elf64_vec" want64=true ;; x86_64-*-linux-*) targ_defvec=x86_64_elf64_vec - targ_selvecs="i386_elf32_vec iamcu_elf32_vec x86_64_elf32_vec i386_pei_vec x86_64_pei_vec l1om_elf64_vec k1om_elf64_vec" + targ_selvecs="i386_elf32_vec iamcu_elf32_vec x86_64_elf32_vec i386_pei_vec x86_64_pe_vec x86_64_pei_vec l1om_elf64_vec k1om_elf64_vec" want64=true ;; x86_64-*-mingw* | x86_64-*-pe | x86_64-*-pep | x86_64-*-cygwin) diff --git a/bfd/reloc.c b/bfd/reloc.c index dc923fe39c2..9639ad262ae 100644 --- a/bfd/reloc.c +++ b/bfd/reloc.c @@ -51,6 +51,7 @@ SECTION #include "bfdlink.h" #include "libbfd.h" #include "bfdver.h" +#include "coff/internal.h" /* DOCDD INODE @@ -904,6 +905,23 @@ space consuming. For each target: } } } + else if (abfd->xvec->flavour == bfd_target_coff_flavour + && (input_section->output_section->owner->xvec->flavour + == bfd_target_elf_flavour) + && strcmp (abfd->xvec->name, "pe-x86-64") == 0 + && strcmp (input_section->output_section->owner->xvec->name, + "elf64-x86-64") == 0) + { + /* NB: bfd_perform_relocation isn't called to generate PE binary. + _bfd_relocate_contents is called instead. When linking PE + object files to generate ELF output, _bfd_relocate_contents + isn't called and bfd_perform_relocation is used. We need to + adjust relocation here. */ + relocation -= reloc_entry->addend; + if (howto->type >= R_AMD64_PCRLONG_1 + && howto->type <= R_AMD64_PCRLONG_5) + relocation -= (bfd_vma)(howto->type - R_AMD64_PCRLONG); + } /* FIXME: This overflow checking is incomplete, because the value might have overflowed before we get here. For a correct check we diff --git a/ld/ChangeLog b/ld/ChangeLog index b61c3fd0db0..81ad2a5ed2c 100644 --- a/ld/ChangeLog +++ b/ld/ChangeLog @@ -1,3 +1,28 @@ +2020-09-16 H.J. Lu + + PR ld/26583 + * testsuite/ld-x86-64/pe-x86-64-1.od: New file. + * testsuite/ld-x86-64/pe-x86-64-1a.obj.bz2: Likewise. + * testsuite/ld-x86-64/pe-x86-64-1b.obj.bz2: Likewise. + * testsuite/ld-x86-64/pe-x86-64-1c.obj.bz2: Likewise. + * testsuite/ld-x86-64/pe-x86-64-2.od: Likewise. + * testsuite/ld-x86-64/pe-x86-64-2a.obj.bz2: Likewise. + * testsuite/ld-x86-64/pe-x86-64-2b.obj.bz2: Likewise. + * testsuite/ld-x86-64/pe-x86-64-2c.obj.bz2: Likewise. + * testsuite/ld-x86-64/pe-x86-64-3.od: Likewise. + * testsuite/ld-x86-64/pe-x86-64-3a.obj.bz2: Likewise. + * testsuite/ld-x86-64/pe-x86-64-3b.obj.bz2: Likewise. + * testsuite/ld-x86-64/pe-x86-64-3c.obj.bz2: Likewise. + * testsuite/ld-x86-64/pe-x86-64-3d.obj.bz2: Likewise. + * testsuite/ld-x86-64/pe-x86-64-4.od: Likewise. + * testsuite/ld-x86-64/pe-x86-64-4a.obj.bz2: Likewise. + * testsuite/ld-x86-64/pe-x86-64-4b.obj.bz2: Likewise. + * testsuite/ld-x86-64/pe-x86-64-4c.obj.bz2: Likewise. + * testsuite/ld-x86-64/pe-x86-64-4d.obj.bz2: Likewise. + * testsuite/ld-x86-64/pe-x86-64.exp: Likewise. + * testsuite/lib/ld-lib.exp (run_ld_link_tests): Handle bz2 binary + inputs. + 2020-09-16 Alan Modra * plugin.c (asymbol_from_plugin_symbol): Adjust elf_symbol_from diff --git a/ld/testsuite/ld-x86-64/pe-x86-64-1.od b/ld/testsuite/ld-x86-64/pe-x86-64-1.od new file mode 100644 index 00000000000..1ff644ee9c8 --- /dev/null +++ b/ld/testsuite/ld-x86-64/pe-x86-64-1.od @@ -0,0 +1,38 @@ + +.*: +file format .* + +SYMBOL TABLE: +0+401000 l d .text\$mn 0000000000000000 .text\$mn +0+402000 l d .xdata 0000000000000000 .xdata +0+402008 l d .pdata 0000000000000000 .pdata +0+403014 l d .bss 0000000000000000 .bss +0+ l d .debug\$S 0000000000000000 .debug\$S +0+401000 g .text\$mn 0000000000000000 getaddr1 +0+401020 g .text\$mn 0000000000000000 begin +0+403014 g .bss 0000000000000000 __bss_start +0+403014 g .bss 0000000000000000 var +0+401010 g .text\$mn 0000000000000000 getaddr2 +0+403014 g .bss 0000000000000000 _edata +0+403018 g .bss 0000000000000000 _end + + + +Disassembly of section .text\$mn: + +0+401000 : + +[a-f0-9]+: 48 8d 05 0d 20 00 00 lea 0x200d\(%rip\),%rax # 403014 <__bss_start> + +[a-f0-9]+: c3 ret + +[a-f0-9]+: 0f 1f 84 00 00 00 00 00 nopl 0x0\(%rax,%rax,1\) + +0+401010 : + +[a-f0-9]+: 48 8d 05 fd 1f 00 00 lea 0x1ffd\(%rip\),%rax # 403014 <__bss_start> + +[a-f0-9]+: c3 ret + +[a-f0-9]+: 0f 1f 84 00 00 00 00 00 nopl 0x0\(%rax,%rax,1\) + +0+401020 : + +[a-f0-9]+: 48 83 ec 28 sub \$0x28,%rsp + +[a-f0-9]+: e8 d7 ff ff ff call 401000 + +[a-f0-9]+: e8 e2 ff ff ff call 401010 + +[a-f0-9]+: 48 83 c4 28 add \$0x28,%rsp + +[a-f0-9]+: c3 ret +#pass diff --git a/ld/testsuite/ld-x86-64/pe-x86-64-1a.obj.bz2 b/ld/testsuite/ld-x86-64/pe-x86-64-1a.obj.bz2 new file mode 100644 index 0000000000000000000000000000000000000000..42724277d9560c59de8487ca4f2f32d6602524b2 GIT binary patch literal 536 zcmV+z0_XigT4*^jL0KkKS&}(=pa1~;fB*m6ZnR$G?G%6K-bDZZ|4>B&NMHa!Kmd#g zS|kWSAOx@hmN8ofqGY4Q)OjbU4^gAiG}?@SG}A)}&}cnC(dj%$Z9sWOgAGJO)HElk z^d=KSOoq`kzzKvH1PlQ%nlJ$x1gWHHOa_zGX{MSD05kv^00Te(XaGGyglXzeu_(UX zNg!(poV2B6a(qfhlpv$F= zqA81c8cZ=9MJS(YvT6h9a-*;3EvV>43PJ{oqBTr5hqJq`A}PoI4N#$2N@wfQve-!w zkgHisHz&aD1mr!$fNwv9=WLh+vfB*mcZZuru-4=i6-bDZZ|4>B&Kwtm?Kmd#g z+XVcOmG}BCIBMGLO7={s(A%Qev3=;$ZX{8#I(LE+j18N$2ngDu%rcY2B00000 z4GlB^Pp`~g=c$~}%867dnEW457~;Yt3oU(cF%&2awzgNMo~Tud2#C=@$jj9gzsFeA zb~TJpe*%b!Bb8c-Kn<%GRapA1qLmE&eCS6qR55Px%S*T!5hp2rMf+EU5Fx1;G&14@fw4d) zAy%3h@VVO-NMXdN4$@0>1A=D@f#icAV32Up5U7;A4SmG~RK!yS$O(U;-6aG4Z;NK3 g2tfEf@_P_KOJB*)po9YefsgTbBvXY64I~xWP*DouUjP6A literal 0 HcmV?d00001 diff --git a/ld/testsuite/ld-x86-64/pe-x86-64-1c.obj.bz2 b/ld/testsuite/ld-x86-64/pe-x86-64-1c.obj.bz2 new file mode 100644 index 0000000000000000000000000000000000000000..c9a14b02cf2c0d14067314187cfa0a93a532f29b GIT binary patch literal 710 zcmV;%0y+IcT4*^jL0KkKSs$FWxBvlg|NsBr{#4xK{k4Dh-bDZZ|IlehP(cDnK#-0? zWQ+>LdKAC{6LfL8VAV|1R5pz?nWmwj$)Gi00TkkJxq-a00w|@E#FRuqsM%vxQ416%NkHJvkxq&LIZ+)e!9-<83W$!@8jnW|BZl8H%k>tXVXY_% z8>J_~r`3puj#uy14+h2jzG7f9IK$a$&AR0eqysx+`iBf z3AItOY1#D-1f%UnIp)zI@6Vv@k1JX$hy7#_XtiLWwpA|(p-@3o!J}w2WTfOL}3g9C6Qk2GglSCB*`QoAsw(G zLY@Z1gfcfkOR%U!jgv28$x_lFBb_`I>qC-Ga~XdZMi8k1-xTq(SiF3oH?Lg!AKvsu s7W1;FFh1%e9Vc?NBoSc7Sgo5I6#?{9B4HdFvH$qHk}1N3fc)jHz&JcF0{{R3 literal 0 HcmV?d00001 diff --git a/ld/testsuite/ld-x86-64/pe-x86-64-2.od b/ld/testsuite/ld-x86-64/pe-x86-64-2.od new file mode 100644 index 00000000000..1ff644ee9c8 --- /dev/null +++ b/ld/testsuite/ld-x86-64/pe-x86-64-2.od @@ -0,0 +1,38 @@ + +.*: +file format .* + +SYMBOL TABLE: +0+401000 l d .text\$mn 0000000000000000 .text\$mn +0+402000 l d .xdata 0000000000000000 .xdata +0+402008 l d .pdata 0000000000000000 .pdata +0+403014 l d .bss 0000000000000000 .bss +0+ l d .debug\$S 0000000000000000 .debug\$S +0+401000 g .text\$mn 0000000000000000 getaddr1 +0+401020 g .text\$mn 0000000000000000 begin +0+403014 g .bss 0000000000000000 __bss_start +0+403014 g .bss 0000000000000000 var +0+401010 g .text\$mn 0000000000000000 getaddr2 +0+403014 g .bss 0000000000000000 _edata +0+403018 g .bss 0000000000000000 _end + + + +Disassembly of section .text\$mn: + +0+401000 : + +[a-f0-9]+: 48 8d 05 0d 20 00 00 lea 0x200d\(%rip\),%rax # 403014 <__bss_start> + +[a-f0-9]+: c3 ret + +[a-f0-9]+: 0f 1f 84 00 00 00 00 00 nopl 0x0\(%rax,%rax,1\) + +0+401010 : + +[a-f0-9]+: 48 8d 05 fd 1f 00 00 lea 0x1ffd\(%rip\),%rax # 403014 <__bss_start> + +[a-f0-9]+: c3 ret + +[a-f0-9]+: 0f 1f 84 00 00 00 00 00 nopl 0x0\(%rax,%rax,1\) + +0+401020 : + +[a-f0-9]+: 48 83 ec 28 sub \$0x28,%rsp + +[a-f0-9]+: e8 d7 ff ff ff call 401000 + +[a-f0-9]+: e8 e2 ff ff ff call 401010 + +[a-f0-9]+: 48 83 c4 28 add \$0x28,%rsp + +[a-f0-9]+: c3 ret +#pass diff --git a/ld/testsuite/ld-x86-64/pe-x86-64-2a.obj.bz2 b/ld/testsuite/ld-x86-64/pe-x86-64-2a.obj.bz2 new file mode 100644 index 0000000000000000000000000000000000000000..31bd019ea7044a19e2364c3bf6b05b01b4f1d6ee GIT binary patch literal 557 zcmV+|0@D3LT4*^jL0KkKS-9c7!vFy#fA9bQ?mS-O?KFSq-UR>u|4>Z>LSR4u%m7#b z2tptPumPANsA?lpW~Rz`nj=P@lhPU+P{`BN2dSo+G-wS0qfBUx0jH53p}+tD&;S9E zp^yLo000b(fB-TCrlM%oJSu*uAE`I0dYe!*W~ZdkGt~jL0004?0i)E=$jPU3)rlT# z88l6WPOVXl`t(bwkrs$lPLR2|`mYIE#8!>ucd}VD)@QrT;pqg*9zWBpq@a zY)lM$R7IAV>6^xe#IT{6ivNym(O8O=)Td$%MGLe_+tEa5eS)ZMBMN6@Pn@B; zi{~I~Jz$JrC1mAgbBi-Ph5KzpR>*M+kPac{o;GHN^DUryZW;>MUtZ<#OQA%u))JKs zwH_6@X2*)14q)*fzsdU=K^nvi0wXR#t=*Kk;m@2_d#lV;dpboK`w~Q2NW8<|j*ehO z5s)Q`D+B?e0u>|Eq9RRSELUlcb)#`BuY?pEDXJ5HNEt@r;&)DNjs{fZPJ{-pgOVfS vi0;4@%NU@zH|kTXg+e~V#|`cn_tymE literal 0 HcmV?d00001 diff --git a/ld/testsuite/ld-x86-64/pe-x86-64-2b.obj.bz2 b/ld/testsuite/ld-x86-64/pe-x86-64-2b.obj.bz2 new file mode 100644 index 0000000000000000000000000000000000000000..da067fdd2421c0ee1da390ad45967843671b808d GIT binary patch literal 537 zcmV+!0_OcfT4*^jL0KkKS#d;YT>t?2fA9bMZZur;{S<%a-UR>u|4>B&KyXM1j0jo) z2tptfumN^4S{kY8l8uz|45pd~qBfDHngDu$F&?0LPf#>zwKkx7gHI^X{ZML}DW~db z>L;koiRhXdX_IIKWXNI+00_WLjEx#%4FRTI}?_uAD<0^4W`Oz;@lK#tF#u*NMqg2PiL4fQvbbRDpXg>)(`gf1a%fmR;q)GrD$ z8DYTnJ3{TvWu?3yOTiQ)6xxBUAoS~r7E9*8U-0ZdbP9qcv|%nNrQsp`mxXGQGE`3; zUZdOw!5)Ew5D??&18IXaWF<&Q5J+ZFf*8_i{00K;sTBC2gjfPnn4*YbaF8;<5mXYE z8NzeCE}T)!s1A}#gaZS$1OcOho=}i*)exwVxCT?E38{&u637V`C2l1F{*F2+dtW%H b{RAGQ2>&)vbBn<1|BJaIoG3^*qBJgm$XMwA literal 0 HcmV?d00001 diff --git a/ld/testsuite/ld-x86-64/pe-x86-64-2c.obj.bz2 b/ld/testsuite/ld-x86-64/pe-x86-64-2c.obj.bz2 new file mode 100644 index 0000000000000000000000000000000000000000..153cfdcc484324e1e9181bcc8b8ab59c195bd40b GIT binary patch literal 718 zcmV;<0x|tUT4*^jL0KkKS?3mODF6X-fB*mg{#4xK{WX90-bDZZ|Ileha6=NnK!A=y zWC#kzdKAC{69zDYRMS({3=<>Ks5CNqnrIqm0iltgXfgl>fNe*p(?HMwG}A_&)dZr5 zX_G_MGYW=!n^7L7gAi$OM+(-T0`NeMQS5^REInvEC(K!aqM zCIA2c000vKFaSmb7yu>!2x4HE00J-qWWh3E07gb8BLNHm0h`*!UbH`wb>g~aoV(lE zta+Br%M9)_l`pEzWinU@YO0HW$MZHiBZ>uUk_jZC8%@UaQcwcn_K_zlAhNWB)Th6~ zYJ1LU8CUSUp}cYP_0%8%>`6pK8Lh9uRS>a4VH6Jx@f8R_06IcIGQfmk4irR!dWe?} zDmf?gVqts|h3qN4)*f<~)FS+O}XpAQs9Z z2gF4pR&`Ja9M1pbn=e%rR>|mCn~E+>075ofAu5l=^wH3ULXwXKs4YTZv>FPQ{T{+Q zPe;u|{i0Q4nj`1nput#-g8>dfYqzbG(*T2*7&)fwl$}rI-VfDk0Q%~!wI82OyGk4-BwZv$7U*_5Gt{{ znIt@!YaP^a!i!wV0-ZaMd`lx^^~+Y32M5U_bl#XVL6o5uDTBmv^;h~y9)U7~H;a)& zDsqkl)BJauZ3V*fGG>1XY0oDH<7P9?ts6#%EFuZUT;~yi>eT-iaz!{$kmnX_DOChB Aga7~l literal 0 HcmV?d00001 diff --git a/ld/testsuite/ld-x86-64/pe-x86-64-3.od b/ld/testsuite/ld-x86-64/pe-x86-64-3.od new file mode 100644 index 00000000000..1ff644ee9c8 --- /dev/null +++ b/ld/testsuite/ld-x86-64/pe-x86-64-3.od @@ -0,0 +1,38 @@ + +.*: +file format .* + +SYMBOL TABLE: +0+401000 l d .text\$mn 0000000000000000 .text\$mn +0+402000 l d .xdata 0000000000000000 .xdata +0+402008 l d .pdata 0000000000000000 .pdata +0+403014 l d .bss 0000000000000000 .bss +0+ l d .debug\$S 0000000000000000 .debug\$S +0+401000 g .text\$mn 0000000000000000 getaddr1 +0+401020 g .text\$mn 0000000000000000 begin +0+403014 g .bss 0000000000000000 __bss_start +0+403014 g .bss 0000000000000000 var +0+401010 g .text\$mn 0000000000000000 getaddr2 +0+403014 g .bss 0000000000000000 _edata +0+403018 g .bss 0000000000000000 _end + + + +Disassembly of section .text\$mn: + +0+401000 : + +[a-f0-9]+: 48 8d 05 0d 20 00 00 lea 0x200d\(%rip\),%rax # 403014 <__bss_start> + +[a-f0-9]+: c3 ret + +[a-f0-9]+: 0f 1f 84 00 00 00 00 00 nopl 0x0\(%rax,%rax,1\) + +0+401010 : + +[a-f0-9]+: 48 8d 05 fd 1f 00 00 lea 0x1ffd\(%rip\),%rax # 403014 <__bss_start> + +[a-f0-9]+: c3 ret + +[a-f0-9]+: 0f 1f 84 00 00 00 00 00 nopl 0x0\(%rax,%rax,1\) + +0+401020 : + +[a-f0-9]+: 48 83 ec 28 sub \$0x28,%rsp + +[a-f0-9]+: e8 d7 ff ff ff call 401000 + +[a-f0-9]+: e8 e2 ff ff ff call 401010 + +[a-f0-9]+: 48 83 c4 28 add \$0x28,%rsp + +[a-f0-9]+: c3 ret +#pass diff --git a/ld/testsuite/ld-x86-64/pe-x86-64-3a.obj.bz2 b/ld/testsuite/ld-x86-64/pe-x86-64-3a.obj.bz2 new file mode 100644 index 0000000000000000000000000000000000000000..1c3e28d3cffbbfbeba0e1e5813499c39343ac4da GIT binary patch literal 538 zcmV+#0_FWeT4*^jL0KkKS$p~vcK`tR|L_0%ZZuru{S<%a-VFc$|4>B+K;S?Cj0jo; z2tpu)umP4aS`AZ7q;(yWHAN+1i+X^MvXBBfYVAfC#20yJxqfmAOO$-gfsxq4FCWPhoTx2 zZFQ2nw9HkAi4-ANd>ddC!rCVVmh(Uq

7m?%L$j*$S{d5gI5NV!hB?{D#JzV_BsK z@F<9pI#x+VC>-BZO%sSfKqfx8BHcxlIFXIpIi|6pa&L%n<(55EB%=J`^I7La2t+dR zTO}B=WvIsnz=RkQ6iFadB9V32Ei1=1~4JW5JuYuc+W;?h8u^Y6gJ_}HE@X`TCkmz@3Vn`BEncq3#t(Yi~$ot zDM6ek8{*-`5mf=oNpS#RcA$VaKq=)32JI0Fi3@;bCOD9gkYJ$!2?xr4iHePgv cU*LGaK*Q)*Fn#feKCk$@k}1N3gWu4jxFN*p-~a#s literal 0 HcmV?d00001 diff --git a/ld/testsuite/ld-x86-64/pe-x86-64-3b.obj.bz2 b/ld/testsuite/ld-x86-64/pe-x86-64-3b.obj.bz2 new file mode 100644 index 0000000000000000000000000000000000000000..2af616598e8c7b7c4c8a30a69ebdf782b6ca4ac6 GIT binary patch literal 539 zcmV+$0_6QdT4*^jL0KkKS^0@<+5iCf|L_0%ZZuru-Bf?)-UR>u|4~IEKwv-tj0jo~ z2tptPumN^4S{kY8lA9FGCy<&9(t1ra)6@e@fu>AA+8}7tYGi0>rjIG1`k>V`L)6pN zH1wIIWW>`Zm=TGSMn)!>6B7Ug!3-u%4F;M~sL?$pnKWtYGHB2YfYVP<(VzeT003w` zO#wE~fjxRtFkXh>0JWW|UHa&9y|Ra7YLP@GbC`qQ%(qjOKCWv7vBhkmQA;2uY>~$HjXmL@1;( za<)n_WYAGW7-S&4c|^hmVmHm7rc%ajECB&7$f7jLC=UB294?#|i2|O4E0ri(m=Z)J zDW_`wr;WMEDRQy`WU8h#uuCj5u+A*jgLC2txinx{7;1;I5gceVx($-#am4R~=6=Ui z8ByzpCfgXU?k=-}@_tC5_@>(v_Ct~`rdU^u{u{W?$Dha-#EEi*`6D^^q1)VuJD$c- zNOXFSa2o_x3={zlLWnjP9}K57DljWAC}4H;Cb00Nuc+lq4GQq8W(lKwBm#jG&C_A#ws0>h(F`gPb1; dtUw0@9^?#uKjttv#tygmyOJrwgon&aX3%Yp?HB+6 literal 0 HcmV?d00001 diff --git a/ld/testsuite/ld-x86-64/pe-x86-64-3c.obj.bz2 b/ld/testsuite/ld-x86-64/pe-x86-64-3c.obj.bz2 new file mode 100644 index 0000000000000000000000000000000000000000..821c01bde64bbed5e2650dbaa24ba4521ca36375 GIT binary patch literal 716 zcmV;-0yF(WT4*^jL0KkKS#u-ar2qkP|NsC0{#4xK{WX90-c0}h|IlehP(cDfK!A=y zWC#k*dlbL|6Lfb@)(ulZBV^KfOhZP8qzwSjXc``-fB*mu8Z^_?#-IkCpaG-PC^a=T z4KgNbdSXEIX&M>^gGPV=&@uo3&}aYv0iXa4G^EislO~#I0i!@P00w{n000004FCWD z27*-8G$SYKn1;~+8UO$QGynhq00000dW?VpCrb3Qmzo?_5<*Ci7AtiVQi$y?;YDGKvQVc#4G}0PO`lMnn|C4pB-|)M*F?KfW$mIm|Bh=9(LEP1QsB&Q4l&J0S}<6 z0Q0S{sK!f`MOC39f6OC%(nQp%qAR3V4%VZChiv-Snp*;KyniXpagAgFf` zhApIYXjb6Ba9T0o(V~Z^>oR(xAu2pHQBz#7q&xEtIJ%&zVq`dM2qQw^T&@_IYG-nU z-``f#qF?dCvMdfyLdOpv1D##7LZuGWe!i&Zwv-r{x^lwweJ=rJ5W`{&1+Ij(Cb=;5 zmpRMkpf5NFVI*H76i9n?D^R?I8i53&n44r!Oj3)}MevI_Fae_!u?bQTz9U75Ez?FT zf*HE1CDaehxf)mGlS+ItsEwK^24Kg$R39HGjIl6E0ch|DnhQS(HX<-!0woTtfV^g) ziDpF+IEAAi_3R*6sDlFM$!5r+Fj+AH(I{Iu2hSN2198~~ZzU)aJx{2oG!Z=9rgI>@ y4fp)A&}*|HY6J1)@^Np^kb81yoj7#au}D7LH1)Q|cy0Qh;_gVN3K9-vd(@x>|0@;% literal 0 HcmV?d00001 diff --git a/ld/testsuite/ld-x86-64/pe-x86-64-3d.obj.bz2 b/ld/testsuite/ld-x86-64/pe-x86-64-3d.obj.bz2 new file mode 100644 index 0000000000000000000000000000000000000000..173bb4116ad579fa277a59be69e44ca11a7adb77 GIT binary patch literal 432 zcmV;h0Z;xyT4*^jL0KkKSwbO0B8n)Gz|b~003yn007WRiBHf;v}UAwk4fno0j8P&GzO1Q z0ib$K0qSB6285}!n3w=Y38MfBh+q>VA)v(55vCIev1Yo}XElMhoT%ed8v7-so$AY? z9$o^}gd*Bh=j_RfWd-plAi%&F`CX_ez`SHAm;k8nPJm&>2R%O2)UiV{Z6qN%HGC|u z%_vGGkt87izDx}-R{=oeaiIYG*hfJ>-32Yb%jVKpUo}K0T>UTrm0?(&Fb+)|WiP>G za5f6#MCKVlb?I#|0sy$6p}dIoT1?RdiBCY|5Gg@2Kq8~` zo{6N2atA!6BqzYKo5sE+rtT79)nKf4d>{o4m zULzjUqD4SqVq%`_`^FVoQ61=P)S_N}_9>G?fKfG+#REkWy#d(afQA@Fq)dD_qn&@j aKKMoaAowK+1w4X<{}*yaI8cyA7pwnC&$v: + +[a-f0-9]+: 48 83 ec 28 sub \$0x28,%rsp + +[a-f0-9]+: 48 c7 05 29 20 00 00 01 00 00 00 movq \$0x1,0x2029\(%rip\) # 403038 <__bss_start> + +[a-f0-9]+: e8 4c 00 00 00 call 401060 + +[a-f0-9]+: e8 07 00 00 00 call 401020 + +[a-f0-9]+: 48 83 c4 28 add \$0x28,%rsp + +[a-f0-9]+: c3 ret + +[a-f0-9]+: 66 90 xchg %ax,%ax + +0+401020 : + +[a-f0-9]+: b8 33 22 00 00 mov \$0x2233,%eax + +[a-f0-9]+: c6 05 ec 1f 00 00 12 movb \$0x12,0x1fec\(%rip\) # 403018 + +[a-f0-9]+: 66 89 05 e7 1f 00 00 mov %ax,0x1fe7\(%rip\) # 40301a + +[a-f0-9]+: 48 b8 99 99 99 99 88 88 88 88 movabs \$0x8888888899999999,%rax + +[a-f0-9]+: 48 89 05 dc 1f 00 00 mov %rax,0x1fdc\(%rip\) # 403020 + +[a-f0-9]+: 83 c8 ff or \$0xffffffff,%eax + +[a-f0-9]+: c7 05 cb 1f 00 00 55 55 44 44 movl \$0x44445555,0x1fcb\(%rip\) # 40301c + +[a-f0-9]+: c3 ret + +[a-f0-9]+: 66 2e 0f 1f 84 00 00 00 00 00 nopw %cs:0x0\(%rax,%rax,1\) + +[a-f0-9]+: 0f 1f 40 00 nopl 0x0\(%rax\) + +0+401060 : + +[a-f0-9]+: 48 89 4c 24 08 mov %rcx,0x8\(%rsp\) + +[a-f0-9]+: b8 10 00 00 00 mov \$0x10,%eax + +[a-f0-9]+: 48 6b c0 00 imul \$0x0,%rax,%rax + +[a-f0-9]+: 48 8d 0d a3 1f 00 00 lea 0x1fa3\(%rip\),%rcx # 403018 + +[a-f0-9]+: c6 04 01 11 movb \$0x11,\(%rcx,%rax,1\) + +[a-f0-9]+: b8 10 00 00 00 mov \$0x10,%eax + +[a-f0-9]+: 48 6b c0 00 imul \$0x0,%rax,%rax + +[a-f0-9]+: 48 8d 0d 8f 1f 00 00 lea 0x1f8f\(%rip\),%rcx # 403018 + +[a-f0-9]+: ba 22 22 00 00 mov \$0x2222,%edx + +[a-f0-9]+: 66 89 54 01 02 mov %dx,0x2\(%rcx,%rax,1\) + +[a-f0-9]+: b8 10 00 00 00 mov \$0x10,%eax + +[a-f0-9]+: 48 6b c0 00 imul \$0x0,%rax,%rax + +[a-f0-9]+: 48 8d 0d 75 1f 00 00 lea 0x1f75\(%rip\),%rcx # 403018 + +[a-f0-9]+: c7 44 01 04 44 44 44 44 movl \$0x44444444,0x4\(%rcx,%rax,1\) + +[a-f0-9]+: b8 10 00 00 00 mov \$0x10,%eax + +[a-f0-9]+: 48 6b c0 00 imul \$0x0,%rax,%rax + +[a-f0-9]+: 48 8d 0d 5d 1f 00 00 lea 0x1f5d\(%rip\),%rcx # 403018 + +[a-f0-9]+: 48 ba 88 88 88 88 88 88 88 88 movabs \$0x8888888888888888,%rdx + +[a-f0-9]+: 48 89 54 01 08 mov %rdx,0x8\(%rcx,%rax,1\) + +[a-f0-9]+: b8 ff ff ff ff mov \$0xffffffff,%eax + +[a-f0-9]+: c3 ret +#pass diff --git a/ld/testsuite/ld-x86-64/pe-x86-64-4a.obj.bz2 b/ld/testsuite/ld-x86-64/pe-x86-64-4a.obj.bz2 new file mode 100644 index 0000000000000000000000000000000000000000..99db1e8ff854060657f56c71d28e3860c11b17ff GIT binary patch literal 668 zcmV;N0%QF`T4*^jL0KkKSz2F5X#fFSfA9bP`f=Rn?KFSq-W31;-_Th=Op!4^TFc007X)2dSV3000000001FGynhq000000F=~IDe8GoL_JaZ zrkF>l^#+?r^ahYHMnKSH1`|vGn3y0LsCHZ|#10RX^fbl_73(6Tja$eiSYIB?>8~ka zvh-mXv*-0T2uExY9mTM&W4f}jV5d%3jZP;8l8U9f!c^Aw1=^ZtLH1ui-0$c~BiIgP zkTV(cjwehHMr=+RC62F|Gc!_5&>@E)X)$?T(JI6)6upU0<{Yyk_=UF221Bo*ny!j z;GkEmV9Id7e`;6aJAL$s!i;#i24$&^Yc!LYvsIk5=(9wvRB zHHR#vct{7DQi4ZSe8Anr$Ywe@2$}&y6cb!A;bIklR|Mw?CmLY_Vp$`?a9+?*V&Cy# zV-@1eGi)ja%n4oQ<5PYkuj+e_x&Q#|fB*mf`Vd^>{ZxPNo&^8@-_T27L?DD91VG8a zU=RodA{4Lzb}-uwLMGJHQ_++%WB@%!sK^=yni&D1pk!%?Y3Y>p2dL2X8&GP9ntEYO znWW7o0x_X5CI*p^z?h8~ATS7F7!wUOHB;1jo>AzTJwqYs05kvwgFpZP01W}49#AJG zSxNQyT%wq=PcXBME6q-vjZwkGKnIj*{11=`fFzJhGY~~V2;u6dQ0tZPMs3*5g@~a3 z1R@6t4pU@Ngd&l3w7>-N=|n`d$Ydt$JuO6)ersG)nM^y#r87!MBLI0Z9U(m;V6mY^ zQl&o&YgvTBtX?RFJ6N*XN;4P)C)Ogt7GsKneB%(3i_*+g7vwP?@-TmeBo!`!LUYQ6 zy^d-YWrWfRjyQ-iE*`UiAgT!>4XT8#E&d#Mh;}%99Id@JRgEUl&K_xK^V1+);D-6d=zmz1J{I7lk^b} ae;6oO<)U8;rw~CO{9VZu;X*@{U*hO${^ia9 literal 0 HcmV?d00001 diff --git a/ld/testsuite/ld-x86-64/pe-x86-64-4c.obj.bz2 b/ld/testsuite/ld-x86-64/pe-x86-64-4c.obj.bz2 new file mode 100644 index 0000000000000000000000000000000000000000..6b4efca9b56060f10d6adbb017cc43c9d5136e4a GIT binary patch literal 563 zcmV-30?hqFT4*^jL0KkKS&Wb%o&W&^|L_0)>Jnb-#T5VN-h}`E-_S$iL;wU($$~%t z2!bFmumP4D+iW#Ppw#srsMPeDXvwrA6Gob3Fqn*nOaKOm$%HnOMrhO;lO*(~p{V^+ z$Y~EyWYcOIVtSaF05s4&LlYo0F{!4RGys$$jY;DsspOc^4K|ZBj4~Q0ifNNT#9$ND zX^DxZ8a*V^oi3Itt^w*cRd5y@1HXZd*tg5s`mZcNNJxaLc5=WdB}QA=Oe8Z~j+ij% zmt%X>jhPd`Q4pS}K(y2bUs9rMt?GuF&r|@hBYMmRA|asu3o@N865uH|@>M6KOH^G& zJd)T;tNZKPaRW5ClDf5b`LkIfRa8ZetEeb+NrvJMrVBQn;ImzWuoNx@M#_Ruqde2% zVoh9GdXkE(e_>t8@+XV!ePI4eH+Mlp1e$aq?XgN!F(y*vfL7hr&HC@{_cTUyIJ}S@jNRDE~4U3Ce@h^y*9+`aq zRnoa+DFph|jB+CoHPQ*1&KGU)Npc1PKaz-WxR9|gu>-i?kU z$6PdE!a*p#50Vb(Fp&hKw5ZCf!&e<>i2>?B7Bt0;!Gq|-D-%v$>NFV?Z3p;87EDvd&E{2Yx^8?Mb=DGKKXEI9f6_FGbK z9`uay@tT0d(;h)gIdn3Xbkof=$Ghdg{SVQQi$-msV0FEDw`6lmktn#0X!~QNagQ; gXK8D;*4~G8Bc|o*$yw&WWxsKEBvXY624i`1kSXH5%m4rY literal 0 HcmV?d00001 diff --git a/ld/testsuite/ld-x86-64/pe-x86-64.exp b/ld/testsuite/ld-x86-64/pe-x86-64.exp new file mode 100644 index 00000000000..74d06e015bb --- /dev/null +++ b/ld/testsuite/ld-x86-64/pe-x86-64.exp @@ -0,0 +1,66 @@ +# Expect script for ELF tests with pe-x86-64 inputs. +# Copyright (C) 2020 Free Software Foundation, Inc. +# +# This file is part of the GNU Binutils. +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, +# MA 02110-1301, USA. +# + +# Only for Linux/x86-64. +if {![istarget "x86_64-*-linux*"] } { + return +} + +run_ld_link_tests [list \ + [list \ + "Build pe-x86-64-1" \ + "-m elf_x86_64 --entry=begin" \ + "" \ + "" \ + {pe-x86-64-1a.obj.bz2 pe-x86-64-1b.obj.bz2 pe-x86-64-1c.obj.bz2} \ + {{objdump {-dw --sym} pe-x86-64-1.od}} \ + "pe-x86-64-1" \ + ] \ + [list \ + "Build pe-x86-64-2" \ + "-m elf_x86_64 --entry=begin" \ + "" \ + "" \ + {pe-x86-64-2a.obj.bz2 pe-x86-64-2b.obj.bz2 pe-x86-64-2c.obj.bz2} \ + {{objdump {-dw --sym} pe-x86-64-2.od}} \ + "pe-x86-64-2" \ + ] \ + [list \ + "Build pe-x86-64-3" \ + "-m elf_x86_64 --entry=begin" \ + "" \ + "" \ + {pe-x86-64-3a.obj.bz2 pe-x86-64-3b.obj.bz2 pe-x86-64-3c.obj.bz2 \ + pe-x86-64-3d.obj.bz2 } \ + {{objdump {-dw --sym} pe-x86-64-3.od}} \ + "pe-x86-64-3" \ + ] \ + [list \ + "Build pe-x86-64-4" \ + "-m elf_x86_64 --entry=begin" \ + "" \ + "" \ + {pe-x86-64-4a.obj.bz2 pe-x86-64-4b.obj.bz2 pe-x86-64-4c.obj.bz2 \ + pe-x86-64-4d.obj.bz2 } \ + {{objdump {-dw --sym} pe-x86-64-4.od}} \ + "pe-x86-64-4" \ + ] \ +] diff --git a/ld/testsuite/lib/ld-lib.exp b/ld/testsuite/lib/ld-lib.exp index 7972e8fd33c..e933be781b7 100644 --- a/ld/testsuite/lib/ld-lib.exp +++ b/ld/testsuite/lib/ld-lib.exp @@ -506,22 +506,34 @@ proc run_ld_link_tests { ldtests args } { # Assemble each file in the test. foreach src_file $src_files { set fileroot "[file rootname [file tail $src_file]]" - set objfile "tmpdir/$fileroot.o" - lappend objfiles $objfile - if { [file extension $src_file] == ".c" } { - set as_file "tmpdir/$fileroot.s" - if ![ld_compile "$CC -S $CFLAGS $cflags" $srcdir/$subdir/$src_file $as_file] { + if { [file extension $src_file] == ".bz2" } { + set objfile tmpdir/[file rootname $src_file] + set unbzip2 "system \"bzip2 -dc $srcdir/$subdir/$src_file > $objfile\"" + send_log "$unbzip2\n" + catch "$unbzip2" exec_output + if ![string match "" $exec_output] then { + send_log "$exec_output\n" set is_unresolved 1 break } } else { - set as_file "$srcdir/$subdir/$src_file" - } - if ![ld_assemble $as "$as_options $as_file" $objfile] { - set failed 1 - break + set objfile "tmpdir/$fileroot.o" + if { [file extension $src_file] == ".c" } { + set as_file "tmpdir/$fileroot.s" + if ![ld_compile "$CC -S $CFLAGS $cflags" $srcdir/$subdir/$src_file $as_file] { + set is_unresolved 1 + break + } + } else { + set as_file "$srcdir/$subdir/$src_file" + } + if ![ld_assemble $as "$as_options $as_file" $objfile] { + set failed 1 + break + } } + lappend objfiles $objfile } # Catch assembler errors. -- 2.30.2