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/dl5.cc | 13 | ||||
-rw-r--r-- | ld/testsuite/ld-elf/dl5.h | 10 | ||||
-rw-r--r-- | ld/testsuite/ld-elf/new.cc | 6 | ||||
-rw-r--r-- | ld/testsuite/ld-x86-64/x86-64.exp | 7 | ||||
-rw-r--r-- | libctf/ctf-create.c | 8 |
8 files changed, 105 insertions, 61 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 9adf589..156818e 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 20240705 +#define BFD_VERSION_DATE 20240723 #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/dl5.cc b/ld/testsuite/ld-elf/dl5.cc index cc40455..1cd33c0 100644 --- a/ld/testsuite/ld-elf/dl5.cc +++ b/ld/testsuite/ld-elf/dl5.cc @@ -1,6 +1,7 @@ #include <stdio.h> #include <stdlib.h> #include <new> +#include "dl5.h" int pass = 0; @@ -30,22 +31,14 @@ operator delete (void *ptr) throw () free (ptr); } -class A -{ -public: - A() {} - ~A() { } - int a; - int b; -}; - - int main (void) { A *bb = new A[10]; + foo (bb); delete [] bb; bb = new (std::nothrow) A [10]; + foo (bb); delete [] bb; if (pass == 4) diff --git a/ld/testsuite/ld-elf/dl5.h b/ld/testsuite/ld-elf/dl5.h new file mode 100644 index 0000000..0d4a7c1 --- /dev/null +++ b/ld/testsuite/ld-elf/dl5.h @@ -0,0 +1,10 @@ +class A +{ +public: + A() {} + ~A() { } + int a; + int b; +}; + +extern void foo (A *); diff --git a/ld/testsuite/ld-elf/new.cc b/ld/testsuite/ld-elf/new.cc index 513cf2f..b038d77 100644 --- a/ld/testsuite/ld-elf/new.cc +++ b/ld/testsuite/ld-elf/new.cc @@ -1,4 +1,5 @@ #include <new> +#include "dl5.h" using std::bad_alloc; @@ -45,3 +46,8 @@ operator new[] (std::size_t sz, const std::nothrow_t& nothrow) throw() { return ::operator new(sz, nothrow); } + +void +foo (A *) +{ +} 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" diff --git a/libctf/ctf-create.c b/libctf/ctf-create.c index d0255e5..2f332e0 100644 --- a/libctf/ctf-create.c +++ b/libctf/ctf-create.c @@ -284,11 +284,11 @@ ctf_dtd_delete (ctf_dict_t *fp, ctf_dtdef_t *dtd) dtd->dtd_vlen_alloc = 0; if (dtd->dtd_data.ctt_name - && (name = ctf_strraw (fp, dtd->dtd_data.ctt_name)) != NULL - && LCTF_INFO_ISROOT (fp, dtd->dtd_data.ctt_info)) + && (name = ctf_strraw (fp, dtd->dtd_data.ctt_name)) != NULL) { - ctf_dynhash_remove (ctf_name_table (fp, name_kind)->ctn_writable, - name); + if (LCTF_INFO_ISROOT (fp, dtd->dtd_data.ctt_info)) + ctf_dynhash_remove (ctf_name_table (fp, name_kind)->ctn_writable, + name); ctf_str_remove_ref (fp, name, &dtd->dtd_data.ctt_name); } |