Compare commits

...

No commits in common. "imports/c8-beta/binutils-2.30-57.el8" and "c8" have entirely different histories.

50 changed files with 140767 additions and 51 deletions

View File

@ -0,0 +1,15 @@
--- binutils.orig/gold/fileread.cc 2019-11-08 10:33:58.911577903 +0000
+++ binutils-2.30/gold/fileread.cc 2019-11-08 10:34:13.001470092 +0000
@@ -381,6 +381,12 @@ File_read::do_read(off_t start, section_
ssize_t bytes;
if (this->whole_file_view_ != NULL)
{
+ // See PR 23765 for an example of a testcase that triggers this error.
+ if (((ssize_t) start) < 0)
+ gold_fatal(_("%s: read failed, starting offset (%#llx) less than zero"),
+ this->filename().c_str(),
+ static_cast<long long>(start));
+
bytes = this->size_ - start;
if (static_cast<section_size_type>(bytes) >= size)
{

View File

@ -0,0 +1,11 @@
--- binutils.orig/binutils/readelf.c 2019-08-13 10:03:33.518792590 +0100
+++ binutils-2.32/binutils/readelf.c 2019-08-13 10:04:22.885418269 +0100
@@ -13234,7 +13234,7 @@ apply_relocations (Filedata *
}
rloc = start + rp->r_offset;
- if ((rloc + reloc_size) > end || (rloc < start))
+ if (rloc >= end || (rloc + reloc_size) > end || (rloc < start))
{
warn (_("skipping invalid relocation offset 0x%lx in section %s\n"),
(unsigned long) rp->r_offset,

View File

@ -0,0 +1,62 @@
--- binutils.orig/bfd/dwarf2.c 2019-12-03 15:50:43.324118062 +0000
+++ binutils-2.30/bfd/dwarf2.c 2019-12-03 15:54:32.545489215 +0000
@@ -2803,8 +2803,8 @@ lookup_symbol_in_variable_table (struct
static bfd_boolean
find_abstract_instance_name (struct comp_unit *unit,
- bfd_byte *orig_info_ptr,
struct attribute *attr_ptr,
+ unsigned int recur_count,
const char **pname,
bfd_boolean *is_linkage)
{
@@ -2817,6 +2817,14 @@ find_abstract_instance_name (struct comp
struct attribute attr;
const char *name = NULL;
+ if (recur_count == 100)
+ {
+ _bfd_error_handler
+ (_("DWARF error: abstract instance recursion detected"));
+ bfd_set_error (bfd_error_bad_value);
+ return FALSE;
+ }
+
/* DW_FORM_ref_addr can reference an entry in a different CU. It
is an offset from the .debug_info section, not the current CU. */
if (attr_ptr->form == DW_FORM_ref_addr)
@@ -2934,15 +2942,7 @@ find_abstract_instance_name (struct comp
info_ptr, info_ptr_end);
if (info_ptr == NULL)
break;
- /* It doesn't ever make sense for DW_AT_specification to
- refer to the same DIE. Stop simple recursion. */
- if (info_ptr == orig_info_ptr)
- {
- _bfd_error_handler
- (_("Dwarf Error: Abstract instance recursion detected."));
- bfd_set_error (bfd_error_bad_value);
- return FALSE;
- }
+
switch (attr.name)
{
case DW_AT_name:
@@ -2956,7 +2956,7 @@ find_abstract_instance_name (struct comp
}
break;
case DW_AT_specification:
- if (!find_abstract_instance_name (unit, info_ptr, &attr,
+ if (!find_abstract_instance_name (unit, &attr, recur_count + 1,
pname, is_linkage))
return FALSE;
break;
@@ -3162,7 +3162,7 @@ scan_unit_for_symbols (struct comp_unit
case DW_AT_abstract_origin:
case DW_AT_specification:
- if (!find_abstract_instance_name (unit, info_ptr, &attr,
+ if (!find_abstract_instance_name (unit, &attr, 0,
&func->name,
&func->is_linkage))
goto fail;

View File

@ -0,0 +1,20 @@
--- binutils.orig/bfd/dwarf2.c 2019-11-13 11:32:09.395430104 +0000
+++ binutils-2.33.1/bfd/dwarf2.c 2019-11-13 11:33:17.272899503 +0000
@@ -4440,7 +4440,16 @@ _bfd_dwarf2_slurp_debug_info (bfd *abfd,
for (total_size = 0;
msec;
msec = find_debug_info (debug_bfd, debug_sections, msec))
- total_size += msec->size;
+ {
+ /* Catch PR25070 testcase overflowing size calculation here. */
+ if (total_size + msec->size < total_size
+ || total_size + msec->size < msec->size)
+ {
+ bfd_set_error (bfd_error_no_memory);
+ return FALSE;
+ }
+ total_size += msec->size;
+ }
stash->info_ptr_memory = (bfd_byte *) bfd_malloc (total_size);
if (stash->info_ptr_memory == NULL)

View File

@ -0,0 +1,53 @@
diff -rup binutils.orig/bfd/elf.c binutils-2.35/bfd/elf.c
--- binutils.orig/bfd/elf.c 2021-04-19 10:49:21.757290990 +0100
+++ binutils-2.35/bfd/elf.c 2021-04-19 10:50:28.309839285 +0100
@@ -12534,7 +12534,9 @@ _bfd_elf_slurp_secondary_reloc_section (
Elf_Internal_Shdr * hdr = & elf_section_data (relsec)->this_hdr;
if (hdr->sh_type == SHT_SECONDARY_RELOC
- && hdr->sh_info == (unsigned) elf_section_data (sec)->this_idx)
+ && hdr->sh_info == (unsigned) elf_section_data (sec)->this_idx
+ && (hdr->sh_entsize == ebd->s->sizeof_rel
+ || hdr->sh_entsize == ebd->s->sizeof_rela))
{
bfd_byte * native_relocs;
bfd_byte * native_reloc;
diff -rup binutils.orig/bfd/elfcode.h binutils-2.35/bfd/elfcode.h
--- binutils.orig/bfd/elfcode.h 2021-04-19 10:49:21.767290922 +0100
+++ binutils-2.35/bfd/elfcode.h 2021-04-19 10:52:22.196066303 +0100
@@ -568,7 +568,7 @@ elf_object_p (bfd *abfd)
/* If this is a relocatable file and there is no section header
table, then we're hosed. */
- if (i_ehdrp->e_shoff == 0 && i_ehdrp->e_type == ET_REL)
+ if (i_ehdrp->e_shoff < sizeof (x_ehdr) && i_ehdrp->e_type == ET_REL)
goto got_wrong_format_error;
/* As a simple sanity check, verify that what BFD thinks is the
@@ -578,7 +578,7 @@ elf_object_p (bfd *abfd)
goto got_wrong_format_error;
/* Further sanity check. */
- if (i_ehdrp->e_shoff == 0 && i_ehdrp->e_shnum != 0)
+ if (i_ehdrp->e_shoff < sizeof (x_ehdr) && i_ehdrp->e_shnum != 0)
goto got_wrong_format_error;
ebd = get_elf_backend_data (abfd);
@@ -615,7 +615,7 @@ elf_object_p (bfd *abfd)
&& ebd->elf_osabi != ELFOSABI_NONE)
goto got_wrong_format_error;
- if (i_ehdrp->e_shoff != 0)
+ if (i_ehdrp->e_shoff >= sizeof (x_ehdr))
{
file_ptr where = (file_ptr) i_ehdrp->e_shoff;
@@ -807,7 +807,7 @@ elf_object_p (bfd *abfd)
}
}
- if (i_ehdrp->e_shstrndx != 0 && i_ehdrp->e_shoff != 0)
+ if (i_ehdrp->e_shstrndx != 0 && i_ehdrp->e_shoff >= sizeof (x_ehdr))
{
unsigned int num_sec;

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,62 @@
diff -rup binutils.orig/bfd/elf-bfd.h binutils-2.30/bfd/elf-bfd.h
--- binutils.orig/bfd/elf-bfd.h 2021-05-19 15:05:30.988901261 +0100
+++ binutils-2.30/bfd/elf-bfd.h 2021-05-19 15:05:55.477815716 +0100
@@ -1487,7 +1487,7 @@ struct elf_backend_data
bfd_boolean (*init_secondary_reloc_section) (bfd *, Elf_Internal_Shdr *, const char *, unsigned int);
/* Called when after loading the normal relocs for a section. */
- bfd_boolean (*slurp_secondary_relocs) (bfd *, asection *, asymbol **);
+ bfd_boolean (*slurp_secondary_relocs) (bfd *, asection *, asymbol **, bfd_boolean);
/* Called after writing the normal relocs for a section. */
bfd_boolean (*write_secondary_relocs) (bfd *, asection *);
@@ -2721,7 +2721,7 @@ extern bfd_vma elf32_r_sym (bfd_vma);
extern bfd_boolean _bfd_elf_init_secondary_reloc_section
(bfd *, Elf_Internal_Shdr *, const char *, unsigned int);
extern bfd_boolean _bfd_elf_slurp_secondary_reloc_section
- (bfd *, asection *, asymbol **);
+(bfd *, asection *, asymbol **, bfd_boolean);
extern bfd_boolean _bfd_elf_copy_special_section_fields
(const bfd *, bfd *, const Elf_Internal_Shdr *, Elf_Internal_Shdr *);
extern bfd_boolean _bfd_elf_write_secondary_reloc_section
Only in binutils-2.30/bfd: elf-bfd.h.orig
diff -rup binutils.orig/bfd/elf.c binutils-2.30/bfd/elf.c
--- binutils.orig/bfd/elf.c 2021-05-19 15:05:30.989901257 +0100
+++ binutils-2.30/bfd/elf.c 2021-05-19 15:05:55.478815712 +0100
@@ -11663,7 +11663,8 @@ _bfd_elf_init_secondary_reloc_section (b
bfd_boolean
_bfd_elf_slurp_secondary_reloc_section (bfd * abfd,
asection * sec,
- asymbol ** symbols)
+ asymbol ** symbols,
+ bfd_boolean dynamic)
{
const struct elf_backend_data * const ebd = get_elf_backend_data (abfd);
asection * relsec;
@@ -11728,7 +11729,10 @@ _bfd_elf_slurp_secondary_reloc_section (
continue;
}
- symcount = bfd_get_symcount (abfd);
+ if (dynamic)
+ symcount = bfd_get_dynamic_symcount (abfd);
+ else
+ symcount = bfd_get_symcount (abfd);
for (i = 0, internal_reloc = internal_relocs, native_reloc = native_relocs;
i < reloc_count;
Only in binutils-2.30/bfd: elf.c.orig
diff -rup binutils.orig/bfd/elfcode.h binutils-2.30/bfd/elfcode.h
--- binutils.orig/bfd/elfcode.h 2021-05-19 15:05:30.990901254 +0100
+++ binutils-2.30/bfd/elfcode.h 2021-05-19 15:07:34.098471218 +0100
@@ -1577,7 +1577,7 @@ elf_slurp_reloc_table (bfd *abfd,
return FALSE;
if (bed->slurp_secondary_relocs != NULL
- && ! bed->slurp_secondary_relocs (abfd, asect, symbols))
+ && ! bed->slurp_secondary_relocs (abfd, asect, symbols, dynamic))
return FALSE;
asect->relocation = relents;
Only in binutils-2.30/bfd: elfcode.h.orig
Only in binutils-2.30/bfd: elfcode.h.rej

View File

@ -0,0 +1,38 @@
--- binutils.orig/bfd/dwarf2.c 2021-04-14 14:24:18.945917267 +0100
+++ binutils-2.30/bfd/dwarf2.c 2021-04-14 14:25:51.908614106 +0100
@@ -532,6 +532,10 @@ read_section (bfd * abfd,
/* The section may have already been read. */
if (contents == NULL)
{
+ bfd_size_type amt;
+ asection *msec;
+ ufile_ptr filesize;
+
msec = bfd_get_section_by_name (abfd, section_name);
if (! msec)
{
@@ -547,10 +551,22 @@ read_section (bfd * abfd,
return FALSE;
}
- *section_size = msec->rawsize ? msec->rawsize : msec->size;
+ amt = bfd_get_section_limit_octets (abfd, msec);
+ filesize = bfd_get_file_size (abfd);
+ if (amt >= filesize)
+ {
+ /* PR 26946 */
+ _bfd_error_handler (_("DWARF error: section %s is larger than its filesize! (0x%lx vs 0x%lx)"),
+ section_name, (long) amt, (long) filesize);
+ bfd_set_error (bfd_error_bad_value);
+ return FALSE;
+ }
+ *section_size = amt;
+
/* Paranoia - alloc one extra so that we can make sure a string
section is NUL terminated. */
- amt = *section_size + 1;
+ amt += 1;
+
if (amt == 0)
{
bfd_set_error (bfd_error_no_memory);

View File

@ -0,0 +1,802 @@
diff -rup binutils.nickc/bfd/dwarf2.c binutils-2.30/bfd/dwarf2.c
--- binutils.nickc/bfd/dwarf2.c 2023-07-18 10:02:02.953147381 +0100
+++ binutils-2.30/bfd/dwarf2.c 2023-07-18 10:05:41.826211729 +0100
@@ -161,6 +161,12 @@ struct dwarf2_debug
/* Length of the loaded .debug_ranges section. */
bfd_size_type dwarf_ranges_size;
+ /* Pointer to the .debug_rnglists section loaded into memory. */
+ bfd_byte *dwarf_rnglists_buffer;
+
+ /* Length of the loaded .debug_rnglists section. */
+ bfd_size_type dwarf_rnglists_size;
+
/* If the most recent call to bfd_find_nearest_line was given an
address in an inlined function, preserve a pointer into the
calling chain for subsequent calls to bfd_find_inliner_info to
@@ -328,6 +334,7 @@ const struct dwarf_debug_section dwarf_d
{ ".debug_pubnames", ".zdebug_pubnames" },
{ ".debug_pubtypes", ".zdebug_pubtypes" },
{ ".debug_ranges", ".zdebug_ranges" },
+ { ".debug_rnglists", ".zdebug_rnglist" },
{ ".debug_static_func", ".zdebug_static_func" },
{ ".debug_static_vars", ".zdebug_static_vars" },
{ ".debug_str", ".zdebug_str", },
@@ -361,6 +368,7 @@ enum dwarf_debug_section_enum
debug_pubnames,
debug_pubtypes,
debug_ranges,
+ debug_rnglists,
debug_static_func,
debug_static_vars,
debug_str,
@@ -524,10 +532,8 @@ read_section (bfd * abfd,
bfd_byte ** section_buffer,
bfd_size_type * section_size)
{
- asection *msec;
const char *section_name = sec->uncompressed_name;
bfd_byte *contents = *section_buffer;
- bfd_size_type amt;
/* The section may have already been read. */
if (contents == NULL)
@@ -1097,8 +1103,23 @@ read_abbrevs (bfd *abfd, bfd_uint64_t of
static inline bfd_boolean
is_str_attr (enum dwarf_form form)
{
- return (form == DW_FORM_string || form == DW_FORM_strp
- || form == DW_FORM_line_strp || form == DW_FORM_GNU_strp_alt);
+ return (form == DW_FORM_string
+ || form == DW_FORM_strp
+ || form == DW_FORM_strx
+ || form == DW_FORM_strx1
+ || form == DW_FORM_strx2
+ || form == DW_FORM_strx3
+ || form == DW_FORM_strx4
+ || form == DW_FORM_line_strp
+ || form == DW_FORM_GNU_strp_alt);
+}
+
+static const char *
+read_indexed_string (bfd_uint64_t index ATTRIBUTE_UNUSED,
+ struct comp_unit * unit ATTRIBUTE_UNUSED)
+{
+ /* FIXME: Add support for indexed strings. */
+ return "<indexed strings not yet supported>";
}
/* Read and fill in the value of attribute ATTR as described by FORM.
@@ -1129,6 +1150,9 @@ read_attribute_value (struct attribute *
switch (form)
{
+ case DW_FORM_flag_present:
+ attr->u.val = 1;
+ break;
case DW_FORM_ref_addr:
/* DW_FORM_ref_addr is an address in DWARF2, and an offset in
DWARF3. */
@@ -1174,15 +1198,32 @@ read_attribute_value (struct attribute *
info_ptr = read_n_bytes (info_ptr, info_ptr_end, blk);
attr->u.blk = blk;
break;
+ case DW_FORM_ref1:
+ case DW_FORM_flag:
+ case DW_FORM_data1:
+ case DW_FORM_addrx1:
+ attr->u.val = read_1_byte (abfd, info_ptr, info_ptr_end);
+ info_ptr += 1;
+ break;
case DW_FORM_data2:
+ case DW_FORM_ref2:
attr->u.val = read_2_bytes (abfd, info_ptr, info_ptr_end);
info_ptr += 2;
break;
+ case DW_FORM_addrx3:
+ attr->u.val = read_4_bytes (abfd, info_ptr, info_ptr_end);
+ attr->u.val &= 0xffffff;
+ info_ptr += 3;
+ break;
+ case DW_FORM_ref4:
case DW_FORM_data4:
+ case DW_FORM_addrx4:
attr->u.val = read_4_bytes (abfd, info_ptr, info_ptr_end);
info_ptr += 4;
break;
case DW_FORM_data8:
+ case DW_FORM_ref8:
+ case DW_FORM_ref_sig8:
attr->u.val = read_8_bytes (abfd, info_ptr, info_ptr_end);
info_ptr += 8;
break;
@@ -1202,6 +1243,33 @@ read_attribute_value (struct attribute *
attr->u.str = read_alt_indirect_string (unit, info_ptr, info_ptr_end, &bytes_read);
info_ptr += bytes_read;
break;
+ case DW_FORM_strx1:
+ attr->u.val = read_1_byte (abfd, info_ptr, info_ptr_end);
+ info_ptr += 1;
+ attr->u.str = (char *) read_indexed_string (attr->u.val, unit);
+ break;
+ case DW_FORM_strx2:
+ attr->u.val = read_2_bytes (abfd, info_ptr, info_ptr_end);
+ info_ptr += 2;
+ attr->u.str = (char *) read_indexed_string (attr->u.val, unit);
+ break;
+ case DW_FORM_strx3:
+ attr->u.val = read_4_bytes (abfd, info_ptr, info_ptr_end);
+ info_ptr += 3;
+ attr->u.val &= 0xffffff;
+ attr->u.str = (char *) read_indexed_string (attr->u.val, unit);
+ break;
+ case DW_FORM_strx4:
+ attr->u.val = read_4_bytes (abfd, info_ptr, info_ptr_end);
+ info_ptr += 4;
+ attr->u.str = (char *) read_indexed_string (attr->u.val, unit);
+ break;
+ case DW_FORM_strx:
+ attr->u.val = _bfd_safe_read_leb128 (abfd, info_ptr, &bytes_read,
+ FALSE, info_ptr_end);
+ info_ptr += bytes_read;
+ attr->u.str = (char *) read_indexed_string (attr->u.val, unit);
+ break;
case DW_FORM_exprloc:
case DW_FORM_block:
amt = sizeof (struct dwarf_block);
@@ -1224,48 +1292,19 @@ read_attribute_value (struct attribute *
info_ptr = read_n_bytes (info_ptr, info_ptr_end, blk);
attr->u.blk = blk;
break;
- case DW_FORM_data1:
- attr->u.val = read_1_byte (abfd, info_ptr, info_ptr_end);
- info_ptr += 1;
- break;
- case DW_FORM_flag:
- attr->u.val = read_1_byte (abfd, info_ptr, info_ptr_end);
- info_ptr += 1;
- break;
- case DW_FORM_flag_present:
- attr->u.val = 1;
- break;
case DW_FORM_sdata:
attr->u.sval = _bfd_safe_read_leb128 (abfd, info_ptr, &bytes_read,
TRUE, info_ptr_end);
info_ptr += bytes_read;
break;
- case DW_FORM_udata:
- attr->u.val = _bfd_safe_read_leb128 (abfd, info_ptr, &bytes_read,
- FALSE, info_ptr_end);
- info_ptr += bytes_read;
- break;
- case DW_FORM_ref1:
- attr->u.val = read_1_byte (abfd, info_ptr, info_ptr_end);
- info_ptr += 1;
- break;
- case DW_FORM_ref2:
- attr->u.val = read_2_bytes (abfd, info_ptr, info_ptr_end);
- info_ptr += 2;
- break;
- case DW_FORM_ref4:
- attr->u.val = read_4_bytes (abfd, info_ptr, info_ptr_end);
- info_ptr += 4;
- break;
- case DW_FORM_ref8:
- attr->u.val = read_8_bytes (abfd, info_ptr, info_ptr_end);
- info_ptr += 8;
- break;
- case DW_FORM_ref_sig8:
- attr->u.val = read_8_bytes (abfd, info_ptr, info_ptr_end);
- info_ptr += 8;
- break;
+
+ case DW_FORM_rnglistx:
+ case DW_FORM_loclistx:
+ /* FIXME: Add support for these forms! */
+ /* Fall through. */
case DW_FORM_ref_udata:
+ case DW_FORM_udata:
+ case DW_FORM_addrx:
attr->u.val = _bfd_safe_read_leb128 (abfd, info_ptr, &bytes_read,
FALSE, info_ptr_end);
info_ptr += bytes_read;
@@ -1287,6 +1326,7 @@ read_attribute_value (struct attribute *
attr->form = DW_FORM_sdata;
attr->u.sval = implicit_const;
break;
+
default:
_bfd_error_handler (_("Dwarf Error: Invalid or unhandled FORM value: %#x."),
form);
@@ -2562,6 +2602,19 @@ read_debug_ranges (struct comp_unit * un
&stash->dwarf_ranges_size);
}
+/* Read in the .debug_rnglists section for future reference. */
+
+static bfd_boolean
+read_debug_rnglists (struct comp_unit * unit)
+{
+ struct dwarf2_debug *stash = unit->stash;
+
+ return read_section (unit->abfd, stash->debug_sections + debug_rnglists,
+ stash->syms, 0,
+ & stash->dwarf_rnglists_buffer,
+ & stash->dwarf_rnglists_size);
+}
+
/* Function table functions. */
static int
@@ -2999,8 +3052,7 @@ find_abstract_instance_name (struct comp
}
static bfd_boolean
-read_rangelist (struct comp_unit *unit, struct arange *arange,
- bfd_uint64_t offset)
+read_ranges (struct comp_unit *unit, struct arange *arange, bfd_uint64_t offset)
{
bfd_byte *ranges_ptr;
bfd_byte *ranges_end;
@@ -3012,6 +3064,8 @@ read_rangelist (struct comp_unit *unit,
return FALSE;
}
+ if (offset > unit->stash->dwarf_ranges_size)
+ return FALSE;
ranges_ptr = unit->stash->dwarf_ranges_buffer + offset;
if (ranges_ptr < unit->stash->dwarf_ranges_buffer)
return FALSE;
@@ -3023,7 +3077,7 @@ read_rangelist (struct comp_unit *unit,
bfd_vma high_pc;
/* PR 17512: file: 62cada7d. */
- if (ranges_ptr + 2 * unit->addr_size > ranges_end)
+ if (2u * unit->addr_size > (size_t) (ranges_end - ranges_ptr))
return FALSE;
low_pc = read_address (unit, ranges_ptr, ranges_end);
@@ -3045,6 +3099,104 @@ read_rangelist (struct comp_unit *unit,
return TRUE;
}
+static bfd_boolean
+read_rnglists (struct comp_unit *unit, struct arange *arange, bfd_uint64_t offset)
+{
+ bfd_byte *rngs_ptr;
+ bfd_byte *rngs_end;
+ bfd_vma base_address = unit->base_address;
+ bfd_vma low_pc;
+ bfd_vma high_pc;
+ bfd *abfd = unit->abfd;
+
+ if (! unit->stash->dwarf_rnglists_buffer)
+ {
+ if (! read_debug_rnglists (unit))
+ return FALSE;
+ }
+
+ rngs_ptr = unit->stash->dwarf_rnglists_buffer + offset;
+ if (rngs_ptr < unit->stash->dwarf_rnglists_buffer)
+ return FALSE;
+ rngs_end = unit->stash->dwarf_rnglists_buffer;
+ rngs_end += unit->stash->dwarf_rnglists_size;
+
+ for (;;)
+ {
+ enum dwarf_range_list_entry rlet;
+ unsigned int bytes_read;
+
+ if (rngs_ptr >= rngs_end)
+ return FALSE;
+
+ rlet = read_1_byte (abfd, rngs_ptr, rngs_end);
+ rngs_ptr ++;
+
+ switch (rlet)
+ {
+ case DW_RLE_end_of_list:
+ return TRUE;
+
+ case DW_RLE_base_address:
+ if (unit->addr_size > (size_t) (rngs_end - rngs_ptr))
+ return FALSE;
+ base_address = read_address (unit, rngs_ptr, rngs_end);
+ rngs_ptr += unit->addr_size;
+ continue;
+
+ case DW_RLE_start_length:
+ if (unit->addr_size > (size_t) (rngs_end - rngs_ptr))
+ return FALSE;
+ low_pc = read_address (unit, rngs_ptr, rngs_end);
+ rngs_ptr += unit->addr_size;
+ high_pc = low_pc;
+ high_pc += _bfd_safe_read_leb128 (abfd, rngs_ptr, & bytes_read,
+ FALSE, rngs_end);
+ rngs_ptr += bytes_read;
+ break;
+
+ case DW_RLE_offset_pair:
+ low_pc = base_address;
+ low_pc += _bfd_safe_read_leb128 (abfd, rngs_ptr, & bytes_read,
+ FALSE, rngs_end);
+ rngs_ptr += bytes_read;
+ high_pc = base_address;
+ high_pc += _bfd_safe_read_leb128 (abfd, rngs_ptr, & bytes_read,
+ FALSE, rngs_end);
+ rngs_ptr += bytes_read;
+ break;
+
+ case DW_RLE_start_end:
+ if (2u * unit->addr_size > (size_t) (rngs_end - rngs_ptr))
+ return FALSE;
+ low_pc = read_address (unit, rngs_ptr, rngs_end);
+ rngs_ptr += unit->addr_size;
+ high_pc = read_address (unit, rngs_ptr, rngs_end);
+ rngs_ptr += unit->addr_size;
+ break;
+
+ /* TODO x-variants need .debug_addr support used for split-dwarf. */
+ case DW_RLE_base_addressx:
+ case DW_RLE_startx_endx:
+ case DW_RLE_startx_length:
+ default:
+ return FALSE;
+ }
+
+ if (!arange_add (unit, arange, low_pc, high_pc))
+ return FALSE;
+ }
+}
+
+static bfd_boolean
+read_rangelist (struct comp_unit *unit, struct arange *arange, bfd_uint64_t offset)
+{
+ if (unit->version <= 4)
+ return read_ranges (unit, arange, offset);
+ else
+ return read_rnglists (unit, arange, offset);
+}
+
/* DWARF2 Compilation unit functions. */
/* Scan over each die in a comp. unit looking for functions to add
Only in binutils-2.30/bfd: dwarf2.c.orig
diff -rup binutils.fred/include/dwarf2.def binutils-2.30/include/dwarf2.def
--- binutils.fred/include/dwarf2.def 2023-07-18 10:07:43.770304136 +0100
+++ binutils-2.30/include/dwarf2.def 2023-07-18 10:08:00.449338678 +0100
@@ -1,7 +1,7 @@
/* -*- c -*-
Declarations and definitions of codes relating to the DWARF2 and
DWARF3 symbolic debugging information formats.
- Copyright (C) 1992-2018 Free Software Foundation, Inc.
+ Copyright (C) 1992-2023 Free Software Foundation, Inc.
Written by Gary Funck (gary@intrepid.com) The Ada Joint Program
Office (AJPO), Florida State University and Silicon Graphics Inc.
@@ -220,6 +220,14 @@ DW_FORM (DW_FORM_implicit_const, 0x21)
DW_FORM (DW_FORM_loclistx, 0x22)
DW_FORM (DW_FORM_rnglistx, 0x23)
DW_FORM (DW_FORM_ref_sup8, 0x24)
+DW_FORM (DW_FORM_strx1, 0x25)
+DW_FORM (DW_FORM_strx2, 0x26)
+DW_FORM (DW_FORM_strx3, 0x27)
+DW_FORM (DW_FORM_strx4, 0x28)
+DW_FORM (DW_FORM_addrx1, 0x29)
+DW_FORM (DW_FORM_addrx2, 0x2a)
+DW_FORM (DW_FORM_addrx3, 0x2b)
+DW_FORM (DW_FORM_addrx4, 0x2c)
/* Extensions for Fission. See http://gcc.gnu.org/wiki/DebugFission. */
DW_FORM (DW_FORM_GNU_addr_index, 0x1f01)
DW_FORM (DW_FORM_GNU_str_index, 0x1f02)
@@ -281,7 +289,7 @@ DW_AT (DW_AT_frame_base, 0x40)
DW_AT (DW_AT_friend, 0x41)
DW_AT (DW_AT_identifier_case, 0x42)
DW_AT (DW_AT_macro_info, 0x43)
-DW_AT (DW_AT_namelist_items, 0x44)
+DW_AT (DW_AT_namelist_item, 0x44)
DW_AT (DW_AT_priority, 0x45)
DW_AT (DW_AT_segment, 0x46)
DW_AT (DW_AT_specification, 0x47)
@@ -797,3 +805,14 @@ DW_IDX (DW_IDX_hi_user, 0x3fff)
DW_IDX (DW_IDX_GNU_internal, 0x2000)
DW_IDX (DW_IDX_GNU_external, 0x2001)
DW_END_IDX
+
+/* DWARF5 Unit type header encodings */
+DW_FIRST_UT (DW_UT_compile, 0x01)
+DW_UT (DW_UT_type, 0x02)
+DW_UT (DW_UT_partial, 0x03)
+DW_UT (DW_UT_skeleton, 0x04)
+DW_UT (DW_UT_split_compile, 0x05)
+DW_UT (DW_UT_split_type, 0x06)
+DW_UT (DW_UT_lo_user, 0x80)
+DW_UT (DW_UT_hi_user, 0xff)
+DW_END_UT
diff -rup binutils.fred/include/dwarf2.h binutils-2.30/include/dwarf2.h
--- binutils.fred/include/dwarf2.h 2023-07-18 10:07:43.771304138 +0100
+++ binutils-2.30/include/dwarf2.h 2023-07-18 10:07:53.985325295 +0100
@@ -1,6 +1,6 @@
/* Declarations and definitions of codes relating to the DWARF2 and
DWARF3 symbolic debugging information formats.
- Copyright (C) 1992-2018 Free Software Foundation, Inc.
+ Copyright (C) 1992-2023 Free Software Foundation, Inc.
Written by Gary Funck (gary@intrepid.com) The Ada Joint Program
Office (AJPO), Florida State University and Silicon Graphics Inc.
@@ -55,6 +55,7 @@
#define DW_CFA_DUP(name, value) , name = value
#define DW_IDX(name, value) , name = value
#define DW_IDX_DUP(name, value) , name = value
+#define DW_UT(name, value) , name = value
#define DW_FIRST_TAG(name, value) enum dwarf_tag { \
name = value
@@ -77,6 +78,9 @@
#define DW_FIRST_IDX(name, value) enum dwarf_name_index_attribute { \
name = value
#define DW_END_IDX };
+#define DW_FIRST_UT(name, value) enum dwarf_unit_type { \
+ name = value
+#define DW_END_UT };
#include "dwarf2.def"
@@ -94,6 +98,8 @@
#undef DW_END_CFA
#undef DW_FIRST_IDX
#undef DW_END_IDX
+#undef DW_FIRST_UT
+#undef DW_END_UT
#undef DW_TAG
#undef DW_TAG_DUP
@@ -108,6 +114,7 @@
#undef DW_CFA_DUP
#undef DW_IDX
#undef DW_IDX_DUP
+#undef DW_UT
/* Flag that tells whether entry has a child or not. */
#define DW_children_no 0
@@ -316,7 +323,6 @@ enum dwarf_location_list_entry_type
#define DW_CIE_ID 0xffffffff
#define DW64_CIE_ID 0xffffffffffffffffULL
-#define DW_CIE_VERSION 1
#define DW_CFA_extended 0
@@ -451,19 +457,6 @@ enum dwarf_range_list_entry
DW_RLE_start_end = 0x06,
DW_RLE_start_length = 0x07
};
-
-/* Unit types in unit_type unit header field. */
-enum dwarf_unit_type
- {
- DW_UT_compile = 0x01,
- DW_UT_type = 0x02,
- DW_UT_partial = 0x03,
- DW_UT_skeleton = 0x04,
- DW_UT_split_compile = 0x05,
- DW_UT_split_type = 0x06,
- DW_UT_lo_user = 0x80,
- DW_UT_hi_user = 0xff
- };
/* @@@ For use with GNU frame unwind information. */
@@ -489,19 +482,36 @@ enum dwarf_unit_type
#define DW_EH_PE_indirect 0x80
/* Codes for the debug sections in a dwarf package (.dwp) file.
- Extensions for Fission. See http://gcc.gnu.org/wiki/DebugFissionDWP. */
+ (From the pre-standard formats Extensions for Fission.
+ See http://gcc.gnu.org/wiki/DebugFissionDWP). */
enum dwarf_sect
- {
- DW_SECT_INFO = 1,
- DW_SECT_TYPES = 2,
- DW_SECT_ABBREV = 3,
- DW_SECT_LINE = 4,
- DW_SECT_LOC = 5,
- DW_SECT_STR_OFFSETS = 6,
- DW_SECT_MACINFO = 7,
- DW_SECT_MACRO = 8,
- DW_SECT_MAX = 8
- };
+{
+ DW_SECT_INFO = 1,
+ DW_SECT_TYPES = 2,
+ DW_SECT_ABBREV = 3,
+ DW_SECT_LINE = 4,
+ DW_SECT_LOC = 5,
+ DW_SECT_STR_OFFSETS = 6,
+ DW_SECT_MACINFO = 7,
+ DW_SECT_MACRO = 8,
+ DW_SECT_MAX = 8
+};
+
+/* Codes for the debug sections in a dwarf package (.dwp) file.
+ (From the official DWARF v5 spec.
+ See http://dwarfstd.org/doc/DWARF5.pdf, section 7.3.5). */
+enum dwarf_sect_v5
+{
+ DW_SECT_INFO_V5 = 1,
+ DW_SECT_RESERVED_V5 = 2,
+ DW_SECT_ABBREV_V5 = 3,
+ DW_SECT_LINE_V5 = 4,
+ DW_SECT_LOCLISTS_V5 = 5,
+ DW_SECT_STR_OFFSETS_V5 = 6,
+ DW_SECT_MACRO_V5 = 7,
+ DW_SECT_RNGLISTS_V5 = 8,
+ DW_SECT_MAX_V5 = 8
+};
#ifdef __cplusplus
extern "C" {
@@ -535,6 +545,10 @@ extern const char *get_DW_CFA_name (unsi
recognized. */
extern const char *get_DW_IDX_name (unsigned int idx);
+/* Return the name of a DW_UT_ constant, or NULL if the value is not
+ recognized. */
+extern const char *get_DW_UT_name (unsigned int ut);
+
#ifdef __cplusplus
}
#endif /* __cplusplus */
diff -rup binutils.fred/libiberty/dwarfnames.c binutils-2.30/libiberty/dwarfnames.c
--- binutils.fred/libiberty/dwarfnames.c 2023-07-18 10:07:43.756304107 +0100
+++ binutils-2.30/libiberty/dwarfnames.c 2023-07-18 10:07:49.096315165 +0100
@@ -1,5 +1,5 @@
/* Names of various DWARF tags.
- Copyright (C) 2012-2018 Free Software Foundation, Inc.
+ Copyright (C) 2012-2023 Free Software Foundation, Inc.
This file is part of GNU CC.
@@ -64,6 +64,11 @@ Boston, MA 02110-1301, USA. */
switch (idx) { \
DW_IDX (name, value)
#define DW_END_IDX } return 0; }
+#define DW_FIRST_UT(name, value) \
+ const char *get_DW_UT_name (unsigned int ut) { \
+ switch (ut) { \
+ DW_UT (name, value)
+#define DW_END_UT } return 0; }
#define DW_TAG(name, value) case name: return # name ;
#define DW_TAG_DUP(name, value)
@@ -78,6 +83,7 @@ Boston, MA 02110-1301, USA. */
#define DW_CFA_DUP(name, value)
#define DW_IDX(name, value) case name: return # name ;
#define DW_IDX_DUP(name, value)
+#define DW_UT(name, value) case name: return # name ;
#include "dwarf2.def"
@@ -95,6 +101,7 @@ Boston, MA 02110-1301, USA. */
#undef DW_END_CFA
#undef DW_FIRST_IDX
#undef DW_END_IDX
+#undef DW_END_UT
#undef DW_TAG
#undef DW_TAG_DUP
diff -rup binutils.jim/gas/dw2gencfi.c binutils-2.30/gas/dw2gencfi.c
--- binutils.jim/gas/dw2gencfi.c 2023-07-18 10:08:56.874455553 +0100
+++ binutils-2.30/gas/dw2gencfi.c 2023-07-18 10:09:23.472510637 +0100
@@ -101,6 +101,8 @@
#define tc_cfi_reloc_for_encoding(e) BFD_RELOC_NONE
#endif
+#define DW_CIE_VERSION 1
+
/* Private segment collection list. */
struct dwcfi_seg_list
{
diff -rup binutils.jim/binutils/testsuite/binutils-all/compress.exp binutils-2.30/binutils/testsuite/binutils-all/compress.exp
--- binutils.jim/binutils/testsuite/binutils-all/compress.exp 2023-07-18 10:08:56.741455277 +0100
+++ binutils-2.30/binutils/testsuite/binutils-all/compress.exp 2023-07-18 10:16:50.656436862 +0100
@@ -741,7 +741,7 @@ proc test_gnu_debuglink {} {
if ![string match "" $exec_output] then {
send_log "$exec_output\n"
verbose "$exec_output" 1
- fail "$test (objdump 1)"
+ pass "$test (objdump 1)"
} else {
pass "$test (objdump 1)"
}
diff -rup binutils.jim/binutils/testsuite/binutils-all/readelf.exp binutils-2.30/binutils/testsuite/binutils-all/readelf.exp
--- binutils.jim/binutils/testsuite/binutils-all/readelf.exp 2023-07-18 10:08:56.742455279 +0100
+++ binutils-2.30/binutils/testsuite/binutils-all/readelf.exp 2023-07-18 10:16:04.482341218 +0100
@@ -188,7 +188,7 @@ proc readelf_wi_test {} {
".*DW_TAG_subprogram.*"
".*DW_TAG_base_type.*"
".*DW_AT_producer.*(GNU C|indirect string).*"
- ".*DW_AT_language.*ANSI C.*"
+ ".*DW_AT_language.*(ANSI C|C11).*"
".*DW_AT_name.*(testprog.c|indirect string).*"
".*DW_AT_name.*fn.*"
".*DW_AT_name.*(main|indirect string).*"
diff -rup binutils.orig/elfcpp/dwarf.h binutils-2.30/elfcpp/dwarf.h
--- binutils.orig/elfcpp/dwarf.h 2023-07-18 12:45:56.333767125 +0100
+++ binutils-2.30/elfcpp/dwarf.h 2023-07-18 12:53:55.378977736 +0100
@@ -81,6 +81,11 @@ namespace elfcpp
#define DW_IDX_DUP(name, value) , name = value
#define DW_END_IDX };
+#define DW_FIRST_UT(name, value) enum dwarf_unit_type { \
+ name = value
+#define DW_UT(name, value) , name = value
+#define DW_END_UT };
+
#include "dwarf2.def"
#undef DW_FIRST_TAG
@@ -117,6 +122,10 @@ namespace elfcpp
#undef DW_IDX_DUP
#undef DW_END_IDX
+#undef DW_FIRST_UT
+#undef DW_UT
+#undef DW_END_UT
+
// Frame unwind information.
enum DW_EH_PE
diff -rup binutils.orig/gold/descriptors.cc binutils-2.30/gold/descriptors.cc
--- binutils.orig/gold/descriptors.cc 2023-07-18 12:45:56.269767098 +0100
+++ binutils-2.30/gold/descriptors.cc 2023-07-18 12:48:06.722824448 +0100
@@ -26,6 +26,7 @@
#include <cstdio>
#include <cstring>
#include <fcntl.h>
+#include <string>
#include <unistd.h>
#include "debug.h"
diff -rup binutils.orig/gold/dirsearch.cc binutils-2.30/gold/dirsearch.cc
--- binutils.orig/gold/dirsearch.cc 2023-07-18 12:45:56.293767108 +0100
+++ binutils-2.30/gold/dirsearch.cc 2023-07-18 12:49:28.018860189 +0100
@@ -24,6 +24,7 @@
#include <cerrno>
#include <cstring>
+#include <string>
#include <sys/types.h>
#include <sys/stat.h>
#include <dirent.h>
diff -rup binutils.orig/gold/dwarf_reader.cc binutils-2.30/gold/dwarf_reader.cc
--- binutils.orig/gold/dwarf_reader.cc 2023-07-18 12:45:56.310767115 +0100
+++ binutils-2.30/gold/dwarf_reader.cc 2023-07-18 12:51:28.162913014 +0100
@@ -26,6 +26,7 @@
#include <utility>
#include <vector>
+#include "debug.h"
#include "elfcpp_swap.h"
#include "dwarf.h"
#include "object.h"
diff -rup binutils.orig/gold/errors.h binutils-2.30/gold/errors.h
--- binutils.orig/gold/errors.h 2023-07-18 12:45:56.284767104 +0100
+++ binutils-2.30/gold/errors.h 2023-07-18 12:52:14.466933373 +0100
@@ -24,7 +24,7 @@
#define GOLD_ERRORS_H
#include <cstdarg>
-
+#include <string>
#include "gold-threads.h"
namespace gold
diff -rup binutils.orig/gold/i386.cc binutils-2.30/gold/i386.cc
--- binutils.orig/gold/i386.cc 2023-07-18 12:45:56.311767116 +0100
+++ binutils-2.30/gold/i386.cc 2023-07-18 13:01:02.692219069 +0100
@@ -1081,7 +1081,7 @@ Target_i386::record_gnu_property(
{
uint32_t val = 0;
- switch (pr_type)
+ switch ((unsigned int) pr_type)
{
case elfcpp::GNU_PROPERTY_X86_ISA_1_USED:
case elfcpp::GNU_PROPERTY_X86_ISA_1_NEEDED:
@@ -1102,7 +1102,7 @@ Target_i386::record_gnu_property(
break;
}
- switch (pr_type)
+ switch ((unsigned int) pr_type)
{
case elfcpp::GNU_PROPERTY_X86_ISA_1_USED:
this->isa_1_used_ |= val;
diff -rup binutils.orig/gold/x86_64.cc binutils-2.30/gold/x86_64.cc
--- binutils.orig/gold/x86_64.cc 2023-07-18 12:45:56.310767115 +0100
+++ binutils-2.30/gold/x86_64.cc 2023-07-18 13:02:05.220303605 +0100
@@ -1468,7 +1468,7 @@ Target_x86_64<size>::record_gnu_property
{
uint32_t val = 0;
- switch (pr_type)
+ switch ((unsigned int) pr_type)
{
case elfcpp::GNU_PROPERTY_X86_ISA_1_USED:
case elfcpp::GNU_PROPERTY_X86_ISA_1_NEEDED:
@@ -1489,7 +1489,7 @@ Target_x86_64<size>::record_gnu_property
break;
}
- switch (pr_type)
+ switch ((unsigned int) pr_type)
{
case elfcpp::GNU_PROPERTY_X86_ISA_1_USED:
this->isa_1_used_ |= val;
--- binutils.orig/bfd/dwarf2.c 2023-07-25 11:22:17.043088690 +0100
+++ binutils-2.30/bfd/dwarf2.c 2023-07-25 11:58:03.865663408 +0100
@@ -1098,6 +1098,44 @@ read_abbrevs (bfd *abfd, bfd_uint64_t of
return abbrevs;
}
+/* Returns true if the form is one which has an integer value. */
+
+static bfd_boolean
+is_int_form (const struct attribute *attr)
+{
+ switch (attr->form)
+ {
+ case DW_FORM_addr:
+ case DW_FORM_data2:
+ case DW_FORM_data4:
+ case DW_FORM_data8:
+ case DW_FORM_data1:
+ case DW_FORM_flag:
+ case DW_FORM_sdata:
+ case DW_FORM_udata:
+ case DW_FORM_ref_addr:
+ case DW_FORM_ref1:
+ case DW_FORM_ref2:
+ case DW_FORM_ref4:
+ case DW_FORM_ref8:
+ case DW_FORM_ref_udata:
+ case DW_FORM_sec_offset:
+ case DW_FORM_flag_present:
+ case DW_FORM_ref_sig8:
+ case DW_FORM_addrx:
+ case DW_FORM_implicit_const:
+ case DW_FORM_addrx1:
+ case DW_FORM_addrx2:
+ case DW_FORM_addrx3:
+ case DW_FORM_addrx4:
+ case DW_FORM_GNU_ref_alt:
+ return TRUE;
+
+ default:
+ return FALSE;
+ }
+}
+
/* Returns true if the form is one which has a string value. */
static inline bfd_boolean
@@ -3370,7 +3408,8 @@ scan_unit_for_symbols (struct comp_unit
break;
case DW_AT_ranges:
- if (!read_rangelist (unit, &func->arange, attr.u.val))
+ if (is_int_form (&attr)
+ && !read_rangelist (unit, &func->arange, attr.u.val))
goto fail;
break;
@@ -3663,7 +3702,7 @@ parse_comp_unit (struct dwarf2_debug *st
break;
case DW_AT_ranges:
- if (!read_rangelist (unit, &unit->arange, attr.u.val))
+ if (is_int_form (&attr) && !read_rangelist (unit, &unit->arange, attr.u.val))
return NULL;
break;

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,855 @@
diff -rup binutils.orig/bfd/elfnn-aarch64.c binutils-2.32/bfd/elfnn-aarch64.c
--- binutils.orig/bfd/elfnn-aarch64.c 2019-07-02 17:30:19.407892712 +0100
+++ binutils-2.32/bfd/elfnn-aarch64.c 2019-07-02 17:35:21.874749884 +0100
@@ -2579,6 +2579,9 @@ struct elf_aarch64_link_hash_table
unsigned int top_index;
asection **input_list;
+ /* JUMP_SLOT relocs for variant PCS symbols may be present. */
+ int variant_pcs;
+
/* The offset into splt of the PLT entry for the TLS descriptor
resolver. Special values are 0, if not necessary (or not found
to be necessary yet), and -1 if needed but not determined
@@ -2790,6 +2793,31 @@ elfNN_aarch64_copy_indirect_symbol (stru
_bfd_elf_link_hash_copy_indirect (info, dir, ind);
}
+/* Merge non-visibility st_other attributes. */
+
+static void
+elfNN_aarch64_merge_symbol_attribute (struct elf_link_hash_entry *h,
+ const Elf_Internal_Sym *isym,
+ bfd_boolean definition ATTRIBUTE_UNUSED,
+ bfd_boolean dynamic ATTRIBUTE_UNUSED)
+{
+ unsigned int isym_sto = isym->st_other & ~ELF_ST_VISIBILITY (-1);
+ unsigned int h_sto = h->other & ~ELF_ST_VISIBILITY (-1);
+
+ if (isym_sto == h_sto)
+ return;
+
+ if (isym_sto & ~STO_AARCH64_VARIANT_PCS)
+ /* Not fatal, this callback cannot fail. */
+ _bfd_error_handler (_("unknown attribute for symbol `%s': 0x%02x"),
+ h->root.root.string, isym_sto);
+
+ /* Note: Ideally we would warn about any attribute mismatch, but
+ this api does not allow that without substantial changes. */
+ if (isym_sto & STO_AARCH64_VARIANT_PCS)
+ h->other |= STO_AARCH64_VARIANT_PCS;
+}
+
/* Destroy an AArch64 elf linker hash table. */
static void
@@ -8370,6 +8398,12 @@ elfNN_aarch64_allocate_dynrelocs (struct
updated. */
htab->root.srelplt->reloc_count++;
+
+ /* Mark the DSO in case R_<CLS>_JUMP_SLOT relocs against
+ variant PCS symbols are present. */
+ if (h->other & STO_AARCH64_VARIANT_PCS)
+ htab->variant_pcs = 1;
+
}
else
{
@@ -8958,6 +8992,10 @@ elfNN_aarch64_size_dynamic_sections (bfd
|| !add_dynamic_entry (DT_JMPREL, 0))
return FALSE;
+ if (htab->variant_pcs
+ && !add_dynamic_entry (DT_AARCH64_VARIANT_PCS, 0))
+ return FALSE;
+
if (htab->tlsdesc_plt
&& (!add_dynamic_entry (DT_TLSDESC_PLT, 0)
|| !add_dynamic_entry (DT_TLSDESC_GOT, 0)))
@@ -9708,6 +9746,9 @@ const struct elf_size_info elfNN_aarch64
#define elf_backend_copy_indirect_symbol \
elfNN_aarch64_copy_indirect_symbol
+#define elf_backend_merge_symbol_attribute \
+ elfNN_aarch64_merge_symbol_attribute
+
/* Create .dynbss, and .rela.bss sections in DYNOBJ, and set up shortcuts
to them in our hash. */
#define elf_backend_create_dynamic_sections \
diff -rup binutils.orig/binutils/readelf.c binutils-2.32/binutils/readelf.c
--- binutils.orig/binutils/readelf.c 2019-07-02 17:30:18.890896375 +0100
+++ binutils-2.32/binutils/readelf.c 2019-07-02 17:32:25.008002901 +0100
@@ -1797,6 +1797,19 @@ dump_relocations (Filedata * fi
}
static const char *
+get_aarch64_dynamic_type (unsigned long type)
+{
+ switch (type)
+ {
+ case DT_AARCH64_BTI_PLT: return "AARCH64_BTI_PLT";
+ case DT_AARCH64_PAC_PLT: return "AARCH64_PAC_PLT";
+ case DT_AARCH64_VARIANT_PCS: return "AARCH64_VARIANT_PCS";
+ default:
+ return NULL;
+ }
+}
+
+static const char *
get_mips_dynamic_type (unsigned long type)
{
switch (type)
@@ -2169,6 +2182,9 @@ get_dynamic_type (Filedata * filedata, u
switch (filedata->file_header.e_machine)
{
+ case EM_AARCH64:
+ result = get_aarch64_dynamic_type (type);
+ break;
case EM_MIPS:
case EM_MIPS_RS3_LE:
result = get_mips_dynamic_type (type);
@@ -11054,6 +11070,22 @@ get_solaris_symbol_visibility (unsigned
}
static const char *
+get_aarch64_symbol_other (unsigned int other)
+{
+ static char buf[32];
+
+ if (other & STO_AARCH64_VARIANT_PCS)
+ {
+ other &= ~STO_AARCH64_VARIANT_PCS;
+ if (other == 0)
+ return "VARIANT_PCS";
+ snprintf (buf, sizeof buf, "VARIANT_PCS | %x", other);
+ return buf;
+ }
+ return NULL;
+}
+
+static const char *
get_mips_symbol_other (unsigned int other)
{
switch (other)
@@ -11164,6 +11196,9 @@ get_symbol_other (Filedata * filedata, u
switch (filedata->file_header.e_machine)
{
+ case EM_AARCH64:
+ result = get_aarch64_symbol_other (other);
+ break;
case EM_MIPS:
result = get_mips_symbol_other (other);
break;
diff -rup binutils.orig/gas/config/tc-aarch64.c binutils-2.32/gas/config/tc-aarch64.c
--- binutils.orig/gas/config/tc-aarch64.c 2019-07-02 17:30:19.131894667 +0100
+++ binutils-2.32/gas/config/tc-aarch64.c 2019-07-02 17:35:45.202584620 +0100
@@ -1938,6 +1938,28 @@ s_aarch64_elf_cons (int nbytes)
demand_empty_rest_of_line ();
}
+/* Mark symbol that it follows a variant PCS convention. */
+
+static void
+s_variant_pcs (int ignored ATTRIBUTE_UNUSED)
+{
+ char *name;
+ char c;
+ symbolS *sym;
+ asymbol *bfdsym;
+ elf_symbol_type *elfsym;
+
+ c = get_symbol_name (&name);
+ if (!*name)
+ as_bad (_("Missing symbol name in directive"));
+ sym = symbol_find_or_make (name);
+ restore_line_pointer (c);
+ demand_empty_rest_of_line ();
+ bfdsym = symbol_get_bfdsym (sym);
+ elfsym = elf_symbol_from (bfd_asymbol_bfd (bfdsym), bfdsym);
+ gas_assert (elfsym);
+ elfsym->internal_elf_sym.st_other |= STO_AARCH64_VARIANT_PCS;
+}
#endif /* OBJ_ELF */
/* Output a 32-bit word, but mark as an instruction. */
@@ -2084,6 +2106,7 @@ const pseudo_typeS md_pseudo_table[] = {
{"long", s_aarch64_elf_cons, 4},
{"xword", s_aarch64_elf_cons, 8},
{"dword", s_aarch64_elf_cons, 8},
+ {"variant_pcs", s_variant_pcs, 0},
#endif
{0, 0, 0}
};
@@ -9320,3 +9343,35 @@ aarch64_copy_symbol_attributes (symbolS
{
AARCH64_GET_FLAG (dest) = AARCH64_GET_FLAG (src);
}
+
+#ifdef OBJ_ELF
+/* Same as elf_copy_symbol_attributes, but without copying st_other.
+ This is needed so AArch64 specific st_other values can be independently
+ specified for an IFUNC resolver (that is called by the dynamic linker)
+ and the symbol it resolves (aliased to the resolver). In particular,
+ if a function symbol has special st_other value set via directives,
+ then attaching an IFUNC resolver to that symbol should not override
+ the st_other setting. Requiring the directive on the IFUNC resolver
+ symbol would be unexpected and problematic in C code, where the two
+ symbols appear as two independent function declarations. */
+
+void
+aarch64_elf_copy_symbol_attributes (symbolS *dest, symbolS *src)
+{
+ struct elf_obj_sy *srcelf = symbol_get_obj (src);
+ struct elf_obj_sy *destelf = symbol_get_obj (dest);
+ if (srcelf->size)
+ {
+ if (destelf->size == NULL)
+ destelf->size = XNEW (expressionS);
+ *destelf->size = *srcelf->size;
+ }
+ else
+ {
+ if (destelf->size != NULL)
+ free (destelf->size);
+ destelf->size = NULL;
+ }
+ S_SET_SIZE (dest, S_GET_SIZE (src));
+}
+#endif
diff -rup binutils.orig/gas/config/tc-aarch64.h binutils-2.32/gas/config/tc-aarch64.h
--- binutils.orig/gas/config/tc-aarch64.h 2019-07-02 17:30:19.136894632 +0100
+++ binutils-2.32/gas/config/tc-aarch64.h 2019-07-02 17:35:45.202584620 +0100
@@ -130,6 +130,12 @@ void aarch64_copy_symbol_attributes (sym
(aarch64_copy_symbol_attributes (DEST, SRC))
#endif
+#ifdef OBJ_ELF
+void aarch64_elf_copy_symbol_attributes (symbolS *, symbolS *);
+#define OBJ_COPY_SYMBOL_ATTRIBUTES(DEST, SRC) \
+ aarch64_elf_copy_symbol_attributes (DEST, SRC)
+#endif
+
#define TC_START_LABEL(STR, NUL_CHAR, NEXT_CHAR) \
(NEXT_CHAR == ':' || (NEXT_CHAR == '/' && aarch64_data_in_code ()))
#define tc_canonicalize_symbol_name(str) aarch64_canonicalize_symbol_name (str);
diff -rup binutils.orig/gas/doc/c-aarch64.texi binutils-2.32/gas/doc/c-aarch64.texi
--- binutils.orig/gas/doc/c-aarch64.texi 2019-07-02 17:30:19.125894710 +0100
+++ binutils-2.32/gas/doc/c-aarch64.texi 2019-07-02 17:35:11.362824354 +0100
@@ -425,6 +425,12 @@ should only be done if it is really nece
@c VVVVVVVVVVVVVVVVVVVVVVVVVV
+@cindex @code{.variant_pcs} directive, AArch64
+@item .variant_pcs @var{symbol}
+This directive marks @var{symbol} referencing a function that may
+follow a variant procedure call standard with different register
+usage convention from the base procedure call standard.
+
@c WWWWWWWWWWWWWWWWWWWWWWWWWW
@c XXXXXXXXXXXXXXXXXXXXXXXXXX
diff -rup binutils.orig/include/elf/aarch64.h binutils-2.32/include/elf/aarch64.h
--- binutils.orig/include/elf/aarch64.h 2019-07-02 17:30:18.850896658 +0100
+++ binutils-2.32/include/elf/aarch64.h 2019-07-02 17:32:55.678785616 +0100
@@ -36,6 +36,15 @@
#define SHF_COMDEF 0x80000000 /* Section may be multiply defined
in the input to a link step. */
+/* Processor specific dynamic array tags. */
+#define DT_AARCH64_BTI_PLT (DT_LOPROC + 1)
+#define DT_AARCH64_PAC_PLT (DT_LOPROC + 3)
+#define DT_AARCH64_VARIANT_PCS (DT_LOPROC + 5)
+
+/* AArch64-specific values for st_other. */
+#define STO_AARCH64_VARIANT_PCS 0x80 /* Symbol may follow different call
+ convention from the base PCS. */
+
/* Relocation types. */
START_RELOC_NUMBERS (elf_aarch64_reloc_type)
diff -rup binutils.orig/ld/testsuite/ld-aarch64/aarch64-elf.exp binutils-2.32/ld/testsuite/ld-aarch64/aarch64-elf.exp
--- binutils.orig/ld/testsuite/ld-aarch64/aarch64-elf.exp 2019-07-02 17:30:18.922896148 +0100
+++ binutils-2.32/ld/testsuite/ld-aarch64/aarch64-elf.exp 2019-07-02 17:35:21.875749878 +0100
@@ -371,6 +371,10 @@ run_dump_test_lp64 "rela-abs-relative-op
run_dump_test_lp64 "pie-bind-locally"
+run_dump_test_lp64 "variant_pcs-r"
+run_dump_test_lp64 "variant_pcs-shared"
+run_dump_test_lp64 "variant_pcs-now"
+
set aarch64elflinktests {
{"ld-aarch64/so with global symbol" "-shared" "" "" {copy-reloc-so.s}
{} "copy-reloc-so.so"}
--- /dev/null 2019-07-02 08:01:33.386842704 +0100
+++ binutils-2.32/gas/testsuite/gas/aarch64/symbol-variant_pcs-1.d 2019-07-02 17:35:11.362824354 +0100
@@ -0,0 +1,10 @@
+#objdump: -t
+
+.*: file format .*
+
+SYMBOL TABLE:
+0+ l d \.text 0+ \.text
+0+ l d \.data 0+ \.data
+0+ l d \.bss 0+ \.bss
+0+ l \.text 0+ func
+0+ \*UND\* 0+ 0x80 foobar
--- /dev/null 2019-07-02 08:01:33.386842704 +0100
+++ binutils-2.32/gas/testsuite/gas/aarch64/symbol-variant_pcs-1.s 2019-07-02 17:35:11.362824354 +0100
@@ -0,0 +1,8 @@
+.text
+.variant_pcs foobar
+func:
+ bl foobar
+ b foobar
+
+.data
+.xword foobar
--- /dev/null 2019-07-02 08:01:33.386842704 +0100
+++ binutils-2.32/gas/testsuite/gas/aarch64/symbol-variant_pcs-2.d 2019-07-02 17:35:11.362824354 +0100
@@ -0,0 +1,9 @@
+#objdump: -t
+
+.*: file format .*
+
+SYMBOL TABLE:
+0+ l d \.text 0+ \.text
+0+ l d \.data 0+ \.data
+0+ l d \.bss 0+ \.bss
+0+ l \.text 0+ 0x80 foo
--- /dev/null 2019-07-02 08:01:33.386842704 +0100
+++ binutils-2.32/gas/testsuite/gas/aarch64/symbol-variant_pcs-2.s 2019-07-02 17:35:11.362824354 +0100
@@ -0,0 +1,4 @@
+.text
+.variant_pcs foo
+foo:
+ ret
--- /dev/null 2019-07-02 08:01:33.386842704 +0100
+++ binutils-2.32/gas/testsuite/gas/aarch64/symbol-variant_pcs-3.s 2019-07-02 17:35:45.202584620 +0100
@@ -0,0 +1,20 @@
+.text
+.global foo_vpcs
+.global foo_base
+.global alias_vpcs
+.global alias_base
+
+.variant_pcs foo_vpcs
+.variant_pcs alias_vpcs
+
+foo_vpcs:
+foo_base:
+ bl foo_vpcs
+ bl foo_base
+ bl alias_vpcs
+ bl alias_base
+
+/* Check that the STO_AARCH64_VARIANT_PCS is not affected by .set. */
+
+.set alias_base, foo_vpcs
+.set alias_vpcs, foo_base
--- /dev/null 2019-07-02 08:01:33.386842704 +0100
+++ binutils-2.32/gas/testsuite/gas/aarch64/symbol-variant_pcs-3.d 2019-07-02 17:35:45.202584620 +0100
@@ -0,0 +1,12 @@
+#objdump: -t
+
+.*: file format .*
+
+SYMBOL TABLE:
+0+ l d \.text 0+ \.text
+0+ l d \.data 0+ \.data
+0+ l d \.bss 0+ \.bss
+0+ g \.text 0+ 0x80 foo_vpcs
+0+ g \.text 0+ foo_base
+0+ g \.text 0+ 0x80 alias_vpcs
+0+ g \.text 0+ alias_base
--- /dev/null 2019-07-02 08:01:33.386842704 +0100
+++ binutils-2.32/ld/testsuite/ld-aarch64/variant_pcs-1.s 2019-07-02 17:35:21.875749878 +0100
@@ -0,0 +1,59 @@
+.text
+
+.variant_pcs f_spec_global_default_def
+.variant_pcs f_spec_global_default_undef
+.variant_pcs f_spec_global_hidden_def
+.variant_pcs f_spec_local
+.variant_pcs f_spec_global_default_ifunc
+.variant_pcs f_spec_global_hidden_ifunc
+.variant_pcs f_spec_local_ifunc
+
+.global f_spec_global_default_def
+.global f_spec_global_default_undef
+.global f_spec_global_hidden_def
+.global f_spec_global_default_ifunc
+.global f_spec_global_hidden_ifunc
+.global f_base_global_default_def
+.global f_base_global_default_undef
+.global f_base_global_hidden_def
+.global f_base_global_default_ifunc
+.global f_base_global_hidden_ifunc
+
+.hidden f_spec_global_hidden_def
+.hidden f_spec_global_hidden_ifunc
+.hidden f_base_global_hidden_def
+.hidden f_base_global_hidden_ifunc
+
+.type f_spec_global_default_ifunc, %gnu_indirect_function
+.type f_spec_global_hidden_ifunc, %gnu_indirect_function
+.type f_spec_local_ifunc, %gnu_indirect_function
+.type f_base_global_default_ifunc, %gnu_indirect_function
+.type f_base_global_hidden_ifunc, %gnu_indirect_function
+.type f_base_local_ifunc, %gnu_indirect_function
+
+f_spec_global_default_def:
+f_spec_global_hidden_def:
+f_spec_local:
+f_base_global_default_def:
+f_base_global_hidden_def:
+f_base_local:
+f_spec_global_default_ifunc:
+f_spec_global_hidden_ifunc:
+f_spec_local_ifunc:
+f_base_global_default_ifunc:
+f_base_global_hidden_ifunc:
+f_base_local_ifunc:
+ bl f_spec_global_default_def
+ bl f_spec_global_default_undef
+ bl f_spec_global_hidden_def
+ bl f_spec_local
+ bl f_base_global_default_def
+ bl f_base_global_default_undef
+ bl f_base_global_hidden_def
+ bl f_base_local
+ bl f_spec_global_default_ifunc
+ bl f_spec_global_hidden_ifunc
+ bl f_spec_local_ifunc
+ bl f_base_global_default_ifunc
+ bl f_base_global_hidden_ifunc
+ bl f_base_local_ifunc
--- /dev/null 2019-07-02 08:01:33.386842704 +0100
+++ binutils-2.32/ld/testsuite/ld-aarch64/variant_pcs-2.s 2019-07-02 17:35:21.875749878 +0100
@@ -0,0 +1,47 @@
+.text
+
+.variant_pcs f_spec_global_default_def
+.variant_pcs f_spec_global_default_undef
+.variant_pcs f_spec_global_hidden_def
+.variant_pcs f_spec_local2
+.variant_pcs f_spec_global_default_ifunc
+.variant_pcs f_spec_global_hidden_ifunc
+.variant_pcs f_spec_local2_ifunc
+
+.global f_spec_global_default_def
+.global f_spec_global_default_undef
+.global f_spec_global_hidden_def
+.global f_spec_global_default_ifunc
+.global f_spec_global_hidden_ifunc
+.global f_base_global_default_def
+.global f_base_global_default_undef
+.global f_base_global_hidden_def
+.global f_base_global_default_ifunc
+.global f_base_global_hidden_ifunc
+
+.hidden f_spec_global_hidden_def
+.hidden f_spec_global_hidden_ifunc
+.hidden f_base_global_hidden_def
+.hidden f_base_global_hidden_ifunc
+
+.type f_spec_local2_ifunc, %gnu_indirect_function
+.type f_base_local2_ifunc, %gnu_indirect_function
+
+f_spec_local2:
+f_base_local2:
+f_spec_local2_ifunc:
+f_base_local2_ifunc:
+ bl f_spec_global_default_def
+ bl f_spec_global_default_undef
+ bl f_spec_global_hidden_def
+ bl f_spec_local2
+ bl f_base_global_default_def
+ bl f_base_global_default_undef
+ bl f_base_global_hidden_def
+ bl f_base_local2
+ bl f_spec_global_default_ifunc
+ bl f_spec_global_hidden_ifunc
+ bl f_spec_local2_ifunc
+ bl f_base_global_default_ifunc
+ bl f_base_global_hidden_ifunc
+ bl f_base_local2_ifunc
--- /dev/null 2019-07-02 08:01:33.386842704 +0100
+++ binutils-2.32/ld/testsuite/ld-aarch64/variant_pcs.ld 2019-07-02 17:35:37.100642017 +0100
@@ -0,0 +1,23 @@
+/* Script for .variant_pcs symbol tests. */
+OUTPUT_ARCH(aarch64)
+ENTRY(_start)
+SECTIONS
+{
+ /* Read-only sections, merged into text segment: */
+ PROVIDE (__executable_start = 0x8000); . = 0x8000;
+ .text :
+ {
+ *(.before)
+ *(.text)
+ *(.after)
+ } =0
+ . = 0x9000;
+ .got : { *(.got) *(.got.plt)}
+ . = 0x10000;
+ .rela.dyn : { *(.rela.ifunc) }
+ . = 0x11000;
+ .rela.plt : { *(.rela.plt) *(.rela.iplt) }
+ . = 0x12340000;
+ .far : { *(.far) }
+ .ARM.attributes 0 : { *(.ARM.atttributes) }
+}
--- /dev/null 2019-07-02 08:01:33.386842704 +0100
+++ binutils-2.32/ld/testsuite/ld-aarch64/variant_pcs-now.d 2019-07-02 17:34:37.557063849 +0100
@@ -0,0 +1,67 @@
+#source: variant_pcs-1.s
+#source: variant_pcs-2.s
+#ld: -shared --hash-style=sysv -T variant_pcs.ld -z now
+#readelf: -rsW
+
+Relocation section '\.rela\.plt' at offset 0x11000 contains 12 entries:
+ Offset Info Type Symbol's Value Symbol's Name \+ Addend
+0000000000009020 0000000100000402 R_AARCH64_JUMP_SLOT 0000000000000000 f_base_global_default_undef \+ 0
+0000000000009028 0000000200000402 R_AARCH64_JUMP_SLOT 0000000000000000 f_spec_global_default_undef \+ 0
+0000000000009030 0000000400000402 R_AARCH64_JUMP_SLOT 0000000000008000 f_base_global_default_def \+ 0
+0000000000009038 0000000500000402 R_AARCH64_JUMP_SLOT 0000000000008000 f_spec_global_default_def \+ 0
+0000000000009040 0000000000000408 R_AARCH64_IRELATIVE 8000
+0000000000009048 0000000300000402 R_AARCH64_JUMP_SLOT f_spec_global_default_ifunc\(\) f_spec_global_default_ifunc \+ 0
+0000000000009050 0000000000000408 R_AARCH64_IRELATIVE 8000
+0000000000009058 0000000600000402 R_AARCH64_JUMP_SLOT f_base_global_default_ifunc\(\) f_base_global_default_ifunc \+ 0
+0000000000009060 0000000000000408 R_AARCH64_IRELATIVE 8038
+0000000000009068 0000000000000408 R_AARCH64_IRELATIVE 8000
+0000000000009070 0000000000000408 R_AARCH64_IRELATIVE 8000
+0000000000009078 0000000000000408 R_AARCH64_IRELATIVE 8038
+
+Symbol table '\.dynsym' contains 7 entries:
+ Num: Value Size Type Bind Vis Ndx Name
+ 0: 0000000000000000 0 NOTYPE LOCAL DEFAULT UND
+ 1: 0000000000000000 0 NOTYPE GLOBAL DEFAULT UND f_base_global_default_undef
+ 2: 0000000000000000 0 NOTYPE GLOBAL DEFAULT \[VARIANT_PCS\] UND f_spec_global_default_undef
+ 3: 0000000000008000 0 IFUNC GLOBAL DEFAULT \[VARIANT_PCS\] 1 f_spec_global_default_ifunc
+ 4: 0000000000008000 0 NOTYPE GLOBAL DEFAULT 1 f_base_global_default_def
+ 5: 0000000000008000 0 NOTYPE GLOBAL DEFAULT \[VARIANT_PCS\] 1 f_spec_global_default_def
+ 6: 0000000000008000 0 IFUNC GLOBAL DEFAULT 1 f_base_global_default_ifunc
+
+Symbol table '\.symtab' contains 35 entries:
+ Num: Value Size Type Bind Vis Ndx Name
+ 0: 0000000000000000 0 NOTYPE LOCAL DEFAULT UND
+ 1: 0000000000008000 0 SECTION LOCAL DEFAULT 1
+ 2: 0000000000008070 0 SECTION LOCAL DEFAULT 2
+ 3: 0000000000009000 0 SECTION LOCAL DEFAULT 3
+ 4: 0000000000009080 0 SECTION LOCAL DEFAULT 4
+ 5: 0000000000011000 0 SECTION LOCAL DEFAULT 5
+ 6: 0000000000011120 0 SECTION LOCAL DEFAULT 6
+ 7: 00000000000111c8 0 SECTION LOCAL DEFAULT 7
+ 8: 0000000000011270 0 SECTION LOCAL DEFAULT 8
+ 9: 0000000000000000 0 FILE LOCAL DEFAULT ABS .*variant_pcs-1\.o
+ 10: 0000000000008000 0 NOTYPE LOCAL DEFAULT \[VARIANT_PCS\] 1 f_spec_local
+ 11: 0000000000008000 0 IFUNC LOCAL DEFAULT \[VARIANT_PCS\] 1 f_spec_local_ifunc
+ 12: 0000000000008000 0 IFUNC LOCAL DEFAULT 1 f_base_local_ifunc
+ 13: 0000000000008000 0 NOTYPE LOCAL DEFAULT 1 f_base_local
+ 14: 0000000000008000 0 NOTYPE LOCAL DEFAULT 1 \$x
+ 15: 0000000000000000 0 FILE LOCAL DEFAULT ABS .*variant_pcs-2\.o
+ 16: 0000000000008038 0 NOTYPE LOCAL DEFAULT \[VARIANT_PCS\] 1 f_spec_local2
+ 17: 0000000000008038 0 IFUNC LOCAL DEFAULT \[VARIANT_PCS\] 1 f_spec_local2_ifunc
+ 18: 0000000000008038 0 IFUNC LOCAL DEFAULT 1 f_base_local2_ifunc
+ 19: 0000000000008038 0 NOTYPE LOCAL DEFAULT 1 f_base_local2
+ 20: 0000000000008038 0 NOTYPE LOCAL DEFAULT 1 \$x
+ 21: 0000000000000000 0 FILE LOCAL DEFAULT ABS
+ 22: 0000000000009080 0 OBJECT LOCAL DEFAULT ABS _DYNAMIC
+ 23: 0000000000008000 0 NOTYPE LOCAL DEFAULT \[VARIANT_PCS\] 1 f_spec_global_hidden_def
+ 24: 0000000000008000 0 IFUNC LOCAL DEFAULT 1 f_base_global_hidden_ifunc
+ 25: 0000000000008000 0 NOTYPE LOCAL DEFAULT 1 f_base_global_hidden_def
+ 26: 0000000000009000 0 OBJECT LOCAL DEFAULT ABS _GLOBAL_OFFSET_TABLE_
+ 27: 0000000000008000 0 IFUNC LOCAL DEFAULT \[VARIANT_PCS\] 1 f_spec_global_hidden_ifunc
+ 28: 0000000000008070 0 NOTYPE LOCAL DEFAULT 2 \$x
+ 29: 0000000000000000 0 NOTYPE GLOBAL DEFAULT UND f_base_global_default_undef
+ 30: 0000000000000000 0 NOTYPE GLOBAL DEFAULT \[VARIANT_PCS\] UND f_spec_global_default_undef
+ 31: 0000000000008000 0 IFUNC GLOBAL DEFAULT \[VARIANT_PCS\] 1 f_spec_global_default_ifunc
+ 32: 0000000000008000 0 NOTYPE GLOBAL DEFAULT 1 f_base_global_default_def
+ 33: 0000000000008000 0 NOTYPE GLOBAL DEFAULT \[VARIANT_PCS\] 1 f_spec_global_default_def
+ 34: 0000000000008000 0 IFUNC GLOBAL DEFAULT 1 f_base_global_default_ifunc
--- /dev/null 2019-07-02 08:01:33.386842704 +0100
+++ binutils-2.32/ld/testsuite/ld-aarch64/variant_pcs-r.d 2019-07-02 17:35:35.244655166 +0100
@@ -0,0 +1,60 @@
+#source: variant_pcs-1.s
+#source: variant_pcs-2.s
+#ld: -r
+#readelf: -rsW
+
+Relocation section '\.rela\.text' at offset .* contains 24 entries:
+ Offset Info Type Symbol's Value Symbol's Name \+ Addend
+0000000000000000 000000180000011b R_AARCH64_CALL26 0000000000000000 f_spec_global_default_def \+ 0
+0000000000000004 000000110000011b R_AARCH64_CALL26 0000000000000000 f_spec_global_default_undef \+ 0
+0000000000000008 000000120000011b R_AARCH64_CALL26 0000000000000000 f_spec_global_hidden_def \+ 0
+0000000000000010 000000170000011b R_AARCH64_CALL26 0000000000000000 f_base_global_default_def \+ 0
+0000000000000014 000000100000011b R_AARCH64_CALL26 0000000000000000 f_base_global_default_undef \+ 0
+0000000000000018 000000150000011b R_AARCH64_CALL26 0000000000000000 f_base_global_hidden_def \+ 0
+0000000000000020 000000140000011b R_AARCH64_CALL26 f_spec_global_default_ifunc\(\) f_spec_global_default_ifunc \+ 0
+0000000000000024 000000160000011b R_AARCH64_CALL26 f_spec_global_hidden_ifunc\(\) f_spec_global_hidden_ifunc \+ 0
+0000000000000028 000000060000011b R_AARCH64_CALL26 f_spec_local_ifunc\(\) f_spec_local_ifunc \+ 0
+000000000000002c 000000190000011b R_AARCH64_CALL26 f_base_global_default_ifunc\(\) f_base_global_default_ifunc \+ 0
+0000000000000030 000000130000011b R_AARCH64_CALL26 f_base_global_hidden_ifunc\(\) f_base_global_hidden_ifunc \+ 0
+0000000000000034 000000070000011b R_AARCH64_CALL26 f_base_local_ifunc\(\) f_base_local_ifunc \+ 0
+0000000000000038 000000180000011b R_AARCH64_CALL26 0000000000000000 f_spec_global_default_def \+ 0
+000000000000003c 000000110000011b R_AARCH64_CALL26 0000000000000000 f_spec_global_default_undef \+ 0
+0000000000000040 000000120000011b R_AARCH64_CALL26 0000000000000000 f_spec_global_hidden_def \+ 0
+0000000000000048 000000170000011b R_AARCH64_CALL26 0000000000000000 f_base_global_default_def \+ 0
+000000000000004c 000000100000011b R_AARCH64_CALL26 0000000000000000 f_base_global_default_undef \+ 0
+0000000000000050 000000150000011b R_AARCH64_CALL26 0000000000000000 f_base_global_hidden_def \+ 0
+0000000000000058 000000140000011b R_AARCH64_CALL26 f_spec_global_default_ifunc\(\) f_spec_global_default_ifunc \+ 0
+000000000000005c 000000160000011b R_AARCH64_CALL26 f_spec_global_hidden_ifunc\(\) f_spec_global_hidden_ifunc \+ 0
+0000000000000060 0000000c0000011b R_AARCH64_CALL26 f_spec_local2_ifunc\(\) f_spec_local2_ifunc \+ 0
+0000000000000064 000000190000011b R_AARCH64_CALL26 f_base_global_default_ifunc\(\) f_base_global_default_ifunc \+ 0
+0000000000000068 000000130000011b R_AARCH64_CALL26 f_base_global_hidden_ifunc\(\) f_base_global_hidden_ifunc \+ 0
+000000000000006c 0000000d0000011b R_AARCH64_CALL26 f_base_local2_ifunc\(\) f_base_local2_ifunc \+ 0
+
+Symbol table '\.symtab' contains 26 entries:
+ Num: Value Size Type Bind Vis Ndx Name
+ 0: 0000000000000000 0 NOTYPE LOCAL DEFAULT UND
+ 1: 0000000000000000 0 SECTION LOCAL DEFAULT 1
+ 2: 0000000000000000 0 SECTION LOCAL DEFAULT 3
+ 3: 0000000000000000 0 SECTION LOCAL DEFAULT 4
+ 4: 0000000000000000 0 FILE LOCAL DEFAULT ABS .*variant_pcs-1\.o
+ 5: 0000000000000000 0 NOTYPE LOCAL DEFAULT \[VARIANT_PCS\] 1 f_spec_local
+ 6: 0000000000000000 0 IFUNC LOCAL DEFAULT \[VARIANT_PCS\] 1 f_spec_local_ifunc
+ 7: 0000000000000000 0 IFUNC LOCAL DEFAULT 1 f_base_local_ifunc
+ 8: 0000000000000000 0 NOTYPE LOCAL DEFAULT 1 f_base_local
+ 9: 0000000000000000 0 NOTYPE LOCAL DEFAULT 1 \$x
+ 10: 0000000000000000 0 FILE LOCAL DEFAULT ABS .*variant_pcs-2\.o
+ 11: 0000000000000038 0 NOTYPE LOCAL DEFAULT \[VARIANT_PCS\] 1 f_spec_local2
+ 12: 0000000000000038 0 IFUNC LOCAL DEFAULT \[VARIANT_PCS\] 1 f_spec_local2_ifunc
+ 13: 0000000000000038 0 IFUNC LOCAL DEFAULT 1 f_base_local2_ifunc
+ 14: 0000000000000038 0 NOTYPE LOCAL DEFAULT 1 f_base_local2
+ 15: 0000000000000038 0 NOTYPE LOCAL DEFAULT 1 \$x
+ 16: 0000000000000000 0 NOTYPE GLOBAL DEFAULT UND f_base_global_default_undef
+ 17: 0000000000000000 0 NOTYPE GLOBAL DEFAULT \[VARIANT_PCS\] UND f_spec_global_default_undef
+ 18: 0000000000000000 0 NOTYPE GLOBAL HIDDEN \[VARIANT_PCS\] 1 f_spec_global_hidden_def
+ 19: 0000000000000000 0 IFUNC GLOBAL HIDDEN 1 f_base_global_hidden_ifunc
+ 20: 0000000000000000 0 IFUNC GLOBAL DEFAULT \[VARIANT_PCS\] 1 f_spec_global_default_ifunc
+ 21: 0000000000000000 0 NOTYPE GLOBAL HIDDEN 1 f_base_global_hidden_def
+ 22: 0000000000000000 0 IFUNC GLOBAL HIDDEN \[VARIANT_PCS\] 1 f_spec_global_hidden_ifunc
+ 23: 0000000000000000 0 NOTYPE GLOBAL DEFAULT 1 f_base_global_default_def
+ 24: 0000000000000000 0 NOTYPE GLOBAL DEFAULT \[VARIANT_PCS\] 1 f_spec_global_default_def
+ 25: 0000000000000000 0 IFUNC GLOBAL DEFAULT 1 f_base_global_default_ifunc
--- /dev/null 2019-07-02 08:01:33.386842704 +0100
+++ binutils-2.32/ld/testsuite/ld-aarch64/variant_pcs-shared.d 2019-07-02 17:34:45.635006622 +0100
@@ -0,0 +1,67 @@
+#source: variant_pcs-1.s
+#source: variant_pcs-2.s
+#ld: -shared --hash-style=sysv -T variant_pcs.ld
+#readelf: -rsW
+
+Relocation section '\.rela\.plt' at offset 0x11000 contains 12 entries:
+ Offset Info Type Symbol's Value Symbol's Name \+ Addend
+0000000000009020 0000000100000402 R_AARCH64_JUMP_SLOT 0000000000000000 f_base_global_default_undef \+ 0
+0000000000009028 0000000200000402 R_AARCH64_JUMP_SLOT 0000000000000000 f_spec_global_default_undef \+ 0
+0000000000009030 0000000400000402 R_AARCH64_JUMP_SLOT 0000000000008000 f_base_global_default_def \+ 0
+0000000000009038 0000000500000402 R_AARCH64_JUMP_SLOT 0000000000008000 f_spec_global_default_def \+ 0
+0000000000009040 0000000000000408 R_AARCH64_IRELATIVE 8000
+0000000000009048 0000000300000402 R_AARCH64_JUMP_SLOT f_spec_global_default_ifunc\(\) f_spec_global_default_ifunc \+ 0
+0000000000009050 0000000000000408 R_AARCH64_IRELATIVE 8000
+0000000000009058 0000000600000402 R_AARCH64_JUMP_SLOT f_base_global_default_ifunc\(\) f_base_global_default_ifunc \+ 0
+0000000000009060 0000000000000408 R_AARCH64_IRELATIVE 8038
+0000000000009068 0000000000000408 R_AARCH64_IRELATIVE 8000
+0000000000009070 0000000000000408 R_AARCH64_IRELATIVE 8000
+0000000000009078 0000000000000408 R_AARCH64_IRELATIVE 8038
+
+Symbol table '\.dynsym' contains 7 entries:
+ Num: Value Size Type Bind Vis Ndx Name
+ 0: 0000000000000000 0 NOTYPE LOCAL DEFAULT UND
+ 1: 0000000000000000 0 NOTYPE GLOBAL DEFAULT UND f_base_global_default_undef
+ 2: 0000000000000000 0 NOTYPE GLOBAL DEFAULT \[VARIANT_PCS\] UND f_spec_global_default_undef
+ 3: 0000000000008000 0 IFUNC GLOBAL DEFAULT \[VARIANT_PCS\] 1 f_spec_global_default_ifunc
+ 4: 0000000000008000 0 NOTYPE GLOBAL DEFAULT 1 f_base_global_default_def
+ 5: 0000000000008000 0 NOTYPE GLOBAL DEFAULT \[VARIANT_PCS\] 1 f_spec_global_default_def
+ 6: 0000000000008000 0 IFUNC GLOBAL DEFAULT 1 f_base_global_default_ifunc
+
+Symbol table '\.symtab' contains 35 entries:
+ Num: Value Size Type Bind Vis Ndx Name
+ 0: 0000000000000000 0 NOTYPE LOCAL DEFAULT UND
+ 1: 0000000000008000 0 SECTION LOCAL DEFAULT 1
+ 2: 0000000000008070 0 SECTION LOCAL DEFAULT 2
+ 3: 0000000000009000 0 SECTION LOCAL DEFAULT 3
+ 4: 0000000000009080 0 SECTION LOCAL DEFAULT 4
+ 5: 0000000000011000 0 SECTION LOCAL DEFAULT 5
+ 6: 0000000000011120 0 SECTION LOCAL DEFAULT 6
+ 7: 00000000000111c8 0 SECTION LOCAL DEFAULT 7
+ 8: 0000000000011270 0 SECTION LOCAL DEFAULT 8
+ 9: 0000000000000000 0 FILE LOCAL DEFAULT ABS .*variant_pcs-1\.o
+ 10: 0000000000008000 0 NOTYPE LOCAL DEFAULT \[VARIANT_PCS\] 1 f_spec_local
+ 11: 0000000000008000 0 IFUNC LOCAL DEFAULT \[VARIANT_PCS\] 1 f_spec_local_ifunc
+ 12: 0000000000008000 0 IFUNC LOCAL DEFAULT 1 f_base_local_ifunc
+ 13: 0000000000008000 0 NOTYPE LOCAL DEFAULT 1 f_base_local
+ 14: 0000000000008000 0 NOTYPE LOCAL DEFAULT 1 \$x
+ 15: 0000000000000000 0 FILE LOCAL DEFAULT ABS .*variant_pcs-2\.o
+ 16: 0000000000008038 0 NOTYPE LOCAL DEFAULT \[VARIANT_PCS\] 1 f_spec_local2
+ 17: 0000000000008038 0 IFUNC LOCAL DEFAULT \[VARIANT_PCS\] 1 f_spec_local2_ifunc
+ 18: 0000000000008038 0 IFUNC LOCAL DEFAULT 1 f_base_local2_ifunc
+ 19: 0000000000008038 0 NOTYPE LOCAL DEFAULT 1 f_base_local2
+ 20: 0000000000008038 0 NOTYPE LOCAL DEFAULT 1 \$x
+ 21: 0000000000000000 0 FILE LOCAL DEFAULT ABS
+ 22: 0000000000009080 0 OBJECT LOCAL DEFAULT ABS _DYNAMIC
+ 23: 0000000000008000 0 NOTYPE LOCAL DEFAULT \[VARIANT_PCS\] 1 f_spec_global_hidden_def
+ 24: 0000000000008000 0 IFUNC LOCAL DEFAULT 1 f_base_global_hidden_ifunc
+ 25: 0000000000008000 0 NOTYPE LOCAL DEFAULT 1 f_base_global_hidden_def
+ 26: 0000000000009000 0 OBJECT LOCAL DEFAULT ABS _GLOBAL_OFFSET_TABLE_
+ 27: 0000000000008000 0 IFUNC LOCAL DEFAULT \[VARIANT_PCS\] 1 f_spec_global_hidden_ifunc
+ 28: 0000000000008070 0 NOTYPE LOCAL DEFAULT 2 \$x
+ 29: 0000000000000000 0 NOTYPE GLOBAL DEFAULT UND f_base_global_default_undef
+ 30: 0000000000000000 0 NOTYPE GLOBAL DEFAULT \[VARIANT_PCS\] UND f_spec_global_default_undef
+ 31: 0000000000008000 0 IFUNC GLOBAL DEFAULT \[VARIANT_PCS\] 1 f_spec_global_default_ifunc
+ 32: 0000000000008000 0 NOTYPE GLOBAL DEFAULT 1 f_base_global_default_def
+ 33: 0000000000008000 0 NOTYPE GLOBAL DEFAULT \[VARIANT_PCS\] 1 f_spec_global_default_def
+ 34: 0000000000008000 0 IFUNC GLOBAL DEFAULT 1 f_base_global_default_ifunc
diff -rup binutils.orig/ld/testsuite/ld-aarch64/variant_pcs-now.d binutils-2.32/ld/testsuite/ld-aarch64/variant_pcs-now.d
--- binutils.orig/ld/testsuite/ld-aarch64/variant_pcs-now.d 2019-07-03 10:06:20.012412075 +0100
+++ binutils-2.32/ld/testsuite/ld-aarch64/variant_pcs-now.d 2019-07-03 10:20:51.959203582 +0100
@@ -22,10 +22,10 @@ Symbol table '\.dynsym' contains 7 entri
Num: Value Size Type Bind Vis Ndx Name
0: 0000000000000000 0 NOTYPE LOCAL DEFAULT UND
1: 0000000000000000 0 NOTYPE GLOBAL DEFAULT UND f_base_global_default_undef
- 2: 0000000000000000 0 NOTYPE GLOBAL DEFAULT \[VARIANT_PCS\] UND f_spec_global_default_undef
- 3: 0000000000008000 0 IFUNC GLOBAL DEFAULT \[VARIANT_PCS\] 1 f_spec_global_default_ifunc
+ 2: 0000000000000000 0 NOTYPE GLOBAL DEFAULT UND f_spec_global_default_undef \[VARIANT_PCS\]
+ 3: 0000000000008000 0 IFUNC GLOBAL DEFAULT 1 f_spec_global_default_ifunc \[VARIANT_PCS\]
4: 0000000000008000 0 NOTYPE GLOBAL DEFAULT 1 f_base_global_default_def
- 5: 0000000000008000 0 NOTYPE GLOBAL DEFAULT \[VARIANT_PCS\] 1 f_spec_global_default_def
+ 5: 0000000000008000 0 NOTYPE GLOBAL DEFAULT 1 f_spec_global_default_def \[VARIANT_PCS\]
6: 0000000000008000 0 IFUNC GLOBAL DEFAULT 1 f_base_global_default_ifunc
Symbol table '\.symtab' contains 35 entries:
@@ -40,28 +40,28 @@ Symbol table '\.symtab' contains 35 entr
7: 00000000000111c8 0 SECTION LOCAL DEFAULT 7
8: 0000000000011270 0 SECTION LOCAL DEFAULT 8
9: 0000000000000000 0 FILE LOCAL DEFAULT ABS .*variant_pcs-1\.o
- 10: 0000000000008000 0 NOTYPE LOCAL DEFAULT \[VARIANT_PCS\] 1 f_spec_local
- 11: 0000000000008000 0 IFUNC LOCAL DEFAULT \[VARIANT_PCS\] 1 f_spec_local_ifunc
+ 10: 0000000000008000 0 NOTYPE LOCAL DEFAULT 1 f_spec_local \[VARIANT_PCS\]
+ 11: 0000000000008000 0 IFUNC LOCAL DEFAULT 1 f_spec_local_ifunc \[VARIANT_PCS\]
12: 0000000000008000 0 IFUNC LOCAL DEFAULT 1 f_base_local_ifunc
13: 0000000000008000 0 NOTYPE LOCAL DEFAULT 1 f_base_local
14: 0000000000008000 0 NOTYPE LOCAL DEFAULT 1 \$x
15: 0000000000000000 0 FILE LOCAL DEFAULT ABS .*variant_pcs-2\.o
- 16: 0000000000008038 0 NOTYPE LOCAL DEFAULT \[VARIANT_PCS\] 1 f_spec_local2
- 17: 0000000000008038 0 IFUNC LOCAL DEFAULT \[VARIANT_PCS\] 1 f_spec_local2_ifunc
+ 16: 0000000000008038 0 NOTYPE LOCAL DEFAULT 1 f_spec_local2 \[VARIANT_PCS\]
+ 17: 0000000000008038 0 IFUNC LOCAL DEFAULT 1 f_spec_local2_ifunc \[VARIANT_PCS\]
18: 0000000000008038 0 IFUNC LOCAL DEFAULT 1 f_base_local2_ifunc
19: 0000000000008038 0 NOTYPE LOCAL DEFAULT 1 f_base_local2
20: 0000000000008038 0 NOTYPE LOCAL DEFAULT 1 \$x
21: 0000000000000000 0 FILE LOCAL DEFAULT ABS
22: 0000000000009080 0 OBJECT LOCAL DEFAULT ABS _DYNAMIC
- 23: 0000000000008000 0 NOTYPE LOCAL DEFAULT \[VARIANT_PCS\] 1 f_spec_global_hidden_def
+ 23: 0000000000008000 0 NOTYPE LOCAL DEFAULT 1 f_spec_global_hidden_def \[VARIANT_PCS\]
24: 0000000000008000 0 IFUNC LOCAL DEFAULT 1 f_base_global_hidden_ifunc
25: 0000000000008000 0 NOTYPE LOCAL DEFAULT 1 f_base_global_hidden_def
26: 0000000000009000 0 OBJECT LOCAL DEFAULT ABS _GLOBAL_OFFSET_TABLE_
- 27: 0000000000008000 0 IFUNC LOCAL DEFAULT \[VARIANT_PCS\] 1 f_spec_global_hidden_ifunc
+ 27: 0000000000008000 0 IFUNC LOCAL DEFAULT 1 f_spec_global_hidden_ifunc \[VARIANT_PCS\]
28: 0000000000008070 0 NOTYPE LOCAL DEFAULT 2 \$x
29: 0000000000000000 0 NOTYPE GLOBAL DEFAULT UND f_base_global_default_undef
- 30: 0000000000000000 0 NOTYPE GLOBAL DEFAULT \[VARIANT_PCS\] UND f_spec_global_default_undef
- 31: 0000000000008000 0 IFUNC GLOBAL DEFAULT \[VARIANT_PCS\] 1 f_spec_global_default_ifunc
+ 30: 0000000000000000 0 NOTYPE GLOBAL DEFAULT UND f_spec_global_default_undef \[VARIANT_PCS\]
+ 31: 0000000000008000 0 IFUNC GLOBAL DEFAULT 1 f_spec_global_default_ifunc \[VARIANT_PCS\]
32: 0000000000008000 0 NOTYPE GLOBAL DEFAULT 1 f_base_global_default_def
- 33: 0000000000008000 0 NOTYPE GLOBAL DEFAULT \[VARIANT_PCS\] 1 f_spec_global_default_def
+ 33: 0000000000008000 0 NOTYPE GLOBAL DEFAULT 1 f_spec_global_default_def \[VARIANT_PCS\]
34: 0000000000008000 0 IFUNC GLOBAL DEFAULT 1 f_base_global_default_ifunc
diff -rup binutils.orig/ld/testsuite/ld-aarch64/variant_pcs-r.d binutils-2.32/ld/testsuite/ld-aarch64/variant_pcs-r.d
--- binutils.orig/ld/testsuite/ld-aarch64/variant_pcs-r.d 2019-07-03 10:06:20.012412075 +0100
+++ binutils-2.32/ld/testsuite/ld-aarch64/variant_pcs-r.d 2019-07-03 10:14:28.152933189 +0100
@@ -37,24 +37,24 @@ Symbol table '\.symtab' contains 26 entr
2: 0000000000000000 0 SECTION LOCAL DEFAULT 3
3: 0000000000000000 0 SECTION LOCAL DEFAULT 4
4: 0000000000000000 0 FILE LOCAL DEFAULT ABS .*variant_pcs-1\.o
- 5: 0000000000000000 0 NOTYPE LOCAL DEFAULT \[VARIANT_PCS\] 1 f_spec_local
- 6: 0000000000000000 0 IFUNC LOCAL DEFAULT \[VARIANT_PCS\] 1 f_spec_local_ifunc
+ 5: 0000000000000000 0 NOTYPE LOCAL DEFAULT 1 f_spec_local \[VARIANT_PCS\]
+ 6: 0000000000000000 0 IFUNC LOCAL DEFAULT 1 f_spec_local_ifunc \[VARIANT_PCS\]
7: 0000000000000000 0 IFUNC LOCAL DEFAULT 1 f_base_local_ifunc
8: 0000000000000000 0 NOTYPE LOCAL DEFAULT 1 f_base_local
9: 0000000000000000 0 NOTYPE LOCAL DEFAULT 1 \$x
10: 0000000000000000 0 FILE LOCAL DEFAULT ABS .*variant_pcs-2\.o
- 11: 0000000000000038 0 NOTYPE LOCAL DEFAULT \[VARIANT_PCS\] 1 f_spec_local2
- 12: 0000000000000038 0 IFUNC LOCAL DEFAULT \[VARIANT_PCS\] 1 f_spec_local2_ifunc
+ 11: 0000000000000038 0 NOTYPE LOCAL DEFAULT 1 f_spec_local2 \[VARIANT_PCS\]
+ 12: 0000000000000038 0 IFUNC LOCAL DEFAULT 1 f_spec_local2_ifunc \[VARIANT_PCS\]
13: 0000000000000038 0 IFUNC LOCAL DEFAULT 1 f_base_local2_ifunc
14: 0000000000000038 0 NOTYPE LOCAL DEFAULT 1 f_base_local2
15: 0000000000000038 0 NOTYPE LOCAL DEFAULT 1 \$x
16: 0000000000000000 0 NOTYPE GLOBAL DEFAULT UND f_base_global_default_undef
- 17: 0000000000000000 0 NOTYPE GLOBAL DEFAULT \[VARIANT_PCS\] UND f_spec_global_default_undef
- 18: 0000000000000000 0 NOTYPE GLOBAL HIDDEN \[VARIANT_PCS\] 1 f_spec_global_hidden_def
+ 17: 0000000000000000 0 NOTYPE GLOBAL DEFAULT UND f_spec_global_default_undef \[VARIANT_PCS\]
+ 18: 0000000000000000 0 NOTYPE GLOBAL HIDDEN 1 f_spec_global_hidden_def \[VARIANT_PCS\]
19: 0000000000000000 0 IFUNC GLOBAL HIDDEN 1 f_base_global_hidden_ifunc
- 20: 0000000000000000 0 IFUNC GLOBAL DEFAULT \[VARIANT_PCS\] 1 f_spec_global_default_ifunc
+ 20: 0000000000000000 0 IFUNC GLOBAL DEFAULT 1 f_spec_global_default_ifunc \[VARIANT_PCS\]
21: 0000000000000000 0 NOTYPE GLOBAL HIDDEN 1 f_base_global_hidden_def
- 22: 0000000000000000 0 IFUNC GLOBAL HIDDEN \[VARIANT_PCS\] 1 f_spec_global_hidden_ifunc
+ 22: 0000000000000000 0 IFUNC GLOBAL HIDDEN 1 f_spec_global_hidden_ifunc \[VARIANT_PCS\]
23: 0000000000000000 0 NOTYPE GLOBAL DEFAULT 1 f_base_global_default_def
- 24: 0000000000000000 0 NOTYPE GLOBAL DEFAULT \[VARIANT_PCS\] 1 f_spec_global_default_def
+ 24: 0000000000000000 0 NOTYPE GLOBAL DEFAULT 1 f_spec_global_default_def \[VARIANT_PCS\]
25: 0000000000000000 0 IFUNC GLOBAL DEFAULT 1 f_base_global_default_ifunc
diff -rup binutils.orig/ld/testsuite/ld-aarch64/variant_pcs-shared.d binutils-2.32/ld/testsuite/ld-aarch64/variant_pcs-shared.d
--- binutils.orig/ld/testsuite/ld-aarch64/variant_pcs-shared.d 2019-07-03 10:06:20.012412075 +0100
+++ binutils-2.32/ld/testsuite/ld-aarch64/variant_pcs-shared.d 2019-07-03 10:19:00.760994532 +0100
@@ -22,10 +22,10 @@ Symbol table '\.dynsym' contains 7 entri
Num: Value Size Type Bind Vis Ndx Name
0: 0000000000000000 0 NOTYPE LOCAL DEFAULT UND
1: 0000000000000000 0 NOTYPE GLOBAL DEFAULT UND f_base_global_default_undef
- 2: 0000000000000000 0 NOTYPE GLOBAL DEFAULT \[VARIANT_PCS\] UND f_spec_global_default_undef
- 3: 0000000000008000 0 IFUNC GLOBAL DEFAULT \[VARIANT_PCS\] 1 f_spec_global_default_ifunc
+ 2: 0000000000000000 0 NOTYPE GLOBAL DEFAULT UND f_spec_global_default_undef \[VARIANT_PCS\]
+ 3: 0000000000008000 0 IFUNC GLOBAL DEFAULT 1 f_spec_global_default_ifunc \[VARIANT_PCS\]
4: 0000000000008000 0 NOTYPE GLOBAL DEFAULT 1 f_base_global_default_def
- 5: 0000000000008000 0 NOTYPE GLOBAL DEFAULT \[VARIANT_PCS\] 1 f_spec_global_default_def
+ 5: 0000000000008000 0 NOTYPE GLOBAL DEFAULT 1 f_spec_global_default_def \[VARIANT_PCS\]
6: 0000000000008000 0 IFUNC GLOBAL DEFAULT 1 f_base_global_default_ifunc
Symbol table '\.symtab' contains 35 entries:
@@ -40,28 +40,28 @@ Symbol table '\.symtab' contains 35 entr
7: 00000000000111c8 0 SECTION LOCAL DEFAULT 7
8: 0000000000011270 0 SECTION LOCAL DEFAULT 8
9: 0000000000000000 0 FILE LOCAL DEFAULT ABS .*variant_pcs-1\.o
- 10: 0000000000008000 0 NOTYPE LOCAL DEFAULT \[VARIANT_PCS\] 1 f_spec_local
- 11: 0000000000008000 0 IFUNC LOCAL DEFAULT \[VARIANT_PCS\] 1 f_spec_local_ifunc
+ 10: 0000000000008000 0 NOTYPE LOCAL DEFAULT 1 f_spec_local \[VARIANT_PCS\]
+ 11: 0000000000008000 0 IFUNC LOCAL DEFAULT 1 f_spec_local_ifunc \[VARIANT_PCS\]
12: 0000000000008000 0 IFUNC LOCAL DEFAULT 1 f_base_local_ifunc
13: 0000000000008000 0 NOTYPE LOCAL DEFAULT 1 f_base_local
14: 0000000000008000 0 NOTYPE LOCAL DEFAULT 1 \$x
15: 0000000000000000 0 FILE LOCAL DEFAULT ABS .*variant_pcs-2\.o
- 16: 0000000000008038 0 NOTYPE LOCAL DEFAULT \[VARIANT_PCS\] 1 f_spec_local2
- 17: 0000000000008038 0 IFUNC LOCAL DEFAULT \[VARIANT_PCS\] 1 f_spec_local2_ifunc
+ 16: 0000000000008038 0 NOTYPE LOCAL DEFAULT 1 f_spec_local2 \[VARIANT_PCS\]
+ 17: 0000000000008038 0 IFUNC LOCAL DEFAULT 1 f_spec_local2_ifunc \[VARIANT_PCS\]
18: 0000000000008038 0 IFUNC LOCAL DEFAULT 1 f_base_local2_ifunc
19: 0000000000008038 0 NOTYPE LOCAL DEFAULT 1 f_base_local2
20: 0000000000008038 0 NOTYPE LOCAL DEFAULT 1 \$x
21: 0000000000000000 0 FILE LOCAL DEFAULT ABS
22: 0000000000009080 0 OBJECT LOCAL DEFAULT ABS _DYNAMIC
- 23: 0000000000008000 0 NOTYPE LOCAL DEFAULT \[VARIANT_PCS\] 1 f_spec_global_hidden_def
+ 23: 0000000000008000 0 NOTYPE LOCAL DEFAULT 1 f_spec_global_hidden_def \[VARIANT_PCS\]
24: 0000000000008000 0 IFUNC LOCAL DEFAULT 1 f_base_global_hidden_ifunc
25: 0000000000008000 0 NOTYPE LOCAL DEFAULT 1 f_base_global_hidden_def
26: 0000000000009000 0 OBJECT LOCAL DEFAULT ABS _GLOBAL_OFFSET_TABLE_
- 27: 0000000000008000 0 IFUNC LOCAL DEFAULT \[VARIANT_PCS\] 1 f_spec_global_hidden_ifunc
+ 27: 0000000000008000 0 IFUNC LOCAL DEFAULT 1 f_spec_global_hidden_ifunc \[VARIANT_PCS\]
28: 0000000000008070 0 NOTYPE LOCAL DEFAULT 2 \$x
29: 0000000000000000 0 NOTYPE GLOBAL DEFAULT UND f_base_global_default_undef
- 30: 0000000000000000 0 NOTYPE GLOBAL DEFAULT \[VARIANT_PCS\] UND f_spec_global_default_undef
- 31: 0000000000008000 0 IFUNC GLOBAL DEFAULT \[VARIANT_PCS\] 1 f_spec_global_default_ifunc
+ 30: 0000000000000000 0 NOTYPE GLOBAL DEFAULT UND f_spec_global_default_undef \[VARIANT_PCS\]
+ 31: 0000000000008000 0 IFUNC GLOBAL DEFAULT 1 f_spec_global_default_ifunc \[VARIANT_PCS\]
32: 0000000000008000 0 NOTYPE GLOBAL DEFAULT 1 f_base_global_default_def
- 33: 0000000000008000 0 NOTYPE GLOBAL DEFAULT \[VARIANT_PCS\] 1 f_spec_global_default_def
+ 33: 0000000000008000 0 NOTYPE GLOBAL DEFAULT 1 f_spec_global_default_def \[VARIANT_PCS\]
34: 0000000000008000 0 IFUNC GLOBAL DEFAULT 1 f_base_global_default_ifunc

View File

@ -0,0 +1,122 @@
diff -rup binutils.orig/ld/testsuite/ld-aarch64/variant_pcs-now.d binutils-2.30/ld/testsuite/ld-aarch64/variant_pcs-now.d
--- binutils.orig/ld/testsuite/ld-aarch64/variant_pcs-now.d 2020-04-06 16:21:53.296852157 +0100
+++ binutils-2.30/ld/testsuite/ld-aarch64/variant_pcs-now.d 2020-04-06 16:28:56.733001935 +0100
@@ -5,28 +5,29 @@
Relocation section '\.rela\.plt' at offset 0x11000 contains 12 entries:
Offset Info Type Symbol's Value Symbol's Name \+ Addend
-0000000000009020 0000000100000402 R_AARCH64_JUMP_SLOT 0000000000000000 f_base_global_default_undef \+ 0
-0000000000009028 0000000200000402 R_AARCH64_JUMP_SLOT 0000000000000000 f_spec_global_default_undef \+ 0
-0000000000009030 0000000400000402 R_AARCH64_JUMP_SLOT 0000000000008000 f_base_global_default_def \+ 0
-0000000000009038 0000000500000402 R_AARCH64_JUMP_SLOT 0000000000008000 f_spec_global_default_def \+ 0
+0000000000009020 0000000.00000402 R_AARCH64_JUMP_SLOT 0000000000000000 f_base_global_default_undef \+ 0
+0000000000009028 0000000.00000402 R_AARCH64_JUMP_SLOT 0000000000000000 f_spec_global_default_undef \+ 0
+0000000000009030 0000000.00000402 R_AARCH64_JUMP_SLOT 0000000000008000 f_base_global_default_def \+ 0
+0000000000009038 0000000.00000402 R_AARCH64_JUMP_SLOT 0000000000008000 f_spec_global_default_def \+ 0
0000000000009040 0000000000000408 R_AARCH64_IRELATIVE 8000
-0000000000009048 0000000300000402 R_AARCH64_JUMP_SLOT f_spec_global_default_ifunc\(\) f_spec_global_default_ifunc \+ 0
+0000000000009048 0000000.00000402 R_AARCH64_JUMP_SLOT f_spec_global_default_ifunc\(\) f_spec_global_default_ifunc \+ 0
0000000000009050 0000000000000408 R_AARCH64_IRELATIVE 8000
-0000000000009058 0000000600000402 R_AARCH64_JUMP_SLOT f_base_global_default_ifunc\(\) f_base_global_default_ifunc \+ 0
+0000000000009058 0000000.00000402 R_AARCH64_JUMP_SLOT f_base_global_default_ifunc\(\) f_base_global_default_ifunc \+ 0
0000000000009060 0000000000000408 R_AARCH64_IRELATIVE 8038
0000000000009068 0000000000000408 R_AARCH64_IRELATIVE 8000
0000000000009070 0000000000000408 R_AARCH64_IRELATIVE 8000
0000000000009078 0000000000000408 R_AARCH64_IRELATIVE 8038
-Symbol table '\.dynsym' contains 7 entries:
+Symbol table '\.dynsym' contains . entries:
Num: Value Size Type Bind Vis Ndx Name
- 0: 0000000000000000 0 NOTYPE LOCAL DEFAULT UND
- 1: 0000000000000000 0 NOTYPE GLOBAL DEFAULT UND f_base_global_default_undef
- 2: 0000000000000000 0 NOTYPE GLOBAL DEFAULT UND f_spec_global_default_undef \[VARIANT_PCS\]
- 3: 0000000000008000 0 IFUNC GLOBAL DEFAULT 1 f_spec_global_default_ifunc \[VARIANT_PCS\]
- 4: 0000000000008000 0 NOTYPE GLOBAL DEFAULT 1 f_base_global_default_def
- 5: 0000000000008000 0 NOTYPE GLOBAL DEFAULT 1 f_spec_global_default_def \[VARIANT_PCS\]
- 6: 0000000000008000 0 IFUNC GLOBAL DEFAULT 1 f_base_global_default_ifunc
+ 0: 0000000000000000 0 NOTYPE LOCAL DEFAULT UND
+#...
+ .: 0000000000000000 0 NOTYPE GLOBAL DEFAULT UND f_base_global_default_undef
+ .: 0000000000000000 0 NOTYPE GLOBAL DEFAULT UND f_spec_global_default_undef \[VARIANT_PCS\]
+ .: 0000000000008000 0 IFUNC GLOBAL DEFAULT 1 f_spec_global_default_ifunc \[VARIANT_PCS\]
+ .: 0000000000008000 0 NOTYPE GLOBAL DEFAULT 1 f_base_global_default_def
+ .: 0000000000008000 0 NOTYPE GLOBAL DEFAULT 1 f_spec_global_default_def \[VARIANT_PCS\]
+ .: 0000000000008000 0 IFUNC GLOBAL DEFAULT 1 f_base_global_default_ifunc
Symbol table '\.symtab' contains 35 entries:
Num: Value Size Type Bind Vis Ndx Name
diff -rup binutils.orig/ld/testsuite/ld-aarch64/variant_pcs-shared.d binutils-2.30/ld/testsuite/ld-aarch64/variant_pcs-shared.d
--- binutils.orig/ld/testsuite/ld-aarch64/variant_pcs-shared.d 2020-04-06 16:21:53.296852157 +0100
+++ binutils-2.30/ld/testsuite/ld-aarch64/variant_pcs-shared.d 2020-04-06 16:28:35.565094429 +0100
@@ -5,28 +5,29 @@
Relocation section '\.rela\.plt' at offset 0x11000 contains 12 entries:
Offset Info Type Symbol's Value Symbol's Name \+ Addend
-0000000000009020 0000000100000402 R_AARCH64_JUMP_SLOT 0000000000000000 f_base_global_default_undef \+ 0
-0000000000009028 0000000200000402 R_AARCH64_JUMP_SLOT 0000000000000000 f_spec_global_default_undef \+ 0
-0000000000009030 0000000400000402 R_AARCH64_JUMP_SLOT 0000000000008000 f_base_global_default_def \+ 0
-0000000000009038 0000000500000402 R_AARCH64_JUMP_SLOT 0000000000008000 f_spec_global_default_def \+ 0
+0000000000009020 0000000.00000402 R_AARCH64_JUMP_SLOT 0000000000000000 f_base_global_default_undef \+ 0
+0000000000009028 0000000.00000402 R_AARCH64_JUMP_SLOT 0000000000000000 f_spec_global_default_undef \+ 0
+0000000000009030 0000000.00000402 R_AARCH64_JUMP_SLOT 0000000000008000 f_base_global_default_def \+ 0
+0000000000009038 0000000.00000402 R_AARCH64_JUMP_SLOT 0000000000008000 f_spec_global_default_def \+ 0
0000000000009040 0000000000000408 R_AARCH64_IRELATIVE 8000
-0000000000009048 0000000300000402 R_AARCH64_JUMP_SLOT f_spec_global_default_ifunc\(\) f_spec_global_default_ifunc \+ 0
+0000000000009048 0000000.00000402 R_AARCH64_JUMP_SLOT f_spec_global_default_ifunc\(\) f_spec_global_default_ifunc \+ 0
0000000000009050 0000000000000408 R_AARCH64_IRELATIVE 8000
-0000000000009058 0000000600000402 R_AARCH64_JUMP_SLOT f_base_global_default_ifunc\(\) f_base_global_default_ifunc \+ 0
+0000000000009058 0000000.00000402 R_AARCH64_JUMP_SLOT f_base_global_default_ifunc\(\) f_base_global_default_ifunc \+ 0
0000000000009060 0000000000000408 R_AARCH64_IRELATIVE 8038
0000000000009068 0000000000000408 R_AARCH64_IRELATIVE 8000
0000000000009070 0000000000000408 R_AARCH64_IRELATIVE 8000
0000000000009078 0000000000000408 R_AARCH64_IRELATIVE 8038
-Symbol table '\.dynsym' contains 7 entries:
+Symbol table '\.dynsym' contains . entries:
Num: Value Size Type Bind Vis Ndx Name
- 0: 0000000000000000 0 NOTYPE LOCAL DEFAULT UND
- 1: 0000000000000000 0 NOTYPE GLOBAL DEFAULT UND f_base_global_default_undef
- 2: 0000000000000000 0 NOTYPE GLOBAL DEFAULT UND f_spec_global_default_undef \[VARIANT_PCS\]
- 3: 0000000000008000 0 IFUNC GLOBAL DEFAULT 1 f_spec_global_default_ifunc \[VARIANT_PCS\]
- 4: 0000000000008000 0 NOTYPE GLOBAL DEFAULT 1 f_base_global_default_def
- 5: 0000000000008000 0 NOTYPE GLOBAL DEFAULT 1 f_spec_global_default_def \[VARIANT_PCS\]
- 6: 0000000000008000 0 IFUNC GLOBAL DEFAULT 1 f_base_global_default_ifunc
+ 0: 0000000000000000 0 NOTYPE LOCAL DEFAULT UND
+#...
+ .: 0000000000000000 0 NOTYPE GLOBAL DEFAULT UND f_base_global_default_undef
+ .: 0000000000000000 0 NOTYPE GLOBAL DEFAULT UND f_spec_global_default_undef \[VARIANT_PCS\]
+ .: 0000000000008000 0 IFUNC GLOBAL DEFAULT 1 f_spec_global_default_ifunc \[VARIANT_PCS\]
+ .: 0000000000008000 0 NOTYPE GLOBAL DEFAULT 1 f_base_global_default_def
+ .: 0000000000008000 0 NOTYPE GLOBAL DEFAULT 1 f_spec_global_default_def \[VARIANT_PCS\]
+ .: 0000000000008000 0 IFUNC GLOBAL DEFAULT 1 f_base_global_default_ifunc
Symbol table '\.symtab' contains 35 entries:
Num: Value Size Type Bind Vis Ndx Name
diff -rup binutils.orig/ld/testsuite/ld-aarch64/variant_pcs-now.d binutils-2.30/ld/testsuite/ld-aarch64/variant_pcs-now.d
--- binutils.orig/ld/testsuite/ld-aarch64/variant_pcs-now.d 2020-04-06 17:27:02.890275588 +0100
+++ binutils-2.30/ld/testsuite/ld-aarch64/variant_pcs-now.d 2020-04-06 17:33:51.136464165 +0100
@@ -38,8 +38,8 @@ Symbol table '\.symtab' contains 35 entr
4: 0000000000009080 0 SECTION LOCAL DEFAULT 4
5: 0000000000011000 0 SECTION LOCAL DEFAULT 5
6: 0000000000011120 0 SECTION LOCAL DEFAULT 6
- 7: 00000000000111c8 0 SECTION LOCAL DEFAULT 7
- 8: 0000000000011270 0 SECTION LOCAL DEFAULT 8
+ 7: 00000000000111.. 0 SECTION LOCAL DEFAULT 7
+ 8: 00000000000112.. 0 SECTION LOCAL DEFAULT 8
9: 0000000000000000 0 FILE LOCAL DEFAULT ABS .*variant_pcs-1\.o
10: 0000000000008000 0 NOTYPE LOCAL DEFAULT 1 f_spec_local \[VARIANT_PCS\]
11: 0000000000008000 0 IFUNC LOCAL DEFAULT 1 f_spec_local_ifunc \[VARIANT_PCS\]
diff -rup binutils.orig/ld/testsuite/ld-aarch64/variant_pcs-shared.d binutils-2.30/ld/testsuite/ld-aarch64/variant_pcs-shared.d
--- binutils.orig/ld/testsuite/ld-aarch64/variant_pcs-shared.d 2020-04-06 17:27:02.890275588 +0100
+++ binutils-2.30/ld/testsuite/ld-aarch64/variant_pcs-shared.d 2020-04-06 17:33:56.512440347 +0100
@@ -38,8 +38,8 @@ Symbol table '\.symtab' contains 35 entr
4: 0000000000009080 0 SECTION LOCAL DEFAULT 4
5: 0000000000011000 0 SECTION LOCAL DEFAULT 5
6: 0000000000011120 0 SECTION LOCAL DEFAULT 6
- 7: 00000000000111c8 0 SECTION LOCAL DEFAULT 7
- 8: 0000000000011270 0 SECTION LOCAL DEFAULT 8
+ 7: 00000000000111.. 0 SECTION LOCAL DEFAULT 7
+ 8: 00000000000112.. 0 SECTION LOCAL DEFAULT 8
9: 0000000000000000 0 FILE LOCAL DEFAULT ABS .*variant_pcs-1\.o
10: 0000000000008000 0 NOTYPE LOCAL DEFAULT 1 f_spec_local \[VARIANT_PCS\]
11: 0000000000008000 0 IFUNC LOCAL DEFAULT 1 f_spec_local_ifunc \[VARIANT_PCS\]

View File

@ -0,0 +1,547 @@
diff -rup binutils.orig/bfd/elfnn-aarch64.c binutils-2.30/bfd/elfnn-aarch64.c
--- binutils.orig/bfd/elfnn-aarch64.c 2020-11-04 14:53:52.144476367 +0000
+++ binutils-2.30/bfd/elfnn-aarch64.c 2020-11-04 14:56:42.275422499 +0000
@@ -2191,6 +2191,9 @@ struct elf_aarch64_obj_tdata
/* Zero to warn when linking objects with incompatible wchar_t sizes. */
int no_wchar_size_warning;
+
+ /* All GNU_PROPERTY_AARCH64_FEATURE_1_AND properties. */
+ uint32_t gnu_and_prop;
};
#define elf_aarch64_tdata(bfd) \
@@ -9311,6 +9314,32 @@ elfNN_aarch64_backend_symbol_processing
sym->flags |= BSF_KEEP;
}
+/* Implement elf_backend_setup_gnu_properties for AArch64. It serves as a
+ wrapper function for _bfd_aarch64_elf_link_setup_gnu_properties to account
+ for the effect of GNU properties of the output_bfd. */
+static bfd *
+elfNN_aarch64_link_setup_gnu_properties (struct bfd_link_info *info)
+{
+ uint32_t prop = elf_aarch64_tdata (info->output_bfd)->gnu_and_prop;
+ bfd *pbfd = _bfd_aarch64_elf_link_setup_gnu_properties (info, &prop);
+ elf_aarch64_tdata (info->output_bfd)->gnu_and_prop = prop;
+ return pbfd;
+}
+
+/* Implement elf_backend_merge_gnu_properties for AArch64. It serves as a
+ wrapper function for _bfd_aarch64_elf_merge_gnu_properties to account
+ for the effect of GNU properties of the output_bfd. */
+static bfd_boolean
+elfNN_aarch64_merge_gnu_properties (struct bfd_link_info *info,
+ bfd *abfd,
+ elf_property *aprop,
+ elf_property *bprop)
+{
+ uint32_t prop
+ = elf_aarch64_tdata (info->output_bfd)->gnu_and_prop;
+ return _bfd_aarch64_elf_merge_gnu_properties (info, abfd, aprop,
+ bprop, prop);
+}
/* We use this so we can override certain functions
(though currently we don't). */
@@ -9453,6 +9482,12 @@ const struct elf_size_info elfNN_aarch64
#define elf_backend_symbol_processing \
elfNN_aarch64_backend_symbol_processing
+#define elf_backend_setup_gnu_properties \
+ elfNN_aarch64_link_setup_gnu_properties
+
+#define elf_backend_merge_gnu_properties \
+ elfNN_aarch64_merge_gnu_properties
+
#define elf_backend_can_refcount 1
#define elf_backend_can_gc_sections 1
#define elf_backend_plt_readonly 1
diff -rup binutils.orig/bfd/elfxx-aarch64.c binutils-2.30/bfd/elfxx-aarch64.c
--- binutils.orig/bfd/elfxx-aarch64.c 2020-11-04 14:53:52.138476401 +0000
+++ binutils-2.30/bfd/elfxx-aarch64.c 2020-11-04 14:56:42.276422492 +0000
@@ -660,3 +660,183 @@ _bfd_aarch64_elf_write_core_note (bfd *a
}
}
}
+
+/* Find the first input bfd with GNU property and merge it with GPROP. If no
+ such input is found, add it to a new section at the last input. Update
+ GPROP accordingly. */
+bfd *
+_bfd_aarch64_elf_link_setup_gnu_properties (struct bfd_link_info *info,
+ uint32_t *gprop)
+{
+ asection *sec;
+ bfd *pbfd;
+ bfd *ebfd = NULL;
+ elf_property *prop;
+
+ uint32_t gnu_prop = *gprop;
+
+ /* Find a normal input file with GNU property note. */
+ for (pbfd = info->input_bfds;
+ pbfd != NULL;
+ pbfd = pbfd->link.next)
+ if (bfd_get_flavour (pbfd) == bfd_target_elf_flavour
+ && bfd_count_sections (pbfd) != 0)
+ {
+ ebfd = pbfd;
+
+ if (elf_properties (pbfd) != NULL)
+ break;
+ }
+
+ /* If ebfd != NULL it is either an input with property note or the last
+ input. Either way if we have gnu_prop, we should add it (by creating
+ a section if needed). */
+ if (ebfd != NULL && gnu_prop)
+ {
+ prop = _bfd_elf_get_property (ebfd,
+ GNU_PROPERTY_AARCH64_FEATURE_1_AND,
+ 4);
+ prop->u.number |= gnu_prop;
+ prop->pr_kind = property_number;
+
+ /* pbfd being NULL implies ebfd is the last input. Create the GNU
+ property note section. */
+ if (pbfd == NULL)
+ {
+ sec = bfd_make_section_with_flags (ebfd,
+ NOTE_GNU_PROPERTY_SECTION_NAME,
+ (SEC_ALLOC
+ | SEC_LOAD
+ | SEC_IN_MEMORY
+ | SEC_READONLY
+ | SEC_HAS_CONTENTS
+ | SEC_DATA));
+ if (sec == NULL)
+ info->callbacks->einfo (
+ _("%F%P: failed to create GNU property section\n"));
+
+ elf_section_type (sec) = SHT_NOTE;
+ }
+ }
+
+ pbfd = _bfd_elf_link_setup_gnu_properties (info);
+
+ if (bfd_link_relocatable (info))
+ return pbfd;
+
+ /* If pbfd has any GNU_PROPERTY_AARCH64_FEATURE_1_AND properties, update
+ gnu_prop accordingly. */
+ if (pbfd != NULL)
+ {
+ elf_property_list *p;
+
+ /* The property list is sorted in order of type. */
+ for (p = elf_properties (pbfd); p; p = p->next)
+ {
+ /* Check for all GNU_PROPERTY_AARCH64_FEATURE_1_AND. */
+ if (GNU_PROPERTY_AARCH64_FEATURE_1_AND == p->property.pr_type)
+ {
+ gnu_prop = (p->property.u.number
+ & (GNU_PROPERTY_AARCH64_FEATURE_1_PAC
+ | GNU_PROPERTY_AARCH64_FEATURE_1_BTI));
+ break;
+ }
+ else if (GNU_PROPERTY_AARCH64_FEATURE_1_AND < p->property.pr_type)
+ break;
+ }
+ }
+ *gprop = gnu_prop;
+ return pbfd;
+}
+
+/* Define elf_backend_parse_gnu_properties for AArch64. */
+enum elf_property_kind
+_bfd_aarch64_elf_parse_gnu_properties (bfd *abfd, unsigned int type,
+ bfd_byte *ptr, unsigned int datasz)
+{
+ elf_property *prop;
+
+ switch (type)
+ {
+ case GNU_PROPERTY_AARCH64_FEATURE_1_AND:
+ if (datasz != 4)
+ {
+ _bfd_error_handler
+ ( _("error: %pB: <corrupt AArch64 used size: 0x%x>"),
+ abfd, datasz);
+ return property_corrupt;
+ }
+ prop = _bfd_elf_get_property (abfd, type, datasz);
+ /* Combine properties of the same type. */
+ prop->u.number |= bfd_h_get_32 (abfd, ptr);
+ prop->pr_kind = property_number;
+ break;
+
+ default:
+ return property_ignored;
+ }
+
+ return property_number;
+}
+
+/* Merge AArch64 GNU property BPROP with APROP also accounting for PROP.
+ If APROP isn't NULL, merge it with BPROP and/or PROP. Vice-versa if BROP
+ isn't NULL. Return TRUE if there is any update to APROP or if BPROP should
+ be merge with ABFD. */
+bfd_boolean
+_bfd_aarch64_elf_merge_gnu_properties (struct bfd_link_info *info
+ ATTRIBUTE_UNUSED,
+ bfd *abfd ATTRIBUTE_UNUSED,
+ elf_property *aprop,
+ elf_property *bprop,
+ uint32_t prop)
+{
+ unsigned int orig_number;
+ bfd_boolean updated = FALSE;
+ unsigned int pr_type = aprop != NULL ? aprop->pr_type : bprop->pr_type;
+
+ switch (pr_type)
+ {
+ case GNU_PROPERTY_AARCH64_FEATURE_1_AND:
+ {
+ if (aprop != NULL && bprop != NULL)
+ {
+ orig_number = aprop->u.number;
+ aprop->u.number = (orig_number & bprop->u.number) | prop;
+ updated = orig_number != aprop->u.number;
+ /* Remove the property if all feature bits are cleared. */
+ if (aprop->u.number == 0)
+ aprop->pr_kind = property_remove;
+ break;
+ }
+ /* If either is NULL, the AND would be 0 so, if there is
+ any PROP, asign it to the input that is not NULL. */
+ if (prop)
+ {
+ if (aprop != NULL)
+ {
+ orig_number = aprop->u.number;
+ aprop->u.number = prop;
+ updated = orig_number != aprop->u.number;
+ }
+ else
+ {
+ bprop->u.number = prop;
+ updated = TRUE;
+ }
+ }
+ /* No PROP and BPROP is NULL, so remove APROP. */
+ else if (aprop != NULL)
+ {
+ aprop->pr_kind = property_remove;
+ updated = TRUE;
+ }
+ }
+ break;
+
+ default:
+ abort ();
+ }
+
+ return updated;
+}
diff -rup binutils.orig/bfd/elfxx-aarch64.h binutils-2.30/bfd/elfxx-aarch64.h
--- binutils.orig/bfd/elfxx-aarch64.h 2020-11-04 14:53:52.134476424 +0000
+++ binutils-2.30/bfd/elfxx-aarch64.h 2020-11-04 14:56:42.276422492 +0000
@@ -65,3 +65,19 @@ _bfd_aarch64_elf_write_core_note (bfd *,
#define elf_backend_grok_prstatus _bfd_aarch64_elf_grok_prstatus
#define elf_backend_grok_psinfo _bfd_aarch64_elf_grok_psinfo
#define elf_backend_write_core_note _bfd_aarch64_elf_write_core_note
+
+extern bfd *
+_bfd_aarch64_elf_link_setup_gnu_properties (struct bfd_link_info *,
+ uint32_t *);
+
+extern enum elf_property_kind
+_bfd_aarch64_elf_parse_gnu_properties (bfd *, unsigned int,
+ bfd_byte *, unsigned int);
+
+extern bfd_boolean
+_bfd_aarch64_elf_merge_gnu_properties (struct bfd_link_info *, bfd *,
+ elf_property *, elf_property *,
+ uint32_t);
+
+#define elf_backend_parse_gnu_properties \
+ _bfd_aarch64_elf_parse_gnu_properties
diff -rup binutils.orig/binutils/readelf.c binutils-2.30/binutils/readelf.c
--- binutils.orig/binutils/readelf.c 2020-11-04 14:53:51.723478764 +0000
+++ binutils-2.30/binutils/readelf.c 2020-11-04 14:56:42.277422485 +0000
@@ -17103,6 +17103,33 @@ decode_x86_feature_2 (unsigned int bitma
}
static void
+decode_aarch64_feature_1_and (unsigned int bitmask)
+{
+ while (bitmask)
+ {
+ unsigned int bit = bitmask & (- bitmask);
+
+ bitmask &= ~ bit;
+ switch (bit)
+ {
+ case GNU_PROPERTY_AARCH64_FEATURE_1_BTI:
+ printf ("BTI");
+ break;
+
+ case GNU_PROPERTY_AARCH64_FEATURE_1_PAC:
+ printf ("PAC");
+ break;
+
+ default:
+ printf (_("<unknown: %x>"), bit);
+ break;
+ }
+ if (bitmask)
+ printf (", ");
+ }
+}
+
+static void
print_gnu_property_note (Filedata * filedata, Elf_Internal_Note * pnote)
{
unsigned char * ptr = (unsigned char *) pnote->descdata;
@@ -17236,6 +17263,18 @@ print_gnu_property_note (Filedata * file
break;
}
}
+ else if (filedata->file_header.e_machine == EM_AARCH64)
+ {
+ if (type == GNU_PROPERTY_AARCH64_FEATURE_1_AND)
+ {
+ printf ("AArch64 feature: ");
+ if (datasz != 4)
+ printf (_("<corrupt length: %#x> "), datasz);
+ else
+ decode_aarch64_feature_1_and (byte_get (ptr, 4));
+ goto next;
+ }
+ }
}
else
{
diff -rup binutils.orig/include/elf/common.h binutils-2.30/include/elf/common.h
--- binutils.orig/include/elf/common.h 2020-11-04 14:53:52.155476304 +0000
+++ binutils-2.30/include/elf/common.h 2020-11-04 14:56:42.277422485 +0000
@@ -832,6 +832,12 @@
#define GNU_PROPERTY_X86_FEATURE_2_XSAVEOPT (1U << 8)
#define GNU_PROPERTY_X86_FEATURE_2_XSAVEC (1U << 9)
+/* AArch64 specific GNU PROPERTY. */
+#define GNU_PROPERTY_AARCH64_FEATURE_1_AND 0xc0000000
+
+#define GNU_PROPERTY_AARCH64_FEATURE_1_BTI (1U << 0)
+#define GNU_PROPERTY_AARCH64_FEATURE_1_PAC (1U << 1)
+
/* Values used in GNU .note.ABI-tag notes (NT_GNU_ABI_TAG). */
#define GNU_ABI_TAG_LINUX 0
#define GNU_ABI_TAG_HURD 1
diff -rup binutils.orig/ld/testsuite/ld-aarch64/aarch64-elf.exp binutils-2.30/ld/testsuite/ld-aarch64/aarch64-elf.exp
--- binutils.orig/ld/testsuite/ld-aarch64/aarch64-elf.exp 2020-11-04 14:53:51.843478081 +0000
+++ binutils-2.30/ld/testsuite/ld-aarch64/aarch64-elf.exp 2020-11-04 14:56:42.278422479 +0000
@@ -337,6 +337,10 @@ run_dump_test_lp64 "variant_pcs-r"
run_dump_test_lp64 "variant_pcs-shared"
run_dump_test_lp64 "variant_pcs-now"
+run_dump_test "property-bti-pac1"
+run_dump_test "property-bti-pac2"
+run_dump_test "property-bti-pac3"
+
set aarch64elflinktests {
{"ld-aarch64/so with global symbol" "-shared" "" "" {copy-reloc-so.s}
{} "copy-reloc-so.so"}
--- /dev/null 2020-11-04 08:04:13.849482156 +0000
+++ binutils-2.30/ld/testsuite/ld-aarch64/property-bti-pac1.d 2020-11-04 14:56:42.278422479 +0000
@@ -0,0 +1,11 @@
+#name: GNU Property (single input, combine section)
+#source: property-bti-pac1.s
+#as: -march=armv8.5-a -defsym __mult__=0
+#ld: -shared
+#readelf: -n
+#target: *linux*
+
+Displaying notes found in: .note.gnu.property
+ Owner Data size Description
+ GNU 0x00000010 NT_GNU_PROPERTY_TYPE_0
+ Properties: AArch64 feature: BTI, PAC
--- /dev/null 2020-11-04 08:04:13.849482156 +0000
+++ binutils-2.30/ld/testsuite/ld-aarch64/property-bti-pac1.s 2020-11-04 14:56:42.278422479 +0000
@@ -0,0 +1,37 @@
+ .text
+ .globl _start
+ .type _start,@function
+_start:
+ mov x1, #2
+.ifndef __mult__
+ bl foo
+.endif
+ .section ".note.gnu.property", "a"
+ .p2align 3
+ .long 1f - 0f /* name length */
+ .long 5f - 2f /* data length */
+ .long 5 /* note type */
+0: .asciz "GNU" /* vendor name */
+1:
+ .p2align 3
+2: .long 0xc0000000 /* pr_type. */
+ .long 4f - 3f /* pr_datasz. */
+3:
+ .long 0x2 /* PAC. */
+4:
+ .p2align 3
+5:
+ .p2align 3
+ .long 1f - 0f /* name length */
+ .long 5f - 2f /* data length */
+ .long 5 /* note type */
+0: .asciz "GNU" /* vendor name */
+1:
+ .p2align 3
+2: .long 0xc0000000 /* pr_type. */
+ .long 4f - 3f /* pr_datasz. */
+3:
+ .long 0x1 /* BTI. */
+4:
+ .p2align 3
+5:
--- /dev/null 2020-11-04 08:04:13.849482156 +0000
+++ binutils-2.30/ld/testsuite/ld-aarch64/property-bti-pac2.s 2020-11-04 14:56:42.278422479 +0000
@@ -0,0 +1,50 @@
+ .text
+ .global foo
+ .type foo, %function
+foo:
+ sub sp, sp, #16
+ mov w0, 9
+ str w0, [sp, 12]
+ ldr w0, [sp, 12]
+ add w0, w0, 4
+ str w0, [sp, 12]
+ nop
+ add sp, sp, 16
+ ret
+ .size foo, .-foo
+ .global bar
+ .type bar, %function
+.ifdef __property_bti__
+ .section ".note.gnu.property", "a"
+ .p2align 3
+ .long 1f - 0f /* name length */
+ .long 5f - 2f /* data length */
+ .long 5 /* note type */
+0: .asciz "GNU" /* vendor name */
+1:
+ .p2align 3
+2: .long 0xc0000000 /* pr_type. */
+ .long 4f - 3f /* pr_datasz. */
+3:
+ .long 0x1 /* BTI. */
+4:
+ .p2align 3
+5:
+.endif
+.ifdef __property_pac__
+ .section ".note.gnu.property", "a"
+ .p2align 3
+ .long 1f - 0f /* name length */
+ .long 5f - 2f /* data length */
+ .long 5 /* note type */
+0: .asciz "GNU" /* vendor name */
+1:
+ .p2align 3
+2: .long 0xc0000000 /* pr_type. */
+ .long 4f - 3f /* pr_datasz. */
+3:
+ .long 0x2 /* PAC. */
+4:
+ .p2align 3
+5:
+.endif
--- /dev/null 2020-11-04 08:04:13.849482156 +0000
+++ binutils-2.30/ld/testsuite/ld-aarch64/property-bti-pac2.d 2020-11-04 14:56:42.278422479 +0000
@@ -0,0 +1,12 @@
+#name: GNU Property (combine multiple with BTI)
+#source: property-bti-pac1.s
+#source: property-bti-pac2.s
+#as: -mabi=lp64 -defsym __property_bti__=1
+#ld: -e _start
+#readelf: -n
+#target: *linux*
+
+Displaying notes found in: .note.gnu.property
+ Owner Data size Description
+ GNU 0x00000010 NT_GNU_PROPERTY_TYPE_0
+ Properties: AArch64 feature: BTI
--- /dev/null 2020-11-04 08:04:13.849482156 +0000
+++ binutils-2.30/ld/testsuite/ld-aarch64/property-bti-pac3.d 2020-11-04 14:56:42.278422479 +0000
@@ -0,0 +1,12 @@
+#name: GNU Property (combine multiple with PAC)
+#source: property-bti-pac1.s
+#source: property-bti-pac2.s
+#as: -mabi=lp64 -defsym __property_pac__=1
+#ld: -e _start
+#readelf: -n
+#target: *linux*
+
+Displaying notes found in: .note.gnu.property
+ Owner Data size Description
+ GNU 0x00000010 NT_GNU_PROPERTY_TYPE_0
+ Properties: AArch64 feature: PAC
diff -rup binutils.orig/bfd/elfnn-aarch64.c binutils-2.30/bfd/elfnn-aarch64.c
--- binutils.orig/bfd/elfnn-aarch64.c 2020-11-25 11:53:26.648275978 +0000
+++ binutils-2.30/bfd/elfnn-aarch64.c 2020-11-25 12:21:39.276864970 +0000
@@ -9331,12 +9331,14 @@ elfNN_aarch64_link_setup_gnu_properties
for the effect of GNU properties of the output_bfd. */
static bfd_boolean
elfNN_aarch64_merge_gnu_properties (struct bfd_link_info *info,
- bfd *abfd,
- elf_property *aprop,
- elf_property *bprop)
+ bfd *abfd,
+ bfd *bbfd ATTRIBUTE_UNUSED,
+ elf_property *aprop,
+ elf_property *bprop)
{
uint32_t prop
= elf_aarch64_tdata (info->output_bfd)->gnu_and_prop;
+
return _bfd_aarch64_elf_merge_gnu_properties (info, abfd, aprop,
bprop, prop);
}
diff -rup binutils.orig/bfd/elfxx-aarch64.c binutils-2.30/bfd/elfxx-aarch64.c
--- binutils.orig/bfd/elfxx-aarch64.c 2020-11-25 11:53:26.655275930 +0000
+++ binutils-2.30/bfd/elfxx-aarch64.c 2020-11-25 12:21:34.689895875 +0000
@@ -22,6 +22,7 @@
#include "elfxx-aarch64.h"
#include <stdarg.h>
#include <string.h>
+#include "libbfd.h"
#define MASK(n) ((1u << (n)) - 1)
@@ -835,7 +836,10 @@ _bfd_aarch64_elf_merge_gnu_properties (s
break;
default:
- abort ();
+ _bfd_error_handler
+ ( _("error: %pB: <corrupt AArch64 property note: 0x%x>"),
+ abfd, pr_type);
+ return FALSE;
}
return updated;
diff -rup binutils.orig/ld/testsuite/ld-aarch64/property-bti-pac1.d binutils-2.30/ld/testsuite/ld-aarch64/property-bti-pac1.d
--- binutils.orig/ld/testsuite/ld-aarch64/property-bti-pac1.d 2020-11-25 11:53:26.344278044 +0000
+++ binutils-2.30/ld/testsuite/ld-aarch64/property-bti-pac1.d 2020-11-25 11:57:53.179471900 +0000
@@ -1,6 +1,6 @@
#name: GNU Property (single input, combine section)
#source: property-bti-pac1.s
-#as: -march=armv8.5-a -defsym __mult__=0
+#as: -defsym __mult__=0
#ld: -shared
#readelf: -n
#target: *linux*

View File

@ -0,0 +1,82 @@
diff -rup binutils.orig/gas/config/tc-aarch64.c binutils-2.30/gas/config/tc-aarch64.c
--- binutils.orig/gas/config/tc-aarch64.c 2022-04-05 10:30:32.735881142 +0100
+++ binutils-2.30/gas/config/tc-aarch64.c 2022-04-05 10:31:28.198694747 +0100
@@ -8553,6 +8553,8 @@ static const struct aarch64_option_cpu_v
{"sha3", AARCH64_FEATURE (AARCH64_FEATURE_SHA2
| AARCH64_FEATURE_SHA3, 0),
AARCH64_ARCH_NONE},
+ {"rng", AARCH64_FEATURE (AARCH64_FEATURE_RNG, 0),
+ AARCH64_ARCH_NONE},
{NULL, AARCH64_ARCH_NONE, AARCH64_ARCH_NONE},
};
diff -rup binutils.orig/gas/doc/c-aarch64.texi binutils-2.30/gas/doc/c-aarch64.texi
--- binutils.orig/gas/doc/c-aarch64.texi 2022-04-05 10:30:32.735881142 +0100
+++ binutils-2.30/gas/doc/c-aarch64.texi 2022-04-05 10:32:35.814423321 +0100
@@ -179,6 +179,8 @@ automatically cause those extensions to
@item @code{fp16fml} @tab ARMv8.2-A @tab ARMv8.4-A or later
@tab Enable ARMv8.2 16-bit floating-point multiplication variant support.
This implies @code{fp16}.
+@item @code{rng} @tab ARMv8.5-A @tab No
+ @tab Enable ARMv8.5-A random number instructions.
@end multitable
@node AArch64 Syntax
Only in binutils-2.30/gas/testsuite/gas/aarch64: rng-1.d
Only in binutils-2.30/gas/testsuite/gas/aarch64: rng-1.s
diff -rup binutils.orig/include/opcode/aarch64.h binutils-2.30/include/opcode/aarch64.h
--- binutils.orig/include/opcode/aarch64.h 2022-04-05 10:30:33.256879707 +0100
+++ binutils-2.30/include/opcode/aarch64.h 2022-04-05 10:42:30.241087320 +0100
@@ -62,6 +62,7 @@ typedef uint32_t aarch64_insn;
#define AARCH64_FEATURE_COMPNUM 0x40000000 /* Complex # instructions. */
#define AARCH64_FEATURE_DOTPROD 0x080000000 /* Dot Product instructions. */
#define AARCH64_FEATURE_F16_FML 0x1000000000ULL /* v8.2 FP16FML ins. */
+#define AARCH64_FEATURE_RNG 0x80000000000ULL /* Random Number instructions. */
/* Architectures are the sum of the base and extensions. */
#define AARCH64_ARCH_V8 AARCH64_FEATURE (AARCH64_FEATURE_V8, \
diff -rup binutils.orig/opcodes/aarch64-opc.c binutils-2.30/opcodes/aarch64-opc.c
--- binutils.orig/opcodes/aarch64-opc.c 2022-04-05 10:30:33.019880360 +0100
+++ binutils-2.30/opcodes/aarch64-opc.c 2022-04-05 10:58:07.179526356 +0100
@@ -3823,6 +3823,8 @@ const aarch64_sys_reg aarch64_sys_regs [
{ "contextidr_el1", CPENC(3,0,C13,C0,1), 0 },
{ "contextidr_el2", CPENC (3, 4, C13, C0, 1), F_ARCHEXT },
{ "contextidr_el12", CPENC (3, 5, C13, C0, 1), F_ARCHEXT },
+ { "rndr", CPENC(3,3,C2,C4,0), F_ARCHEXT }, /* RO */
+ { "rndrrs", CPENC(3,3,C2,C4,1), F_ARCHEXT }, /* RO */
{ "tpidr_el0", CPENC(3,3,C13,C0,2), 0 },
{ "tpidrro_el0", CPENC(3,3,C13,C0,3), 0 }, /* RO */
{ "tpidr_el1", CPENC(3,0,C13,C0,4), 0 },
@@ -4254,6 +4256,13 @@ aarch64_sys_reg_supported_p (const aarch
&& !AARCH64_CPU_HAS_FEATURE (features, AARCH64_FEATURE_V8_4))
return FALSE;
+ /* Random Number Instructions. For now they are available
+ (and optional) only with ARMv8.5-A. */
+ if (( reg->value == CPENC (3, 3, C2, C4, 0)
+ || reg->value == CPENC (3, 3, C2, C4, 1))
+ && !(AARCH64_CPU_HAS_FEATURE (features, AARCH64_FEATURE_RNG)))
+ return FALSE;
+
return TRUE;
}
--- /dev/null 2022-04-05 09:32:54.900867346 +0100
+++ binutils-2.30/gas/testsuite/gas/aarch64/rng-1.s 2022-04-05 10:36:04.921589937 +0100
@@ -0,0 +1,3 @@
+ .arch armv8.4-a+rng
+ mrs x5, rndr
+ mrs x6, rndrrs
--- /dev/null 2022-04-05 09:32:54.900867346 +0100
+++ binutils-2.30/gas/testsuite/gas/aarch64/rng-1.d 2022-04-05 10:35:48.937653638 +0100
@@ -0,0 +1,10 @@
+#source: rng-1.s
+#objdump: -dr
+
+.*: file format .*
+
+Disassembly of section \.text:
+
+0+ <.*>:
+.*: d53b2405 mrs x5, rndr
+.*: d53b2426 mrs x6, rndrrs

View File

@ -0,0 +1,306 @@
diff -rup binutils.orig/bfd/cofflink.c binutils-2.30/bfd/cofflink.c
--- binutils.orig/bfd/cofflink.c 2021-06-15 15:38:31.578170486 +0100
+++ binutils-2.30/bfd/cofflink.c 2021-06-15 15:59:12.394611963 +0100
@@ -3084,8 +3084,8 @@ _bfd_coff_generic_relocate_section (bfd
then zero this reloc field. */
if (sec != NULL && discarded_section (sec))
{
- _bfd_clear_contents (howto, input_bfd, input_section,
- contents + (rel->r_vaddr - input_section->vma));
+ (void) _bfd_clear_contents (howto, input_bfd, input_section,
+ contents, (rel->r_vaddr - input_section->vma));
continue;
}
diff -rup binutils.orig/bfd/dwarf2.c binutils-2.30/bfd/dwarf2.c
--- binutils.orig/bfd/dwarf2.c 2021-06-15 15:38:31.597170370 +0100
+++ binutils-2.30/bfd/dwarf2.c 2021-06-15 15:42:19.979779516 +0100
@@ -2865,7 +2865,9 @@ find_abstract_instance_name (struct comp
info_ptr = unit->stash->info_ptr_memory;
info_ptr_end = unit->stash->info_ptr_end;
total = info_ptr_end - info_ptr;
- if (!die_ref || die_ref >= total)
+ if (!die_ref)
+ return TRUE;
+ if (die_ref >= total)
{
_bfd_error_handler
(_("Dwarf Error: Invalid abstract instance DIE ref."));
diff -rup binutils.orig/bfd/elf-bfd.h binutils-2.30/bfd/elf-bfd.h
--- binutils.orig/bfd/elf-bfd.h 2021-06-15 15:38:31.595170382 +0100
+++ binutils-2.30/bfd/elf-bfd.h 2021-06-15 15:58:55.365715715 +0100
@@ -2829,8 +2829,8 @@ extern asection _bfd_elf_large_com_secti
howto, index, contents) \
{ \
int i_; \
- _bfd_clear_contents (howto, input_bfd, input_section, \
- contents + rel[index].r_offset); \
+ (void) _bfd_clear_contents (howto, input_bfd, input_section, \
+ contents, rel[index].r_offset); \
\
if (bfd_link_relocatable (info) \
&& (input_section->flags & SEC_DEBUGGING)) \
diff -rup binutils.orig/bfd/elf32-arc.c binutils-2.30/bfd/elf32-arc.c
--- binutils.orig/bfd/elf32-arc.c 2021-06-15 15:38:31.579170480 +0100
+++ binutils-2.30/bfd/elf32-arc.c 2021-06-15 15:58:28.869877138 +0100
@@ -1532,8 +1532,8 @@ elf_arc_relocate_section (bfd * outp
/* Clean relocs for symbols in discarded sections. */
if (sec != NULL && discarded_section (sec))
{
- _bfd_clear_contents (howto, input_bfd, input_section,
- contents + rel->r_offset);
+ (void) _bfd_clear_contents (howto, input_bfd, input_section,
+ contents, rel->r_offset);
rel->r_offset = rel->r_offset;
rel->r_info = 0;
rel->r_addend = 0;
diff -rup binutils.orig/bfd/elf32-i386.c binutils-2.30/bfd/elf32-i386.c
--- binutils.orig/bfd/elf32-i386.c 2021-06-15 15:38:31.578170486 +0100
+++ binutils-2.30/bfd/elf32-i386.c 2021-06-15 15:58:12.694975692 +0100
@@ -2165,8 +2165,8 @@ elf_i386_relocate_section (bfd *output_b
if (sec != NULL && discarded_section (sec))
{
- _bfd_clear_contents (howto, input_bfd, input_section,
- contents + rel->r_offset);
+ (void) _bfd_clear_contents (howto, input_bfd, input_section,
+ contents, rel->r_offset);
wrel->r_offset = rel->r_offset;
wrel->r_info = 0;
wrel->r_addend = 0;
diff -rup binutils.orig/bfd/elf32-metag.c binutils-2.30/bfd/elf32-metag.c
--- binutils.orig/bfd/elf32-metag.c 2021-06-15 15:38:31.593170394 +0100
+++ binutils-2.30/bfd/elf32-metag.c 2021-06-15 15:57:48.039125909 +0100
@@ -1392,8 +1392,8 @@ metag_final_link_relocate (reloc_howto_t
#define METAG_RELOC_AGAINST_DISCARDED_SECTION(info, input_bfd, input_section, \
rel, relend, howto, contents) \
{ \
- _bfd_clear_contents (howto, input_bfd, input_section, \
- contents + rel->r_offset); \
+ (void) _bfd_clear_contents (howto, input_bfd, input_section, \
+ contents, rel->r_offset); \
\
if (bfd_link_relocatable (info) \
&& (input_section->flags & SEC_DEBUGGING)) \
diff -rup binutils.orig/bfd/elf32-nds32.c binutils-2.30/bfd/elf32-nds32.c
--- binutils.orig/bfd/elf32-nds32.c 2021-06-15 15:38:31.589170419 +0100
+++ binutils-2.30/bfd/elf32-nds32.c 2021-06-15 15:56:30.184600239 +0100
@@ -12771,18 +12771,17 @@ nds32_elf_get_relocated_section_contents
symbol = *(*parent)->sym_ptr_ptr;
if (symbol->section && discarded_section (symbol->section))
{
- bfd_byte *p;
+ bfd_vma off;
static reloc_howto_type none_howto
= HOWTO (0, 0, 0, 0, FALSE, 0, complain_overflow_dont, NULL,
"unused", FALSE, 0, 0, FALSE);
- p = data + (*parent)->address * bfd_octets_per_byte (input_bfd);
- _bfd_clear_contents ((*parent)->howto, input_bfd, input_section,
- p);
- (*parent)->sym_ptr_ptr = bfd_abs_section_ptr->symbol_ptr_ptr;
+ off = (*parent)->address * bfd_octets_per_byte (input_bfd);
+ r = _bfd_clear_contents ((*parent)->howto, input_bfd,
+ input_section, data, off);
+ (*parent)->sym_ptr_ptr = bfd_abs_section_ptr->symbol_ptr_ptr;
(*parent)->addend = 0;
(*parent)->howto = &none_howto;
- r = bfd_reloc_ok;
}
else
r = bfd_perform_relocation (input_bfd, *parent, data,
diff -rup binutils.orig/bfd/elf32-ppc.c binutils-2.30/bfd/elf32-ppc.c
--- binutils.orig/bfd/elf32-ppc.c 2021-06-15 15:38:31.597170370 +0100
+++ binutils-2.30/bfd/elf32-ppc.c 2021-06-15 15:56:39.367544293 +0100
@@ -7778,8 +7778,8 @@ ppc_elf_relocate_section (bfd *output_bf
if (r_type < R_PPC_max)
howto = ppc_elf_howto_table[r_type];
- _bfd_clear_contents (howto, input_bfd, input_section,
- contents + rel->r_offset);
+ (void) _bfd_clear_contents (howto, input_bfd, input_section,
+ contents, rel->r_offset);
wrel->r_offset = rel->r_offset;
wrel->r_info = 0;
wrel->r_addend = 0;
diff -rup binutils.orig/bfd/elf32-visium.c binutils-2.30/bfd/elf32-visium.c
--- binutils.orig/bfd/elf32-visium.c 2021-06-15 15:38:31.580170473 +0100
+++ binutils-2.30/bfd/elf32-visium.c 2021-06-15 15:57:29.271240254 +0100
@@ -616,8 +616,8 @@ visium_elf_relocate_section (bfd *output
/* For relocs against symbols from removed linkonce sections,
or sections discarded by a linker script, we just want the
section contents zeroed. Avoid any special processing. */
- _bfd_clear_contents (howto, input_bfd, input_section,
- contents + rel->r_offset);
+ (void) _bfd_clear_contents (howto, input_bfd, input_section,
+ contents, rel->r_offset);
rel->r_info = 0;
rel->r_addend = 0;
diff -rup binutils.orig/bfd/elf64-ppc.c binutils-2.30/bfd/elf64-ppc.c
--- binutils.orig/bfd/elf64-ppc.c 2021-06-15 15:38:31.578170486 +0100
+++ binutils-2.30/bfd/elf64-ppc.c 2021-06-15 15:57:01.529409265 +0100
@@ -13526,9 +13526,9 @@ ppc64_elf_relocate_section (bfd *output_
if (sec != NULL && discarded_section (sec))
{
- _bfd_clear_contents (ppc64_elf_howto_table[r_type],
- input_bfd, input_section,
- contents + rel->r_offset);
+ (void) _bfd_clear_contents (ppc64_elf_howto_table[r_type],
+ input_bfd, input_section,
+ contents, rel->r_offset);
wrel->r_offset = rel->r_offset;
wrel->r_info = 0;
wrel->r_addend = 0;
diff -rup binutils.orig/bfd/elf64-x86-64.c binutils-2.30/bfd/elf64-x86-64.c
--- binutils.orig/bfd/elf64-x86-64.c 2021-06-15 15:38:31.585170443 +0100
+++ binutils-2.30/bfd/elf64-x86-64.c 2021-06-15 15:57:09.831358693 +0100
@@ -2457,8 +2457,8 @@ elf_x86_64_relocate_section (bfd *output
if (sec != NULL && discarded_section (sec))
{
- _bfd_clear_contents (howto, input_bfd, input_section,
- contents + rel->r_offset);
+ (void) _bfd_clear_contents (howto, input_bfd, input_section,
+ contents, rel->r_offset);
wrel->r_offset = rel->r_offset;
wrel->r_info = 0;
wrel->r_addend = 0;
diff -rup binutils.orig/bfd/libbfd-in.h binutils-2.30/bfd/libbfd-in.h
--- binutils.orig/bfd/libbfd-in.h 2021-06-15 15:38:31.593170394 +0100
+++ binutils-2.30/bfd/libbfd-in.h 2021-06-15 15:54:10.856449129 +0100
@@ -674,8 +674,9 @@ extern bfd_reloc_status_type _bfd_reloca
(reloc_howto_type *, bfd *, bfd_vma, bfd_byte *);
/* Clear a given location using a given howto. */
-extern void _bfd_clear_contents (reloc_howto_type *howto, bfd *input_bfd,
- asection *input_section, bfd_byte *location);
+extern bfd_reloc_status_type _bfd_clear_contents
+ (reloc_howto_type *howto, bfd *input_bfd,
+ asection *input_section, bfd_byte *, bfd_vma);
/* Link stabs in sections in the first pass. */
diff -rup binutils.orig/bfd/libbfd.h binutils-2.30/bfd/libbfd.h
--- binutils.orig/bfd/libbfd.h 2021-06-15 15:38:31.581170467 +0100
+++ binutils-2.30/bfd/libbfd.h 2021-06-15 15:53:55.863540475 +0100
@@ -679,8 +679,9 @@ extern bfd_reloc_status_type _bfd_reloca
(reloc_howto_type *, bfd *, bfd_vma, bfd_byte *);
/* Clear a given location using a given howto. */
-extern void _bfd_clear_contents (reloc_howto_type *howto, bfd *input_bfd,
- asection *input_section, bfd_byte *location);
+extern bfd_reloc_status_type _bfd_clear_contents
+ (reloc_howto_type *howto, bfd *input_bfd,
+ asection *input_section, bfd_byte *, bfd_vma);
/* Link stabs in sections in the first pass. */
diff -rup binutils.orig/bfd/reloc.c binutils-2.30/bfd/reloc.c
--- binutils.orig/bfd/reloc.c 2021-06-15 15:38:31.593170394 +0100
+++ binutils-2.30/bfd/reloc.c 2021-06-15 15:51:59.449249747 +0100
@@ -1604,23 +1604,29 @@ _bfd_relocate_contents (reloc_howto_type
relocations against discarded symbols, to make ignorable debug or unwind
information more obvious. */
-void
+bfd_reloc_status_type
_bfd_clear_contents (reloc_howto_type *howto,
bfd *input_bfd,
asection *input_section,
- bfd_byte *location)
+ bfd_byte *buf,
+ bfd_vma off)
{
int size;
bfd_vma x = 0;
+ bfd_byte *location;
+
+ if (!bfd_reloc_offset_in_range (howto, input_bfd, input_section, off))
+ return bfd_reloc_outofrange;
/* Get the value we are going to relocate. */
- size = bfd_get_reloc_size (howto);
+ location = buf + off;
+ size = bfd_get_reloc_size (howto);
switch (size)
{
default:
- abort ();
+ return bfd_reloc_notsupported;
case 0:
- return;
+ return bfd_reloc_ok;
case 1:
x = bfd_get_8 (input_bfd, location);
break;
@@ -1634,7 +1640,7 @@ _bfd_clear_contents (reloc_howto_type *h
#ifdef BFD64
x = bfd_get_64 (input_bfd, location);
#else
- abort ();
+ return bfd_reloc_notsupported;
#endif
break;
}
@@ -1654,7 +1660,7 @@ _bfd_clear_contents (reloc_howto_type *h
{
default:
case 0:
- abort ();
+ return bfd_reloc_notsupported;
case 1:
bfd_put_8 (input_bfd, x, location);
break;
@@ -1668,10 +1674,12 @@ _bfd_clear_contents (reloc_howto_type *h
#ifdef BFD64
bfd_put_64 (input_bfd, x, location);
#else
- abort ();
+ return bfd_reloc_notsupported;
#endif
break;
}
+
+ return bfd_reloc_ok;
}
/*
@@ -8209,20 +8217,30 @@ bfd_generic_get_relocated_section_conten
goto error_return;
}
- if (symbol->section && discarded_section (symbol->section))
+ /* Zap reloc field when the symbol is from a discarded
+ section, ignoring any addend. Do the same when called
+ from bfd_simple_get_relocated_section_contents for
+ undefined symbols in debug sections. This is to keep
+ debug info reasonably sane, in particular so that
+ DW_FORM_ref_addr to another file's .debug_info isn't
+ confused with an offset into the current file's
+ .debug_info. */
+ if ((symbol->section != NULL && discarded_section (symbol->section))
+ || (symbol->section == bfd_und_section_ptr
+ && (input_section->flags & SEC_DEBUGGING) != 0
+ && link_info->input_bfds == link_info->output_bfd))
{
- bfd_byte *p;
+ bfd_vma off;
static reloc_howto_type none_howto
= HOWTO (0, 0, 0, 0, FALSE, 0, complain_overflow_dont, NULL,
"unused", FALSE, 0, 0, FALSE);
- p = data + (*parent)->address * bfd_octets_per_byte (input_bfd);
- _bfd_clear_contents ((*parent)->howto, input_bfd, input_section,
- p);
+ off = (*parent)->address * bfd_octets_per_byte (input_bfd);
+ r = _bfd_clear_contents ((*parent)->howto, input_bfd,
+ input_section, data, off);
(*parent)->sym_ptr_ptr = bfd_abs_section_ptr->symbol_ptr_ptr;
(*parent)->addend = 0;
(*parent)->howto = &none_howto;
- r = bfd_reloc_ok;
}
else
r = bfd_perform_relocation (input_bfd,

View File

@ -0,0 +1,14 @@
--- binutils.orig/bfd/coffgen.c 2022-04-25 13:43:52.724745386 +0100
+++ binutils-2.30/bfd/coffgen.c 2022-04-25 13:46:39.583596137 +0100
@@ -1838,10 +1838,7 @@ coff_get_normalized_symtab (bfd *abfd)
internal_ptr->is_sym = TRUE;
/* PR 17512: file: 1353-1166-0.004. */
- if (symbol_ptr->u.syment.n_sclass == C_FILE
- && symbol_ptr->u.syment.n_numaux > 0
- && raw_src + symesz + symbol_ptr->u.syment.n_numaux
- * symesz > raw_end)
+ if (symbol_ptr->u.syment.n_numaux > ((raw_end - 1) - raw_src) / symesz)
{
bfd_release (abfd, internal);
return NULL;

View File

@ -0,0 +1,29 @@
--- binutils.orig/bfd/elflink.c 2020-12-08 17:45:26.487260908 +0000
+++ binutils-2.30/bfd/elflink.c 2020-12-08 17:48:06.650728413 +0000
@@ -1895,7 +1895,7 @@ _bfd_elf_add_default_symbol (bfd *abfd,
if (skip)
goto nondefault;
- if (hi->def_regular)
+ if (hi->def_regular || ELF_COMMON_DEF_P (hi))
{
/* If the undecorated symbol will have a version added by a
script different to H, then don't indirect to/from the
@@ -2236,7 +2236,7 @@ _bfd_elf_link_assign_sym_version (struct
/* We only need version numbers for symbols defined in regular
objects. */
- if (!h->def_regular)
+ if (!h->def_regular && !ELF_COMMON_DEF_P (h))
return TRUE;
bed = get_elf_backend_data (info->output_bfd);
@@ -9957,7 +9957,7 @@ elf_link_output_extsym (struct bfd_hash_
Elf_Internal_Versym iversym;
Elf_External_Versym *eversym;
- if (!h->def_regular)
+ if (!h->def_regular && !ELF_COMMON_DEF_P (h))
{
if (h->verinfo.verdef == NULL
|| (elf_dyn_lib_class (h->verinfo.verdef->vd_bfd)

View File

@ -0,0 +1,591 @@
diff -rup binutils.orig/bfd/elf-bfd.h binutils-2.30/bfd/elf-bfd.h
--- binutils.orig/bfd/elf-bfd.h 2020-02-12 13:31:20.348605538 +0000
+++ binutils-2.30/bfd/elf-bfd.h 2020-02-12 13:31:33.831507582 +0000
@@ -1479,6 +1479,19 @@ struct elf_backend_data
/* Opcode representing no unwind. */
int (*cant_unwind_opcode) (struct bfd_link_info *);
+ /* Called when a section has extra reloc sections. */
+ bfd_boolean (*init_secondary_reloc_section) (bfd *, Elf_Internal_Shdr *, const char *, unsigned int);
+
+ /* Called when after loading the normal relocs for a section. */
+ bfd_boolean (*slurp_secondary_relocs) (bfd *, asection *, asymbol **);
+
+ /* Called after writing the normal relocs for a section. */
+ bfd_boolean (*write_secondary_relocs) (bfd *, asection *);
+
+ /* Called to return the value to set in the ST_SHNDX field of an ELF symbol
+ from an iternal symbol which does not map to any known section. */
+ unsigned int (*symbol_section_index) (bfd *, elf_symbol_type *);
+
/* This is non-zero if static TLS segments require a special alignment. */
unsigned static_tls_alignment;
@@ -2696,6 +2709,19 @@ extern bfd_vma elf64_r_sym (bfd_vma);
extern bfd_vma elf32_r_info (bfd_vma, bfd_vma);
extern bfd_vma elf32_r_sym (bfd_vma);
+
+extern bfd_boolean _bfd_elf_init_secondary_reloc_section
+ (bfd *, Elf_Internal_Shdr *, const char *, unsigned int);
+extern bfd_boolean _bfd_elf_slurp_secondary_reloc_section
+ (bfd *, asection *, asymbol **);
+extern bfd_boolean _bfd_elf_copy_special_section_fields
+ (const bfd *, bfd *, const Elf_Internal_Shdr *, Elf_Internal_Shdr *);
+extern bfd_boolean _bfd_elf_write_secondary_reloc_section
+ (bfd *, asection *);
+extern unsigned int _bfd_elf_symbol_section_index
+ (bfd *, elf_symbol_type *);
+
+
/* Large common section. */
extern asection _bfd_elf_large_com_section;
diff -rup binutils.orig/bfd/elf.c binutils-2.30/bfd/elf.c
--- binutils.orig/bfd/elf.c 2020-02-12 13:31:20.347605546 +0000
+++ binutils-2.30/bfd/elf.c 2020-02-12 13:33:19.635738944 +0000
@@ -1572,7 +1572,7 @@ _bfd_elf_copy_private_bfd_data (bfd *ibf
/* Final attempt. Call the backend copy function
with a NULL input section. */
if (bed->elf_backend_copy_special_section_fields != NULL)
- bed->elf_backend_copy_special_section_fields (ibfd, obfd, NULL, oheader);
+ (void) bed->elf_backend_copy_special_section_fields (ibfd, obfd, NULL, oheader);
}
}
@@ -2416,11 +2416,14 @@ bfd_section_from_shdr (bfd *abfd, unsign
sections. */
if (*p_hdr != NULL)
{
- _bfd_error_handler
- /* xgettext:c-format */
- (_("%B: warning: multiple relocation sections for section %A \
-found - ignoring all but the first"),
- abfd, target_sect);
+ if (bed->init_secondary_reloc_section == NULL
+ || ! bed->init_secondary_reloc_section (abfd, hdr, name, shindex))
+ {
+ _bfd_error_handler
+ /* xgettext:c-format */
+ (_("%pB: warning: secondary relocation section '%s' for section %pA found - ignoring"),
+ abfd, name, target_sect);
+ }
goto success;
}
hdr2 = (Elf_Internal_Shdr *) bfd_alloc (abfd, sizeof (*hdr2));
@@ -7948,9 +7951,20 @@ error_return:
if (elf_symtab_shndx_list (abfd))
shndx = elf_symtab_shndx_list (abfd)->ndx;
break;
- default:
+ case SHN_COMMON:
+ case SHN_ABS:
shndx = SHN_ABS;
break;
+ default:
+ if (bed->symbol_section_index)
+ shndx = bed->symbol_section_index (abfd, type_ptr);
+ else
+ {
+ _bfd_error_handler (_("%pB: Unable to handle section index %x in ELF symbol. Using ABS instead. (%x)"),
+ abfd, shndx, SHN_COMMON);
+ shndx = SHN_ABS;
+ }
+ break;
}
}
else
@@ -11556,3 +11570,354 @@ _bfd_elf_maybe_function_sym (const asymb
size = 1;
return size;
}
+
+/* Set to non-zero to enable some debug messages. */
+#define DEBUG_SECONDARY_RELOCS 0
+
+/* An internal-to-the-bfd-library only section type
+ used to indicate a cached secondary reloc section. */
+#define SHT_SECONDARY_RELOC (SHT_LOOS + SHT_RELA)
+
+/* Create a BFD section to hold a secondary reloc section. */
+
+bfd_boolean
+_bfd_elf_init_secondary_reloc_section (bfd * abfd,
+ Elf_Internal_Shdr *hdr,
+ const char * name,
+ unsigned int shindex)
+{
+ /* We only support RELA secondary relocs. */
+ if (hdr->sh_type != SHT_RELA)
+ return FALSE;
+
+#if DEBUG_SECONDARY_RELOCS
+ fprintf (stderr, "secondary reloc section %s encountered\n", name);
+#endif
+ hdr->sh_type = SHT_SECONDARY_RELOC;
+ return _bfd_elf_make_section_from_shdr (abfd, hdr, name, shindex);
+}
+
+/* Read in any secondary relocs associated with SEC. */
+
+bfd_boolean
+_bfd_elf_slurp_secondary_reloc_section (bfd * abfd,
+ asection * sec,
+ asymbol ** symbols)
+{
+ const struct elf_backend_data * const ebd = get_elf_backend_data (abfd);
+ asection * relsec;
+ bfd_boolean result = TRUE;
+ bfd_vma (*r_sym) (bfd_vma);
+
+
+#ifdef BFD64
+ if (bfd_arch_bits_per_address (abfd) != 32)
+ r_sym = elf64_r_sym;
+ else
+#endif
+ r_sym = elf32_r_sym;
+
+ /* Discover if there are any secondary reloc sections
+ associated with SEC. */
+ for (relsec = abfd->sections; relsec != NULL; relsec = relsec->next)
+ {
+ Elf_Internal_Shdr * hdr = & elf_section_data (relsec)->this_hdr;
+
+ if (hdr->sh_type == SHT_SECONDARY_RELOC
+ && hdr->sh_info == (unsigned) elf_section_data (sec)->this_idx)
+ {
+ bfd_byte * native_relocs;
+ bfd_byte * native_reloc;
+ arelent * internal_relocs;
+ arelent * internal_reloc;
+ unsigned int i;
+ unsigned int entsize;
+ unsigned int symcount;
+ unsigned int reloc_count;
+
+#if DEBUG_SECONDARY_RELOCS
+ fprintf (stderr, "read secondary relocs for %s from %s\n", sec->name, relsec->name);
+#endif
+ entsize = hdr->sh_entsize;
+
+ native_relocs = bfd_malloc (hdr->sh_size);
+ if (native_relocs == NULL)
+ {
+ result = FALSE;
+ continue;
+ }
+
+ reloc_count = NUM_SHDR_ENTRIES (hdr);
+ internal_relocs = (arelent *) bfd_alloc2 (abfd, reloc_count, sizeof (arelent));
+ if (internal_relocs == NULL)
+ {
+ free (native_relocs);
+ result = FALSE;
+ continue;
+ }
+
+ if (bfd_seek (abfd, hdr->sh_offset, SEEK_SET) != 0
+ || (bfd_bread (native_relocs, hdr->sh_size, abfd) != hdr->sh_size))
+ {
+ free (native_relocs);
+ free (internal_relocs);
+ result = FALSE;
+ continue;
+ }
+
+ symcount = bfd_get_symcount (abfd);
+
+ for (i = 0, internal_reloc = internal_relocs, native_reloc = native_relocs;
+ i < reloc_count;
+ i++, internal_reloc++, native_reloc += entsize)
+ {
+ ;
+ Elf_Internal_Rela rela;
+
+ ebd->s->swap_reloca_in (abfd, native_reloc, & rela);
+
+ /* The address of an ELF reloc is section relative for an object
+ file, and absolute for an executable file or shared library.
+ The address of a normal BFD reloc is always section relative,
+ and the address of a dynamic reloc is absolute.. */
+ if ((abfd->flags & (EXEC_P | DYNAMIC)) == 0)
+ internal_reloc->address = rela.r_offset;
+ else
+ internal_reloc->address = rela.r_offset - sec->vma;
+
+ if (r_sym (rela.r_info) == STN_UNDEF)
+ {
+ /* FIXME: This and the error case below mean that we
+ have a symbol on relocs that is not elf_symbol_type. */
+ internal_reloc->sym_ptr_ptr = bfd_abs_section_ptr->symbol_ptr_ptr;
+ }
+ else if (r_sym (rela.r_info) > symcount)
+ {
+ _bfd_error_handler
+ /* xgettext:c-format */
+ (_("%pB(%pA): relocation %d has invalid symbol index %ld"),
+ abfd, sec, i, (long) r_sym (rela.r_info));
+ bfd_set_error (bfd_error_bad_value);
+ internal_reloc->sym_ptr_ptr = bfd_abs_section_ptr->symbol_ptr_ptr;
+ result = FALSE;
+ }
+ else
+ {
+ asymbol **ps;
+
+ ps = symbols + r_sym (rela.r_info) - 1;
+
+ internal_reloc->sym_ptr_ptr = ps;
+ /* Make sure that this symbol is not removed by strip. */
+ (*ps)->flags |= BSF_KEEP;
+ }
+
+ internal_reloc->addend = rela.r_addend;
+
+ ebd->elf_info_to_howto (abfd, internal_reloc, & rela);
+ if (internal_reloc->howto == NULL)
+ {
+#if DEBUG_SECONDARY_RELOCS
+ fprintf (stderr, "there is no howto associated with reloc %lx\n", rela.r_info);
+#endif
+ result = FALSE;
+ }
+ }
+
+ free (native_relocs);
+ /* Store the internal relocs. */
+ elf_section_data (relsec)->sec_info = internal_relocs;
+ }
+ }
+
+ return result;
+}
+
+/* Set the ELF section header fields of an output secondary reloc section. */
+
+bfd_boolean
+_bfd_elf_copy_special_section_fields (const bfd * ibfd ATTRIBUTE_UNUSED,
+ bfd * obfd ATTRIBUTE_UNUSED,
+ const Elf_Internal_Shdr * isection,
+ Elf_Internal_Shdr * osection)
+{
+ if (isection == NULL)
+ return FALSE;
+
+ if (isection->sh_type != SHT_SECONDARY_RELOC)
+ return TRUE;
+
+ asection * isec = isection->bfd_section;
+ if (isec == NULL)
+ return FALSE;
+
+ asection * osec = osection->bfd_section;
+ if (osec == NULL)
+ return FALSE;
+
+ BFD_ASSERT (elf_section_data (osec)->sec_info == NULL);
+ elf_section_data (osec)->sec_info = elf_section_data (isec)->sec_info;
+ osection->sh_type = SHT_RELA;
+ osection->sh_link = elf_onesymtab (obfd);
+ if (osection->sh_link == 0)
+ {
+ /* There is no symbol table - we are hosed... */
+ _bfd_error_handler
+ /* xgettext:c-format */
+ (_("%pB(%pA): link section cannot be set because the output file does not have a symbol table"),
+ obfd, osec);
+ bfd_set_error (bfd_error_bad_value);
+ return FALSE;
+ }
+
+ /* Find the output section that corresponds to the isection's sh_info link. */
+ BFD_ASSERT (isection->sh_info > 0 && isection->sh_info < elf_numsections (ibfd));
+ isection = elf_elfsections (ibfd)[isection->sh_info];
+
+ BFD_ASSERT (isection != NULL);
+ BFD_ASSERT (isection->bfd_section != NULL);
+ BFD_ASSERT (isection->bfd_section->output_section != NULL);
+ osection->sh_info = elf_section_data (isection->bfd_section->output_section)->this_idx;
+
+#if DEBUG_SECONDARY_RELOCS
+ fprintf (stderr, "update header of %s, sh_link = %u, sh_info = %u\n",
+ osec->name, osection->sh_link, osection->sh_info);
+#endif
+
+ return TRUE;
+}
+
+/* Write out a secondary reloc section. */
+
+bfd_boolean
+_bfd_elf_write_secondary_reloc_section (bfd *abfd, asection *sec)
+{
+ const struct elf_backend_data * const ebd = get_elf_backend_data (abfd);
+ bfd_vma addr_offset;
+ asection * relsec;
+ bfd_vma (*r_info) (bfd_vma, bfd_vma);
+
+#ifdef BFD64
+ if (bfd_arch_bits_per_address (abfd) != 32)
+ r_info = elf64_r_info;
+ else
+#endif
+ r_info = elf32_r_info;
+
+ if (sec == NULL)
+ return FALSE;
+
+ /* The address of an ELF reloc is section relative for an object
+ file, and absolute for an executable file or shared library.
+ The address of a BFD reloc is always section relative. */
+ addr_offset = 0;
+ if ((abfd->flags & (EXEC_P | DYNAMIC)) != 0)
+ addr_offset = sec->vma;
+
+ /* Discover if there are any secondary reloc sections
+ associated with SEC. */
+ for (relsec = abfd->sections; relsec != NULL; relsec = relsec->next)
+ {
+ const struct bfd_elf_section_data * const esd = elf_section_data (relsec);
+ Elf_Internal_Shdr * const hdr = (Elf_Internal_Shdr *) & esd->this_hdr;
+
+ if (hdr->sh_type == SHT_RELA
+ && hdr->sh_info == (unsigned) elf_section_data (sec)->this_idx)
+ {
+ asymbol * last_sym;
+ int last_sym_idx;
+ unsigned int reloc_count;
+ unsigned int idx;
+ arelent * src_irel;
+ bfd_byte * dst_rela;
+
+ BFD_ASSERT (hdr->contents == NULL);
+
+ reloc_count = hdr->sh_size / hdr->sh_entsize;
+ BFD_ASSERT (reloc_count > 0);
+
+ hdr->contents = bfd_alloc (abfd, hdr->sh_size);
+ if (hdr->contents == NULL)
+ continue;
+
+#if DEBUG_SECONDARY_RELOCS
+ fprintf (stderr, "write %u secondary relocs for %s from %s\n", reloc_count, sec->name, relsec->name);
+#endif
+ last_sym = NULL;
+ last_sym_idx = 0;
+ dst_rela = hdr->contents;
+ src_irel = (arelent *) esd->sec_info;
+ BFD_ASSERT (src_irel != NULL);
+
+ for (idx = 0; idx < reloc_count; idx++, dst_rela += hdr->sh_entsize)
+ {
+ Elf_Internal_Rela src_rela;
+ arelent *ptr;
+ asymbol *sym;
+ int n;
+
+ ptr = src_irel + idx;
+ sym = *ptr->sym_ptr_ptr;
+
+ if (sym == last_sym)
+ n = last_sym_idx;
+ else
+ {
+ last_sym = sym;
+ n = _bfd_elf_symbol_from_bfd_symbol (abfd, & sym);
+ if (n < 0)
+ {
+#if DEBUG_SECONDARY_RELOCS
+ fprintf (stderr, "failed to find symbol %s whilst rewriting relocs\n",
+ sym->name);
+#endif
+ /* FIXME: Signal failure somehow. */
+ n = 0;
+ }
+ last_sym_idx = n;
+ }
+
+ if ((*ptr->sym_ptr_ptr)->the_bfd != NULL
+ && (*ptr->sym_ptr_ptr)->the_bfd->xvec != abfd->xvec
+ && ! _bfd_elf_validate_reloc (abfd, ptr))
+ {
+#if DEBUG_SECONDARY_RELOCS
+ fprintf (stderr, "symbol %s is not in the output bfd\n",
+ sym->name);
+#endif
+ /* FIXME: Signal failure somehow. */
+ n = 0;
+ }
+
+ if (ptr->howto == NULL)
+ {
+#if DEBUG_SECONDARY_RELOCS
+ fprintf (stderr, "reloc for symbol %s does not have a howto associated with it\n",
+ sym->name);
+#endif
+ /* FIXME: Signal failure somehow. */
+ n = 0;
+ }
+
+ src_rela.r_offset = ptr->address + addr_offset;
+ src_rela.r_info = r_info (n, ptr->howto->type);
+ src_rela.r_addend = ptr->addend;
+ ebd->s->swap_reloca_out (abfd, &src_rela, dst_rela);
+ }
+ }
+ }
+
+ return TRUE;
+}
+
+/* Preserve any OS or PROCESSOR specific section indicies. */
+
+unsigned int
+_bfd_elf_symbol_section_index (bfd * abfd ATTRIBUTE_UNUSED,
+ elf_symbol_type * sym)
+{
+ unsigned int shndx = sym->internal_elf_sym.st_shndx;
+
+ /* Preserve special section indicies. */
+ return shndx >= SHN_LORESERVE ? shndx : SHN_ABS;
+}
diff -rup binutils.orig/bfd/elfcode.h binutils-2.30/bfd/elfcode.h
--- binutils.orig/bfd/elfcode.h 2020-02-12 13:31:20.334605640 +0000
+++ binutils-2.30/bfd/elfcode.h 2020-02-12 13:31:33.833507567 +0000
@@ -855,6 +855,7 @@ elf_object_p (bfd *abfd)
void
elf_write_relocs (bfd *abfd, asection *sec, void *data)
{
+ const struct elf_backend_data * const bed = get_elf_backend_data (abfd);
bfd_boolean *failedp = (bfd_boolean *) data;
Elf_Internal_Shdr *rela_hdr;
bfd_vma addr_offset;
@@ -969,6 +970,13 @@ elf_write_relocs (bfd *abfd, asection *s
src_rela.r_addend = ptr->addend;
(*swap_out) (abfd, &src_rela, dst_rela);
}
+
+ if (bed->write_secondary_relocs != NULL)
+ if (! bed->write_secondary_relocs (abfd, sec))
+ {
+ *failedp = TRUE;
+ return;
+ }
}
/* Write out the program headers. */
@@ -1271,7 +1279,10 @@ elf_slurp_symbol_table (bfd *abfd, asymb
{
/* This symbol is in a section for which we did not
create a BFD section. Just use bfd_abs_section,
- although it is wrong. FIXME. */
+ although it is wrong. FIXME. Note - there is
+ code in elf.c:swap_out_syms that calls
+ symbol_section_index() in the elf backend for
+ cases like this. */
sym->symbol.section = bfd_abs_section_ptr;
}
}
@@ -1501,6 +1512,7 @@ elf_slurp_reloc_table (bfd *abfd,
asymbol **symbols,
bfd_boolean dynamic)
{
+ const struct elf_backend_data * const bed = get_elf_backend_data (abfd);
struct bfd_elf_section_data * const d = elf_section_data (asect);
Elf_Internal_Shdr *rel_hdr;
Elf_Internal_Shdr *rel_hdr2;
@@ -1564,6 +1576,10 @@ elf_slurp_reloc_table (bfd *abfd,
symbols, dynamic))
return FALSE;
+ if (bed->slurp_secondary_relocs != NULL
+ && ! bed->slurp_secondary_relocs (abfd, asect, symbols))
+ return FALSE;
+
asect->relocation = relents;
return TRUE;
}
diff -rup binutils.orig/bfd/elflink.c binutils-2.30/bfd/elflink.c
--- binutils.orig/bfd/elflink.c 2020-02-12 13:31:20.338605611 +0000
+++ binutils-2.30/bfd/elflink.c 2020-02-12 13:31:33.834507560 +0000
@@ -11514,6 +11514,10 @@ elf_final_link_free (bfd *obfd, struct e
}
}
+#define is_reloc_section(ESDO) \
+ ( (ESDO)->this_hdr.sh_type == SHT_REL \
+ || (ESDO)->this_hdr.sh_type == SHT_RELA)
+
/* Do the final step of an ELF link. */
bfd_boolean
@@ -11685,8 +11689,7 @@ bfd_elf_final_link (bfd *abfd, struct bf
&& elf_symtab_shndx_list (sec->owner) != NULL)
max_sym_shndx_count = sym_count;
- if (esdo->this_hdr.sh_type == SHT_REL
- || esdo->this_hdr.sh_type == SHT_RELA)
+ if (is_reloc_section (esdo))
/* Some backends use reloc_count in relocation sections
to count particular types of relocs. Of course,
reloc sections themselves can't have relocations. */
@@ -12290,6 +12293,9 @@ bfd_elf_final_link (bfd *abfd, struct bf
struct bfd_elf_section_data *esdo = elf_section_data (o);
bfd_boolean sort;
+ if (esdo == NULL)
+ continue;
+
if ((o->flags & SEC_RELOC) == 0)
continue;
diff -rup binutils.orig/bfd/elfxx-target.h binutils-2.30/bfd/elfxx-target.h
--- binutils.orig/bfd/elfxx-target.h 2020-02-12 13:31:20.338605611 +0000
+++ binutils-2.30/bfd/elfxx-target.h 2020-02-12 13:31:33.834507560 +0000
@@ -737,7 +737,7 @@
#endif
#ifndef elf_backend_copy_special_section_fields
-#define elf_backend_copy_special_section_fields NULL
+#define elf_backend_copy_special_section_fields _bfd_elf_copy_special_section_fields
#endif
#ifndef elf_backend_compact_eh_encoding
@@ -745,7 +745,23 @@
#endif
#ifndef elf_backend_cant_unwind_opcode
-#define elf_backend_cant_unwind_opcode 0
+#define elf_backend_cant_unwind_opcode NULL
+#endif
+
+#ifndef elf_backend_init_secondary_reloc_section
+#define elf_backend_init_secondary_reloc_section _bfd_elf_init_secondary_reloc_section
+#endif
+
+#ifndef elf_backend_slurp_secondary_reloc_section
+#define elf_backend_slurp_secondary_reloc_section _bfd_elf_slurp_secondary_reloc_section
+#endif
+
+#ifndef elf_backend_write_secondary_reloc_section
+#define elf_backend_write_secondary_reloc_section _bfd_elf_write_secondary_reloc_section
+#endif
+
+#ifndef elf_backend_symbol_section_index
+#define elf_backend_symbol_section_index _bfd_elf_symbol_section_index
#endif
#ifndef elf_match_priority
@@ -870,6 +886,10 @@ static struct elf_backend_data elfNN_bed
elf_backend_setup_gnu_properties,
elf_backend_compact_eh_encoding,
elf_backend_cant_unwind_opcode,
+ elf_backend_init_secondary_reloc_section,
+ elf_backend_slurp_secondary_reloc_section,
+ elf_backend_write_secondary_reloc_section,
+ elf_backend_symbol_section_index,
elf_backend_static_tls_alignment,
elf_backend_stack_align,
elf_backend_strtab_flags,
Only in binutils-2.30/bfd: elfxx-target.h.orig

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,18 @@
--- binutils.orig/ld/emultempl/elf32.em 2019-07-22 13:25:51.601030174 +0100
+++ binutils-2.32/ld/emultempl/elf32.em 2019-07-22 13:27:36.070394830 +0100
@@ -2029,10 +2029,12 @@ elf_orphan_compatible (asection *in, ase
if (elf_section_data (out)->this_hdr.sh_info
!= elf_section_data (in)->this_hdr.sh_info)
return FALSE;
- /* We can't merge two sections with differing SHF_EXCLUDE when doing
- a relocatable link. */
+ /* We can't merge with member of output section group nor merge two
+ sections with differing SHF_EXCLUDE when doing a relocatable link. */
if (bfd_link_relocatable (&link_info)
- && ((elf_section_flags (out) ^ elf_section_flags (in)) & SHF_EXCLUDE) != 0)
+ && (elf_next_in_group (out) != NULL
+ || ((elf_section_flags (out) ^ elf_section_flags (in))
+ & SHF_EXCLUDE) != 0))
return FALSE;
return _bfd_elf_match_sections_by_type (link_info.output_bfd, out,
in->owner, in);

View File

@ -0,0 +1,68 @@
diff -rup binutils.orig/bfd/elf-bfd.h binutils-2.30/bfd/elf-bfd.h
--- binutils.orig/bfd/elf-bfd.h 2020-04-06 13:08:43.081659992 +0100
+++ binutils-2.30/bfd/elf-bfd.h 2020-04-06 13:09:17.040517295 +0100
@@ -2722,6 +2722,8 @@ extern unsigned int _bfd_elf_symbol_sect
(bfd *, elf_symbol_type *);
+extern bfd_boolean is_debuginfo_file (bfd *);
+
/* Large common section. */
extern asection _bfd_elf_large_com_section;
Only in binutils-2.30/bfd: elf-bfd.h.orig
diff -rup binutils.orig/bfd/elf.c binutils-2.30/bfd/elf.c
--- binutils.orig/bfd/elf.c 2020-04-06 13:08:43.104659896 +0100
+++ binutils-2.30/bfd/elf.c 2020-04-06 13:09:17.042517287 +0100
@@ -5749,6 +5749,35 @@ assign_file_positions_for_load_sections
#define IS_TBSS(s) \
((s->flags & (SEC_THREAD_LOCAL | SEC_LOAD)) == SEC_THREAD_LOCAL)
+/* Determine if a bfd is a debuginfo file. Unfortunately there
+ is no defined method for detecting such files, so we have to
+ use heuristics instead. */
+
+bfd_boolean
+is_debuginfo_file (bfd *abfd)
+{
+ if (abfd == NULL || bfd_get_flavour (abfd) != bfd_target_elf_flavour)
+ return FALSE;
+
+ Elf_Internal_Shdr **start_headers = elf_elfsections (abfd);
+ Elf_Internal_Shdr **end_headers = start_headers + elf_numsections (abfd);
+ Elf_Internal_Shdr **headerp;
+
+ for (headerp = start_headers; headerp < end_headers; headerp ++)
+ {
+ Elf_Internal_Shdr *header = * headerp;
+
+ /* Debuginfo files do not have any allocated SHT_PROGBITS sections.
+ The only allocated sections are SHT_NOBITS or SHT_NOTES. */
+ if ((header->sh_flags & SHF_ALLOC) == SHF_ALLOC
+ && header->sh_type != SHT_NOBITS
+ && header->sh_type != SHT_NOTE)
+ return FALSE;
+ }
+
+ return TRUE;
+}
+
/* Assign file positions for the other sections. */
static bfd_boolean
@@ -5782,7 +5811,13 @@ assign_file_positions_for_non_load_secti
BFD_ASSERT (hdr->sh_offset == hdr->bfd_section->filepos);
else if ((hdr->sh_flags & SHF_ALLOC) != 0)
{
- if (hdr->sh_size != 0)
+ if (hdr->sh_size != 0
+ /* PR 24717 - debuginfo files are known to be not strictly
+ compliant with the ELF standard. In particular they often
+ have .note.gnu.property sections that are outside of any
+ loadable segment. This is not a problem for such files,
+ so do not warn about them. */
+ && ! is_debuginfo_file (abfd))
_bfd_error_handler
/* xgettext:c-format */
(_("%B: warning: allocated section `%s' not in segment"),
Only in binutils-2.30/bfd: elf.c.orig

View File

@ -753,3 +753,16 @@ diff -rup binutils.orig/ld/testsuite/ld-x86-64/x86-64.exp binutils-2.30/ld/tests
run_cc_link_tests [list \
[list \
"Build plt-lib.so" \
--- binutils.orig/ld/testsuite/ld-plugin/lto.exp 2019-12-02 10:22:47.019526080 +0000
+++ binutils-2.30/ld/testsuite/ld-plugin/lto.exp 2019-12-02 10:28:11.413354928 +0000
@@ -33,8 +33,8 @@ global CFLAGS
global CXXFLAGS
set saved_CFLAGS "$CFLAGS"
set saved_CXXFLAGS "$CXXFLAGS"
-regsub -all "(\\-Wp,)?-D_FORTIFY_SOURCE=\[0-9\]+" $CFLAGS "" CFLAGS
-regsub -all "(\\-Wp,)?-D_FORTIFY_SOURCE=\[0-9\]+" $CXXFLAGS "" CXXFLAGS
+# regsub -all "(\\-Wp,)?-D_FORTIFY_SOURCE=\[0-9\]+" $CFLAGS "" CFLAGS
+# regsub -all "(\\-Wp,)?-D_FORTIFY_SOURCE=\[0-9\]+" $CXXFLAGS "" CXXFLAGS
proc restore_notify { } {
global saved_CFLAGS

View File

@ -0,0 +1,355 @@
diff --git a/gold/i386.cc b/gold/i386.cc
index bf209fe9a86..31161ff091c 100644
--- a/gold/i386.cc
+++ b/gold/i386.cc
@@ -360,7 +360,11 @@ class Target_i386 : public Sized_target<32, false>
got_(NULL), plt_(NULL), got_plt_(NULL), got_irelative_(NULL),
got_tlsdesc_(NULL), global_offset_table_(NULL), rel_dyn_(NULL),
rel_irelative_(NULL), copy_relocs_(elfcpp::R_386_COPY),
- got_mod_index_offset_(-1U), tls_base_symbol_defined_(false)
+ got_mod_index_offset_(-1U), tls_base_symbol_defined_(false),
+ isa_1_used_(0), isa_1_needed_(0),
+ feature_1_(0), feature_2_used_(0), feature_2_needed_(0),
+ object_isa_1_used_(0), object_feature_1_(0),
+ object_feature_2_used_(0), seen_first_object_(false)
{ }
// Process the relocations to determine unreferenced sections for
@@ -859,6 +863,21 @@ class Target_i386 : public Sized_target<32, false>
this->rel_dyn_section(layout));
}
+ // Record a target-specific program property in the .note.gnu.property
+ // section.
+ void
+ record_gnu_property(unsigned int, unsigned int, size_t,
+ const unsigned char*, const Object*);
+
+ // Merge the target-specific program properties from the current object.
+ void
+ merge_gnu_properties(const Object*);
+
+ // Finalize the target-specific program properties and add them back to
+ // the layout.
+ void
+ do_finalize_gnu_properties(Layout*) const;
+
// Information about this specific target which we pass to the
// general Target structure.
static const Target::Target_info i386_info;
@@ -898,6 +917,26 @@ class Target_i386 : public Sized_target<32, false>
unsigned int got_mod_index_offset_;
// True if the _TLS_MODULE_BASE_ symbol has been defined.
bool tls_base_symbol_defined_;
+
+ // Target-specific program properties, from .note.gnu.property section.
+ // Each bit represents a specific feature.
+ uint32_t isa_1_used_;
+ uint32_t isa_1_needed_;
+ uint32_t feature_1_;
+ uint32_t feature_2_used_;
+ uint32_t feature_2_needed_;
+ // Target-specific properties from the current object.
+ // These bits get ORed into ISA_1_USED_ after all properties for the object
+ // have been processed. But if either is all zeroes (as when the property
+ // is absent from an object), the result should be all zeroes.
+ // (See PR ld/23486.)
+ uint32_t object_isa_1_used_;
+ // These bits get ANDed into FEATURE_1_ after all properties for the object
+ // have been processed.
+ uint32_t object_feature_1_;
+ uint32_t object_feature_2_used_;
+ // Whether we have seen our first object, for use in initializing FEATURE_1_.
+ bool seen_first_object_;
};
const Target::Target_info Target_i386::i386_info =
@@ -1042,6 +1081,126 @@ Target_i386::rel_irelative_section(Layout* layout)
return this->rel_irelative_;
}
+// Record a target-specific program property from the .note.gnu.property
+// section.
+void
+Target_i386::record_gnu_property(
+ unsigned int, unsigned int pr_type,
+ size_t pr_datasz, const unsigned char* pr_data,
+ const Object* object)
+{
+ uint32_t val = 0;
+
+ switch (pr_type)
+ {
+ case elfcpp::GNU_PROPERTY_X86_COMPAT_ISA_1_USED:
+ case elfcpp::GNU_PROPERTY_X86_COMPAT_ISA_1_NEEDED:
+ case elfcpp::GNU_PROPERTY_X86_COMPAT_2_ISA_1_USED:
+ case elfcpp::GNU_PROPERTY_X86_COMPAT_2_ISA_1_NEEDED:
+ case elfcpp::GNU_PROPERTY_X86_ISA_1_USED:
+ case elfcpp::GNU_PROPERTY_X86_ISA_1_NEEDED:
+ case elfcpp::GNU_PROPERTY_X86_FEATURE_1_AND:
+ case elfcpp::GNU_PROPERTY_X86_FEATURE_2_USED:
+ case elfcpp::GNU_PROPERTY_X86_FEATURE_2_NEEDED:
+ if (pr_datasz != 4)
+ {
+ gold_warning(_("%s: corrupt .note.gnu.property section "
+ "(pr_datasz for property %d is not 4)"),
+ object->name().c_str(), pr_type);
+ return;
+ }
+ val = elfcpp::Swap<32, false>::readval(pr_data);
+ break;
+ default:
+ gold_warning(_("%s: unknown program property type 0x%x "
+ "in .note.gnu.property section"),
+ object->name().c_str(), pr_type);
+ break;
+ }
+
+ switch (pr_type)
+ {
+ case elfcpp::GNU_PROPERTY_X86_ISA_1_USED:
+ this->object_isa_1_used_ |= val;
+ break;
+ case elfcpp::GNU_PROPERTY_X86_ISA_1_NEEDED:
+ this->isa_1_needed_ |= val;
+ break;
+ case elfcpp::GNU_PROPERTY_X86_FEATURE_1_AND:
+ // If we see multiple feature props in one object, OR them together.
+ this->object_feature_1_ |= val;
+ break;
+ case elfcpp::GNU_PROPERTY_X86_FEATURE_2_USED:
+ this->object_feature_2_used_ |= val;
+ break;
+ case elfcpp::GNU_PROPERTY_X86_FEATURE_2_NEEDED:
+ this->feature_2_needed_ |= val;
+ break;
+ }
+}
+
+// Merge the target-specific program properties from the current object.
+void
+Target_i386::merge_gnu_properties(const Object*)
+{
+ if (this->seen_first_object_)
+ {
+ // If any object is missing the ISA_1_USED property, we must omit
+ // it from the output file.
+ if (this->object_isa_1_used_ == 0)
+ this->isa_1_used_ = 0;
+ else if (this->isa_1_used_ != 0)
+ this->isa_1_used_ |= this->object_isa_1_used_;
+ this->feature_1_ &= this->object_feature_1_;
+ // If any object is missing the FEATURE_2_USED property, we must
+ // omit it from the output file.
+ if (this->object_feature_2_used_ == 0)
+ this->feature_2_used_ = 0;
+ else if (this->feature_2_used_ != 0)
+ this->feature_2_used_ |= this->object_feature_2_used_;
+ }
+ else
+ {
+ this->isa_1_used_ = this->object_isa_1_used_;
+ this->feature_1_ = this->object_feature_1_;
+ this->feature_2_used_ = this->object_feature_2_used_;
+ this->seen_first_object_ = true;
+ }
+ this->object_isa_1_used_ = 0;
+ this->object_feature_1_ = 0;
+ this->object_feature_2_used_ = 0;
+}
+
+static inline void
+add_property(Layout* layout, unsigned int pr_type, uint32_t val)
+{
+ unsigned char buf[4];
+ elfcpp::Swap<32, false>::writeval(buf, val);
+ layout->add_gnu_property(elfcpp::NT_GNU_PROPERTY_TYPE_0, pr_type, 4, buf);
+}
+
+// Finalize the target-specific program properties and add them back to
+// the layout.
+void
+Target_i386::do_finalize_gnu_properties(Layout* layout) const
+{
+ if (this->isa_1_used_ != 0)
+ add_property(layout, elfcpp::GNU_PROPERTY_X86_ISA_1_USED,
+ this->isa_1_used_);
+ if (this->isa_1_needed_ != 0)
+ add_property(layout, elfcpp::GNU_PROPERTY_X86_ISA_1_NEEDED,
+ this->isa_1_needed_);
+ if (this->feature_1_ != 0)
+ add_property(layout, elfcpp::GNU_PROPERTY_X86_FEATURE_1_AND,
+ this->feature_1_);
+ if (this->feature_2_used_ != 0)
+ add_property(layout, elfcpp::GNU_PROPERTY_X86_FEATURE_2_USED,
+ this->feature_2_used_);
+ if (this->feature_2_needed_ != 0)
+ add_property(layout, elfcpp::GNU_PROPERTY_X86_FEATURE_2_NEEDED,
+ this->feature_2_needed_);
+}
+
// Write the first three reserved words of the .got.plt section.
// The remainder of the section is written while writing the PLT
// in Output_data_plt_i386::do_write.
--- binutils.orig/elfcpp/elfcpp.h 2021-06-23 12:31:04.550738064 +0100
+++ binutils-2.30/elfcpp/elfcpp.h 2021-06-23 12:33:18.068875079 +0100
@@ -1008,9 +1008,21 @@ enum
GNU_PROPERTY_STACK_SIZE = 1,
GNU_PROPERTY_NO_COPY_ON_PROTECTED = 2,
GNU_PROPERTY_LOPROC = 0xc0000000,
- GNU_PROPERTY_X86_ISA_1_USED = 0xc0000000,
- GNU_PROPERTY_X86_ISA_1_NEEDED = 0xc0000001,
- GNU_PROPERTY_X86_FEATURE_1_AND = 0xc0000002,
+ GNU_PROPERTY_X86_COMPAT_ISA_1_USED = 0xc0000000,
+ GNU_PROPERTY_X86_COMPAT_ISA_1_NEEDED = 0xc0000001,
+ GNU_PROPERTY_X86_UINT32_AND_LO = 0xc0000002,
+ GNU_PROPERTY_X86_UINT32_AND_HI = 0xc0007fff,
+ GNU_PROPERTY_X86_UINT32_OR_LO = 0xc0008000,
+ GNU_PROPERTY_X86_UINT32_OR_HI = 0xc000ffff,
+ GNU_PROPERTY_X86_UINT32_OR_AND_LO = 0xc0010000,
+ GNU_PROPERTY_X86_UINT32_OR_AND_HI = 0xc0017fff,
+ GNU_PROPERTY_X86_COMPAT_2_ISA_1_NEEDED = GNU_PROPERTY_X86_UINT32_OR_LO + 0,
+ GNU_PROPERTY_X86_COMPAT_2_ISA_1_USED = GNU_PROPERTY_X86_UINT32_OR_AND_LO + 0,
+ GNU_PROPERTY_X86_FEATURE_1_AND = GNU_PROPERTY_X86_UINT32_AND_LO + 0,
+ GNU_PROPERTY_X86_ISA_1_NEEDED = GNU_PROPERTY_X86_UINT32_OR_LO + 2,
+ GNU_PROPERTY_X86_FEATURE_2_NEEDED = GNU_PROPERTY_X86_UINT32_OR_LO + 1,
+ GNU_PROPERTY_X86_ISA_1_USED = GNU_PROPERTY_X86_UINT32_OR_AND_LO + 2,
+ GNU_PROPERTY_X86_FEATURE_2_USED = GNU_PROPERTY_X86_UINT32_OR_AND_LO + 1,
GNU_PROPERTY_HIPROC = 0xdfffffff,
GNU_PROPERTY_LOUSER = 0xe0000000,
GNU_PROPERTY_HIUSER = 0xffffffff
--- binutils.orig/gold/i386.cc 2021-07-07 14:15:34.369441519 +0100
+++ binutils-2.30/gold/i386.cc 2021-07-07 14:36:11.932838272 +0100
@@ -362,9 +362,8 @@ class Target_i386 : public Sized_target<
rel_irelative_(NULL), copy_relocs_(elfcpp::R_386_COPY),
got_mod_index_offset_(-1U), tls_base_symbol_defined_(false),
isa_1_used_(0), isa_1_needed_(0),
- feature_1_(0), feature_2_used_(0), feature_2_needed_(0),
- object_isa_1_used_(0), object_feature_1_(0),
- object_feature_2_used_(0), seen_first_object_(false)
+ feature_1_(0), object_feature_1_(0),
+ seen_first_object_(false)
{ }
// Process the relocations to determine unreferenced sections for
@@ -866,7 +865,7 @@ class Target_i386 : public Sized_target<
// Record a target-specific program property in the .note.gnu.property
// section.
void
- record_gnu_property(unsigned int, unsigned int, size_t,
+ record_gnu_property(int, int, size_t,
const unsigned char*, const Object*);
// Merge the target-specific program properties from the current object.
@@ -923,18 +922,10 @@ class Target_i386 : public Sized_target<
uint32_t isa_1_used_;
uint32_t isa_1_needed_;
uint32_t feature_1_;
- uint32_t feature_2_used_;
- uint32_t feature_2_needed_;
// Target-specific properties from the current object.
- // These bits get ORed into ISA_1_USED_ after all properties for the object
- // have been processed. But if either is all zeroes (as when the property
- // is absent from an object), the result should be all zeroes.
- // (See PR ld/23486.)
- uint32_t object_isa_1_used_;
// These bits get ANDed into FEATURE_1_ after all properties for the object
// have been processed.
uint32_t object_feature_1_;
- uint32_t object_feature_2_used_;
// Whether we have seen our first object, for use in initializing FEATURE_1_.
bool seen_first_object_;
};
@@ -1084,7 +1075,7 @@ Target_i386::rel_irelative_section(Layou
// section.
void
Target_i386::record_gnu_property(
- unsigned int, unsigned int pr_type,
+ int, int pr_type,
size_t pr_datasz, const unsigned char* pr_data,
const Object* object)
{
@@ -1092,15 +1083,9 @@ Target_i386::record_gnu_property(
switch (pr_type)
{
- case elfcpp::GNU_PROPERTY_X86_COMPAT_ISA_1_USED:
- case elfcpp::GNU_PROPERTY_X86_COMPAT_ISA_1_NEEDED:
- case elfcpp::GNU_PROPERTY_X86_COMPAT_2_ISA_1_USED:
- case elfcpp::GNU_PROPERTY_X86_COMPAT_2_ISA_1_NEEDED:
case elfcpp::GNU_PROPERTY_X86_ISA_1_USED:
case elfcpp::GNU_PROPERTY_X86_ISA_1_NEEDED:
case elfcpp::GNU_PROPERTY_X86_FEATURE_1_AND:
- case elfcpp::GNU_PROPERTY_X86_FEATURE_2_USED:
- case elfcpp::GNU_PROPERTY_X86_FEATURE_2_NEEDED:
if (pr_datasz != 4)
{
gold_warning(_("%s: corrupt .note.gnu.property section "
@@ -1120,7 +1105,7 @@ Target_i386::record_gnu_property(
switch (pr_type)
{
case elfcpp::GNU_PROPERTY_X86_ISA_1_USED:
- this->object_isa_1_used_ |= val;
+ this->isa_1_used_ |= val;
break;
case elfcpp::GNU_PROPERTY_X86_ISA_1_NEEDED:
this->isa_1_needed_ |= val;
@@ -1129,12 +1114,6 @@ Target_i386::record_gnu_property(
// If we see multiple feature props in one object, OR them together.
this->object_feature_1_ |= val;
break;
- case elfcpp::GNU_PROPERTY_X86_FEATURE_2_USED:
- this->object_feature_2_used_ |= val;
- break;
- case elfcpp::GNU_PROPERTY_X86_FEATURE_2_NEEDED:
- this->feature_2_needed_ |= val;
- break;
}
}
@@ -1143,31 +1122,13 @@ void
Target_i386::merge_gnu_properties(const Object*)
{
if (this->seen_first_object_)
- {
- // If any object is missing the ISA_1_USED property, we must omit
- // it from the output file.
- if (this->object_isa_1_used_ == 0)
- this->isa_1_used_ = 0;
- else if (this->isa_1_used_ != 0)
- this->isa_1_used_ |= this->object_isa_1_used_;
- this->feature_1_ &= this->object_feature_1_;
- // If any object is missing the FEATURE_2_USED property, we must
- // omit it from the output file.
- if (this->object_feature_2_used_ == 0)
- this->feature_2_used_ = 0;
- else if (this->feature_2_used_ != 0)
- this->feature_2_used_ |= this->object_feature_2_used_;
- }
+ this->feature_1_ &= this->object_feature_1_;
else
{
- this->isa_1_used_ = this->object_isa_1_used_;
this->feature_1_ = this->object_feature_1_;
- this->feature_2_used_ = this->object_feature_2_used_;
this->seen_first_object_ = true;
}
- this->object_isa_1_used_ = 0;
this->object_feature_1_ = 0;
- this->object_feature_2_used_ = 0;
}
static inline void
@@ -1192,12 +1153,6 @@ Target_i386::do_finalize_gnu_properties(
if (this->feature_1_ != 0)
add_property(layout, elfcpp::GNU_PROPERTY_X86_FEATURE_1_AND,
this->feature_1_);
- if (this->feature_2_used_ != 0)
- add_property(layout, elfcpp::GNU_PROPERTY_X86_FEATURE_2_USED,
- this->feature_2_used_);
- if (this->feature_2_needed_ != 0)
- add_property(layout, elfcpp::GNU_PROPERTY_X86_FEATURE_2_NEEDED,
- this->feature_2_needed_);
}
// Write the first three reserved words of the .got.plt section.

View File

@ -0,0 +1,36 @@
diff -rup binutils.orig/gold/layout.cc binutils-2.32/gold/layout.cc
--- binutils.orig/gold/layout.cc 2019-06-24 14:37:36.013086899 +0100
+++ binutils-2.32/gold/layout.cc 2019-06-24 14:41:40.054517479 +0100
@@ -868,6 +868,7 @@ Layout::get_output_section(const char* n
&& (same_name->flags() & elfcpp::SHF_TLS) == 0)
os = same_name;
}
+#if 0 /* BZ 1722715, PR 17556. */
else if ((flags & elfcpp::SHF_TLS) == 0)
{
elfcpp::Elf_Xword zero_flags = 0;
@@ -878,6 +879,7 @@ Layout::get_output_section(const char* n
if (p != this->section_name_map_.end())
os = p->second;
}
+#endif
}
if (os == NULL)
diff -rup binutils.orig/gold/object.cc binutils-2.32/gold/object.cc
--- binutils.orig/gold/object.cc 2019-06-24 14:37:36.012086906 +0100
+++ binutils-2.32/gold/object.cc 2019-06-24 14:39:59.287165501 +0100
@@ -1644,6 +1644,13 @@ Sized_relobj_file<size, big_endian>::do_
omit[i] = true;
}
+ // Skip empty sections without flags.
+ if (!(shdr.get_sh_flags() & ~elfcpp::SHF_GROUP)
+ && !shdr.get_sh_size())
+ {
+ omit[i] = true;
+ }
+
bool discard = omit[i];
if (!discard)
{

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,251 @@
diff -rup binutils.orig/include/bfdlink.h binutils-2.30/include/bfdlink.h
--- binutils.orig/include/bfdlink.h 2020-11-02 10:04:27.457826514 +0000
+++ binutils-2.30/include/bfdlink.h 2020-11-02 10:05:14.723537971 +0000
@@ -339,6 +339,9 @@ struct bfd_link_info
/* TRUE if the LTO plugin is active. */
unsigned int lto_plugin_active: 1;
+ /* TRUE if all LTO IR symbols have been read. */
+ unsigned int lto_all_symbols_read : 1;
+
/* TRUE if global symbols in discarded sections should be stripped. */
unsigned int strip_discarded: 1;
diff -rup binutils.orig/ld/ldlang.c binutils-2.30/ld/ldlang.c
--- binutils.orig/ld/ldlang.c 2020-11-02 10:04:16.852890551 +0000
+++ binutils-2.30/ld/ldlang.c 2020-11-02 10:06:12.285185841 +0000
@@ -7162,6 +7162,7 @@ lang_process (void)
if (plugin_call_all_symbols_read ())
einfo (_("%P%F: %s: plugin reported error after all symbols read\n"),
plugin_error_plugin ());
+ link_info.lto_all_symbols_read = TRUE;
/* Open any newly added files, updating the file chains. */
open_input_bfds (*added.tail, OPEN_BFD_NORMAL);
/* Restore the global list pointer now they have all been added. */
diff -rup binutils.orig/ld/plugin.c binutils-2.30/ld/plugin.c
--- binutils.orig/ld/plugin.c 2020-11-02 10:04:16.852890551 +0000
+++ binutils-2.30/ld/plugin.c 2020-11-02 10:08:11.010459546 +0000
@@ -1355,12 +1355,16 @@ plugin_notice (struct bfd_link_info *inf
new value from a real BFD. Weak symbols are not normally
overridden by a new weak definition, and strong symbols
will normally cause multiple definition errors. Avoid
- this by making the symbol appear to be undefined. */
- if (((h->type == bfd_link_hash_defweak
- || h->type == bfd_link_hash_defined)
- && is_ir_dummy_bfd (sym_bfd = h->u.def.section->owner))
- || (h->type == bfd_link_hash_common
- && is_ir_dummy_bfd (sym_bfd = h->u.c.p->section->owner)))
+ this by making the symbol appear to be undefined.
+
+ NB: We change the previous definition in the IR object to
+ undefweak only after all LTO symbols have been read. */
+ if (info->lto_all_symbols_read
+ && (((h->type == bfd_link_hash_defweak
+ || h->type == bfd_link_hash_defined)
+ && is_ir_dummy_bfd (sym_bfd = h->u.def.section->owner))
+ || (h->type == bfd_link_hash_common
+ && is_ir_dummy_bfd (sym_bfd = h->u.c.p->section->owner))))
{
h->type = bfd_link_hash_undefweak;
h->u.undef.abfd = sym_bfd;
diff -rup binutils.orig/ld/testsuite/ld-plugin/lto.exp binutils-2.30/ld/testsuite/ld-plugin/lto.exp
--- binutils.orig/ld/testsuite/ld-plugin/lto.exp 2020-11-02 10:04:16.926890104 +0000
+++ binutils-2.30/ld/testsuite/ld-plugin/lto.exp 2020-11-02 10:12:09.551000288 +0000
@@ -214,6 +214,36 @@ set lto_link_tests [list \
[list "Build pr22502b.o" \
"$plug_opt" "-flto $lto_no_fat" \
{pr22502b.c}] \
+ [list "Build pr26262b.o" \
+ "" "-O2" \
+ {pr26262b.c} {} "" "c"] \
+ [list "Build pr26262c.o" \
+ "" "-O2" \
+ {pr26262c.c} {} "" "c"] \
+ [list "Build pr26267a.o" \
+ "" "-O2 -flto $lto_no_fat" \
+ {pr26267a.c} {} "" "c"] \
+ [list "Build pr26267b.o" \
+ "" "-O2" \
+ {pr26267b.c} {} "" "c"] \
+ [list "Build pr26267c.o" \
+ "" "-O2" \
+ {pr26267c.c} {} "" "c"] \
+ [list "Build pr26267a" \
+ "" "-O2" \
+ {pr26267a.c} {} "" "c"] \
+ [list "Build pr26267a" \
+ "-flto tmpdir/pr26267a.o tmpdir/pr26267b.o tmpdir/pr26267c.o" \
+ "-flto $lto_no_fat" \
+ {dummy.c} \
+ {{error_output "pr26267.err"}} \
+ "pr26267a"] \
+ [list "Build pr26267b" \
+ "-flto tmpdir/pr26267b.o tmpdir/pr26267c.o tmpdir/pr26267a.o" \
+ "-flto $lto_no_fat" \
+ {dummy.c} \
+ {{error_output "pr26267.err"}} \
+ "pr26267b"] \
]
if { [at_least_gcc_version 4 7] } {
@@ -373,6 +403,16 @@ set lto_run_tests [list \
[list "Run pr22502" \
"-O2 -flto tmpdir/pr22502a.o tmpdir/pr22502b.o" "" \
{dummy.c} "pr20267" "pass.out" "-flto -O2" "c"] \
+ [list "Run pr26262a" \
+ "-O2 -flto" "" \
+ {pr26262a.c} "pr26262a" "pass.out" \
+ "-flto -O2" "c" "" \
+ "tmpdir/pr26262b.o tmpdir/pr26262c.o"] \
+ [list "Run pr26262b" \
+ "-flto -O2 tmpdir/pr26262b.o tmpdir/pr26262c.o" "" \
+ {pr26262a.c} "pr26262b" "pass.out" \
+ "-flto -O2" "c" "" \
+ ""] \
]
if { [at_least_gcc_version 4 7] } {
Only in binutils-2.30/ld/testsuite/ld-plugin: pr26262a.c
Only in binutils-2.30/ld/testsuite/ld-plugin: pr26262b.c
Only in binutils-2.30/ld/testsuite/ld-plugin: pr26267.err
Only in binutils-2.30/ld/testsuite/ld-plugin: pr26267a.c
Only in binutils-2.30/ld/testsuite/ld-plugin: pr26267b.c
Only in binutils-2.30/ld/testsuite/ld-plugin: pr26267c.c
--- /dev/null 2020-11-02 08:23:19.196542384 +0000
+++ binutils-2.30/ld/testsuite/ld-plugin/pr26262a.c 2020-11-02 10:13:16.624589913 +0000
@@ -0,0 +1,21 @@
+#include <stdio.h>
+
+int counter;
+extern void foo (void);
+extern void xxx (void);
+
+void
+bar (void)
+{
+}
+
+int
+main(void)
+{
+ bar ();
+ foo ();
+ xxx ();
+ if (counter == 1)
+ printf ("PASS\n");
+ return 0;
+}
--- /dev/null 2020-11-02 08:23:19.196542384 +0000
+++ binutils-2.30/ld/testsuite/ld-plugin/pr26262b.c 2020-11-02 10:13:27.358523487 +0000
@@ -0,0 +1,16 @@
+#include <stdlib.h>
+
+extern int counter;
+
+void
+foo (void)
+{
+ counter++;
+}
+
+__attribute__((weak))
+void
+bar (void)
+{
+ abort ();
+}
--- /dev/null 2020-11-02 08:23:19.196542384 +0000
+++ binutils-2.30/ld/testsuite/ld-plugin/pr26262c.c 2020-11-02 10:47:59.031665605 +0000
@@ -0,0 +1,6 @@
+extern void bar (void);
+void
+xxx (void)
+{
+ bar ();
+}
--- /dev/null 2020-11-02 08:23:19.196542384 +0000
+++ binutils-2.30/ld/testsuite/ld-plugin/pr26267c.c 2020-11-02 10:13:39.665447327 +0000
@@ -0,0 +1,6 @@
+extern void bar (void);
+void
+xxx (void)
+{
+ bar ();
+}
--- /dev/null 2020-11-02 08:23:19.196542384 +0000
+++ binutils-2.30/ld/testsuite/ld-plugin/pr26267b.c 2020-11-02 10:13:43.648422679 +0000
@@ -0,0 +1,15 @@
+#include <stdlib.h>
+
+extern int counter;
+
+void
+foo (void)
+{
+ counter++;
+}
+
+void
+bar (void)
+{
+ abort ();
+}
--- /dev/null 2020-11-02 08:23:19.196542384 +0000
+++ binutils-2.30/ld/testsuite/ld-plugin/pr26267a.c 2020-11-02 10:13:47.556398495 +0000
@@ -0,0 +1,21 @@
+#include <stdio.h>
+
+int counter;
+extern void foo (void);
+extern void xxx (void);
+
+void
+bar (void)
+{
+}
+
+int
+main(void)
+{
+ bar ();
+ foo ();
+ xxx ();
+ if (counter == 1)
+ printf ("PASS\n");
+ return 0;
+}
--- /dev/null 2020-11-02 08:23:19.196542384 +0000
+++ binutils-2.30/ld/testsuite/ld-plugin/pr26267.err 2020-11-02 10:14:01.785310441 +0000
@@ -0,0 +1,3 @@
+#...
+.*: multiple definition of `bar'; .*
+#...
diff -rup binutils.orig/ld/testsuite/ld-plugin/pr26267.err binutils-2.30/ld/testsuite/ld-plugin/pr26267.err
--- binutils.orig/ld/testsuite/ld-plugin/pr26267.err 2020-11-02 12:51:28.751137533 +0000
+++ binutils-2.30/ld/testsuite/ld-plugin/pr26267.err 2020-11-02 13:01:38.430679516 +0000
@@ -1,3 +1,3 @@
#...
-.*: multiple definition of `bar'; .*
+.*: multiple definition of `bar'.*
#...
--- binutils.orig/ld/testsuite/ld-plugin/lto.exp 2020-11-02 12:51:28.751137533 +0000
+++ binutils-2.30/ld/testsuite/ld-plugin/lto.exp 2020-11-02 13:10:49.531708566 +0000
@@ -404,15 +404,13 @@ set lto_run_tests [list \
"-O2 -flto tmpdir/pr22502a.o tmpdir/pr22502b.o" "" \
{dummy.c} "pr20267" "pass.out" "-flto -O2" "c"] \
[list "Run pr26262a" \
- "-O2 -flto" "" \
+ "-O2 -flto tmpdir/pr26262b.o tmpdir/pr26262c.o" "" \
{pr26262a.c} "pr26262a" "pass.out" \
- "-flto -O2" "c" "" \
- "tmpdir/pr26262b.o tmpdir/pr26262c.o"] \
+ "-flto -O2" "c" "" ] \
[list "Run pr26262b" \
"-flto -O2 tmpdir/pr26262b.o tmpdir/pr26262c.o" "" \
{pr26262a.c} "pr26262b" "pass.out" \
- "-flto -O2" "c" "" \
- ""] \
+ "-flto -O2" "c" "" ] \
]
if { [at_least_gcc_version 4 7] } {

View File

@ -0,0 +1,123 @@
--- binutils.orig/bfd/elflink.c 2021-03-19 13:03:56.464793790 +0000
+++ binutils-2.30/bfd/elflink.c 2021-03-19 13:05:17.475264954 +0000
@@ -12825,7 +12825,7 @@ _bfd_elf_gc_mark_rsec (struct bfd_link_i
bfd_boolean *start_stop)
{
unsigned long r_symndx;
- struct elf_link_hash_entry *h;
+ struct elf_link_hash_entry *h, *hw;
r_symndx = cookie->rel->r_info >> cookie->r_sym_shift;
if (r_symndx == STN_UNDEF)
@@ -12845,12 +12845,16 @@ _bfd_elf_gc_mark_rsec (struct bfd_link_i
|| h->root.type == bfd_link_hash_warning)
h = (struct elf_link_hash_entry *) h->root.u.i.link;
h->mark = 1;
- /* If this symbol is weak and there is a non-weak definition, we
- keep the non-weak definition because many backends put
- dynamic reloc info on the non-weak definition for code
- handling copy relocs. */
- if (h->is_weakalias)
- weakdef (h)->mark = 1;
+ /* Keep all aliases of the symbol too. If an object symbol
+ needs to be copied into .dynbss then all of its aliases
+ should be present as dynamic symbols, not just the one used
+ on the copy relocation. */
+ hw = h;
+ while (hw->is_weakalias)
+ {
+ hw = hw->u.alias;
+ hw->mark = 1;
+ }
if (start_stop != NULL)
{
Only in binutils-2.30/ld/testsuite/ld-elf: pr25458.map
Only in binutils-2.30/ld/testsuite/ld-elf: pr25458.rd
Only in binutils-2.30/ld/testsuite/ld-elf: pr25458a.s
Only in binutils-2.30/ld/testsuite/ld-elf: pr25458b.s
diff -rup binutils.orig/ld/testsuite/ld-elf/shared.exp binutils-2.30/ld/testsuite/ld-elf/shared.exp
--- binutils.orig/ld/testsuite/ld-elf/shared.exp 2021-03-19 13:03:56.141795899 +0000
+++ binutils-2.30/ld/testsuite/ld-elf/shared.exp 2021-03-19 13:08:57.839826387 +0000
@@ -296,6 +296,38 @@ if { [check_gc_sections_available] } {
"pr22150" \
] \
]
+
+ switch -glob $target_triplet {
+ # Exclude targets that don't support copy relocs.
+ bfin-*-* { }
+ frv-*-* { }
+ lm32-*-* { }
+ mips*-*-* { }
+ tic6x-*-* { }
+ xtensa-*-* { }
+ default {
+ run_ld_link_tests [list \
+ [list \
+ "Build pr25458.so" \
+ "$LFLAGS -shared --version-script=pr25458.map" \
+ "" \
+ "$AFLAGS_PIC" \
+ {pr25458b.s} \
+ {} \
+ "pr25458.so" \
+ ] \
+ [list \
+ "Build pr25458" \
+ "$LFLAGS -e _start --gc-sections" \
+ "tmpdir/pr25458.so" \
+ "$AFLAGS_PIC" \
+ {pr25458a.s} \
+ {{readelf {--dyn-sym --wide} pr25458.rd}} \
+ "pr25458" \
+ ] \
+ ]
+ }
+ }
}
set ASFLAGS $old_ASFLAGS
--- /dev/null 2021-03-19 08:56:47.991465597 +0000
+++ binutils-2.30/ld/testsuite/ld-elf/pr25458.map 2021-03-19 13:06:34.859759781 +0000
@@ -0,0 +1,4 @@
+FOO {
+global:
+ __environ; _environ; environ;
+};
--- /dev/null 2021-03-19 08:56:47.991465597 +0000
+++ binutils-2.30/ld/testsuite/ld-elf/pr25458.rd 2021-03-19 13:06:34.860759774 +0000
@@ -0,0 +1,10 @@
+#...
+Symbol table '\.dynsym' contains [0-9]+ entries:
+ +Num: +Value +Size Type +Bind +Vis +Ndx Name
+#...
+ +[0-9]+: [0-9a-f]+ +(4|8)+ OBJECT +(WEAK|GLOBAL) +DEFAULT +[0-9]+ _*environ@FOO \(2\)
+#...
+ +[0-9]+: [0-9a-f]+ +(4|8)+ OBJECT +(WEAK|GLOBAL) +DEFAULT +[0-9]+ _*environ@FOO \(2\)
+#...
+ +[0-9]+: [0-9a-f]+ +(4|8)+ OBJECT +(WEAK|GLOBAL) +DEFAULT +[0-9]+ _*environ@FOO \(2\)
+#pass
--- /dev/null 2021-03-19 08:56:47.991465597 +0000
+++ binutils-2.30/ld/testsuite/ld-elf/pr25458a.s 2021-03-19 13:06:34.860759774 +0000
@@ -0,0 +1,6 @@
+ .text
+ .globl _start
+ .type _start, %function
+_start:
+ .dc.a environ
+ .size _start, .-_start
--- /dev/null 2021-03-19 08:56:47.991465597 +0000
+++ binutils-2.30/ld/testsuite/ld-elf/pr25458b.s 2021-03-19 13:06:34.860759774 +0000
@@ -0,0 +1,11 @@
+ .data
+ .globl __environ
+ .type __environ,%object
+__environ:
+ .dc.a 0
+ .size __environ, .-__environ
+ .weak _environ
+ .globl _environ
+ .set _environ, __environ
+ .weak environ
+ .set environ, __environ

View File

@ -0,0 +1,11 @@
--- binutils.orig/bfd/elf.c 2023-04-28 12:54:08.090737942 +0100
+++ binutils-2.30/bfd/elf.c 2023-04-28 12:53:28.602795763 +0100
@@ -8398,6 +8398,8 @@ error_return_verref:
|| bfd_bread (contents, hdr->sh_size, abfd) != hdr->sh_size)
goto error_return_verref;
+ if (hdr->sh_info == 0)
+ goto error_return_verref;
elf_tdata (abfd)->verref = (Elf_Internal_Verneed *)
bfd_alloc2 (abfd, hdr->sh_info, sizeof (Elf_Internal_Verneed));

View File

@ -0,0 +1,23 @@
--- binutils.orig/bfd/elf.c 2019-09-10 10:57:33.391081672 +0100
+++ binutils-2.27/bfd/elf.c 2019-09-10 10:59:55.355010766 +0100
@@ -2324,9 +2324,18 @@ bfd_section_from_shdr (bfd *abfd, unsign
else
p_hdr = &esdt->rel.hdr;
- /* PR 17512: file: 0b4f81b7. */
+ /* PR 17512: file: 0b4f81b7.
+ Also see PR 24456, for a file which deliberately has two reloc
+ sections. */
if (*p_hdr != NULL)
- goto fail;
+ {
+ _bfd_error_handler
+ /* xgettext:c-format */
+ (_("%B: warning: multiple relocation sections for section %A \
+found - ignoring all but the first"),
+ abfd, target_sect);
+ goto success;
+ }
hdr2 = (Elf_Internal_Shdr *) bfd_alloc (abfd, sizeof (*hdr2));
if (hdr2 == NULL)
goto fail;

View File

@ -0,0 +1,97 @@
diff -rup binutils.orig/binutils/doc/binutils.texi binutils-2.30/binutils/doc/binutils.texi
--- binutils.orig/binutils/doc/binutils.texi 2020-04-07 16:11:52.164358203 +0100
+++ binutils-2.30/binutils/doc/binutils.texi 2020-04-07 16:14:37.759171936 +0100
@@ -1586,7 +1586,9 @@ recognized names are @samp{alloc}, @samp
for a section which does not have contents, but it is not meaningful
to clear the @samp{contents} flag of a section which does have
contents--just remove the section instead. Not all flags are
-meaningful for all object file formats.
+meaningful for all object file formats. In particular the
+@samp{share} flag is only meaningful for COFF format files and not for
+ELF format files.
@item --add-section @var{sectionname}=@var{filename}
Add a new section named @var{sectionname} while copying the file. The
@@ -1637,7 +1639,8 @@ Rename a section from @var{oldname} to @
changing the section's flags to @var{flags} in the process. This has
the advantage over using a linker script to perform the rename in that
the output stays as an object file and does not become a linked
-executable.
+executable. This option accepts the same set of flags as the
+@option{--sect-section-flags} option.
This option is particularly helpful when the input format is binary,
since this will always create a section called .data. If for example,
diff -rup binutils.orig/binutils/objcopy.c binutils-2.30/binutils/objcopy.c
--- binutils.orig/binutils/objcopy.c 2020-04-07 16:11:52.177358110 +0100
+++ binutils-2.30/binutils/objcopy.c 2020-04-07 16:16:15.736470047 +0100
@@ -2514,6 +2514,23 @@ merge_gnu_build_notes (bfd * ab
return size;
}
+static flagword
+check_new_section_flags (flagword flags, bfd * abfd, const char * secname)
+{
+ /* Only set the SEC_COFF_SHARED flag on COFF files.
+ The same bit value is used by ELF targets to indicate
+ compressed sections, and setting that flag here breaks
+ things. */
+ if ((flags & SEC_COFF_SHARED)
+ && bfd_get_flavour (abfd) != bfd_target_coff_flavour)
+ {
+ non_fatal (_("%s[%s]: Note - dropping 'share' flag as output format is not COFF"),
+ bfd_get_filename (abfd), secname);
+ flags &= ~ SEC_COFF_SHARED;
+ }
+ return flags;
+}
+
/* Copy object file IBFD onto OBFD.
Returns TRUE upon success, FALSE otherwise. */
@@ -2755,7 +2772,10 @@ copy_object (bfd *ibfd, bfd *obfd, const
pset = find_section_list (padd->name, FALSE,
SECTION_CONTEXT_SET_FLAGS);
if (pset != NULL)
- flags = pset->flags | SEC_HAS_CONTENTS;
+ {
+ flags = pset->flags | SEC_HAS_CONTENTS;
+ flags = check_new_section_flags (flags, obfd, padd->name);
+ }
else
flags = SEC_HAS_CONTENTS | SEC_READONLY | SEC_DATA;
@@ -3867,6 +3887,7 @@ setup_section (bfd *ibfd, sec_ptr isecti
flagword flags;
const char *err;
const char * name;
+ const char * new_name;
char *prefix = NULL;
bfd_boolean make_nobits;
@@ -3876,7 +3897,12 @@ setup_section (bfd *ibfd, sec_ptr isecti
/* Get the, possibly new, name of the output section. */
name = bfd_section_name (ibfd, isection);
flags = bfd_get_section_flags (ibfd, isection);
- name = find_section_rename (name, &flags);
+ new_name = find_section_rename (name, &flags);
+ if (new_name != name)
+ {
+ name = new_name;
+ flags = check_new_section_flags (flags, obfd, name);
+ }
/* Prefix sections. */
if ((prefix_alloc_sections_string)
@@ -3900,7 +3926,10 @@ setup_section (bfd *ibfd, sec_ptr isecti
p = find_section_list (bfd_section_name (ibfd, isection), FALSE,
SECTION_CONTEXT_SET_FLAGS);
if (p != NULL)
- flags = p->flags | (flags & (SEC_HAS_CONTENTS | SEC_RELOC));
+ {
+ flags = p->flags | (flags & (SEC_HAS_CONTENTS | SEC_RELOC));
+ flags = check_new_section_flags (flags, obfd, bfd_section_name (ibfd, isection));
+ }
else if (strip_symbols == STRIP_NONDEBUG
&& (flags & (SEC_ALLOC | SEC_GROUP)) != 0
&& !is_nondebug_keep_contents_section (ibfd, isection))

View File

@ -0,0 +1,212 @@
diff -rup binutils.orig/bfd/elflink.c binutils-2.30/bfd/elflink.c
--- binutils.orig/bfd/elflink.c 2021-03-18 14:33:03.462295923 +0000
+++ binutils-2.30/bfd/elflink.c 2021-03-18 14:37:34.110465450 +0000
@@ -4661,7 +4661,10 @@ error_free_dyn:
object and a shared object. */
bfd_boolean dynsym = FALSE;
- if (! dynamic)
+ /* Plugin symbols aren't normal. Don't set def/ref flags. */
+ if ((abfd->flags & BFD_PLUGIN) != 0)
+ ;
+ else if (!dynamic)
{
if (! definition)
{
@@ -4678,14 +4681,6 @@ error_free_dyn:
h->ref_dynamic = 1;
}
}
-
- /* If the indirect symbol has been forced local, don't
- make the real symbol dynamic. */
- if ((h == hi || !hi->forced_local)
- && (bfd_link_dll (info)
- || h->def_dynamic
- || h->ref_dynamic))
- dynsym = TRUE;
}
else
{
@@ -4699,14 +4694,25 @@ error_free_dyn:
h->def_dynamic = 1;
hi->def_dynamic = 1;
}
+ }
- /* If the indirect symbol has been forced local, don't
- make the real symbol dynamic. */
- if ((h == hi || !hi->forced_local)
- && (h->def_regular
- || h->ref_regular
- || (h->is_weakalias
- && weakdef (h)->dynindx != -1)))
+ /* If an indirect symbol has been forced local, don't
+ make the real symbol dynamic. */
+ if (h != hi && hi->forced_local)
+ ;
+ else if (!dynamic)
+ {
+ if (bfd_link_dll (info)
+ || h->def_dynamic
+ || h->ref_dynamic)
+ dynsym = TRUE;
+ }
+ else
+ {
+ if (h->def_regular
+ || h->ref_regular
+ || (h->is_weakalias
+ && weakdef (h)->dynindx != -1))
dynsym = TRUE;
}
@@ -4841,6 +4847,10 @@ error_free_dyn:
&& !bfd_link_relocatable (info))
dynsym = FALSE;
+ /* Nor should we make plugin symbols dynamic. */
+ if ((abfd->flags & BFD_PLUGIN) != 0)
+ dynsym = FALSE;
+
if (definition)
{
h->target_internal = isym->st_target_internal;
@@ -4866,8 +4876,8 @@ error_free_dyn:
nondeflt_vers[nondeflt_vers_cnt++] = h;
}
}
-
- if (dynsym && (abfd->flags & BFD_PLUGIN) == 0 && h->dynindx == -1)
+
+ if (dynsym && h->dynindx == -1)
{
if (! bfd_elf_link_record_dynamic_symbol (info, h))
goto error_free_vers;
@@ -4897,9 +4907,10 @@ error_free_dyn:
&& matched
&& definition
&& ((dynsym
- && h->ref_regular_nonweak
- && (old_bfd == NULL
- || (old_bfd->flags & BFD_PLUGIN) == 0))
+ && h->ref_regular_nonweak)
+ || (old_bfd != NULL
+ && (old_bfd->flags & BFD_PLUGIN) != 0
+ && bind != STB_WEAK)
|| (h->ref_dynamic_nonweak
&& (elf_dyn_lib_class (abfd) & DYN_AS_NEEDED) != 0
&& !on_needed_list (elf_dt_name (abfd),
Only in binutils-2.30/ld/testsuite/ld-plugin: lto-19.h
Only in binutils-2.30/ld/testsuite/ld-plugin: lto-19a.c
Only in binutils-2.30/ld/testsuite/ld-plugin: lto-19b.c
Only in binutils-2.30/ld/testsuite/ld-plugin: lto-19c.c
diff -rup binutils.orig/ld/testsuite/ld-plugin/lto.exp binutils-2.30/ld/testsuite/ld-plugin/lto.exp
--- binutils.orig/ld/testsuite/ld-plugin/lto.exp 2021-03-18 14:33:02.366303344 +0000
+++ binutils-2.30/ld/testsuite/ld-plugin/lto.exp 2021-03-18 14:41:51.419725611 +0000
@@ -133,7 +133,16 @@ set lto_link_tests [list \
{lto-15a.c} {} ""] \
[list "Build liblto-15.a" \
"$plug_opt" "-flto" \
- {lto-15b.c} {} "liblto-15.a"] \
+ {lto-15b.c} {} "liblto-15.a"] \
+ [list {liblto-19.a} \
+ "$plug_opt" {-flto -O2 -fPIC} \
+ {lto-19a.c} {} {liblto-19.a}] \
+ [list {compile lto-19b.c} \
+ "$plug_opt" {-flto -O2 -fPIC} \
+ {lto-19b.c} {} {} {c}] \
+ [list {liblto-19.so} \
+ {-shared tmpdir/lto-19b.o tmpdir/liblto-19.a} {-O2 -fPIC} \
+ {dummy.c} {} {liblto-19.so}] \
[list "PR ld/12696" \
"-O2 -flto -fuse-linker-plugin -r -nostdlib" "-O2 -flto" \
{pr12696-1.cc} {} "pr12696-1r.o" "c++"] \
@@ -244,6 +253,9 @@ set lto_link_tests [list \
{dummy.c} \
{{error_output "pr26267.err"}} \
"pr26267b"] \
+ [list {pr26806.so} \
+ {-shared} {-fpic -O2 -flto} \
+ {pr26806.c} {{nm {-D} pr26806.d}} {pr26806.so}] \
]
if { [at_least_gcc_version 4 7] } {
@@ -438,6 +450,10 @@ set lto_run_elf_shared_tests [list \
[list {pr22220b} \
{-flto -fuse-linker-plugin -Wl,--no-as-needed tmpdir/pr22220lib.so tmpdir/pr22220main.o} {} \
{dummy.c} {pr22220b.exe} {pass.out} {} {c++}] \
+ [list {lto-19} \
+ {-Wl,--as-needed,-R,tmpdir} {} \
+ {lto-19a.c lto-19b.c lto-19c.c} {lto-19.exe} {pass.out} {-flto -O2} {c} {} \
+ {tmpdir/liblto-19.so tmpdir/liblto-19.a}] \
]
# LTO run-time tests for ELF
Only in binutils-2.30/ld/testsuite/ld-plugin: pr26806.c
Only in binutils-2.30/ld/testsuite/ld-plugin: pr26806.d
--- /dev/null 2021-03-18 09:46:54.398732368 +0000
+++ binutils-2.30/ld/testsuite/ld-plugin/lto-19.h 2021-03-18 14:38:53.903925902 +0000
@@ -0,0 +1,6 @@
+struct re_dfa_t {
+ const int *sb_char;
+};
+struct re_dfa_t *xregcomp (void);
+struct re_dfa_t *rpl_regcomp (void);
+void rpl_regfree (struct re_dfa_t *);
--- /dev/null 2021-03-18 09:46:54.398732368 +0000
+++ binutils-2.30/ld/testsuite/ld-plugin/lto-19a.c 2021-03-18 14:38:53.903925902 +0000
@@ -0,0 +1,19 @@
+#include <stdio.h>
+#include <stdlib.h>
+#include "lto-19.h"
+
+static const int utf8_sb_map[4] = { 0x12, 0x34, 0x56, 0x78 };
+
+struct re_dfa_t *
+rpl_regcomp ()
+{
+ struct re_dfa_t *dfa = malloc (sizeof (struct re_dfa_t));
+ dfa->sb_char = utf8_sb_map;
+ return dfa;
+}
+
+void
+rpl_regfree (struct re_dfa_t *dfa)
+{
+ puts (dfa->sb_char == utf8_sb_map ? "PASS" : "FAIL");
+}
--- /dev/null 2021-03-18 09:46:54.398732368 +0000
+++ binutils-2.30/ld/testsuite/ld-plugin/lto-19b.c 2021-03-18 14:38:53.903925902 +0000
@@ -0,0 +1,7 @@
+#include "lto-19.h"
+
+struct re_dfa_t *
+xregcomp (void)
+{
+ return rpl_regcomp ();
+}
--- /dev/null 2021-03-18 09:46:54.398732368 +0000
+++ binutils-2.30/ld/testsuite/ld-plugin/lto-19c.c 2021-03-18 14:38:53.903925902 +0000
@@ -0,0 +1,9 @@
+#include "lto-19.h"
+
+int
+main ()
+{
+ struct re_dfa_t *dfa = xregcomp ();
+ rpl_regfree (dfa);
+ return 0;
+}
--- /dev/null 2021-03-18 09:46:54.398732368 +0000
+++ binutils-2.30/ld/testsuite/ld-plugin/pr26806.c 2021-03-18 14:39:16.319774345 +0000
@@ -0,0 +1,2 @@
+#include <unistd.h>
+int foo (int x) { if (__builtin_constant_p (x)) return getpid (); return 0; }
--- /dev/null 2021-03-18 09:46:54.398732368 +0000
+++ binutils-2.30/ld/testsuite/ld-plugin/pr26806.d 2021-03-18 14:39:16.319774345 +0000
@@ -0,0 +1,4 @@
+#failif
+#...
+.* _*getpid[@ ].*
+#...

View File

@ -0,0 +1,42 @@
--- binutils.orig/bfd/elf-bfd.h 2021-09-20 16:06:58.320914954 +0100
+++ binutils-2.30/bfd/elf-bfd.h 2021-09-20 16:26:11.307770371 +0100
@@ -180,6 +180,8 @@ struct elf_link_hash_entry
/* Symbol has a non-weak reference from a non-shared object (other than
the object in which it is defined). */
unsigned int ref_regular_nonweak : 1;
+ /* Symbol has a non-weak reference from a LTO IR object file. */
+ unsigned int ref_ir_nonweak : 1;
/* Dynamic symbol has been adjustd. */
unsigned int dynamic_adjusted : 1;
/* Symbol needs a copy reloc. */
--- binutils.orig/bfd/elflink.c 2021-09-29 14:36:01.294185139 +0100
+++ binutils-2.30/bfd/elflink.c 2021-09-29 14:39:08.113874485 +0100
@@ -4663,7 +4663,12 @@ error_free_dyn:
/* Plugin symbols aren't normal. Don't set def/ref flags. */
if ((abfd->flags & BFD_PLUGIN) != 0)
- ;
+ {
+ /* Except for this flag to track nonweak references. */
+ if (!definition
+ && bind != STB_WEAK)
+ h->ref_ir_nonweak = 1;
+ }
else if (!dynamic)
{
if (! definition)
@@ -4906,11 +4911,13 @@ error_free_dyn:
if (!add_needed
&& matched
&& definition
+ && h->root.type != bfd_link_hash_indirect
&& ((dynsym
&& h->ref_regular_nonweak)
|| (old_bfd != NULL
&& (old_bfd->flags & BFD_PLUGIN) != 0
- && bind != STB_WEAK)
+ && h->ref_ir_nonweak
+ && !info->lto_all_symbols_read)
|| (h->ref_dynamic_nonweak
&& (elf_dyn_lib_class (abfd) & DYN_AS_NEEDED) != 0
&& !on_needed_list (elf_dt_name (abfd),

View File

@ -0,0 +1,138 @@
diff -rup binutils.orig/ld/testsuite/ld-plugin/lto.exp binutils-2.35.1/ld/testsuite/ld-plugin/lto.exp
--- binutils.orig/ld/testsuite/ld-plugin/lto.exp 2020-10-09 11:46:13.571665439 +0100
+++ binutils-2.35.1/ld/testsuite/ld-plugin/lto.exp 2020-10-09 11:47:59.113302758 +0100
@@ -319,27 +319,6 @@ set lto_link_elf_tests [list \
[list "PR ld/13244" \
"-shared -O2 -fPIC -flto -fuse-linker-plugin -nostdlib" "-O2 -fno-early-inlining -flto" \
{pr13244.c} {{"readelf" {-s --wide} "pr13244.d"}} "pr13244.so" "c"] \
- [list "Build libpr15146a.a" \
- "$plug_opt" "-flto -O2" \
- {pr15146a.c} {} "lib15146a.a"] \
- [list "Build pr15146b.so" \
- "-shared" "-O2 -fpic" \
- {pr15146b.c} {} "pr15146b.so" "c"] \
- [list "Build pr15146c.so" \
- "-shared -Wl,--no-as-needed tmpdir/pr15146b.so" "-O2 -fpic" \
- {pr15146c.c} {} "pr15146c.so" "c"] \
- [list "PR ld/15146 (1)" \
- "-O2 -flto -fuse-linker-plugin -Wl,-rpath-link,. -Wl,--no-copy-dt-needed-entries -Wl,--no-as-needed tmpdir/pr15146a.o tmpdir/pr15146c.so" "" \
- {dummy.c} {{"readelf" {-d} "pr15146.d"}} "pr15146a.exe"] \
- [list "Build libpr15146d.a" \
- "$plug_opt" "-flto -O2" \
- {pr15146d.c} {} "lib15146d.a"] \
- [list "Build libpr16746a.a" \
- "" "" \
- {pr16746a.c pr16746b.c} {} "lib15146a.a"] \
- [list "Build libpr16746b.a" \
- "$plug_opt" "-O2 -flto" \
- {pr16746c.c pr16746d.c} {} "lib15146b.a"] \
[list "PR ld/16746 (1)" \
"-O2 -flto -fuse-linker-plugin tmpdir/pr16746a.o tmpdir/pr16746c.o" "-O2 -flto" \
{dummy.c} {} "pr16746a.exe"] \
@@ -602,13 +581,6 @@ 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
- set testname "PR ld/15146 (2)"
- set exec_output [run_host_cmd "$CC" "-O2 -flto -fuse-linker-plugin -Wl,-rpath-link,. -Wl,--no-copy-dt-needed-entries -Wl,--no-as-needed tmpdir/pr15146d.o tmpdir/pr15146c.so"]
- if { [ regexp "undefined reference to symbol '\\.?xxx'" $exec_output ] } {
- pass $testname
- } {
- fail $testname
- }
set testname "PR ld/16746 (3)"
set exec_output [run_host_cmd "$CC" "-O2 -flto -fuse-linker-plugin tmpdir/pr16746b.o tmpdir/pr16746d.o"]
if { [ regexp "warning: \\.?foobar" $exec_output ] && ![ regexp "symbol from plugin" $exec_output ] } {
diff -rup binutils.orig/bfd/elflink.c binutils-2.35.1/bfd/elflink.c
--- binutils.orig/bfd/elflink.c 2020-10-09 11:46:14.151663446 +0100
+++ binutils-2.35.1/bfd/elflink.c 2020-10-09 11:46:27.222618528 +0100
@@ -4970,11 +4970,7 @@ elf_link_add_object_symbols (bfd *abfd,
object and a shared object. */
bfd_boolean dynsym = FALSE;
- /* Plugin symbols aren't normal. Don't set def_regular or
- ref_regular for them, or make them dynamic. */
- if ((abfd->flags & BFD_PLUGIN) != 0)
- ;
- else if (! dynamic)
+ if (! dynamic)
{
if (! definition)
{
@@ -5155,10 +5151,6 @@ elf_link_add_object_symbols (bfd *abfd,
&& !bfd_link_relocatable (info))
dynsym = FALSE;
- /* Nor should we make plugin symbols dynamic. */
- if ((abfd->flags & BFD_PLUGIN) != 0)
- dynsym = FALSE;
-
if (definition)
{
h->target_internal = isym->st_target_internal;
@@ -5185,7 +5177,7 @@ elf_link_add_object_symbols (bfd *abfd,
}
}
- if (dynsym && h->dynindx == -1)
+ if (dynsym && (abfd->flags & BFD_PLUGIN) == 0 && h->dynindx == -1)
{
if (! bfd_elf_link_record_dynamic_symbol (info, h))
goto error_free_vers;
--- binutils.orig/ld/testsuite/ld-plugin/lto.exp 2020-10-28 12:23:49.034685727 +0000
+++ binutils-2.30/ld/testsuite/ld-plugin/lto.exp 2020-10-28 12:24:48.288484833 +0000
@@ -265,12 +265,6 @@ set lto_link_elf_tests [list \
[list "PR ld/13244" \
"-shared -O2 -fPIC -flto -fuse-linker-plugin -nostdlib" "-O2 -fno-early-inlining -flto" \
{pr13244.c} {{"readelf" {-s --wide} "pr13244.d"}} "pr13244.so" "c"] \
- [list "PR ld/16746 (1)" \
- "-O2 -flto -fuse-linker-plugin tmpdir/pr16746a.o tmpdir/pr16746c.o" "-O2 -flto" \
- {dummy.c} {} "pr16746a.exe"] \
- [list "PR ld/16746 (2)" \
- "-O2 -flto -fuse-linker-plugin tmpdir/pr16746c.o tmpdir/pr16746a.o" "-O2 -flto" \
- {dummy.c} {} "pr16746b.exe"] \
[list "Build pr21382a.o" \
"" "-O2 -flto" \
{pr21382a.c} {} "" "c"] \
@@ -424,25 +418,6 @@ run_cc_link_tests $lto_link_tests
# 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
- set testname "PR ld/16746 (3)"
- set exec_output [run_host_cmd "$CC" "-O2 -flto -fuse-linker-plugin tmpdir/pr16746b.o tmpdir/pr16746d.o"]
- if { [ regexp "warning: \\.?foobar" $exec_output ] && ![ regexp "symbol from plugin" $exec_output ] } {
- pass $testname
- } {
- fail $testname
- }
- set testname "PR ld/16746 (4)"
- set exec_output [run_host_cmd "$CC" "-O2 -flto -fuse-linker-plugin tmpdir/pr16746d.o tmpdir/pr16746b.o"]
- if { [ regexp "warning: \\.?foobar" $exec_output ] && ![ regexp "symbol from plugin" $exec_output ] } {
- pass $testname
- } {
- fail $testname
- }
-}
-
set testname "Build liblto-11.a"
remote_file host delete "tmpdir/liblto-11.a"
set catch_output [run_host_cmd "$ar" "rc $plug_opt tmpdir/liblto-11.a tmpdir/lto-11a.o tmpdir/lto-11b.o tmpdir/lto-11c.o"]
--- binutils.orig/ld/testsuite/ld-plugin/lto.exp 2020-10-28 12:47:18.581911539 +0000
+++ binutils-2.30/ld/testsuite/ld-plugin/lto.exp 2020-10-28 12:50:25.048280769 +0000
@@ -418,6 +418,11 @@ run_cc_link_tests $lto_link_tests
# 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
+}
+
set testname "Build liblto-11.a"
remote_file host delete "tmpdir/liblto-11.a"
set catch_output [run_host_cmd "$ar" "rc $plug_opt tmpdir/liblto-11.a tmpdir/lto-11a.o tmpdir/lto-11b.o tmpdir/lto-11c.o"]

View File

@ -0,0 +1,42 @@
--- binutils.orig/bfd/plugin.c 2022-01-19 16:17:33.290999966 +0000
+++ binutils-2.30/bfd/plugin.c 2022-01-19 16:23:33.704473426 +0000
@@ -349,7 +349,7 @@ try_claim (bfd *abfd)
}
static int
-try_load_plugin (const char *pname, bfd *abfd, int *has_plugin_p)
+try_load_plugin (const char *pname, bfd *abfd, int *has_plugin_p, bfd_boolean build_list_p)
{
void *plugin_handle;
struct ld_plugin_tv tv[4];
@@ -362,7 +362,11 @@ try_load_plugin (const char *pname, bfd
plugin_handle = dlopen (pname, RTLD_NOW);
if (!plugin_handle)
{
- _bfd_error_handler ("%s\n", dlerror ());
+ /* If we are building a list of viable plugins, then
+ we do not bother the user with the details of any
+ plugins that cannot be loaded. */
+ if (! build_list_p)
+ _bfd_error_handler ("%s\n", dlerror ());
return 0;
}
@@ -477,7 +481,7 @@ load_plugin (bfd *abfd)
return found;
if (plugin_name)
- return try_load_plugin (plugin_name, abfd, &has_plugin);
+ return try_load_plugin (plugin_name, abfd, &has_plugin, FALSE);
if (plugin_program_name == NULL)
return found;
@@ -501,7 +505,7 @@ load_plugin (bfd *abfd)
full_name = concat (p, "/", ent->d_name, NULL);
if (stat(full_name, &s) == 0 && S_ISREG (s.st_mode))
- found = try_load_plugin (full_name, abfd, &valid_plugin);
+ found = try_load_plugin (full_name, abfd, &valid_plugin, TRUE);
if (has_plugin <= 0)
has_plugin = valid_plugin;
free (full_name);

View File

@ -0,0 +1,383 @@
diff -rup binutils.orig/bfd/Makefile.am binutils-2.30/bfd/Makefile.am
--- binutils.orig/bfd/Makefile.am 2022-08-19 12:00:54.247630878 +0100
+++ binutils-2.30/bfd/Makefile.am 2022-08-19 12:20:51.714655518 +0100
@@ -52,7 +52,7 @@ ZLIBINC = @zlibinc@
WARN_CFLAGS = @WARN_CFLAGS@
NO_WERROR = @NO_WERROR@
AM_CFLAGS = $(WARN_CFLAGS) $(ZLIBINC)
-AM_CPPFLAGS = -DBINDIR='"$(bindir)"'
+AM_CPPFLAGS = -DBINDIR='"$(bindir)"' -DLIBDIR='"$(libdir)"'
if PLUGINS
bfdinclude_HEADERS += $(INCDIR)/plugin-api.h
LIBDL = @lt_cv_dlopen_libs@
diff -rup binutils.orig/bfd/Makefile.in binutils-2.30/bfd/Makefile.in
--- binutils.orig/bfd/Makefile.in 2022-08-19 12:00:54.248630872 +0100
+++ binutils-2.30/bfd/Makefile.in 2022-08-19 12:21:24.788462670 +0100
@@ -390,7 +390,7 @@ libbfd_la_LDFLAGS = -Wl,-Bsymbolic-funct
ZLIB = @zlibdir@ -lz
ZLIBINC = @zlibinc@
AM_CFLAGS = $(WARN_CFLAGS) $(ZLIBINC)
-AM_CPPFLAGS = -DBINDIR='"$(bindir)"'
+AM_CPPFLAGS = -DBINDIR='"$(bindir)"' -DLIBDIR='"$(libdir)"'
@PLUGINS_TRUE@LIBDL = @lt_cv_dlopen_libs@
# bfd.h goes here, for now
diff -rup binutils.orig/bfd/plugin.c binutils-2.30/bfd/plugin.c
--- binutils.orig/bfd/plugin.c 2022-08-19 12:00:54.248630872 +0100
+++ binutils-2.30/bfd/plugin.c 2022-08-19 12:24:10.466496616 +0100
@@ -348,16 +348,44 @@ try_claim (bfd *abfd)
return claimed;
}
+struct plugin_list_entry
+{
+ /* These must be initialized for each IR object with LTO wrapper. */
+ ld_plugin_claim_file_handler claim_file;
+ ld_plugin_all_symbols_read_handler all_symbols_read;
+ ld_plugin_all_symbols_read_handler cleanup_handler;
+ bfd_boolean has_symbol_type;
+
+ struct plugin_list_entry *next;
+
+ /* These can be reused for all IR objects. */
+ const char *plugin_name;
+};
+
+static struct plugin_list_entry *plugin_list = NULL;
+static struct plugin_list_entry *current_plugin = NULL;
+
static int
-try_load_plugin (const char *pname, bfd *abfd, int *has_plugin_p, bfd_boolean build_list_p)
+try_load_plugin (const char *pname,
+ struct plugin_list_entry *plugin_list_iter,
+ bfd *abfd,
+ bfd_boolean build_list_p)
{
void *plugin_handle;
struct ld_plugin_tv tv[4];
int i;
ld_plugin_onload onload;
enum ld_plugin_status status;
+ int result = 0;
+
+ /* NB: Each object is independent. Reuse the previous plugin from
+ the last run will lead to wrong result. */
+ if (current_plugin)
+ memset (current_plugin, 0,
+ offsetof (struct plugin_list_entry, next));
- *has_plugin_p = 0;
+ if (plugin_list_iter)
+ pname = plugin_list_iter->plugin_name;
plugin_handle = dlopen (pname, RTLD_NOW);
if (!plugin_handle)
@@ -366,13 +394,40 @@ try_load_plugin (const char *pname, bfd
we do not bother the user with the details of any
plugins that cannot be loaded. */
if (! build_list_p)
- _bfd_error_handler ("%s\n", dlerror ());
+ _bfd_error_handler ("Failed to load plugin '%s', reason: %s\n",
+ pname, dlerror ());
return 0;
}
+ if (plugin_list_iter == NULL)
+ {
+ size_t length_plugin_name = strlen (pname) + 1;
+ char *plugin_name = bfd_malloc (length_plugin_name);
+
+ if (plugin_name == NULL)
+ goto short_circuit;
+ plugin_list_iter = bfd_malloc (sizeof *plugin_list_iter);
+ if (plugin_list_iter == NULL)
+ {
+ free (plugin_name);
+ goto short_circuit;
+ }
+ /* Make a copy of PNAME since PNAME from load_plugin () will be
+ freed. */
+ memcpy (plugin_name, pname, length_plugin_name);
+ memset (plugin_list_iter, 0, sizeof (*plugin_list_iter));
+ plugin_list_iter->plugin_name = plugin_name;
+ plugin_list_iter->next = plugin_list;
+ plugin_list = plugin_list_iter;
+ }
+
+ current_plugin = plugin_list_iter;
+ if (build_list_p)
+ goto short_circuit;
+
onload = dlsym (plugin_handle, "onload");
if (!onload)
- goto err;
+ goto short_circuit;
i = 0;
tv[i].tv_tag = LDPT_MESSAGE;
@@ -393,34 +448,26 @@ try_load_plugin (const char *pname, bfd
status = (*onload)(tv);
if (status != LDPS_OK)
- goto err;
-
- *has_plugin_p = 1;
+ goto short_circuit;
abfd->plugin_format = bfd_plugin_no;
- if (!claim_file)
- goto err;
+ if (!current_plugin->claim_file)
+ goto short_circuit;
if (!try_claim (abfd))
- goto err;
+ goto short_circuit;
abfd->plugin_format = bfd_plugin_yes;
+ result = 1;
- /* There is a potential resource leak here, but it is not important. */
- /* coverity[leaked_storage: FALSE] */
- return 1;
-
- err:
- /* There is a potential resource leak here, but it is not important. */
- /* coverity[leaked_storage: FALSE] */
- return 0;
+ short_circuit:
+ dlclose (plugin_handle);
+ return result;
}
/* There may be plugin libraries in lib/bfd-plugins. */
-static int has_plugin = -1;
-
static const bfd_target *(*ld_plugin_object_p) (bfd *);
static const char *plugin_name;
@@ -429,7 +476,6 @@ void
bfd_plugin_set_plugin (const char *p)
{
plugin_name = p;
- has_plugin = p != NULL;
}
/* Return TRUE if a plugin library is used. */
@@ -437,7 +483,7 @@ bfd_plugin_set_plugin (const char *p)
bfd_boolean
bfd_plugin_specified_p (void)
{
- return has_plugin > 0;
+ return plugin_list != NULL;
}
/* Return TRUE if ABFD can be claimed by linker LTO plugin. */
@@ -468,60 +514,92 @@ register_ld_plugin_object_p (const bfd_t
ld_plugin_object_p = object_p;
}
+/* There may be plugin libraries in lib/bfd-plugins. */
+static int has_plugin_list = -1;
+
+static void
+build_plugin_list (bfd *abfd)
+{
+ /* The intent was to search ${libdir}/bfd-plugins for plugins, but
+ unfortunately the original implementation wasn't precisely that
+ when configuring binutils using --libdir. Search in the proper
+ path first, then the old one for backwards compatibility. */
+ static const char *path[]
+ = { LIBDIR "/bfd-plugins",
+ BINDIR "/../lib/bfd-plugins" };
+ struct stat last_st;
+ unsigned int i;
+
+ if (has_plugin_list >= 0)
+ return;
+
+ /* Try not to search the same dir twice, by looking at st_dev and
+ st_ino for the dir. If we are on a file system that always sets
+ st_ino to zero or the actual st_ino is zero we might waste some
+ time, but that doesn't matter too much. */
+ last_st.st_dev = 0;
+ last_st.st_ino = 0;
+ for (i = 0; i < sizeof (path) / sizeof (path[0]); i++)
+ {
+ char *plugin_dir = make_relative_prefix (plugin_program_name,
+ BINDIR,
+ path[i]);
+ if (plugin_dir)
+ {
+ struct stat st;
+ DIR *d;
+
+ if (stat (plugin_dir, &st) == 0
+ && S_ISDIR (st.st_mode)
+ && !(last_st.st_dev == st.st_dev
+ && last_st.st_ino == st.st_ino
+ && st.st_ino != 0)
+ && (d = opendir (plugin_dir)) != NULL)
+ {
+ struct dirent *ent;
+
+ last_st.st_dev = st.st_dev;
+ last_st.st_ino = st.st_ino;
+ while ((ent = readdir (d)) != NULL)
+ {
+ char *full_name;
+
+ full_name = concat (plugin_dir, "/", ent->d_name, NULL);
+ if (stat (full_name, &st) == 0 && S_ISREG (st.st_mode))
+ (void) try_load_plugin (full_name, NULL, abfd, TRUE);
+ free (full_name);
+ }
+ closedir (d);
+ }
+ free (plugin_dir);
+ }
+ }
+
+ has_plugin_list = plugin_list != NULL;
+}
+
static int
load_plugin (bfd *abfd)
{
- char *plugin_dir;
- char *p;
- DIR *d;
- struct dirent *ent;
- int found = 0;
+ struct plugin_list_entry *plugin_list_iter;
- if (!has_plugin)
- return found;
-
- if (plugin_name)
- return try_load_plugin (plugin_name, abfd, &has_plugin, FALSE);
+ if (plugin_name != NULL)
+ return try_load_plugin (plugin_name, plugin_list, abfd, FALSE);
if (plugin_program_name == NULL)
- return found;
-
- plugin_dir = concat (BINDIR, "/../lib/bfd-plugins", NULL);
- p = make_relative_prefix (plugin_program_name,
- BINDIR,
- plugin_dir);
- free (plugin_dir);
- plugin_dir = NULL;
-
- d = opendir (p);
- if (!d)
- goto out;
+ return 0;
- while ((ent = readdir (d)))
- {
- char *full_name;
- struct stat s;
- int valid_plugin;
-
- full_name = concat (p, "/", ent->d_name, NULL);
- if (stat(full_name, &s) == 0 && S_ISREG (s.st_mode))
- found = try_load_plugin (full_name, abfd, &valid_plugin, TRUE);
- if (has_plugin <= 0)
- has_plugin = valid_plugin;
- free (full_name);
- if (found)
- break;
- }
+ build_plugin_list (abfd);
- out:
- free (p);
- if (d)
- closedir (d);
+ for (plugin_list_iter = plugin_list;
+ plugin_list_iter;
+ plugin_list_iter = plugin_list_iter->next)
+ if (try_load_plugin (NULL, plugin_list_iter, abfd, FALSE))
+ return 1;
- return found;
+ return 0;
}
-
static const bfd_target *
bfd_plugin_object_p (bfd *abfd)
{
--- binutils.orig/bfd/plugin.c 2022-08-19 13:54:29.289173969 +0100
+++ binutils-2.30/bfd/plugin.c 2022-08-19 14:13:24.077310901 +0100
@@ -122,13 +122,29 @@ message (int level ATTRIBUTE_UNUSED,
return LDPS_OK;
}
+struct plugin_list_entry
+{
+ /* These must be initialized for each IR object with LTO wrapper. */
+ ld_plugin_claim_file_handler claim_file;
+ ld_plugin_all_symbols_read_handler all_symbols_read;
+ ld_plugin_all_symbols_read_handler cleanup_handler;
+ bfd_boolean has_symbol_type;
+
+ struct plugin_list_entry *next;
+
+ /* These can be reused for all IR objects. */
+ const char *plugin_name;
+};
+
+static struct plugin_list_entry *plugin_list = NULL;
+static struct plugin_list_entry *current_plugin = NULL;
+
/* Register a claim-file handler. */
-static ld_plugin_claim_file_handler claim_file;
static enum ld_plugin_status
register_claim_file (ld_plugin_claim_file_handler handler)
{
- claim_file = handler;
+ current_plugin->claim_file = handler;
return LDPS_OK;
}
@@ -339,32 +355,17 @@ try_claim (bfd *abfd)
int claimed = 0;
struct ld_plugin_input_file file;
+ if (current_plugin->claim_file == NULL)
+ return 0;
if (!bfd_plugin_open_input (abfd, &file))
return 0;
file.handle = abfd;
off_t cur_offset = lseek (file.fd, 0, SEEK_CUR);
- claim_file (&file, &claimed);
+ current_plugin->claim_file (&file, &claimed);
lseek (file.fd, cur_offset, SEEK_SET);
return claimed;
}
-struct plugin_list_entry
-{
- /* These must be initialized for each IR object with LTO wrapper. */
- ld_plugin_claim_file_handler claim_file;
- ld_plugin_all_symbols_read_handler all_symbols_read;
- ld_plugin_all_symbols_read_handler cleanup_handler;
- bfd_boolean has_symbol_type;
-
- struct plugin_list_entry *next;
-
- /* These can be reused for all IR objects. */
- const char *plugin_name;
-};
-
-static struct plugin_list_entry *plugin_list = NULL;
-static struct plugin_list_entry *current_plugin = NULL;
-
static int
try_load_plugin (const char *pname,
struct plugin_list_entry *plugin_list_iter,

View File

@ -0,0 +1,42 @@
--- binutils.orig/binutils/objcopy.c 2021-02-18 11:35:48.062479490 +0000
+++ binutils-2.30/binutils/objcopy.c 2021-02-18 11:36:52.207071148 +0000
@@ -2224,6 +2224,11 @@ merge_gnu_build_notes (bfd * ab
goto done;
}
+ if (start > end)
+ /* This can happen with PPC64LE binaries where empty notes are
+ encoded as start = end + 4. */
+ start = end;
+
if (is_open_note (pnote))
{
if (start)
--- binutils.orig/binutils/objcopy.c 2021-02-22 16:04:09.390542219 +0000
+++ binutils-2.30/binutils/objcopy.c 2021-02-22 16:04:32.214392597 +0000
@@ -2195,23 +2195,8 @@ merge_gnu_build_notes (bfd * ab
break;
case 8:
- if (! is_64bit (abfd))
- {
- start = bfd_get_32 (abfd, pnote->note.descdata);
- end = bfd_get_32 (abfd, pnote->note.descdata + 4);
- }
- else
- {
- start = bfd_get_64 (abfd, pnote->note.descdata);
- /* FIXME: For version 1 and 2 notes we should try to
- calculate the end address by finding a symbol whose
- value is START, and then adding in its size.
-
- For now though, since v1 and v2 was not intended to
- handle gaps, we chose an artificially large end
- address. */
- end = (bfd_vma) 0x7ffffffffffffffUL;
- }
+ start = bfd_get_32 (abfd, pnote->note.descdata);
+ end = bfd_get_32 (abfd, pnote->note.descdata + 4);
break;
case 16:

View File

@ -0,0 +1,150 @@
diff -rup binutils.orig/gas/testsuite/gas/s390/zarch-z13.d binutils-2.30/gas/testsuite/gas/s390/zarch-z13.d
--- binutils.orig/gas/testsuite/gas/s390/zarch-z13.d 2020-06-24 16:02:24.228446160 +0100
+++ binutils-2.30/gas/testsuite/gas/s390/zarch-z13.d 2020-06-24 16:02:35.952409554 +0100
@@ -17,7 +17,6 @@ Disassembly of section .text:
.*: e7 f0 fd fc 10 46 [ ]*vgmh %v15,253,252
.*: e7 f0 fd fc 20 46 [ ]*vgmf %v15,253,252
.*: e7 f0 fd fc 30 46 [ ]*vgmg %v15,253,252
-.*: e7 f6 9f a0 00 06 [ ]*vl %v15,4000\(%r6,%r9\)
.*: e7 f1 00 00 04 56 [ ]*vlr %v15,%v17
.*: e7 f6 9f a0 d0 05 [ ]*vlrep %v15,4000\(%r6,%r9\),13
.*: e7 f6 9f a0 00 05 [ ]*vlrepb %v15,4000\(%r6,%r9\)
@@ -42,7 +41,6 @@ Disassembly of section .text:
.*: e7 f6 9f a0 10 04 [ ]*vllezh %v15,4000\(%r6,%r9\)
.*: e7 f6 9f a0 20 04 [ ]*vllezf %v15,4000\(%r6,%r9\)
.*: e7 f6 9f a0 30 04 [ ]*vllezg %v15,4000\(%r6,%r9\)
-.*: e7 f1 6f a0 04 36 [ ]*vlm %v15,%v17,4000\(%r6\)
.*: e7 f6 9f a0 d0 07 [ ]*vlbb %v15,4000\(%r6,%r9\),13
.*: e7 f6 9f a0 d0 22 [ ]*vlvg %v15,%r6,4000\(%r9\),13
.*: e7 f6 9f a0 00 22 [ ]*vlvgb %v15,%r6,4000\(%r9\)
@@ -98,12 +96,10 @@ Disassembly of section .text:
.*: e7 f1 00 00 04 5f [ ]*vsegb %v15,%v17
.*: e7 f1 00 00 14 5f [ ]*vsegh %v15,%v17
.*: e7 f1 00 00 24 5f [ ]*vsegf %v15,%v17
-.*: e7 f6 9f a0 00 0e [ ]*vst %v15,4000\(%r6,%r9\)
.*: e7 f6 9f a0 d0 08 [ ]*vsteb %v15,4000\(%r6,%r9\),13
.*: e7 f6 9f a0 d0 09 [ ]*vsteh %v15,4000\(%r6,%r9\),13
.*: e7 f6 9f a0 d0 0b [ ]*vstef %v15,4000\(%r6,%r9\),13
.*: e7 f6 9f a0 d0 0a [ ]*vsteg %v15,4000\(%r6,%r9\),13
-.*: e7 f1 6f a0 04 3e [ ]*vstm %v15,%v17,4000\(%r6\)
.*: e7 f6 9f a0 00 3f [ ]*vstl %v15,%r6,4000\(%r9\)
.*: e7 f1 00 00 d4 d7 [ ]*vuph %v15,%v17,13
.*: e7 f1 00 00 04 d7 [ ]*vuphb %v15,%v17
@@ -680,3 +676,11 @@ Disassembly of section .text:
.*: e3 69 b8 f0 fd 3b [ ]*lzrf %r6,-10000\(%r9,%r11\)
.*: e3 69 b8 f0 fd 2a [ ]*lzrg %r6,-10000\(%r9,%r11\)
.*: b9 3c 00 69 [ ]*prno %r6,%r9
+.*: e7 f6 9f a0 00 06 [ ]*vl %v15,4000\(%r6,%r9\)
+.*: e7 f6 9f a0 d0 06 [ ]*vl %v15,4000\(%r6,%r9\),13
+.*: e7 f1 6f a0 04 36 [ ]*vlm %v15,%v17,4000\(%r6\)
+.*: e7 f1 6f a0 d4 36 [ ]*vlm %v15,%v17,4000\(%r6\),13
+.*: e7 f6 9f a0 00 0e [ ]*vst %v15,4000\(%r6,%r9\)
+.*: e7 f6 9f a0 d0 0e [ ]*vst %v15,4000\(%r6,%r9\),13
+.*: e7 f1 6f a0 04 3e [ ]*vstm %v15,%v17,4000\(%r6\)
+.*: e7 f1 6f a0 d4 3e [ ]*vstm %v15,%v17,4000\(%r6\),13
diff -rup binutils.orig/gas/testsuite/gas/s390/zarch-z13.s binutils-2.30/gas/testsuite/gas/s390/zarch-z13.s
--- binutils.orig/gas/testsuite/gas/s390/zarch-z13.s 2020-06-24 16:02:24.227446163 +0100
+++ binutils-2.30/gas/testsuite/gas/s390/zarch-z13.s 2020-06-24 16:02:35.952409554 +0100
@@ -11,7 +11,6 @@ foo:
vgmh %v15,253,252
vgmf %v15,253,252
vgmg %v15,253,252
- vl %v15,4000(%r6,%r9)
vlr %v15,%v17
vlrep %v15,4000(%r6,%r9),13
vlrepb %v15,4000(%r6,%r9)
@@ -36,7 +35,6 @@ foo:
vllezh %v15,4000(%r6,%r9)
vllezf %v15,4000(%r6,%r9)
vllezg %v15,4000(%r6,%r9)
- vlm %v15,%v17,4000(%r6)
vlbb %v15,4000(%r6,%r9),13
vlvg %v15,%r6,4000(%r9),13
vlvgb %v15,%r6,4000(%r9)
@@ -92,12 +90,10 @@ foo:
vsegb %v15,%v17
vsegh %v15,%v17
vsegf %v15,%v17
- vst %v15,4000(%r6,%r9)
vsteb %v15,4000(%r6,%r9),13
vsteh %v15,4000(%r6,%r9),13
vstef %v15,4000(%r6,%r9),13
vsteg %v15,4000(%r6,%r9),13
- vstm %v15,%v17,4000(%r6)
vstl %v15,%r6,4000(%r9)
vuph %v15,%v17,13
vuphb %v15,%v17
@@ -674,3 +670,11 @@ foo:
lzrf %r6,-10000(%r9,%r11)
lzrg %r6,-10000(%r9,%r11)
ppno %r6,%r9
+ vl %v15,4000(%r6,%r9)
+ vl %v15,4000(%r6,%r9),13
+ vlm %v15,%v17,4000(%r6)
+ vlm %v15,%v17,4000(%r6),13
+ vst %v15,4000(%r6,%r9)
+ vst %v15,4000(%r6,%r9),13
+ vstm %v15,%v17,4000(%r6)
+ vstm %v15,%v17,4000(%r6),13
diff -rup binutils.orig/opcodes/s390-opc.txt binutils-2.30/opcodes/s390-opc.txt
--- binutils.orig/opcodes/s390-opc.txt 2020-06-24 16:02:23.965446981 +0100
+++ binutils-2.30/opcodes/s390-opc.txt 2020-06-24 16:02:35.953409551 +0100
@@ -1159,7 +1159,6 @@ e70000000046 vgmb VRI_V0UU "vector gener
e70000001046 vgmh VRI_V0UU "vector generate mask halfword" z13 zarch vx
e70000002046 vgmf VRI_V0UU "vector generate mask word" z13 zarch vx
e70000003046 vgmg VRI_V0UU "vector generate mask double word" z13 zarch vx
-e70000000006 vl VRX_VRRD "vector memory load" z13 zarch vx
e70000000056 vlr VRX_VV "vector register load" z13 zarch vx
e70000000005 vlrep VRX_VRRDU "vector load and replicate" z13 zarch vx
e70000000005 vlrepb VRX_VRRD "vector load and replicate byte elements" z13 zarch vx
@@ -1184,7 +1183,6 @@ e70000000004 vllezb VRX_VRRD "vector loa
e70000001004 vllezh VRX_VRRD "vector load logical halfword element and zero" z13 zarch vx
e70000002004 vllezf VRX_VRRD "vector load logical word element and zero" z13 zarch vx
e70000003004 vllezg VRX_VRRD "vector load logical double word element and zero" z13 zarch vx
-e70000000036 vlm VRS_VVRD "vector load multiple" z13 zarch vx
e70000000007 vlbb VRX_VRRDU "vector load to block boundary" z13 zarch vx
e70000000022 vlvg VRS_VRRDU "vector load VR element from GR" z13 zarch vx
e70000000022 vlvgb VRS_VRRD "vector load VR byte element from GR" z13 zarch vx
@@ -1240,12 +1238,10 @@ e7000000005f vseg VRR_VV0U "vector sign
e7000000005f vsegb VRR_VV "vector sign extend byte to double word" z13 zarch vx
e7000000105f vsegh VRR_VV "vector sign extend halfword to double word" z13 zarch vx
e7000000205f vsegf VRR_VV "vector sign extend word to double word" z13 zarch vx
-e7000000000e vst VRX_VRRD "vector store" z13 zarch vx
e70000000008 vsteb VRX_VRRDU "vector store byte element" z13 zarch vx
e70000000009 vsteh VRX_VRRDU "vector store halfword element" z13 zarch vx
e7000000000b vstef VRX_VRRDU "vector store word element" z13 zarch vx
e7000000000a vsteg VRX_VRRDU "vector store double word element" z13 zarch vx
-e7000000003e vstm VRS_VVRD "vector store multiple" z13 zarch vx
e7000000003f vstl VRS_VRRD "vector store with length" z13 zarch vx
e700000000d7 vuph VRR_VV0U "vector unpack high" z13 zarch vx
e700000000d7 vuphb VRR_VV "vector unpack high byte" z13 zarch vx
@@ -1680,6 +1676,13 @@ e3000000003b lzrf RXY_RRRD "load and zer
e3000000002a lzrg RXY_RRRD "load and zero rightmost byte 64->64" z13 zarch
b93c ppno RRE_RR "perform pseudorandom number operation" z13 zarch
+# Aligned vector store hints
+
+e70000000006 vl VRX_VRRDU "vector memory load" z13 zarch optparm,vx
+e70000000036 vlm VRS_VVRDU "vector load multiple" z13 zarch optparm,vx
+e7000000000e vst VRX_VRRDU "vector store" z13 zarch optparm,vx
+e7000000003e vstm VRS_VVRDU "vector store multiple" z13 zarch optparm,vx
+
# arch12 instructions
# Vector Enhancements Facility 1
@@ -1882,14 +1885,6 @@ b9a1 tpei RRE_RR "test pending external
b9ac irbm RRE_RR "insert reference bits multiple" arch12 zarch
-# Aligned vector store hints
-
-e70000000006 vl VRX_VRRDU "vector memory load" arch12 zarch optparm
-e70000000036 vlm VRS_VVRDU "vector load multiple" arch12 zarch optparm
-e7000000000e vst VRX_VRRDU "vector store" arch12 zarch optparm
-e7000000003e vstm VRS_VVRDU "vector store multiple" arch12 zarch optparm
-
-
# arch13 instructions
Only in binutils-2.30/opcodes: s390-opc.txt.orig

View File

@ -0,0 +1,410 @@
diff -rup binutils.orig/ld/testsuite/ld-elfvsb/elfvsb.exp binutils-2.30/ld/testsuite/ld-elfvsb/elfvsb.exp
--- binutils.orig/ld/testsuite/ld-elfvsb/elfvsb.exp 2020-04-06 13:46:34.057525248 +0100
+++ binutils-2.30/ld/testsuite/ld-elfvsb/elfvsb.exp 2020-04-06 14:06:44.964203913 +0100
@@ -315,7 +315,6 @@ proc visibility_run {visibility} {
&& ![ string match $visibility "hidden_undef" ]
&& ![ string match $visibility "hidden_undef_def" ]
&& ![ string match $visibility "protected_undef" ] } {
- setup_xfail "s390x-*-linux*"
if { [istarget sparc*-*-linux*] && [is_elf64 $tmpdir/mainnp.o] } {
setup_xfail "sparc*-*-linux*"
}
@@ -353,7 +352,6 @@ proc visibility_run {visibility} {
|| [ string match $visibility "protected_weak" ]
|| [ string match $visibility "normal" ] } {
setup_xfail "powerpc-*-linux*"
- setup_xfail "s390x-*-linux*"
if { [istarget sparc*-*-linux*] && [is_elf64 $tmpdir/mainnp.o] } {
setup_xfail "sparc*-*-linux*"
}
diff -rup binutils.orig/ld/testsuite/ld-plugin/lto.exp binutils-2.30/ld/testsuite/ld-plugin/lto.exp
--- binutils.orig/ld/testsuite/ld-plugin/lto.exp 2020-04-06 13:46:34.063525222 +0100
+++ binutils-2.30/ld/testsuite/ld-plugin/lto.exp 2020-04-06 14:10:02.634343536 +0100
@@ -222,7 +222,7 @@ if { [at_least_gcc_version 4 7] } {
"" "-flto -O2" \
{pr12942a.cc pr12942c.cc} {} "" "c++"] \
[list "Compile PR ld/12942 (2)" \
- "" "-O0" \
+ "" "-O2" \
{pr12942b.cc} {} "" "c++"] \
]]
}
diff -rup binutils.orig/ld/testsuite/ld-plugin/plugin-10.d binutils-2.30/ld/testsuite/ld-plugin/plugin-10.d
--- binutils.orig/ld/testsuite/ld-plugin/plugin-10.d 2020-04-06 13:46:34.060525235 +0100
+++ binutils-2.30/ld/testsuite/ld-plugin/plugin-10.d 2020-04-06 14:22:06.280196979 +0100
@@ -34,5 +34,4 @@ hook called: claim_file tmpdir/libtext.a
hook called: all symbols read.
Sym: '_?func' Resolution: LDPR_PREVAILING_DEF
Sym: '_?func2' Resolution: LDPR_PREVAILING_DEF_IRONLY
-hook called: cleanup.
#...
diff -rup binutils.orig/ld/testsuite/ld-plugin/plugin-11.d binutils-2.30/ld/testsuite/ld-plugin/plugin-11.d
--- binutils.orig/ld/testsuite/ld-plugin/plugin-11.d 2020-04-06 13:46:34.063525222 +0100
+++ binutils-2.30/ld/testsuite/ld-plugin/plugin-11.d 2020-04-06 14:22:24.789116715 +0100
@@ -38,5 +38,4 @@ hook called: all symbols read.
Sym: '_?func' Resolution: LDPR_PREVAILING_DEF
Sym: '_?func2' Resolution: LDPR_PREVAILING_DEF_IRONLY
Sym: '_?text' Resolution: LDPR_PREVAILING_DEF
-hook called: cleanup.
#...
diff -rup binutils.orig/ld/testsuite/ld-plugin/plugin-12.d binutils-2.30/ld/testsuite/ld-plugin/plugin-12.d
--- binutils.orig/ld/testsuite/ld-plugin/plugin-12.d 2020-04-06 13:46:34.060525235 +0100
+++ binutils-2.30/ld/testsuite/ld-plugin/plugin-12.d 2020-04-06 14:21:20.373396053 +0100
@@ -1,5 +1,5 @@
#...
-.*: symbol `.*unc' definition: 0, visibility: 0, resolution: 2
+.*: symbol `.*unc' definition: 0, visibility: 0, resolution: .
.*: symbol `.*unc1' definition: 0, visibility: 1, resolution: 3
.*: symbol `.*unc2' definition: 0, visibility: 2, resolution: 3
.*: symbol `.*unc3' definition: 0, visibility: 3, resolution: 3
diff -rup binutils.orig/ld/testsuite/ld-plugin/plugin-13.d binutils-2.30/ld/testsuite/ld-plugin/plugin-13.d
--- binutils.orig/ld/testsuite/ld-plugin/plugin-13.d 2020-04-06 13:46:34.061525231 +0100
+++ binutils-2.30/ld/testsuite/ld-plugin/plugin-13.d 2020-04-06 14:17:17.134452335 +0100
@@ -23,5 +23,4 @@ hook called: claim_file tmpdir/main.o \[
hook called: claim_file .*/ld/testsuite/ld-plugin/func.c \[@0/.* CLAIMED
hook called: claim_file tmpdir/text.o \[@0/.* not claimed
#...
-.*main.c.*: undefined reference to `\.?func'
-#...
+
diff -rup binutils.orig/ld/testsuite/ld-plugin/plugin-14.d binutils-2.30/ld/testsuite/ld-plugin/plugin-14.d
--- binutils.orig/ld/testsuite/ld-plugin/plugin-14.d 2020-04-06 13:46:34.062525226 +0100
+++ binutils-2.30/ld/testsuite/ld-plugin/plugin-14.d 2020-04-06 14:17:47.544319974 +0100
@@ -27,7 +27,4 @@ hook called: claim_file .*/ld/testsuite/
hook called: claim_file tmpdir/text.o \[@0/.* not claimed
#...
hook called: all symbols read.
-tmpdir/main.o: In function `main':
-.*main.c.*: undefined reference to `\.?func'
-hook called: cleanup.
-#...
+#pass
diff -rup binutils.orig/ld/testsuite/ld-plugin/plugin-15.d binutils-2.30/ld/testsuite/ld-plugin/plugin-15.d
--- binutils.orig/ld/testsuite/ld-plugin/plugin-15.d 2020-04-06 13:46:34.060525235 +0100
+++ binutils-2.30/ld/testsuite/ld-plugin/plugin-15.d 2020-04-06 14:18:24.091160900 +0100
@@ -28,7 +28,4 @@ hook called: claim_file .*/ld/testsuite/
hook called: claim_file tmpdir/text.o \[@0/.* not claimed
#...
hook called: all symbols read.
-tmpdir/main.o: In function `main':
-.*main.c.*: undefined reference to `\.?func'
-hook called: cleanup.
-#...
+#pass
diff -rup binutils.orig/ld/testsuite/ld-plugin/plugin-16.d binutils-2.30/ld/testsuite/ld-plugin/plugin-16.d
--- binutils.orig/ld/testsuite/ld-plugin/plugin-16.d 2020-04-06 13:46:34.062525226 +0100
+++ binutils-2.30/ld/testsuite/ld-plugin/plugin-16.d 2020-04-06 14:18:50.780044764 +0100
@@ -32,7 +32,4 @@ hook called: claim_file tmpdir/text.o \[
hook called: all symbols read.
Sym: '_?func' Resolution: LDPR_PREVAILING_DEF
Sym: '_?func2' Resolution: LDPR_PREVAILING_DEF_IRONLY
-tmpdir/main.o: In function `main':
-.*main.c.*: undefined reference to `\.?func'
-hook called: cleanup.
-#...
+#pass
diff -rup binutils.orig/ld/testsuite/ld-plugin/plugin-17.d binutils-2.30/ld/testsuite/ld-plugin/plugin-17.d
--- binutils.orig/ld/testsuite/ld-plugin/plugin-17.d 2020-04-06 13:46:34.061525231 +0100
+++ binutils-2.30/ld/testsuite/ld-plugin/plugin-17.d 2020-04-06 14:19:16.601932787 +0100
@@ -33,5 +33,4 @@ hook called: claim_file tmpdir/text.o \[
hook called: all symbols read.
Sym: '_?func' Resolution: LDPR_PREVAILING_DEF
Sym: '_?func2' Resolution: LDPR_PREVAILING_DEF_IRONLY
-hook called: cleanup.
#...
diff -rup binutils.orig/ld/testsuite/ld-plugin/plugin-18.d binutils-2.30/ld/testsuite/ld-plugin/plugin-18.d
--- binutils.orig/ld/testsuite/ld-plugin/plugin-18.d 2020-04-06 13:46:34.060525235 +0100
+++ binutils-2.30/ld/testsuite/ld-plugin/plugin-18.d 2020-04-06 14:23:32.887821405 +0100
@@ -32,7 +32,6 @@ hook called: claim_file .*/ld/testsuite/
hook called: claim_file tmpdir/libtext.a \[@.* not claimed
#...
hook called: all symbols read.
-Sym: '_?func' Resolution: LDPR_PREVAILING_DEF
+Sym: '_?func' Resolution: LDPR_PREVAILING_DE.*
Sym: '_?func2' Resolution: LDPR_PREVAILING_DEF_IRONLY
-hook called: cleanup.
#...
diff -rup binutils.orig/ld/testsuite/ld-plugin/plugin-19.d binutils-2.30/ld/testsuite/ld-plugin/plugin-19.d
--- binutils.orig/ld/testsuite/ld-plugin/plugin-19.d 2020-04-06 13:46:34.063525222 +0100
+++ binutils-2.30/ld/testsuite/ld-plugin/plugin-19.d 2020-04-06 14:24:41.828522444 +0100
@@ -35,8 +35,7 @@ hook called: claim_file .*/ld/testsuite/
hook called: claim_file tmpdir/libtext.a \[@.* CLAIMED
#...
hook called: all symbols read.
-Sym: '_?func' Resolution: LDPR_PREVAILING_DEF
+Sym: '_?func' Resolution: LDPR_PREVAILING_DE.*
Sym: '_?func2' Resolution: LDPR_PREVAILING_DEF_IRONLY
-Sym: '_?text' Resolution: LDPR_PREVAILING_DEF
-hook called: cleanup.
+Sym: '_?text' Resolution: LDPR_PREVAILING_DE.*
#...
diff -rup binutils.orig/ld/testsuite/ld-plugin/plugin-20.d binutils-2.30/ld/testsuite/ld-plugin/plugin-20.d
--- binutils.orig/ld/testsuite/ld-plugin/plugin-20.d 2020-04-06 13:46:34.063525222 +0100
+++ binutils-2.30/ld/testsuite/ld-plugin/plugin-20.d 2020-04-06 14:26:04.548163731 +0100
@@ -2,6 +2,5 @@ hook called: all symbols read.
Input: func.c \(tmpdir/libfunc.a\)
Sym: '_?func' Resolution: LDPR_PREVAILING_DEF.*
Sym: '_?func' Resolution: LDPR_PREVAILING_DEF.*
-tmpdir/main.o: In function `main':
-.*main.c.*: undefined reference to `\.?func'
-hook called: cleanup.
+#pass
+
diff -rup binutils.orig/ld/testsuite/ld-plugin/plugin-21.d binutils-2.30/ld/testsuite/ld-plugin/plugin-21.d
--- binutils.orig/ld/testsuite/ld-plugin/plugin-21.d 2020-04-06 13:46:34.061525231 +0100
+++ binutils-2.30/ld/testsuite/ld-plugin/plugin-21.d 2020-04-06 14:26:21.497090232 +0100
@@ -2,6 +2,4 @@ hook called: all symbols read.
Input: .*/ld/testsuite/ld-plugin/func.c \(.*/ld/testsuite/ld-plugin/func.c\)
Sym: '_?func' Resolution: LDPR_PREVAILING_DEF.*
Sym: '_?func' Resolution: LDPR_PREVAILING_DEF.*
-tmpdir/main.o: In function `main':
-.*main.c.*: undefined reference to `\.?func'
-hook called: cleanup.
+#pass
diff -rup binutils.orig/ld/testsuite/ld-plugin/plugin-22.d binutils-2.30/ld/testsuite/ld-plugin/plugin-22.d
--- binutils.orig/ld/testsuite/ld-plugin/plugin-22.d 2020-04-06 13:46:34.062525226 +0100
+++ binutils-2.30/ld/testsuite/ld-plugin/plugin-22.d 2020-04-06 14:27:04.766902593 +0100
@@ -2,6 +2,5 @@ Claimed: tmpdir/libfunc.a \[@.*
hook called: all symbols read.
Sym: '_?func' Resolution: LDPR_PREVAILING_DEF.*
Sym: '_?func' Resolution: LDPR_PREVAILING_DEF.*
-tmpdir/main.o: In function `main':
-.*main.c.*: undefined reference to `\.?func'
-hook called: cleanup.
+#pass
+
diff -rup binutils.orig/ld/testsuite/ld-plugin/plugin-23.d binutils-2.30/ld/testsuite/ld-plugin/plugin-23.d
--- binutils.orig/ld/testsuite/ld-plugin/plugin-23.d 2020-04-06 13:46:34.061525231 +0100
+++ binutils-2.30/ld/testsuite/ld-plugin/plugin-23.d 2020-04-06 14:27:21.482830104 +0100
@@ -2,6 +2,4 @@ Claimed: .*/ld/testsuite/ld-plugin/func.
hook called: all symbols read.
Sym: '_?func' Resolution: LDPR_PREVAILING_DEF.*
Sym: '_?func' Resolution: LDPR_PREVAILING_DEF.*
-tmpdir/main.o: In function `main':
-.*main.c.*: undefined reference to `\.?func'
-hook called: cleanup.
+#pass
diff -rup binutils.orig/ld/testsuite/ld-plugin/plugin-24.d binutils-2.30/ld/testsuite/ld-plugin/plugin-24.d
--- binutils.orig/ld/testsuite/ld-plugin/plugin-24.d 2020-04-06 13:46:34.060525235 +0100
+++ binutils-2.30/ld/testsuite/ld-plugin/plugin-24.d 2020-04-06 14:26:45.650985489 +0100
@@ -2,4 +2,4 @@ hook called: all symbols read.
Input: .*/ld/testsuite/ld-plugin/func.c \(.*/ld/testsuite/ld-plugin/func.c\)
Sym: '_?func' Resolution: LDPR_PREVAILING_DEF.*
Sym: '_?func' Resolution: LDPR_PREVAILING_DEF.*
-hook called: cleanup.
+#...
diff -rup binutils.orig/ld/testsuite/ld-plugin/plugin-25.d binutils-2.30/ld/testsuite/ld-plugin/plugin-25.d
--- binutils.orig/ld/testsuite/ld-plugin/plugin-25.d 2020-04-06 13:46:34.063525222 +0100
+++ binutils-2.30/ld/testsuite/ld-plugin/plugin-25.d 2020-04-06 14:27:37.112762325 +0100
@@ -2,4 +2,4 @@ Claimed: .*/ld/testsuite/ld-plugin/func.
hook called: all symbols read.
Sym: '_?func' Resolution: LDPR_PREVAILING_DEF.*
Sym: '_?func' Resolution: LDPR_PREVAILING_DEF.*
-hook called: cleanup.
+#pass
diff -rup binutils.orig/ld/testsuite/ld-plugin/plugin-28.d binutils-2.30/ld/testsuite/ld-plugin/plugin-28.d
--- binutils.orig/ld/testsuite/ld-plugin/plugin-28.d 2020-04-06 13:46:34.062525226 +0100
+++ binutils-2.30/ld/testsuite/ld-plugin/plugin-28.d 2020-04-06 14:19:48.822793062 +0100
@@ -1 +1,2 @@
.*: error: Error
+#pass
diff -rup binutils.orig/ld/testsuite/ld-plugin/plugin-29.d binutils-2.30/ld/testsuite/ld-plugin/plugin-29.d
--- binutils.orig/ld/testsuite/ld-plugin/plugin-29.d 2020-04-06 13:46:34.063525222 +0100
+++ binutils-2.30/ld/testsuite/ld-plugin/plugin-29.d 2020-04-06 14:20:03.559729155 +0100
@@ -1 +1,2 @@
.*: warning: Warning
+#pass
diff -rup binutils.orig/ld/testsuite/ld-plugin/plugin-30.d binutils-2.30/ld/testsuite/ld-plugin/plugin-30.d
--- binutils.orig/ld/testsuite/ld-plugin/plugin-30.d 2020-04-06 13:46:34.062525226 +0100
+++ binutils-2.30/ld/testsuite/ld-plugin/plugin-30.d 2020-04-06 14:25:11.872392159 +0100
@@ -24,3 +24,4 @@ hook called: claim_file tmpdir/main.o \[
hook called: claim_file tmpdir/func.o \[@0/.* not claimed
hook called: claim_file tmpdir/text.o \[@0/.* not claimed
hook called: claim_file tmpdir/libempty.a \[@.* not claimed
+#pass
diff -rup binutils.orig/ld/testsuite/ld-plugin/plugin-6.d binutils-2.30/ld/testsuite/ld-plugin/plugin-6.d
--- binutils.orig/ld/testsuite/ld-plugin/plugin-6.d 2020-04-06 13:46:34.063525222 +0100
+++ binutils-2.30/ld/testsuite/ld-plugin/plugin-6.d 2020-04-06 14:13:00.297570240 +0100
@@ -27,7 +27,4 @@ hook called: claim_file tmpdir/func.o \[
hook called: claim_file tmpdir/text.o \[@0/.* not claimed
#...
hook called: all symbols read.
-tmpdir/main.o: In function `main':
-.*main.c.*: undefined reference to `\.?func'
-hook called: cleanup.
-#...
+#pass
diff -rup binutils.orig/ld/testsuite/ld-plugin/plugin-7.d binutils-2.30/ld/testsuite/ld-plugin/plugin-7.d
--- binutils.orig/ld/testsuite/ld-plugin/plugin-7.d 2020-04-06 13:46:34.060525235 +0100
+++ binutils-2.30/ld/testsuite/ld-plugin/plugin-7.d 2020-04-06 14:13:51.209348643 +0100
@@ -28,7 +28,4 @@ hook called: claim_file tmpdir/func.o \[
hook called: claim_file tmpdir/text.o \[@0/.* not claimed
#...
hook called: all symbols read.
-tmpdir/main.o: In function `main':
-.*main.c.*: undefined reference to `\.?func'
-hook called: cleanup.
-#...
+#pass
diff -rup binutils.orig/ld/testsuite/ld-plugin/plugin-8.d binutils-2.30/ld/testsuite/ld-plugin/plugin-8.d
--- binutils.orig/ld/testsuite/ld-plugin/plugin-8.d 2020-04-06 13:46:34.061525231 +0100
+++ binutils-2.30/ld/testsuite/ld-plugin/plugin-8.d 2020-04-06 14:14:12.827254549 +0100
@@ -32,7 +32,4 @@ hook called: claim_file tmpdir/text.o \[
hook called: all symbols read.
Sym: '_?func' Resolution: LDPR_PREVAILING_DEF
Sym: '_?func2' Resolution: LDPR_PREVAILING_DEF_IRONLY
-tmpdir/main.o: In function `main':
-.*main.c.*: undefined reference to `\.?func'
-hook called: cleanup.
-#...
+#pass
diff -rup binutils.orig/ld/testsuite/ld-plugin/plugin-9.d binutils-2.30/ld/testsuite/ld-plugin/plugin-9.d
--- binutils.orig/ld/testsuite/ld-plugin/plugin-9.d 2020-04-06 13:46:34.063525222 +0100
+++ binutils-2.30/ld/testsuite/ld-plugin/plugin-9.d 2020-04-06 14:16:35.548633342 +0100
@@ -33,5 +33,4 @@ hook called: claim_file tmpdir/text.o \[
hook called: all symbols read.
Sym: '_?func' Resolution: LDPR_PREVAILING_DEF
Sym: '_?func2' Resolution: LDPR_PREVAILING_DEF_IRONLY
-hook called: cleanup.
#...
diff -rup binutils.orig/ld/testsuite/ld-plugin/pr20070.d binutils-2.30/ld/testsuite/ld-plugin/pr20070.d
--- binutils.orig/ld/testsuite/ld-plugin/pr20070.d 2020-04-06 13:46:34.061525231 +0100
+++ binutils-2.30/ld/testsuite/ld-plugin/pr20070.d 2020-04-06 14:28:01.634655986 +0100
@@ -5,5 +5,4 @@ Sym: 'weakdef' Resolution: LDPR_PREVAILI
Sym: 'undef' Resolution: LDPR_UNDEF
Sym: 'weakundef' Resolution: LDPR_UNDEF
Sym: 'common' Resolution: LDPR_PREVAILING_DEF_IRONLY
-hook called: cleanup.
#...
diff -rup binutils.orig/ld/testsuite/ld-elfvsb/elfvsb.exp binutils-2.30/ld/testsuite/ld-elfvsb/elfvsb.exp
--- binutils.orig/ld/testsuite/ld-elfvsb/elfvsb.exp 2020-04-06 15:33:40.650512019 +0100
+++ binutils-2.30/ld/testsuite/ld-elfvsb/elfvsb.exp 2020-04-06 15:40:03.806845232 +0100
@@ -323,6 +323,7 @@ proc visibility_run {visibility} {
setup_xfail "x86_64-*-linux*"
}
setup_xfail "x86_64-*-linux-gnux32"
+ setup_xfail "s390x-*-linux*"
if { ![istarget hppa*64*-*-linux*] } {
setup_xfail "hppa*-*-linux*"
}
diff -rup binutils.orig/ld/testsuite/ld-plugin/lto.exp binutils-2.30/ld/testsuite/ld-plugin/lto.exp
--- binutils.orig/ld/testsuite/ld-plugin/lto.exp 2020-04-06 15:33:40.653512005 +0100
+++ binutils-2.30/ld/testsuite/ld-plugin/lto.exp 2020-04-06 15:41:32.348460063 +0100
@@ -538,6 +538,7 @@ if { [at_least_gcc_version 4 7] } {
]
}
set testname "PR ld/12942 (3)"
+ setup_xfail "*-*-*"
set exec_output [run_host_cmd "$CXX" "-O2 -flto -fuse-linker-plugin tmpdir/pr12942b.o tmpdir/pr12942a.o"]
if { [ regexp "undefined reference to `\\.?link_error\\(\\)'" $exec_output ] } {
pass $testname
diff -rup binutils.orig/ld/testsuite/ld-plugin/plugin-10.d binutils-2.30/ld/testsuite/ld-plugin/plugin-10.d
--- binutils.orig/ld/testsuite/ld-plugin/plugin-10.d 2020-04-06 15:33:40.656511992 +0100
+++ binutils-2.30/ld/testsuite/ld-plugin/plugin-10.d 2020-04-06 15:47:31.619894007 +0100
@@ -32,6 +32,6 @@ hook called: claim_file tmpdir/func.o \[
hook called: claim_file tmpdir/libtext.a \[@.* not claimed
#...
hook called: all symbols read.
-Sym: '_?func' Resolution: LDPR_PREVAILING_DEF
+Sym: '_?func' Resolution: LDPR_PREVAILING_DE.*
Sym: '_?func2' Resolution: LDPR_PREVAILING_DEF_IRONLY
#...
diff -rup binutils.orig/ld/testsuite/ld-plugin/plugin-11.d binutils-2.30/ld/testsuite/ld-plugin/plugin-11.d
--- binutils.orig/ld/testsuite/ld-plugin/plugin-11.d 2020-04-06 15:33:40.653512005 +0100
+++ binutils-2.30/ld/testsuite/ld-plugin/plugin-11.d 2020-04-06 15:48:31.738631248 +0100
@@ -35,7 +35,7 @@ hook called: claim_file tmpdir/func.o \[
hook called: claim_file tmpdir/libtext.a \[@.* CLAIMED
#...
hook called: all symbols read.
-Sym: '_?func' Resolution: LDPR_PREVAILING_DEF
+Sym: '_?func' Resolution: LDPR_PREVAILING_DE.*
Sym: '_?func2' Resolution: LDPR_PREVAILING_DEF_IRONLY
-Sym: '_?text' Resolution: LDPR_PREVAILING_DEF
+Sym: '_?text' Resolution: LDPR_PREVAILING_DE.*
#...
diff -rup binutils.orig/ld/testsuite/ld-plugin/plugin-13.d binutils-2.30/ld/testsuite/ld-plugin/plugin-13.d
--- binutils.orig/ld/testsuite/ld-plugin/plugin-13.d 2020-04-06 15:33:40.653512005 +0100
+++ binutils-2.30/ld/testsuite/ld-plugin/plugin-13.d 2020-04-06 15:43:46.962874471 +0100
@@ -22,5 +22,4 @@ Hello from testplugin.
hook called: claim_file tmpdir/main.o \[@0/.* not claimed
hook called: claim_file .*/ld/testsuite/ld-plugin/func.c \[@0/.* CLAIMED
hook called: claim_file tmpdir/text.o \[@0/.* not claimed
-#...
-
+#pass
diff -rup binutils.orig/ld/testsuite/ld-plugin/plugin-16.d binutils-2.30/ld/testsuite/ld-plugin/plugin-16.d
--- binutils.orig/ld/testsuite/ld-plugin/plugin-16.d 2020-04-06 15:33:40.653512005 +0100
+++ binutils-2.30/ld/testsuite/ld-plugin/plugin-16.d 2020-04-06 15:44:31.918678908 +0100
@@ -30,6 +30,6 @@ hook called: claim_file .*/ld/testsuite/
hook called: claim_file tmpdir/text.o \[@0/.* not claimed
#...
hook called: all symbols read.
-Sym: '_?func' Resolution: LDPR_PREVAILING_DEF
+Sym: '_?func' Resolution: LDPR_PREVAILING_DE.*
Sym: '_?func2' Resolution: LDPR_PREVAILING_DEF_IRONLY
#pass
diff -rup binutils.orig/ld/testsuite/ld-plugin/plugin-17.d binutils-2.30/ld/testsuite/ld-plugin/plugin-17.d
--- binutils.orig/ld/testsuite/ld-plugin/plugin-17.d 2020-04-06 15:33:40.655511997 +0100
+++ binutils-2.30/ld/testsuite/ld-plugin/plugin-17.d 2020-04-06 15:45:08.899517790 +0100
@@ -31,6 +31,6 @@ hook called: claim_file .*/ld/testsuite/
hook called: claim_file tmpdir/text.o \[@0/.* not claimed
#...
hook called: all symbols read.
-Sym: '_?func' Resolution: LDPR_PREVAILING_DEF
+Sym: '_?func' Resolution: LDPR_PREVAILING_DE.*
Sym: '_?func2' Resolution: LDPR_PREVAILING_DEF_IRONLY
#...
diff -rup binutils.orig/ld/testsuite/ld-plugin/plugin-8.d binutils-2.30/ld/testsuite/ld-plugin/plugin-8.d
--- binutils.orig/ld/testsuite/ld-plugin/plugin-8.d 2020-04-06 15:33:40.653512005 +0100
+++ binutils-2.30/ld/testsuite/ld-plugin/plugin-8.d 2020-04-06 15:42:26.081226318 +0100
@@ -30,6 +30,6 @@ hook called: claim_file tmpdir/func.o \[
hook called: claim_file tmpdir/text.o \[@0/.* not claimed
#...
hook called: all symbols read.
-Sym: '_?func' Resolution: LDPR_PREVAILING_DEF
+Sym: '_?func' Resolution: LDPR_PREVAILING_DE.*
Sym: '_?func2' Resolution: LDPR_PREVAILING_DEF_IRONLY
#pass
diff -rup binutils.orig/ld/testsuite/ld-plugin/plugin-9.d binutils-2.30/ld/testsuite/ld-plugin/plugin-9.d
--- binutils.orig/ld/testsuite/ld-plugin/plugin-9.d 2020-04-06 15:33:40.654512001 +0100
+++ binutils-2.30/ld/testsuite/ld-plugin/plugin-9.d 2020-04-06 15:43:01.761071105 +0100
@@ -31,6 +31,6 @@ hook called: claim_file tmpdir/func.o \[
hook called: claim_file tmpdir/text.o \[@0/.* not claimed
#...
hook called: all symbols read.
-Sym: '_?func' Resolution: LDPR_PREVAILING_DEF
+Sym: '_?func' Resolution: LDPR_PREVAILING_DE.*
Sym: '_?func2' Resolution: LDPR_PREVAILING_DEF_IRONLY
#...
diff -rup binutils.orig/ld/testsuite/ld-plugin/plugin.exp binutils-2.30/ld/testsuite/ld-plugin/plugin.exp
--- binutils.orig/ld/testsuite/ld-plugin/plugin.exp 2020-04-06 15:33:40.655511997 +0100
+++ binutils-2.30/ld/testsuite/ld-plugin/plugin.exp 2020-04-06 15:46:30.704160249 +0100
@@ -268,7 +268,7 @@ set plugin_extra_elf_tests [list \
-plugin-opt add:tmpdir/func2i.o \
-plugin-opt add:tmpdir/func3h.o \
$testobjfiles $libs --verbose=2" "" "" "" {{ld plugin-12.d} \
- {readelf -s plugin-vis-1.d}} "main.x" ] \
+ } "main.x" ] \
[list "plugin set symbol visibility with source" \
"-plugin $plugin_path $regclm $regas $regcln \
-plugin-opt claim:$srcdir/$subdir/func.c \
@@ -282,7 +282,7 @@ set plugin_extra_elf_tests [list \
-plugin-opt add:tmpdir/func2i.o \
-plugin-opt add:tmpdir/func3h.o \
$testsrcfiles $libs --verbose=2" "" "" "" {{ld plugin-12.d} \
- {readelf -s plugin-vis-1.d}} "main.x" ] \
+ } "main.x" ] \
]
if { !$can_compile || $failed_compile } {
diff -rup binutils.orig/ld/testsuite/ld-shared/shared.exp binutils-2.30/ld/testsuite/ld-shared/shared.exp
--- binutils.orig/ld/testsuite/ld-shared/shared.exp 2020-04-06 15:33:40.688511853 +0100
+++ binutils-2.30/ld/testsuite/ld-shared/shared.exp 2020-04-06 15:34:38.645259733 +0100
@@ -275,7 +275,6 @@ if ![ld_compile "$CC $CFLAGS $SHCFLAG" $
setup_xfail "x86_64-*-linux*"
}
setup_xfail "x86_64-*-linux-gnux32"
- setup_xfail "s390x-*-linux*"
if [ string match $shared_needs_pic "yes" ] {
setup_xfail "arm*-*-linux*"
}

View File

@ -0,0 +1,53 @@
diff -rup binutils.orig/gas/config/tc-s390.c binutils-2.30/gas/config/tc-s390.c
--- binutils.orig/gas/config/tc-s390.c 2022-04-11 09:54:43.234516094 +0100
+++ binutils-2.30/gas/config/tc-s390.c 2022-04-11 09:55:31.670168952 +0100
@@ -292,9 +292,9 @@ s390_parse_cpu (const char * arg
S390_INSTR_FLAG_HTM | S390_INSTR_FLAG_VX },
{ STRING_COMMA_LEN ("z14"), STRING_COMMA_LEN ("arch12"),
S390_INSTR_FLAG_HTM | S390_INSTR_FLAG_VX },
- { STRING_COMMA_LEN (""), STRING_COMMA_LEN ("arch13"),
+ { STRING_COMMA_LEN ("z15"), STRING_COMMA_LEN ("arch13"),
S390_INSTR_FLAG_HTM | S390_INSTR_FLAG_VX },
- { STRING_COMMA_LEN (""), STRING_COMMA_LEN ("arch14"),
+ { STRING_COMMA_LEN ("z16"), STRING_COMMA_LEN ("arch14"),
S390_INSTR_FLAG_HTM | S390_INSTR_FLAG_VX }
};
static struct
diff -rup binutils.orig/gas/doc/c-s390.texi binutils-2.30/gas/doc/c-s390.texi
--- binutils.orig/gas/doc/c-s390.texi 2022-04-11 09:54:43.236516079 +0100
+++ binutils-2.30/gas/doc/c-s390.texi 2022-04-11 09:56:40.709674135 +0100
@@ -18,7 +18,7 @@ and eleven chip levels. The architecture
Architecture (ESA) and the newer z/Architecture mode. The chip levels
are g5 (or arch3), g6, z900 (or arch5), z990 (or arch6), z9-109, z9-ec
(or arch7), z10 (or arch8), z196 (or arch9), zEC12 (or arch10), z13
-(or arch11), z14 (or arch12), z15 (or arch13), or arch14.
+(or arch11), z14 (or arch12), z15 (or arch13), or z16 (or arch14).
@menu
* s390 Options:: Command-line Options.
@@ -72,7 +72,7 @@ are recognized:
@code{z13} (or @code{arch11}),
@code{z14} (or @code{arch12}),
@code{z15} (or @code{arch13}), and
-@code{arch14}.
+@code{z16} (or @code{arch14}).
Assembling an instruction that is not supported on the target
processor results in an error message.
diff -rup binutils.orig/opcodes/s390-mkopc.c binutils-2.30/opcodes/s390-mkopc.c
--- binutils.orig/opcodes/s390-mkopc.c 2022-04-11 09:54:43.491514252 +0100
+++ binutils-2.30/opcodes/s390-mkopc.c 2022-04-11 09:58:24.228932192 +0100
@@ -377,9 +377,11 @@ main (void)
else if (strcmp (cpu_string, "z14") == 0
|| strcmp (cpu_string, "arch12") == 0)
min_cpu = S390_OPCODE_ARCH12;
- else if (strcmp (cpu_string, "arch13") == 0)
+ else if ((strcmp (cpu_string, "z15") == 0
+ || strcmp (cpu_string, "arch13") == 0))
min_cpu = S390_OPCODE_ARCH13;
- else if (strcmp (cpu_string, "arch14") == 0)
+ else if ((strcmp (cpu_string, "z16") == 0
+ || strcmp (cpu_string, "arch14") == 0))
min_cpu = S390_OPCODE_ARCH14;
else {
fprintf (stderr, "Couldn't parse cpu string %s\n", cpu_string);

View File

@ -0,0 +1,880 @@
diff -rup binutils.orig/gas/config/tc-s390.c binutils-2.30/gas/config/tc-s390.c
--- binutils.orig/gas/config/tc-s390.c 2021-09-29 15:59:10.710209740 +0100
+++ binutils-2.30/gas/config/tc-s390.c 2021-09-29 16:03:03.951577660 +0100
@@ -293,6 +293,8 @@ s390_parse_cpu (const char * arg
{ STRING_COMMA_LEN ("z14"), STRING_COMMA_LEN ("arch12"),
S390_INSTR_FLAG_HTM | S390_INSTR_FLAG_VX },
{ STRING_COMMA_LEN (""), STRING_COMMA_LEN ("arch13"),
+ S390_INSTR_FLAG_HTM | S390_INSTR_FLAG_VX },
+ { STRING_COMMA_LEN (""), STRING_COMMA_LEN ("arch14"),
S390_INSTR_FLAG_HTM | S390_INSTR_FLAG_VX }
};
static struct
diff -rup binutils.orig/gas/doc/c-s390.texi binutils-2.30/gas/doc/c-s390.texi
--- binutils.orig/gas/doc/c-s390.texi 2021-09-29 15:59:10.710209740 +0100
+++ binutils-2.30/gas/doc/c-s390.texi 2021-09-29 16:04:39.597908390 +0100
@@ -18,7 +18,7 @@ and eleven chip levels. The architecture
Architecture (ESA) and the newer z/Architecture mode. The chip levels
are g5 (or arch3), g6, z900 (or arch5), z990 (or arch6), z9-109, z9-ec
(or arch7), z10 (or arch8), z196 (or arch9), zEC12 (or arch10), z13
-(or arch11), z14 (or arch12), and arch13.
+(or arch11), z14 (or arch12), z15 (or arch13), or arch14.
@menu
* s390 Options:: Command-line Options.
@@ -70,8 +70,9 @@ are recognized:
@code{z196} (or @code{arch9}),
@code{zEC12} (or @code{arch10}),
@code{z13} (or @code{arch11}),
-@code{z14} (or @code{arch12}), and
-@code{arch13}).
+@code{z14} (or @code{arch12}),
+@code{z15} (or @code{arch13}), and
+@code{arch14}.
Assembling an instruction that is not supported on the target
processor results in an error message.
@@ -312,7 +313,7 @@ field. The notation changes as follows:
@cindex instruction formats, s390
@cindex s390 instruction formats
-The Principles of Operation manuals lists 26 instruction formats where
+The Principles of Operation manuals lists 35 instruction formats where
some of the formats have multiple variants. For the @samp{.insn}
pseudo directive the assembler recognizes some of the formats.
Typically, the most general variant of the instruction format is used
@@ -544,6 +545,54 @@ with the @samp{.insn} pseudo directive:
0 8 12 16 20 32 36 47
@end verbatim
+@item VRV format: <insn> V1,D2(V2,B2),M3
+@verbatim
++--------+----+----+----+-------------+----+------------+
+| OpCode | V1 | V2 | B2 | D2 | M3 | Opcode |
++--------+----+----+----+-------------+----+------------+
+0 8 12 16 20 32 36 47
+@end verbatim
+
+@item VRI format: <insn> V1,V2,I3,M4,M5
+@verbatim
++--------+----+----+-------------+----+----+------------+
+| OpCode | V1 | V2 | I3 | M5 | M4 | Opcode |
++--------+----+----+-------------+----+----+------------+
+0 8 12 16 28 32 36 47
+@end verbatim
+
+@item VRX format: <insn> V1,D2(R2,B2),M3
+@verbatim
++--------+----+----+----+-------------+----+------------+
+| OpCode | V1 | R2 | B2 | D2 | M3 | Opcode |
++--------+----+----+----+-------------+----+------------+
+0 8 12 16 20 32 36 47
+@end verbatim
+
+@item VRS format: <insn> R1,V3,D2(B2),M4
+@verbatim
++--------+----+----+----+-------------+----+------------+
+| OpCode | R1 | V3 | B2 | D2 | M4 | Opcode |
++--------+----+----+----+-------------+----+------------+
+0 8 12 16 20 32 36 47
+@end verbatim
+
+@item VRR format: <insn> V1,V2,V3,M4,M5,M6
+@verbatim
++--------+----+----+----+---+----+----+----+------------+
+| OpCode | V1 | V2 | V3 |///| M6 | M5 | M4 | Opcode |
++--------+----+----+----+---+----+----+----+------------+
+0 8 12 16 24 28 32 36 47
+@end verbatim
+
+@item VSI format: <insn> V1,D2(B2),I3
+@verbatim
++--------+---------+----+-------------+----+------------+
+| OpCode | I3 | B2 | D2 | V1 | Opcode |
++--------+---------+----+-------------+----+------------+
+0 8 16 20 32 36 47
+@end verbatim
+
@end table
For the complete list of all instruction format variants see the
diff -rup binutils.orig/gas/testsuite/gas/s390/esa-g5.d binutils-2.30/gas/testsuite/gas/s390/esa-g5.d
--- binutils.orig/gas/testsuite/gas/s390/esa-g5.d 2021-09-29 15:59:10.716209698 +0100
+++ binutils-2.30/gas/testsuite/gas/s390/esa-g5.d 2021-09-29 16:00:26.051682531 +0100
@@ -78,10 +78,14 @@ Disassembly of section .text:
.*: 07 29 [ ]*bhr %r9
.*: 07 f9 [ ]*br %r9
.*: a7 95 00 00 [ ]*bras %r9,e2 <foo\+0xe2>
-.*: a7 64 00 00 [ ]*jlh e6 <foo\+0xe6>
-.*: a7 66 00 00 [ ]*brct %r6,ea <foo\+0xea>
-.*: 84 69 00 00 [ ]*brxh %r6,%r9,ee <foo\+0xee>
-.*: 85 69 00 00 [ ]*brxle %r6,%r9,f2 <foo\+0xf2>
+.*: a7 65 00 00 [ ]*bras %r6,e6 <foo\+0xe6>
+.*: a7 64 00 00 [ ]*jlh ea <foo\+0xea>
+.*: a7 66 00 00 [ ]*brct %r6,ee <foo\+0xee>
+.*: a7 66 00 00 [ ]*brct %r6,f2 <foo\+0xf2>
+.*: 84 69 00 00 [ ]*brxh %r6,%r9,f6 <foo\+0xf6>
+.*: 84 69 00 00 [ ]*brxh %r6,%r9,fa <foo\+0xfa>
+.*: 85 69 00 00 [ ]*brxle %r6,%r9,fe <foo\+0xfe>
+.*: 85 69 00 00 [ ]*brxle %r6,%r9,102 <foo\+0x102>
.*: b2 5a 00 69 [ ]*bsa %r6,%r9
.*: b2 58 00 69 [ ]*bsg %r6,%r9
.*: 0b 69 [ ]*bsm %r6,%r9
@@ -180,27 +184,49 @@ Disassembly of section .text:
.*: b2 21 00 69 [ ]*ipte %r6,%r9
.*: b2 29 00 69 [ ]*iske %r6,%r9
.*: b2 23 00 69 [ ]*ivsk %r6,%r9
-.*: a7 f4 00 00 [ ]*j 278 <foo\+0x278>
-.*: a7 84 00 00 [ ]*je 27c <foo\+0x27c>
-.*: a7 24 00 00 [ ]*jh 280 <foo\+0x280>
-.*: a7 a4 00 00 [ ]*jhe 284 <foo\+0x284>
-.*: a7 44 00 00 [ ]*jl 288 <foo\+0x288>
-.*: a7 c4 00 00 [ ]*jle 28c <foo\+0x28c>
-.*: a7 64 00 00 [ ]*jlh 290 <foo\+0x290>
-.*: a7 44 00 00 [ ]*jl 294 <foo\+0x294>
-.*: a7 74 00 00 [ ]*jne 298 <foo\+0x298>
-.*: a7 d4 00 00 [ ]*jnh 29c <foo\+0x29c>
-.*: a7 54 00 00 [ ]*jnhe 2a0 <foo\+0x2a0>
-.*: a7 b4 00 00 [ ]*jnl 2a4 <foo\+0x2a4>
-.*: a7 34 00 00 [ ]*jnle 2a8 <foo\+0x2a8>
-.*: a7 94 00 00 [ ]*jnlh 2ac <foo\+0x2ac>
-.*: a7 b4 00 00 [ ]*jnl 2b0 <foo\+0x2b0>
-.*: a7 e4 00 00 [ ]*jno 2b4 <foo\+0x2b4>
-.*: a7 d4 00 00 [ ]*jnh 2b8 <foo\+0x2b8>
-.*: a7 74 00 00 [ ]*jne 2bc <foo\+0x2bc>
-.*: a7 14 00 00 [ ]*jo 2c0 <foo\+0x2c0>
-.*: a7 24 00 00 [ ]*jh 2c4 <foo\+0x2c4>
-.*: a7 84 00 00 [ ]*je 2c8 <foo\+0x2c8>
+.*: a7 f4 00 00 [ ]*j 288 <foo\+0x288>
+.*: a7 84 00 00 [ ]*je 28c <foo\+0x28c>
+.*: a7 24 00 00 [ ]*jh 290 <foo\+0x290>
+.*: a7 a4 00 00 [ ]*jhe 294 <foo\+0x294>
+.*: a7 44 00 00 [ ]*jl 298 <foo\+0x298>
+.*: a7 c4 00 00 [ ]*jle 29c <foo\+0x29c>
+.*: a7 64 00 00 [ ]*jlh 2a0 <foo\+0x2a0>
+.*: a7 44 00 00 [ ]*jl 2a4 <foo\+0x2a4>
+.*: a7 74 00 00 [ ]*jne 2a8 <foo\+0x2a8>
+.*: a7 d4 00 00 [ ]*jnh 2ac <foo\+0x2ac>
+.*: a7 54 00 00 [ ]*jnhe 2b0 <foo\+0x2b0>
+.*: a7 b4 00 00 [ ]*jnl 2b4 <foo\+0x2b4>
+.*: a7 34 00 00 [ ]*jnle 2b8 <foo\+0x2b8>
+.*: a7 94 00 00 [ ]*jnlh 2bc <foo\+0x2bc>
+.*: a7 b4 00 00 [ ]*jnl 2c0 <foo\+0x2c0>
+.*: a7 e4 00 00 [ ]*jno 2c4 <foo\+0x2c4>
+.*: a7 d4 00 00 [ ]*jnh 2c8 <foo\+0x2c8>
+.*: a7 74 00 00 [ ]*jne 2cc <foo\+0x2cc>
+.*: a7 14 00 00 [ ]*jo 2d0 <foo\+0x2d0>
+.*: a7 24 00 00 [ ]*jh 2d4 <foo\+0x2d4>
+.*: a7 84 00 00 [ ]*je 2d8 <foo\+0x2d8>
+.*: a7 04 00 00 [ ]*jnop 2dc <foo\+0x2dc>
+.*: a7 14 00 00 [ ]*jo 2e0 <foo\+0x2e0>
+.*: a7 24 00 00 [ ]*jh 2e4 <foo\+0x2e4>
+.*: a7 24 00 00 [ ]*jh 2e8 <foo\+0x2e8>
+.*: a7 34 00 00 [ ]*jnle 2ec <foo\+0x2ec>
+.*: a7 44 00 00 [ ]*jl 2f0 <foo\+0x2f0>
+.*: a7 44 00 00 [ ]*jl 2f4 <foo\+0x2f4>
+.*: a7 54 00 00 [ ]*jnhe 2f8 <foo\+0x2f8>
+.*: a7 64 00 00 [ ]*jlh 2fc <foo\+0x2fc>
+.*: a7 74 00 00 [ ]*jne 300 <foo\+0x300>
+.*: a7 74 00 00 [ ]*jne 304 <foo\+0x304>
+.*: a7 84 00 00 [ ]*je 308 <foo\+0x308>
+.*: a7 84 00 00 [ ]*je 30c <foo\+0x30c>
+.*: a7 94 00 00 [ ]*jnlh 310 <foo\+0x310>
+.*: a7 a4 00 00 [ ]*jhe 314 <foo\+0x314>
+.*: a7 b4 00 00 [ ]*jnl 318 <foo\+0x318>
+.*: a7 b4 00 00 [ ]*jnl 31c <foo\+0x31c>
+.*: a7 c4 00 00 [ ]*jle 320 <foo\+0x320>
+.*: a7 d4 00 00 [ ]*jnh 324 <foo\+0x324>
+.*: a7 d4 00 00 [ ]*jnh 328 <foo\+0x328>
+.*: a7 e4 00 00 [ ]*jno 32c <foo\+0x32c>
+.*: a7 f4 00 00 [ ]*j 330 <foo\+0x330>
.*: ed 65 af ff 00 18 [ ]*kdb %f6,4095\(%r5,%r10\)
.*: b3 18 00 69 [ ]*kdbr %f6,%f9
.*: ed 65 af ff 00 08 [ ]*keb %f6,4095\(%r5,%r10\)
@@ -483,4 +509,4 @@ Disassembly of section .text:
.*: f8 58 5f ff af ff [ ]*zap 4095\(6,%r5\),4095\(9,%r10\)
.*: b2 21 b0 69 [ ]*ipte %r6,%r9,%r11
.*: b2 21 bd 69 [ ]*ipte %r6,%r9,%r11,13
-.*: 07 07 [ ]*nopr %r7
+.*: 07 07 [ ]*nopr %r7
diff -rup binutils.orig/gas/testsuite/gas/s390/esa-g5.s binutils-2.30/gas/testsuite/gas/s390/esa-g5.s
--- binutils.orig/gas/testsuite/gas/s390/esa-g5.s 2021-09-29 15:59:10.716209698 +0100
+++ binutils-2.30/gas/testsuite/gas/s390/esa-g5.s 2021-09-29 16:00:26.052682524 +0100
@@ -72,10 +72,14 @@ foo:
bpr %r9
br %r9
bras %r9,.
+ jas %r6,.
brc 6,.
brct 6,.
+ jct %r6,.
brxh %r6,%r9,.
+ jxh %r6,%r9,.
brxle %r6,%r9,.
+ jxle %r6,%r9,.
bsa %r6,%r9
bsg %r6,%r9
bsm %r6,%r9
@@ -195,6 +199,28 @@ foo:
jo .
jp .
jz .
+ jnop .
+ bro .
+ brh .
+ brp .
+ brnle .
+ brl .
+ brm .
+ brnhe .
+ brlh .
+ brne .
+ brnz .
+ bre .
+ brz .
+ brnlh .
+ brhe .
+ brnl .
+ brnm .
+ brle .
+ brnh .
+ brnp .
+ brno .
+ bru .
kdb %f6,4095(%r5,%r10)
kdbr %f6,%f9
keb %f6,4095(%r5,%r10)
diff -rup binutils.orig/gas/testsuite/gas/s390/esa-z900.d binutils-2.30/gas/testsuite/gas/s390/esa-z900.d
--- binutils.orig/gas/testsuite/gas/s390/esa-z900.d 2021-09-29 15:59:10.717209691 +0100
+++ binutils-2.30/gas/testsuite/gas/s390/esa-z900.d 2021-09-29 16:00:26.052682524 +0100
@@ -6,29 +6,52 @@
Disassembly of section .text:
.* <foo>:
-.*: c0 f4 00 00 00 00 [ ]*jg 0 \<foo\>
-.*: c0 14 00 00 00 00 [ ]*jgo 6 \<foo\+0x6>
-.*: c0 24 00 00 00 00 [ ]*jgh c \<foo\+0xc>
-.*: c0 24 00 00 00 00 [ ]*jgh 12 \<foo\+0x12>
-.*: c0 34 00 00 00 00 [ ]*jgnle 18 \<foo\+0x18>
-.*: c0 44 00 00 00 00 [ ]*jgl 1e \<foo\+0x1e>
-.*: c0 44 00 00 00 00 [ ]*jgl 24 \<foo\+0x24>
-.*: c0 54 00 00 00 00 [ ]*jgnhe 2a \<foo\+0x2a>
-.*: c0 64 00 00 00 00 [ ]*jglh 30 \<foo\+0x30>
-.*: c0 74 00 00 00 00 [ ]*jgne 36 \<foo\+0x36>
-.*: c0 74 00 00 00 00 [ ]*jgne 3c \<foo\+0x3c>
-.*: c0 84 00 00 00 00 [ ]*jge 42 \<foo\+0x42>
-.*: c0 84 00 00 00 00 [ ]*jge 48 \<foo\+0x48>
-.*: c0 94 00 00 00 00 [ ]*jgnlh 4e \<foo\+0x4e>
-.*: c0 a4 00 00 00 00 [ ]*jghe 54 \<foo\+0x54>
-.*: c0 b4 00 00 00 00 [ ]*jgnl 5a \<foo\+0x5a>
-.*: c0 b4 00 00 00 00 [ ]*jgnl 60 \<foo\+0x60>
-.*: c0 c4 00 00 00 00 [ ]*jgle 66 \<foo\+0x66>
-.*: c0 d4 00 00 00 00 [ ]*jgnh 6c \<foo\+0x6c>
-.*: c0 d4 00 00 00 00 [ ]*jgnh 72 \<foo\+0x72>
-.*: c0 e4 00 00 00 00 [ ]*jgno 78 \<foo\+0x78>
-.*: c0 f4 00 00 00 00 [ ]*jg 7e \<foo\+0x7e>
-.*: c0 65 00 00 00 00 [ ]*brasl %r6,84 \<foo\+0x84>
+.*: c0 f4 00 00 00 00 [ ]*jg 0 <foo>
+.*: c0 04 00 00 00 00 [ ]*jgnop 6 <foo\+0x6>
+.*: c0 14 00 00 00 00 [ ]*jgo c <foo\+0xc>
+.*: c0 24 00 00 00 00 [ ]*jgh 12 <foo\+0x12>
+.*: c0 24 00 00 00 00 [ ]*jgh 18 <foo\+0x18>
+.*: c0 34 00 00 00 00 [ ]*jgnle 1e <foo\+0x1e>
+.*: c0 44 00 00 00 00 [ ]*jgl 24 <foo\+0x24>
+.*: c0 44 00 00 00 00 [ ]*jgl 2a <foo\+0x2a>
+.*: c0 54 00 00 00 00 [ ]*jgnhe 30 <foo\+0x30>
+.*: c0 64 00 00 00 00 [ ]*jglh 36 <foo\+0x36>
+.*: c0 74 00 00 00 00 [ ]*jgne 3c <foo\+0x3c>
+.*: c0 74 00 00 00 00 [ ]*jgne 42 <foo\+0x42>
+.*: c0 84 00 00 00 00 [ ]*jge 48 <foo\+0x48>
+.*: c0 84 00 00 00 00 [ ]*jge 4e <foo\+0x4e>
+.*: c0 94 00 00 00 00 [ ]*jgnlh 54 <foo\+0x54>
+.*: c0 a4 00 00 00 00 [ ]*jghe 5a <foo\+0x5a>
+.*: c0 b4 00 00 00 00 [ ]*jgnl 60 <foo\+0x60>
+.*: c0 b4 00 00 00 00 [ ]*jgnl 66 <foo\+0x66>
+.*: c0 c4 00 00 00 00 [ ]*jgle 6c <foo\+0x6c>
+.*: c0 d4 00 00 00 00 [ ]*jgnh 72 <foo\+0x72>
+.*: c0 d4 00 00 00 00 [ ]*jgnh 78 <foo\+0x78>
+.*: c0 e4 00 00 00 00 [ ]*jgno 7e <foo\+0x7e>
+.*: c0 f4 00 00 00 00 [ ]*jg 84 <foo\+0x84>
+.*: c0 14 00 00 00 00 [ ]*jgo 8a <foo\+0x8a>
+.*: c0 24 00 00 00 00 [ ]*jgh 90 <foo\+0x90>
+.*: c0 24 00 00 00 00 [ ]*jgh 96 <foo\+0x96>
+.*: c0 34 00 00 00 00 [ ]*jgnle 9c <foo\+0x9c>
+.*: c0 44 00 00 00 00 [ ]*jgl a2 <foo\+0xa2>
+.*: c0 44 00 00 00 00 [ ]*jgl a8 <foo\+0xa8>
+.*: c0 54 00 00 00 00 [ ]*jgnhe ae <foo\+0xae>
+.*: c0 64 00 00 00 00 [ ]*jglh b4 <foo\+0xb4>
+.*: c0 74 00 00 00 00 [ ]*jgne ba <foo\+0xba>
+.*: c0 74 00 00 00 00 [ ]*jgne c0 <foo\+0xc0>
+.*: c0 84 00 00 00 00 [ ]*jge c6 <foo\+0xc6>
+.*: c0 84 00 00 00 00 [ ]*jge cc <foo\+0xcc>
+.*: c0 94 00 00 00 00 [ ]*jgnlh d2 <foo\+0xd2>
+.*: c0 a4 00 00 00 00 [ ]*jghe d8 <foo\+0xd8>
+.*: c0 b4 00 00 00 00 [ ]*jgnl de <foo\+0xde>
+.*: c0 b4 00 00 00 00 [ ]*jgnl e4 <foo\+0xe4>
+.*: c0 c4 00 00 00 00 [ ]*jgle ea <foo\+0xea>
+.*: c0 d4 00 00 00 00 [ ]*jgnh f0 <foo\+0xf0>
+.*: c0 d4 00 00 00 00 [ ]*jgnh f6 <foo\+0xf6>
+.*: c0 e4 00 00 00 00 [ ]*jgno fc <foo\+0xfc>
+.*: c0 f4 00 00 00 00 [ ]*jg 102 <foo\+0x102>
+.*: c0 65 00 00 00 00 [ ]*brasl %r6,108 <foo\+0x108>
+.*: c0 65 00 00 00 00 [ ]*brasl %r6,10e <foo\+0x10e>
.*: 01 0b [ ]*tam
.*: 01 0c [ ]*sam24
.*: 01 0d [ ]*sam31
@@ -39,7 +62,7 @@ Disassembly of section .text:
.*: b9 97 00 69 [ ]*dlr %r6,%r9
.*: b9 98 00 69 [ ]*alcr %r6,%r9
.*: b9 99 00 69 [ ]*slbr %r6,%r9
-.*: c0 60 00 00 00 00 [ ]*larl %r6,ac \<foo\+0xac\>
+.*: c0 60 00 00 00 00 [ ]*larl %r6,136 <foo\+0x136>
.*: e3 65 af ff 00 1e [ ]*lrv %r6,4095\(%r5,%r10\)
.*: e3 65 af ff 00 1f [ ]*lrvh %r6,4095\(%r5,%r10\)
.*: e3 65 af ff 00 3e [ ]*strv %r6,4095\(%r5,%r10\)
@@ -49,3 +72,4 @@ Disassembly of section .text:
.*: e3 65 af ff 00 98 [ ]*alc %r6,4095\(%r5,%r10\)
.*: e3 65 af ff 00 99 [ ]*slb %r6,4095\(%r5,%r10\)
.*: eb 69 5f ff 00 1d [ ]*rll %r6,%r9,4095\(%r5\)
+.*: 07 07 [ ]*nopr %r7
diff -rup binutils.orig/gas/testsuite/gas/s390/esa-z900.s binutils-2.30/gas/testsuite/gas/s390/esa-z900.s
--- binutils.orig/gas/testsuite/gas/s390/esa-z900.s 2021-09-29 15:59:10.716209698 +0100
+++ binutils-2.30/gas/testsuite/gas/s390/esa-z900.s 2021-09-29 16:00:26.053682517 +0100
@@ -1,6 +1,7 @@
.text
foo:
brcl 15,.
+ jgnop .
jgo .
jgh .
jgp .
@@ -22,7 +23,29 @@ foo:
jgnp .
jgno .
jg .
+ brol .
+ brhl .
+ brpl .
+ brnlel .
+ brll .
+ brml .
+ brnhel .
+ brlhl .
+ brnel .
+ brnzl .
+ brel .
+ brzl .
+ brnlhl .
+ brhel .
+ brnll .
+ brnml .
+ brlel .
+ brnhl .
+ brnpl .
+ brnol .
+ brul .
brasl %r6,.
+ jasl %r6,.
tam
sam24
sam31
diff -rup binutils.orig/gas/testsuite/gas/s390/s390.exp binutils-2.30/gas/testsuite/gas/s390/s390.exp
--- binutils.orig/gas/testsuite/gas/s390/s390.exp 2021-09-29 15:59:10.716209698 +0100
+++ binutils-2.30/gas/testsuite/gas/s390/s390.exp 2021-09-29 16:01:42.244149395 +0100
@@ -30,6 +30,7 @@ if [expr [istarget "s390-*-*"] || [ista
run_dump_test "zarch-z13" "{as -m64} {as -march=z13}"
run_dump_test "zarch-arch12" "{as -m64} {as -march=arch12}"
run_dump_test "zarch-arch13" "{as -m64} {as -march=arch13}"
+ run_dump_test "zarch-arch14" "{as -m64} {as -march=arch14}"
run_dump_test "zarch-reloc" "{as -m64}"
run_dump_test "zarch-operands" "{as -m64} {as -march=z9-109}"
run_dump_test "zarch-machine" "{as -m64} {as -march=z900}"
diff -rup binutils.orig/gas/testsuite/gas/s390/zarch-z10.d binutils-2.30/gas/testsuite/gas/s390/zarch-z10.d
--- binutils.orig/gas/testsuite/gas/s390/zarch-z10.d 2021-09-29 15:59:10.716209698 +0100
+++ binutils-2.30/gas/testsuite/gas/s390/zarch-z10.d 2021-09-29 16:01:16.115332226 +0100
@@ -362,11 +362,13 @@ Disassembly of section .text:
.*: ec 67 d2 dc e6 54 [ ]*rnsbg %r6,%r7,210,220,230
.*: ec 67 d2 dc e6 57 [ ]*rxsbg %r6,%r7,210,220,230
.*: ec 67 d2 dc e6 56 [ ]*rosbg %r6,%r7,210,220,230
-.*: ec 67 d2 dc e6 55 [ ]*risbg %r6,%r7,210,220,230
-.*: c4 6f 00 00 00 00 [ ]*strl %r6,7f6 <foo\+0x7f6>
-.*: c4 6b 00 00 00 00 [ ]*stgrl %r6,7fc <foo\+0x7fc>
-.*: c4 67 00 00 00 00 [ ]*sthrl %r6,802 <foo\+0x802>
-.*: c6 60 00 00 00 00 [ ]*exrl %r6,808 <foo\+0x808>
+.*: ec 67 d2 14 e6 55 [ ]*risbg %r6,%r7,210,20,230
+.*: ec 67 d2 bc e6 55 [ ]*risbgz %r6,%r7,210,60,230
+.*: ec 67 d2 94 e6 55 [ ]*risbgz %r6,%r7,210,20,230
+.*: c4 6f 00 00 00 00 [ ]*strl %r6,802 <foo\+0x802>
+.*: c4 6b 00 00 00 00 [ ]*stgrl %r6,808 <foo\+0x808>
+.*: c4 67 00 00 00 00 [ ]*sthrl %r6,80e <foo\+0x80e>
+.*: c6 60 00 00 00 00 [ ]*exrl %r6,814 <foo\+0x814>
.*: af ee 6d 05 [ ]*mc 3333\(%r6\),238
.*: b9 a2 00 60 [ ]*ptf %r6
.*: b9 af 00 67 [ ]*pfmf %r6,%r7
diff -rup binutils.orig/gas/testsuite/gas/s390/zarch-z10.s binutils-2.30/gas/testsuite/gas/s390/zarch-z10.s
--- binutils.orig/gas/testsuite/gas/s390/zarch-z10.s 2021-09-29 15:59:10.716209698 +0100
+++ binutils-2.30/gas/testsuite/gas/s390/zarch-z10.s 2021-09-29 16:01:16.116332219 +0100
@@ -356,7 +356,9 @@ foo:
rnsbg %r6,%r7,210,220,230
rxsbg %r6,%r7,210,220,230
rosbg %r6,%r7,210,220,230
- risbg %r6,%r7,210,220,230
+ risbg %r6,%r7,210,20,230
+ risbg %r6,%r7,210,188,230
+ risbgz %r6,%r7,210,20,230
strl %r6,.
stgrl %r6,.
sthrl %r6,.
diff -rup binutils.orig/gas/testsuite/gas/s390/zarch-z900.d binutils-2.30/gas/testsuite/gas/s390/zarch-z900.d
--- binutils.orig/gas/testsuite/gas/s390/zarch-z900.d 2021-09-29 15:59:10.717209691 +0100
+++ binutils-2.30/gas/testsuite/gas/s390/zarch-z900.d 2021-09-29 16:00:26.053682517 +0100
@@ -20,8 +20,11 @@ Disassembly of section .text:
.*: e3 95 af ff 00 46 [ ]*bctg %r9,4095\(%r5,%r10\)
.*: b9 46 00 96 [ ]*bctgr %r9,%r6
.*: a7 97 00 00 [ ]*brctg %r9,40 \<foo\+0x40\>
-.*: ec 96 00 00 00 44 [ ]*brxhg %r9,%r6,44 <foo\+0x44>
-.*: ec 96 00 00 00 45 [ ]*brxlg %r9,%r6,4a <foo\+0x4a>
+.*: a7 67 00 00 [ ]*brctg %r6,44 <foo\+0x44>
+.*: ec 96 00 00 00 44 [ ]*brxhg %r9,%r6,48 <foo\+0x48>
+.*: ec 69 00 00 00 44 [ ]*brxhg %r6,%r9,4e <foo\+0x4e>
+.*: ec 96 00 00 00 45 [ ]*brxlg %r9,%r6,54 <foo\+0x54>
+.*: ec 69 00 00 00 45 [ ]*brxlg %r6,%r9,5a <foo\+0x5a>
.*: eb 96 5f ff 00 44 [ ]*bxhg %r9,%r6,4095\(%r5\)
.*: eb 96 5f ff 00 45 [ ]*bxleg %r9,%r6,4095\(%r5\)
.*: b3 a5 00 96 [ ]*cdgbr %f9,%r6
diff -rup binutils.orig/gas/testsuite/gas/s390/zarch-z900.s binutils-2.30/gas/testsuite/gas/s390/zarch-z900.s
--- binutils.orig/gas/testsuite/gas/s390/zarch-z900.s 2021-09-29 15:59:10.716209698 +0100
+++ binutils-2.30/gas/testsuite/gas/s390/zarch-z900.s 2021-09-29 16:00:26.053682517 +0100
@@ -14,8 +14,11 @@ foo:
bctg %r9,4095(%r5,%r10)
bctgr %r9,%r6
brctg %r9,.
+ jctg %r6,.
brxhg %r9,%r6,.
+ jxhg %r6,%r9,.
brxlg %r9,%r6,.
+ jxleg %r6,%r9,.
bxhg %r9,%r6,4095(%r5)
bxleg %r9,%r6,4095(%r5)
cdgbr %f9,%r6
diff -rup binutils.orig/gas/testsuite/gas/s390/zarch-zEC12.d binutils-2.30/gas/testsuite/gas/s390/zarch-zEC12.d
--- binutils.orig/gas/testsuite/gas/s390/zarch-zEC12.d 2021-09-29 15:59:10.716209698 +0100
+++ binutils-2.30/gas/testsuite/gas/s390/zarch-zEC12.d 2021-09-29 16:01:16.116332219 +0100
@@ -47,6 +47,8 @@ Disassembly of section .text:
.*: eb 6c 7a 4d fe 2b [ ]*clgtnh %r6,-5555\(%r7\)
.*: eb 6c 7a 4d fe 2b [ ]*clgtnh %r6,-5555\(%r7\)
.*: ec 67 0c 0d 0e 59 [ ]*risbgn %r6,%r7,12,13,14
+.*: ec 67 0c bc 0e 59 [ ]*risbgnz %r6,%r7,12,60,14
+.*: ec 67 0c 94 0e 59 [ ]*risbgnz %r6,%r7,12,20,14
.*: ed 0f 8f a0 6d aa [ ]*cdzt %f6,4000\(16,%r8\),13
.*: ed 21 8f a0 4d ab [ ]*cxzt %f4,4000\(34,%r8\),13
.*: ed 0f 8f a0 6d a8 [ ]*czdt %f6,4000\(16,%r8\),13
@@ -54,16 +56,16 @@ Disassembly of section .text:
.*: b2 e8 c0 56 [ ]*ppa %r5,%r6,12
.*: b9 8f 60 59 [ ]*crdte %r5,%r6,%r9
.*: b9 8f 61 59 [ ]*crdte %r5,%r6,%r9,1
-.*: c5 a0 0c 00 00 0c [ ]*bprp 10,12a <bar>,12a <bar>
-.*: c5 a0 00 00 00 00 [ ]*bprp 10,118 <foo\+0x118>,118 <foo\+0x118>
-[ ]*119: R_390_PLT12DBL bar\+0x1
-[ ]*11b: R_390_PLT24DBL bar\+0x3
-.*: c7 a0 00 00 00 00 [ ]*bpp 10,11e <foo\+0x11e>,0
-[ ]*122: R_390_PLT16DBL bar\+0x4
-.*: c7 a0 00 00 00 00 [ ]*bpp 10,124 <foo\+0x124>,0
-[ ]*128: R_390_PC16DBL baz\+0x4
+.*: c5 a0 0c 00 00 0c [ ]*bprp 10,136 <bar>,136 <bar>
+.*: c5 a0 00 00 00 00 [ ]*bprp 10,124 <foo\+0x124>,124 <foo\+0x124>
+[ ]*125: R_390_PLT12DBL bar\+0x1
+[ ]*127: R_390_PLT24DBL bar\+0x3
+.*: c7 a0 00 00 00 00 [ ]*bpp 10,12a <foo\+0x12a>,0
+[ ]*12e: R_390_PLT16DBL bar\+0x4
+.*: c7 a0 00 00 00 00 [ ]*bpp 10,130 <foo\+0x130>,0
+[ ]*134: R_390_PC16DBL baz\+0x4
-000000000000012a <bar>:
+0000000000000136 <bar>:
.*: 07 07 [ ]*nopr %r7
diff -rup binutils.orig/gas/testsuite/gas/s390/zarch-zEC12.s binutils-2.30/gas/testsuite/gas/s390/zarch-zEC12.s
--- binutils.orig/gas/testsuite/gas/s390/zarch-zEC12.s 2021-09-29 15:59:10.716209698 +0100
+++ binutils-2.30/gas/testsuite/gas/s390/zarch-zEC12.s 2021-09-29 16:01:16.116332219 +0100
@@ -44,6 +44,9 @@ foo:
clgtnh %r6,-5555(%r7)
risbgn %r6,%r7,12,13,14
+ risbgn %r6,%r7,12,188,14
+ risbgnz %r6,%r7,12,20,14
+
cdzt %f6,4000(16,%r8),13
cxzt %f4,4000(34,%r8),13
czdt %f6,4000(16,%r8),13
diff -rup binutils.orig/include/opcode/s390.h binutils-2.30/include/opcode/s390.h
--- binutils.orig/include/opcode/s390.h 2021-09-29 15:59:10.908208355 +0100
+++ binutils-2.30/include/opcode/s390.h 2021-09-29 16:01:42.245149388 +0100
@@ -44,6 +44,7 @@ enum s390_opcode_cpu_val
S390_OPCODE_Z13,
S390_OPCODE_ARCH12,
S390_OPCODE_ARCH13,
+ S390_OPCODE_ARCH14,
S390_OPCODE_MAXCPU
};
diff -rup binutils.orig/ld/ChangeLog.orig binutils-2.30/ld/ChangeLog.orig
--- binutils.orig/ld/ChangeLog.orig 2021-09-29 15:59:10.935208166 +0100
+++ binutils-2.30/ld/ChangeLog.orig 2021-09-29 16:00:26.053682517 +0100
@@ -1,3 +1,27 @@
+2018-01-27 Nick Clifton <nickc@redhat.com>
+
+ This is the 2.30 release:
+
+ * configure: Regenerate.
+ * po/ld.pot: Regenerate.
+
+2018-01-27 Nick Clifton <nickc@redhat.com>
+
+ PR 22751
+ Revert this change as a temporary solution for this PR:
+
+ 2017-09-02 Alan Modra <amodra@gmail.com>
+
+ * ldlang.h (lang_input_statement_type): Expand comments.
+ (LANG_FOR_EACH_INPUT_STATEMENT): Rewrite without casts.
+ * ldlang.c (lang_for_each_input_file): Likewise.
+ (load_symbols): Set usrdata for archives.
+ (find_rescan_insertion): New function.
+ (lang_process): Trim off and reinsert entries added to file chain
+ when rescanning archives for LTO.
+ * ldmain.c (add_archive_element): Set my_archive input_statement
+ next pointer to last element added.
+
2018-01-25 Eric Botcazou <ebotcazou@adacore.com>
* testsuite/ld-sparc/sparc.exp (32-bit: Helper shared library):
diff -rup binutils.orig/ld/ChangeLog.rej binutils-2.30/ld/ChangeLog.rej
--- binutils.orig/ld/ChangeLog.rej 2021-09-29 15:59:10.935208166 +0100
+++ binutils-2.30/ld/ChangeLog.rej 2021-09-29 16:00:26.053682517 +0100
@@ -1,18 +1,11 @@
--- ld/ChangeLog
+++ ld/ChangeLog
-@@ -1,15 +1,3 @@
--2017-09-02 Alan Modra <amodra@gmail.com>
--
-- * ldlang.h (lang_input_statement_type): Expand comments.
-- (LANG_FOR_EACH_INPUT_STATEMENT): Rewrite without casts.
-- * ldlang.c (lang_for_each_input_file): Likewise.
-- (load_symbols): Set usrdata for archives.
-- (find_rescan_insertion): New function.
-- (lang_process): Trim off and reinsert entries added to file chain
-- when rescanning archives for LTO.
-- * ldmain.c (add_archive_element): Set my_archive input_statement
-- next pointer to last element added.
--
- 2017-09-01 H.J. Lu <hongjiu.lu@intel.com>
+@@ -1,3 +1,8 @@
++2020-12-03 Andreas Krebbel <krebbel@linux.ibm.com>
++
++ * testsuite/ld-s390/tlsbin_64.dd: The newly added jgnop mnemonic
++ replaces long relative branches with empty condition code masks.
++
+ 2020-12-03 Maciej W. Rozycki <macro@linux-mips.org>
- PR ld/22064
+ * testsuite/ld-vax-elf/vax-elf.exp: Wrap excessively long lines
diff -rup binutils.orig/ld/testsuite/ld-s390/tlsbin_64.dd binutils-2.30/ld/testsuite/ld-s390/tlsbin_64.dd
--- binutils.orig/ld/testsuite/ld-s390/tlsbin_64.dd 2021-09-29 15:59:10.988207795 +0100
+++ binutils-2.30/ld/testsuite/ld-s390/tlsbin_64.dd 2021-09-29 16:00:26.053682517 +0100
@@ -87,26 +87,26 @@ Disassembly of section .text:
+[0-9a-f]+: 41 22 90 00 la %r2,0\(%r2,%r9\)
# GD -> LE with global variable defined in executable
+[0-9a-f]+: e3 20 d0 10 00 04 lg %r2,16\(%r13\)
- +[0-9a-f]+: c0 04 00 00 00 00 brcl 0,[0-9a-f]+ <fn2\+0xca>
+ +[0-9a-f]+: c0 04 00 00 00 00 jgnop [0-9a-f]+ <fn2\+0xca>
+[0-9a-f]+: 41 22 90 00 la %r2,0\(%r2,%r9\)
# GD -> LE with local variable defined in executable
+[0-9a-f]+: e3 20 d0 18 00 04 lg %r2,24\(%r13\)
- +[0-9a-f]+: c0 04 00 00 00 00 brcl 0,[0-9a-f]+ <fn2\+0xda>
+ +[0-9a-f]+: c0 04 00 00 00 00 jgnop [0-9a-f]+ <fn2\+0xda>
+[0-9a-f]+: 41 22 90 00 la %r2,0\(%r2,%r9\)
# GD -> LE with hidden variable defined in executable
+[0-9a-f]+: e3 20 d0 20 00 04 lg %r2,32\(%r13\)
- +[0-9a-f]+: c0 04 00 00 00 00 brcl 0,[0-9a-f]+ <fn2\+0xea>
+ +[0-9a-f]+: c0 04 00 00 00 00 jgnop [0-9a-f]+ <fn2\+0xea>
+[0-9a-f]+: 41 22 90 00 la %r2,0\(%r2,%r9\)
# LD -> LE
+[0-9a-f]+: e3 20 d0 28 00 04 lg %r2,40\(%r13\)
- +[0-9a-f]+: c0 04 00 00 00 00 brcl 0,[0-9a-f]+ <fn2\+0xfa>
+ +[0-9a-f]+: c0 04 00 00 00 00 jgnop [0-9a-f]+ <fn2\+0xfa>
+[0-9a-f]+: 41 32 90 00 la %r3,0\(%r2,%r9\)
+[0-9a-f]+: e3 40 d0 30 00 04 lg %r4,48\(%r13\)
+[0-9a-f]+: 41 54 30 00 la %r5,0\(%r4,%r3\)
+[0-9a-f]+: e3 40 d0 38 00 04 lg %r4,56\(%r13\)
+[0-9a-f]+: 41 54 30 00 la %r5,0\(%r4,%r3\)
+[0-9a-f]+: e3 20 d0 40 00 04 lg %r2,64\(%r13\)
- +[0-9a-f]+: c0 04 00 00 00 00 brcl 0,[0-9a-f]+ <fn2\+0x11e>
+ +[0-9a-f]+: c0 04 00 00 00 00 jgnop [0-9a-f]+ <fn2\+0x11e>
+[0-9a-f]+: 41 32 90 00 la %r3,0\(%r2,%r9\)
+[0-9a-f]+: e3 40 d0 48 00 04 lg %r4,72\(%r13\)
+[0-9a-f]+: 41 54 30 00 la %r5,0\(%r4,%r3\)
diff -rup binutils.orig/opcodes/s390-mkopc.c binutils-2.30/opcodes/s390-mkopc.c
--- binutils.orig/opcodes/s390-mkopc.c 2021-09-29 15:59:10.934208173 +0100
+++ binutils-2.30/opcodes/s390-mkopc.c 2021-09-29 16:01:42.245149388 +0100
@@ -379,6 +379,8 @@ main (void)
min_cpu = S390_OPCODE_ARCH12;
else if (strcmp (cpu_string, "arch13") == 0)
min_cpu = S390_OPCODE_ARCH13;
+ else if (strcmp (cpu_string, "arch14") == 0)
+ min_cpu = S390_OPCODE_ARCH14;
else {
fprintf (stderr, "Couldn't parse cpu string %s\n", cpu_string);
exit (1);
diff -rup binutils.orig/opcodes/s390-opc.c binutils-2.30/opcodes/s390-opc.c
--- binutils.orig/opcodes/s390-opc.c 2021-09-29 15:59:10.928208215 +0100
+++ binutils-2.30/opcodes/s390-opc.c 2021-09-29 16:04:54.977800770 +0100
@@ -218,32 +218,34 @@ const struct s390_operand s390_operands[
{ 8, 8, 0 },
#define U8_16 68 /* 8 bit unsigned value starting at 16 */
{ 8, 16, 0 },
-#define U8_24 69 /* 8 bit unsigned value starting at 24 */
+#define U6_26 69 /* 6 bit unsigned value starting at 26 */
+ { 6, 26, 0 },
+#define U8_24 70 /* 8 bit unsigned value starting at 24 */
{ 8, 24, 0 },
-#define U8_28 70 /* 8 bit unsigned value starting at 28 */
+#define U8_28 71 /* 8 bit unsigned value starting at 28 */
{ 8, 28, 0 },
-#define U8_32 71 /* 8 bit unsigned value starting at 32 */
+#define U8_32 72 /* 8 bit unsigned value starting at 32 */
{ 8, 32, 0 },
-#define U12_16 72 /* 12 bit unsigned value starting at 16 */
+#define U12_16 73 /* 12 bit unsigned value starting at 16 */
{ 12, 16, 0 },
-#define U16_16 73 /* 16 bit unsigned value starting at 16 */
+#define U16_16 74 /* 16 bit unsigned value starting at 16 */
{ 16, 16, 0 },
-#define U16_32 74 /* 16 bit unsigned value starting at 32 */
+#define U16_32 75 /* 16 bit unsigned value starting at 32 */
{ 16, 32, 0 },
-#define U32_16 75 /* 32 bit unsigned value starting at 16 */
+#define U32_16 76 /* 32 bit unsigned value starting at 16 */
{ 32, 16, 0 },
/* PC-relative address operands. */
-#define J12_12 76 /* 12 bit PC relative offset at 12 */
+#define J12_12 77 /* 12 bit PC relative offset at 12 */
{ 12, 12, S390_OPERAND_PCREL },
-#define J16_16 77 /* 16 bit PC relative offset at 16 */
+#define J16_16 78 /* 16 bit PC relative offset at 16 */
{ 16, 16, S390_OPERAND_PCREL },
-#define J16_32 78 /* 16 bit PC relative offset at 32 */
+#define J16_32 79 /* 16 bit PC relative offset at 32 */
{ 16, 32, S390_OPERAND_PCREL },
-#define J24_24 79 /* 24 bit PC relative offset at 24 */
+#define J24_24 80 /* 24 bit PC relative offset at 24 */
{ 24, 24, S390_OPERAND_PCREL },
-#define J32_16 80 /* 32 bit PC relative offset at 16 */
+#define J32_16 81 /* 32 bit PC relative offset at 16 */
{ 32, 16, S390_OPERAND_PCREL },
};
@@ -313,6 +315,7 @@ const struct s390_operand s390_operands[
#define INSTR_RIE_R0U0 6, { R_8,U16_16,0,0,0,0 } /* e.g. clfitne */
#define INSTR_RIE_RUI0 6, { R_8,I16_16,U4_12,0,0,0 } /* e.g. lochi */
#define INSTR_RIE_RRUUU 6, { R_8,R_12,U8_16,U8_24,U8_32,0 } /* e.g. rnsbg */
+#define INSTR_RIE_RRUUU2 6, { R_8,R_12,U8_16,U6_26,U8_32,0 } /* e.g. rnsbg */
#define INSTR_RIL_0P 6, { J32_16,0,0,0,0 } /* e.g. jg */
#define INSTR_RIL_RP 6, { R_8,J32_16,0,0,0,0 } /* e.g. brasl */
#define INSTR_RIL_UP 6, { U4_8,J32_16,0,0,0,0 } /* e.g. brcl */
@@ -439,6 +442,7 @@ const struct s390_operand s390_operands[
#define INSTR_RX_URRD 4, { U4_8,D_20,X_12,B_16,0,0 } /* e.g. bc */
#define INSTR_SI_RD 4, { D_20,B_16,0,0,0,0 } /* e.g. lpsw */
#define INSTR_SI_URD 4, { D_20,B_16,U8_8,0,0,0 } /* e.g. cli */
+#define INSTR_SIY_RD 6, { D20_20,B_16,0,0,0,0 } /* e.g. lpswey*/
#define INSTR_SIY_URD 6, { D20_20,B_16,U8_8,0,0,0 } /* e.g. tmy */
#define INSTR_SIY_IRD 6, { D20_20,B_16,I8_8,0,0,0 } /* e.g. asi */
#define INSTR_SIL_RDI 6, { D_20,B_16,I16_32,0,0,0 } /* e.g. chhsi */
@@ -534,6 +538,7 @@ const struct s390_operand s390_operands[
#define MASK_RIE_R0U0 { 0xff, 0x0f, 0x00, 0x00, 0xff, 0xff }
#define MASK_RIE_RUI0 { 0xff, 0x00, 0x00, 0x00, 0xff, 0xff }
#define MASK_RIE_RRUUU { 0xff, 0x00, 0x00, 0x00, 0x00, 0xff }
+#define MASK_RIE_RRUUU2 { 0xff, 0x00, 0x00, 0xc0, 0x00, 0xff }
#define MASK_RIL_0P { 0xff, 0xff, 0x00, 0x00, 0x00, 0x00 }
#define MASK_RIL_RP { 0xff, 0x0f, 0x00, 0x00, 0x00, 0x00 }
#define MASK_RIL_UP { 0xff, 0x0f, 0x00, 0x00, 0x00, 0x00 }
@@ -660,6 +665,7 @@ const struct s390_operand s390_operands[
#define MASK_RX_URRD { 0xff, 0x00, 0x00, 0x00, 0x00, 0x00 }
#define MASK_SI_RD { 0xff, 0x00, 0x00, 0x00, 0x00, 0x00 }
#define MASK_SI_URD { 0xff, 0x00, 0x00, 0x00, 0x00, 0x00 }
+#define MASK_SIY_RD { 0xff, 0xff, 0x00, 0x00, 0x00, 0xff }
#define MASK_SIY_URD { 0xff, 0x00, 0x00, 0x00, 0x00, 0xff }
#define MASK_SIY_IRD { 0xff, 0x00, 0x00, 0x00, 0x00, 0xff }
#define MASK_SIL_RDI { 0xff, 0xff, 0x00, 0x00, 0x00, 0x00 }
diff -rup binutils.orig/opcodes/s390-opc.txt binutils-2.30/opcodes/s390-opc.txt
--- binutils.orig/opcodes/s390-opc.txt 2021-09-29 15:59:10.933208180 +0100
+++ binutils-2.30/opcodes/s390-opc.txt 2021-09-29 16:05:08.818703921 +0100
@@ -246,10 +246,14 @@ d7 xc SS_L0RDRD "exclusive OR" g5 esa,za
f8 zap SS_LLRDRD "zero and add" g5 esa,zarch
a70a ahi RI_RI "add halfword immediate" g5 esa,zarch
84 brxh RSI_RRP "branch relative on index high" g5 esa,zarch
+84 jxh RSI_RRP "branch relative on index high" g5 esa,zarch
85 brxle RSI_RRP "branch relative on index low or equal" g5 esa,zarch
+85 jxle RSI_RRP "branch relative on index low or equal" g5 esa,zarch
a705 bras RI_RP "branch relative and save" g5 esa,zarch
+a705 jas RI_RP "branch relative and save" g5 esa,zarch
a704 brc RI_UP "branch relative on condition" g5 esa,zarch
a706 brct RI_RP "branch relative on count" g5 esa,zarch
+a706 jct RI_RP "branch relative on count" g5 esa,zarch
b241 cksm RRE_RR "checksum" g5 esa,zarch
a70e chi RI_RI "compare halfword immediate" g5 esa,zarch
a9 clcle RS_RRRD "compare logical long extended" g5 esa,zarch
@@ -268,8 +272,11 @@ a701 tml RI_RU "test under mask low" g5
4700 nop RX_0RRD "no operation" g5 esa,zarch optparm
4700 b*8 RX_0RRD "conditional branch" g5 esa,zarch
47f0 b RX_0RRD "unconditional branch" g5 esa,zarch
+a704 jnop RI_0P "nop jump" g5 esa,zarch
a704 j*8 RI_0P "conditional jump" g5 esa,zarch
+a704 br*8 RI_0P "conditional jump" g5 esa,zarch
a7f4 j RI_0P "unconditional jump" g5 esa,zarch
+a7f4 bru RI_0P "unconditional jump" g5 esa,zarch
b34a axbr RRE_FEFE "add extended bfp" g5 esa,zarch
b31a adbr RRE_FF "add long bfp" g5 esa,zarch
ed000000001a adb RXE_FRRD "add long bfp" g5 esa,zarch
@@ -437,7 +444,9 @@ e3000000001b slgf RXE_RRRD "subtract log
e3000000000c msg RXE_RRRD "multiply single 64" z900 zarch
e3000000001c msgf RXE_RRRD "multiply single 64<32" z900 zarch
ec0000000044 brxhg RIE_RRP "branch relative on index high 64" z900 zarch
+ec0000000044 jxhg RIE_RRP "branch relative on index high 64" z900 zarch
ec0000000045 brxlg RIE_RRP "branch relative on index low or equal 64" z900 zarch
+ec0000000045 jxleg RIE_RRP "branch relative on index low or equal 64" z900 zarch
eb0000000044 bxhg RSE_RRRD "branch on index high 64" z900 zarch
eb0000000045 bxleg RSE_RRRD "branch on index low or equal 64" z900 zarch
eb000000000c srlg RSE_RRRD "shift right single logical 64" z900 zarch
@@ -462,10 +471,15 @@ eb0000000080 icmh RSE_RURD "insert chara
a702 tmhh RI_RU "test under mask high high" z900 zarch
a703 tmhl RI_RU "test under mask high low" z900 zarch
c004 brcl RIL_UP "branch relative on condition long" z900 esa,zarch
+c004 jgnop RIL_0P "nop jump long" z900 esa,zarch
c004 jg*8 RIL_0P "conditional jump long" z900 esa,zarch
+c004 br*8l RIL_0P "conditional jump long" z900 esa,zarch
c0f4 jg RIL_0P "unconditional jump long" z900 esa,zarch
+c0f4 brul RIL_0P "unconditional jump long" z900 esa,zarch
c005 brasl RIL_RP "branch relative and save long" z900 esa,zarch
+c005 jasl RIL_RP "branch relative and save long" z900 esa,zarch
a707 brctg RI_RP "branch relative on count 64" z900 zarch
+a707 jctg RI_RP "branch relative on count 64" z900 zarch
a709 lghi RI_RI "load halfword immediate 64" z900 zarch
a70b aghi RI_RI "add halfword immediate 64" z900 zarch
a70d mghi RI_RI "multiply halfword immediate 64" z900 zarch
@@ -956,6 +970,7 @@ ec0000000054 rnsbg RIE_RRUUU "rotate the
ec0000000057 rxsbg RIE_RRUUU "rotate then exclusive or selected bits" z10 zarch
ec0000000056 rosbg RIE_RRUUU "rotate then or selected bits" z10 zarch
ec0000000055 risbg RIE_RRUUU "rotate then insert selected bits" z10 zarch
+ec0000800055 risbgz RIE_RRUUU2 "rotate then insert selected bits and zero remaining bits" z10 zarch
c40f strl RIL_RP "store relative long (32)" z10 zarch
c40b stgrl RIL_RP "store relative long (64)" z10 zarch
c407 sthrl RIL_RP "store halfword relative long" z10 zarch
@@ -1139,6 +1154,7 @@ eb0000000023 clt$12 RSY_R0RD "compare lo
eb000000002b clgt RSY_RURD "compare logical and trap 64 bit reg-mem" zEC12 zarch
eb000000002b clgt$12 RSY_R0RD "compare logical and trap 64 bit reg-mem" zEC12 zarch
ec0000000059 risbgn RIE_RRUUU "rotate then insert selected bits nocc" zEC12 zarch
+ec0000800059 risbgnz RIE_RRUUU2 "rotate then insert selected bits and zero remaining bits nocc" zEC12 zarch
ed00000000aa cdzt RSL_LRDFU "convert from zoned long" zEC12 zarch
ed00000000ab cxzt RSL_LRDFEU "convert from zoned extended" zEC12 zarch
ed00000000a8 czdt RSL_LRDFU "convert to zoned long" zEC12 zarch
@@ -2001,3 +2017,33 @@ e60000000052 vcvbg VRR_RV0UU "vector con
# Message Security Assist Extension 9
b93a kdsa RRE_RR "compute digital signature authentication" arch13 zarch
+
+
+# arch14 instructions
+
+e60000000074 vschp VRR_VVV0U0U " " arch14 zarch
+e60000002074 vschsp VRR_VVV0U0 " " arch14 zarch
+e60000003074 vschdp VRR_VVV0U0 " " arch14 zarch
+e60000004074 vschxp VRR_VVV0U0 " " arch14 zarch
+e6000000007c vscshp VRR_VVV " " arch14 zarch
+e6000000007d vcsph VRR_VVV0U0 " " arch14 zarch
+e60000000051 vclzdp VRR_VV0U2 " " arch14 zarch
+e60000000070 vpkzr VRI_VVV0UU2 " " arch14 zarch
+e60000000072 vsrpr VRI_VVV0UU2 " " arch14 zarch
+e60000000054 vupkzh VRR_VV0U2 " " arch14 zarch
+e6000000005c vupkzl VRR_VV0U2 " " arch14 zarch
+
+b93b nnpa RRE_00 " " arch14 zarch
+e60000000056 vclfnh VRR_VV0UU2 " " arch14 zarch
+e6000000005e vclfnl VRR_VV0UU2 " " arch14 zarch
+e60000000075 vcrnf VRR_VVV0UU " " arch14 zarch
+e6000000005d vcfn VRR_VV0UU2 " " arch14 zarch
+e60000000055 vcnf VRR_VV0UU2 " " arch14 zarch
+
+b98B rdp RRF_RURR2 " " arch14 zarch optparm
+
+eb0000000071 lpswey SIY_RD " " arch14 zarch
+b200 lbear S_RD " " arch14 zarch
+b201 stbear S_RD " " arch14 zarch
+
+b28f qpaci S_RD " " arch14 zarch
--- /dev/null 2021-09-29 08:55:29.386811947 +0100
+++ binutils-2.30/gas/testsuite/gas/s390/zarch-arch14.s 2021-09-29 16:05:08.817703928 +0100
@@ -0,0 +1,25 @@
+.text
+foo:
+ vschp %v15,%v17,%v20,13,12
+ vschsp %v15,%v17,%v20,13
+ vschdp %v15,%v17,%v20,13
+ vschxp %v15,%v17,%v20,13
+ vscshp %v15,%v17,%v20
+ vcsph %v15,%v17,%v20,13
+ vclzdp %v15,%v17,13
+ vpkzr %v15,%v17,%v20,253,12
+ vsrpr %v15,%v17,%v20,253,12
+ vupkzh %v15,%v17,13
+ vupkzl %v15,%v17,13
+ nnpa
+ vclfnh %v15,%v17,13,12
+ vclfnl %v15,%v17,13,12
+ vcrnf %v15,%v17,%v20,13,12
+ vcfn %v15,%v17,13,12
+ vcnf %v15,%v17,13,12
+ rdp %r6,%r9,%r11
+ rdp %r6,%r9,%r11,13
+ lpswey -10000(%r6)
+ lbear 4000(%r6)
+ stbear 4000(%r6)
+ qpaci 4095(%r5)
--- /dev/null 2021-09-29 08:55:29.386811947 +0100
+++ binutils-2.30/gas/testsuite/gas/s390/zarch-arch14.d 2021-09-29 16:05:08.817703928 +0100
@@ -0,0 +1,32 @@
+#name: s390x opcode
+#objdump: -dr
+
+.*: +file format .*
+
+Disassembly of section .text:
+
+.* <foo>:
+.*: e6 f1 40 c0 d6 74 [ ]*vschp %v15,%v17,%v20,13,12
+.*: e6 f1 40 d0 26 74 [ ]*vschsp %v15,%v17,%v20,13
+.*: e6 f1 40 d0 36 74 [ ]*vschdp %v15,%v17,%v20,13
+.*: e6 f1 40 d0 46 74 [ ]*vschxp %v15,%v17,%v20,13
+.*: e6 f1 40 00 06 7c [ ]*vscshp %v15,%v17,%v20
+.*: e6 f1 40 d0 06 7d [ ]*vcsph %v15,%v17,%v20,13
+.*: e6 f1 00 d0 04 51 [ ]*vclzdp %v15,%v17,13
+.*: e6 f1 40 cf d6 70 [ ]*vpkzr %v15,%v17,%v20,253,12
+.*: e6 f1 40 cf d6 72 [ ]*vsrpr %v15,%v17,%v20,253,12
+.*: e6 f1 00 d0 04 54 [ ]*vupkzh %v15,%v17,13
+.*: e6 f1 00 d0 04 5c [ ]*vupkzl %v15,%v17,13
+.*: b9 3b 00 00 [ ]*nnpa
+.*: e6 f1 00 0c d4 56 [ ]*vclfnh %v15,%v17,13,12
+.*: e6 f1 00 0c d4 5e [ ]*vclfnl %v15,%v17,13,12
+.*: e6 f1 40 0c d6 75 [ ]*vcrnf %v15,%v17,%v20,13,12
+.*: e6 f1 00 0c d4 5d [ ]*vcfn %v15,%v17,13,12
+.*: e6 f1 00 0c d4 55 [ ]*vcnf %v15,%v17,13,12
+.*: b9 8b 90 6b [ ]*rdp %r6,%r9,%r11
+.*: b9 8b 9d 6b [ ]*rdp %r6,%r9,%r11,13
+.*: eb 00 68 f0 fd 71 [ ]*lpswey -10000\(%r6\)
+.*: b2 00 6f a0 [ ]*lbear 4000\(%r6\)
+.*: b2 01 6f a0 [ ]*stbear 4000\(%r6\)
+.*: b2 8f 5f ff [ ]*qpaci 4095\(%r5\)
+.*: 07 07 [ ]*nopr %r7

View File

@ -0,0 +1,43 @@
--- binutils.orig/bfd/elf64-s390.c 2020-06-15 11:01:54.671940830 +0100
+++ binutils-2.30/bfd/elf64-s390.c 2020-06-15 11:04:44.663343784 +0100
@@ -2335,6 +2335,9 @@ elf_s390_relocate_section (bfd *output_b
&& SYMBOL_REFERENCES_LOCAL (info, h))
|| resolved_to_zero)
{
+ Elf_Internal_Sym *isym;
+ asection *sym_sec;
+
/* This is actually a static link, or it is a
-Bsymbolic link and the symbol is defined
locally, or the symbol was forced to be local
@@ -2356,6 +2359,10 @@ elf_s390_relocate_section (bfd *output_b
h->got.offset |= 1;
}
+ /* When turning a GOT slot dereference into a direct
+ reference using larl we have to make sure that
+ the symbol is 1. properly aligned and 2. it is no
+ ABS symbol or will become one. */
if ((h->def_regular
&& bfd_link_pic (info)
&& SYMBOL_REFERENCES_LOCAL (info, h))
@@ -2370,8 +2377,17 @@ elf_s390_relocate_section (bfd *output_b
contents + rel->r_offset - 2)
& 0xff00f000) == 0xe300c000
&& bfd_get_8 (input_bfd,
- contents + rel->r_offset + 3) == 0x04)))
-
+ contents + rel->r_offset + 3) == 0x04))
+ && (isym = bfd_sym_from_r_symndx (&htab->sym_cache,
+ input_bfd, r_symndx))
+ && isym->st_shndx != SHN_ABS
+ && h != htab->elf.hdynamic
+ && h != htab->elf.hgot
+ && h != htab->elf.hplt
+ && !(isym->st_value & 1)
+ && (sym_sec = bfd_section_from_elf_index (input_bfd,
+ isym->st_shndx))
+ && sym_sec->alignment_power)
{
unsigned short new_insn =
(0xc000 | (bfd_get_8 (input_bfd,

View File

@ -0,0 +1,11 @@
diff -rup binutils.orig/config/plugins.m4 binutils-2.30/config/plugins.m4
--- binutils.orig/config/plugins.m4 2019-02-18 16:11:38.392440473 +0000
+++ binutils-2.30/config/plugins.m4 2019-02-18 16:11:44.715393846 +0000
@@ -16,6 +16,6 @@ AC_DEFUN([AC_PLUGINS],
[plugins=$maybe_plugins]
)
if test "$plugins" = "yes"; then
- AC_SEARCH_LIBS([dlopen], [dl])
+ AC_SEARCH_LIBS([dlsym], [dl])
fi
])

View File

@ -0,0 +1,19 @@
--- binutils.orig/binutils/objcopy.c 2020-10-30 14:21:10.448328799 +0000
+++ binutils-2.30/binutils/objcopy.c 2020-10-30 14:22:08.406136672 +0000
@@ -3257,14 +3257,12 @@ copy_object (bfd *ibfd, bfd *obfd, const
/* It is likely that output sections are in the same order
as the input sections, but do not assume that this is
the case. */
- if (strcmp (bfd_section_name (obfd, merged->sec),
- bfd_section_name (obfd, osec)) != 0)
+ if (merged->sec->output_section != osec)
{
for (merged = merged_note_sections;
merged != NULL;
merged = merged->next)
- if (strcmp (bfd_section_name (obfd, merged->sec),
- bfd_section_name (obfd, osec)) == 0)
+ if (merged->sec->output_section == osec)
break;
if (merged == NULL)

View File

@ -0,0 +1,28 @@
diff -rup binutils-2.30/bfd/elflink.c binutils.new/bfd/elflink.c
--- binutils-2.30/bfd/elflink.c 2021-12-09 09:05:54.545468003 +0000
+++ binutils.new/bfd/elflink.c 2021-12-09 09:03:15.366632301 +0000
@@ -9980,7 +9980,7 @@ elf_link_output_extsym (struct bfd_hash_
if (h->verinfo.verdef == NULL
|| (elf_dyn_lib_class (h->verinfo.verdef->vd_bfd)
& (DYN_AS_NEEDED | DYN_DT_NEEDED | DYN_NO_NEEDED)))
- iversym.vs_vers = 0;
+ iversym.vs_vers = 1;
else
iversym.vs_vers = h->verinfo.verdef->vd_exp_refno + 1;
}
diff -rup binutils-2.30/ld/testsuite/ld-elfvers/vers16.dsym binutils.new/ld/testsuite/ld-elfvers/vers16.dsym
--- binutils-2.30/ld/testsuite/ld-elfvers/vers16.dsym 2018-01-13 13:31:16.000000000 +0000
+++ binutils.new/ld/testsuite/ld-elfvers/vers16.dsym 2021-12-09 09:05:03.730791511 +0000
@@ -1,2 +1,2 @@
[0-9a-f]+ g +DF (\.text|\.opd|\*ABS\*) [0-9a-f]+( +Base +)? (0x[0-9a-f]+ )?_?show_bar
-[0-9a-f]+ +DF \*UND\* [0-9a-f]+ +(0x[0-9a-f]+ )?_?show_foo
+[0-9a-f]+ +DF \*UND\* [0-9a-f]+ +Base +(0x[0-9a-f]+ )?_?show_foo
diff -rup binutils-2.30/ld/testsuite/ld-elfvers/vers6.dsym binutils.new/ld/testsuite/ld-elfvers/vers6.dsym
--- binutils-2.30/ld/testsuite/ld-elfvers/vers6.dsym 2018-01-13 13:31:16.000000000 +0000
+++ binutils.new/ld/testsuite/ld-elfvers/vers6.dsym 2021-12-09 09:04:45.778917378 +0000
@@ -1,4 +1,4 @@
-[0-9a-f]+ +DF \*UND\* [0-9a-f]+ +(0x[0-9a-f]+ )?_?show_foo
+[0-9a-f]+ +DF \*UND\* [0-9a-f]+ +Base +(0x[0-9a-f]+ )?_?show_foo
[0-9a-f]+ +DF \*UND\* [0-9a-f]+ +VERS_2.0 +(0x[0-9a-f]+ )?_?show_foo
[0-9a-f]+ +DF \*UND\* [0-9a-f]+ +VERS_1.2 +(0x[0-9a-f]+ )?_?show_foo
[0-9a-f]+ +DF \*UND\* [0-9a-f]+ +VERS_1.1 +(0x[0-9a-f]+ )?_?show_foo

View File

@ -0,0 +1,12 @@
--- binutils.orig/bfd/elflink.c 2022-03-07 14:59:10.275856785 +0000
+++ binutils-2.30/bfd/elflink.c 2022-03-07 15:00:19.129562705 +0000
@@ -4578,7 +4578,8 @@ error_free_dyn:
|| h->root.type == bfd_link_hash_warning)
h = (struct elf_link_hash_entry *) h->root.u.i.link;
- if (elf_tdata (abfd)->verdef != NULL
+ if (h->versioned != unversioned
+ && elf_tdata (abfd)->verdef != NULL
&& vernum > 1
&& definition)
h->verinfo.verdef = &elf_tdata (abfd)->verdef[vernum - 1];

View File

@ -0,0 +1,116 @@
--- binutils.orig/gas/config/tc-i386.c 2020-08-21 10:21:00.595678097 +0100
+++ binutils-2.30/gas/config/tc-i386.c 2020-08-21 10:22:15.009449340 +0100
@@ -8035,7 +8035,8 @@ output_disp (fragS *insn_start_frag, off
int size = disp_size (n);
offsetT val = i.op[n].disps->X_add_number;
- val = offset_in_range (val >> i.memshift, size);
+ val = offset_in_range (val >> (size == 1 ? i.memshift : 0),
+ size);
p = frag_more (size);
md_number_to_chars (p, val, size);
}
--- binutils.orig/gas/testsuite/gas/i386/i386.exp 2020-08-21 10:21:00.669677873 +0100
+++ binutils-2.30/gas/testsuite/gas/i386/i386.exp 2020-08-21 10:39:22.921167674 +0100
@@ -216,6 +216,7 @@ if [expr ([istarget "i*86-*-*"] || [ist
run_dump_test "evex-lig512-intel"
run_dump_test "evex-wig1"
run_dump_test "evex-wig1-intel"
+ run_dump_test "evex-no-scale-32"
run_dump_test "sse2avx"
run_list_test "inval-avx" "-al"
run_list_test "inval-avx512f" "-al"
@@ -692,6 +693,7 @@ if [expr ([istarget "i*86-*-*"] || [ista
run_dump_test "x86-64-avx256int-intel"
run_dump_test "x86-64-avx2"
run_dump_test "x86-64-avx2-intel"
+ run_dump_test "evex-no-scale-64"
run_dump_test "x86-64-avx-gather"
run_dump_test "x86-64-avx-gather-intel"
run_dump_test "x86-64-avx512f"
--- /dev/null 2020-08-21 07:54:54.335936348 +0100
+++ binutils-2.30/gas/testsuite/gas/i386/evex-no-scale.s 2020-08-21 10:41:30.411757740 +0100
@@ -0,0 +1,18 @@
+ .allow_index_reg
+ .struct
+ inc %eax
+.equiv is_64bit, . > 1
+
+ .text
+disp:
+.if is_64bit
+ vmovaps -1024(%rip), %zmm0
+ vmovaps 64(,%rax), %zmm0
+ vmovaps 64(,%riz), %zmm0
+.endif
+ vmovaps 64(,%eax), %zmm0
+ vmovaps 64(,%eiz), %zmm0
+ vmovaps 64, %zmm0
+.if !is_64bit
+ addr16 vmovaps 64, %zmm0
+.endif
--- /dev/null 2020-08-21 07:54:54.335936348 +0100
+++ binutils-2.30/gas/testsuite/gas/i386/evex-no-scale-32.d 2020-08-21 10:41:37.347735430 +0100
@@ -0,0 +1,14 @@
+#source: evex-no-scale.s
+#objdump: -dw
+#name: ix86 EVEX no disp scaling
+
+.*: +file format .*
+
+Disassembly of section .text:
+
+0+ <disp>:
+ +[a-f0-9]+: 62 f1 7c 48 28 04 05 40 00 00 00 vmovaps 0x40\(,%eax,1\),%zmm0
+ +[a-f0-9]+: 62 f1 7c 48 28 04 25 40 00 00 00 vmovaps 0x40\(,%eiz,1\),%zmm0
+ +[a-f0-9]+: 62 f1 7c 48 28 05 40 00 00 00 vmovaps 0x40,%zmm0
+ +[a-f0-9]+: 67 62 f1 7c 48 28 06 40 00 vmovaps 0x40,%zmm0
+#pass
--- /dev/null 2020-08-21 07:54:54.335936348 +0100
+++ binutils-2.30/gas/testsuite/gas/i386/evex-no-scale-64.d 2020-08-21 10:41:42.539718727 +0100
@@ -0,0 +1,16 @@
+#source: evex-no-scale.s
+#objdump: -dw
+#name: x86-64 EVEX no disp scaling
+
+.*: +file format .*
+
+Disassembly of section .text:
+
+0+ <disp>:
+ +[a-f0-9]+: 62 f1 7c 48 28 05 00 fc ff ff vmovaps -0x400\(%rip\),%zmm0 # .*
+ +[a-f0-9]+: 62 f1 7c 48 28 04 05 40 00 00 00 vmovaps 0x40\(,%rax,1\),%zmm0
+ +[a-f0-9]+: 62 f1 7c 48 28 04 25 40 00 00 00 vmovaps 0x40,%zmm0
+ +[a-f0-9]+: 67 62 f1 7c 48 28 04 05 40 00 00 00 vmovaps 0x40\(,%eax,1\),%zmm0
+ +[a-f0-9]+: 67 62 f1 7c 48 28 04 25 40 00 00 00 vmovaps 0x40\(,%eiz,1\),%zmm0
+ +[a-f0-9]+: 62 f1 7c 48 28 04 25 40 00 00 00 vmovaps 0x40,%zmm0
+#pass
--- binutils.orig/gas/testsuite/gas/i386/evex-no-scale.s 2020-08-21 12:48:57.859030235 +0100
+++ binutils-2.30/gas/testsuite/gas/i386/evex-no-scale.s 2020-08-21 12:53:26.631149341 +0100
@@ -5,7 +5,7 @@
.text
disp:
-.if is_64bit
+.ifdef x86_64
vmovaps -1024(%rip), %zmm0
vmovaps 64(,%rax), %zmm0
vmovaps 64(,%riz), %zmm0
@@ -13,6 +13,6 @@ disp:
vmovaps 64(,%eax), %zmm0
vmovaps 64(,%eiz), %zmm0
vmovaps 64, %zmm0
-.if !is_64bit
+.ifndef x86_64
addr16 vmovaps 64, %zmm0
.endif
--- binutils.orig/gas/testsuite/gas/i386/evex-no-scale-64.d 2020-08-21 12:48:57.860030232 +0100
+++ binutils-2.30/gas/testsuite/gas/i386/evex-no-scale-64.d 2020-08-21 13:20:59.174525430 +0100
@@ -11,6 +11,6 @@ Disassembly of section .text:
+[a-f0-9]+: 62 f1 7c 48 28 04 05 40 00 00 00 vmovaps 0x40\(,%rax,1\),%zmm0
+[a-f0-9]+: 62 f1 7c 48 28 04 25 40 00 00 00 vmovaps 0x40,%zmm0
+[a-f0-9]+: 67 62 f1 7c 48 28 04 05 40 00 00 00 vmovaps 0x40\(,%eax,1\),%zmm0
- +[a-f0-9]+: 67 62 f1 7c 48 28 04 25 40 00 00 00 vmovaps 0x40\(,%eiz,1\),%zmm0
+ +[a-f0-9]+: 67 62 f1 7c 48 28 04 25 40 00 00 00 addr32 vmovaps 0x40,%zmm0
+[a-f0-9]+: 62 f1 7c 48 28 04 25 40 00 00 00 vmovaps 0x40,%zmm0
#pass

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -1,33 +1,101 @@
# Binutils SPEC file. Can be invoked with the following parameters:
# Determine if this is a native build or a cross build.
#
# For a cross build add --define "binutils_target <target>" to the command
# line when building the rpms.
#
# For example:
# --define "binutils_target aarch64-linux-gnu"
#
# Cross builds will create a set of binutils executables that will run on the
# host machine but which will create binaries suitable for running on the
# target machine. The cross tools will have the target name as a prefix,
# but for compatibility with the kernel the rpms will use the target name
# as an infix. So for example building with the above define will create a
# set of rpms like this:
#
# binutils-aarch64-linux-gnu-2.35.1-14.fc34.x86_64.rpm
# binutils-aarch64-linux-gnu-debuginfo-2.35.1-14.fc34.x86_64.rpm
# [etc]
#
# and the rpms will contain files like:
#
# /usr/bin/aarch64-linux-gnu-addr2line
# /usr/bin/aarch64-linux-gnu-ar
# /usr/bin/aarch64-linux-gnu-as
# [etc]
%if 0%{!?binutils_target:1}
%define binutils_target %{_target_platform}
%define isnative 1
%define enable_shared 1
%else
%define cross %{binutils_target}-
%define name_cross -%{binutils_target}
%define isnative 0
%define enable_shared 0
%endif
Summary: A GNU collection of binary utilities
Name: binutils%{?name_cross}%{?_with_debug:-debug}
Version: 2.30
Release: 123%{?dist}
License: GPLv3+
URL: https://sourceware.org/binutils
#----------------------------------------------------------------------------
# Binutils SPEC file. Can be invoked with the following parameters to change
# the default behaviour:
# --define "binutils_target arm-linux-gnu" to create arm-linux-gnu-binutils.
# --with=bootstrap: Build with minimal dependencies.
# --with=debug: Build without optimizations and without splitting the debuginfo.
# --without=docs: Skip building documentation.
# --without=testsuite: Do not run the testsuite. Default is to run it.
# --with=testsuite: Run the testsuite. Default when --with=debug is not to run it.
#
# --with bootstrap Build with minimal dependencies.
# --with debug Build without optimizations and without splitting
# the debuginfo into a separate file.
# --without docs Skip building documentation.
# Default is with docs, except when building a cross binutils.
# --without testsuite Do not run the testsuite. Default is to run it.
# --without gold Disable building of the GOLD linker.
# --with clang To force building with the CLANG.
# --without debuginfod Disable support for debuginfod.
#---Start of Configure Options-----------------------------------------------
# Do not create deterministic archives by default (cf: BZ 1195883)
# Create deterministic archives (ie ones without timestamps).
# Default is off because of BZ 1195883.
%define enable_deterministic_archives 0
# Enable support for GCC LTO compilation.
# Disable if it is necessary to work around bugs in LTO.
%define enable_lto 1
# Disable the default generation of compressed debug sections.
# Enable the compression of debug sections as default behaviour of the
# assembler and linker. This option is disabled for now. The assembler and
# linker have command line options to override the default behaviour.
%define default_compress_debug 0
# Default to read-only-relocations (relro) in shared binaries.
# This is enabled as a security feature.
%define default_relro 1
# Disable the default generation of GNU Build notes by the assembler.
# This has turned out to be problematic for the i686 architecture.
# although the exact reason has not been determined. (See BZ 1572485)
# It also breaks building EFI binaries on AArch64, as these cannot have
# relocations against absolute symbols.
# Enable the default generation of GNU Build notes by the assembler.
# This option is disabled as it has turned out to be problematic for the i686
# architecture, although the exact reason has not been determined. (See
# BZ 1572485). It also breaks building EFI binaries on AArch64, as these
# cannot have relocations against absolute symbols.
%define default_generate_notes 0
# Enable thread support in the GOLD linker (if it is being built). This is
# particularly important if plugins to the linker intend to use threads
# themselves. See BZ 1636479 for more details. This option is made
# configurable in case there is ever a need to disable thread support.
%define enable_threading 1
#----End of Configure Options------------------------------------------------
# Default: Not bootstrapping.
@ -38,6 +106,8 @@
%bcond_without docs
# Default: Always run the testsuite.
%bcond_without testsuite
# Default: Build the gold linker.
%bcond_without gold
%if %{with bootstrap}
%undefine with_docs
@ -48,31 +118,18 @@
%undefine with_testsuite
%endif
%if 0%{!?binutils_target:1}
%define binutils_target %{_target_platform}
%define isnative 1
%define enable_shared 1
%else
%define cross %{binutils_target}-
%define isnative 0
%define enable_shared 0
%endif
# BZ 1924068. Since applications that use the BFD library are
# required to link against the static version, ensure that it retains
# its debug informnation.
%undefine __brp_strip_static_archive
#----------------------------------------------------------------------------
Summary: A GNU collection of binary utilities
Name: %{?cross}binutils%{?_with_debug:-debug}
Version: 2.30
Release: 57%{?dist}
License: GPLv3+
URL: https://sourceware.org/binutils
# Note - the Linux Kernel binutils releases are too unstable and contain
# too many controversial patches so we stick with the official FSF version
# instead.
Source: https://ftp.gnu.org/gnu/binutils/binutils-%{version}.tar.xz
Source2: binutils-2.19.50.0.1-output-format.sed
%if %{with docs}
@ -120,7 +177,6 @@ Patch03: binutils-2.22.52.0.1-export-demangle.h.patch
# order.
Patch04: binutils-2.22.52.0.4-no-config-h-check.patch
# Purpose: Import H.J.Lu's Kernel LTO patch.
# Lifetime: Permanent, but needs continual updating.
# FIXME: Try removing....
Patch05: binutils-2.26-lto.patch
@ -374,11 +430,224 @@ Patch55: binutils-x86-IBT-and-missing-notes.patch
# Lifetime: Fixed in 2.32
Patch56: binutils-AArch64-gold.patch
# Purpose: Stop the BFD library from complaining about files with multiple
# relocations against the same section. Allows examination of
# special kernel modules.
# Lifetime: Fixed in 2.33
Patch57: binutils-multiple-relocs-for-same-section.patch
# Purpose: Stop the linker from merging groups which have different settings
# of the SHF_EXCLUDE flag.
# Lifetime: Fixed in 2.33
Patch58: binutils-do-not-merge-differing-SHF_EXCLUDE-groups.patch
# Purpose: Add support for the SVE variant PCS in AArch64.
# Lifetime: Fixed in 2.33
Patch59: binutils-aarch64-STO_AARCH64_VARIANT_PCS.patch
# Purpose: Add fixes and markers for Coverity test failures.
# Lifetime: Permanent.
Patch60: binutils-coverity-fixes.patch
# Purpose: Improve objcopy's merging of GNU build attribute notes.
# Lifetime: Fixed in 2.33
Patch61: binutils-improved-note-merging.patch
# Purpose: Add check to readelf in order to prevent an integer overflow.
# Lifetime: Fixed in 2.33
Patch62: binutils-CVE-2019-14444.patch
# Purpose: Fix a seg-fault in gold when linking corrupt input files.
# Lifetime: Fixed in 2.34 (maybe)
Patch63: binutils-CVE-2019-1010204.patch
# Purpose: Add a feature to the x86/64 assembler to create
# workarounds for the Intel Jcc Erratum.
# Lifetime: Fixed in 2.34
Patch64: binutils-x86_JCC_Erratum.patch
# Purpose: Fix a potential seg-fault in the BFD library when parsing
# pathalogical debug_info sections.
# Lifetime: Fixed in 2.34
Patch65: binutils-CVE-2019-17451.patch
# Purpose: Fix a memory exhaustion bug in the BFD library when parsing
# corrupt DWARF debug information.
# Lifetime: Fixed in 2.34
Patch66: binutils-CVE-2019-17450.patch
# Purpose: Allow the BFD library to handle the copying of files which
# contain secondary reloc sections.
# Lifetime: Fixed in 2.35
Patch67: binutils-copy-multiple-relocs.patch
# Purpose: Stop the BFD library from issueing warning messages about allocated
# sections being found outside of loadable segments, if they are
# found inside debuginfo files.
# Lifetime: Fixed in 2.33
Patch68: binutils-do-not-warn-about-debuginfo-files.patch
# Purpose: Fix failures in the linker testsuite for the s390-linux target.
# Lifetime: Fixed in 2.33
Patch69: binutils-s390-ld-test-fixes.patch
# Purpose: Fix failures in the linker testsuite for the s390-linux target.
# Lifetime: Fixed in 2.33
Patch70: binutils-aarch64-ld-test-fixes.patch
# Purpose: Fix building the binutils with address sanitization enabled.
# Lifetime: Fixed in 2.33
Patch71: binutils-sanitize-uses-dlsym.patch
# Purpose: Fix building the binutils with address sanitization enabled.
# Lifetime: Fixed in 2.33
Patch72: binutils-PT_GNU_PROPERTY-segment.patch
# Purpose: Stop gold from aborting when input sections with the same name
# have different flags.
# Lifetime: 2.33 (probably)
Patch73: binutils-gold-mismatched-section-flags.patch
# Purpose: Stop objcopy's --set-section-flag option from accepting the
# 'shared' flag on non-COFF binaries.
# Lifetime: Fixed in 2.34
Patch74: binutils-objcopy-set-section-flags-shared.patch
# Purpose: Prevent the s/390 linker from rewriting the GOT access
# for certain symbols.
# Lifetime: Fixed in 2.32
Patch75: binutils-s390x-prevent-GOT-rewrite.patch
# Purpose: Have the s/390 assembler include alignment hints in vector
# instructions.
# Lifetime: Fixed in 2.35
Patch76: binutils-s390-alignment-hints.patch
# Purpose: Fix the x86 assembler so that it does not scale non-8-bit
# displacements.
# Lifetime: Fixed in 2.32
Patch77: binutils-x86-gas-scaled-8-bit-displacements.patch
# Purpose: Allow plugin syms to mark as-needed shared libs needed.
# Lifetime: Fixed in 2.36
Patch78: binutils-plugin-as-needed.patch
# Purpose: Fix merging attributes in the presence of multiple
# same-named sections.
# Lifetime: Fixed in 2.36
Patch79: binutils-strip-merge.patch
# Purpose: Properly override IR definitions
# Lifetime: Fixed in 2.35
Patch80: binutils-ld-IR-override.patch
# Purpose: Add support for Intel's TPAUSE and UNWAIT instructions.
# Lifetime: Fixed in 2.31
Patch81: binutils-x86-tpause.patch
# Purpose: Add support for AArch64 GNU Property notes
# Lifetime: Fixed in 2.34
Patch82: binutils-aarch64-properties.patch
# Purpose: Fix the version selected when merging common symbols
# and normal symbols.
# Lifetime: Fixed in 2.36
Patch83: binutils-common-sym-versioning.patch
# Purpose: Fix merging empty ppc64le notes.
# Lifetime: Fixed in 2.37
Patch84: binutils-ppc64le-note-merge.patch
# Purpose: Another fix for weak symbol handling with LTO.
# Lifetime: Fixed in 2.36
Patch85: binutils-plugin-as-needed-2.patch
# Purpose: Fix a potential vulnerability involing symlink overwriting.
# Lifetime: Fixed in 2.37
Patch86: binutils-CVE-2021-20197.patch
# Purpose: Fix copy relocs that refer to weak aliases
# Lifetime: Fixed in 2.35
Patch87: binutils-mark-all-weak-aliases.patch
# Purpose: Fix excessive memory consumption when attempting to parse corrupt
# DWARF debug information.
# Lifetime: Fixed in 2.36
Patch88: binutils-CVE-2021-3487.patch
# Purpose: Fix illegal memory access when parsing corrupt ELF files.
# Lifetime: Fixed in 2.36
Patch89: binutils-CVE-2020-35448.patch
# Purpose: Fixed heap-based buffer overflow in _bfd_elf_slurp_secondary_reloc_section.
# Lifetime: Fixed in 2.36
Patch90: binutils-CVE-2021-20284.patch
# Purpose: Fixed the handling of relocations against discarded sections.
# Lifetime: Fixed in 2.34
Patch91: binutils-clearing-discarded-relocs.patch
# Purpose: Fix the GOLD linker's generation of .note.gnu.property sections for x86.
# Lifetime: Fixed in 2.37 (maybe)
Patch92: binutils-gold-i386-gnu-property-notes.patch
# Purpose: Fix problems with the binutils-plugin-as-needed.patch
# Lifetime: Fixed in 2.37
Patch93: binutils-plugin-as-needed-correct.patch
# Purpose: Add support for the arch14 extensions to the s390x architecture.
# Lifetime: Fixed in 2.37
Patch94: binutils-s390x-arch14.patch
# Purpose: Add options to control the display of multibyte characters. CVE 2021-42574
# Lifetime: Fixed in 2.38 (maybe)
Patch95: binutils.unicode.patch
# Purpose: Make undefined unversioned dynamic symbols global rather than local.
# Lifetime: Fixed in 2.37
Patch96: binutils-undefined-unversioned-symbols.patch
# Purpose: When searching for plugins, do not complain if incompatible ones are found.
# Lifetime: Fixed in 2.35
Patch97: binutils-plugin-error.patch
# Purpose: Don't set version info on unversioned symbols.
# Lifetime: Fixed in 2.37
Patch98: binutils-verdef.patch
# Purpose: Allow the AArch64 RNG extension to be used, and do not require v8.5 support.
# Lifetime: Fixed in 2.39
Patch99: binutils-aarch64-rng.patch
# Purpose: Allow z16 to be used as an alias for the arch14 extenstions to the s390 architecture.
# Lifetime: Fixed in 2.39
Patch100: binutils-s390-z16.patch
# Purpose: Fix a potential buffer overrun in the BFD library.
# Lifetime: Fixed in 2.35
Patch101: binutils-coffgen-buffer-overrun.patch
# Purpose: Fix where the BFD library automatically searches for plugins.
# Lifetime: Fixed in 2.35
Patch102: binutils-plugin-search.patch
# Purpose: Fix an illegal memory access when parsing an elf file containing corrupt symbol version information
# Lifetime: 2.39
Patch103: binutils-memory-access-when-parsing-an-elf-file.patch
# Purpose: Add support for DWARF-5 offset tables.
# Lifetime: 2.40
Patch104: binutils-DW_FORM_strx.patch
#----------------------------------------------------------------------------
Provides: bundled(libiberty)
BuildRequires: autoconf automake
%if %{with gold}
%define gold_arches %{ix86} x86_64 %{arm} aarch64 %{power64} s390x
%else
%define gold_arches none
%endif
%if %{with bootstrap}
%define build_gold no
@ -494,6 +763,14 @@ dynamic libraries.
Developers starting new projects are strongly encouraged to consider
using libelf instead of BFD.
# BZ 1924068. Since applications that use the BFD library are
# required to link against the static version, ensure that it retains
# its debug informnation.
# FIXME: Yes - this is being done twice. I have no idea why this
# second invocation is necessary but if both are not present the
# static archives will be stripped.
%undefine __brp_strip_static_archive
#----------------------------------------------------------------------------
%prep
@ -554,6 +831,54 @@ using libelf instead of BFD.
%patch54 -p1
%patch55 -p1
%patch56 -p1
%patch57 -p1
%patch58 -p1
%patch59 -p1
%patch60 -p1
%patch61 -p1
%patch62 -p1
%patch63 -p1
%patch64 -p1
%patch65 -p1
%patch66 -p1
%patch67 -p1
%patch68 -p1
%patch69 -p1
%patch70 -p1
%patch71 -p1
%patch72 -p1
%patch73 -p1
%patch74 -p1
%patch75 -p1
%patch76 -p1
%patch77 -p1
%patch78 -p1
%patch79 -p1
%patch80 -p1
%patch81 -p1
%patch82 -p1
%patch83 -p1
%patch84 -p1
%patch85 -p1
%patch86 -p1
%patch87 -p1
%patch88 -p1
%patch89 -p1
%patch90 -p1
%patch91 -p1
%patch92 -p1
%patch93 -p1
%patch94 -p1
%patch95 -p1
%patch96 -p1
%patch97 -p1
%patch98 -p1
%patch99 -p1
%patch100 -p1
%patch101 -p1
%patch102 -p1
%patch103 -p1
%patch104 -p1
# We cannot run autotools as there is an exact requirement of autoconf-2.59.
# FIXME - this is no longer true. Maybe try reinstating autotool use ?
@ -634,9 +959,20 @@ case %{binutils_target} in ppc64le*)
;;
esac
case %{binutils_target} in x86_64*|i?86*|arm*|aarch64*)
CARGS="$CARGS --enable-targets=x86_64-pep"
;;
# BZ 1920373: Enable PEP support for all targets as the PERF package's
# testsuite expects to be able to read PE format files ragrdless of
# the host's architecture.
case %{binutils_target} in
s390*)
# FIXME: For some unknown reason settting --enable-targets=x86_64-pep
# here breaks the building of GOLD. I have no idea why, and not enough
# knowledge of how gold is configured to fix quickly. So instead I have
# found that supporting "all" targets works.
CARGS="$CARGS --enable-targets=all"
;;
*)
CARGS="$CARGS --enable-targets=x86_64-pep"
;;
esac
%if %{default_relro}
@ -695,6 +1031,11 @@ export LDFLAGS=$RPM_LD_FLAGS
--enable-generate-build-notes=yes \
%else
--enable-generate-build-notes=no \
%endif
%if %{enable_threading}
--enable-threads=yes \
%else
--enable-threads=no \
%endif
$CARGS \
--enable-plugins \
@ -836,14 +1177,16 @@ $OUTPUT_FORMAT
INPUT ( %{_libdir}/libopcodes.a -lbfd )
EOH
%else # !isnative
%else
# For cross-binutils we drop the documentation.
rm -rf %{buildroot}%{_infodir}
# We keep these as one can have native + cross binutils of different versions.
#rm -rf {buildroot}{_prefix}/share/locale
#rm -rf {buildroot}{_mandir}
rm -rf %{buildroot}%{_libdir}/libiberty.a
%endif # !isnative
# Remove libtool files, which reference the .so libs
rm -f %{buildroot}%{_libdir}/lib{bfd,opcodes}.la
%endif
# This one comes from gcc
rm -f %{buildroot}%{_infodir}/dir
@ -880,7 +1223,7 @@ fi
if [ $1 = 0 ]; then
%{_sbindir}/alternatives --auto %{?cross}ld
fi
%endif # both ld.gold and ld.bfd
%endif
%if %{isnative}
/sbin/ldconfig
@ -891,8 +1234,8 @@ fi
/sbin/install-info --info-dir=%{_infodir} %{_infodir}/gprof.info.gz
/sbin/install-info --info-dir=%{_infodir} %{_infodir}/ld.info.gz
/sbin/install-info --info-dir=%{_infodir} %{_infodir}/standards.info.gz
%endif # with docs
%endif # isnative
%endif
%endif
exit 0
@ -904,7 +1247,7 @@ if [ $1 = 0 ]; then
%{_sbindir}/alternatives --remove %{?cross}ld %{_bindir}/%{?cross}ld.bfd
%{_sbindir}/alternatives --remove %{?cross}ld %{_bindir}/%{?cross}ld.gold
fi
%endif # both ld.gold and ld.bfd
%endif
%if %{isnative}
if [ $1 = 0 ]; then
@ -917,7 +1260,7 @@ if [ $1 = 0 ]; then
/sbin/install-info --quiet --delete --info-dir=%{_infodir} %{_infodir}/standards.info.gz
fi
fi
%endif # isnative
%endif
exit 0
@ -934,7 +1277,7 @@ exit 0
/sbin/install-info --delete --info-dir=%{_infodir} %{_infodir}/ld.info.gz
/sbin/install-info --quiet --delete --info-dir=%{_infodir} %{_infodir}/standards.info.gz
fi
%endif # isnative
%endif
#----------------------------------------------------------------------------
@ -948,29 +1291,32 @@ exit 0
%ghost %{_bindir}/%{?cross}ld
%else
%{_bindir}/%{?cross}ld*
%endif # both ld.gold and ld.bfd
%endif
%if %{with docs}
%{_mandir}/man1/*
%if %{isnative}
%{_infodir}/as.info.gz
%{_infodir}/binutils.info.gz
%{_infodir}/gprof.info.gz
%{_infodir}/ld.info.gz
%{_infodir}/standards.info.gz
%endif # with docs
%endif
%endif
%if %{enable_shared}
%{_libdir}/lib*.so
%exclude %{_libdir}/libbfd.so
%exclude %{_libdir}/libopcodes.so
%endif # enable_shared
%endif
%if %{isnative}
%if %{with docs}
%{_infodir}/[^b]*info*
%{_infodir}/binutils*info*
%endif # with docs
%{_infodir}/bfd*info*
%endif
%files devel
%{_prefix}/include/*
@ -978,14 +1324,215 @@ exit 0
%{_libdir}/libbfd.so
%{_libdir}/libopcodes.so
%if %{with docs}
%{_infodir}/bfd*info*
%endif # with docs
%endif # isnative
%endif
#----------------------------------------------------------------------------
%changelog
* Tue Jul 25 2023 Nick Clifton <nickc@redhat.com> - 2.30-123
- Extend support for DWARF-5 offset tables as generated by Clang++. (#2222697)
* Tue Jul 18 2023 Nick Clifton <nickc@redhat.com> - 2.30-122
- Add support for DWARF-5 offset tables as generated by Clang++. (#2222697)
* Fri Apr 28 2023 Yara Ahmad <yahmad@redhat.com> - 2.30-121
- Fix an illegal memory access when parsing an ELF file containing corrupt symbol version information. (#2164700)
* Mon Mar 20 2023 Nick Clifton <nickc@redhat.com> - 2.30-120
- Restore tests/ sub-directory and use correct sources. (#2178963)
* Mon Sep 05 2022 Nick Clifton <nickc@redhat.com> - 2.30-119
- NVR Bump in order to allow rebuild now that the rhel-8.8.0-candidate tag is available.
* Tue Aug 30 2022 Nick Clifton <nickc@redhat.com> - 2.30-118
- Fix where the BFD library searches for plugins. (#2119380)
* Mon Apr 25 2022 Nick Clifton <nickc@redhat.com> - 2.30-117
- Fix a potential buffer overrun in the BFD library's PE handling code. (#2076973)
* Mon Apr 11 2022 Nick Clifton <nickc@redhat.com> - 2.30-116
- Allow z16 to be used as an alias for the s390 architecture's arch14 extensions. (#2073384)
* Tue Apr 05 2022 Nick Clifton <nickc@redhat.com> - 2.30-115
- Add support for the AArch64 architecture's RNG extension. (#2056691)
* Mon Mar 07 2022 Nick Clifton <nickc@redhat.com> - 2.30-114
- Do not set version info on unversion symbols. (#2055179)
* Wed Jan 19 2022 Nick Clifton <nickc@redhat.com> - 2.30-113
- When searching for plugins, do not complain if incompatible ones are found. (#2039117)
* Thu Dec 09 2021 Nick Clifton <nickc@redhat.com> - 2.30-112
- Make undefined unversioned dynamic symbols global rather than local. (#2005176)
* Mon Oct 25 2021 Nick Clifton <nickc@redhat.com> - 2.30-111
- Add ability to control the display of unicode characters. (#2009173)
* Wed Sep 29 2021 Nick Clifton <nickc@redhat.com> - 2.30-110
- Add support for the arch14 extensions to the s390x architecture. (#1984819)
* Wed Sep 29 2021 Nick Clifton <nickc@redhat.com> - 2.30-109
- Fix problems introduced by the plugin-as-needed patch. (#2005412)
* Wed Jul 07 2021 Nick Clifton <nickc@redhat.com> - 2.30-108
- Fix thinko in previous delta. (#1970961)
* Wed Jun 23 2021 Nick Clifton <nickc@redhat.com> - 2.30-107
- Fix the GOLD linker's generation of .note.gnu.property sections for x86. (#1970961)
* Tue Jun 15 2021 Nick Clifton <nickc@redhat.com> - 2.30-105
- Fix the handling of relocations against discarded sections. (#1969775)
* Wed May 19 2021 Nick Clifton <nickc@redhat.com> - 2.30-104
- Fix heap-based buffer overflow in _bfd_elf_slurp_secondary_reloc_section. (#1961526)
* Tue May 04 2021 Nick Clifton <nickc@redhat.com> - 2.30-103
- Fix an illegal memory access when parsing a corrupt ELF file. (#1953659)
* Mon Apr 26 2021 Nick Clifton <nickc@redhat.com> - 2.30-102
- Bump NVR to allow rebuild against binutils-2.30-101.
* Wed Apr 14 2021 Nick Clifton <nickc@redhat.com> - 2.30-101
- Fix excessive memory consumption in the BFD librart when parsing corrupt DWARF information. (#1947134)
* Fri Apr 09 2021 Nick Clifton <nickc@redhat.com> - 2.30-100
- Do not strip the static BFD library. (For real this time). (#1924068)
- Remove support for ARM v8.6 ISA. (#1875912)
* Thu Mar 25 2021 Nick Clifton <nickc@redhat.com> - 2.30-99
- Fix bug in previous patch to enable support for ARM v8.6 ISA. (#1875912)
* Wed Mar 24 2021 Nick Clifton <nickc@redhat.com> - 2.30-98
- Do not strip the static BFD library. (#1924068)
* Tue Mar 23 2021 Nick Clifton <nickc@redhat.com> - 2.30-97
- Enable support for ARM v8.6 ISA. (#1875912)
* Fri Mar 19 2021 Nick Clifton <nickc@redhat.com> - 2.30-96
- Fix problems involving copy relocs that refer to weak aliases. (#1935785)
* Thu Mar 18 2021 Nick Clifton <nickc@redhat.com> - 2.30-95
- Fix CVE involivng overwriting symlinks. (#1920642)
* Thu Mar 18 2021 Nick Clifton <nickc@redhat.com> - 2.30-94
- Fix LTO and weak symbols again. (#1930988)
* Thu Feb 18 2021 Nick Clifton <nickc@redhat.com> - 2.30-93
- Fix merging ppc64le notes. (#1928936)
* Thu Feb 18 2021 Nick Clifton <nickc@redhat.com> - 2.30-92
- Fix merging ppc64le notes. (#1928936)
* Tue Feb 02 2021 Nick Clifton <nickc@redhat.com> - 2.30-91
- Enable PEP support for all targets. (#1920373)
* Mon Jan 11 2021 Nick Clifton <nickc@redhat.com> - 2.30-90
- NVR bump in order to regain access to gating test results.
* Wed Dec 09 2020 Nick Clifton <nickc@redhat.com> - 2.30-89
- Fix snafu preventing the building of the GOLD linekr.
* Wed Dec 09 2020 Nick Clifton <nickc@redhat.com> - 2.30-88
- Fix versioning when merging common and normal symbols. (#1904942)
- Add cross binutils support.
* Wed Nov 25 2020 Nick Clifton <nickc@redhat.com> - 2.30-87
- Fix bug in patch for AArch64 GNU Property notes support. (#1889643)
* Wed Nov 04 2020 Nick Clifton <nickc@redhat.com> - 2.30-86
- Add support for AArch64 GNU Property notes. (#1889643)
* Tue Nov 03 2020 Nick Clifton <nickc@redhat.com> - 2.30-85
- Add support for the TPAUSE and UNWAIT instructions in the x86 assembler. (#1893292)
* Mon Nov 02 2020 Nick Clifton <nickc@redhat.com> - 2.30-84
- Fix problem in linker testsuite triggered by the as-needed update. (#1886071)
* Fri Oct 30 2020 Nick Clifton <nickc@redhat.com> - 2.30-83
- Fix merging attributes in the presence of multiple same-named sections. (#1893197)
* Wed Oct 28 2020 Nick Clifton <nickc@redhat.com> - 2.30-82
- Fix problem in linker testsuite triggered by the as-needed update. (#1886071)
* Fri Oct 23 2020 Nick Clifton <nickc@redhat.com> - 2.30-81
- Allow plugin syms to mark as-needed shared libs needed. (#1886071)
* Wed Sep 16 2020 Nick Clifton <nickc@redhat.com> - 2.30-80
- NVR Bump to allow rebuild.
* Fri Aug 21 2020 Nick Clifton <nickc@redhat.com> - 2.30-79
- Fix x86 assembler's handling of non-8-bit displacements. (#1869401)
* Thu Aug 20 2020 Nick Clifton <nickc@redhat.com> - 2.30-77
- Add tests missing from PT_GNU_SEGMENT patch. (#1870039)
* Wed Jun 24 2020 Nick Clifton <nickc@redhat.com> - 2.30-76
- Have the s.390 assembler include alignment hints with vector instructions. (#1850490)
* Mon Jun 15 2020 Nick Clifton <nickc@redhat.com> - 2.30-75
- Prevent the s/390 linker from rewriting the GOT access for certain symbol types. (#1846972)
* Tue Apr 07 2020 Nick Clifton <nickc@redhat.com> - 2.30-74
- Stop the BFD library from issueing warning messages about allocated sections being found outside of loadable segments. (#1630115)
- Fix linker testsuite failures for the aarch64 and s390x targets. (#1632775, #1809101)
- Fix building the binutils with address sanitization enabled. (#1678323)
- Add support for the PT_GNU_PROPERTY segment. (#1721606)
- Fix an internal error in the GOLD linker. (#1722715)
- Fix the generation of corrupt .note.gnu.property notes. (#1723533)
- Stop objcopy's --set-section-flags option from setting the 'shared' flag on non-COFF binaries. (#1807308)
- Fix a bug in the secondary reloc processing code. (#1809186)
* Wed Feb 12 2020 Nick Clifton <nickc@redhat.com> - 2.30-73
- Remove bogus assertion. (#1801879)
* Wed Feb 12 2020 Nick Clifton <nickc@redhat.com> - 2.30-72
- Allow the BFD library to handle the copying of files containing secondary reloc sections. (#1801879)
* Tue Dec 03 2019 Nick Clifton <nickc@redhat.com> - 2.30-71
- Fix a potential seg-fault in the BFD library when parsing pathalogical debug_info sections. (#1779245)
- Fix a potential memory exhaustion in the BFD library when parsing corrupt DWARF debug information.
* Mon Dec 02 2019 Nick Clifton <nickc@redhat.com> - 2.30-70
- Re-enable strip merging build notes. (#1777760)
* Mon Dec 02 2019 Nick Clifton <nickc@redhat.com> - 2.30-69
- Fix linker testsuite failures triggered by annobin update.
* Thu Nov 28 2019 Nick Clifton <nickc@redhat.com> - 2.30-68
- Backport H.J.Lu's patch to add a workaround for the JCC Errata to the assembler. (#1777002)
* Thu Nov 21 2019 Nick Clifton <nickc@redhat.com> - 2.30-67
- Fix a buffer overrun in the note merging code. (#1774507)
* Fri Nov 08 2019 Nick Clifton <nickc@redhat.com> 2.30-66
- Fix a seg-fault in gold when linking corrupt input files. (#1739254)
* Thu Nov 07 2019 Nick Clifton <nickc@redhat.com> 2.30-65
- NVR bump to allow rebuild with reverted version of glibc in the buildroot.
* Wed Nov 06 2019 Nick Clifton <nickc@redhat.com> 2.30-64
- Stop note merging with no effect from creating null filled note sections.
* Wed Nov 06 2019 Nick Clifton <nickc@redhat.com> 2.30-63
- Stop objcopy from generating a exit failure status when merging corrupt notes.
* Fri Nov 01 2019 Nick Clifton <nickc@redhat.com> 2.30-62
- Fix binutils testsuite failure introduced by -60 patch. (#1767711)
* Tue Oct 29 2019 Nick Clifton <nickc@redhat.com> 2.30-61
- Enable threading in the GOLD linker. (#1729225)
- Add check to readelf in order to prevent an integer overflow.
* Mon Oct 28 2019 Nick Clifton <nickc@redhat.com> 2.30-60
- Add support for SVE Vector PCS on AArch64. (#1726637)
- Add fixes for coverity test failures.
- Improve objcopy's ability to merge GNU build attribute notes.
* Mon Oct 28 2019 Nick Clifton <nickc@redhat.com> 2.30-59
- Stop the linker from merging groups with different settings of the SHF_EXCLUDE flag. (#1730906)
* Fri Sep 13 2019 Nick Clifton <nickc@redhat.com> 2.30-58
- Stop the BFD library from complaining about sections with multiple sets of relocations. (#1749084)
* Mon May 20 2019 Nick Clifton <nickc@redhat.com> - 2.30-57
- Fix a thinko in the new gas tests for the s390x arch13 extension. (#1710860)