Compare commits

...

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

17 changed files with 5200 additions and 1 deletions

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;

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,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;

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,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,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,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,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,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,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];

File diff suppressed because it is too large Load Diff

View File

@ -43,7 +43,7 @@
Summary: A GNU collection of binary utilities
Name: binutils%{?name_cross}%{?_with_debug:-debug}
Version: 2.30
Release: 101%{?dist}
Release: 123%{?dist}
License: GPLv3+
URL: https://sourceware.org/binutils
@ -575,6 +575,69 @@ Patch87: binutils-mark-all-weak-aliases.patch
# 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)
@ -800,6 +863,22 @@ using libelf instead of BFD.
%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 ?
@ -1249,6 +1328,69 @@ exit 0
#----------------------------------------------------------------------------
%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)