Compare commits

...

4 Commits

Author SHA1 Message Date
eabdullin b112c30317 import UBI binutils-2.30-123.el8 2023-11-14 20:07:08 +00:00
eabdullin 32124c5994 import UBI binutils-2.30-119.el8_8.2 2023-11-01 18:08:39 +00:00
CentOS Sources 14fe4b0c0f import binutils-2.30-119.el8 2023-05-17 01:09:46 +00:00
CentOS Sources 6f632041eb import binutils-2.30-117.el8 2022-11-08 11:46:37 +00:00
8 changed files with 1422 additions and 1 deletions

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

View File

@ -43,7 +43,7 @@
Summary: A GNU collection of binary utilities
Name: binutils%{?name_cross}%{?_with_debug:-debug}
Version: 2.30
Release: 113%{?dist}
Release: 123%{?dist}
License: GPLv3+
URL: https://sourceware.org/binutils
@ -611,6 +611,33 @@ Patch96: binutils-undefined-unversioned-symbols.patch
# 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)
@ -845,6 +872,13 @@ using libelf instead of BFD.
%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 ?
@ -1294,6 +1328,36 @@ 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)