diff options
author | Adhemerval Zanella <adhemerval.zanella@linaro.org> | 2018-01-15 15:43:10 -0200 |
---|---|---|
committer | Adhemerval Zanella <adhemerval.zanella@linaro.org> | 2018-01-15 15:43:10 -0200 |
commit | acf4fe13d46e15a09cb922247bf70157e4ff8656 (patch) | |
tree | 2bf256e418d52453a98ac828b6a71d614dc5ea2d | |
parent | e2bd6d4d2f35ca1ff9f7d6667f4274efa7781df3 (diff) | |
parent | 1e4d2a179d04d08bf113706939dd502c46301261 (diff) | |
download | gdb-acf4fe13d46e15a09cb922247bf70157e4ff8656.zip gdb-acf4fe13d46e15a09cb922247bf70157e4ff8656.tar.gz gdb-acf4fe13d46e15a09cb922247bf70157e4ff8656.tar.bz2 |
Merge with binutils-2_28-branch rev 1e4d2a179d0
112 files changed, 1320 insertions, 99 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog index 496a5ca..a376ed3 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,3 +1,87 @@ +2017-09-28 Alan Modra <amodra@gmail.com> + + PR 22220 + * elflink.c (_bfd_elf_merge_symbol): Set non_ir_ref_dynamic in + a case where plugin_notice isn't called. + +2017-09-27 Alan Modra <amodra@gmail.com> + + Apply from master + 2017-05-16 Alan Modra <amodra@gmail.com> + * elf-m10300.c: Rename occurrences of non_ir_ref. + * elf32-arm.c: Likewise. + * elf32-bfin.c: Likewise. + * elf32-cr16.c: Likewise. + * elf32-cris.c: Likewise. + * elf32-d10v.c: Likewise. + * elf32-dlx.c: Likewise. + * elf32-fr30.c: Likewise. + * elf32-frv.c: Likewise. + * elf32-hppa.c: Likewise. + * elf32-i370.c: Likewise. + * elf32-i386.c: Likewise. + * elf32-iq2000.c: Likewise. + * elf32-lm32.c: Likewise. + * elf32-m32c.c: Likewise. + * elf32-m32r.c: Likewise. + * elf32-m68hc1x.c: Likewise. + * elf32-m68k.c: Likewise. + * elf32-mcore.c: Likewise. + * elf32-metag.c: Likewise. + * elf32-microblaze.c: Likewise. + * elf32-moxie.c: Likewise. + * elf32-msp430.c: Likewise. + * elf32-mt.c: Likewise. + * elf32-nios2.c: Likewise. + * elf32-or1k.c: Likewise. + * elf32-ppc.c: Likewise. + * elf32-rl78.c: Likewise. + * elf32-s390.c: Likewise. + * elf32-score.c: Likewise. + * elf32-score7.c: Likewise. + * elf32-sh.c: Likewise. + * elf32-tic6x.c: Likewise. + * elf32-tilepro.c: Likewise. + * elf32-v850.c: Likewise. + * elf32-vax.c: Likewise. + * elf32-xstormy16.c: Likewise. + * elf32-xtensa.c: Likewise. + * elf64-alpha.c: Likewise. + * elf64-hppa.c: Likewise. + * elf64-ia64-vms.c: Likewise. + * elf64-mmix.c: Likewise. + * elf64-ppc.c: Likewise. + * elf64-s390.c: Likewise. + * elf64-sh64.c: Likewise. + * elf64-x86-64.c: Likewise. + * elflink.c: Likewise. + * elfnn-aarch64.c: Likewise. + * elfnn-ia64.c: Likewise. + * elfnn-riscv.c: Likewise. + * elfxx-mips.c: Likewise. + * elfxx-sparc.c: Likewise. + * elfxx-tilegx.c: Likewise. + * linker.c: Likewise. + + 2017-05-16 Alan Modra <amodra@gmail.com> + * elf64-ppc.c (add_symbol_adjust): Transfer non_ir_ref_dynamic. + * elflink.c (elf_link_add_object_symbols): Update to use + non_ir_ref_dynamic. + (elf_link_input_bfd): Test non_ir_ref_dynamic in addition to + non_ir_ref. + * linker.c (_bfd_generic_link_add_one_symbol): Likewise. + + 2017-04-20 H.J. Lu <hongjiu.lu@intel.com> + PR ld/21382 + * elflink.c (elf_link_add_object_symbols): Preserve + dynamic_ref_after_ir_def when restoring the symbol table for + unneeded dynamic object. + +2017-08-30 Maciej W. Rozycki <macro@imgtec.com> + + * elfxx-mips.c (mips_elf_perform_relocation): Correct microMIPS + branch offset interpretation. + 2017-07-28 Andreas Krebbel <krebbel@linux.vnet.ibm.com> Backport from mainline diff --git a/bfd/elf-m10300.c b/bfd/elf-m10300.c index e7d466b..66bdca7 100644 --- a/bfd/elf-m10300.c +++ b/bfd/elf-m10300.c @@ -1094,7 +1094,7 @@ mn10300_elf_check_relocs (bfd *abfd, /* PR15323, ref flags aren't set for references in the same object. */ - h->root.non_ir_ref = 1; + h->root.non_ir_ref_regular = 1; } r_type = ELF32_R_TYPE (rel->r_info); diff --git a/bfd/elf32-arm.c b/bfd/elf32-arm.c index 9f956d3..7b142a0 100644 --- a/bfd/elf32-arm.c +++ b/bfd/elf32-arm.c @@ -14553,7 +14553,7 @@ elf32_arm_check_relocs (bfd *abfd, struct bfd_link_info *info, /* PR15323, ref flags aren't set for references in the same object. */ - h->root.non_ir_ref = 1; + h->root.non_ir_ref_regular = 1; } } diff --git a/bfd/elf32-bfin.c b/bfd/elf32-bfin.c index 2a53903..9a43409 100644 --- a/bfd/elf32-bfin.c +++ b/bfd/elf32-bfin.c @@ -1191,7 +1191,7 @@ bfin_check_relocs (bfd * abfd, /* PR15323, ref flags aren't set for references in the same object. */ - h->root.non_ir_ref = 1; + h->root.non_ir_ref_regular = 1; } switch (ELF32_R_TYPE (rel->r_info)) diff --git a/bfd/elf32-cr16.c b/bfd/elf32-cr16.c index 92aa0c8..c36388e 100644 --- a/bfd/elf32-cr16.c +++ b/bfd/elf32-cr16.c @@ -738,7 +738,7 @@ cr16_elf_check_relocs (bfd *abfd, struct bfd_link_info *info, asection *sec, /* PR15323, ref flags aren't set for references in the same object. */ - h->root.non_ir_ref = 1; + h->root.non_ir_ref_regular = 1; } /* Some relocs require a global offset table. */ diff --git a/bfd/elf32-cris.c b/bfd/elf32-cris.c index d4bbceb..83c4101 100644 --- a/bfd/elf32-cris.c +++ b/bfd/elf32-cris.c @@ -3178,7 +3178,7 @@ cris_elf_check_relocs (bfd *abfd, /* PR15323, ref flags aren't set for references in the same object. */ - h->root.non_ir_ref = 1; + h->root.non_ir_ref_regular = 1; } r_type = ELF32_R_TYPE (rel->r_info); diff --git a/bfd/elf32-d10v.c b/bfd/elf32-d10v.c index 6b6fb34..d284d4f 100644 --- a/bfd/elf32-d10v.c +++ b/bfd/elf32-d10v.c @@ -294,7 +294,7 @@ elf32_d10v_check_relocs (bfd *abfd, /* PR15323, ref flags aren't set for references in the same object. */ - h->root.non_ir_ref = 1; + h->root.non_ir_ref_regular = 1; } switch (ELF32_R_TYPE (rel->r_info)) diff --git a/bfd/elf32-dlx.c b/bfd/elf32-dlx.c index 965d866..b12d24a 100644 --- a/bfd/elf32-dlx.c +++ b/bfd/elf32-dlx.c @@ -454,7 +454,7 @@ elf32_dlx_check_relocs (bfd *abfd, /* PR15323, ref flags aren't set for references in the same object. */ - h->root.non_ir_ref = 1; + h->root.non_ir_ref_regular = 1; } switch (ELF32_R_TYPE (rel->r_info)) diff --git a/bfd/elf32-fr30.c b/bfd/elf32-fr30.c index f668074..94070d8 100644 --- a/bfd/elf32-fr30.c +++ b/bfd/elf32-fr30.c @@ -673,7 +673,7 @@ fr30_elf_check_relocs (bfd *abfd, /* PR15323, ref flags aren't set for references in the same object. */ - h->root.non_ir_ref = 1; + h->root.non_ir_ref_regular = 1; } switch (ELF32_R_TYPE (rel->r_info)) diff --git a/bfd/elf32-frv.c b/bfd/elf32-frv.c index f998690..415c92d 100644 --- a/bfd/elf32-frv.c +++ b/bfd/elf32-frv.c @@ -6041,7 +6041,7 @@ elf32_frv_check_relocs (bfd *abfd, /* PR15323, ref flags aren't set for references in the same object. */ - h->root.non_ir_ref = 1; + h->root.non_ir_ref_regular = 1; } switch (ELF32_R_TYPE (rel->r_info)) diff --git a/bfd/elf32-hppa.c b/bfd/elf32-hppa.c index 1deebf4..0087c71 100644 --- a/bfd/elf32-hppa.c +++ b/bfd/elf32-hppa.c @@ -1171,7 +1171,7 @@ elf32_hppa_check_relocs (bfd *abfd, /* PR15323, ref flags aren't set for references in the same object. */ - hh->eh.root.non_ir_ref = 1; + hh->eh.root.non_ir_ref_regular = 1; } r_type = ELF32_R_TYPE (rela->r_info); diff --git a/bfd/elf32-i370.c b/bfd/elf32-i370.c index f8e825f..4c40b79 100644 --- a/bfd/elf32-i370.c +++ b/bfd/elf32-i370.c @@ -839,7 +839,7 @@ i370_elf_check_relocs (bfd *abfd, /* PR15323, ref flags aren't set for references in the same object. */ - h->root.non_ir_ref = 1; + h->root.non_ir_ref_regular = 1; } if (bfd_link_pic (info)) diff --git a/bfd/elf32-i386.c b/bfd/elf32-i386.c index f570253..3ee61bb 100644 --- a/bfd/elf32-i386.c +++ b/bfd/elf32-i386.c @@ -1978,7 +1978,7 @@ elf_i386_check_relocs (bfd *abfd, /* It is referenced by a non-shared object. */ h->ref_regular = 1; - h->root.non_ir_ref = 1; + h->root.non_ir_ref_regular = 1; if (h->type == STT_GNU_IFUNC) elf_tdata (info->output_bfd)->has_gnu_symbols diff --git a/bfd/elf32-iq2000.c b/bfd/elf32-iq2000.c index f28e751..8baec19 100644 --- a/bfd/elf32-iq2000.c +++ b/bfd/elf32-iq2000.c @@ -486,7 +486,7 @@ iq2000_elf_check_relocs (bfd *abfd, /* PR15323, ref flags aren't set for references in the same object. */ - h->root.non_ir_ref = 1; + h->root.non_ir_ref_regular = 1; } switch (ELF32_R_TYPE (rel->r_info)) diff --git a/bfd/elf32-lm32.c b/bfd/elf32-lm32.c index a6fafef..aabf49f 100644 --- a/bfd/elf32-lm32.c +++ b/bfd/elf32-lm32.c @@ -1272,7 +1272,7 @@ lm32_elf_check_relocs (bfd *abfd, /* PR15323, ref flags aren't set for references in the same object. */ - h->root.non_ir_ref = 1; + h->root.non_ir_ref_regular = 1; } /* Some relocs require a global offset table. */ diff --git a/bfd/elf32-m32c.c b/bfd/elf32-m32c.c index b5e2474..53ae9b1 100644 --- a/bfd/elf32-m32c.c +++ b/bfd/elf32-m32c.c @@ -689,7 +689,7 @@ m32c_elf_check_relocs /* PR15323, ref flags aren't set for references in the same object. */ - h->root.non_ir_ref = 1; + h->root.non_ir_ref_regular = 1; } switch (ELF32_R_TYPE (rel->r_info)) diff --git a/bfd/elf32-m32r.c b/bfd/elf32-m32r.c index 645a1ff..3c591fa 100644 --- a/bfd/elf32-m32r.c +++ b/bfd/elf32-m32r.c @@ -3706,7 +3706,7 @@ m32r_elf_check_relocs (bfd *abfd, /* PR15323, ref flags aren't set for references in the same object. */ - h->root.non_ir_ref = 1; + h->root.non_ir_ref_regular = 1; } /* Some relocs require a global offset table. */ diff --git a/bfd/elf32-m68hc1x.c b/bfd/elf32-m68hc1x.c index 86e52d8..96fc96f 100644 --- a/bfd/elf32-m68hc1x.c +++ b/bfd/elf32-m68hc1x.c @@ -879,7 +879,7 @@ elf32_m68hc11_check_relocs (bfd *abfd, struct bfd_link_info *info, /* PR15323, ref flags aren't set for references in the same object. */ - h->root.non_ir_ref = 1; + h->root.non_ir_ref_regular = 1; } switch (ELF32_R_TYPE (rel->r_info)) diff --git a/bfd/elf32-m68k.c b/bfd/elf32-m68k.c index 20e6362..932d8ff 100644 --- a/bfd/elf32-m68k.c +++ b/bfd/elf32-m68k.c @@ -2590,7 +2590,7 @@ elf_m68k_check_relocs (bfd *abfd, /* PR15323, ref flags aren't set for references in the same object. */ - h->root.non_ir_ref = 1; + h->root.non_ir_ref_regular = 1; } switch (ELF32_R_TYPE (rel->r_info)) diff --git a/bfd/elf32-mcore.c b/bfd/elf32-mcore.c index 79c0da6..0037129 100644 --- a/bfd/elf32-mcore.c +++ b/bfd/elf32-mcore.c @@ -629,7 +629,7 @@ mcore_elf_check_relocs (bfd * abfd, /* PR15323, ref flags aren't set for references in the same object. */ - h->root.non_ir_ref = 1; + h->root.non_ir_ref_regular = 1; } switch (ELF32_R_TYPE (rel->r_info)) diff --git a/bfd/elf32-metag.c b/bfd/elf32-metag.c index c45d719..94eda953 100644 --- a/bfd/elf32-metag.c +++ b/bfd/elf32-metag.c @@ -2132,7 +2132,7 @@ elf_metag_check_relocs (bfd *abfd, /* PR15323, ref flags aren't set for references in the same object. */ - hh->eh.root.non_ir_ref = 1; + hh->eh.root.non_ir_ref_regular = 1; } /* Some relocs require a global offset table. */ diff --git a/bfd/elf32-microblaze.c b/bfd/elf32-microblaze.c index 7765fe8..cb83765 100644 --- a/bfd/elf32-microblaze.c +++ b/bfd/elf32-microblaze.c @@ -2315,7 +2315,7 @@ microblaze_elf_check_relocs (bfd * abfd, /* PR15323, ref flags aren't set for references in the same object. */ - h->root.non_ir_ref = 1; + h->root.non_ir_ref_regular = 1; } switch (r_type) diff --git a/bfd/elf32-moxie.c b/bfd/elf32-moxie.c index fde9b64..f955096 100644 --- a/bfd/elf32-moxie.c +++ b/bfd/elf32-moxie.c @@ -359,7 +359,7 @@ moxie_elf_check_relocs (bfd *abfd, /* PR15323, ref flags aren't set for references in the same object. */ - h->root.non_ir_ref = 1; + h->root.non_ir_ref_regular = 1; } } diff --git a/bfd/elf32-msp430.c b/bfd/elf32-msp430.c index 43fcff5..0e4c05c 100644 --- a/bfd/elf32-msp430.c +++ b/bfd/elf32-msp430.c @@ -698,7 +698,7 @@ elf32_msp430_check_relocs (bfd * abfd, struct bfd_link_info * info, /* PR15323, ref flags aren't set for references in the same object. */ - h->root.non_ir_ref = 1; + h->root.non_ir_ref_regular = 1; } } diff --git a/bfd/elf32-mt.c b/bfd/elf32-mt.c index 9e58a7f..db89f8c 100644 --- a/bfd/elf32-mt.c +++ b/bfd/elf32-mt.c @@ -458,7 +458,7 @@ mt_elf_check_relocs /* PR15323, ref flags aren't set for references in the same object. */ - h->root.non_ir_ref = 1; + h->root.non_ir_ref_regular = 1; } } diff --git a/bfd/elf32-nios2.c b/bfd/elf32-nios2.c index a2045bf..50a09ea 100644 --- a/bfd/elf32-nios2.c +++ b/bfd/elf32-nios2.c @@ -4734,7 +4734,7 @@ nios2_elf32_check_relocs (bfd *abfd, struct bfd_link_info *info, /* PR15323, ref flags aren't set for references in the same object. */ - h->root.non_ir_ref = 1; + h->root.non_ir_ref_regular = 1; } r_type = ELF32_R_TYPE (rel->r_info); diff --git a/bfd/elf32-or1k.c b/bfd/elf32-or1k.c index 224cbb8..583f2d4 100644 --- a/bfd/elf32-or1k.c +++ b/bfd/elf32-or1k.c @@ -1404,7 +1404,7 @@ or1k_elf_check_relocs (bfd *abfd, /* PR15323, ref flags aren't set for references in the same object. */ - h->root.non_ir_ref = 1; + h->root.non_ir_ref_regular = 1; } switch (ELF32_R_TYPE (rel->r_info)) diff --git a/bfd/elf32-ppc.c b/bfd/elf32-ppc.c index 10caa8a..6077cc2 100644 --- a/bfd/elf32-ppc.c +++ b/bfd/elf32-ppc.c @@ -4043,7 +4043,7 @@ ppc_elf_check_relocs (bfd *abfd, /* PR15323, ref flags aren't set for references in the same object. */ - h->root.non_ir_ref = 1; + h->root.non_ir_ref_regular = 1; } /* If a relocation refers to _GLOBAL_OFFSET_TABLE_, create the .got. diff --git a/bfd/elf32-rl78.c b/bfd/elf32-rl78.c index 42e2568..da54237 100644 --- a/bfd/elf32-rl78.c +++ b/bfd/elf32-rl78.c @@ -1328,7 +1328,7 @@ rl78_elf_check_relocs /* PR15323, ref flags aren't set for references in the same object. */ - h->root.non_ir_ref = 1; + h->root.non_ir_ref_regular = 1; } switch (ELF32_R_TYPE (rel->r_info)) diff --git a/bfd/elf32-s390.c b/bfd/elf32-s390.c index 7f22ae1..c71dd94 100644 --- a/bfd/elf32-s390.c +++ b/bfd/elf32-s390.c @@ -996,7 +996,7 @@ elf_s390_check_relocs (bfd *abfd, /* PR15323, ref flags aren't set for references in the same object. */ - h->root.non_ir_ref = 1; + h->root.non_ir_ref_regular = 1; } /* Create got section and local_got_refcounts array if they diff --git a/bfd/elf32-score.c b/bfd/elf32-score.c index 98170df..b9ac71d 100644 --- a/bfd/elf32-score.c +++ b/bfd/elf32-score.c @@ -2845,7 +2845,7 @@ s3_bfd_score_elf_check_relocs (bfd *abfd, /* PR15323, ref flags aren't set for references in the same object. */ - h->root.non_ir_ref = 1; + h->root.non_ir_ref_regular = 1; } } diff --git a/bfd/elf32-score7.c b/bfd/elf32-score7.c index 91b25d9..4240206 100644 --- a/bfd/elf32-score7.c +++ b/bfd/elf32-score7.c @@ -2654,7 +2654,7 @@ s7_bfd_score_elf_check_relocs (bfd *abfd, /* PR15323, ref flags aren't set for references in the same object. */ - h->root.non_ir_ref = 1; + h->root.non_ir_ref_regular = 1; } } diff --git a/bfd/elf32-sh.c b/bfd/elf32-sh.c index 3c30032..3b1cc67 100644 --- a/bfd/elf32-sh.c +++ b/bfd/elf32-sh.c @@ -5823,7 +5823,7 @@ sh_elf_check_relocs (bfd *abfd, struct bfd_link_info *info, asection *sec, /* PR15323, ref flags aren't set for references in the same object. */ - h->root.non_ir_ref = 1; + h->root.non_ir_ref_regular = 1; } r_type = sh_elf_optimized_tls_reloc (info, r_type, h == NULL); diff --git a/bfd/elf32-tic6x.c b/bfd/elf32-tic6x.c index f65e24f..e2a2961 100644 --- a/bfd/elf32-tic6x.c +++ b/bfd/elf32-tic6x.c @@ -2835,7 +2835,7 @@ elf32_tic6x_check_relocs (bfd *abfd, struct bfd_link_info *info, /* PR15323, ref flags aren't set for references in the same object. */ - h->root.non_ir_ref = 1; + h->root.non_ir_ref_regular = 1; } switch (r_type) diff --git a/bfd/elf32-tilepro.c b/bfd/elf32-tilepro.c index fb06a47..63d0cbe 100644 --- a/bfd/elf32-tilepro.c +++ b/bfd/elf32-tilepro.c @@ -1504,7 +1504,7 @@ tilepro_elf_check_relocs (bfd *abfd, struct bfd_link_info *info, /* PR15323, ref flags aren't set for references in the same object. */ - h->root.non_ir_ref = 1; + h->root.non_ir_ref_regular = 1; } r_type = tilepro_elf_tls_transition (info, r_type, h == NULL); diff --git a/bfd/elf32-v850.c b/bfd/elf32-v850.c index e97d1d1..ee61c45 100644 --- a/bfd/elf32-v850.c +++ b/bfd/elf32-v850.c @@ -86,7 +86,7 @@ v850_elf_check_relocs (bfd *abfd, /* PR15323, ref flags aren't set for references in the same object. */ - h->root.non_ir_ref = 1; + h->root.non_ir_ref_regular = 1; } r_type = ELF32_R_TYPE (rel->r_info); diff --git a/bfd/elf32-vax.c b/bfd/elf32-vax.c index 41bd772..474450d 100644 --- a/bfd/elf32-vax.c +++ b/bfd/elf32-vax.c @@ -591,7 +591,7 @@ elf_vax_check_relocs (bfd *abfd, struct bfd_link_info *info, asection *sec, /* PR15323, ref flags aren't set for references in the same object. */ - h->root.non_ir_ref = 1; + h->root.non_ir_ref_regular = 1; } switch (ELF32_R_TYPE (rel->r_info)) diff --git a/bfd/elf32-xstormy16.c b/bfd/elf32-xstormy16.c index af4175c..d6aab8f 100644 --- a/bfd/elf32-xstormy16.c +++ b/bfd/elf32-xstormy16.c @@ -438,7 +438,7 @@ xstormy16_elf_check_relocs (bfd *abfd, /* PR15323, ref flags aren't set for references in the same object. */ - h->root.non_ir_ref = 1; + h->root.non_ir_ref_regular = 1; } switch (ELF32_R_TYPE (rel->r_info)) diff --git a/bfd/elf32-xtensa.c b/bfd/elf32-xtensa.c index 80f50e3..d11d43b 100644 --- a/bfd/elf32-xtensa.c +++ b/bfd/elf32-xtensa.c @@ -1015,7 +1015,7 @@ elf_xtensa_check_relocs (bfd *abfd, /* PR15323, ref flags aren't set for references in the same object. */ - h->root.non_ir_ref = 1; + h->root.non_ir_ref_regular = 1; } eh = elf_xtensa_hash_entry (h); diff --git a/bfd/elf64-alpha.c b/bfd/elf64-alpha.c index b4a50f4..6485be2 100644 --- a/bfd/elf64-alpha.c +++ b/bfd/elf64-alpha.c @@ -1838,7 +1838,7 @@ elf64_alpha_check_relocs (bfd *abfd, struct bfd_link_info *info, /* PR15323, ref flags aren't set for references in the same object. */ - h->root.root.non_ir_ref = 1; + h->root.root.non_ir_ref_regular = 1; h->root.ref_regular = 1; } diff --git a/bfd/elf64-hppa.c b/bfd/elf64-hppa.c index 96e03ba..834855a 100644 --- a/bfd/elf64-hppa.c +++ b/bfd/elf64-hppa.c @@ -644,7 +644,7 @@ elf64_hppa_check_relocs (bfd *abfd, /* PR15323, ref flags aren't set for references in the same object. */ - hh->eh.root.non_ir_ref = 1; + hh->eh.root.non_ir_ref_regular = 1; hh->eh.ref_regular = 1; } else diff --git a/bfd/elf64-ia64-vms.c b/bfd/elf64-ia64-vms.c index 3e316d3..918dbb1 100644 --- a/bfd/elf64-ia64-vms.c +++ b/bfd/elf64-ia64-vms.c @@ -2098,7 +2098,7 @@ elf64_ia64_check_relocs (bfd *abfd, struct bfd_link_info *info, /* PR15323, ref flags aren't set for references in the same object. */ - h->root.non_ir_ref = 1; + h->root.non_ir_ref_regular = 1; h->ref_regular = 1; } else diff --git a/bfd/elf64-mmix.c b/bfd/elf64-mmix.c index 91aa4c5..e4a6075 100644 --- a/bfd/elf64-mmix.c +++ b/bfd/elf64-mmix.c @@ -2017,7 +2017,7 @@ mmix_elf_check_relocs (bfd *abfd, /* PR15323, ref flags aren't set for references in the same object. */ - h->root.non_ir_ref = 1; + h->root.non_ir_ref_regular = 1; } switch (ELF64_R_TYPE (rel->r_info)) diff --git a/bfd/elf64-ppc.c b/bfd/elf64-ppc.c index 765bc6b..34c5708 100644 --- a/bfd/elf64-ppc.c +++ b/bfd/elf64-ppc.c @@ -5105,7 +5105,8 @@ add_symbol_adjust (struct ppc_link_hash_entry *eh, struct bfd_link_info *info) /* Propagate reference flags from entry symbol to function descriptor symbol. */ - fdh->elf.root.non_ir_ref |= eh->elf.root.non_ir_ref; + fdh->elf.root.non_ir_ref_regular |= eh->elf.root.non_ir_ref_regular; + fdh->elf.root.non_ir_ref_dynamic |= eh->elf.root.non_ir_ref_dynamic; fdh->elf.ref_regular |= eh->elf.ref_regular; fdh->elf.ref_regular_nonweak |= eh->elf.ref_regular_nonweak; @@ -5409,9 +5410,9 @@ ppc64_elf_check_relocs (bfd *abfd, struct bfd_link_info *info, /* PR15323, ref flags aren't set for references in the same object. */ - h->root.non_ir_ref = 1; + h->root.non_ir_ref_regular = 1; if (eh->is_func && eh->oh != NULL) - eh->oh->elf.root.non_ir_ref = 1; + eh->oh->elf.root.non_ir_ref_regular = 1; if (h == htab->elf.hgot) sec->has_toc_reloc = 1; diff --git a/bfd/elf64-s390.c b/bfd/elf64-s390.c index a59777c..b5cece6 100644 --- a/bfd/elf64-s390.c +++ b/bfd/elf64-s390.c @@ -911,7 +911,7 @@ elf_s390_check_relocs (bfd *abfd, /* PR15323, ref flags aren't set for references in the same object. */ - h->root.non_ir_ref = 1; + h->root.non_ir_ref_regular = 1; } /* Create got section and local_got_refcounts array if they diff --git a/bfd/elf64-sh64.c b/bfd/elf64-sh64.c index 5de67b2..4db27a8 100644 --- a/bfd/elf64-sh64.c +++ b/bfd/elf64-sh64.c @@ -2385,7 +2385,7 @@ sh_elf64_check_relocs (bfd *abfd, struct bfd_link_info *info, /* PR15323, ref flags aren't set for references in the same object. */ - h->root.non_ir_ref = 1; + h->root.non_ir_ref_regular = 1; } /* Some relocs require a global offset table. */ diff --git a/bfd/elf64-x86-64.c b/bfd/elf64-x86-64.c index e363eaf..d193639 100644 --- a/bfd/elf64-x86-64.c +++ b/bfd/elf64-x86-64.c @@ -2414,7 +2414,7 @@ elf_x86_64_check_relocs (bfd *abfd, struct bfd_link_info *info, /* It is referenced by a non-shared object. */ h->ref_regular = 1; - h->root.non_ir_ref = 1; + h->root.non_ir_ref_regular = 1; if (h->type == STT_GNU_IFUNC) elf_tdata (info->output_bfd)->has_gnu_symbols diff --git a/bfd/elflink.c b/bfd/elflink.c index f82bd82..7a800a9 100644 --- a/bfd/elflink.c +++ b/bfd/elflink.c @@ -1223,6 +1223,16 @@ _bfd_elf_merge_symbol (bfd *abfd, olddyn = (oldsec->symbol->flags & BSF_DYNAMIC) != 0; } + /* Handle a case where plugin_notice won't be called and thus won't + set the non_ir_ref flags on the first pass over symbols. */ + if (oldbfd != NULL + && (oldbfd->flags & BFD_PLUGIN) != (abfd->flags & BFD_PLUGIN) + && newdyn != olddyn) + { + h->root.non_ir_ref_dynamic = TRUE; + hi->root.non_ir_ref_dynamic = TRUE; + } + /* NEWDEF and OLDDEF indicate whether the new or old symbol, respectively, appear to be a definition rather than reference. */ @@ -4886,6 +4896,7 @@ error_free_dyn: struct elf_link_hash_entry *h; bfd_size_type size; unsigned int alignment_power; + unsigned int non_ir_ref_dynamic; for (p = htab->root.table.table[i]; p != NULL; p = p->next) { @@ -4907,6 +4918,10 @@ error_free_dyn: size = 0; alignment_power = 0; } + /* Preserve non_ir_ref_dynamic so that this symbol + will be exported when the dynamic lib becomes needed + in the second pass. */ + non_ir_ref_dynamic = h->root.non_ir_ref_dynamic; memcpy (p, old_ent, htab->root.table.entsize); old_ent = (char *) old_ent + htab->root.table.entsize; h = (struct elf_link_hash_entry *) p; @@ -4923,6 +4938,7 @@ error_free_dyn: if (alignment_power > h->root.u.c.p->alignment_power) h->root.u.c.p->alignment_power = alignment_power; } + h->root.non_ir_ref_dynamic = non_ir_ref_dynamic; } } @@ -10340,7 +10356,8 @@ elf_link_input_bfd (struct elf_final_link_info *flinfo, bfd *input_bfd) linker may attach linker created dynamic sections to the plugin bfd. Symbols defined in linker created sections are not plugin symbols. */ - if (h->root.non_ir_ref + if ((h->root.non_ir_ref_regular + || h->root.non_ir_ref_dynamic) && (h->root.type == bfd_link_hash_defined || h->root.type == bfd_link_hash_defweak) && (h->root.u.def.section->flags diff --git a/bfd/elfnn-aarch64.c b/bfd/elfnn-aarch64.c index a92c0f3..16b520c 100644 --- a/bfd/elfnn-aarch64.c +++ b/bfd/elfnn-aarch64.c @@ -7088,7 +7088,7 @@ elfNN_aarch64_check_relocs (bfd *abfd, struct bfd_link_info *info, /* PR15323, ref flags aren't set for references in the same object. */ - h->root.non_ir_ref = 1; + h->root.non_ir_ref_regular = 1; } /* Could be done earlier, if h were already available. */ @@ -7144,7 +7144,7 @@ elfNN_aarch64_check_relocs (bfd *abfd, struct bfd_link_info *info, /* It is referenced by a non-shared object. */ h->ref_regular = 1; - h->root.non_ir_ref = 1; + h->root.non_ir_ref_regular = 1; } switch (bfd_r_type) diff --git a/bfd/elfnn-ia64.c b/bfd/elfnn-ia64.c index 6f92b34..b166ccc 100644 --- a/bfd/elfnn-ia64.c +++ b/bfd/elfnn-ia64.c @@ -2358,7 +2358,7 @@ elfNN_ia64_check_relocs (bfd *abfd, struct bfd_link_info *info, /* PR15323, ref flags aren't set for references in the same object. */ - h->root.non_ir_ref = 1; + h->root.non_ir_ref_regular = 1; h->ref_regular = 1; } else diff --git a/bfd/elfnn-riscv.c b/bfd/elfnn-riscv.c index 3c04507..53c28be 100644 --- a/bfd/elfnn-riscv.c +++ b/bfd/elfnn-riscv.c @@ -539,7 +539,7 @@ riscv_elf_check_relocs (bfd *abfd, struct bfd_link_info *info, /* PR15323, ref flags aren't set for references in the same object. */ - h->root.non_ir_ref = 1; + h->root.non_ir_ref_regular = 1; } switch (r_type) diff --git a/bfd/elfxx-mips.c b/bfd/elfxx-mips.c index 723853f..64713d7 100644 --- a/bfd/elfxx-mips.c +++ b/bfd/elfxx-mips.c @@ -6408,6 +6408,7 @@ mips_elf_perform_relocation (struct bfd_link_info *info, bfd_boolean ok = FALSE; bfd_vma opcode = x >> 16; bfd_vma jalx_opcode = 0; + bfd_vma sign_bit = 0; bfd_vma addr; bfd_vma dest; @@ -6415,12 +6416,14 @@ mips_elf_perform_relocation (struct bfd_link_info *info, { ok = opcode == 0x4060; jalx_opcode = 0x3c; + sign_bit = 0x10000; value <<= 1; } else if (r_type == R_MIPS_PC16 || r_type == R_MIPS_GNU_REL16_S2) { ok = opcode == 0x411; jalx_opcode = 0x1d; + sign_bit = 0x20000; value <<= 2; } @@ -6430,7 +6433,8 @@ mips_elf_perform_relocation (struct bfd_link_info *info, + input_section->output_offset + relocation->r_offset + 4); - dest = addr + (((value & 0x3ffff) ^ 0x20000) - 0x20000); + dest = (addr + + (((value & ((sign_bit << 1) - 1)) ^ sign_bit) - sign_bit)); if ((addr >> 28) << 28 != (dest >> 28) << 28) { @@ -8385,7 +8389,7 @@ _bfd_mips_elf_check_relocs (bfd *abfd, struct bfd_link_info *info, /* PR15323, ref flags aren't set for references in the same object. */ - h->root.non_ir_ref = 1; + h->root.non_ir_ref_regular = 1; } } diff --git a/bfd/elfxx-sparc.c b/bfd/elfxx-sparc.c index 80fda1b..275ee53 100644 --- a/bfd/elfxx-sparc.c +++ b/bfd/elfxx-sparc.c @@ -1448,7 +1448,7 @@ _bfd_sparc_elf_check_relocs (bfd *abfd, struct bfd_link_info *info, /* PR15323, ref flags aren't set for references in the same object. */ - h->root.non_ir_ref = 1; + h->root.non_ir_ref_regular = 1; } if (h && h->type == STT_GNU_IFUNC) diff --git a/bfd/elfxx-tilegx.c b/bfd/elfxx-tilegx.c index 76dfcd8..95c9a15 100644 --- a/bfd/elfxx-tilegx.c +++ b/bfd/elfxx-tilegx.c @@ -1721,7 +1721,7 @@ tilegx_elf_check_relocs (bfd *abfd, struct bfd_link_info *info, /* PR15323, ref flags aren't set for references in the same object. */ - h->root.non_ir_ref = 1; + h->root.non_ir_ref_regular = 1; } r_type = tilegx_elf_tls_transition (info, r_type, h == NULL, diff --git a/bfd/linker.c b/bfd/linker.c index c3ec4fe..f6f0450 100644 --- a/bfd/linker.c +++ b/bfd/linker.c @@ -1736,7 +1736,8 @@ _bfd_generic_link_add_one_symbol (struct bfd_link_info *info, otherwise add a warning. */ if ((!info->lto_plugin_active && (h->u.undef.next != NULL || info->hash->undefs_tail == h)) - || h->non_ir_ref) + || h->non_ir_ref_regular + || h->non_ir_ref_dynamic) { (*info->callbacks->warning) (info, string, h->root.string, hash_entry_bfd (h), NULL, 0); diff --git a/gas/ChangeLog b/gas/ChangeLog index 0ed8e93..ecab66f 100644 --- a/gas/ChangeLog +++ b/gas/ChangeLog @@ -1,3 +1,37 @@ +2017-08-30 Maciej W. Rozycki <macro@imgtec.com> + + * testsuite/gas/mips/branch-addend-micromips.d: New test. + * testsuite/gas/mips/branch-addend-micromips-n32.d: New test. + * testsuite/gas/mips/branch-addend-micromips-n64.d: New test. + * testsuite/gas/mips/branch-addend-micromips.s: New test source. + * testsuite/gas/mips/mips.exp: Run the new tests. + +2017-08-30 Maciej W. Rozycki <macro@imgtec.com> + + * config/tc-mips.c (md_convert_frag): Respect + `mips_ignore_branch_isa'. + * testsuite/gas/mips/branch-local-5.d: New test. + * testsuite/gas/mips/branch-local-n32-5.d: New test. + * testsuite/gas/mips/branch-local-n64-5.d: New test. + * testsuite/gas/mips/branch-local-6.d: New test. + * testsuite/gas/mips/branch-local-n32-6.d: New test. + * testsuite/gas/mips/branch-local-n64-6.d: New test. + * testsuite/gas/mips/branch-local-7.d: New test. + * testsuite/gas/mips/branch-local-n32-7.d: New test. + * testsuite/gas/mips/branch-local-n64-7.d: New test. + * testsuite/gas/mips/branch-local-ignore-5.d: New test. + * testsuite/gas/mips/branch-local-ignore-n32-5.d: New test. + * testsuite/gas/mips/branch-local-ignore-n64-5.d: New test. + * testsuite/gas/mips/branch-local-ignore-6.d: New test. + * testsuite/gas/mips/branch-local-ignore-n32-6.d: New test. + * testsuite/gas/mips/branch-local-ignore-n64-6.d: New test. + * testsuite/gas/mips/branch-local-5.l: New stderr output. + * testsuite/gas/mips/branch-local-6.l: New stderr output. + * testsuite/gas/mips/branch-local-5.s: New test source. + * testsuite/gas/mips/branch-local-6.s: New test source. + * testsuite/gas/mips/branch-local-7.s: New test source. + * testsuite/gas/mips/mips.exp: Run the new tests. + 2017-07-25 Tristan Gingold <gingold@adacore.com> * configure: Regenerate. diff --git a/gas/config/tc-mips.c b/gas/config/tc-mips.c index e24e84d..0632adc 100644 --- a/gas/config/tc-mips.c +++ b/gas/config/tc-mips.c @@ -18372,7 +18372,8 @@ md_convert_frag (bfd *abfd ATTRIBUTE_UNUSED, segT asec, fragS *fragp) { if (!need_reloc) { - if (!ELF_ST_IS_MIPS16 (S_GET_OTHER (fragp->fr_symbol))) + if (!mips_ignore_branch_isa + && !ELF_ST_IS_MIPS16 (S_GET_OTHER (fragp->fr_symbol))) as_bad_where (fragp->fr_file, fragp->fr_line, _("branch to a symbol in another ISA mode")); else if ((fragp->fr_offset & 0x1) != 0) diff --git a/gas/testsuite/gas/mips/branch-addend-micromips-n32.d b/gas/testsuite/gas/mips/branch-addend-micromips-n32.d new file mode 100644 index 0000000..085cc22 --- /dev/null +++ b/gas/testsuite/gas/mips/branch-addend-micromips-n32.d @@ -0,0 +1,23 @@ +#objdump: -dr --prefix-addresses --show-raw-insn +#name: microMIPS BAL addend encoding (n32) +#as: -n32 -march=from-abi +#source: branch-addend-micromips.s + +.*: +file format .*mips.* + +Disassembly of section \.text: + \.\.\. +[0-9a-f]+ <[^>]*> 00000027 nor zero,zero,zero +[0-9a-f]+ <[^>]*> 03e00009 jalr zero,ra +[0-9a-f]+ <[^>]*> 00000027 nor zero,zero,zero +[0-9a-f]+ <[^>]*> 00000000 nop +[0-9a-f]+ <[^>]*> 0000 02d0 not zero,zero +[0-9a-f]+ <[^>]*> 4060 0000 bal 00001018 <bar\+0x8> +[ ]*[0-9a-f]+: R_MICROMIPS_PC16_S1 foo\+0xfffc +[0-9a-f]+ <[^>]*> 0000 02d0 not zero,zero +[0-9a-f]+ <[^>]*> 4060 0000 bal 00001020 <bar\+0x10> +[ ]*[0-9a-f]+: R_MICROMIPS_PC16_S1 bar\+0xfffc +[0-9a-f]+ <[^>]*> 0000 02d0 not zero,zero +[0-9a-f]+ <[^>]*> 001f 0f3c jr ra +[0-9a-f]+ <[^>]*> 0000 02d0 not zero,zero + \.\.\. diff --git a/gas/testsuite/gas/mips/branch-addend-micromips-n64.d b/gas/testsuite/gas/mips/branch-addend-micromips-n64.d new file mode 100644 index 0000000..65d0cd2 --- /dev/null +++ b/gas/testsuite/gas/mips/branch-addend-micromips-n64.d @@ -0,0 +1,27 @@ +#objdump: -dr --prefix-addresses --show-raw-insn +#name: microMIPS BAL addend encoding (n64) +#as: -64 -march=from-abi +#source: branch-addend-micromips.s + +.*: +file format .*mips.* + +Disassembly of section \.text: + \.\.\. +[0-9a-f]+ <[^>]*> 00000027 nor zero,zero,zero +[0-9a-f]+ <[^>]*> 03e00009 jalr zero,ra +[0-9a-f]+ <[^>]*> 00000027 nor zero,zero,zero +[0-9a-f]+ <[^>]*> 00000000 nop +[0-9a-f]+ <[^>]*> 0000 02d0 not zero,zero +[0-9a-f]+ <[^>]*> 4060 0000 bal 0000000000001018 <bar\+0x8> +[ ]*[0-9a-f]+: R_MICROMIPS_PC16_S1 foo\+0xfffc +[ ]*[0-9a-f]+: R_MIPS_NONE \*ABS\*\+0xfffc +[ ]*[0-9a-f]+: R_MIPS_NONE \*ABS\*\+0xfffc +[0-9a-f]+ <[^>]*> 0000 02d0 not zero,zero +[0-9a-f]+ <[^>]*> 4060 0000 bal 0000000000001020 <bar\+0x10> +[ ]*[0-9a-f]+: R_MICROMIPS_PC16_S1 bar\+0xfffc +[ ]*[0-9a-f]+: R_MIPS_NONE \*ABS\*\+0xfffc +[ ]*[0-9a-f]+: R_MIPS_NONE \*ABS\*\+0xfffc +[0-9a-f]+ <[^>]*> 0000 02d0 not zero,zero +[0-9a-f]+ <[^>]*> 001f 0f3c jr ra +[0-9a-f]+ <[^>]*> 0000 02d0 not zero,zero + \.\.\. diff --git a/gas/testsuite/gas/mips/branch-addend-micromips.d b/gas/testsuite/gas/mips/branch-addend-micromips.d new file mode 100644 index 0000000..345d9df --- /dev/null +++ b/gas/testsuite/gas/mips/branch-addend-micromips.d @@ -0,0 +1,22 @@ +#objdump: -dr --prefix-addresses --show-raw-insn +#name: microMIPS BAL addend encoding +#as: -32 + +.*: +file format .*mips.* + +Disassembly of section \.text: + \.\.\. +[0-9a-f]+ <[^>]*> 00000027 nor zero,zero,zero +[0-9a-f]+ <[^>]*> 03e00009 jalr zero,ra +[0-9a-f]+ <[^>]*> 00000027 nor zero,zero,zero +[0-9a-f]+ <[^>]*> 00000000 nop +[0-9a-f]+ <[^>]*> 0000 02d0 not zero,zero +[0-9a-f]+ <[^>]*> 4060 7ffe bal 00011014 <bar\+0x10004> +[ ]*[0-9a-f]+: R_MICROMIPS_PC16_S1 foo +[0-9a-f]+ <[^>]*> 0000 02d0 not zero,zero +[0-9a-f]+ <[^>]*> 4060 7ffe bal 0001101c <bar\+0x1000c> +[ ]*[0-9a-f]+: R_MICROMIPS_PC16_S1 bar +[0-9a-f]+ <[^>]*> 0000 02d0 not zero,zero +[0-9a-f]+ <[^>]*> 001f 0f3c jr ra +[0-9a-f]+ <[^>]*> 0000 02d0 not zero,zero + \.\.\. diff --git a/gas/testsuite/gas/mips/branch-addend-micromips.s b/gas/testsuite/gas/mips/branch-addend-micromips.s new file mode 100644 index 0000000..91d7c8f --- /dev/null +++ b/gas/testsuite/gas/mips/branch-addend-micromips.s @@ -0,0 +1,31 @@ + .text + .set noreorder + .space 0x1000 + + .align 4 + .set nomicromips + .globl foo + .ent foo +foo: + nor $0, $0 + jalr $0, $ra + nor $0, $0 + .end foo + + .align 4 + .set micromips + .globl bar + .ent bar +bar: + nor $0, $0 + bal foo + 0x10000 + nor $0, $0 + bal bar + 0x10000 + nor $0, $0 + jalr $0, $ra + nor $0, $0 + .end bar + +# Force some (non-delay-slot) zero bytes, to make 'objdump' print ... + .align 4, 0 + .space 16 diff --git a/gas/testsuite/gas/mips/branch-local-5.d b/gas/testsuite/gas/mips/branch-local-5.d new file mode 100644 index 0000000..8033ced --- /dev/null +++ b/gas/testsuite/gas/mips/branch-local-5.d @@ -0,0 +1,3 @@ +#name: MIPS branch local symbol relocation 5 +#as: -32 +#error-output: branch-local-5.l diff --git a/gas/testsuite/gas/mips/branch-local-5.l b/gas/testsuite/gas/mips/branch-local-5.l new file mode 100644 index 0000000..361cf8a --- /dev/null +++ b/gas/testsuite/gas/mips/branch-local-5.l @@ -0,0 +1,4 @@ +.*: Assembler messages: +.*:19: Error: branch to a symbol in another ISA mode +.*:21: Error: branch to a symbol in another ISA mode +.*:23: Error: branch to a symbol in another ISA mode diff --git a/gas/testsuite/gas/mips/branch-local-5.s b/gas/testsuite/gas/mips/branch-local-5.s new file mode 100644 index 0000000..a6b8338 --- /dev/null +++ b/gas/testsuite/gas/mips/branch-local-5.s @@ -0,0 +1,31 @@ + .text + .set noreorder + .space 0x1000 + + .align 4 + .set nomips16 + .ent foo +foo: + nor $0, $0 + jalr $0, $ra + nor $0, $0 + .end foo + + .align 4 + .set mips16 + .ent bar +bar: + not $16, $16 + b foo + not $16, $16 + beqz $2, foo + not $16, $16 + bteqz foo + not $16, $16 + jr $ra + not $16, $16 + .end bar + +# Force some (non-delay-slot) zero bytes, to make 'objdump' print ... + .align 4, 0 + .space 16 diff --git a/gas/testsuite/gas/mips/branch-local-6.d b/gas/testsuite/gas/mips/branch-local-6.d new file mode 100644 index 0000000..45a0ede --- /dev/null +++ b/gas/testsuite/gas/mips/branch-local-6.d @@ -0,0 +1,3 @@ +#name: MIPS branch local symbol relocation 6 +#as: -32 +#error-output: branch-local-6.l diff --git a/gas/testsuite/gas/mips/branch-local-6.l b/gas/testsuite/gas/mips/branch-local-6.l new file mode 100644 index 0000000..a119ade --- /dev/null +++ b/gas/testsuite/gas/mips/branch-local-6.l @@ -0,0 +1,9 @@ +.*: Assembler messages: +.*:19: Error: branch to a symbol in another ISA mode +.*:25: Error: branch to a symbol in another ISA mode +.*:27: Error: branch to a symbol in another ISA mode +.*:29: Error: branch to a symbol in another ISA mode +.*:31: Error: branch to a symbol in another ISA mode +.*:33: Error: branch to a symbol in another ISA mode +.*:21: Error: branch to a symbol in another ISA mode +.*:23: Error: branch to a symbol in another ISA mode diff --git a/gas/testsuite/gas/mips/branch-local-6.s b/gas/testsuite/gas/mips/branch-local-6.s new file mode 100644 index 0000000..1a54673 --- /dev/null +++ b/gas/testsuite/gas/mips/branch-local-6.s @@ -0,0 +1,41 @@ + .text + .set noreorder + .space 0x1000 + + .align 4 + .set nomicromips + .ent foo +foo: + nor $0, $0 + jalr $0, $ra + nor $0, $0 + .end foo + + .align 4 + .set micromips + .ent bar +bar: + nor $0, $0 + beqzc $2, foo + nor $0, $0 + b foo + nor $0, $0 + beqz $2, foo + nor $0, $0 + bgezal $2, foo + nor $0, $0 + bgezals $2, foo + not $16, $16 + bltzal $2, foo + nor $0, $0 + bltzals $2, foo + not $16, $16 + bals foo + not $16, $16 + jalr $0, $ra + nor $0, $0 + .end bar + +# Force some (non-delay-slot) zero bytes, to make 'objdump' print ... + .align 4, 0 + .space 16 diff --git a/gas/testsuite/gas/mips/branch-local-7.d b/gas/testsuite/gas/mips/branch-local-7.d new file mode 100644 index 0000000..0cc2a11 --- /dev/null +++ b/gas/testsuite/gas/mips/branch-local-7.d @@ -0,0 +1,20 @@ +#objdump: -dr --prefix-addresses --show-raw-insn +#name: MIPS branch local symbol relocation 7 +#as: -32 +#source: branch-local-7.s + +.*: +file format .*mips.* + +Disassembly of section \.text: + \.\.\. +[0-9a-f]+ <[^>]*> 00000027 nor zero,zero,zero +[0-9a-f]+ <[^>]*> 03e00009 jalr zero,ra +[0-9a-f]+ <[^>]*> 00000027 nor zero,zero,zero +[0-9a-f]+ <[^>]*> 00000000 nop +[0-9a-f]+ <[^>]*> 0000 02d0 not zero,zero +[0-9a-f]+ <[^>]*> 4060 fffe bal 00001014 <bar\+0x4> +[ ]*[0-9a-f]+: R_MICROMIPS_PC16_S1 foo +[0-9a-f]+ <[^>]*> 0000 02d0 not zero,zero +[0-9a-f]+ <[^>]*> 001f 0f3c jr ra +[0-9a-f]+ <[^>]*> 0000 02d0 not zero,zero + \.\.\. diff --git a/gas/testsuite/gas/mips/branch-local-7.s b/gas/testsuite/gas/mips/branch-local-7.s new file mode 100644 index 0000000..82d94f3 --- /dev/null +++ b/gas/testsuite/gas/mips/branch-local-7.s @@ -0,0 +1,27 @@ + .text + .set noreorder + .space 0x1000 + + .align 4 + .set nomicromips + .ent foo +foo: + nor $0, $0 + jalr $0, $ra + nor $0, $0 + .end foo + + .align 4 + .set micromips + .ent bar +bar: + nor $0, $0 + bal foo + nor $0, $0 + jalr $0, $ra + nor $0, $0 + .end bar + +# Force some (non-delay-slot) zero bytes, to make 'objdump' print ... + .align 4, 0 + .space 16 diff --git a/gas/testsuite/gas/mips/branch-local-ignore-5.d b/gas/testsuite/gas/mips/branch-local-ignore-5.d new file mode 100644 index 0000000..94ffe19 --- /dev/null +++ b/gas/testsuite/gas/mips/branch-local-ignore-5.d @@ -0,0 +1,23 @@ +#objdump: -dr --prefix-addresses --show-raw-insn +#name: MIPS branch local symbol relocation 5 (ignore branch ISA) +#as: -32 -mignore-branch-isa +#source: branch-local-5.s + +.*: +file format .*mips.* + +Disassembly of section \.text: + \.\.\. +[0-9a-f]+ <[^>]*> 00000027 nor zero,zero,zero +[0-9a-f]+ <[^>]*> 03e00009 jalr zero,ra +[0-9a-f]+ <[^>]*> 00000027 nor zero,zero,zero +[0-9a-f]+ <[^>]*> 00000000 nop +[0-9a-f]+ <[^>]*> e80f not s0 +[0-9a-f]+ <[^>]*> 17f6 b 0+001000 <foo> +[0-9a-f]+ <[^>]*> e80f not s0 +[0-9a-f]+ <[^>]*> 22f4 beqz v0,0+001000 <foo> +[0-9a-f]+ <[^>]*> e80f not s0 +[0-9a-f]+ <[^>]*> 60f2 bteqz 0+001000 <foo> +[0-9a-f]+ <[^>]*> e80f not s0 +[0-9a-f]+ <[^>]*> e820 jr ra +[0-9a-f]+ <[^>]*> e80f not s0 + \.\.\. diff --git a/gas/testsuite/gas/mips/branch-local-ignore-6.d b/gas/testsuite/gas/mips/branch-local-ignore-6.d new file mode 100644 index 0000000..1565688 --- /dev/null +++ b/gas/testsuite/gas/mips/branch-local-ignore-6.d @@ -0,0 +1,41 @@ +#objdump: -dr --prefix-addresses --show-raw-insn +#name: MIPS branch local symbol relocation 6 (ignore branch ISA) +#as: -32 -mignore-branch-isa +#source: branch-local-6.s + +.*: +file format .*mips.* + +Disassembly of section \.text: + \.\.\. +[0-9a-f]+ <[^>]*> 00000027 nor zero,zero,zero +[0-9a-f]+ <[^>]*> 03e00009 jalr zero,ra +[0-9a-f]+ <[^>]*> 00000027 nor zero,zero,zero +[0-9a-f]+ <[^>]*> 00000000 nop +[0-9a-f]+ <[^>]*> 0000 02d0 not zero,zero +[0-9a-f]+ <[^>]*> 40e2 fffe beqzc v0,00001014 <bar\+0x4> +[ ]*[0-9a-f]+: R_MICROMIPS_PC16_S1 foo +[0-9a-f]+ <[^>]*> 0000 02d0 not zero,zero +[0-9a-f]+ <[^>]*> cfff b 0000101c <bar\+0xc> +[ ]*[0-9a-f]+: R_MICROMIPS_PC10_S1 foo +[0-9a-f]+ <[^>]*> 0000 02d0 not zero,zero +[0-9a-f]+ <[^>]*> 8d7f beqz v0,00001022 <bar\+0x12> +[ ]*[0-9a-f]+: R_MICROMIPS_PC7_S1 foo +[0-9a-f]+ <[^>]*> 0000 02d0 not zero,zero +[0-9a-f]+ <[^>]*> 4062 fffe bgezal v0,00001028 <bar\+0x18> +[ ]*[0-9a-f]+: R_MICROMIPS_PC16_S1 foo +[0-9a-f]+ <[^>]*> 0000 02d0 not zero,zero +[0-9a-f]+ <[^>]*> 4262 fffe bgezals v0,00001030 <bar\+0x20> +[ ]*[0-9a-f]+: R_MICROMIPS_PC16_S1 foo +[0-9a-f]+ <[^>]*> 4400 not s0,s0 +[0-9a-f]+ <[^>]*> 4022 fffe bltzal v0,00001036 <bar\+0x26> +[ ]*[0-9a-f]+: R_MICROMIPS_PC16_S1 foo +[0-9a-f]+ <[^>]*> 0000 02d0 not zero,zero +[0-9a-f]+ <[^>]*> 4222 fffe bltzals v0,0000103e <bar\+0x2e> +[ ]*[0-9a-f]+: R_MICROMIPS_PC16_S1 foo +[0-9a-f]+ <[^>]*> 4400 not s0,s0 +[0-9a-f]+ <[^>]*> 4260 fffe bals 00001044 <bar\+0x34> +[ ]*[0-9a-f]+: R_MICROMIPS_PC16_S1 foo +[0-9a-f]+ <[^>]*> 4400 not s0,s0 +[0-9a-f]+ <[^>]*> 001f 0f3c jr ra +[0-9a-f]+ <[^>]*> 0000 02d0 not zero,zero + \.\.\. diff --git a/gas/testsuite/gas/mips/branch-local-ignore-n32-5.d b/gas/testsuite/gas/mips/branch-local-ignore-n32-5.d new file mode 100644 index 0000000..3ddd866 --- /dev/null +++ b/gas/testsuite/gas/mips/branch-local-ignore-n32-5.d @@ -0,0 +1,5 @@ +#objdump: -dr --prefix-addresses --show-raw-insn +#name: MIPS branch local symbol relocation 5 (ignore branch ISA, n32) +#as: -n32 -march=from-abi -mignore-branch-isa +#source: branch-local-5.s +#dump: branch-local-ignore-5.d diff --git a/gas/testsuite/gas/mips/branch-local-ignore-n32-6.d b/gas/testsuite/gas/mips/branch-local-ignore-n32-6.d new file mode 100644 index 0000000..7b12203 --- /dev/null +++ b/gas/testsuite/gas/mips/branch-local-ignore-n32-6.d @@ -0,0 +1,41 @@ +#objdump: -dr --prefix-addresses --show-raw-insn +#name: MIPS branch local symbol relocation 6 (ignore branch ISA, n32) +#as: -n32 -march=from-abi -mignore-branch-isa +#source: branch-local-6.s + +.*: +file format .*mips.* + +Disassembly of section \.text: + \.\.\. +[0-9a-f]+ <[^>]*> 00000027 nor zero,zero,zero +[0-9a-f]+ <[^>]*> 03e00009 jalr zero,ra +[0-9a-f]+ <[^>]*> 00000027 nor zero,zero,zero +[0-9a-f]+ <[^>]*> 00000000 nop +[0-9a-f]+ <[^>]*> 0000 02d0 not zero,zero +[0-9a-f]+ <[^>]*> 40e2 0000 beqzc v0,00001018 <bar\+0x8> +[ ]*[0-9a-f]+: R_MICROMIPS_PC16_S1 \.text\+0xffc +[0-9a-f]+ <[^>]*> 0000 02d0 not zero,zero +[0-9a-f]+ <[^>]*> cc00 b 0000101e <bar\+0xe> +[ ]*[0-9a-f]+: R_MICROMIPS_PC10_S1 \.text\+0xffe +[0-9a-f]+ <[^>]*> 0000 02d0 not zero,zero +[0-9a-f]+ <[^>]*> 8d00 beqz v0,00001024 <bar\+0x14> +[ ]*[0-9a-f]+: R_MICROMIPS_PC7_S1 \.text\+0xffe +[0-9a-f]+ <[^>]*> 0000 02d0 not zero,zero +[0-9a-f]+ <[^>]*> 4062 0000 bgezal v0,0000102c <bar\+0x1c> +[ ]*[0-9a-f]+: R_MICROMIPS_PC16_S1 \.text\+0xffc +[0-9a-f]+ <[^>]*> 0000 02d0 not zero,zero +[0-9a-f]+ <[^>]*> 4262 0000 bgezals v0,00001034 <bar\+0x24> +[ ]*[0-9a-f]+: R_MICROMIPS_PC16_S1 \.text\+0xffc +[0-9a-f]+ <[^>]*> 4400 not s0,s0 +[0-9a-f]+ <[^>]*> 4022 0000 bltzal v0,0000103a <bar\+0x2a> +[ ]*[0-9a-f]+: R_MICROMIPS_PC16_S1 \.text\+0xffc +[0-9a-f]+ <[^>]*> 0000 02d0 not zero,zero +[0-9a-f]+ <[^>]*> 4222 0000 bltzals v0,00001042 <bar\+0x32> +[ ]*[0-9a-f]+: R_MICROMIPS_PC16_S1 \.text\+0xffc +[0-9a-f]+ <[^>]*> 4400 not s0,s0 +[0-9a-f]+ <[^>]*> 4260 0000 bals 00001048 <bar\+0x38> +[ ]*[0-9a-f]+: R_MICROMIPS_PC16_S1 \.text\+0xffc +[0-9a-f]+ <[^>]*> 4400 not s0,s0 +[0-9a-f]+ <[^>]*> 001f 0f3c jr ra +[0-9a-f]+ <[^>]*> 0000 02d0 not zero,zero + \.\.\. diff --git a/gas/testsuite/gas/mips/branch-local-ignore-n64-5.d b/gas/testsuite/gas/mips/branch-local-ignore-n64-5.d new file mode 100644 index 0000000..9f08b33 --- /dev/null +++ b/gas/testsuite/gas/mips/branch-local-ignore-n64-5.d @@ -0,0 +1,5 @@ +#objdump: -dr --prefix-addresses --show-raw-insn +#name: MIPS branch local symbol relocation 5 (ignore branch ISA, n64) +#as: -64 -march=from-abi -mignore-branch-isa +#source: branch-local-5.s +#dump: branch-local-ignore-5.d diff --git a/gas/testsuite/gas/mips/branch-local-ignore-n64-6.d b/gas/testsuite/gas/mips/branch-local-ignore-n64-6.d new file mode 100644 index 0000000..2852e98 --- /dev/null +++ b/gas/testsuite/gas/mips/branch-local-ignore-n64-6.d @@ -0,0 +1,57 @@ +#objdump: -dr --prefix-addresses --show-raw-insn +#name: MIPS branch local symbol relocation 6 (ignore branch ISA, n64) +#as: -64 -march=from-abi -mignore-branch-isa +#source: branch-local-6.s + +.*: +file format .*mips.* + +Disassembly of section \.text: + \.\.\. +[0-9a-f]+ <[^>]*> 00000027 nor zero,zero,zero +[0-9a-f]+ <[^>]*> 03e00009 jalr zero,ra +[0-9a-f]+ <[^>]*> 00000027 nor zero,zero,zero +[0-9a-f]+ <[^>]*> 00000000 nop +[0-9a-f]+ <[^>]*> 0000 02d0 not zero,zero +[0-9a-f]+ <[^>]*> 40e2 0000 beqzc v0,0000000000001018 <bar\+0x8> +[ ]*[0-9a-f]+: R_MICROMIPS_PC16_S1 \.text\+0xffc +[ ]*[0-9a-f]+: R_MIPS_NONE \*ABS\*\+0xffc +[ ]*[0-9a-f]+: R_MIPS_NONE \*ABS\*\+0xffc +[0-9a-f]+ <[^>]*> 0000 02d0 not zero,zero +[0-9a-f]+ <[^>]*> cc00 b 000000000000101e <bar\+0xe> +[ ]*[0-9a-f]+: R_MICROMIPS_PC10_S1 \.text\+0xffe +[ ]*[0-9a-f]+: R_MIPS_NONE \*ABS\*\+0xffe +[ ]*[0-9a-f]+: R_MIPS_NONE \*ABS\*\+0xffe +[0-9a-f]+ <[^>]*> 0000 02d0 not zero,zero +[0-9a-f]+ <[^>]*> 8d00 beqz v0,0000000000001024 <bar\+0x14> +[ ]*[0-9a-f]+: R_MICROMIPS_PC7_S1 \.text\+0xffe +[ ]*[0-9a-f]+: R_MIPS_NONE \*ABS\*\+0xffe +[ ]*[0-9a-f]+: R_MIPS_NONE \*ABS\*\+0xffe +[0-9a-f]+ <[^>]*> 0000 02d0 not zero,zero +[0-9a-f]+ <[^>]*> 4062 0000 bgezal v0,000000000000102c <bar\+0x1c> +[ ]*[0-9a-f]+: R_MICROMIPS_PC16_S1 \.text\+0xffc +[ ]*[0-9a-f]+: R_MIPS_NONE \*ABS\*\+0xffc +[ ]*[0-9a-f]+: R_MIPS_NONE \*ABS\*\+0xffc +[0-9a-f]+ <[^>]*> 0000 02d0 not zero,zero +[0-9a-f]+ <[^>]*> 4262 0000 bgezals v0,0000000000001034 <bar\+0x24> +[ ]*[0-9a-f]+: R_MICROMIPS_PC16_S1 \.text\+0xffc +[ ]*[0-9a-f]+: R_MIPS_NONE \*ABS\*\+0xffc +[ ]*[0-9a-f]+: R_MIPS_NONE \*ABS\*\+0xffc +[0-9a-f]+ <[^>]*> 4400 not s0,s0 +[0-9a-f]+ <[^>]*> 4022 0000 bltzal v0,000000000000103a <bar\+0x2a> +[ ]*[0-9a-f]+: R_MICROMIPS_PC16_S1 \.text\+0xffc +[ ]*[0-9a-f]+: R_MIPS_NONE \*ABS\*\+0xffc +[ ]*[0-9a-f]+: R_MIPS_NONE \*ABS\*\+0xffc +[0-9a-f]+ <[^>]*> 0000 02d0 not zero,zero +[0-9a-f]+ <[^>]*> 4222 0000 bltzals v0,0000000000001042 <bar\+0x32> +[ ]*[0-9a-f]+: R_MICROMIPS_PC16_S1 \.text\+0xffc +[ ]*[0-9a-f]+: R_MIPS_NONE \*ABS\*\+0xffc +[ ]*[0-9a-f]+: R_MIPS_NONE \*ABS\*\+0xffc +[0-9a-f]+ <[^>]*> 4400 not s0,s0 +[0-9a-f]+ <[^>]*> 4260 0000 bals 0000000000001048 <bar\+0x38> +[ ]*[0-9a-f]+: R_MICROMIPS_PC16_S1 \.text\+0xffc +[ ]*[0-9a-f]+: R_MIPS_NONE \*ABS\*\+0xffc +[ ]*[0-9a-f]+: R_MIPS_NONE \*ABS\*\+0xffc +[0-9a-f]+ <[^>]*> 4400 not s0,s0 +[0-9a-f]+ <[^>]*> 001f 0f3c jr ra +[0-9a-f]+ <[^>]*> 0000 02d0 not zero,zero + \.\.\. diff --git a/gas/testsuite/gas/mips/branch-local-n32-5.d b/gas/testsuite/gas/mips/branch-local-n32-5.d new file mode 100644 index 0000000..ac1f73e --- /dev/null +++ b/gas/testsuite/gas/mips/branch-local-n32-5.d @@ -0,0 +1,4 @@ +#name: MIPS branch local symbol relocation 5 (n32) +#as: -n32 -march=from-abi +#error-output: branch-local-5.l +#source: branch-local-5.s diff --git a/gas/testsuite/gas/mips/branch-local-n32-6.d b/gas/testsuite/gas/mips/branch-local-n32-6.d new file mode 100644 index 0000000..de3fc98 --- /dev/null +++ b/gas/testsuite/gas/mips/branch-local-n32-6.d @@ -0,0 +1,4 @@ +#name: MIPS branch local symbol relocation 6 (n32) +#as: -n32 -march=from-abi +#error-output: branch-local-6.l +#source: branch-local-6.s diff --git a/gas/testsuite/gas/mips/branch-local-n32-7.d b/gas/testsuite/gas/mips/branch-local-n32-7.d new file mode 100644 index 0000000..5d5b1de --- /dev/null +++ b/gas/testsuite/gas/mips/branch-local-n32-7.d @@ -0,0 +1,20 @@ +#objdump: -dr --prefix-addresses --show-raw-insn +#name: MIPS branch local symbol relocation 7 (n32) +#as: -n32 -march=from-abi +#source: branch-local-7.s + +.*: +file format .*mips.* + +Disassembly of section \.text: + \.\.\. +[0-9a-f]+ <[^>]*> 00000027 nor zero,zero,zero +[0-9a-f]+ <[^>]*> 03e00009 jalr zero,ra +[0-9a-f]+ <[^>]*> 00000027 nor zero,zero,zero +[0-9a-f]+ <[^>]*> 00000000 nop +[0-9a-f]+ <[^>]*> 0000 02d0 not zero,zero +[0-9a-f]+ <[^>]*> 4060 0000 bal 00001018 <bar\+0x8> +[ ]*[0-9a-f]+: R_MICROMIPS_PC16_S1 \.text\+0xffc +[0-9a-f]+ <[^>]*> 0000 02d0 not zero,zero +[0-9a-f]+ <[^>]*> 001f 0f3c jr ra +[0-9a-f]+ <[^>]*> 0000 02d0 not zero,zero + \.\.\. diff --git a/gas/testsuite/gas/mips/branch-local-n64-5.d b/gas/testsuite/gas/mips/branch-local-n64-5.d new file mode 100644 index 0000000..05a396e --- /dev/null +++ b/gas/testsuite/gas/mips/branch-local-n64-5.d @@ -0,0 +1,4 @@ +#name: MIPS branch local symbol relocation 5 (n64) +#as: -64 -march=from-abi +#error-output: branch-local-5.l +#source: branch-local-5.s diff --git a/gas/testsuite/gas/mips/branch-local-n64-6.d b/gas/testsuite/gas/mips/branch-local-n64-6.d new file mode 100644 index 0000000..3cd8a33 --- /dev/null +++ b/gas/testsuite/gas/mips/branch-local-n64-6.d @@ -0,0 +1,4 @@ +#name: MIPS branch local symbol relocation 6 (n64) +#as: -64 -march=from-abi +#error-output: branch-local-6.l +#source: branch-local-6.s diff --git a/gas/testsuite/gas/mips/branch-local-n64-7.d b/gas/testsuite/gas/mips/branch-local-n64-7.d new file mode 100644 index 0000000..56296bd --- /dev/null +++ b/gas/testsuite/gas/mips/branch-local-n64-7.d @@ -0,0 +1,22 @@ +#objdump: -dr --prefix-addresses --show-raw-insn +#name: MIPS branch local symbol relocation 7 (n64) +#as: -64 -march=from-abi +#source: branch-local-7.s + +.*: +file format .*mips.* + +Disassembly of section \.text: + \.\.\. +[0-9a-f]+ <[^>]*> 00000027 nor zero,zero,zero +[0-9a-f]+ <[^>]*> 03e00009 jalr zero,ra +[0-9a-f]+ <[^>]*> 00000027 nor zero,zero,zero +[0-9a-f]+ <[^>]*> 00000000 nop +[0-9a-f]+ <[^>]*> 0000 02d0 not zero,zero +[0-9a-f]+ <[^>]*> 4060 0000 bal 0000000000001018 <bar\+0x8> +[ ]*[0-9a-f]+: R_MICROMIPS_PC16_S1 \.text\+0xffc +[ ]*[0-9a-f]+: R_MIPS_NONE \*ABS\*\+0xffc +[ ]*[0-9a-f]+: R_MIPS_NONE \*ABS\*\+0xffc +[0-9a-f]+ <[^>]*> 0000 02d0 not zero,zero +[0-9a-f]+ <[^>]*> 001f 0f3c jr ra +[0-9a-f]+ <[^>]*> 0000 02d0 not zero,zero + \.\.\. diff --git a/gas/testsuite/gas/mips/mips.exp b/gas/testsuite/gas/mips/mips.exp index 5a69542..56b4909 100644 --- a/gas/testsuite/gas/mips/mips.exp +++ b/gas/testsuite/gas/mips/mips.exp @@ -630,6 +630,11 @@ if { [istarget mips*-*-vxworks*] } { run_dump_test "branch-local-3" run_dump_test "branch-local-ignore-3" run_dump_test "branch-local-4" + run_dump_test "branch-local-5" + run_dump_test "branch-local-ignore-5" + run_dump_test "branch-local-6" + run_dump_test "branch-local-ignore-6" + run_dump_test "branch-local-7" if $has_newabi { run_dump_test "branch-local-n32-1" run_dump_test "branch-local-n32-2" @@ -637,17 +642,30 @@ if { [istarget mips*-*-vxworks*] } { run_dump_test "branch-local-n32-3" run_dump_test "branch-local-ignore-n32-3" run_dump_test "branch-local-n32-4" + run_dump_test "branch-local-n32-5" + run_dump_test "branch-local-ignore-n32-5" + run_dump_test "branch-local-n32-6" + run_dump_test "branch-local-ignore-n32-6" + run_dump_test "branch-local-n32-7" run_dump_test "branch-local-n64-1" run_dump_test "branch-local-n64-2" run_dump_test "branch-local-ignore-n64-2" run_dump_test "branch-local-n64-3" run_dump_test "branch-local-ignore-n64-3" run_dump_test "branch-local-n64-4" + run_dump_test "branch-local-n64-5" + run_dump_test "branch-local-ignore-n64-5" + run_dump_test "branch-local-n64-6" + run_dump_test "branch-local-ignore-n64-6" + run_dump_test "branch-local-n64-7" } run_dump_test "branch-addend" + run_dump_test "branch-addend-micromips" if $has_newabi { run_dump_test "branch-addend-n32" + run_dump_test "branch-addend-micromips-n32" run_dump_test "branch-addend-n64" + run_dump_test "branch-addend-micromips-n64" } run_dump_test "branch-absolute" run_dump_test "branch-absolute-addend" diff --git a/gold/ChangeLog b/gold/ChangeLog index 7be51ff..e2eebd1 100644 --- a/gold/ChangeLog +++ b/gold/ChangeLog @@ -1,3 +1,246 @@ +2018-01-12 Eric Christopher <echristo@gmail.com> + + Apply from master: + 2018-01-12 Sterling Augustine <saugustine@google.com> + + * cref.cc (Cref_inputs::Cref_table_compare::operator): Add + conditionals and calls to is_forwarder. + +2017-11-21 Ian Lance Taylor <iant@google.com> + + Apply from master: + 2017-11-19 Ian Lance Taylor <iant@google.com> + Cary Coutant <ccoutant@gmail.com> + * dwarf_reader.h (class Dwarf_info_reader): Add ref_addr_size + method. + * dwarf_reader.cc (Dwarf_die::read_attributes): Use ref_addr_size + for DW_FORM_ref_addr_size. + (Dwarf_die::skip_attributes): Likewise. + +2017-11-15 Eric Christopher <echristo@gmail.com> + + Apply from master. + 2017-10-18 Kyle Butt <iteratee@google.com> + Alan Modra <amodra@gmail.com> + + * powerpc.cc (Target_powerpc::Scan::local): Correct dst_off + calculation for TOC16 relocs. + (Target_powerpc::Scan::global): Likewise. + + 2017-11-08 Kyle Butt <iteratee@google.com> + + * object.cc (do_find_special_sections): Fix a thinko with memmem return + values and check for != NULL rather than == 0. + +2017-11-07 Alan Modra <amodra@gmail.com> + + * system.h (textdomain, bindtextdomain): Use safer "do nothing". + (ngettext, dngettext, dcngettext): Define when !ENABLE_NLS. + +2017-10-25 Alan Modra <amodra@gmail.com> + + * symtab.cc (Symbol_table::add_from_relobj): Match "__gnu_lto_slim" + optionally prefixed with "_". + +2017-10-20 Sriraman Tallam <tmsriram@google.com> + + * options.h (-z,text_unlikely_segment): New option. + * layout.cc (Layout::layout): Create new output section + for .text.unlikely sections with the new option. + (Layout::segment_precedes): Check for the new option + when segment flags match. + * testsuite/text_unlikely_segment.cc: New test source. + * testsuite/text_unlikely_segment.sh: New test script. + * testsuite/Makefile.am (text_unlikely_segment): New test. + * testsuite/Makefile.in: Regenerate. + +2017-10-19 Umesh Kalappa <ukalappa@cisco.com> + + * arm.cc (Stub::do_fixed_endian_write):Far call stubs support for arm + in the be8 mode. + * testsuite/Makefile.am: New test cases. + * testsuite/Makefile.in: Regenerate. + * testsuite/arm_farcall_arm_arm_be8.sh: New script for arm to arm far + call stubs. + * testsuite/arm_farcall_thumb_thumb_be8.sh: New script for thumb to + thumb far call stubs. + +2017-09-26 Cary Coutant <ccoutant@gmail.com> + + PR gold/22213 + * sparc.cc (Target_sparc): Fix incorrect register mask. + +2017-09-22 Jim Wilson <jim.wilson@linaro.org> + + * aarch64.cc (Target_aarch64::aarch64_info): Set + is_default_stack_executable to false. + +2017-09-22 Alan Modra <amodra@gmail.com> + + * resolve.cc (clone): Fix got_offset_list test. + +2017-09-22 Alan Modra <amodra@gmail.com> + + * powerpc.cc (Target_powerpc<64,*>::powerpc_info): Set + is_default_stack_executable false. + +2017-09-20 Teresa Johnson <tejohnson@google.com> + + * plugin.cc (is_visible_from_outside): Check for export dynamic symbol + option and list. + * testsuite/Makefile.am (plugin_test_12): New test. + * testsuite/Makefile.in: Regenerate. + * testsuite/export_dynamic_plugin.cc: New test source. + * testsuite/plugin_test_12.sh: New test script. + +2017-09-20 Alan Modra <amodra@gmail.com> + + * powerpc.cc (Target_powerpc::Branch_info::make_stub): Put + stubs for ppc32 non-branch relocs in first stub table. + (Target_powerpc::Relocate::relocate): Resolve similarly. + +2017-09-19 Alan Modra <amodra@gmail.com> + + * options.h (stub-group-multi): Default to true. Add + --no-stub-group-multi. + +2017-08-30 Alan Modra <amodra@gmail.com> + + * powerpc.cc (Target_powerpc::Relocate::relocate): Nop addis on + TPREL16_HA, and convert insn on TPREL16_LO and TPREL16_LO_DS + relocs to use r2/r13 when addis would add zero. + +2017-08-29 Alan Modra <amodra@gmail.com> + + * options.h (tls_get_addr_optimize): New option. + * symtab.h (Symbol::clear_in_reg, clone): New functions. + (Sized_symbol::clone): New function. + (Symbol_table::clone): New function. + * resolve.cc (Symbol::clone, Sized_symbol::clone): New functions. + * powerpc.cc (Target_powerpc::has_tls_get_addr_opt_, + tls_get_addr_, tls_get_addr_opt_): New vars. + (Target_powerpc::tls_get_addr_opt, tls_get_addr, + is_tls_get_addr_opt, replace_tls_get_addr, + set_has_tls_get_addr_opt, stk_linker): New functions. + (Target_powerpc::Track_tls::maybe_skip_tls_get_addr_call): Add + target param. Update callers. Compare symbols rather than names. + (Target_powerpc::do_define_standard_symbols): Init tls_get_addr_ + and tls_get_addr_opt_. + (Target_powerpc::Branch_info::mark_pltcall): Translate tls_get_addr + sym to tls_get_addr_opt. + (Target_powerpc::Branch_info::make_stub): Likewise. + (Stub_table::define_stub_syms): Likewise. + (Target_powerpc::Scan::global): Likewise. + (Target_powerpc::Relocate::relocate): Likewise. + (add_3_12_2, add_3_12_13, bctrl, beqlr, cmpdi_11_0, cmpwi_11_0, + ld_11_1, ld_11_3, ld_12_3, lwz_11_3, lwz_12_3, mr_0_3, mr_3_0, + mtlr_11, std_11_1): New constants. + (Stub_table::eh_frame_added_): Delete. + (Stub_table::tls_get_addr_opt_bctrl_, plt_fde_len_, plt_fde_): New vars. + (Stub_table::init_plt_fde): New functions. + (Stub_table::add_eh_frame, replace_eh_frame): Move definition out + of line. Init and use plt_fde_. + (Stub_table::plt_call_size): Return size for tls_get_addr stub. + Extract alignment code to.. + (Stub_table::plt_call_align): ..this new function. Adjust all callers. + (Stub_table::add_plt_call_entry): Set has_tls_get_addr_opt and + tls_get_addr_opt_bctrl, and align after that. + (Stub_table::do_write): Write out tls_get_addr stub. + (Target_powerpc::do_finalize_sections): Emit DT_PPC_OPT + PPC_OPT_TLS/PPC64_OPT_TLS bit. + (Target_powerpc::Relocate::relocate): Don't check for or modify + nop following bl for tls_get_addr stub. + +2017-08-29 Alan Modra <amodra@gmail.com> + + * symtab.h (Symbol): Split u_ into u1_ and u2_. Adjust accessors + to suit. Move plt_offset_ before got_offsets_. + * symtab.cc (Symbol::init_fields): Adjust for union change. + (Symbol::init_base_output_data): Likewise. + (Symbol::init_base_output_segment): Likewise. + (Symbol::allocate_base_common): Likewise. + (Symbol::output_section): Likewise. + (Symbol::set_output_section): Likewise. + (Symbol::set_output_segment): Likewise. + * resolve.cc (Symbol::override_base): Likewise. + (Symbol::override_base_with_special): Likewise. + +2017-08-28 Igor Kudrin <ikudrin@accesssoftek.com> + + * aarch64.cc (Target_aarch64::Relocate::relocate_tls): + Make got_tlsdesc_offset signed and fix its calculation. + * testsuite/Makefile.am (aarch64_tlsdesc): New test. + * testsuite/Makefile.in: Regenerate. + * testsuite/aarch64_tlsdesc.s: New test source file. + * testsuite/aarch64_tlsdesc.sh: New test script. + * testsuite/aarch64_tlsdesc.t: New test linker script. + +2017-08-28 Alan Modra <amodra@gmail.com> + + PR 21847 + * powerpc.cc (Target_powerpc::is_elfv2_localentry0): Test + non_zero_localentry. + (Target_powerpc::resolve): New function. + (powerpc_info): Set has_resolve for 64-bit. + * target.h (Sized_target::resolve): Return bool. + * resolve.cc (Symbol_table::resolve): Continue with normal + processing when target resolve returns false. + * symtab.h (Symbol::non_zero_localentry, set_non_zero_localentry): + New accessors. + (Symbol::non_zero_localentry_): New flag bit. + * symtab.cc (Symbol::init_fields): Init non_zero_localentry_. + +2017-08-08 Romain Geissler <romain.geissler@gmail.com> + Alan Modra <amodra@gmail.com> + + * configure.ac: Add --enable-default-hash-style option. + * options.h (hash_style): Use DEFAULT_HASH_STYLE as default value. + * configure: Regenerate. + * config.in: Regenerate. + +2017-08-03 James Clarke <jrtc27@jrtc27.com> + + * options.h (General_options): Set a non-NULL second help string + argument for relax to allow --no-relax. + +2017-08-01 Alan Modra <amodra@gmail.com> + + * ehframe.cc (Fde::operator==): New. + (Cie::remove_fde, Eh_frame::remove_ehframe_for_plt): New. + * ehframe.h (Fde::operator==): Declare. + (Cie::remove_fde, Eh_frame::remove_ehframe_for_plt): Likewise. + * layout.cc (Layout::remove_eh_frame_for_plt): New. + * layout.h (Layout::remove_eh_frame_for_plt): Declare. + * powerpc.cc (Target_powerpc::do_relax): Remove old eh_frame FDEs. + (Stub_table::add_eh_frame): Delete eh_frame_added_ condition. + Don't add eh_frame for empty stub section. + (Stub_table::remove_eh_frame): New. + +2017-07-31 Alan Modra <amodra@gmail.com> + + * options.h (no_tls_optimize): New powerpc option. + * powerpc.cc (Target_powerpc::abiversion, set_abiversion): Formatting. + (Target_powerpc::stk_toc): Formatting, fix comment. + (Target_powerpc::Track_tls::tls_get_addr_state): Rename from + tls_get_addr. + (Target_powerpc::optimize_tls_gd, optimize_tls_ld, optimize_tls_ie): + Return TLSOPT_NONE when !tls_optimize. + (Target_powerpc::add_global_pair_with_rel): Check + for existing reloc before reserving. + (Target_powerpc::add_local_tls_pair): Likewise. + +2017-07-31 Alan Modra <amodra@gmail.com> + + PR 21847 + * powerpc.cc (Target_powerpc::scan_relocs): Warn on --plt-localentry + without ld.so checks. + +2017-07-29 Alan Modra <amodra@gmail.com> + + PR 21847 + * powerpc.cc (Target_powerpc::scan_relocs): Default to + --no-plt-localentry. + 2017-07-28 H.J. Lu <hongjiu.lu@intel.com> PR gold/21857 diff --git a/gold/cref.cc b/gold/cref.cc index d3337b9..ff9e217 100644 --- a/gold/cref.cc +++ b/gold/cref.cc @@ -236,9 +236,13 @@ Cref_inputs::Cref_table_compare::operator()(const Symbol* s1, } // We should never have two different symbols with the same name and - // version. + // version, where one doesn't forward to the other. if (s1 == s2) return false; + if (s1->is_forwarder() && !s2->is_forwarder()) + return true; + if (!s1->is_forwarder() && s2->is_forwarder()) + return false; gold_unreachable(); } diff --git a/gold/dwarf_reader.cc b/gold/dwarf_reader.cc index 8c0d593..4da9c1e 100644 --- a/gold/dwarf_reader.cc +++ b/gold/dwarf_reader.cc @@ -737,7 +737,6 @@ Dwarf_die::read_attributes() break; } case elfcpp::DW_FORM_addr: - case elfcpp::DW_FORM_ref_addr: { off_t sec_off; if (this->dwinfo_->address_size() == 4) @@ -751,6 +750,20 @@ Dwarf_die::read_attributes() ref_form = true; break; } + case elfcpp::DW_FORM_ref_addr: + { + off_t sec_off; + if (this->dwinfo_->ref_addr_size() == 4) + sec_off = this->dwinfo_->read_from_pointer<32>(&pattr); + else + sec_off = this->dwinfo_->read_from_pointer<64>(&pattr); + unsigned int shndx = + this->dwinfo_->lookup_reloc(attr_off, &sec_off); + attr_value.aux.shndx = shndx; + attr_value.val.refval = sec_off; + ref_form = true; + break; + } case elfcpp::DW_FORM_block1: attr_value.aux.blocklen = *pattr++; attr_value.val.blockval = pattr; @@ -947,9 +960,11 @@ Dwarf_die::skip_attributes() pattr += this->dwinfo_->offset_size(); break; case elfcpp::DW_FORM_addr: - case elfcpp::DW_FORM_ref_addr: pattr += this->dwinfo_->address_size(); break; + case elfcpp::DW_FORM_ref_addr: + pattr += this->dwinfo_->ref_addr_size(); + break; case elfcpp::DW_FORM_block1: pattr += 1 + *pattr; break; diff --git a/gold/dwarf_reader.h b/gold/dwarf_reader.h index b41e057..31e76ce 100644 --- a/gold/dwarf_reader.h +++ b/gold/dwarf_reader.h @@ -764,6 +764,13 @@ class Dwarf_info_reader address_size() const { return this->address_size_; } + // Return the size of a DW_FORM_ref_addr. + // In DWARF v2, this was the size of an address; in DWARF v3 and later, + // it is the size of an DWARF offset. + unsigned int + ref_addr_size() const + { return this->cu_version_ > 2 ? this->offset_size_ : this->address_size_; } + // Set the section index of the .debug_abbrev section. // We use this if there are no relocations for the .debug_info section. // If not set, the code parse() routine will search for the section by name. diff --git a/gold/object.cc b/gold/object.cc index 4110686..0135651 100644 --- a/gold/object.cc +++ b/gold/object.cc @@ -816,9 +816,9 @@ Sized_relobj_file<size, big_endian>::do_find_special_sections( return (this->has_eh_frame_ || (!parameters->options().relocatable() && parameters->options().gdb_index() - && (memmem(names, sd->section_names_size, "debug_info", 11) == 0 + && (memmem(names, sd->section_names_size, "debug_info", 11) != NULL || memmem(names, sd->section_names_size, - "debug_types", 12) == 0))); + "debug_types", 12) != NULL))); } // Read the sections and symbols from an object file. diff --git a/gold/powerpc.cc b/gold/powerpc.cc index a448efb..9658867 100644 --- a/gold/powerpc.cc +++ b/gold/powerpc.cc @@ -6420,7 +6420,7 @@ Target_powerpc<size, big_endian>::Scan::local( shndx = ppc_object->adjust_sym_shndx(r_sym, shndx, &is_ordinary); if (is_ordinary && shndx == ppc_object->toc_shndx()) { - Address dst_off = lsym.get_st_value() + reloc.get_r_offset(); + Address dst_off = lsym.get_st_value() + reloc.get_r_addend(); if (dst_off < ppc_object->section_size(shndx)) { bool ok = false; @@ -7065,7 +7065,7 @@ Target_powerpc<size, big_endian>::Scan::global( if (shndx == sym_object->toc_shndx()) { Sized_symbol<size>* sym = symtab->get_sized_symbol<size>(gsym); - Address dst_off = sym->value() + reloc.get_r_offset(); + Address dst_off = sym->value() + reloc.get_r_addend(); if (dst_off < sym_object->section_size(shndx)) { bool ok = false; diff --git a/include/ChangeLog b/include/ChangeLog index dddecfb..339cabe 100644 --- a/include/ChangeLog +++ b/include/ChangeLog @@ -1,3 +1,18 @@ +2017-09-27 Alan Modra <amodra@gmail.com> + + Apply from master + 2017-05-16 Alan Modra <amodra@gmail.com> + * bfdlink.h (struct bfd_link_hash_entry <non_ir_ref>): Rename to + non_ir_ref_regular. + + 2017-05-16 Alan Modra <amodra@gmail.com> + * bfdlink.h (struct bfd_link_hash_entry): Update non_ir_ref + comment. Rename dynamic_ref_after_ir_def to non_ir_ref_dynamic. + + 2017-04-20 H.J. Lu <hongjiu.lu@intel.com> + PR ld/21382 + * bfdlink.h (bfd_link_hash_entry): Add dynamic_ref_after_ir_def. + 2017-04-03 Palmer Dabbelt <palmer@dabbelt.com> * elf/riscv.h (RISCV_GP_SYMBOL): New define. diff --git a/include/bfdlink.h b/include/bfdlink.h index 3835fcb..46528ce 100644 --- a/include/bfdlink.h +++ b/include/bfdlink.h @@ -100,9 +100,13 @@ struct bfd_link_hash_entry /* Type of this entry. */ ENUM_BITFIELD (bfd_link_hash_type) type : 8; - /* Symbol is referenced in a normal object file, as distict from a LTO - IR object file. */ - unsigned int non_ir_ref : 1; + /* Symbol is referenced in a normal regular object file, + as distinct from a LTO IR object file. */ + unsigned int non_ir_ref_regular : 1; + + /* Symbol is referenced in a normal dynamic object file, + as distinct from a LTO IR object file. */ + unsigned int non_ir_ref_dynamic : 1; /* Symbol is a built-in define. These will be overridden by PROVIDE in a linker script. */ diff --git a/ld/ChangeLog b/ld/ChangeLog index 6b39c0d..67830b9 100644 --- a/ld/ChangeLog +++ b/ld/ChangeLog @@ -1,3 +1,63 @@ +2017-09-28 Alan Modra <amodra@gmail.com> + + * testsuite/ld-plugin/pr22220.h, + * testsuite/ld-plugin/pr22220lib.cc, + * testsuite/ld-plugin/pr22220lib.ver, + * testsuite/ld-plugin/pr22220main.cc: New test. + * testsuite/ld-plugin/lto.exp: Run it. + +2017-09-27 Alan Modra <amodra@gmail.com> + + Apply from master + 2017-05-16 Alan Modra <amodra@gmail.com> + * plugin.c: Rename occurrences of non_ir_ref. + + 2017-05-16 Alan Modra <amodra@gmail.com> + * plugin.c (is_visible_from_outside): Use non_ir_ref_dynamic. + (plugin_notice): Set non_ir_ref for references from regular + objects, non_ir_ref_dynamic for references from dynamic objects. + + 2017-04-20 H.J. Lu <hongjiu.lu@intel.com> + PR ld/21382 + * plugin.c (is_visible_from_outside): Symbol may be visible + from outside if dynamic_ref_after_ir_def is set. + (plugin_notice): Set dynamic_ref_after_ir_def if the symbol is + defined in an IR object and referenced in a dynamic object. + * testsuite/ld-plugin/lto.exp: Run PR ld/21382 tests. + * testsuite/ld-plugin/pr21382a.c: New file. + * testsuite/ld-plugin/pr21382b.c: Likewise. + + 2017-01-24 Jiong Wang <jiong.wang@arm.com> + * testsuite/ld-plugin/lto.exp (lto_link_elf_tests): Move "Compile 7", + "Compile 8a", "Compile 8b"... + (lto_compile_elf_tests): ...to here. Always run these tests. + (lto_run_elf_tests): Move "LTO 7"... + (lto_run_elf_shared_tests): ...to here. Restrict these tests on + environment where share library is supported. + +2017-08-30 Maciej W. Rozycki <macro@imgtec.com> + + * testsuite/ld-mips-elf/bal-jalx-addend-micromips.d: New test. + * testsuite/ld-mips-elf/bal-jalx-addend-micromips-n32.d: New + test. + * testsuite/ld-mips-elf/bal-jalx-addend-micromips-n64.d: New + test. + * testsuite/ld-mips-elf/bal-jalx-local-micromips.d: New test. + * testsuite/ld-mips-elf/bal-jalx-local-micromips-n32.d: New + test. + * testsuite/ld-mips-elf/bal-jalx-local-micromips-n64.d: New + test. + * testsuite/ld-mips-elf/bal-jalx-pic-micromips.d: New test. + * testsuite/ld-mips-elf/bal-jalx-pic-micromips-n32.d: New test. + * testsuite/ld-mips-elf/bal-jalx-pic-micromips-n64.d: New test. + * testsuite/ld-mips-elf/bal-jalx-pic-ignore-micromips.d: New + test. + * testsuite/ld-mips-elf/bal-jalx-pic-ignore-micromips-n32.d: New + test. + * testsuite/ld-mips-elf/bal-jalx-pic-ignore-micromips-n64.d: New + test. + * testsuite/ld-mips-elf/mips-elf.exp: Run the new tests. + 2017-07-25 Tristan Gingold <gingold@adacore.com> * configure: Regenerate. diff --git a/ld/plugin.c b/ld/plugin.c index 03e2e69..9abeaf0 100644 --- a/ld/plugin.c +++ b/ld/plugin.c @@ -629,7 +629,9 @@ is_visible_from_outside (struct ld_plugin_symbol *lsym, if (bfd_link_relocatable (&link_info)) return TRUE; - if (link_info.export_dynamic || bfd_link_dll (&link_info)) + if (blhe->non_ir_ref_dynamic + || link_info.export_dynamic + || bfd_link_dll (&link_info)) { /* Check if symbol is hidden by version script. */ if (bfd_hide_sym_by_version (link_info.version_info, @@ -772,7 +774,7 @@ get_symbols (const void *handle, int nsyms, struct ld_plugin_symbol *syms, even potentially-referenced, perhaps in a future final link if this is a partial one, perhaps dynamically at load-time if the symbol is externally visible. */ - if (blhe->non_ir_ref) + if (blhe->non_ir_ref_regular) res = LDPR_PREVAILING_DEF; else if (is_visible_from_outside (&syms[n], blhe)) res = def_ironly_exp; @@ -1264,9 +1266,10 @@ plugin_call_cleanup (void) /* To determine which symbols should be resolved LDPR_PREVAILING_DEF and which LDPR_PREVAILING_DEF_IRONLY, we notice all the symbols as the linker adds them to the linker hash table. Mark those - referenced from a non-IR file with non_ir_ref. We have to - notice_all symbols, because we won't necessarily know until later - which ones will be contributed by IR files. */ + referenced from a non-IR file with non_ir_ref_regular or + non_ir_ref_dynamic as appropriate. We have to notice_all symbols, + because we won't necessarily know until later which ones will be + contributed by IR files. */ static bfd_boolean plugin_notice (struct bfd_link_info *info, struct bfd_link_hash_entry *h, @@ -1281,6 +1284,7 @@ plugin_notice (struct bfd_link_info *info, if (h != NULL) { bfd *sym_bfd; + bfd_boolean ref = FALSE; if (h->type == bfd_link_hash_warning) h = h->u.i.link; @@ -1296,13 +1300,17 @@ plugin_notice (struct bfd_link_info *info, { /* ??? Some of this is questionable. See comments in _bfd_generic_link_add_one_symbol for case IND. */ - if (h->type != bfd_link_hash_new) + if (h->type != bfd_link_hash_new + || inh->type == bfd_link_hash_new) { - h->non_ir_ref = TRUE; - inh->non_ir_ref = TRUE; + if ((abfd->flags & DYNAMIC) == 0) + inh->non_ir_ref_regular = TRUE; + else + inh->non_ir_ref_dynamic = TRUE; } - else if (inh->type == bfd_link_hash_new) - inh->non_ir_ref = TRUE; + + if (h->type != bfd_link_hash_new) + ref = TRUE; } /* Nothing to do here for warning symbols. */ @@ -1317,24 +1325,17 @@ plugin_notice (struct bfd_link_info *info, else if (bfd_is_und_section (section)) { /* Replace the undefined dummy bfd with the real one. */ - if ((h->type == bfd_link_hash_undefined - || h->type == bfd_link_hash_undefweak) - && (h->u.undef.abfd == NULL - || (h->u.undef.abfd->flags & BFD_PLUGIN) != 0)) - h->u.undef.abfd = abfd; - h->non_ir_ref = TRUE; + if ((h->type == bfd_link_hash_undefined + || h->type == bfd_link_hash_undefweak) + && (h->u.undef.abfd == NULL + || (h->u.undef.abfd->flags & BFD_PLUGIN) != 0)) + h->u.undef.abfd = abfd; + ref = TRUE; } /* Otherwise, it must be a new def. */ else { - /* A common symbol should be merged with other commons or - defs with the same name. In particular, a common ought - to be overridden by a def in a -flto object. In that - sense a common is also a ref. */ - if (bfd_is_com_section (section)) - h->non_ir_ref = TRUE; - /* Ensure any symbol defined in an IR dummy BFD takes on a new value from a real BFD. Weak symbols are not normally overridden by a new weak definition, and strong symbols @@ -1349,6 +1350,21 @@ plugin_notice (struct bfd_link_info *info, h->type = bfd_link_hash_undefweak; h->u.undef.abfd = sym_bfd; } + + /* A common symbol should be merged with other commons or + defs with the same name. In particular, a common ought + to be overridden by a def in a -flto object. In that + sense a common is also a ref. */ + if (bfd_is_com_section (section)) + ref = TRUE; + } + + if (ref) + { + if ((abfd->flags & DYNAMIC) == 0) + h->non_ir_ref_regular = TRUE; + else + h->non_ir_ref_dynamic = TRUE; } } diff --git a/ld/testsuite/ld-mips-elf/bal-jalx-addend-micromips-n32.d b/ld/testsuite/ld-mips-elf/bal-jalx-addend-micromips-n32.d new file mode 100644 index 0000000..9c7aca5 --- /dev/null +++ b/ld/testsuite/ld-mips-elf/bal-jalx-addend-micromips-n32.d @@ -0,0 +1,6 @@ +#name: microMIPS BAL/JALX addend calculation (n32) +#source: ../../../gas/testsuite/gas/mips/branch-addend-micromips.s +#as: -EB -n32 -march=from-abi +#ld: -EB -Ttext 0x1c000000 -e 0x1c000000 +#objdump: -dr --prefix-addresses --show-raw-insn +#dump: bal-jalx-addend-micromips.d diff --git a/ld/testsuite/ld-mips-elf/bal-jalx-addend-micromips-n64.d b/ld/testsuite/ld-mips-elf/bal-jalx-addend-micromips-n64.d new file mode 100644 index 0000000..e254c65 --- /dev/null +++ b/ld/testsuite/ld-mips-elf/bal-jalx-addend-micromips-n64.d @@ -0,0 +1,6 @@ +#name: microMIPS BAL/JALX addend calculation (n64) +#source: ../../../gas/testsuite/gas/mips/branch-addend-micromips.s +#as: -EB -64 -march=from-abi +#ld: -EB -Ttext 0x1c000000 -e 0x1c000000 +#objdump: -dr --prefix-addresses --show-raw-insn +#dump: bal-jalx-addend-micromips.d diff --git a/ld/testsuite/ld-mips-elf/bal-jalx-addend-micromips.d b/ld/testsuite/ld-mips-elf/bal-jalx-addend-micromips.d new file mode 100644 index 0000000..e066f5d --- /dev/null +++ b/ld/testsuite/ld-mips-elf/bal-jalx-addend-micromips.d @@ -0,0 +1,22 @@ +#name: microMIPS BAL/JALX addend calculation +#source: ../../../gas/testsuite/gas/mips/branch-addend-micromips.s +#as: -EB -32 +#ld: -EB -Ttext 0x1c000000 -e 0x1c000000 +#objdump: -dr --prefix-addresses --show-raw-insn + +.*: +file format .*mips.* + +Disassembly of section \.text: + \.\.\. +[0-9a-f]+ <[^>]*> 00000027 nor zero,zero,zero +[0-9a-f]+ <[^>]*> 03e00009 jalr zero,ra +[0-9a-f]+ <[^>]*> 00000027 nor zero,zero,zero +[0-9a-f]+ <[^>]*> 00000000 nop +[0-9a-f]+ <[^>]*> 0000 02d0 not zero,zero +[0-9a-f]+ <[^>]*> f300 4400 jalx 0*1c011000 <.*> +[0-9a-f]+ <[^>]*> 0000 02d0 not zero,zero +[0-9a-f]+ <[^>]*> 4060 7ff8 bal 0*1c011010 <.*> +[0-9a-f]+ <[^>]*> 0000 02d0 not zero,zero +[0-9a-f]+ <[^>]*> 001f 0f3c jr ra +[0-9a-f]+ <[^>]*> 0000 02d0 not zero,zero + \.\.\. diff --git a/ld/testsuite/ld-mips-elf/bal-jalx-local-micromips-n32.d b/ld/testsuite/ld-mips-elf/bal-jalx-local-micromips-n32.d new file mode 100644 index 0000000..16fcb0a --- /dev/null +++ b/ld/testsuite/ld-mips-elf/bal-jalx-local-micromips-n32.d @@ -0,0 +1,6 @@ +#name: microMIPS BAL to JALX conversion for local symbol (n32) +#source: ../../../gas/testsuite/gas/mips/branch-local-7.s +#as: -EB -n32 -march=from-abi +#ld: -EB -Ttext 0x1c000000 -e 0x1c000000 +#objdump: -dr --prefix-addresses --show-raw-insn +#dump: bal-jalx-local-micromips.d diff --git a/ld/testsuite/ld-mips-elf/bal-jalx-local-micromips-n64.d b/ld/testsuite/ld-mips-elf/bal-jalx-local-micromips-n64.d new file mode 100644 index 0000000..d13a9ea --- /dev/null +++ b/ld/testsuite/ld-mips-elf/bal-jalx-local-micromips-n64.d @@ -0,0 +1,6 @@ +#name: microMIPS BAL to JALX conversion for local symbol (n64) +#source: ../../../gas/testsuite/gas/mips/branch-local-7.s +#as: -EB -64 -march=from-abi +#ld: -EB -Ttext 0x1c000000 -e 0x1c000000 +#objdump: -dr --prefix-addresses --show-raw-insn +#dump: bal-jalx-local-micromips.d diff --git a/ld/testsuite/ld-mips-elf/bal-jalx-local-micromips.d b/ld/testsuite/ld-mips-elf/bal-jalx-local-micromips.d new file mode 100644 index 0000000..e944d3b --- /dev/null +++ b/ld/testsuite/ld-mips-elf/bal-jalx-local-micromips.d @@ -0,0 +1,20 @@ +#name: microMIPS BAL to JALX conversion for local symbol +#source: ../../../gas/testsuite/gas/mips/branch-local-7.s +#as: -EB -32 +#ld: -EB -Ttext 0x1c000000 -e 0x1c000000 +#objdump: -dr --prefix-addresses --show-raw-insn + +.*: +file format .*mips.* + +Disassembly of section \.text: + \.\.\. +[0-9a-f]+ <[^>]*> 00000027 nor zero,zero,zero +[0-9a-f]+ <[^>]*> 03e00009 jalr zero,ra +[0-9a-f]+ <[^>]*> 00000027 nor zero,zero,zero +[0-9a-f]+ <[^>]*> 00000000 nop +[0-9a-f]+ <[^>]*> 0000 02d0 not zero,zero +[0-9a-f]+ <[^>]*> f300 0400 jalx 0*1c001000 <foo> +[0-9a-f]+ <[^>]*> 0000 02d0 not zero,zero +[0-9a-f]+ <[^>]*> 001f 0f3c jr ra +[0-9a-f]+ <[^>]*> 0000 02d0 not zero,zero + \.\.\. diff --git a/ld/testsuite/ld-mips-elf/bal-jalx-pic-ignore-micromips-n32.d b/ld/testsuite/ld-mips-elf/bal-jalx-pic-ignore-micromips-n32.d new file mode 100644 index 0000000..9a293c5 --- /dev/null +++ b/ld/testsuite/ld-mips-elf/bal-jalx-pic-ignore-micromips-n32.d @@ -0,0 +1,6 @@ +#name: microMIPS BAL/JALX in PIC mode (ignore branch ISA, n32) +#source: ../../../gas/testsuite/gas/mips/branch-addend-micromips.s +#as: -EB -n32 -march=from-abi +#ld: -EB -Ttext 0x1c000000 -e 0x1c000000 -shared --ignore-branch-isa +#objdump: -dr --prefix-addresses --show-raw-insn +#dump: bal-jalx-pic-ignore-micromips.d diff --git a/ld/testsuite/ld-mips-elf/bal-jalx-pic-ignore-micromips-n64.d b/ld/testsuite/ld-mips-elf/bal-jalx-pic-ignore-micromips-n64.d new file mode 100644 index 0000000..2b78bb9 --- /dev/null +++ b/ld/testsuite/ld-mips-elf/bal-jalx-pic-ignore-micromips-n64.d @@ -0,0 +1,6 @@ +#name: microMIPS BAL/JALX in PIC mode (ignore branch ISA, n64) +#source: ../../../gas/testsuite/gas/mips/branch-addend-micromips.s +#as: -EB -64 -march=from-abi +#ld: -EB -Ttext 0x1c000000 -e 0x1c000000 -shared --ignore-branch-isa +#objdump: -dr --prefix-addresses --show-raw-insn +#dump: bal-jalx-pic-ignore-micromips.d diff --git a/ld/testsuite/ld-mips-elf/bal-jalx-pic-ignore-micromips.d b/ld/testsuite/ld-mips-elf/bal-jalx-pic-ignore-micromips.d new file mode 100644 index 0000000..0b48b3a --- /dev/null +++ b/ld/testsuite/ld-mips-elf/bal-jalx-pic-ignore-micromips.d @@ -0,0 +1,22 @@ +#name: microMIPS BAL/JALX in PIC mode (ignore branch ISA) +#source: ../../../gas/testsuite/gas/mips/branch-addend-micromips.s +#as: -EB -32 +#ld: -EB -Ttext 0x1c000000 -e 0x1c000000 -shared --ignore-branch-isa +#objdump: -dr --prefix-addresses --show-raw-insn + +.*: +file format .*mips.* + +Disassembly of section \.text: + \.\.\. +[0-9a-f]+ <[^>]*> 00000027 nor zero,zero,zero +[0-9a-f]+ <[^>]*> 03e00009 jalr zero,ra +[0-9a-f]+ <[^>]*> 00000027 nor zero,zero,zero +[0-9a-f]+ <[^>]*> 00000000 nop +[0-9a-f]+ <[^>]*> 0000 02d0 not zero,zero +[0-9a-f]+ <[^>]*> 4060 7ff4 bal 0*1c011000 <.*> +[0-9a-f]+ <[^>]*> 0000 02d0 not zero,zero +[0-9a-f]+ <[^>]*> 4060 7ff8 bal 0*1c011010 <.*> +[0-9a-f]+ <[^>]*> 0000 02d0 not zero,zero +[0-9a-f]+ <[^>]*> 001f 0f3c jr ra +[0-9a-f]+ <[^>]*> 0000 02d0 not zero,zero + \.\.\. diff --git a/ld/testsuite/ld-mips-elf/bal-jalx-pic-micromips-n32.d b/ld/testsuite/ld-mips-elf/bal-jalx-pic-micromips-n32.d new file mode 100644 index 0000000..3b25dc7 --- /dev/null +++ b/ld/testsuite/ld-mips-elf/bal-jalx-pic-micromips-n32.d @@ -0,0 +1,6 @@ +#name: microMIPS BAL/JALX in PIC mode (n32) +#source: ../../../gas/testsuite/gas/mips/branch-addend-micromips.s +#as: -EB -n32 -march=from-abi +#ld: -EB -Ttext 0x1c000000 -e 0x1c000000 -shared +#error: \A[^\n]*: In function `bar':\n +#error: \(\.text\+0x1014\): Unsupported branch between ISA modes\Z diff --git a/ld/testsuite/ld-mips-elf/bal-jalx-pic-micromips-n64.d b/ld/testsuite/ld-mips-elf/bal-jalx-pic-micromips-n64.d new file mode 100644 index 0000000..d39f114 --- /dev/null +++ b/ld/testsuite/ld-mips-elf/bal-jalx-pic-micromips-n64.d @@ -0,0 +1,6 @@ +#name: microMIPS BAL/JALX in PIC mode (n64) +#source: ../../../gas/testsuite/gas/mips/branch-addend-micromips.s +#as: -EB -64 -march=from-abi +#ld: -EB -Ttext 0x1c000000 -e 0x1c000000 -shared +#error: \A[^\n]*: In function `bar':\n +#error: \(\.text\+0x1014\): Unsupported branch between ISA modes\Z diff --git a/ld/testsuite/ld-mips-elf/bal-jalx-pic-micromips.d b/ld/testsuite/ld-mips-elf/bal-jalx-pic-micromips.d new file mode 100644 index 0000000..7404d25 --- /dev/null +++ b/ld/testsuite/ld-mips-elf/bal-jalx-pic-micromips.d @@ -0,0 +1,6 @@ +#name: microMIPS BAL/JALX in PIC mode +#source: ../../../gas/testsuite/gas/mips/branch-addend-micromips.s +#as: -EB -32 +#ld: -EB -Ttext 0x1c000000 -e 0x1c000000 -shared +#error: \A[^\n]*: In function `bar':\n +#error: \(\.text\+0x1014\): Unsupported branch between ISA modes\Z diff --git a/ld/testsuite/ld-mips-elf/mips-elf.exp b/ld/testsuite/ld-mips-elf/mips-elf.exp index 7fa11c5..ca44140 100644 --- a/ld/testsuite/ld-mips-elf/mips-elf.exp +++ b/ld/testsuite/ld-mips-elf/mips-elf.exp @@ -214,22 +214,43 @@ if { $linux_gnu } { run_dump_test "jalx-addend" [list [list ld $abi_ldflags(o32)]] run_dump_test "jalx-local" [list [list ld $abi_ldflags(o32)]] run_dump_test "bal-jalx-addend" [list [list ld $abi_ldflags(o32)]] +run_dump_test "bal-jalx-addend-micromips" [list [list ld $abi_ldflags(o32)]] run_dump_test "bal-jalx-local" [list [list ld $abi_ldflags(o32)]] +run_dump_test "bal-jalx-local-micromips" [list [list ld $abi_ldflags(o32)]] run_dump_test "bal-jalx-pic" [list [list ld $abi_ldflags(o32)]] +run_dump_test "bal-jalx-pic-micromips" [list [list ld $abi_ldflags(o32)]] run_dump_test "bal-jalx-pic-ignore" [list [list ld $abi_ldflags(o32)]] +run_dump_test "bal-jalx-pic-ignore-micromips" \ + [list [list ld $abi_ldflags(o32)]] if $has_newabi { run_dump_test "jalx-addend-n32" [list [list ld $abi_ldflags(n32)]] run_dump_test "jalx-local-n32" [list [list ld $abi_ldflags(n32)]] run_dump_test "bal-jalx-addend-n32" [list [list ld $abi_ldflags(n32)]] + run_dump_test "bal-jalx-addend-micromips-n32" \ + [list [list ld $abi_ldflags(n32)]] run_dump_test "bal-jalx-local-n32" [list [list ld $abi_ldflags(n32)]] + run_dump_test "bal-jalx-local-micromips-n32" \ + [list [list ld $abi_ldflags(n32)]] run_dump_test "bal-jalx-pic-n32" [list [list ld $abi_ldflags(n32)]] + run_dump_test "bal-jalx-pic-micromips-n32" \ + [list [list ld $abi_ldflags(n32)]] run_dump_test "bal-jalx-pic-ignore-n32" [list [list ld $abi_ldflags(n32)]] + run_dump_test "bal-jalx-pic-ignore-micromips-n32" \ + [list [list ld $abi_ldflags(n32)]] run_dump_test "jalx-addend-n64" [list [list ld $abi_ldflags(n64)]] run_dump_test "jalx-local-n64" [list [list ld $abi_ldflags(n64)]] run_dump_test "bal-jalx-addend-n64" [list [list ld $abi_ldflags(n64)]] + run_dump_test "bal-jalx-addend-micromips-n64" \ + [list [list ld $abi_ldflags(n64)]] run_dump_test "bal-jalx-local-n64" [list [list ld $abi_ldflags(n64)]] + run_dump_test "bal-jalx-local-micromips-n64" \ + [list [list ld $abi_ldflags(n64)]] run_dump_test "bal-jalx-pic-n64" [list [list ld $abi_ldflags(n64)]] + run_dump_test "bal-jalx-pic-micromips-n64" \ + [list [list ld $abi_ldflags(n64)]] run_dump_test "bal-jalx-pic-ignore-n64" [list [list ld $abi_ldflags(n64)]] + run_dump_test "bal-jalx-pic-ignore-micromips-n64" \ + [list [list ld $abi_ldflags(n64)]] } run_dump_test "unaligned-jalx-0" [list [list ld $abi_ldflags(o32)]] diff --git a/ld/testsuite/ld-plugin/lto.exp b/ld/testsuite/ld-plugin/lto.exp index d1ef17e..04e4eea 100644 --- a/ld/testsuite/ld-plugin/lto.exp +++ b/ld/testsuite/ld-plugin/lto.exp @@ -214,20 +214,23 @@ if { [at_least_gcc_version 4 7] } { ]] } -# Generate input files for complex LTO tests for ELF. -set lto_link_elf_tests [list \ +set lto_compile_elf_tests [list \ [list "Compile 7" \ "" "-flto -O2" \ {lto-7a.c lto-7b.c lto-7c.c} {} ""] \ - [list "Build liblto-7.so" \ - "-shared" "-O2 -fpic" \ - {lto-7d.c} {} "liblto-7.so" "c"] \ [list "Compile 8a" \ "" "-O2" \ {lto-8a.c} {} ""] \ [list "Compile 8b" \ "" "-flto -O2" \ {lto-8b.c} {} ""] \ +] + +# Generate input files for complex LTO tests for ELF. +set lto_link_elf_tests [list \ + [list "Build liblto-7.so" \ + "-shared" "-O2 -fpic" \ + {lto-7d.c} {} "liblto-7.so" "c"] \ [list "Build liblto-17a.so" \ "-shared -O2 -fpic -flto -fuse-linker-plugin" "-O2 -fpic -flto" \ {lto-17a.c} {{"nm" {} "lto-17a.d"}} "liblto-17a.so" "c"] \ @@ -279,6 +282,18 @@ set lto_link_elf_tests [list \ [list "PR ld/14918" \ "-flto" "-flto" \ {pr14918.c} {{"readelf" {-d --wide} "pr14918.d"}} "pr14918.exe" "c"] \ + [list "Build pr21382a.o" \ + "" "-O2 -flto" \ + {pr21382a.c} {} "" "c"] \ + [list "Build pr21382.so" \ + "-shared" "-O2 -fpic" \ + {pr21382b.c} {} "pr21382.so" "c"] \ + [list {Build pr22220lib.so} \ + {-shared -Wl,--version-script=pr22220lib.ver} {-fPIC} \ + {pr22220lib.cc} {} {pr22220lib.so} {c++}] \ + [list {Build pr22220main.o} \ + {} {-flto} \ + {pr22220main.cc} {} {} {c++}] \ ] # Check final symbols in executables. @@ -372,11 +387,24 @@ if { [at_least_gcc_version 4 7] } { ]] } -# LTO run-time tests for ELF -set lto_run_elf_tests [list \ +# LTO run-time tests for ELF which require shared library support. +set lto_run_elf_shared_tests [list \ [list "LTO 7" \ "-O2 -flto -fuse-linker-plugin tmpdir/lto-7b.o tmpdir/lto-7c.o tmpdir/lto-7a.o -Wl,--no-as-needed tmpdir/liblto-7.so" "" \ {dummy.c} "lto-7.exe" "lto-7.out" "" "c"] \ + [list "Run pr21382" \ + "-O2 -flto -fuse-linker-plugin -Wl,--as-needed tmpdir/pr21382a.o tmpdir/pr21382.so" "" \ + {dummy.c} "pr21382.exe" "pass.out" "" "c"] \ + [list {pr22220a} \ + {-flto -fuse-linker-plugin tmpdir/pr22220main.o tmpdir/pr22220lib.so} {} \ + {dummy.c} {pr22220a.exe} {pass.out} {} {c++}] \ + [list {pr22220b} \ + {-flto -fuse-linker-plugin -Wl,--no-as-needed tmpdir/pr22220lib.so tmpdir/pr22220main.o} {} \ + {dummy.c} {pr22220b.exe} {pass.out} {} {c++}] \ +] + +# LTO run-time tests for ELF +set lto_run_elf_tests [list \ [list "LTO 8" \ "-O2 -flto -fuse-linker-plugin tmpdir/lto-8b.o tmpdir/lto-8a.o" "" \ {dummy.c} "lto-8.exe" "lto-8.out" "" "c"] \ @@ -387,6 +415,10 @@ set lto_run_elf_tests [list \ run_cc_link_tests $lto_link_tests +# These compilation tests generate intermediate object files which will be used +# by some elf tests besides shared libs tests. So, always compile them. +run_cc_link_tests $lto_compile_elf_tests + # Restrict these to ELF targets that support shared libs and PIC. if { [is_elf_format] && [check_lto_shared_available] } { run_cc_link_tests $lto_link_elf_tests @@ -487,6 +519,10 @@ if { [is_elf_format] } { run_ld_link_exec_tests $lto_run_elf_tests } +if { [is_elf_format] && [check_lto_shared_available] } { + run_ld_link_exec_tests $lto_run_elf_shared_tests +} + proc pr20103 {cflags libs} { global CC diff --git a/ld/testsuite/ld-plugin/pr21382a.c b/ld/testsuite/ld-plugin/pr21382a.c new file mode 100644 index 0000000..09b9d75 --- /dev/null +++ b/ld/testsuite/ld-plugin/pr21382a.c @@ -0,0 +1,17 @@ +#include <stdio.h> + +extern void y (void); + +void +x (void) +{ + printf ("PASS\n"); +} + + +int +main (void) +{ + y (); + return 0; +} diff --git a/ld/testsuite/ld-plugin/pr21382b.c b/ld/testsuite/ld-plugin/pr21382b.c new file mode 100644 index 0000000..c5b74a9 --- /dev/null +++ b/ld/testsuite/ld-plugin/pr21382b.c @@ -0,0 +1,7 @@ +extern void x (void); + +void +y (void) +{ + x (); +} diff --git a/ld/testsuite/ld-plugin/pr22220.h b/ld/testsuite/ld-plugin/pr22220.h new file mode 100644 index 0000000..b15b45c --- /dev/null +++ b/ld/testsuite/ld-plugin/pr22220.h @@ -0,0 +1,8 @@ +extern int doo(); + +inline int *goo() { + static int xyz; + return &xyz; +} + +int *boo(); diff --git a/ld/testsuite/ld-plugin/pr22220lib.cc b/ld/testsuite/ld-plugin/pr22220lib.cc new file mode 100644 index 0000000..771f44f --- /dev/null +++ b/ld/testsuite/ld-plugin/pr22220lib.cc @@ -0,0 +1,6 @@ +#include "pr22220.h" + +int* boo() +{ + return goo (); +} diff --git a/ld/testsuite/ld-plugin/pr22220lib.ver b/ld/testsuite/ld-plugin/pr22220lib.ver new file mode 100644 index 0000000..6da7e1a --- /dev/null +++ b/ld/testsuite/ld-plugin/pr22220lib.ver @@ -0,0 +1 @@ +BAR { global: *; }; diff --git a/ld/testsuite/ld-plugin/pr22220main.cc b/ld/testsuite/ld-plugin/pr22220main.cc new file mode 100644 index 0000000..38c206f --- /dev/null +++ b/ld/testsuite/ld-plugin/pr22220main.cc @@ -0,0 +1,12 @@ +#include <stdio.h> +#include "pr22220.h" + +int main() +{ + if (boo() == goo()) + { + printf ("PASS\n"); + return 0; + } + return 1; +} |