diff options
-rw-r--r-- | bfd/elf32-hppa.c | 88 | ||||
-rw-r--r-- | bfd/elflink.c | 32 | ||||
-rw-r--r-- | bfd/version.h | 2 | ||||
-rw-r--r-- | ld/testsuite/ld-elf/dwarf.exp | 2 | ||||
-rw-r--r-- | ld/testsuite/ld-elf/shared.exp | 2 | ||||
-rw-r--r-- | ld/testsuite/ld-x86-64/x86-64.exp | 7 |
6 files changed, 84 insertions, 49 deletions
diff --git a/bfd/elf32-hppa.c b/bfd/elf32-hppa.c index 99ec789..c2a7ad9 100644 --- a/bfd/elf32-hppa.c +++ b/bfd/elf32-hppa.c @@ -3432,48 +3432,62 @@ final_link_relocate (asection *input_section, break; } - r_format = bfd_hppa_insn2fmt (input_bfd, insn); - switch (r_format) + switch (r_type) { - case 10: - case -10: - if (val & 7) - { - _bfd_error_handler - /* xgettext:c-format */ - (_("%pB(%pA+%#" PRIx64 "): displacement %#x for insn %#x " - "is not a multiple of 8 (gp %#x)"), - input_bfd, - input_section, - (uint64_t) offset, - val, - insn, - (unsigned int) elf_gp (input_section->output_section->owner)); - bfd_set_error (bfd_error_bad_value); - return bfd_reloc_notsupported; - } + case R_PARISC_DIR32: + case R_PARISC_SECREL32: + case R_PARISC_SEGBASE: + case R_PARISC_SEGREL32: + case R_PARISC_PLABEL32: + /* These relocations apply to data. */ + r_format = howto->bitsize; break; - case -11: - case -16: - if (val & 3) + default: + r_format = bfd_hppa_insn2fmt (input_bfd, insn); + switch (r_format) { - _bfd_error_handler - /* xgettext:c-format */ - (_("%pB(%pA+%#" PRIx64 "): displacement %#x for insn %#x " - "is not a multiple of 4 (gp %#x)"), - input_bfd, - input_section, - (uint64_t) offset, - val, - insn, - (unsigned int) elf_gp (input_section->output_section->owner)); - bfd_set_error (bfd_error_bad_value); - return bfd_reloc_notsupported; - } - break; + case 10: + case -10: + if (val & 7) + { + _bfd_error_handler + /* xgettext:c-format */ + (_("%pB(%pA+%#" PRIx64 "): displacement %#x for insn %#x " + "is not a multiple of 8 (gp %#x)"), + input_bfd, + input_section, + (uint64_t) offset, + val, + insn, + (unsigned int) elf_gp (input_section->output_section->owner)); + bfd_set_error (bfd_error_bad_value); + return bfd_reloc_notsupported; + } + break; - default: + case -11: + case -16: + if (val & 3) + { + _bfd_error_handler + /* xgettext:c-format */ + (_("%pB(%pA+%#" PRIx64 "): displacement %#x for insn %#x " + "is not a multiple of 4 (gp %#x)"), + input_bfd, + input_section, + (uint64_t) offset, + val, + insn, + (unsigned int) elf_gp (input_section->output_section->owner)); + bfd_set_error (bfd_error_bad_value); + return bfd_reloc_notsupported; + } + break; + + default: + break; + } break; } insn = hppa_rebuild_insn (insn, val, r_format); diff --git a/bfd/elflink.c b/bfd/elflink.c index c2494b3..0fd06d1 100644 --- a/bfd/elflink.c +++ b/bfd/elflink.c @@ -2206,16 +2206,19 @@ _bfd_elf_export_symbol (struct elf_link_hash_entry *h, void *data) /* Return the glibc version reference if VERSION_DEP is added to the list of glibc version dependencies successfully. VERSION_DEP will - be put into the .gnu.version_r section. */ + be put into the .gnu.version_r section. GLIBC_MINOR_BASE is the + pointer to the glibc minor base version. */ static Elf_Internal_Verneed * elf_link_add_glibc_verneed (struct elf_find_verdep_info *rinfo, Elf_Internal_Verneed *glibc_verref, - const char *version_dep) + const char *version_dep, + int *glibc_minor_base) { Elf_Internal_Verneed *t; Elf_Internal_Vernaux *a; size_t amt; + int minor_version = -1; if (glibc_verref != NULL) { @@ -2231,8 +2234,6 @@ elf_link_add_glibc_verneed (struct elf_find_verdep_info *rinfo, } else { - bool is_glibc; - for (t = elf_tdata (rinfo->info->output_bfd)->verref; t != NULL; t = t->vn_nextref) @@ -2246,7 +2247,6 @@ elf_link_add_glibc_verneed (struct elf_find_verdep_info *rinfo, if (t == NULL) return t; - is_glibc = false; for (a = t->vn_auxptr; a != NULL; a = a->vna_nextptr) { /* Return if VERSION_DEP dependency has been added. */ @@ -2255,12 +2255,24 @@ elf_link_add_glibc_verneed (struct elf_find_verdep_info *rinfo, return t; /* Check if libc.so provides GLIBC_2.XX version. */ - if (!is_glibc && startswith (a->vna_nodename, "GLIBC_2.")) - is_glibc = true; + if (startswith (a->vna_nodename, "GLIBC_2.")) + { + minor_version = strtol (a->vna_nodename + 8, NULL, 10); + if (minor_version < *glibc_minor_base) + *glibc_minor_base = minor_version; + } } /* Skip if it isn't linked against glibc. */ - if (!is_glibc) + if (minor_version < 0) + return NULL; + } + + /* Skip if 2.GLIBC_MINOR_BASE includes VERSION_DEP. */ + if (startswith (version_dep, "GLIBC_2.")) + { + minor_version = strtol (version_dep + 8, NULL, 10); + if (minor_version <= *glibc_minor_base) return NULL; } @@ -2292,10 +2304,12 @@ _bfd_elf_link_add_glibc_version_dependency const char *version_dep[]) { Elf_Internal_Verneed *t = NULL; + int glibc_minor_base = INT_MAX; do { - t = elf_link_add_glibc_verneed (rinfo, t, *version_dep); + t = elf_link_add_glibc_verneed (rinfo, t, *version_dep, + &glibc_minor_base); /* Return if there is no glibc version reference. */ if (t == NULL) return; diff --git a/bfd/version.h b/bfd/version.h index f807e57..9e9d0e1 100644 --- a/bfd/version.h +++ b/bfd/version.h @@ -16,7 +16,7 @@ In releases, the date is not included in either version strings or sonames. */ -#define BFD_VERSION_DATE 20240627 +#define BFD_VERSION_DATE 20240716 #define BFD_VERSION @bfd_version@ #define BFD_VERSION_STRING @bfd_version_package@ @bfd_version_string@ #define REPORT_BUGS_TO @report_bugs_to@ diff --git a/ld/testsuite/ld-elf/dwarf.exp b/ld/testsuite/ld-elf/dwarf.exp index 6a63269..670551f 100644 --- a/ld/testsuite/ld-elf/dwarf.exp +++ b/ld/testsuite/ld-elf/dwarf.exp @@ -50,7 +50,7 @@ set build_tests { "-s -shared" "-fPIC -g -feliminate-dwarf2-dups" {dwarf1.c} {} "libdwarf1.so"} {"DWARF parse during linker error" - "" "-fno-toplevel-reorder" + "" "-g -fno-toplevel-reorder" {dwarf2a.c dwarf2b.c} {{error_output "dwarf2.err"}} "dwarf2.x"} {"Handle no DWARF information" "" "-g0" diff --git a/ld/testsuite/ld-elf/shared.exp b/ld/testsuite/ld-elf/shared.exp index 277dc7b..d811738 100644 --- a/ld/testsuite/ld-elf/shared.exp +++ b/ld/testsuite/ld-elf/shared.exp @@ -552,7 +552,7 @@ set build_tests { "-shared" "-fPIC" {begin.c end.c} {} "libbar.so"} {"Build warn libbar.so" - "-shared" "-fPIC" + "-shared" "-fPIC -g" {beginwarn.c end.c} {{readelf {-S --wide} libbarw.rd} {warning {^.*beginwarn.c:7:\(.*\): warning: function foo is deprecated\n?$}}} diff --git a/ld/testsuite/ld-x86-64/x86-64.exp b/ld/testsuite/ld-x86-64/x86-64.exp index e370f39..2a40f0b 100644 --- a/ld/testsuite/ld-x86-64/x86-64.exp +++ b/ld/testsuite/ld-x86-64/x86-64.exp @@ -2250,6 +2250,13 @@ run_dump_test "ibt-plt-3a-x32" run_dump_test "ibt-plt-3b-x32" run_dump_test "ibt-plt-3c-x32" run_dump_test "ibt-plt-3d-x32" + +# Skip -z mark-plt tests on MUSL. +if { [istarget "x86_64-*-musl*"]} { + set ASFLAGS "$saved_ASFLAGS" + return +} + run_dump_test "mark-plt-1a" run_dump_test "mark-plt-1b" run_dump_test "mark-plt-1c" |