Compare commits

...

37 Commits
master ... f33

Author SHA1 Message Date
Nick Clifton 4e164f3ceb Fix an illegal memory access when parsing a corrupt ELF file.
Resolves: #1950481
2021-04-19 11:24:45 +01:00
Nick Clifton 56d95751ec Fix excessive memory consumption parsing corrupt DWARF information.
Resolves: #1947969
2021-04-09 17:40:36 +01:00
Nick Clifton 419f9fff4a Fix an illegal memory access when using readelf to examine a corrupt file.
Resolves: #1943534
2021-03-26 13:40:49 +00:00
Nick Clifton b6ef461052 Update the GOLD linker to handle x86 .note.gnu.property sections.
Resolves: #1916925
2021-01-18 15:48:42 +00:00
Nick Clifton a3451687e1 Fix strip when merging multiple same-named sections.
Resolves: #1885607
2021-01-14 16:57:05 +00:00
Nick Clifton e4e1fcf172 Fix bug running readelf on an empty file. (#1903448)
Fix bug running readelf on a file that cannot be read.  (#1913589)
2021-01-08 17:47:26 +00:00
Nick Clifton 9030781630 Add DWARF5 fixes from 2_35-branch. 2020-11-27 16:32:09 +00:00
Nick Clifton 850ad561ca Add missing patch 2020-10-30 10:51:58 +00:00
Nick Clifton 5ab4346626 Correction for plugin as-needed patch.
Related: #1889763
2020-10-30 10:50:20 +00:00
Nick Clifton 5305d155cb Allow plugin syms to mark as-needed shared libs needed. 2020-10-09 13:25:26 +01:00
Jeff Law 7bb2daa612 Re-enable LTO 2020-07-31 18:39:00 -06:00
Jeff Law e315473f6c Disable LTO for bootstrapping purposes 2020-07-31 15:25:01 -06:00
Nick Clifton b22933e83e Fix building with LTO enabled. 2020-07-31 14:35:26 +01:00
Nick Clifton 93bf869662 Set the sh_entsize field of the AArch64's PLT section to 0. (PR 26312) 2020-07-31 08:13:17 +01:00
Richard W.M. Jones 6442193bff Disable LTO again, it causes "ar" to segfault. 2020-07-30 22:31:29 +01:00
Nick Clifton 722dceebdb Fix assembler to default to DWARF level 3 2020-07-30 14:05:32 +01:00
Nick Clifton a8b0efde87 Default to DWARF level 4 in the assembler. 2020-07-30 09:29:21 +01:00
Nick Clifton 3eb4862ad3 Remove unneeded patches 2020-07-27 15:21:06 +01:00
Fedora Release Engineering 74b3ce8462 - Rebuilt for https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild
Signed-off-by: Fedora Release Engineering <releng@fedoraproject.org>
2020-07-27 13:08:28 +00:00
Jeff Law 0af851ae02 Disable LTO for now 2020-07-26 12:02:43 -06:00
Nick Clifton 15a78ff3d8 Rebase to GNU BInutils 2.35
Resolves: #1854613
2020-07-26 11:33:09 +01:00
Nick Clifton 5cfc5a91d2 Add gcc 10 build fixes 2020-07-24 19:57:15 +01:00
Nick Clifton 385f20222d Enable debuginfod support. 2020-07-24 19:56:24 +01:00
Jeff Law 426edf4a6e - Fix more configure tests compromised by LTO. 2020-07-20 13:58:21 -06:00
Jeff Law 32bf168f75 - Fix configure test compromised by LTO. Add appropriate BuildRequires
and force rebuliding the configure files in the appropriate dirs
- Fix various warnings exposed by LTO.
2020-07-19 11:35:06 -06:00
Nick Clifton d8ce39864a Switch to using %autosetup 2020-07-07 10:56:06 +01:00
Nick Clifton c548afa128 Add BPF support to the s390x target.
Resolves: #1825193
2020-06-16 20:38:14 +01:00
Nick Clifton 347bbd0dc5 Enhance the error message displayed by the BFD library when it fails to load a plugin.
Resolves: #1836618
2020-05-26 14:05:33 +01:00
Nick Clifton 72f99ab293 Rebase to tip of GNU Binutils 2.34 branch, brining in LTO fixes.
Retire: binutils-nm-lto-plugin.patch
2020-05-22 15:50:12 +01:00
Nick Clifton e8f39243b8 Fix seg fault when loading plugins via symlinks.
Resolves: #1828587
2020-04-28 15:33:47 +01:00
Nick Clifton d1aeab2109 readd sed script 2020-04-20 16:05:49 +01:00
Nick Clifton 07a3e80865 Add support for the BPF target.
Resolves: #1825193
2020-04-20 15:22:40 +01:00
Nick Clifton beb7b8e936 Fix the plugin support architecture to allow proper symbol info handling. (PR 25355) 2020-02-16 11:34:52 +00:00
Nick Clifton 657e3d5a3e Rebase to GNU Binutils 2.34. (#1793098)
Retire: binutils-improved-note-merging.patch
Retire: binutils-CVE-2019-17451.patch
Retire: binutils-CVE-2019-17450.patch
Retire: binutils-addr2line-fixes.patch
2020-02-02 14:55:39 +00:00
Fedora Release Engineering bf57373ec8 - Rebuilt for https://fedoraproject.org/wiki/Fedora_32_Mass_Rebuild
Signed-off-by: Fedora Release Engineering <releng@fedoraproject.org>
2020-01-28 12:59:08 +00:00
Nick Clifton dcf3d266fa Enable 64-bit BFD and PEP support for riscv. 2020-01-23 12:27:30 +00:00
Nick Clifton 7111265a8a Improve the accuracy of addr2line.
Resolves: #1760967
2020-01-02 17:26:12 +00:00
31 changed files with 8414 additions and 2789 deletions

83
.gitignore vendored
View File

@ -1,20 +1,67 @@
binutils-2.*/
i386
i686
x86_64
/binutils-*.tar.bz2
.build-*
*.src.rpm
*.log
HOWTO
build-sources
*.diff
*.patch
*.orig
*.rej
/binutils-2.29.tar.xz
/binutils-2.29.1.tar.xz
*~
.#*
*#
*.flt
*.gmo
*.info
*.la
*.lo
*.o
*.pyc
*.tmp
*.a
.deps
.libs
autom4te.cache
config.cache
config.h
config.intl
config.log
config.status
libtool
POTFILES
*-POTFILES
TAGS
TAGS.sub
.local.vimrc
.lvimrc
.clang-format
.gdbinit
.gdb_history
perf.data
perf.data.old
# ignore core files, but not java/net/protocol/core/
core
!core/
lost+found
# ignore ./contrib/gcc_update output
LAST_UPDATED
REVISION
stamp-*
*.stamp
# ignore in-tree prerequisites
/mpfr*
/mpc*
/gmp*
/isl*
/binutils-2.34.0-5dfc0c955dbe912cd328fc2688e5fceb3239ac2a.tar.xz
/binutils-2.19.50.0.1-output-format.sed
/binutils-2.30.tar.xz
/binutils-2.30.90.tar.xz
/binutils-2.31.1.tar.xz
/binutils-special-sections-in-groups.patch
/binutils-2.32.tar.xz
/binutils-2.33.1.tar.xz
/binutils-2.35.tar.xz

View File

@ -1,38 +0,0 @@
# Generate OUTPUT_FORMAT line for .so files from the system linker output.
# Imported from glibc/Makerules.
/ld.*[ ]-E[BL]/b f
/collect.*[ ]-E[BL]/b f
/OUTPUT_FORMAT[^)]*$/{N
s/\n[ ]*/ /
}
t o
: o
s/^.*OUTPUT_FORMAT(\([^,]*\), \1, \1).*$/OUTPUT_FORMAT(\1)/
t q
s/^.*OUTPUT_FORMAT(\([^,]*\), \([^,]*\), \([^,]*\)).*$/\1,\2,\3/
t s
s/^.*OUTPUT_FORMAT(\([^,)]*\).*$)/OUTPUT_FORMAT(\1)/
t q
d
: s
s/"//g
G
s/\n//
s/^\([^,]*\),\([^,]*\),\([^,]*\),B/OUTPUT_FORMAT(\2)/p
s/^\([^,]*\),\([^,]*\),\([^,]*\),L/OUTPUT_FORMAT(\3)/p
s/^\([^,]*\),\([^,]*\),\([^,]*\)/OUTPUT_FORMAT(\1)/p
/,/s|^|*** BUG in libc/scripts/output-format.sed *** |p
q
: q
s/"//g
p
q
: f
s/^.*[ ]-E\([BL]\)[ ].*$/,\1/
t h
s/^.*[ ]-E\([BL]\)$/,\1/
t h
d
: h
h

View File

@ -1,6 +1,6 @@
--- binutils.orig/binutils/readelf.c 2018-01-22 15:48:10.450701702 +0000
+++ binutils-2.30.0/binutils/readelf.c 2018-01-22 15:55:26.739588657 +0000
@@ -19019,75 +19019,85 @@ process_file (char * file_name)
--- binutils.orig/binutils/readelf.c 2020-07-24 14:55:25.163647522 +0100
+++ binutils-2.35/binutils/readelf.c 2020-07-24 15:02:39.613851369 +0100
@@ -20729,79 +20729,92 @@ process_file (char * file_name)
Filedata * filedata = NULL;
struct stat statbuf;
char armag[SARMAG];
@ -61,64 +61,85 @@
if (fread (armag, SARMAG, 1, filedata->handle) != 1)
{
- error (_("%s: Failed to read file's magic number\n"), file_name);
- fclose (filedata->handle);
+ error (_("Failed to read file's magic number\n"));
fclose (filedata->handle);
- free (filedata);
- return FALSE;
- }
-
- filedata->file_size = (bfd_size_type) statbuf.st_size;
-
- if (memcmp (armag, ARMAG, SARMAG) == 0)
- {
+ goto done;
}
filedata->file_size = (bfd_size_type) statbuf.st_size;
if (memcmp (armag, ARMAG, SARMAG) == 0)
{
- if (! process_archive (filedata, FALSE))
- ret = FALSE;
- }
- else if (memcmp (armag, ARMAGT, SARMAG) == 0)
- {
+ if (process_archive (filedata, FALSE))
+ ret = TRUE;
}
else if (memcmp (armag, ARMAGT, SARMAG) == 0)
{
- if ( ! process_archive (filedata, TRUE))
- ret = FALSE;
+ error (_("Failed to read file's magic number\n"));
+ if (process_archive (filedata, TRUE))
+ ret = TRUE;
}
else
{
- if (do_archive_index)
if (do_archive_index && !check_all)
- error (_("File %s is not an archive so its index cannot be displayed.\n"),
- file_name);
+ filedata->file_size = (bfd_size_type) statbuf.st_size;
+ error (_("Not an archive so its index cannot be displayed.\n"));
rewind (filedata->handle);
filedata->archive_file_size = filedata->archive_file_offset = 0;
- rewind (filedata->handle);
- archive_file_size = archive_file_offset = 0;
-
- if (! process_object (filedata))
- ret = FALSE;
+ if (memcmp (armag, ARMAG, SARMAG) == 0)
+ {
+ if (process_archive (filedata, FALSE))
+ ret = TRUE;
+ }
+ else if (memcmp (armag, ARMAGT, SARMAG) == 0)
+ {
+ if (process_archive (filedata, TRUE))
+ ret = TRUE;
+ }
+ else
+ {
+ if (do_archive_index)
+ error (_("Not an archive so its index cannot be displayed.\n"));
+
+ rewind (filedata->handle);
+ archive_file_size = archive_file_offset = 0;
+
+ if (process_object (filedata))
+ ret = TRUE;
+ }
+ if (process_object (filedata))
+ ret = TRUE;
}
fclose (filedata->handle);
- fclose (filedata->handle);
- free (filedata->section_headers);
- free (filedata->program_headers);
- free (filedata->string_table);
- free (filedata->dump.dump_sects);
- free (filedata);
+ done:
free (filedata);
+ if (filedata)
+ {
+ fclose (filedata->handle);
+ free (filedata->section_headers);
+ free (filedata->program_headers);
+ free (filedata->string_table);
+ free (filedata->dump.dump_sects);
+ free (filedata);
+ }
+ free (program_name);
+ program_name = saved_program_name;
return ret;
}
free (ba_cache.strtab);
ba_cache.strtab = NULL;
--- binutils.orig/binutils/readelf.c 2021-01-07 12:59:35.802994842 +0000
+++ binutils-2.35.1/binutils/readelf.c 2021-01-07 13:02:36.591754005 +0000
@@ -20818,7 +20818,8 @@ process_file (char * file_name)
done:
if (filedata)
{
- fclose (filedata->handle);
+ if (filedata->handle != NULL)
+ fclose (filedata->handle);
free (filedata->section_headers);
free (filedata->program_headers);
free (filedata->string_table);
--- binutils.orig/binutils/readelf.c 2021-01-08 17:01:23.573093204 +0000
+++ binutils-2.35.1/binutils/readelf.c 2021-01-08 17:02:23.095677242 +0000
@@ -20787,7 +20787,6 @@ process_file (char * file_name)
if (fread (armag, SARMAG, 1, filedata->handle) != 1)
{
error (_("Failed to read file's magic number\n"));
- fclose (filedata->handle);
goto done;
}

View File

@ -79,17 +79,6 @@ diff -rup binutils.orig/ld/testsuite/ld-x86-64/plt-main-bnd.dd binutils-2.29.1/l
+#...
[ ]*[a-f0-9]+: 90 nop
#pass
diff -rup binutils.orig/ld/testsuite/ld-x86-64/plt-main-ibt.dd binutils-2.29.1/ld/testsuite/ld-x86-64/plt-main-ibt.dd
--- binutils.orig/ld/testsuite/ld-x86-64/plt-main-ibt.dd 2017-11-15 13:32:39.412064336 +0000
+++ binutils-2.29.1/ld/testsuite/ld-x86-64/plt-main-ibt.dd 2017-11-15 15:06:35.148842897 +0000
@@ -1,7 +1,3 @@
#...
-Disassembly of section .plt.got:
-
-[a-f0-9]+ <[_a-z]+@plt>:
[ ]*[a-f0-9]+: f3 0f 1e fa endbr64
-[ ]*[a-f0-9]+: f2 ff 25 .. .. 20 00 bnd jmpq \*0x20....\(%rip\) # ...... <[_a-z]+>
#pass
diff -rup binutils.orig/ld/testsuite/ld-x86-64/plt-main.rd binutils-2.29.1/ld/testsuite/ld-x86-64/plt-main.rd
--- binutils.orig/ld/testsuite/ld-x86-64/plt-main.rd 2017-11-15 13:32:39.407064397 +0000
+++ binutils-2.29.1/ld/testsuite/ld-x86-64/plt-main.rd 2017-11-15 15:06:17.244054423 +0000
@ -264,3 +253,13 @@ diff -rup binutils.orig/ld/testsuite/ld-x86-64/tlspic2.rd binutils-2.29.1/ld/tes
0+18 00000010 0000001c FDE cie=00000000 pc=00000128..00000133
DW_CFA_nop
DW_CFA_nop
--- binutils.orig/ld/testsuite/ld-x86-64/plt-main-ibt.dd 2020-07-24 14:55:25.370646189 +0100
+++ binutils-2.35/ld/testsuite/ld-x86-64/plt-main-ibt.dd 2020-07-24 15:06:58.124189348 +0100
@@ -1,7 +1,3 @@
#...
-Disassembly of section .plt.got:
-
-[a-f0-9]+ <[_a-z]+@plt>:
[ ]*[a-f0-9]+: f3 0f 1e fa endbr64
-[ ]*[a-f0-9]+: f2 ff 25 .. .. 20 00 bnd jmpq \*0x20....\(%rip\) # ...... <.*>
#pass

View File

@ -1,62 +0,0 @@
--- binutils.orig/bfd/dwarf2.c 2019-11-13 11:49:52.211121564 +0000
+++ binutils-2.33.1/bfd/dwarf2.c 2019-11-13 11:53:26.991423055 +0000
@@ -2813,8 +2813,8 @@ static bfd_boolean comp_unit_maybe_decod
static bfd_boolean
find_abstract_instance (struct comp_unit * unit,
- bfd_byte * orig_info_ptr,
struct attribute * attr_ptr,
+ unsigned int recur_count,
const char ** pname,
bfd_boolean * is_linkage,
char ** filename_ptr,
@@ -2829,6 +2829,14 @@ find_abstract_instance (struct comp_unit
struct attribute attr;
const char *name = NULL;
+ if (recur_count == 100)
+ {
+ _bfd_error_handler
+ (_("DWARF error: abstract instance recursion detected"));
+ bfd_set_error (bfd_error_bad_value);
+ return FALSE;
+ }
+
/* DW_FORM_ref_addr can reference an entry in a different CU. It
is an offset from the .debug_info section, not the current CU. */
if (attr_ptr->form == DW_FORM_ref_addr)
@@ -2962,15 +2970,7 @@ find_abstract_instance (struct comp_unit
info_ptr, info_ptr_end);
if (info_ptr == NULL)
break;
- /* It doesn't ever make sense for DW_AT_specification to
- refer to the same DIE. Stop simple recursion. */
- if (info_ptr == orig_info_ptr)
- {
- _bfd_error_handler
- (_("DWARF error: abstract instance recursion detected"));
- bfd_set_error (bfd_error_bad_value);
- return FALSE;
- }
+
switch (attr.name)
{
case DW_AT_name:
@@ -2984,7 +2984,7 @@ find_abstract_instance (struct comp_unit
}
break;
case DW_AT_specification:
- if (!find_abstract_instance (unit, info_ptr, &attr,
+ if (!find_abstract_instance (unit, &attr, recur_count + 1,
&name, is_linkage,
filename_ptr, linenumber_ptr))
return FALSE;
@@ -3200,7 +3200,7 @@ scan_unit_for_symbols (struct comp_unit
case DW_AT_abstract_origin:
case DW_AT_specification:
- if (!find_abstract_instance (unit, info_ptr, &attr,
+ if (!find_abstract_instance (unit, &attr, 0,
&func->name,
&func->is_linkage,
&func->file,

View File

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

View File

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

View File

@ -0,0 +1,14 @@
--- binutils.orig/binutils/readelf.c 2021-03-26 12:46:41.494356890 +0000
+++ binutils-2.35/binutils/readelf.c 2021-03-26 12:48:36.370580519 +0000
@@ -12093,9 +12093,9 @@ print_dynamic_symbol (Filedata *filedata
int len_avail = 21;
if (! do_wide && version_string != NULL)
{
- char buffer[256];
+ char buffer[16];
- len_avail -= sprintf (buffer, "@%s", version_string);
+ len_avail -= 1 + strlen (version_string);
if (sym_info == symbol_undefined)
len_avail -= sprintf (buffer," (%d)", vna_other);

View File

@ -0,0 +1,34 @@
--- binutils.orig/bfd/dwarf2.c 2021-04-09 16:59:18.345187116 +0100
+++ binutils-2.35/bfd/dwarf2.c 2021-04-09 17:02:03.614064723 +0100
@@ -539,6 +539,8 @@ read_section (bfd * abfd,
/* The section may have already been read. */
if (contents == NULL)
{
+ ufile_ptr filesize;
+
msec = bfd_get_section_by_name (abfd, section_name);
if (! msec)
{
@@ -554,10 +556,20 @@ read_section (bfd * abfd,
return FALSE;
}
- *section_size = msec->rawsize ? msec->rawsize : msec->size;
+ amt = bfd_get_section_limit_octets (abfd, msec);
+ filesize = bfd_get_file_size (abfd);
+ if (amt >= filesize)
+ {
+ /* PR 26946 */
+ _bfd_error_handler (_("DWARF error: section %s is larger than its filesize! (0x%lx vs 0x%lx)"),
+ section_name, (long) amt, (long) filesize);
+ bfd_set_error (bfd_error_bad_value);
+ return FALSE;
+ }
+ *section_size = amt;
/* Paranoia - alloc one extra so that we can make sure a string
section is NUL terminated. */
- amt = *section_size + 1;
+ amt += 1;
if (amt == 0)
{
bfd_set_error (bfd_error_no_memory);

View File

@ -0,0 +1,27 @@
diff -rup binutils.orig/bfd/elfnn-aarch64.c binutils-2.35/bfd/elfnn-aarch64.c
--- binutils.orig/bfd/elfnn-aarch64.c 2020-07-30 17:20:30.607580720 +0100
+++ binutils-2.35/bfd/elfnn-aarch64.c 2020-07-30 17:22:45.629741124 +0100
@@ -9513,8 +9513,10 @@ elfNN_aarch64_init_small_plt0_entry (bfd
memcpy (htab->root.splt->contents, htab->plt0_entry,
htab->plt_header_size);
- elf_section_data (htab->root.splt->output_section)->this_hdr.sh_entsize =
- htab->plt_header_size;
+ /* PR 26312: Explicitly set the sh_entsize to 0 so that
+ consumers do not think that the section contains fixed
+ sized objects. */
+ elf_section_data (htab->root.splt->output_section)->this_hdr.sh_entsize = 0;
plt_got_2nd_ent = (htab->root.sgotplt->output_section->vma
+ htab->root.sgotplt->output_offset
@@ -9616,10 +9618,6 @@ elfNN_aarch64_finish_dynamic_sections (b
{
elfNN_aarch64_init_small_plt0_entry (output_bfd, htab);
- elf_section_data (htab->root.splt->output_section)->
- this_hdr.sh_entsize = htab->plt_entry_size;
-
-
if (htab->root.tlsdesc_plt && !(info->flags & DF_BIND_NOW))
{
BFD_ASSERT (htab->root.tlsdesc_got != (bfd_vma)-1);

File diff suppressed because it is too large Load Diff

View File

@ -1,447 +0,0 @@
diff -rup binutils.orig/bfd/bfd.c binutils-2.31.1/bfd/bfd.c
--- binutils.orig/bfd/bfd.c 2019-02-18 11:53:32.155652114 +0000
+++ binutils-2.31.1/bfd/bfd.c 2019-02-18 12:03:21.591459682 +0000
@@ -2332,6 +2332,8 @@ bfd_update_compression_header (bfd *abfd
bfd_put_32 (abfd, sec->size, &echdr->ch_size);
bfd_put_32 (abfd, 1 << sec->alignment_power,
&echdr->ch_addralign);
+ /* bfd_log2 (alignof (Elf32_Chdr)). */
+ bfd_set_section_alignment (abfd, sec, 2);
}
else
{
@@ -2342,6 +2344,8 @@ bfd_update_compression_header (bfd *abfd
bfd_put_64 (abfd, sec->size, &echdr->ch_size);
bfd_put_64 (abfd, 1 << sec->alignment_power,
&echdr->ch_addralign);
+ /* bfd_log2 (alignof (Elf64_Chdr)). */
+ bfd_set_section_alignment (abfd, sec, 3);
}
}
else
@@ -2354,6 +2358,8 @@ bfd_update_compression_header (bfd *abfd
order. */
memcpy (contents, "ZLIB", 4);
bfd_putb64 (sec->size, contents + 4);
+ /* No way to keep the original alignment, just use 1 always. */
+ bfd_set_section_alignment (abfd, sec, 0);
}
}
}
@@ -2368,12 +2374,15 @@ bfd_update_compression_header (bfd *abfd
SYNOPSIS
bfd_boolean bfd_check_compression_header
(bfd *abfd, bfd_byte *contents, asection *sec,
- bfd_size_type *uncompressed_size);
+ bfd_size_type *uncompressed_size,
+ unsigned int *uncompressed_alignment_power);
+
DESCRIPTION
Check the compression header at CONTENTS of SEC in ABFD and
- store the uncompressed size in UNCOMPRESSED_SIZE if the
- compression header is valid.
+ store the uncompressed size in UNCOMPRESSED_SIZE and the
+ uncompressed data alignment in UNCOMPRESSED_ALIGNMENT_POWER
+ if the compression header is valid.
RETURNS
Return TRUE if the compression header is valid.
@@ -2382,7 +2391,8 @@ RETURNS
bfd_boolean
bfd_check_compression_header (bfd *abfd, bfd_byte *contents,
asection *sec,
- bfd_size_type *uncompressed_size)
+ bfd_size_type *uncompressed_size,
+ unsigned int *uncompressed_alignment_power)
{
if (bfd_get_flavour (abfd) == bfd_target_elf_flavour
&& (elf_section_flags (sec) & SHF_COMPRESSED) != 0)
@@ -2404,9 +2414,10 @@ bfd_check_compression_header (bfd *abfd,
chdr.ch_addralign = bfd_get_64 (abfd, &echdr->ch_addralign);
}
if (chdr.ch_type == ELFCOMPRESS_ZLIB
- && chdr.ch_addralign == 1U << sec->alignment_power)
+ && chdr.ch_addralign == (1U << bfd_log2 (chdr.ch_addralign)))
{
*uncompressed_size = chdr.ch_size;
+ *uncompressed_alignment_power = bfd_log2 (chdr.ch_addralign);
return TRUE;
}
}
diff -rup binutils.orig/bfd/bfd-in2.h binutils-2.31.1/bfd/bfd-in2.h
--- binutils.orig/bfd/bfd-in2.h 2019-02-18 11:53:32.156652107 +0000
+++ binutils-2.31.1/bfd/bfd-in2.h 2019-02-18 12:00:23.849723903 +0000
@@ -7274,7 +7274,8 @@ void bfd_update_compression_header
bfd_boolean bfd_check_compression_header
(bfd *abfd, bfd_byte *contents, asection *sec,
- bfd_size_type *uncompressed_size);
+ bfd_size_type *uncompressed_size,
+ unsigned int *uncompressed_alignment_power);
int bfd_get_compression_header_size (bfd *abfd, asection *sec);
@@ -7850,7 +7851,8 @@ void bfd_cache_section_contents
bfd_boolean bfd_is_section_compressed_with_header
(bfd *abfd, asection *section,
int *compression_header_size_p,
- bfd_size_type *uncompressed_size_p);
+ bfd_size_type *uncompressed_size_p,
+ unsigned int *uncompressed_alignment_power_p);
bfd_boolean bfd_is_section_compressed
(bfd *abfd, asection *section);
diff -rup binutils.orig/bfd/compress.c binutils-2.31.1/bfd/compress.c
--- binutils.orig/bfd/compress.c 2019-02-18 11:53:32.153652128 +0000
+++ binutils-2.31.1/bfd/compress.c 2019-02-18 12:11:44.899886376 +0000
@@ -84,11 +84,13 @@ bfd_compress_section_contents (bfd *abfd
int zlib_size = 0;
int orig_compression_header_size;
bfd_size_type orig_uncompressed_size;
+ unsigned int orig_uncompressed_alignment_pow;
int header_size = bfd_get_compression_header_size (abfd, NULL);
bfd_boolean compressed
= bfd_is_section_compressed_with_header (abfd, sec,
&orig_compression_header_size,
- &orig_uncompressed_size);
+ &orig_uncompressed_size,
+ &orig_uncompressed_alignment_pow);
/* Either ELF compression header or the 12-byte, "ZLIB" + 8-byte size,
overhead in .zdebug* section. */
@@ -153,6 +155,8 @@ bfd_compress_section_contents (bfd *abfd
return 0;
}
free (uncompressed_buffer);
+ bfd_set_section_alignment (abfd, sec,
+ orig_uncompressed_alignment_pow);
sec->contents = buffer;
sec->compress_status = COMPRESS_SECTION_DONE;
return orig_uncompressed_size;
@@ -364,20 +368,25 @@ SYNOPSIS
bfd_boolean bfd_is_section_compressed_with_header
(bfd *abfd, asection *section,
int *compression_header_size_p,
- bfd_size_type *uncompressed_size_p);
+ bfd_size_type *uncompressed_size_p,
+ unsigned int *uncompressed_alignment_power_p);
+
DESCRIPTION
Return @code{TRUE} if @var{section} is compressed. Compression
- header size is returned in @var{compression_header_size_p} and
- uncompressed size is returned in @var{uncompressed_size_p}. If
- compression is unsupported, compression header size is returned
- with -1 and uncompressed size is returned with 0.
+ header size is returned in @var{compression_header_size_p},
+ uncompressed size is returned in @var{uncompressed_size_p}
+ and the uncompressed data alignement power is returned in
+ @var{uncompressed_align_pow_p}. If compression is
+ unsupported, compression header size is returned with -1
+ and uncompressed size is returned with 0.
*/
bfd_boolean
bfd_is_section_compressed_with_header (bfd *abfd, sec_ptr sec,
int *compression_header_size_p,
- bfd_size_type *uncompressed_size_p)
+ bfd_size_type *uncompressed_size_p,
+ unsigned int *uncompressed_align_pow_p)
{
bfd_byte header[MAX_COMPRESSION_HEADER_SIZE];
int compression_header_size;
@@ -385,6 +394,8 @@ bfd_is_section_compressed_with_header (b
unsigned int saved = sec->compress_status;
bfd_boolean compressed;
+ *uncompressed_align_pow_p = 0;
+
compression_header_size = bfd_get_compression_header_size (abfd, sec);
if (compression_header_size > MAX_COMPRESSION_HEADER_SIZE)
abort ();
@@ -412,7 +423,8 @@ bfd_is_section_compressed_with_header (b
if (compression_header_size != 0)
{
if (!bfd_check_compression_header (abfd, header, sec,
- uncompressed_size_p))
+ uncompressed_size_p,
+ uncompressed_align_pow_p))
compression_header_size = -1;
}
/* Check for the pathalogical case of a debug string section that
@@ -449,9 +461,11 @@ bfd_is_section_compressed (bfd *abfd, se
{
int compression_header_size;
bfd_size_type uncompressed_size;
+ unsigned int uncompressed_align_power;
return (bfd_is_section_compressed_with_header (abfd, sec,
&compression_header_size,
- &uncompressed_size)
+ &uncompressed_size,
+ &uncompressed_align_power)
&& compression_header_size >= 0
&& uncompressed_size > 0);
}
@@ -480,6 +494,7 @@ bfd_init_section_decompress_status (bfd
int compression_header_size;
int header_size;
bfd_size_type uncompressed_size;
+ unsigned int uncompressed_alignment_power = 0;
compression_header_size = bfd_get_compression_header_size (abfd, sec);
if (compression_header_size > MAX_COMPRESSION_HEADER_SIZE)
@@ -508,7 +523,8 @@ bfd_init_section_decompress_status (bfd
uncompressed_size = bfd_getb64 (header + 4);
}
else if (!bfd_check_compression_header (abfd, header, sec,
- &uncompressed_size))
+ &uncompressed_size,
+ &uncompressed_alignment_power))
{
bfd_set_error (bfd_error_wrong_format);
return FALSE;
@@ -516,6 +532,7 @@ bfd_init_section_decompress_status (bfd
sec->compressed_size = sec->size;
sec->size = uncompressed_size;
+ bfd_set_section_alignment (abfd, sec, uncompressed_alignment_power);
sec->compress_status = DECOMPRESS_SECTION_SIZED;
return TRUE;
diff -rup binutils.orig/bfd/elf.c binutils-2.31.1/bfd/elf.c
--- binutils.orig/bfd/elf.c 2019-02-18 11:53:32.161652071 +0000
+++ binutils-2.31.1/bfd/elf.c 2019-02-18 12:08:52.135108638 +0000
@@ -1177,10 +1177,12 @@ _bfd_elf_make_section_from_shdr (bfd *ab
enum { nothing, compress, decompress } action = nothing;
int compression_header_size;
bfd_size_type uncompressed_size;
+ unsigned int uncompressed_align_power;
bfd_boolean compressed
= bfd_is_section_compressed_with_header (abfd, newsect,
&compression_header_size,
- &uncompressed_size);
+ &uncompressed_size,
+ &uncompressed_align_power);
if (compressed)
{
diff -rup binutils.orig/binutils/readelf.c binutils-2.31.1/binutils/readelf.c
--- binutils.orig/binutils/readelf.c 2019-02-18 11:53:32.947646480 +0000
+++ binutils-2.31.1/binutils/readelf.c 2019-02-18 12:10:13.142535034 +0000
@@ -13366,12 +13366,6 @@ dump_section_as_strings (Elf_Internal_Sh
printable_section_name (filedata, section), chdr.ch_type);
return FALSE;
}
- else if (chdr.ch_addralign != section->sh_addralign)
- {
- warn (_("compressed section '%s' is corrupted\n"),
- printable_section_name (filedata, section));
- return FALSE;
- }
uncompressed_size = chdr.ch_size;
start += compression_header_size;
new_size -= compression_header_size;
@@ -13513,12 +13507,6 @@ dump_section_as_bytes (Elf_Internal_Shdr
printable_section_name (filedata, section), chdr.ch_type);
return FALSE;
}
- else if (chdr.ch_addralign != section->sh_addralign)
- {
- warn (_("compressed section '%s' is corrupted\n"),
- printable_section_name (filedata, section));
- return FALSE;
- }
uncompressed_size = chdr.ch_size;
start += compression_header_size;
new_size -= compression_header_size;
@@ -13688,12 +13676,6 @@ load_specific_debug_section (enum dwarf_
section->name, chdr.ch_type);
return FALSE;
}
- else if (chdr.ch_addralign != sec->sh_addralign)
- {
- warn (_("compressed section '%s' is corrupted\n"),
- section->name);
- return FALSE;
- }
uncompressed_size = chdr.ch_size;
start += compression_header_size;
size -= compression_header_size;
diff -rup binutils.orig/binutils/testsuite/binutils-all/dw2-3.rS binutils-2.31.1/binutils/testsuite/binutils-all/dw2-3.rS
--- binutils.orig/binutils/testsuite/binutils-all/dw2-3.rS 2019-02-18 11:53:32.908646758 +0000
+++ binutils-2.31.1/binutils/testsuite/binutils-all/dw2-3.rS 2019-02-18 12:10:40.884338917 +0000
@@ -1,3 +1,3 @@
#...
- +\[[ 0-9]+\] .debug_info +(PROGBITS|MIPS_DWARF) +0+ +[0-9a-f]+ +[0-9a-f]+ [0-9a-f]+ +C +0 +0 +1
+ +\[[ 0-9]+\] .debug_info +(PROGBITS|MIPS_DWARF) +0+ +[0-9a-f]+ +[0-9a-f]+ [0-9a-f]+ +C +0 +0 +(4|8)
#pass
diff -rup binutils.orig/binutils/testsuite/binutils-all/dw2-3.rt binutils-2.31.1/binutils/testsuite/binutils-all/dw2-3.rt
--- binutils.orig/binutils/testsuite/binutils-all/dw2-3.rt 2019-02-18 11:53:32.905646779 +0000
+++ binutils-2.31.1/binutils/testsuite/binutils-all/dw2-3.rt 2019-02-18 12:11:13.476108521 +0000
@@ -1,6 +1,6 @@
#...
+\[[ 0-9]+\] .debug_info
- +(PROGBITS|MIPS_DWARF) +0+ +[0-9a-f]+ +[0-9a-f]+ +[0-9a-f]+ +0 +0 +1
+ +(PROGBITS|MIPS_DWARF) +0+ +[0-9a-f]+ +[0-9a-f]+ +[0-9a-f]+ +0 +0 +(4|8)
+\[0+800\]: COMPRESSED
+ZLIB, 0+9d, 1
#pass
diff -rup binutils.orig/gold/merge.cc binutils-2.31.1/gold/merge.cc
--- binutils.orig/gold/merge.cc 2019-02-18 11:53:32.210651723 +0000
+++ binutils-2.31.1/gold/merge.cc 2019-02-18 12:12:59.027362334 +0000
@@ -440,9 +440,11 @@ Output_merge_string<Char_type>::do_add_i
{
section_size_type sec_len;
bool is_new;
+ uint64_t addralign = this->addralign();
const unsigned char* pdata = object->decompressed_section_contents(shndx,
&sec_len,
- &is_new);
+ &is_new,
+ &addralign);
const Char_type* p = reinterpret_cast<const Char_type*>(pdata);
const Char_type* pend = p + sec_len / sizeof(Char_type);
@@ -494,7 +496,7 @@ Output_merge_string<Char_type>::do_add_i
// aligned, so each string within the section must retain the same
// modulo.
uintptr_t init_align_modulo = (reinterpret_cast<uintptr_t>(pdata)
- & (this->addralign() - 1));
+ & (addralign - 1));
bool has_misaligned_strings = false;
while (p < pend)
@@ -503,7 +505,7 @@ Output_merge_string<Char_type>::do_add_i
// Within merge input section each string must be aligned.
if (len != 0
- && ((reinterpret_cast<uintptr_t>(p) & (this->addralign() - 1))
+ && ((reinterpret_cast<uintptr_t>(p) & (addralign - 1))
!= init_align_modulo))
has_misaligned_strings = true;
diff -rup binutils.orig/gold/object.cc binutils-2.31.1/gold/object.cc
--- binutils.orig/gold/object.cc 2019-02-18 11:53:32.208651737 +0000
+++ binutils-2.31.1/gold/object.cc 2019-02-18 12:16:35.938828914 +0000
@@ -751,11 +751,13 @@ build_compressed_section_map(
const unsigned char* contents =
obj->section_contents(i, &len, false);
uint64_t uncompressed_size;
+ Compressed_section_info info;
if (is_zcompressed)
{
// Skip over the ".zdebug" prefix.
name += 7;
uncompressed_size = get_uncompressed_size(contents, len);
+ info.addralign = shdr.get_sh_addralign();
}
else
{
@@ -763,8 +765,8 @@ build_compressed_section_map(
name += 6;
elfcpp::Chdr<size, big_endian> chdr(contents);
uncompressed_size = chdr.get_ch_size();
+ info.addralign = chdr.get_ch_addralign();
}
- Compressed_section_info info;
info.size = convert_to_section_size_type(uncompressed_size);
info.flag = shdr.get_sh_flags();
info.contents = NULL;
@@ -3060,7 +3062,8 @@ const unsigned char*
Object::decompressed_section_contents(
unsigned int shndx,
section_size_type* plen,
- bool* is_new)
+ bool* is_new,
+ uint64_t* palign)
{
section_size_type buffer_size;
const unsigned char* buffer = this->do_section_contents(shndx, &buffer_size,
@@ -3087,6 +3090,8 @@ Object::decompressed_section_contents(
{
*plen = uncompressed_size;
*is_new = false;
+ if (palign != NULL)
+ *palign = p->second.addralign;
return p->second.contents;
}
@@ -3108,6 +3113,8 @@ Object::decompressed_section_contents(
// once in this pass.
*plen = uncompressed_size;
*is_new = true;
+ if (palign != NULL)
+ *palign = p->second.addralign;
return uncompressed_data;
}
diff -rup binutils.orig/gold/object.h binutils-2.31.1/gold/object.h
--- binutils.orig/gold/object.h 2019-02-18 11:53:32.210651723 +0000
+++ binutils-2.31.1/gold/object.h 2019-02-18 12:17:50.625300926 +0000
@@ -373,6 +373,7 @@ struct Compressed_section_info
{
section_size_type size;
elfcpp::Elf_Xword flag;
+ uint64_t addralign;
const unsigned char* contents;
};
typedef std::map<unsigned int, Compressed_section_info> Compressed_section_map;
@@ -808,7 +809,8 @@ class Object
bool
section_is_compressed(unsigned int shndx,
- section_size_type* uncompressed_size) const
+ section_size_type* uncompressed_size,
+ elfcpp::Elf_Xword* palign = NULL) const
{
if (this->compressed_sections_ == NULL)
return false;
@@ -818,6 +820,8 @@ class Object
{
if (uncompressed_size != NULL)
*uncompressed_size = p->second.size;
+ if (palign != NULL)
+ *palign = p->second.addralign;
return true;
}
return false;
@@ -828,7 +832,7 @@ class Object
// by the caller.
const unsigned char*
decompressed_section_contents(unsigned int shndx, section_size_type* plen,
- bool* is_cached);
+ bool* is_cached, uint64_t* palign = NULL);
// Discard any buffers of decompressed sections. This is done
// at the end of the Add_symbols task.
diff -rup binutils.orig/gold/output.cc binutils-2.31.1/gold/output.cc
--- binutils.orig/gold/output.cc 2019-02-18 11:53:32.209651729 +0000
+++ binutils-2.31.1/gold/output.cc 2019-02-18 12:18:39.729953797 +0000
@@ -2448,7 +2448,14 @@ Output_section::add_input_section(Layout
unsigned int reloc_shndx,
bool have_sections_script)
{
+ section_size_type input_section_size = shdr.get_sh_size();
+ section_size_type uncompressed_size;
elfcpp::Elf_Xword addralign = shdr.get_sh_addralign();
+
+ if (object->section_is_compressed(shndx, &uncompressed_size,
+ &addralign))
+ input_section_size = uncompressed_size;
+
if ((addralign & (addralign - 1)) != 0)
{
object->error(_("invalid alignment %lu for section \"%s\""),
@@ -2498,11 +2505,6 @@ Output_section::add_input_section(Layout
}
}
- section_size_type input_section_size = shdr.get_sh_size();
- section_size_type uncompressed_size;
- if (object->section_is_compressed(shndx, &uncompressed_size))
- input_section_size = uncompressed_size;
-
off_t offset_in_section;
if (this->has_fixed_layout())

View File

@ -1,7 +1,7 @@
diff -rup binutils.orig/gas/config/obj-elf.c binutils-2.30/gas/config/obj-elf.c
--- binutils.orig/gas/config/obj-elf.c 2018-09-24 17:50:06.974172867 +0100
+++ binutils-2.30/gas/config/obj-elf.c 2018-09-25 15:19:33.559830794 +0100
@@ -82,9 +82,11 @@ static void obj_elf_gnu_attribute (int);
diff -rup binutils.orig/gas/config/obj-elf.c binutils-2.34/gas/config/obj-elf.c
--- binutils.orig/gas/config/obj-elf.c 2020-02-02 11:34:11.858321477 +0000
+++ binutils-2.34/gas/config/obj-elf.c 2020-02-02 11:34:30.099247619 +0000
@@ -78,9 +78,11 @@ static void obj_elf_gnu_attribute (int);
static void obj_elf_tls_common (int);
static void obj_elf_lcomm (int);
static void obj_elf_struct (int);
@ -13,7 +13,7 @@ diff -rup binutils.orig/gas/config/obj-elf.c binutils-2.30/gas/config/obj-elf.c
{"comm", obj_elf_common, 0},
{"common", obj_elf_common, 1},
{"ident", obj_elf_ident, 0},
@@ -1007,6 +1009,27 @@ obj_elf_section_name (void)
@@ -1003,6 +1005,27 @@ obj_elf_section_name (void)
return name;
}
@ -41,18 +41,19 @@ diff -rup binutils.orig/gas/config/obj-elf.c binutils-2.30/gas/config/obj-elf.c
void
obj_elf_section (int push)
{
diff -rup binutils.orig/gas/doc/as.texinfo binutils-2.30/gas/doc/as.texinfo
--- binutils.orig/gas/doc/as.texi 2018-09-24 17:50:06.984172788 +0100
+++ binutils-2.30/gas/doc/as.texi 2018-09-25 15:19:43.557748972 +0100
@@ -4407,6 +4407,7 @@ Some machine configurations provide addi
Only in binutils-2.34/gas/config: obj-elf.c.orig
diff -rup binutils.orig/gas/doc/as.texi binutils-2.34/gas/doc/as.texi
--- binutils.orig/gas/doc/as.texi 2020-02-02 11:34:11.850321509 +0000
+++ binutils-2.34/gas/doc/as.texi 2020-02-02 11:35:11.359080560 +0000
@@ -4359,6 +4359,7 @@ Some machine configurations provide addi
* Altmacro:: @code{.altmacro}
* Ascii:: @code{.ascii "@var{string}"}@dots{}
* Asciz:: @code{.asciz "@var{string}"}@dots{}
+* Attach_to_group:: @code{.attach_to_group @var{name}}
* Balign:: @code{.balign @var{abs-expr} , @var{abs-expr}}
* Balign:: @code{.balign [@var{abs-expr}[, @var{abs-expr}]]}
* Bundle directives:: @code{.bundle_align_mode @var{abs-expr}}, etc
* Byte:: @code{.byte @var{expressions}}
@@ -4703,6 +4704,12 @@ trailing zero byte) into consecutive add
@@ -4656,6 +4657,12 @@ trailing zero byte) into consecutive add
@code{.asciz} is just like @code{.ascii}, but each string is followed by
a zero byte. The ``z'' in @samp{.asciz} stands for ``zero''.
@ -63,6 +64,7 @@ diff -rup binutils.orig/gas/doc/as.texinfo binutils-2.30/gas/doc/as.texinfo
+has been created.
+
@node Balign
@section @code{.balign[wl] @var{abs-expr}, @var{abs-expr}, @var{abs-expr}}
@section @code{.balign[wl] [@var{abs-expr}[, @var{abs-expr}[, @var{abs-expr}]]]}
Only in binutils-2.34/gas/doc: as.texi.orig
Only in binutils-2.34/gas/doc: as.texi.rej

44
binutils-config.patch Normal file
View File

@ -0,0 +1,44 @@
diff -Nrup a/libiberty/aclocal.m4 b/libiberty/aclocal.m4
--- a/libiberty/aclocal.m4 2019-01-19 09:01:34.000000000 -0700
+++ b/libiberty/aclocal.m4 2020-01-09 22:00:27.183312982 -0700
@@ -147,7 +147,7 @@ if test $ac_cv_os_cray = yes; then
fi
AC_CACHE_CHECK(stack direction for C alloca, ac_cv_c_stack_direction,
-[AC_TRY_RUN([find_stack_direction ()
+[AC_TRY_RUN([__attribute__ ((noclone,noinline)) find_stack_direction ()
{
static char *addr = 0;
auto char dummy;
diff --git a/config/intdiv0.m4 b/config/intdiv0.m4
index 55dddcf1..ba906efc 100644
--- a/config/intdiv0.m4
+++ b/config/intdiv0.m4
@@ -31,10 +31,10 @@ sigfpe_handler (sig) int sig;
exit (sig != SIGFPE);
}
-int x = 1;
-int y = 0;
-int z;
-int nan;
+volatile int x = 1;
+volatile int y = 0;
+volatile int z;
+volatile int nan;
int main ()
{
diff --git a/libiberty/configure.ac b/libiberty/configure.ac
index f1ce7601..fc20d228 100644
--- a/libiberty/configure.ac
+++ b/libiberty/configure.ac
@@ -661,7 +661,7 @@ if test -z "${setobjs}"; then
for v in $vars; do
AC_MSG_CHECKING([for $v])
AC_CACHE_VAL(libiberty_cv_var_$v,
- [AC_LINK_IFELSE([AC_LANG_PROGRAM([[int *p;]],[[extern int $v []; p = $v;]])],
+ [AC_LINK_IFELSE([AC_LANG_PROGRAM([[__attribute__ ((used)) int *p;]],[[extern int $v []; p = $v;]])],
[eval "libiberty_cv_var_$v=yes"],
[eval "libiberty_cv_var_$v=no"])])
if eval "test \"`echo '$libiberty_cv_var_'$v`\" = yes"; then

View File

@ -0,0 +1,931 @@
--- binutils.orig/binutils/dwarf.c 2020-10-21 14:15:47.101351869 +0100
+++ binutils-2.35.1/binutils/dwarf.c 2020-10-21 14:17:44.608585923 +0100
@@ -1868,7 +1868,7 @@ skip_attr_bytes (unsigned long
case DW_FORM_ref_addr:
if (dwarf_version == 2)
SAFE_BYTE_GET_AND_INC (uvalue, data, pointer_size, end);
- else if (dwarf_version == 3 || dwarf_version == 4)
+ else if (dwarf_version > 2)
SAFE_BYTE_GET_AND_INC (uvalue, data, offset_size, end);
else
return NULL;
@@ -1920,6 +1920,7 @@ skip_attr_bytes (unsigned long
case DW_FORM_ref8:
case DW_FORM_data8:
+ case DW_FORM_ref_sig8:
data += 8;
break;
@@ -1934,6 +1935,7 @@ skip_attr_bytes (unsigned long
case DW_FORM_block:
case DW_FORM_exprloc:
READ_ULEB (uvalue, data, end);
+ data += uvalue;
break;
case DW_FORM_block1:
@@ -1951,12 +1953,12 @@ skip_attr_bytes (unsigned long
data += 4 + uvalue;
break;
- case DW_FORM_ref_sig8:
- data += 8;
- break;
-
case DW_FORM_indirect:
- /* FIXME: Handle this form. */
+ READ_ULEB (form, data, end);
+ if (form == DW_FORM_implicit_const)
+ SKIP_ULEB (data, end);
+ return skip_attr_bytes (form, data, end, pointer_size, offset_size, dwarf_version, value_return);
+
default:
return NULL;
}
@@ -1978,7 +1980,7 @@ get_type_signedness (unsigned char *
dwarf_vma offset_size,
int dwarf_version,
bfd_boolean * is_signed,
- bfd_boolean is_nested)
+ unsigned int nesting)
{
unsigned long abbrev_number;
abbrev_entry * entry;
@@ -1997,6 +1999,14 @@ get_type_signedness (unsigned char *
/* FIXME: Issue a warning ? */
return;
+#define MAX_NESTING 20
+ if (nesting > MAX_NESTING)
+ {
+ /* FIXME: Warn - or is this expected ?
+ NB/ We need to avoid infinite recursion. */
+ return;
+ }
+
for (attr = entry->first_attr;
attr != NULL && attr->attribute;
attr = attr->next)
@@ -2019,16 +2029,12 @@ get_type_signedness (unsigned char *
#endif
case DW_AT_type:
/* Recurse. */
- if (is_nested)
- {
- /* FIXME: Warn - or is this expected ?
- NB/ We need to avoid infinite recursion. */
- return;
- }
if (uvalue >= (size_t) (end - start))
return;
- get_type_signedness (start, start + uvalue, end, pointer_size,
- offset_size, dwarf_version, is_signed, TRUE);
+ /* We cannot correctly process DW_FORM_ref_addr at the moment. */
+ if (attr->form != DW_FORM_ref_addr)
+ get_type_signedness (start, start + uvalue, end, pointer_size,
+ offset_size, dwarf_version, is_signed, nesting + 1);
break;
case DW_AT_encoding:
@@ -2206,7 +2212,6 @@ read_and_display_attr_value (unsigned lo
SAFE_BYTE_GET_AND_INC (uvalue, data, offset_size, end);
else
error (_("Internal error: DWARF version is not 2, 3 or 4.\n"));
-
break;
case DW_FORM_addr:
@@ -2246,8 +2251,8 @@ read_and_display_attr_value (unsigned lo
uvalue = svalue;
break;
- case DW_FORM_GNU_str_index:
case DW_FORM_ref_udata:
+ case DW_FORM_GNU_str_index:
case DW_FORM_udata:
case DW_FORM_GNU_addr_index:
READ_ULEB (uvalue, data, end);
@@ -2663,8 +2668,10 @@ read_and_display_attr_value (unsigned lo
{
bfd_boolean is_signed = FALSE;
- get_type_signedness (start, start + uvalue, end, pointer_size,
- offset_size, dwarf_version, & is_signed, FALSE);
+ /* We cannot correctly process DW_FORM_ref_addr at the moment. */
+ if (form != DW_FORM_ref_addr)
+ get_type_signedness (start, start + uvalue, end, pointer_size,
+ offset_size, dwarf_version, & is_signed, 0);
level_type_signed[level] = is_signed;
}
break;
diff -rup binutils.orig/binutils/dwarf.c binutils-2.35.1/binutils/dwarf.c
--- binutils.orig/binutils/dwarf.c 2020-10-27 16:24:29.489636820 +0000
+++ binutils-2.35.1/binutils/dwarf.c 2020-10-27 16:24:44.507568083 +0000
@@ -849,101 +849,204 @@ fetch_indexed_value (dwarf_vma offset, d
/* FIXME: There are better and more efficient ways to handle
these structures. For now though, I just want something that
is simple to implement. */
+/* Records a single attribute in an abbrev. */
typedef struct abbrev_attr
{
- unsigned long attribute;
- unsigned long form;
- bfd_signed_vma implicit_const;
- struct abbrev_attr *next;
+ unsigned long attribute;
+ unsigned long form;
+ bfd_signed_vma implicit_const;
+ struct abbrev_attr * next;
}
abbrev_attr;
+/* Records a single abbrev. */
typedef struct abbrev_entry
{
- unsigned long entry;
- unsigned long tag;
- int children;
- struct abbrev_attr *first_attr;
- struct abbrev_attr *last_attr;
- struct abbrev_entry *next;
+ unsigned long number;
+ unsigned long tag;
+ int children;
+ struct abbrev_attr * first_attr;
+ struct abbrev_attr * last_attr;
+ struct abbrev_entry * next;
}
abbrev_entry;
-static abbrev_entry *first_abbrev = NULL;
-static abbrev_entry *last_abbrev = NULL;
+/* Records a set of abbreviations. */
+typedef struct abbrev_list
+{
+ abbrev_entry * first_abbrev;
+ abbrev_entry * last_abbrev;
+ dwarf_vma abbrev_offset;
+ struct abbrev_list * next;
+ unsigned char * start_of_next_abbrevs;
+}
+abbrev_list;
+
+/* Records all the abbrevs found so far. */
+static struct abbrev_list * abbrev_lists = NULL;
+
+typedef struct abbrev_map
+{
+ dwarf_vma start;
+ dwarf_vma end;
+ abbrev_list * list;
+} abbrev_map;
+
+/* Maps between CU offsets and abbrev sets. */
+static abbrev_map * cu_abbrev_map = NULL;
+static unsigned long num_abbrev_map_entries = 0;
+static unsigned long next_free_abbrev_map_entry = 0;
+
+#define INITIAL_NUM_ABBREV_MAP_ENTRIES 8
+#define ABBREV_MAP_ENTRIES_INCREMENT 8
+
+static void
+record_abbrev_list_for_cu (dwarf_vma start, dwarf_vma end, abbrev_list * list)
+{
+ if (cu_abbrev_map == NULL)
+ {
+ num_abbrev_map_entries = INITIAL_NUM_ABBREV_MAP_ENTRIES;
+ cu_abbrev_map = xmalloc (num_abbrev_map_entries * sizeof (* cu_abbrev_map));
+ }
+ else if (next_free_abbrev_map_entry == num_abbrev_map_entries)
+ {
+ num_abbrev_map_entries += ABBREV_MAP_ENTRIES_INCREMENT;
+ cu_abbrev_map = xrealloc (cu_abbrev_map, num_abbrev_map_entries * sizeof (* cu_abbrev_map));
+ }
+
+ cu_abbrev_map[next_free_abbrev_map_entry].start = start;
+ cu_abbrev_map[next_free_abbrev_map_entry].end = end;
+ cu_abbrev_map[next_free_abbrev_map_entry].list = list;
+ next_free_abbrev_map_entry ++;
+}
static void
-free_abbrevs (void)
+free_all_abbrevs (void)
{
- abbrev_entry *abbrv;
+ abbrev_list * list;
- for (abbrv = first_abbrev; abbrv;)
+ for (list = abbrev_lists; list != NULL;)
{
- abbrev_entry *next_abbrev = abbrv->next;
- abbrev_attr *attr;
+ abbrev_list * next = list->next;
+ abbrev_entry * abbrv;
- for (attr = abbrv->first_attr; attr;)
+ for (abbrv = list->first_abbrev; abbrv != NULL;)
{
- abbrev_attr *next_attr = attr->next;
+ abbrev_entry * next_abbrev = abbrv->next;
+ abbrev_attr * attr;
- free (attr);
- attr = next_attr;
+ for (attr = abbrv->first_attr; attr;)
+ {
+ abbrev_attr *next_attr = attr->next;
+
+ free (attr);
+ attr = next_attr;
+ }
+
+ free (abbrv);
+ abbrv = next_abbrev;
}
- free (abbrv);
- abbrv = next_abbrev;
+ free (list);
+ list = next;
}
- last_abbrev = first_abbrev = NULL;
+ abbrev_lists = NULL;
+}
+
+static abbrev_list *
+new_abbrev_list (dwarf_vma abbrev_offset)
+{
+ abbrev_list * list = (abbrev_list *) xcalloc (sizeof * list, 1);
+
+ list->abbrev_offset = abbrev_offset;
+
+ list->next = abbrev_lists;
+ abbrev_lists = list;
+
+ return list;
+}
+
+static abbrev_list *
+find_abbrev_list_by_abbrev_offset (dwarf_vma abbrev_offset)
+{
+ abbrev_list * list;
+
+ for (list = abbrev_lists; list != NULL; list = list->next)
+ if (list->abbrev_offset == abbrev_offset)
+ return list;
+
+ return NULL;
+}
+
+/* Find the abbreviation map for the CU that includes OFFSET.
+ OFFSET is an absolute offset from the start of the .debug_info section. */
+/* FIXME: This function is going to slow down readelf & objdump.
+ Consider using a better algorithm to mitigate this effect. */
+
+static abbrev_map *
+find_abbrev_map_by_offset (dwarf_vma offset)
+{
+ unsigned long i;
+
+ for (i = 0; i < next_free_abbrev_map_entry; i++)
+ if (cu_abbrev_map[i].start <= offset
+ && cu_abbrev_map[i].end > offset)
+ return cu_abbrev_map + i;
+
+ return NULL;
}
static void
-add_abbrev (unsigned long number, unsigned long tag, int children)
+add_abbrev (unsigned long number,
+ unsigned long tag,
+ int children,
+ abbrev_list * list)
{
- abbrev_entry *entry;
+ abbrev_entry * entry;
- entry = (abbrev_entry *) malloc (sizeof (*entry));
- if (entry == NULL)
- /* ugg */
- return;
+ entry = (abbrev_entry *) xmalloc (sizeof (*entry));
- entry->entry = number;
+ entry->number = number;
entry->tag = tag;
entry->children = children;
entry->first_attr = NULL;
entry->last_attr = NULL;
entry->next = NULL;
- if (first_abbrev == NULL)
- first_abbrev = entry;
+ assert (list != NULL);
+
+ if (list->first_abbrev == NULL)
+ list->first_abbrev = entry;
else
- last_abbrev->next = entry;
+ list->last_abbrev->next = entry;
- last_abbrev = entry;
+ list->last_abbrev = entry;
}
static void
-add_abbrev_attr (unsigned long attribute, unsigned long form,
- bfd_signed_vma implicit_const)
+add_abbrev_attr (unsigned long attribute,
+ unsigned long form,
+ bfd_signed_vma implicit_const,
+ abbrev_list * list)
{
abbrev_attr *attr;
- attr = (abbrev_attr *) malloc (sizeof (*attr));
- if (attr == NULL)
- /* ugg */
- return;
+ attr = (abbrev_attr *) xmalloc (sizeof (*attr));
attr->attribute = attribute;
attr->form = form;
attr->implicit_const = implicit_const;
attr->next = NULL;
- if (last_abbrev->first_attr == NULL)
- last_abbrev->first_attr = attr;
+ assert (list != NULL && list->last_abbrev != NULL);
+
+ if (list->last_abbrev->first_attr == NULL)
+ list->last_abbrev->first_attr = attr;
else
- last_abbrev->last_attr->next = attr;
+ list->last_abbrev->last_attr->next = attr;
- last_abbrev->last_attr = attr;
+ list->last_abbrev->last_attr = attr;
}
/* Processes the (partial) contents of a .debug_abbrev section.
@@ -952,11 +1055,10 @@ add_abbrev_attr (unsigned long attribute
an abbreviation set was found. */
static unsigned char *
-process_abbrev_section (unsigned char *start, unsigned char *end)
+process_abbrev_set (unsigned char * start,
+ const unsigned char * end,
+ abbrev_list * list)
{
- if (first_abbrev != NULL)
- return NULL;
-
while (start < end)
{
unsigned long entry;
@@ -966,7 +1068,7 @@ process_abbrev_section (unsigned char *s
READ_ULEB (entry, start, end);
- /* A single zero is supposed to end the section according
+ /* A single zero is supposed to end the set according
to the standard. If there's more, then signal that to
the caller. */
if (start == end)
@@ -980,7 +1082,7 @@ process_abbrev_section (unsigned char *s
children = *start++;
- add_abbrev (entry, tag, children);
+ add_abbrev (entry, tag, children, list);
do
{
@@ -1003,7 +1105,7 @@ process_abbrev_section (unsigned char *s
break;
}
- add_abbrev_attr (attribute, form, implicit_const);
+ add_abbrev_attr (attribute, form, implicit_const, list);
}
while (attribute != 0);
}
@@ -1969,36 +2071,123 @@ skip_attr_bytes (unsigned long
return data;
}
-/* Return IS_SIGNED set to TRUE if the type at
- DATA can be determined to be a signed type. */
+/* Given form FORM with value UVALUE, locate and return the abbreviation
+ associated with it. */
+
+static abbrev_entry *
+get_type_abbrev_from_form (unsigned long form,
+ unsigned long uvalue,
+ dwarf_vma cu_offset,
+ const struct dwarf_section * section,
+ unsigned long * abbrev_num_return,
+ unsigned char ** data_return,
+ unsigned long * cu_offset_return)
+{
+ unsigned long abbrev_number;
+ abbrev_map * map;
+ abbrev_entry * entry;
+ unsigned char * data;
+
+ if (abbrev_num_return != NULL)
+ * abbrev_num_return = 0;
+ if (data_return != NULL)
+ * data_return = NULL;
+
+ switch (form)
+ {
+ case DW_FORM_GNU_ref_alt:
+ /* FIXME: We are unable to handle this form at the moment. */
+ return NULL;
+
+ case DW_FORM_ref_addr:
+ if (uvalue >= section->size)
+ {
+ warn (_("Unable to resolve ref_addr form: uvalue %lx > section size %lx (%s)\n"),
+ uvalue, (long) section->size, section->name);
+ return NULL;
+ }
+ break;
+
+ case DW_FORM_ref1:
+ case DW_FORM_ref2:
+ case DW_FORM_ref4:
+ case DW_FORM_ref_udata:
+ if (uvalue + cu_offset > section->size)
+ {
+ warn (_("Unable to resolve ref form: uvalue %lx + cu_offset %lx > section size %lx\n"),
+ uvalue, (long) cu_offset, (long) section->size);
+ return NULL;
+ }
+ uvalue += cu_offset;
+ break;
+
+ /* FIXME: Are there other DW_FORMs that can be used by types ? */
+
+ default:
+ warn (_("Unexpected form %lx encountered whilst finding abbreviation for type\n"), form);
+ return NULL;
+ }
+
+ data = (unsigned char *) section->start + uvalue;
+ map = find_abbrev_map_by_offset (uvalue);
+
+ if (map == NULL)
+ {
+ warn (_("Unable to find abbreviations for CU offset %#lx\n"), uvalue);
+ return NULL;
+ }
+ if (map->list == NULL)
+ {
+ warn (_("Empty abbreviation list encountered for CU offset %lx\n"), uvalue);
+ return NULL;
+ }
+
+ if (cu_offset_return != NULL)
+ {
+ if (form == DW_FORM_ref_addr)
+ * cu_offset_return = map->start;
+ else
+ * cu_offset_return = cu_offset;
+ }
+
+ READ_ULEB (abbrev_number, data, section->start + section->size);
+
+ for (entry = map->list->first_abbrev; entry != NULL; entry = entry->next)
+ if (entry->number == abbrev_number)
+ break;
+
+ if (abbrev_num_return != NULL)
+ * abbrev_num_return = abbrev_number;
+
+ if (data_return != NULL)
+ * data_return = data;
+
+ if (entry == NULL)
+ warn (_("Unable to find entry for abbreviation %lu\n"), abbrev_number);
+
+ return entry;
+}
+
+/* Return IS_SIGNED set to TRUE if the type using abbreviation ENTRY
+ can be determined to be a signed type. The data for ENTRY can be
+ found starting at DATA. */
static void
-get_type_signedness (unsigned char * start,
+get_type_signedness (abbrev_entry * entry,
+ const struct dwarf_section * section,
unsigned char * data,
unsigned const char * end,
+ dwarf_vma cu_offset,
dwarf_vma pointer_size,
dwarf_vma offset_size,
int dwarf_version,
bfd_boolean * is_signed,
unsigned int nesting)
{
- unsigned long abbrev_number;
- abbrev_entry * entry;
abbrev_attr * attr;
* is_signed = FALSE;
- READ_ULEB (abbrev_number, data, end);
-
- for (entry = first_abbrev;
- entry != NULL && entry->entry != abbrev_number;
- entry = entry->next)
- continue;
-
- if (entry == NULL)
- /* FIXME: Issue a warning ? */
- return;
-
#define MAX_NESTING 20
if (nesting > MAX_NESTING)
{
@@ -2011,6 +2200,7 @@ get_type_signedness (unsigned char *
attr != NULL && attr->attribute;
attr = attr->next)
{
+ unsigned char * orig_data = data;
dwarf_vma uvalue = 0;
data = skip_attr_bytes (attr->form, data, end, pointer_size,
@@ -2020,21 +2210,38 @@ get_type_signedness (unsigned char *
switch (attr->attribute)
{
-#if 0 /* FIXME: It would be nice to print the name of the type,
- but this would mean updating a lot of binutils tests. */
+ case DW_AT_linkage_name:
case DW_AT_name:
- if (attr->form == DW_FORM_strp)
- printf ("%s", fetch_indirect_string (uvalue));
+ if (do_wide)
+ {
+ if (attr->form == DW_FORM_strp)
+ printf (", %s", fetch_indirect_string (uvalue));
+ else if (attr->form == DW_FORM_string)
+ printf (", %s", orig_data);
+ }
break;
-#endif
+
case DW_AT_type:
/* Recurse. */
- if (uvalue >= (size_t) (end - start))
- return;
- /* We cannot correctly process DW_FORM_ref_addr at the moment. */
- if (attr->form != DW_FORM_ref_addr)
- get_type_signedness (start, start + uvalue, end, pointer_size,
- offset_size, dwarf_version, is_signed, nesting + 1);
+ {
+ abbrev_entry * type_abbrev;
+ unsigned char * type_data;
+ unsigned long type_cu_offset;
+
+ type_abbrev = get_type_abbrev_from_form (attr->form,
+ uvalue,
+ cu_offset,
+ section,
+ NULL /* abbrev num return */,
+ & type_data,
+ & type_cu_offset);
+ if (type_abbrev == NULL)
+ break;
+
+ get_type_signedness (type_abbrev, section, type_data, end, type_cu_offset,
+ pointer_size, offset_size, dwarf_version,
+ is_signed, nesting + 1);
+ }
break;
case DW_AT_encoding:
@@ -2276,12 +2483,12 @@ read_and_display_attr_value (unsigned lo
{
case DW_FORM_ref_addr:
if (!do_loc)
- printf ("%c<0x%s>", delimiter, dwarf_vmatoa ("x",uvalue));
+ printf ("%c<0x%s>", delimiter, dwarf_vmatoa ("x", uvalue));
break;
case DW_FORM_GNU_ref_alt:
if (!do_loc)
- printf ("%c<alt 0x%s>", delimiter, dwarf_vmatoa ("x",uvalue));
+ printf ("%c<alt 0x%s>", delimiter, dwarf_vmatoa ("x", uvalue));
/* FIXME: Follow the reference... */
break;
@@ -2667,11 +2874,18 @@ read_and_display_attr_value (unsigned lo
&& uvalue < (size_t) (end - start))
{
bfd_boolean is_signed = FALSE;
-
- /* We cannot correctly process DW_FORM_ref_addr at the moment. */
- if (form != DW_FORM_ref_addr)
- get_type_signedness (start, start + uvalue, end, pointer_size,
- offset_size, dwarf_version, & is_signed, 0);
+ abbrev_entry * type_abbrev;
+ unsigned char * type_data;
+ unsigned long type_cu_offset;
+
+ type_abbrev = get_type_abbrev_from_form (form, uvalue, cu_offset,
+ section, NULL, & type_data, & type_cu_offset);
+ if (type_abbrev != NULL)
+ {
+ get_type_signedness (type_abbrev, section, type_data, end, type_cu_offset,
+ pointer_size, offset_size, dwarf_version,
+ & is_signed, 0);
+ }
level_type_signed[level] = is_signed;
}
break;
@@ -2993,40 +3207,22 @@ read_and_display_attr_value (unsigned lo
case DW_AT_import:
{
- if (form == DW_FORM_ref_sig8
- || form == DW_FORM_GNU_ref_alt)
- break;
-
- if (form == DW_FORM_ref1
- || form == DW_FORM_ref2
- || form == DW_FORM_ref4
- || form == DW_FORM_ref_udata)
- uvalue += cu_offset;
+ unsigned long abbrev_number;
+ abbrev_entry *entry;
- if (uvalue >= section->size)
- warn (_("Offset %s used as value for DW_AT_import attribute of DIE at offset 0x%lx is too big.\n"),
- dwarf_vmatoa ("x", uvalue),
- (unsigned long) (orig_data - section->start));
+ entry = get_type_abbrev_from_form (form, uvalue, cu_offset,
+ section, & abbrev_number, NULL, NULL);
+ if (entry == NULL)
+ {
+ if (form != DW_FORM_GNU_ref_alt)
+ warn (_("Offset %s used as value for DW_AT_import attribute of DIE at offset 0x%lx is too big.\n"),
+ dwarf_vmatoa ("x", uvalue),
+ (unsigned long) (orig_data - section->start));
+ }
else
{
- unsigned long abbrev_number;
- abbrev_entry *entry;
- unsigned char *p = section->start + uvalue;
-
- READ_ULEB (abbrev_number, p, end);
-
printf (_("\t[Abbrev Number: %ld"), abbrev_number);
- /* Don't look up abbrev for DW_FORM_ref_addr, as it very often will
- use different abbrev table, and we don't track .debug_info chunks
- yet. */
- if (form != DW_FORM_ref_addr)
- {
- for (entry = first_abbrev; entry != NULL; entry = entry->next)
- if (entry->entry == abbrev_number)
- break;
- if (entry != NULL)
- printf (" (%s)", get_TAG_name (entry->tag));
- }
+ printf (" (%s)", get_TAG_name (entry->tag));
printf ("]");
}
}
@@ -3245,8 +3441,98 @@ process_debug_info (struct dwarf_section
if (!do_loc && dwarf_start_die == 0)
introduce (section, FALSE);
+
+ free_all_abbrevs ();
+ free (cu_abbrev_map);
+ cu_abbrev_map = NULL;
+ next_free_abbrev_map_entry = 0;
- for (section_begin = start, unit = 0; start < end; unit++)
+ /* In order to be able to resolve DW_FORM_ref_attr forms we need
+ to load *all* of the abbrevs for all CUs in this .debug_info
+ section. This does effectively mean that we (partially) read
+ every CU header twice. */
+ for (section_begin = start; start < end;)
+ {
+ DWARF2_Internal_CompUnit compunit;
+ unsigned char * hdrptr;
+ dwarf_vma cu_offset;
+ unsigned int offset_size;
+ unsigned int initial_length_size;
+ struct cu_tu_set * this_set;
+ abbrev_list * list;
+
+ hdrptr = start;
+
+ SAFE_BYTE_GET_AND_INC (compunit.cu_length, hdrptr, 4, end);
+
+ if (compunit.cu_length == 0xffffffff)
+ {
+ SAFE_BYTE_GET_AND_INC (compunit.cu_length, hdrptr, 8, end);
+ offset_size = 8;
+ initial_length_size = 12;
+ }
+ else
+ {
+ offset_size = 4;
+ initial_length_size = 4;
+ }
+
+ SAFE_BYTE_GET_AND_INC (compunit.cu_version, hdrptr, 2, end);
+
+ cu_offset = start - section_begin;
+
+ this_set = find_cu_tu_set_v2 (cu_offset, do_types);
+
+ if (compunit.cu_version < 5)
+ {
+ compunit.cu_unit_type = DW_UT_compile;
+ /* Initialize it due to a false compiler warning. */
+ compunit.cu_pointer_size = -1;
+ }
+ else
+ {
+ SAFE_BYTE_GET_AND_INC (compunit.cu_unit_type, hdrptr, 1, end);
+ do_types = (compunit.cu_unit_type == DW_UT_type);
+
+ SAFE_BYTE_GET_AND_INC (compunit.cu_pointer_size, hdrptr, 1, end);
+ }
+
+ SAFE_BYTE_GET_AND_INC (compunit.cu_abbrev_offset, hdrptr, offset_size, end);
+
+ list = find_abbrev_list_by_abbrev_offset (compunit.cu_abbrev_offset);
+ if (list == NULL)
+ {
+ dwarf_vma abbrev_base;
+ size_t abbrev_size;
+ unsigned char * next;
+
+ if (this_set == NULL)
+ {
+ abbrev_base = 0;
+ abbrev_size = debug_displays [abbrev_sec].section.size;
+ }
+ else
+ {
+ abbrev_base = this_set->section_offsets [DW_SECT_ABBREV];
+ abbrev_size = this_set->section_sizes [DW_SECT_ABBREV];
+ }
+
+ list = new_abbrev_list (compunit.cu_abbrev_offset);
+ next = process_abbrev_set
+ (((unsigned char *) debug_displays [abbrev_sec].section.start
+ + abbrev_base + compunit.cu_abbrev_offset),
+ ((unsigned char *) debug_displays [abbrev_sec].section.start
+ + abbrev_base + abbrev_size),
+ list);
+ list->start_of_next_abbrevs = next;
+ }
+
+ start = section_begin + cu_offset + compunit.cu_length
+ + initial_length_size;
+ record_abbrev_list_for_cu (cu_offset, start - section_begin, list);
+ }
+
+ for (start = section_begin, unit = 0; start < end; unit++)
{
DWARF2_Internal_CompUnit compunit;
unsigned char *hdrptr;
@@ -3262,6 +3548,7 @@ process_debug_info (struct dwarf_section
struct cu_tu_set *this_set;
dwarf_vma abbrev_base;
size_t abbrev_size;
+ abbrev_list * list = NULL;
hdrptr = start;
@@ -3434,8 +3721,6 @@ process_debug_info (struct dwarf_section
continue;
}
- free_abbrevs ();
-
/* Process the abbrevs used by this compilation unit. */
if (compunit.cu_abbrev_offset >= abbrev_size)
warn (_("Debug info is corrupted, abbrev offset (%lx) is larger than abbrev section size (%lx)\n"),
@@ -3448,11 +3733,22 @@ process_debug_info (struct dwarf_section
(unsigned long) abbrev_base + abbrev_size,
(unsigned long) debug_displays [abbrev_sec].section.size);
else
- process_abbrev_section
- (((unsigned char *) debug_displays [abbrev_sec].section.start
- + abbrev_base + compunit.cu_abbrev_offset),
- ((unsigned char *) debug_displays [abbrev_sec].section.start
- + abbrev_base + abbrev_size));
+ {
+ list = find_abbrev_list_by_abbrev_offset (compunit.cu_abbrev_offset);
+ if (list == NULL)
+ {
+ unsigned char * next;
+
+ list = new_abbrev_list (compunit.cu_abbrev_offset);
+ next = process_abbrev_set
+ (((unsigned char *) debug_displays [abbrev_sec].section.start
+ + abbrev_base + compunit.cu_abbrev_offset),
+ ((unsigned char *) debug_displays [abbrev_sec].section.start
+ + abbrev_base + abbrev_size),
+ list);
+ list->start_of_next_abbrevs = next;
+ }
+ }
level = 0;
last_level = level;
@@ -3532,11 +3828,13 @@ process_debug_info (struct dwarf_section
/* Scan through the abbreviation list until we reach the
correct entry. */
- for (entry = first_abbrev;
- entry && entry->entry != abbrev_number;
- entry = entry->next)
+ if (list == NULL)
continue;
+ for (entry = list->first_abbrev; entry != NULL; entry = entry->next)
+ if (entry->number == abbrev_number)
+ break;
+
if (entry == NULL)
{
if (!do_loc && do_printing)
@@ -5721,30 +6019,37 @@ display_debug_abbrev (struct dwarf_secti
{
abbrev_entry *entry;
unsigned char *start = section->start;
- unsigned char *end = start + section->size;
+ const unsigned char *end = start + section->size;
introduce (section, FALSE);
do
{
- unsigned char *last;
-
- free_abbrevs ();
+ abbrev_list * list;
+ dwarf_vma offset;
- last = start;
- start = process_abbrev_section (start, end);
+ offset = start - section->start;
+ list = find_abbrev_list_by_abbrev_offset (offset);
+ if (list == NULL)
+ {
+ list = new_abbrev_list (offset);
+ start = process_abbrev_set (start, end, list);
+ list->start_of_next_abbrevs = start;
+ }
+ else
+ start = list->start_of_next_abbrevs;
- if (first_abbrev == NULL)
+ if (list->first_abbrev == NULL)
continue;
- printf (_(" Number TAG (0x%lx)\n"), (long) (last - section->start));
+ printf (_(" Number TAG (0x%lx)\n"), (long) offset);
- for (entry = first_abbrev; entry; entry = entry->next)
+ for (entry = list->first_abbrev; entry; entry = entry->next)
{
abbrev_attr *attr;
printf (" %ld %s [%s]\n",
- entry->entry,
+ entry->number,
get_TAG_name (entry->tag),
entry->children ? _("has children") : _("no children"));
@@ -10776,8 +11081,12 @@ free_debug_memory (void)
{
unsigned int i;
- free_abbrevs ();
+ free_all_abbrevs ();
+ free (cu_abbrev_map);
+ cu_abbrev_map = NULL;
+ next_free_abbrev_map_entry = 0;
+
for (i = 0; i < max; i++)
free_debug_section ((enum dwarf_section_display_enum) i);
Only in binutils-2.35.1/binutils: dwarf.c.orig

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,36 @@
--- binutils.orig/bfd/elflink.c 2020-07-31 10:45:48.747912761 +0100
+++ binutils-2.35/bfd/elflink.c 2020-07-31 10:47:26.336262770 +0100
@@ -505,6 +505,16 @@ bfd_elf_link_record_dynamic_symbol (stru
const char *name;
size_t indx;
+ if (h->root.type == bfd_link_hash_defined
+ || h->root.type == bfd_link_hash_defweak)
+ {
+ /* An IR symbol should not be made dynamic. */
+ if (h->root.u.def.section != NULL
+ && h->root.u.def.section->owner != NULL
+ && (h->root.u.def.section->owner->flags & BFD_PLUGIN) != 0)
+ return TRUE;
+ }
+
/* XXX: The ABI draft says the linker must turn hidden and
internal symbols into STB_LOCAL symbols when producing the
DSO. However, if ld.so honors st_other in the dynamic table,
@@ -5199,15 +5209,11 @@ elf_link_add_object_symbols (bfd *abfd,
break;
}
- /* Don't add DT_NEEDED for references from the dummy bfd nor
- for unmatched symbol. */
if (!add_needed
&& matched
&& definition
&& ((dynsym
- && h->ref_regular_nonweak
- && (old_bfd == NULL
- || (old_bfd->flags & BFD_PLUGIN) == 0))
+ && h->ref_regular_nonweak)
|| (h->ref_dynamic_nonweak
&& (elf_dyn_lib_class (abfd) & DYN_AS_NEEDED) != 0
&& !on_needed_list (elf_dt_name (abfd),

View File

@ -223,35 +223,6 @@ diff -rup binutils-2.32.orig/ld/testsuite/ld-srec/srec.exp binutils-2.32/ld/test
proc srec_off { l } {
if [string match "S1*" $l] {
return 8
diff -rup binutils-2.32.orig/ld/testsuite/ld-x86-64/x86-64.exp binutils-2.32/ld/testsuite/ld-x86-64/x86-64.exp
--- binutils-2.32.orig/ld/testsuite/ld-x86-64/x86-64.exp 2019-02-15 13:33:22.030626874 +0000
+++ binutils-2.32/ld/testsuite/ld-x86-64/x86-64.exp 2019-02-15 13:57:34.295106041 +0000
@@ -1275,25 +1275,6 @@ if { [isnative] && [which $CC] != 0 } {
"$NOPIE_CFLAGS" \
] \
]
- } else {
- run_cc_link_tests [list \
- [list \
- "Build pr22001-1b" \
- "$NOPIE_LDFLAGS -Wl,-z,nocopyreloc,--no-as-needed tmpdir/pr22001-1.so" \
- "$NOPIE_CFLAGS -Wa,-mx86-used-note=yes" \
- { pr22001-1c.c } \
- {{error_output "pr22001-1b.err"}} \
- "pr22001-1b" \
- ] \
- [list \
- "Build pr21997-1b" \
- "$NOPIE_LDFLAGS -Wl,--no-as-needed tmpdir/pr21997-1.so" \
- "$NOPIE_CFLAGS -Wa,-mx86-used-note=yes" \
- { pr21997-1c.c } \
- {{error_output "pr21997-1b.err"}} \
- "pr21997-1b" \
- ] \
- ]
}
run_ld_link_exec_tests [list \
diff -rup binutils-2.32.orig/ld/testsuite/ld-plugin/plugin-10.d binutils-2.32/ld/testsuite/ld-plugin/plugin-10.d
--- binutils-2.32.orig/ld/testsuite/ld-plugin/plugin-10.d 2019-02-15 14:10:59.038709514 +0000
+++ binutils-2.32/ld/testsuite/ld-plugin/plugin-10.d 2019-02-15 14:13:53.532300721 +0000
@ -326,3 +297,34 @@ diff -rup binutils-2.32.orig/ld/testsuite/ld-plugin/plugin-8.d binutils-2.32/ld/
Sym: '_?func2' Resolution: LDPR_PREVAILING_DEF_IRONLY
#...
hook called: cleanup.
diff -rup binutils.orig/ld/testsuite/ld-elfvers/vers24.rd binutils-2.30/ld/testsuite/ld-elfvers/vers24.rd
--- binutils.orig/ld/testsuite/ld-elfvers/vers24.rd 2018-09-05 09:45:44.013108697 +0100
+++ binutils-2.30/ld/testsuite/ld-elfvers/vers24.rd 2018-09-05 12:06:17.287425232 +0100
@@ -7,9 +7,9 @@ Symbol table '.dynsym' contains [0-9]+ e
# And ensure the dynamic symbol table contains at least x@VERS.0
# and foo@@VERS.0 symbols
#...
- +[0-9]+: [0-9a-f]+ +(4 +OBJECT +GLOBAL +DEFAULT +[0-9]+ _?x|[0-9]+ +FUNC +GLOBAL +DEFAULT .* [0-9]+ _?foo@)@VERS\.0
+ +[0-9]+: [0-9a-f]+ +(4 +OBJECT +GLOBAL +DEFAULT +[0-9]+ _?x|[0-9]+ +FUNC +GLOBAL +DEFAULT .* [0-9]+ _?foo@)@VERS\.0.*
#...
- +[0-9]+: [0-9a-f]+ +(4 +OBJECT +GLOBAL +DEFAULT +[0-9]+ _?x|[0-9]+ +FUNC +GLOBAL +DEFAULT .* [0-9]+ _?foo@)@VERS\.0
+ +[0-9]+: [0-9a-f]+ +(4 +OBJECT +GLOBAL +DEFAULT +[0-9]+ _?x|[0-9]+ +FUNC +GLOBAL +DEFAULT .* [0-9]+ _?foo@)@VERS\.0.*
#...
Symbol table '.symtab' contains [0-9]+ entries:
#pass
diff -rup binutils.orig/ld/testsuite/ld-plugin/plugin.exp binutils-2.30/ld/testsuite/ld-plugin/plugin.exp
--- binutils.orig/ld/testsuite/ld-plugin/plugin.exp 2018-09-05 09:45:44.023108605 +0100
+++ binutils-2.30/ld/testsuite/ld-plugin/plugin.exp 2018-09-05 11:18:53.997202105 +0100
@@ -118,6 +118,12 @@ if { $can_compile && !$failed_compile }
}
}
+# I do not know why, but the underscore prefix test is going
+# wrong on ppc64le targets. So override it here.
+if { [istarget powerpc*-*-linux*] || [istarget x86_64*-*-linux*] } {
+ set _ ""
+}
+
set testobjfiles "tmpdir/main.o tmpdir/func.o tmpdir/text.o"
set testobjfiles_notext "tmpdir/main.o tmpdir/func.o"
set testsrcfiles "tmpdir/main.o $srcdir/$subdir/func.c tmpdir/text.o"

View File

@ -0,0 +1,11 @@
--- binutils.orig/gas/as.c 2020-07-30 08:41:25.034236441 +0100
+++ binutils-2.35/gas/as.c 2020-07-30 08:41:52.197058041 +0100
@@ -103,7 +103,7 @@ int verbose = 0;
int flag_dwarf_cie_version = -1;
/* The maximum level of DWARF DEBUG information we should manufacture. */
-unsigned int dwarf_level = 0;
+unsigned int dwarf_level = 3;
#if defined OBJ_ELF || defined OBJ_MAYBE_ELF
int flag_use_elf_stt_common = DEFAULT_GENERATE_ELF_STT_COMMON;

180
binutils-gcc-10-fixes.patch Normal file
View File

@ -0,0 +1,180 @@
diff -rup binutils.orig/gold/gdb-index.cc binutils-2.34.0/gold/gdb-index.cc
--- binutils.orig/gold/gdb-index.cc 2020-07-24 09:12:29.241306445 +0100
+++ binutils-2.34.0/gold/gdb-index.cc 2020-07-24 09:15:48.332095898 +0100
@@ -817,7 +817,7 @@ Gdb_index_info_reader::get_qualified_nam
void
Gdb_index_info_reader::record_cu_ranges(Dwarf_die* die)
{
- unsigned int shndx;
+ unsigned int shndx = 0;
unsigned int shndx2;
off_t ranges_offset = die->ref_attribute(elfcpp::DW_AT_ranges, &shndx);
diff -rup binutils.orig/gold/layout.cc binutils-2.34.0/gold/layout.cc
--- binutils.orig/gold/layout.cc 2020-07-24 09:12:29.243306433 +0100
+++ binutils-2.34.0/gold/layout.cc 2020-07-24 09:15:11.464320064 +0100
@@ -1986,7 +1986,7 @@ Layout::attach_allocated_section_to_segm
seg_flags |= os->extra_segment_flags();
// Check for --section-start.
- uint64_t addr;
+ uint64_t addr = 0;
bool is_address_set = parameters->options().section_start(os->name(), &addr);
// In general the only thing we really care about for PT_LOAD
diff -rup binutils.orig/binutils/dlltool.c binutils-2.34.0/binutils/dlltool.c
--- binutils.orig/binutils/dlltool.c 2020-07-24 09:12:28.974308069 +0100
+++ binutils-2.34.0/binutils/dlltool.c 2020-07-24 12:09:37.527121295 +0100
@@ -1305,7 +1305,7 @@ run (const char *what, char *args)
int pid, wait_status;
int i;
const char **argv;
- char *errmsg_fmt, *errmsg_arg;
+ char *errmsg_fmt = "", *errmsg_arg = "";
char *temp_base = choose_temp_base ();
inform (_("run: %s %s"), what, args);
diff -rup binutils.orig/gas/config/tc-arm.c binutils-2.34.0/gas/config/tc-arm.c
--- binutils.orig/gas/config/tc-arm.c 2020-07-24 09:12:32.368287432 +0100
+++ binutils-2.34.0/gas/config/tc-arm.c 2020-07-24 12:14:19.842360634 +0100
@@ -28416,9 +28416,12 @@ md_apply_fix (fixS * fixP,
perform relaxation. */
if (value == -2)
{
- newval = md_chars_to_number (buf, THUMB_SIZE);
- newval = 0xbf00; /* NOP encoding T1 */
- md_number_to_chars (buf, newval, THUMB_SIZE);
+ if (fixP->fx_done || !seg->use_rela_p)
+ {
+ newval = md_chars_to_number (buf, THUMB_SIZE);
+ newval = 0xbf00; /* NOP encoding T1 */
+ md_number_to_chars (buf, newval, THUMB_SIZE);
+ }
}
else
{
@@ -28631,17 +28634,14 @@ md_apply_fix (fixS * fixP,
case BFD_RELOC_ARM_GOTFUNCDESC:
case BFD_RELOC_ARM_GOTOFFFUNCDESC:
case BFD_RELOC_ARM_FUNCDESC:
- if (arm_fdpic)
- {
- if (fixP->fx_done || !seg->use_rela_p)
- md_number_to_chars (buf, 0, 4);
- }
- else
+ if (!arm_fdpic)
{
as_bad_where (fixP->fx_file, fixP->fx_line,
_("Relocation supported only in FDPIC mode"));
- }
- break;
+ break;
+ }
+ value = 0;
+ /* Fall through. */
#endif
case BFD_RELOC_RVA:
diff -rup binutils.orig/gas/config/tc-arm.c binutils-2.34.0/gas/config/tc-arm.c
--- binutils.orig/gas/config/tc-arm.c 2020-07-24 12:16:02.099719884 +0100
+++ binutils-2.34.0/gas/config/tc-arm.c 2020-07-24 12:34:17.690858328 +0100
@@ -28641,7 +28641,7 @@ md_apply_fix (fixS * fixP,
break;
}
value = 0;
- /* Fall through. */
+ goto fred;
#endif
case BFD_RELOC_RVA:
@@ -28653,6 +28653,7 @@ md_apply_fix (fixS * fixP,
#ifdef TE_PE
case BFD_RELOC_32_SECREL:
#endif
+ fred:
if (fixP->fx_done || !seg->use_rela_p)
#ifdef TE_WINCE
/* For WinCE we only do this for pcrel fixups. */
diff -rup binutils.orig/gas/config/tc-arm.c binutils-2.34.0/gas/config/tc-arm.c
--- binutils.orig/gas/config/tc-arm.c 2020-07-24 13:28:26.926553452 +0100
+++ binutils-2.34.0/gas/config/tc-arm.c 2020-07-24 13:31:57.835215763 +0100
@@ -28416,12 +28416,8 @@ md_apply_fix (fixS * fixP,
perform relaxation. */
if (value == -2)
{
- if (fixP->fx_done || !seg->use_rela_p)
- {
- newval = md_chars_to_number (buf, THUMB_SIZE);
- newval = 0xbf00; /* NOP encoding T1 */
- md_number_to_chars (buf, newval, THUMB_SIZE);
- }
+ newval = 0xbf00; /* NOP encoding T1 */
+ goto jim;
}
else
{
@@ -28432,6 +28428,7 @@ md_apply_fix (fixS * fixP,
{
newval = md_chars_to_number (buf, THUMB_SIZE);
newval |= ((value & 0x3e) << 2) | ((value & 0x40) << 3);
+ jim:
md_number_to_chars (buf, newval, THUMB_SIZE);
}
}
diff -rup binutils.orig/binutils/mclex.c binutils-2.34.0/binutils/mclex.c
--- binutils.orig/binutils/mclex.c 2020-07-24 13:28:26.297557441 +0100
+++ binutils-2.34.0/binutils/mclex.c 2020-07-24 14:46:53.587940149 +0100
@@ -207,7 +207,7 @@ enum_severity (int e)
static void
mc_add_keyword_ascii (const char *sz, int rid, const char *grp, rc_uint_type nv, const char *sv)
{
- unichar *usz, *usv = NULL;
+ unichar *usz = NULL, *usv = NULL;
rc_uint_type usz_len;
unicode_from_codepage (&usz_len, &usz, sz, CP_ACP);
diff -rup binutils.orig/binutils/windmc.c binutils-2.34.0/binutils/windmc.c
--- binutils.orig/binutils/windmc.c 2020-07-24 13:28:26.279557556 +0100
+++ binutils-2.34.0/binutils/windmc.c 2020-07-24 14:48:05.460477478 +0100
@@ -338,7 +338,7 @@ mc_add_node_lang (mc_node *root, const m
static char *
convert_unicode_to_ACP (const unichar *usz)
{
- char *s;
+ char *s = NULL;
rc_uint_type l;
if (! usz)
@@ -607,10 +607,10 @@ mc_generate_bin_item (mc_node_lang *n, r
else
{
rc_uint_type txt_len, l;
- char *cvt_txt;
+ char *cvt_txt = NULL;
codepage_from_unicode( &l, n->message, &cvt_txt, n->lang->lang_info.wincp);
- if (! cvt_txt)
+ if (cvt_txt == NULL)
fatal ("Failed to convert message to language codepage.\n");
txt_len = strlen (cvt_txt);
if (mcset_automatic_null_termination && txt_len > 0)
@@ -1107,7 +1107,7 @@ main (int argc, char **argv)
/* Load the input file and do code page transformations to UTF16. */
{
- unichar *u;
+ unichar *u = NULL;
rc_uint_type ul;
char *buff;
bfd_size_type flen;
--- binutils.orig/binutils/srconv.c 2020-07-24 15:37:25.847459208 +0100
+++ binutils-2.34.0/binutils/srconv.c 2020-07-24 15:39:12.853773423 +0100
@@ -316,6 +316,7 @@ wr_hd (struct coff_ofile *p)
struct IT_hd hd;
hd.spare1 = 0;
+ hd.spare2 = 0;
if (bfd_get_file_flags (abfd) & EXEC_P)
hd.mt = MTYPE_ABS_LM;
else

View File

@ -0,0 +1,181 @@
diff -rup binutils.orig/gold/testsuite/gnu_property_a.S binutils-2.35/gold/testsuite/gnu_property_a.S
--- binutils.orig/gold/testsuite/gnu_property_a.S 2021-01-18 14:01:41.228809868 +0000
+++ binutils-2.35/gold/testsuite/gnu_property_a.S 2021-01-18 14:01:52.542736705 +0000
@@ -1,8 +1,8 @@
#define NT_GNU_PROPERTY_TYPE_0 5
#define GNU_PROPERTY_STACK_SIZE 1
-#define GNU_PROPERTY_X86_ISA_1_USED 0xc0000000
-#define GNU_PROPERTY_X86_ISA_1_NEEDED 0xc0000001
+#define GNU_PROPERTY_X86_ISA_1_USED 0xc0010002
+#define GNU_PROPERTY_X86_ISA_1_NEEDED 0xc0008002
#define GNU_PROPERTY_X86_FEATURE_1_AND 0xc0000002
#if __SIZEOF_PTRDIFF_T__ == 8
diff -rup binutils.orig/gold/testsuite/gnu_property_b.S binutils-2.35/gold/testsuite/gnu_property_b.S
--- binutils.orig/gold/testsuite/gnu_property_b.S 2021-01-18 14:01:41.233809836 +0000
+++ binutils-2.35/gold/testsuite/gnu_property_b.S 2021-01-18 14:01:52.542736705 +0000
@@ -2,8 +2,8 @@
#define GNU_PROPERTY_STACK_SIZE 1
#define GNU_PROPERTY_NO_COPY_ON_PROTECTED 2
-#define GNU_PROPERTY_X86_ISA_1_USED 0xc0000000
-#define GNU_PROPERTY_X86_ISA_1_NEEDED 0xc0000001
+#define GNU_PROPERTY_X86_ISA_1_USED 0xc0010002
+#define GNU_PROPERTY_X86_ISA_1_NEEDED 0xc0008002
#define GNU_PROPERTY_X86_FEATURE_1_AND 0xc0000002
#if __SIZEOF_PTRDIFF_T__ == 8
diff -rup binutils.orig/gold/testsuite/gnu_property_c.S binutils-2.35/gold/testsuite/gnu_property_c.S
--- binutils.orig/gold/testsuite/gnu_property_c.S 2021-01-18 14:01:41.232809843 +0000
+++ binutils-2.35/gold/testsuite/gnu_property_c.S 2021-01-18 14:01:52.542736705 +0000
@@ -2,8 +2,8 @@
#define GNU_PROPERTY_STACK_SIZE 1
#define GNU_PROPERTY_NO_COPY_ON_PROTECTED 2
-#define GNU_PROPERTY_X86_ISA_1_USED 0xc0000000
-#define GNU_PROPERTY_X86_ISA_1_NEEDED 0xc0000001
+#define GNU_PROPERTY_X86_ISA_1_USED 0xc0010002
+#define GNU_PROPERTY_X86_ISA_1_NEEDED 0xc0008002
#define GNU_PROPERTY_X86_FEATURE_1_AND 0xc0000002
#if __SIZEOF_PTRDIFF_T__ == 8
diff -rup binutils.orig/gold/testsuite/gnu_property_test.sh binutils-2.35/gold/testsuite/gnu_property_test.sh
--- binutils.orig/gold/testsuite/gnu_property_test.sh 2021-01-18 14:01:41.236809817 +0000
+++ binutils-2.35/gold/testsuite/gnu_property_test.sh 2021-01-18 14:01:52.543736699 +0000
@@ -57,8 +57,8 @@ check_count gnu_property_test.stdout "GN
check gnu_property_test.stdout "stack size: 0x111100"
check gnu_property_test.stdout "no copy on protected"
-check gnu_property_test.stdout "x86 ISA used: i486, SSE2, SSE4_2, AVX512CD"
-check gnu_property_test.stdout "x86 ISA needed: i486, SSE2, SSE4_2, AVX512CD"
+check gnu_property_test.stdout "x86 ISA used: x86-64-v2, <unknown: 10>, <unknown: 100>, <unknown: 1000>"
+check gnu_property_test.stdout "x86 ISA needed: x86-64-v2, <unknown: 10>, <unknown: 100>, <unknown: 1000>"
check gnu_property_test.stdout "x86 feature: IBT"
exit 0
diff -rup binutils.orig/gold/x86_64.cc binutils-2.35/gold/x86_64.cc
--- binutils.orig/gold/x86_64.cc 2021-01-18 14:01:41.225809888 +0000
+++ binutils-2.35/gold/x86_64.cc 2021-01-18 14:01:52.543736699 +0000
@@ -706,8 +706,9 @@ class Target_x86_64 : public Sized_targe
rela_irelative_(NULL), copy_relocs_(elfcpp::R_X86_64_COPY),
got_mod_index_offset_(-1U), tlsdesc_reloc_info_(),
tls_base_symbol_defined_(false), isa_1_used_(0), isa_1_needed_(0),
- feature_1_(0), object_isa_1_used_(0), object_feature_1_(0),
- seen_first_object_(false)
+ 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)
{ }
// Hook for a new output section.
@@ -1382,6 +1383,8 @@ class Target_x86_64 : public Sized_targe
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
@@ -1391,6 +1394,7 @@ class Target_x86_64 : public Sized_targe
// 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_;
};
@@ -1594,9 +1598,15 @@ Target_x86_64<size>::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 "
@@ -1625,6 +1635,12 @@ Target_x86_64<size>::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;
}
}
@@ -1642,15 +1658,23 @@ Target_x86_64<size>::merge_gnu_propertie
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
@@ -1676,6 +1700,12 @@ Target_x86_64<size>::do_finalize_gnu_pro
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.
--- binutils.orig/elfcpp/elfcpp.h 2021-01-18 14:01:40.778812778 +0000
+++ binutils-2.35/elfcpp/elfcpp.h 2021-01-18 14:50:05.144035077 +0000
@@ -1009,9 +1009,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

View File

@ -1,10 +0,0 @@
--- binutils.orig/gold/target-reloc.h 2018-07-12 11:37:24.894494658 +0100
+++ binutils-2.30.90/gold/target-reloc.h 2018-07-12 15:38:50.049083904 +0100
@@ -136,6 +136,7 @@ class Default_comdat_behavior
if (Layout::is_debug_info_section(name))
return CB_PRETEND;
if (strcmp(name, ".eh_frame") == 0
+ || strncmp(name, ".gnu.build.attributes", 21) == 0 // FIXME: We should really be checking the section type for ST_NOTE...
|| strcmp(name, ".gcc_except_table") == 0)
return CB_IGNORE;
return CB_ERROR;

View File

@ -0,0 +1,66 @@
Only in binutils-2.34/gold: autom4te.cache
diff -rup binutils.orig/gold/configure binutils-2.34/gold/configure
--- binutils.orig/gold/configure 2020-04-20 12:35:13.048297305 +0100
+++ binutils-2.34/gold/configure 2020-04-20 14:02:06.743725696 +0100
@@ -5180,7 +5180,8 @@ for targ in $target $canon_targets; do
. ${srcdir}/configure.tgt
if test "$targ_obj" = "UNKNOWN"; then
- as_fn_error $? "\"unsupported target $targ\"" "$LINENO" 5
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: \"unsupported target $targ\"" >&5
+$as_echo "$as_me: WARNING: \"unsupported target $targ\"" >&2;}
else
targetobjs="$targetobjs ${targ_obj}.\$(OBJEXT)"
if test "$targ_extra_obj" != ""; then
diff -rup binutils.orig/gold/configure.ac binutils-2.34/gold/configure.ac
--- binutils.orig/gold/configure.ac 2020-04-20 12:35:13.050297291 +0100
+++ binutils-2.34/gold/configure.ac 2020-04-20 14:01:46.435868770 +0100
@@ -181,7 +181,7 @@ for targ in $target $canon_targets; do
. ${srcdir}/configure.tgt
if test "$targ_obj" = "UNKNOWN"; then
- AC_MSG_ERROR("unsupported target $targ")
+ AC_MSG_WARN("unsupported target $targ")
else
targetobjs="$targetobjs ${targ_obj}.\$(OBJEXT)"
if test "$targ_extra_obj" != ""; then
--- binutils.orig/ld/configure.tgt 2020-04-20 12:35:12.465301359 +0100
+++ binutils-2.34/ld/configure.tgt 2020-04-20 14:17:52.123066333 +0100
@@ -220,7 +220,7 @@ bfin-*-linux-uclibc*) targ_emul=elf32bfi
targ_extra_emuls="elf32bfin"
targ_extra_libpath=$targ_extra_emuls
;;
-bpf-*-*) targ_emul=elf64bpf
+bpf-* | bpf-*-*) targ_emul=elf64bpf
;;
cr16-*-elf*) targ_emul=elf32cr16
;;
@@ -1026,7 +1026,7 @@ z8k-*-coff) targ_emul=z8002
targ_extra_ofiles=
;;
*)
- echo 2>&1 "*** ld does not support target ${targ}"
+ echo 2>&1 "*** ld does not support target '${targ}' NO REALLY"
echo 2>&1 "*** see ld/configure.tgt for supported targets"
exit 1
--- binutils.orig/bfd/config.bfd 2020-04-20 12:35:13.038297375 +0100
+++ binutils-2.34/bfd/config.bfd 2020-04-20 14:25:26.452869193 +0100
@@ -473,7 +473,7 @@ case "${targ}" in
;;
#ifdef BFD64
- bpf-*-none)
+ bpf-*-none | bpf-*)
targ_defvec=bpf_elf64_le_vec
targ_selvecs=bpf_elf64_be_vec
targ_underscore=yes
@@ -1427,7 +1427,7 @@ case "${targ}" in
;;
*)
- echo 1>&2 "*** BFD does not support target ${targ}."
+ echo 1>&2 "*** BFD does not support target '${targ}'. Honest."
echo 1>&2 "*** Look in bfd/config.bfd for supported targets."
exit 1
;;

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,73 @@
diff -rup binutils.orig/bfd/elflink.c binutils-2.35.1/bfd/elflink.c
--- binutils.orig/bfd/elflink.c 2020-10-29 12:46:32.228618844 +0000
+++ binutils-2.35.1/bfd/elflink.c 2020-10-29 13:07:58.786847312 +0000
@@ -5340,7 +5340,7 @@ elf_link_add_object_symbols (bfd *abfd,
struct elf_link_hash_entry *h;
bfd_size_type size;
unsigned int alignment_power;
- unsigned int non_ir_ref_dynamic;
+ struct elf_link_hash_entry preserved_h;
for (p = htab->root.table.table[i]; p != NULL; p = p->next)
{
@@ -5365,7 +5365,8 @@ elf_link_add_object_symbols (bfd *abfd,
/* Preserve non_ir_ref_dynamic so that this symbol
will be exported when the dynamic lib becomes needed
in the second pass. */
- non_ir_ref_dynamic = h->root.non_ir_ref_dynamic;
+ preserved_h = *h;
+
memcpy (p, old_ent, htab->root.table.entsize);
old_ent = (char *) old_ent + htab->root.table.entsize;
h = (struct elf_link_hash_entry *) p;
@@ -5382,7 +5383,10 @@ elf_link_add_object_symbols (bfd *abfd,
if (alignment_power > h->root.u.c.p->alignment_power)
h->root.u.c.p->alignment_power = alignment_power;
}
- h->root.non_ir_ref_dynamic = non_ir_ref_dynamic;
+
+ h->root.non_ir_ref_dynamic
+ = preserved_h.root.non_ir_ref_dynamic;
+ h->root.as_needed_def_dynamic |= preserved_h.dynamic_def;
}
}
@@ -5819,6 +5823,11 @@ elf_link_add_archive_symbols (bfd *abfd,
if (h == NULL)
continue;
+ /* Don't load the archive element after seeing a definition
+ in a DT_NEEDED shared object. */
+ if (h->root.as_needed_def_dynamic)
+ continue;
+
if (h->root.type == bfd_link_hash_undefined)
{
/* If the archive element has already been loaded then one
Only in binutils.orig/: binutils-2.35.1
diff -rup binutils.orig/include/bfdlink.h binutils-2.35.1/include/bfdlink.h
--- binutils.orig/include/bfdlink.h 2020-10-29 12:46:31.611621137 +0000
+++ binutils-2.35.1/include/bfdlink.h 2020-10-29 13:07:36.833927443 +0000
@@ -114,6 +114,9 @@ struct bfd_link_hash_entry
as distinct from a LTO IR object file. */
unsigned int non_ir_ref_dynamic : 1;
+ /* Symbol is defined in a DT_NEEDED dynamic object file. */
+ unsigned int as_needed_def_dynamic : 1;
+
/* Symbol is a built-in define. These will be overridden by PROVIDE
in a linker script. */
unsigned int linker_def : 1;
diff -rup binutils.orig/ld/plugin.c binutils-2.35.1/ld/plugin.c
--- binutils.orig/ld/plugin.c 2020-10-29 12:46:31.878620145 +0000
+++ binutils-2.35.1/ld/plugin.c 2020-10-29 13:07:19.951989072 +0000
@@ -794,7 +794,8 @@ get_symbols (const void *handle, int nsy
if (blhe->type == bfd_link_hash_undefined
|| blhe->type == bfd_link_hash_undefweak)
{
- res = LDPR_UNDEF;
+ res = (blhe->as_needed_def_dynamic
+ ? LDPR_RESOLVED_DYN : LDPR_UNDEF);
goto report_symbol;
}
if (blhe->type != bfd_link_hash_defined

View File

@ -1,25 +1,24 @@
diff -rup binutils.orig/binutils/readelf.c binutils-2.29/binutils/readelf.c
--- binutils.orig/binutils/readelf.c 2017-12-12 16:24:19.571221194 +0000
+++ binutils-2.29/binutils/readelf.c 2017-12-12 16:27:26.997979803 +0000
@@ -11018,12 +11018,14 @@ print_dynamic_symbol (bfd_vma si, unsign
--- binutils.orig/binutils/readelf.c 2020-07-24 15:08:30.317597020 +0100
+++ binutils-2.35/binutils/readelf.c 2020-07-24 15:09:39.029155552 +0100
@@ -12069,11 +12069,13 @@ print_dynamic_symbol (Filedata *filedata
unsigned int vis = ELF_ST_VISIBILITY (psym->st_other);
printf (" %-7s", get_symbol_visibility (vis));
printf (" %-7s", get_symbol_visibility (vis));
+#if 0
/* Check to see if any other bits in the st_other field are set.
Note - displaying this information disrupts the layout of the
table being generated, but for the moment this case is very
rare. */
table being generated, but for the moment this case is very rare. */
if (psym->st_other ^ vis)
printf (" [%s] ", get_symbol_other (filedata, psym->st_other ^ vis));
+#endif
}
printf (" %4s ", get_symbol_index_type (filedata, psym->st_shndx));
printf (" %3.3s ", get_symbol_index_type (filedata, psym->st_shndx));
@@ -11031,6 +11033,15 @@ print_dynamic_symbol (bfd_vma si, unsign
print_symbol (25, GET_DYNAMIC_NAME (psym->st_name));
else
printf (_(" <corrupt: %14ld>"), psym->st_name);
@@ -12112,7 +12114,17 @@ print_dynamic_symbol (Filedata *filedata
version_string);
}
- putchar ('\n');
+#if 1
+ {
+ unsigned int vis = ELF_ST_VISIBILITY (psym->st_other);
@ -29,38 +28,8 @@ diff -rup binutils.orig/binutils/readelf.c binutils-2.29/binutils/readelf.c
+ printf (" \t[%s]", get_symbol_other (filedata, psym->st_other ^ vis));
+ }
+#endif
putchar ('\n');
}
+
+ putchar ('\n');
--- binutils.orig/binutils/readelf.c 2017-12-12 16:36:21.806561149 +0000
+++ binutils-2.29.1/binutils/readelf.c 2017-12-12 16:38:17.763168514 +0000
@@ -11548,11 +11548,13 @@ process_symbol_table (FILE * file)
unsigned int vis = ELF_ST_VISIBILITY (psym->st_other);
printf (" %-7s", get_symbol_visibility (vis));
+#if 0
/* Check to see if any other bits in the st_other field are set.
Note - displaying this information disrupts the layout of the
table being generated, but for the moment this case is very rare. */
if (psym->st_other ^ vis)
printf (" [%s] ", get_symbol_other (filedata, psym->st_other ^ vis));
+#endif
}
printf (" %4s ", get_symbol_index_type (filedata, psym->st_shndx));
print_symbol (25, psym->st_name < strtab_size
@@ -11571,7 +11573,15 @@ process_symbol_table (FILE * file)
printf (sym_info == symbol_hidden ? "@%s" : "@@%s",
version_string);
}
+#if 1
+ {
+ unsigned int vis = ELF_ST_VISIBILITY (psym->st_other);
+ /* Check to see if any other bits in the st_other field are set. */
+ if (psym->st_other ^ vis)
+ printf (" \t[%s] ", get_symbol_other (filedata, psym->st_other ^ vis));
+ }
+#endif
putchar ('\n');
if (ELF_ST_BIND (psym->st_info) == STB_LOCAL
if (ELF_ST_BIND (psym->st_info) == STB_LOCAL
&& section != NULL

772
binutils-s390-build.patch Normal file
View File

@ -0,0 +1,772 @@
diff -rup binutils.orig/libctf/ctf-create.c binutils-2.34.0/libctf/ctf-create.c
--- binutils.orig/libctf/ctf-create.c 2020-06-16 12:06:28.466468753 +0100
+++ binutils-2.34.0/libctf/ctf-create.c 2020-06-16 12:16:19.744482839 +0100
@@ -871,7 +871,8 @@ ctf_add_encoded (ctf_file_t *fp, uint32_
if ((type = ctf_add_generic (fp, flag, name, kind, &dtd)) == CTF_ERR)
return CTF_ERR; /* errno is set for us. */
-
+ if (dtd == NULL)
+ return CTF_ERR;
dtd->dtd_data.ctt_info = CTF_TYPE_INFO (kind, flag, 0);
dtd->dtd_data.ctt_size = clp2 (P2ROUNDUP (ep->cte_bits, CHAR_BIT)
/ CHAR_BIT);
@@ -896,6 +897,8 @@ ctf_add_reftype (ctf_file_t *fp, uint32_
if ((type = ctf_add_generic (fp, flag, NULL, kind, &dtd)) == CTF_ERR)
return CTF_ERR; /* errno is set for us. */
+ if (dtd == NULL)
+ return CTF_ERR;
dtd->dtd_data.ctt_info = CTF_TYPE_INFO (kind, flag, 0);
dtd->dtd_data.ctt_type = (uint32_t) ref;
@@ -958,6 +961,8 @@ ctf_add_slice (ctf_file_t *fp, uint32_t
if ((type = ctf_add_generic (fp, flag, NULL, CTF_K_SLICE, &dtd)) == CTF_ERR)
return CTF_ERR; /* errno is set for us. */
+ if (dtd == NULL)
+ return CTF_ERR;
dtd->dtd_data.ctt_info = CTF_TYPE_INFO (CTF_K_SLICE, flag, 0);
dtd->dtd_data.ctt_size = clp2 (P2ROUNDUP (ep->cte_bits, CHAR_BIT)
@@ -1008,6 +1013,8 @@ ctf_add_array (ctf_file_t *fp, uint32_t
if ((type = ctf_add_generic (fp, flag, NULL, CTF_K_ARRAY, &dtd)) == CTF_ERR)
return CTF_ERR; /* errno is set for us. */
+ if (dtd == NULL)
+ return CTF_ERR;
dtd->dtd_data.ctt_info = CTF_TYPE_INFO (CTF_K_ARRAY, flag, 0);
dtd->dtd_data.ctt_size = 0;
@@ -1075,6 +1082,8 @@ ctf_add_function (ctf_file_t *fp, uint32
free (vdat);
return CTF_ERR; /* errno is set for us. */
}
+ if (dtd == NULL)
+ return CTF_ERR;
dtd->dtd_data.ctt_info = CTF_TYPE_INFO (CTF_K_FUNCTION, flag, vlen);
dtd->dtd_data.ctt_type = (uint32_t) ctc->ctc_return;
@@ -1104,6 +1113,8 @@ ctf_add_struct_sized (ctf_file_t *fp, ui
else if ((type = ctf_add_generic (fp, flag, name, CTF_K_STRUCT,
&dtd)) == CTF_ERR)
return CTF_ERR; /* errno is set for us. */
+ if (dtd == NULL)
+ return CTF_ERR;
dtd->dtd_data.ctt_info = CTF_TYPE_INFO (CTF_K_STRUCT, flag, 0);
@@ -1141,6 +1152,8 @@ ctf_add_union_sized (ctf_file_t *fp, uin
else if ((type = ctf_add_generic (fp, flag, name, CTF_K_UNION,
&dtd)) == CTF_ERR)
return CTF_ERR; /* errno is set for us */
+ if (dtd == NULL)
+ return CTF_ERR;
dtd->dtd_data.ctt_info = CTF_TYPE_INFO (CTF_K_UNION, flag, 0);
@@ -1177,6 +1190,8 @@ ctf_add_enum (ctf_file_t *fp, uint32_t f
else if ((type = ctf_add_generic (fp, flag, name, CTF_K_ENUM,
&dtd)) == CTF_ERR)
return CTF_ERR; /* errno is set for us. */
+ if (dtd == NULL)
+ return CTF_ERR;
dtd->dtd_data.ctt_info = CTF_TYPE_INFO (CTF_K_ENUM, flag, 0);
dtd->dtd_data.ctt_size = fp->ctf_dmodel->ctd_int;
diff -rup binutils.orig/libctf/ctf-types.c binutils-2.34.0/libctf/ctf-types.c
--- binutils.orig/libctf/ctf-types.c 2020-06-16 12:06:28.466468753 +0100
+++ binutils-2.34.0/libctf/ctf-types.c 2020-06-16 12:10:58.033563365 +0100
@@ -748,7 +748,7 @@ ctf_type_encoding (ctf_file_t *fp, ctf_i
case CTF_K_SLICE:
{
const ctf_slice_t *slice;
- ctf_encoding_t underlying_en;
+ ctf_encoding_t underlying_en = {0};
slice = &dtd->dtd_u.dtu_slice;
data = ctf_type_encoding (fp, slice->cts_type, &underlying_en);
diff -rup binutils.orig/opcodes/s390-mkopc.c binutils-2.34.0/opcodes/s390-mkopc.c
--- binutils.orig/opcodes/s390-mkopc.c 2020-06-16 12:06:28.447468816 +0100
+++ binutils-2.34.0/opcodes/s390-mkopc.c 2020-06-16 12:17:10.783311417 +0100
@@ -168,7 +168,7 @@ insertExpandedMnemonic (char *opcode, ch
int mask_start, i = 0, tag_found = 0, reading_number = 0;
int number_p = 0, suffix_p = 0, prefix_p = 0;
const struct s390_cond_ext_format *ext_table;
- int ext_table_length;
+ int ext_table_length = 0;
if (!(tag = strpbrk (mnemonic, "*$")))
{
Only in binutils.orig/libctf: .#ctf-create.c
diff -rup binutils.orig/libctf/ctf-create.c binutils-2.34.0/libctf/ctf-create.c
--- binutils.orig/libctf/ctf-create.c 2020-06-16 14:49:06.080801319 +0100
+++ binutils-2.34.0/libctf/ctf-create.c 2020-06-16 14:49:08.046794113 +0100
@@ -798,6 +798,7 @@ ctf_add_generic (ctf_file_t *fp, uint32_
{
ctf_dtdef_t *dtd;
ctf_id_t type;
+ *rp = NULL;
if (flag != CTF_ADD_NONROOT && flag != CTF_ADD_ROOT)
return (ctf_set_errno (fp, EINVAL));
diff -rup binutils.orig/opcodes/fr30-ibld.c binutils-2.34.0/opcodes/fr30-ibld.c
--- binutils.orig/opcodes/fr30-ibld.c 2020-06-16 14:49:06.074801341 +0100
+++ binutils-2.34.0/opcodes/fr30-ibld.c 2020-06-16 16:43:31.428324833 +0100
@@ -810,7 +810,7 @@ fr30_cgen_extract_operand (CGEN_CPU_DESC
break;
case FR30_OPERAND_DIR10 :
{
- long value;
+ long value = 0;
length = extract_normal (cd, ex_info, insn_value, 0, 0, 8, 8, 16, total_length, pc, & value);
value = ((value) << (2));
fields->f_dir10 = value;
@@ -821,7 +821,7 @@ fr30_cgen_extract_operand (CGEN_CPU_DESC
break;
case FR30_OPERAND_DIR9 :
{
- long value;
+ long value = 0;
length = extract_normal (cd, ex_info, insn_value, 0, 0, 8, 8, 16, total_length, pc, & value);
value = ((value) << (1));
fields->f_dir9 = value;
@@ -829,7 +829,7 @@ fr30_cgen_extract_operand (CGEN_CPU_DESC
break;
case FR30_OPERAND_DISP10 :
{
- long value;
+ long value = 0;
length = extract_normal (cd, ex_info, insn_value, 0|(1<<CGEN_IFLD_SIGNED), 0, 4, 8, 16, total_length, pc, & value);
value = ((value) * (4));
fields->f_disp10 = value;
@@ -840,7 +840,7 @@ fr30_cgen_extract_operand (CGEN_CPU_DESC
break;
case FR30_OPERAND_DISP9 :
{
- long value;
+ long value = 0;
length = extract_normal (cd, ex_info, insn_value, 0|(1<<CGEN_IFLD_SIGNED), 0, 4, 8, 16, total_length, pc, & value);
value = ((value) * (2));
fields->f_disp9 = value;
@@ -865,7 +865,7 @@ fr30_cgen_extract_operand (CGEN_CPU_DESC
break;
case FR30_OPERAND_LABEL12 :
{
- long value;
+ long value = 0;
length = extract_normal (cd, ex_info, insn_value, 0|(1<<CGEN_IFLD_SIGNED)|(1<<CGEN_IFLD_PCREL_ADDR), 0, 5, 11, 16, total_length, pc, & value);
value = ((((value) * (2))) + (((pc) + (2))));
fields->f_rel12 = value;
@@ -873,7 +873,7 @@ fr30_cgen_extract_operand (CGEN_CPU_DESC
break;
case FR30_OPERAND_LABEL9 :
{
- long value;
+ long value = 0;
length = extract_normal (cd, ex_info, insn_value, 0|(1<<CGEN_IFLD_SIGNED)|(1<<CGEN_IFLD_PCREL_ADDR), 0, 8, 8, 16, total_length, pc, & value);
value = ((((value) * (2))) + (((pc) + (2))));
fields->f_rel9 = value;
@@ -881,7 +881,7 @@ fr30_cgen_extract_operand (CGEN_CPU_DESC
break;
case FR30_OPERAND_M4 :
{
- long value;
+ long value = 0;
length = extract_normal (cd, ex_info, insn_value, 0, 0, 8, 4, 16, total_length, pc, & value);
value = ((value) | (-16));
fields->f_m4 = value;
@@ -911,7 +911,7 @@ fr30_cgen_extract_operand (CGEN_CPU_DESC
break;
case FR30_OPERAND_U10 :
{
- long value;
+ long value = 0;
length = extract_normal (cd, ex_info, insn_value, 0, 0, 8, 8, 16, total_length, pc, & value);
value = ((value) << (2));
fields->f_u10 = value;
@@ -928,7 +928,7 @@ fr30_cgen_extract_operand (CGEN_CPU_DESC
break;
case FR30_OPERAND_UDISP6 :
{
- long value;
+ long value = 0;
length = extract_normal (cd, ex_info, insn_value, 0, 0, 8, 4, 16, total_length, pc, & value);
value = ((value) << (2));
fields->f_udisp6 = value;
diff -rup binutils.orig/opcodes/fr30-ibld.c binutils-2.34.0/opcodes/fr30-ibld.c
--- binutils.orig/opcodes/fr30-ibld.c 2020-06-16 17:10:22.540563440 +0100
+++ binutils-2.34.0/opcodes/fr30-ibld.c 2020-06-16 17:10:48.966468906 +0100
@@ -903,7 +903,7 @@ fr30_cgen_extract_operand (CGEN_CPU_DESC
break;
case FR30_OPERAND_S10 :
{
- long value;
+ long value = 0;
length = extract_normal (cd, ex_info, insn_value, 0|(1<<CGEN_IFLD_SIGNED), 0, 8, 8, 16, total_length, pc, & value);
value = ((value) * (4));
fields->f_s10 = value;
Only in binutils-2.34.0/opcodes: fr30-ibld.c~
--- binutils.orig/opcodes/m32c-ibld.c 2020-06-16 17:10:22.531563472 +0100
+++ binutils-2.34.0/opcodes/m32c-ibld.c 2020-06-16 17:25:48.612258094 +0100
@@ -1805,7 +1805,7 @@ m32c_cgen_extract_operand (CGEN_CPU_DESC
break;
case M32C_OPERAND_BIT32RNPREFIXED :
{
- long value;
+ long value = 0;
length = extract_normal (cd, ex_info, insn_value, 0, 0, 16, 2, 32, total_length, pc, & value);
value = (((((~ (((USI) (value) >> (1))))) & (1))) | (((((value) << (1))) & (2))));
fields->f_dst32_rn_prefixed_QI = value;
@@ -1813,7 +1813,7 @@ m32c_cgen_extract_operand (CGEN_CPU_DESC
break;
case M32C_OPERAND_BIT32RNUNPREFIXED :
{
- long value;
+ long value = 0;
length = extract_normal (cd, ex_info, insn_value, 0, 0, 8, 2, 32, total_length, pc, & value);
value = (((((~ (((USI) (value) >> (1))))) & (1))) | (((((value) << (1))) & (2))));
fields->f_dst32_rn_unprefixed_QI = value;
@@ -1824,7 +1824,7 @@ m32c_cgen_extract_operand (CGEN_CPU_DESC
break;
case M32C_OPERAND_BITBASE16_16_U16 :
{
- long value;
+ long value = 0;
length = extract_normal (cd, ex_info, insn_value, 0, 0, 16, 16, 32, total_length, pc, & value);
value = ((((((UHI) (value) >> (8))) & (255))) | (((((value) & (255))) << (8))));
fields->f_dsp_16_u16 = value;
@@ -1860,7 +1860,7 @@ m32c_cgen_extract_operand (CGEN_CPU_DESC
length = extract_normal (cd, ex_info, insn_value, 0, 0, 13, 3, 32, total_length, pc, & fields->f_bitno32_unprefixed);
if (length <= 0) break;
{
- long value;
+ long value = 0;
length = extract_normal (cd, ex_info, insn_value, 0|(1<<CGEN_IFLD_SIGNED), 0, 16, 16, 32, total_length, pc, & value);
value = EXTHISI (((HI) (INT) (((((((UINT) (value) >> (8))) & (255))) | (((((value) & (255))) << (8)))))));
fields->f_dsp_16_s16 = value;
@@ -1887,7 +1887,7 @@ m32c_cgen_extract_operand (CGEN_CPU_DESC
length = extract_normal (cd, ex_info, insn_value, 0, 0, 13, 3, 32, total_length, pc, & fields->f_bitno32_unprefixed);
if (length <= 0) break;
{
- long value;
+ long value = 0;
length = extract_normal (cd, ex_info, insn_value, 0, 0, 16, 16, 32, total_length, pc, & value);
value = ((((((UHI) (value) >> (8))) & (255))) | (((((value) & (255))) << (8))));
fields->f_dsp_16_u16 = value;
@@ -1903,7 +1903,7 @@ m32c_cgen_extract_operand (CGEN_CPU_DESC
length = extract_normal (cd, ex_info, insn_value, 0, 0, 13, 3, 32, total_length, pc, & fields->f_bitno32_unprefixed);
if (length <= 0) break;
{
- long value;
+ long value = 0;
length = extract_normal (cd, ex_info, insn_value, 0, 0, 16, 16, 32, total_length, pc, & value);
value = ((((((UHI) (value) >> (8))) & (255))) | (((((value) & (255))) << (8))));
fields->f_dsp_16_u16 = value;
@@ -1971,7 +1971,7 @@ m32c_cgen_extract_operand (CGEN_CPU_DESC
length = extract_normal (cd, ex_info, insn_value, 0, 0, 24, 8, 32, total_length, pc, & fields->f_dsp_24_u8);
if (length <= 0) break;
{
- long value;
+ long value = 0;
length = extract_normal (cd, ex_info, insn_value, 0, 32, 0, 16, 32, total_length, pc, & value);
value = ((((((UHI) (value) >> (8))) & (255))) | (((((value) & (255))) << (8))));
fields->f_dsp_32_u16 = value;
@@ -1996,7 +1996,7 @@ m32c_cgen_extract_operand (CGEN_CPU_DESC
break;
case M32C_OPERAND_DSP_16_S16 :
{
- long value;
+ long value = 0;
length = extract_normal (cd, ex_info, insn_value, 0|(1<<CGEN_IFLD_SIGNED), 0, 16, 16, 32, total_length, pc, & value);
value = EXTHISI (((HI) (INT) (((((((UINT) (value) >> (8))) & (255))) | (((((value) & (255))) << (8)))))));
fields->f_dsp_16_s16 = value;
@@ -2007,7 +2007,7 @@ m32c_cgen_extract_operand (CGEN_CPU_DESC
break;
case M32C_OPERAND_DSP_16_U16 :
{
- long value;
+ long value = 0;
length = extract_normal (cd, ex_info, insn_value, 0, 0, 16, 16, 32, total_length, pc, & value);
value = ((((((UHI) (value) >> (8))) & (255))) | (((((value) & (255))) << (8))));
fields->f_dsp_16_u16 = value;
@@ -2016,7 +2016,7 @@ m32c_cgen_extract_operand (CGEN_CPU_DESC
case M32C_OPERAND_DSP_16_U20 :
{
{
- long value;
+ long value = 0;
length = extract_normal (cd, ex_info, insn_value, 0, 0, 16, 16, 32, total_length, pc, & value);
value = ((((((UHI) (value) >> (8))) & (255))) | (((((value) & (255))) << (8))));
fields->f_dsp_16_u16 = value;
@@ -2032,7 +2032,7 @@ m32c_cgen_extract_operand (CGEN_CPU_DESC
case M32C_OPERAND_DSP_16_U24 :
{
{
- long value;
+ long value = 0;
length = extract_normal (cd, ex_info, insn_value, 0, 0, 16, 16, 32, total_length, pc, & value);
value = ((((((UHI) (value) >> (8))) & (255))) | (((((value) & (255))) << (8))));
fields->f_dsp_16_u16 = value;
@@ -2078,7 +2078,7 @@ m32c_cgen_extract_operand (CGEN_CPU_DESC
length = extract_normal (cd, ex_info, insn_value, 0, 0, 24, 8, 32, total_length, pc, & fields->f_dsp_24_u8);
if (length <= 0) break;
{
- long value;
+ long value = 0;
length = extract_normal (cd, ex_info, insn_value, 0, 32, 0, 16, 32, total_length, pc, & value);
value = ((((((UHI) (value) >> (8))) & (255))) | (((((value) & (255))) << (8))));
fields->f_dsp_32_u16 = value;
@@ -2094,7 +2094,7 @@ m32c_cgen_extract_operand (CGEN_CPU_DESC
length = extract_normal (cd, ex_info, insn_value, 0, 0, 24, 8, 32, total_length, pc, & fields->f_dsp_24_u8);
if (length <= 0) break;
{
- long value;
+ long value = 0;
length = extract_normal (cd, ex_info, insn_value, 0, 32, 0, 16, 32, total_length, pc, & value);
value = ((((((UHI) (value) >> (8))) & (255))) | (((((value) & (255))) << (8))));
fields->f_dsp_32_u16 = value;
@@ -2110,7 +2110,7 @@ m32c_cgen_extract_operand (CGEN_CPU_DESC
break;
case M32C_OPERAND_DSP_32_S16 :
{
- long value;
+ long value = 0;
length = extract_normal (cd, ex_info, insn_value, 0|(1<<CGEN_IFLD_SIGNED), 32, 0, 16, 32, total_length, pc, & value);
value = EXTHISI (((HI) (INT) (((((((UINT) (value) >> (8))) & (255))) | (((((value) & (255))) << (8)))))));
fields->f_dsp_32_s16 = value;
@@ -2121,7 +2121,7 @@ m32c_cgen_extract_operand (CGEN_CPU_DESC
break;
case M32C_OPERAND_DSP_32_U16 :
{
- long value;
+ long value = 0;
length = extract_normal (cd, ex_info, insn_value, 0, 32, 0, 16, 32, total_length, pc, & value);
value = ((((((UHI) (value) >> (8))) & (255))) | (((((value) & (255))) << (8))));
fields->f_dsp_32_u16 = value;
@@ -2129,7 +2129,7 @@ m32c_cgen_extract_operand (CGEN_CPU_DESC
break;
case M32C_OPERAND_DSP_32_U20 :
{
- long value;
+ long value = 0;
length = extract_normal (cd, ex_info, insn_value, 0, 32, 0, 24, 32, total_length, pc, & value);
value = ((((((((USI) (value) >> (16))) & (255))) | (((value) & (65280))))) | (((((value) << (16))) & (16711680))));
fields->f_dsp_32_u24 = value;
@@ -2137,7 +2137,7 @@ m32c_cgen_extract_operand (CGEN_CPU_DESC
break;
case M32C_OPERAND_DSP_32_U24 :
{
- long value;
+ long value = 0;
length = extract_normal (cd, ex_info, insn_value, 0, 32, 0, 24, 32, total_length, pc, & value);
value = ((((((((USI) (value) >> (16))) & (255))) | (((value) & (65280))))) | (((((value) << (16))) & (16711680))));
fields->f_dsp_32_u24 = value;
@@ -2148,7 +2148,7 @@ m32c_cgen_extract_operand (CGEN_CPU_DESC
break;
case M32C_OPERAND_DSP_40_S16 :
{
- long value;
+ long value = 0;
length = extract_normal (cd, ex_info, insn_value, 0|(1<<CGEN_IFLD_SIGNED), 32, 8, 16, 32, total_length, pc, & value);
value = EXTHISI (((HI) (INT) (((((((UINT) (value) >> (8))) & (255))) | (((((value) & (255))) << (8)))))));
fields->f_dsp_40_s16 = value;
@@ -2159,7 +2159,7 @@ m32c_cgen_extract_operand (CGEN_CPU_DESC
break;
case M32C_OPERAND_DSP_40_U16 :
{
- long value;
+ long value = 0;
length = extract_normal (cd, ex_info, insn_value, 0, 32, 8, 16, 32, total_length, pc, & value);
value = ((((((UHI) (value) >> (8))) & (255))) | (((((value) & (255))) << (8))));
fields->f_dsp_40_u16 = value;
@@ -2167,7 +2167,7 @@ m32c_cgen_extract_operand (CGEN_CPU_DESC
break;
case M32C_OPERAND_DSP_40_U20 :
{
- long value;
+ long value = 0;
length = extract_normal (cd, ex_info, insn_value, 0, 32, 8, 20, 32, total_length, pc, & value);
value = ((((((((USI) (value) >> (16))) & (255))) | (((value) & (65280))))) | (((((value) << (16))) & (983040))));
fields->f_dsp_40_u20 = value;
@@ -2175,7 +2175,7 @@ m32c_cgen_extract_operand (CGEN_CPU_DESC
break;
case M32C_OPERAND_DSP_40_U24 :
{
- long value;
+ long value = 0;
length = extract_normal (cd, ex_info, insn_value, 0, 32, 8, 24, 32, total_length, pc, & value);
value = ((((((((USI) (value) >> (16))) & (255))) | (((value) & (65280))))) | (((((value) << (16))) & (16711680))));
fields->f_dsp_40_u24 = value;
@@ -2186,7 +2186,7 @@ m32c_cgen_extract_operand (CGEN_CPU_DESC
break;
case M32C_OPERAND_DSP_48_S16 :
{
- long value;
+ long value = 0;
length = extract_normal (cd, ex_info, insn_value, 0|(1<<CGEN_IFLD_SIGNED), 32, 16, 16, 32, total_length, pc, & value);
value = EXTHISI (((HI) (INT) (((((((UINT) (value) >> (8))) & (255))) | (((((value) & (255))) << (8)))))));
fields->f_dsp_48_s16 = value;
@@ -2197,7 +2197,7 @@ m32c_cgen_extract_operand (CGEN_CPU_DESC
break;
case M32C_OPERAND_DSP_48_U16 :
{
- long value;
+ long value = 0;
length = extract_normal (cd, ex_info, insn_value, 0, 32, 16, 16, 32, total_length, pc, & value);
value = ((((((UHI) (value) >> (8))) & (255))) | (((((value) & (255))) << (8))));
fields->f_dsp_48_u16 = value;
@@ -2206,7 +2206,7 @@ m32c_cgen_extract_operand (CGEN_CPU_DESC
case M32C_OPERAND_DSP_48_U20 :
{
{
- long value;
+ long value = 0;
length = extract_normal (cd, ex_info, insn_value, 0, 32, 16, 16, 32, total_length, pc, & value);
value = ((((((UHI) (value) >> (8))) & (255))) | (((((value) & (255))) << (8))));
fields->f_dsp_48_u16 = value;
@@ -2222,7 +2222,7 @@ m32c_cgen_extract_operand (CGEN_CPU_DESC
case M32C_OPERAND_DSP_48_U24 :
{
{
- long value;
+ long value = 0;
length = extract_normal (cd, ex_info, insn_value, 0, 32, 16, 16, 32, total_length, pc, & value);
value = ((((((UHI) (value) >> (8))) & (255))) | (((((value) & (255))) << (8))));
fields->f_dsp_48_u16 = value;
@@ -2240,7 +2240,7 @@ m32c_cgen_extract_operand (CGEN_CPU_DESC
break;
case M32C_OPERAND_DSP_8_S24 :
{
- long value;
+ long value = 0;
length = extract_normal (cd, ex_info, insn_value, 0|(1<<CGEN_IFLD_SIGNED), 0, 8, 24, 32, total_length, pc, & value);
value = ((((((((((((USI) (value) >> (16))) & (255))) | (((value) & (65280))))) | (((((value) & (255))) << (16))))) ^ (8388608))) - (8388608));
fields->f_dsp_8_s24 = value;
@@ -2251,7 +2251,7 @@ m32c_cgen_extract_operand (CGEN_CPU_DESC
break;
case M32C_OPERAND_DSP_8_U16 :
{
- long value;
+ long value = 0;
length = extract_normal (cd, ex_info, insn_value, 0, 0, 8, 16, 32, total_length, pc, & value);
value = ((((((UHI) (value) >> (8))) & (255))) | (((((value) & (255))) << (8))));
fields->f_dsp_8_u16 = value;
@@ -2259,7 +2259,7 @@ m32c_cgen_extract_operand (CGEN_CPU_DESC
break;
case M32C_OPERAND_DSP_8_U24 :
{
- long value;
+ long value = 0;
length = extract_normal (cd, ex_info, insn_value, 0, 0, 8, 24, 32, total_length, pc, & value);
value = ((((((USI) (value) >> (16))) | (((value) & (65280))))) | (((((value) & (255))) << (16))));
fields->f_dsp_8_u24 = value;
@@ -2343,7 +2343,7 @@ m32c_cgen_extract_operand (CGEN_CPU_DESC
break;
case M32C_OPERAND_DST32RNPREFIXEDHI :
{
- long value;
+ long value = 0;
length = extract_normal (cd, ex_info, insn_value, 0, 0, 16, 2, 32, total_length, pc, & value);
value = ((((value) + (2))) % (4));
fields->f_dst32_rn_prefixed_HI = value;
@@ -2351,7 +2351,7 @@ m32c_cgen_extract_operand (CGEN_CPU_DESC
break;
case M32C_OPERAND_DST32RNPREFIXEDQI :
{
- long value;
+ long value = 0;
length = extract_normal (cd, ex_info, insn_value, 0, 0, 16, 2, 32, total_length, pc, & value);
value = (((((~ (((USI) (value) >> (1))))) & (1))) | (((((value) << (1))) & (2))));
fields->f_dst32_rn_prefixed_QI = value;
@@ -2359,7 +2359,7 @@ m32c_cgen_extract_operand (CGEN_CPU_DESC
break;
case M32C_OPERAND_DST32RNPREFIXEDSI :
{
- long value;
+ long value = 0;
length = extract_normal (cd, ex_info, insn_value, 0, 0, 16, 2, 32, total_length, pc, & value);
value = ((value) - (2));
fields->f_dst32_rn_prefixed_SI = value;
@@ -2367,7 +2367,7 @@ m32c_cgen_extract_operand (CGEN_CPU_DESC
break;
case M32C_OPERAND_DST32RNUNPREFIXEDHI :
{
- long value;
+ long value = 0;
length = extract_normal (cd, ex_info, insn_value, 0, 0, 8, 2, 32, total_length, pc, & value);
value = ((((value) + (2))) % (4));
fields->f_dst32_rn_unprefixed_HI = value;
@@ -2375,7 +2375,7 @@ m32c_cgen_extract_operand (CGEN_CPU_DESC
break;
case M32C_OPERAND_DST32RNUNPREFIXEDQI :
{
- long value;
+ long value = 0;
length = extract_normal (cd, ex_info, insn_value, 0, 0, 8, 2, 32, total_length, pc, & value);
value = (((((~ (((USI) (value) >> (1))))) & (1))) | (((((value) << (1))) & (2))));
fields->f_dst32_rn_unprefixed_QI = value;
@@ -2383,7 +2383,7 @@ m32c_cgen_extract_operand (CGEN_CPU_DESC
break;
case M32C_OPERAND_DST32RNUNPREFIXEDSI :
{
- long value;
+ long value = 0;
length = extract_normal (cd, ex_info, insn_value, 0, 0, 8, 2, 32, total_length, pc, & value);
value = ((value) - (2));
fields->f_dst32_rn_unprefixed_SI = value;
@@ -2402,7 +2402,7 @@ m32c_cgen_extract_operand (CGEN_CPU_DESC
break;
case M32C_OPERAND_IMM_16_HI :
{
- long value;
+ long value = 0;
length = extract_normal (cd, ex_info, insn_value, 0|(1<<CGEN_IFLD_SIGNED), 0, 16, 16, 32, total_length, pc, & value);
value = EXTHISI (((HI) (INT) (((((((UINT) (value) >> (8))) & (255))) | (((((value) & (255))) << (8)))))));
fields->f_dsp_16_s16 = value;
@@ -2414,14 +2414,14 @@ m32c_cgen_extract_operand (CGEN_CPU_DESC
case M32C_OPERAND_IMM_16_SI :
{
{
- long value;
+ long value = 0;
length = extract_normal (cd, ex_info, insn_value, 0, 0, 16, 16, 32, total_length, pc, & value);
value = ((((((UHI) (value) >> (8))) & (255))) | (((((value) & (255))) << (8))));
fields->f_dsp_16_u16 = value;
}
if (length <= 0) break;
{
- long value;
+ long value = 0;
length = extract_normal (cd, ex_info, insn_value, 0, 32, 0, 16, 32, total_length, pc, & value);
value = ((((((UHI) (value) >> (8))) & (255))) | (((((value) & (255))) << (8))));
fields->f_dsp_32_u16 = value;
@@ -2454,7 +2454,7 @@ m32c_cgen_extract_operand (CGEN_CPU_DESC
length = extract_normal (cd, ex_info, insn_value, 0, 0, 24, 8, 32, total_length, pc, & fields->f_dsp_24_u8);
if (length <= 0) break;
{
- long value;
+ long value = 0;
length = extract_normal (cd, ex_info, insn_value, 0, 32, 0, 24, 32, total_length, pc, & value);
value = ((((((((USI) (value) >> (16))) & (255))) | (((value) & (65280))))) | (((((value) << (16))) & (16711680))));
fields->f_dsp_32_u24 = value;
@@ -2467,7 +2467,7 @@ m32c_cgen_extract_operand (CGEN_CPU_DESC
break;
case M32C_OPERAND_IMM_32_HI :
{
- long value;
+ long value = 0;
length = extract_normal (cd, ex_info, insn_value, 0|(1<<CGEN_IFLD_SIGNED), 32, 0, 16, 32, total_length, pc, & value);
value = EXTHISI (((HI) (INT) (((((((UINT) (value) >> (8))) & (255))) | (((((value) & (255))) << (8)))))));
fields->f_dsp_32_s16 = value;
@@ -2486,7 +2486,7 @@ m32c_cgen_extract_operand (CGEN_CPU_DESC
break;
case M32C_OPERAND_IMM_40_HI :
{
- long value;
+ long value = 0;
length = extract_normal (cd, ex_info, insn_value, 0|(1<<CGEN_IFLD_SIGNED), 32, 8, 16, 32, total_length, pc, & value);
value = EXTHISI (((HI) (INT) (((((((UINT) (value) >> (8))) & (255))) | (((((value) & (255))) << (8)))))));
fields->f_dsp_40_s16 = value;
@@ -2498,7 +2498,7 @@ m32c_cgen_extract_operand (CGEN_CPU_DESC
case M32C_OPERAND_IMM_40_SI :
{
{
- long value;
+ long value = 0;
length = extract_normal (cd, ex_info, insn_value, 0, 32, 8, 24, 32, total_length, pc, & value);
value = ((((((((USI) (value) >> (16))) & (255))) | (((value) & (65280))))) | (((((value) << (16))) & (16711680))));
fields->f_dsp_40_u24 = value;
@@ -2513,7 +2513,7 @@ m32c_cgen_extract_operand (CGEN_CPU_DESC
break;
case M32C_OPERAND_IMM_48_HI :
{
- long value;
+ long value = 0;
length = extract_normal (cd, ex_info, insn_value, 0|(1<<CGEN_IFLD_SIGNED), 32, 16, 16, 32, total_length, pc, & value);
value = EXTHISI (((HI) (INT) (((((((UINT) (value) >> (8))) & (255))) | (((((value) & (255))) << (8)))))));
fields->f_dsp_48_s16 = value;
@@ -2525,14 +2525,14 @@ m32c_cgen_extract_operand (CGEN_CPU_DESC
case M32C_OPERAND_IMM_48_SI :
{
{
- long value;
+ long value = 0;
length = extract_normal (cd, ex_info, insn_value, 0, 32, 16, 16, 32, total_length, pc, & value);
value = ((((((UHI) (value) >> (8))) & (255))) | (((((value) & (255))) << (8))));
fields->f_dsp_48_u16 = value;
}
if (length <= 0) break;
{
- long value;
+ long value = 0;
length = extract_normal (cd, ex_info, insn_value, 0, 64, 0, 16, 32, total_length, pc, & value);
value = ((((((UHI) (value) >> (8))) & (255))) | (((((value) & (255))) << (8))));
fields->f_dsp_64_u16 = value;
@@ -2567,7 +2567,7 @@ m32c_cgen_extract_operand (CGEN_CPU_DESC
break;
case M32C_OPERAND_IMM_8_HI :
{
- long value;
+ long value = 0;
length = extract_normal (cd, ex_info, insn_value, 0|(1<<CGEN_IFLD_SIGNED), 0, 8, 16, 32, total_length, pc, & value);
value = EXTHISI (((HI) (INT) (((((((UINT) (value) >> (8))) & (255))) | (((((value) & (255))) << (8)))))));
fields->f_dsp_8_s16 = value;
@@ -2593,7 +2593,7 @@ m32c_cgen_extract_operand (CGEN_CPU_DESC
break;
case M32C_OPERAND_IMM1_S :
{
- long value;
+ long value = 0;
length = extract_normal (cd, ex_info, insn_value, 0, 0, 2, 1, 32, total_length, pc, & value);
value = ((value) + (1));
fields->f_imm1_S = value;
@@ -2612,7 +2612,7 @@ m32c_cgen_extract_operand (CGEN_CPU_DESC
break;
case M32C_OPERAND_LAB_16_8 :
{
- long value;
+ long value = 0;
length = extract_normal (cd, ex_info, insn_value, 0|(1<<CGEN_IFLD_SIGNED)|(1<<CGEN_IFLD_PCREL_ADDR), 0, 16, 8, 32, total_length, pc, & value);
value = ((value) + (((pc) + (2))));
fields->f_lab_16_8 = value;
@@ -2620,7 +2620,7 @@ m32c_cgen_extract_operand (CGEN_CPU_DESC
break;
case M32C_OPERAND_LAB_24_8 :
{
- long value;
+ long value = 0;
length = extract_normal (cd, ex_info, insn_value, 0|(1<<CGEN_IFLD_SIGNED)|(1<<CGEN_IFLD_PCREL_ADDR), 0, 24, 8, 32, total_length, pc, & value);
value = ((value) + (((pc) + (2))));
fields->f_lab_24_8 = value;
@@ -2628,7 +2628,7 @@ m32c_cgen_extract_operand (CGEN_CPU_DESC
break;
case M32C_OPERAND_LAB_32_8 :
{
- long value;
+ long value = 0;
length = extract_normal (cd, ex_info, insn_value, 0|(1<<CGEN_IFLD_SIGNED)|(1<<CGEN_IFLD_PCREL_ADDR), 32, 0, 8, 32, total_length, pc, & value);
value = ((value) + (((pc) + (2))));
fields->f_lab_32_8 = value;
@@ -2636,7 +2636,7 @@ m32c_cgen_extract_operand (CGEN_CPU_DESC
break;
case M32C_OPERAND_LAB_40_8 :
{
- long value;
+ long value = 0;
length = extract_normal (cd, ex_info, insn_value, 0|(1<<CGEN_IFLD_SIGNED)|(1<<CGEN_IFLD_PCREL_ADDR), 32, 8, 8, 32, total_length, pc, & value);
value = ((value) + (((pc) + (2))));
fields->f_lab_40_8 = value;
@@ -2644,7 +2644,7 @@ m32c_cgen_extract_operand (CGEN_CPU_DESC
break;
case M32C_OPERAND_LAB_5_3 :
{
- long value;
+ long value = 0;
length = extract_normal (cd, ex_info, insn_value, 0|(1<<CGEN_IFLD_PCREL_ADDR), 0, 5, 3, 32, total_length, pc, & value);
value = ((value) + (((pc) + (2))));
fields->f_lab_5_3 = value;
@@ -2652,7 +2652,7 @@ m32c_cgen_extract_operand (CGEN_CPU_DESC
break;
case M32C_OPERAND_LAB_8_16 :
{
- long value;
+ long value = 0;
length = extract_normal (cd, ex_info, insn_value, 0|(1<<CGEN_IFLD_SIGN_OPT)|(1<<CGEN_IFLD_PCREL_ADDR), 0, 8, 16, 32, total_length, pc, & value);
value = ((((((((((USI) (((value) & (65280))) >> (8))) | (((((value) & (255))) << (8))))) ^ (32768))) - (32768))) + (((pc) + (1))));
fields->f_lab_8_16 = value;
@@ -2660,7 +2660,7 @@ m32c_cgen_extract_operand (CGEN_CPU_DESC
break;
case M32C_OPERAND_LAB_8_24 :
{
- long value;
+ long value = 0;
length = extract_normal (cd, ex_info, insn_value, 0|(1<<CGEN_IFLD_ABS_ADDR), 0, 8, 24, 32, total_length, pc, & value);
value = ((((((USI) (value) >> (16))) | (((value) & (65280))))) | (((((value) & (255))) << (16))));
fields->f_lab_8_24 = value;
@@ -2668,7 +2668,7 @@ m32c_cgen_extract_operand (CGEN_CPU_DESC
break;
case M32C_OPERAND_LAB_8_8 :
{
- long value;
+ long value = 0;
length = extract_normal (cd, ex_info, insn_value, 0|(1<<CGEN_IFLD_SIGNED)|(1<<CGEN_IFLD_PCREL_ADDR), 0, 8, 8, 32, total_length, pc, & value);
value = ((value) + (((pc) + (1))));
fields->f_lab_8_8 = value;
@@ -2757,7 +2757,7 @@ m32c_cgen_extract_operand (CGEN_CPU_DESC
break;
case M32C_OPERAND_SRC32RNPREFIXEDHI :
{
- long value;
+ long value = 0;
length = extract_normal (cd, ex_info, insn_value, 0, 0, 18, 2, 32, total_length, pc, & value);
value = ((((value) + (2))) % (4));
fields->f_src32_rn_prefixed_HI = value;
@@ -2765,7 +2765,7 @@ m32c_cgen_extract_operand (CGEN_CPU_DESC
break;
case M32C_OPERAND_SRC32RNPREFIXEDQI :
{
- long value;
+ long value = 0;
length = extract_normal (cd, ex_info, insn_value, 0, 0, 18, 2, 32, total_length, pc, & value);
value = (((((~ (((USI) (value) >> (1))))) & (1))) | (((((value) << (1))) & (2))));
fields->f_src32_rn_prefixed_QI = value;
@@ -2773,7 +2773,7 @@ m32c_cgen_extract_operand (CGEN_CPU_DESC
break;
case M32C_OPERAND_SRC32RNPREFIXEDSI :
{
- long value;
+ long value = 0;
length = extract_normal (cd, ex_info, insn_value, 0, 0, 18, 2, 32, total_length, pc, & value);
value = ((value) - (2));
fields->f_src32_rn_prefixed_SI = value;
@@ -2781,7 +2781,7 @@ m32c_cgen_extract_operand (CGEN_CPU_DESC
break;
case M32C_OPERAND_SRC32RNUNPREFIXEDHI :
{
- long value;
+ long value = 0;
length = extract_normal (cd, ex_info, insn_value, 0, 0, 10, 2, 32, total_length, pc, & value);
value = ((((value) + (2))) % (4));
fields->f_src32_rn_unprefixed_HI = value;
@@ -2789,7 +2789,7 @@ m32c_cgen_extract_operand (CGEN_CPU_DESC
break;
case M32C_OPERAND_SRC32RNUNPREFIXEDQI :
{
- long value;
+ long value = 0;
length = extract_normal (cd, ex_info, insn_value, 0, 0, 10, 2, 32, total_length, pc, & value);
value = (((((~ (((USI) (value) >> (1))))) & (1))) | (((((value) << (1))) & (2))));
fields->f_src32_rn_unprefixed_QI = value;
@@ -2797,7 +2797,7 @@ m32c_cgen_extract_operand (CGEN_CPU_DESC
break;
case M32C_OPERAND_SRC32RNUNPREFIXEDSI :
{
- long value;
+ long value = 0;
length = extract_normal (cd, ex_info, insn_value, 0, 0, 10, 2, 32, total_length, pc, & value);
value = ((value) - (2));
fields->f_src32_rn_unprefixed_SI = value;
--- binutils.orig/binutils/srconv.c 2020-06-16 17:10:22.251564474 +0100
+++ binutils-2.34.0/binutils/srconv.c 2020-06-16 20:07:51.670025912 +0100
@@ -492,6 +492,8 @@ wr_rl (struct coff_ofile *ptr ATTRIBUTE_
rl.addr = r->offset;
rl.bitloc = 0;
rl.flen = 32; /* SH Specific. */
+ rl.dunno = 0;
+ rl.symn = 0;
/* What sort of reloc ? Look in the section to find out. */
ref = r->symbol;
--- binutils.orig/libctf/ctf-create.c 2020-07-24 15:33:26.100996335 +0100
+++ binutils-2.35/libctf/ctf-create.c 2020-07-24 15:33:29.042977475 +0100
@@ -1257,6 +1257,8 @@ ctf_add_forward (ctf_file_t *fp, uint32_
if ((type = ctf_add_generic (fp, flag, name, kind, &dtd)) == CTF_ERR)
return CTF_ERR; /* errno is set for us. */
+ if (dtd == NULL)
+ return CTF_ERR;
dtd->dtd_data.ctt_info = CTF_TYPE_INFO (CTF_K_FORWARD, flag, 0);
dtd->dtd_data.ctt_type = kind;

View File

@ -0,0 +1,19 @@
--- binutils.orig/binutils/objcopy.c 2021-01-14 09:09:30.796925559 +0000
+++ binutils-2.35/binutils/objcopy.c 2021-01-14 15:45:38.105153686 +0000
@@ -3313,14 +3313,12 @@ copy_object (bfd *ibfd, bfd *obfd, const
/* It is likely that output sections are in the same order
as the input sections, but do not assume that this is
the case. */
- if (strcmp (bfd_section_name (merged->sec),
- bfd_section_name (osec)) != 0)
+ if (merged->sec->output_section != osec)
{
for (merged = merged_note_sections;
merged != NULL;
merged = merged->next)
- if (strcmp (bfd_section_name (merged->sec),
- bfd_section_name (osec)) == 0)
+ if (merged->sec->output_section == osec)
break;
if (merged == NULL)

158
binutils-warnings.patch Normal file
View File

@ -0,0 +1,158 @@
diff --git a/binutils/dwarf.c b/binutils/dwarf.c
index 6ecfab5d..f8698213 100644
--- a/binutils/dwarf.c
+++ b/binutils/dwarf.c
@@ -4914,7 +4914,7 @@ display_debug_lines_decoded (struct dwarf_section * section,
else
{
newFileName = (char *) xmalloc (fileNameLength + 1);
- strncpy (newFileName, fileName, fileNameLength + 1);
+ strcpy (newFileName, fileName);
}
if (!do_wide || (fileNameLength <= MAX_FILENAME_LENGTH))
diff --git a/libiberty/cp-demangle.c b/libiberty/cp-demangle.c
index 3639bfbf..ed080a1a 100644
--- a/libiberty/cp-demangle.c
+++ b/libiberty/cp-demangle.c
@@ -185,20 +185,6 @@ static void d_init_info (const char *, int, size_t, struct d_info *);
#define CP_STATIC_IF_GLIBCPP_V3
#endif /* ! defined(IN_GLIBCPP_V3) */
-/* See if the compiler supports dynamic arrays. */
-
-#ifdef __GNUC__
-#define CP_DYNAMIC_ARRAYS
-#else
-#ifdef __STDC__
-#ifdef __STDC_VERSION__
-#if __STDC_VERSION__ >= 199901L && !__STDC_NO_VLA__
-#define CP_DYNAMIC_ARRAYS
-#endif /* __STDC_VERSION__ >= 199901L && !__STDC_NO_VLA__ */
-#endif /* defined (__STDC_VERSION__) */
-#endif /* defined (__STDC__) */
-#endif /* ! defined (__GNUC__) */
-
/* We avoid pulling in the ctype tables, to prevent pulling in
additional unresolved symbols when this code is used in a library.
FIXME: Is this really a valid reason? This comes from the original
@@ -4343,29 +4329,21 @@ cplus_demangle_print_callback (int options,
d_print_init (&dpi, callback, opaque, dc);
{
-#ifdef CP_DYNAMIC_ARRAYS
- /* Avoid zero-length VLAs, which are prohibited by the C99 standard
- and flagged as errors by Address Sanitizer. */
- __extension__ struct d_saved_scope scopes[(dpi.num_saved_scopes > 0)
- ? dpi.num_saved_scopes : 1];
- __extension__ struct d_print_template temps[(dpi.num_copy_templates > 0)
- ? dpi.num_copy_templates : 1];
-
- dpi.saved_scopes = scopes;
- dpi.copy_templates = temps;
-#else
- dpi.saved_scopes = alloca (dpi.num_saved_scopes
- * sizeof (*dpi.saved_scopes));
- dpi.copy_templates = alloca (dpi.num_copy_templates
- * sizeof (*dpi.copy_templates));
-#endif
-
+ dpi.saved_scopes
+ = (struct d_saved_scope *) xmalloc (dpi.num_saved_scopes
+ * sizeof (*dpi.saved_scopes));
+ dpi.copy_templates
+ = (struct d_print_template *) xmalloc (dpi.num_copy_templates
+ * sizeof (*dpi.copy_templates));
d_print_comp (&dpi, options, dc);
}
d_print_flush (&dpi);
- return ! d_print_saw_error (&dpi);
+ int retval = ! d_print_saw_error (&dpi);
+ free (dpi.saved_scopes);
+ free (dpi.copy_templates);
+ return retval;
}
/* Turn components into a human readable string. OPTIONS is the
@@ -6307,16 +6285,12 @@ d_demangle_callback (const char *mangled, int options,
}
{
-#ifdef CP_DYNAMIC_ARRAYS
- __extension__ struct demangle_component comps[di.num_comps];
- __extension__ struct demangle_component *subs[di.num_subs];
-
- di.comps = comps;
- di.subs = subs;
-#else
- di.comps = alloca (di.num_comps * sizeof (*di.comps));
- di.subs = alloca (di.num_subs * sizeof (*di.subs));
-#endif
+ di.comps
+ = (struct demangle_component *) xmalloc (di.num_comps
+ * sizeof (*di.comps));
+ di.subs
+ = (struct demangle_component **) xmalloc (di.num_subs
+ * sizeof (*di.subs));
switch (type)
{
@@ -6357,6 +6331,8 @@ d_demangle_callback (const char *mangled, int options,
: 0;
}
+ free (di.comps);
+ free (di.subs);
return status;
}
@@ -6588,16 +6564,12 @@ is_ctor_or_dtor (const char *mangled,
cplus_demangle_init_info (mangled, DMGL_GNU_V3, strlen (mangled), &di);
{
-#ifdef CP_DYNAMIC_ARRAYS
- __extension__ struct demangle_component comps[di.num_comps];
- __extension__ struct demangle_component *subs[di.num_subs];
-
- di.comps = comps;
- di.subs = subs;
-#else
- di.comps = alloca (di.num_comps * sizeof (*di.comps));
- di.subs = alloca (di.num_subs * sizeof (*di.subs));
-#endif
+ di.comps
+ = (struct demangle_component *) xmalloc (di.num_comps
+ * sizeof (*di.comps));
+ di.subs
+ = (struct demangle_component **) xmalloc (di.num_subs
+ * sizeof (*di.subs));
dc = cplus_demangle_mangled_name (&di, 1);
@@ -6640,6 +6612,8 @@ is_ctor_or_dtor (const char *mangled,
}
}
+ free (di.comps);
+ free (di.subs);
return ret;
}
diff --git a/libiberty/make-relative-prefix.c b/libiberty/make-relative-prefix.c
index e3f9f920..5dbe6f89 100644
--- a/libiberty/make-relative-prefix.c
+++ b/libiberty/make-relative-prefix.c
@@ -259,10 +259,7 @@ make_relative_prefix_1 (const char *progname, const char *bin_prefix,
#ifdef HAVE_HOST_EXECUTABLE_SUFFIX
len += strlen (HOST_EXECUTABLE_SUFFIX);
#endif
- if (len < MAX_ALLOCA_SIZE)
- nstore = (char *) alloca (len);
- else
- alloc_ptr = nstore = (char *) malloc (len);
+ alloc_ptr = nstore = (char *) malloc (len);
startp = endp = temp;
while (1)

View File

@ -1,30 +1,29 @@
Summary: A GNU collection of binary utilities
Name: %{?cross}binutils%{?_with_debug:-debug}
Version: 2.33.1
Release: 10%{?dist}
Version: 2.35
Release: 21%{?dist}
License: GPLv3+
URL: https://sourceware.org/binutils
#----------------------------------------------------------------------------
# Binutils SPEC file. Can be invoked with the following parameters:
# Binutils SPEC file. Can be invoked with the following parameters to change
# the default behaviour:
# --define "binutils_target arm-linux-gnu" to create arm-linux-gnu-binutils.
# --with=bootstrap Build with minimal dependencies.
# --with=debug Build without optimizations and without splitting
# the debuginfo into a separate file.
# --without=docs Skip building documentation.
# --without=testsuite Do not run the testsuite. Default is to run it.
# --with=testsuite Run the testsuite. Default when --with=debug is not
# to run it.
# --without=gold Disable building of the GOLD linker.
#
# --with bootstrap Build with minimal dependencies.
# --with debug Build without optimizations and without splitting
# the debuginfo into a separate file.
# --without docs Skip building documentation.
# --without testsuite Do not run the testsuite. Default is to run it.
# --without gold Disable building of the GOLD linker.
# --with clang To force building with the CLANG.
# --without debuginfod Disable support for debuginfod.
#---Start of Configure Options-----------------------------------------------
# Use clang as the build time compiler rather than gcc.
%define build_using_clang 0
# Create deterministic archives (ie ones without timestamps).
# Default is off because of BZ 1195883.
%define enable_deterministic_archives 0
@ -73,6 +72,11 @@ URL: https://sourceware.org/binutils
%bcond_without docs
# Default: Always run the testsuite.
%bcond_without testsuite
# Use clang as the build time compiler. Default: gcc
%bcond_with clang
# Default: support debuginfod.
%bcond_without debuginfod
%if %{with bootstrap}
%undefine with_docs
@ -105,8 +109,7 @@ URL: https://sourceware.org/binutils
# too many controversial patches so we stick with the official FSF version
# instead.
Source: https://ftp.gnu.org/gnu/binutils/binutils-%{version}.tar.xz
Source: https://ftp.gnu.org/gnu/binutils/binutils-%%{version}.tar.xz
Source2: binutils-2.19.50.0.1-output-format.sed
#----------------------------------------------------------------------------
@ -181,46 +184,98 @@ Patch09: binutils-do-not-link-with-static-libstdc++.patch
# Lifetime: Permanent.
Patch10: binutils-attach-to-group.patch
# Purpose: Stop gold from complaining about relocs in the .gnu.build.attribute
# section that reference symbols in discarded sections.
# Lifetime: Fixed in 2.34 (maybe)
Patch11: binutils-gold-ignore-discarded-note-relocs.patch
# Purpose: Allow OS specific sections in section groups.
# Lifetime: Might be fixed in 2.34 (maybe)
# Lifetime: Fixed in 2.35 (maybe)
Patch12: binutils-special-sections-in-groups.patch
# Purpose: Fix linker testsuite failures.
# Lifetime: Fixed in 2.34 (maybe)
# Lifetime: Fixed in 2.35 (maybe)
Patch13: binutils-fix-testsuite-failures.patch
# Purpose: Stop gold from aborting when input sections with the same name
# have different flags.
# Lifetime: Fixed in 2.34 (maybe)
# Lifetime: Fixed in 2.35 (maybe)
Patch14: binutils-gold-mismatched-section-flags.patch
# Purpose: Add a check to the GOLD linker for a corrupt input file
# with a fuzzed section offset.
# Lifetime: Fixed in 2.34 (maybe)
# Lifetime: Fixed in 2.35 (maybe)
Patch15: binutils-CVE-2019-1010204.patch
# Purpose: Improve objdump's ability to merge GNU build attribute notes.
# Lifetime: Fixed in 2.34
Patch16: binutils-improved-note-merging.patch
# Purpose: Change the gold configuration script to only warn about
# unsupported targets. This allows the binutils to be built with
# BPF support enabled.
# Lifetime: Permanent.
Patch17: binutils-gold-warn-unsupported.patch
# Purpose: Fix a potential seg-fault in the BFD library when parsing
# pathalogical debug_info sections.
# Lifetime: Fixed in 2.34
Patch17: binutils-CVE-2019-17451.patch
# Purpose: Fix compile time warning messages building s390 target with gcc-10.
# Lifetime: Should be fixed in 2.36.
Patch19: binutils-s390-build.patch
# Purpose: Fix a memory exhaustion bug in the BFD library when parsing
# corrupt DWARF debug information.
# Lifetime: Fixed in 2.34
Patch18: binutils-CVE-2019-17450.patch
# Purpose: Fix LTO problems running config mini-builds.
# Lifetime: Should be fixed in 2.36.
Patch20: binutils-config.patch
# Purpose: Fix compile time warning messages building with gcc-10.
# Lifetime: Should be fixed in 2.36.
Patch21: binutils-warnings.patch
# Purpose: Fix compile time warning messages building with gcc-10. (part 2).
# Lifetime: Should be fixed in 2.36.
Patch22: binutils-gcc-10-fixes.patch
# Purpose: Default to DWARF level 3 in the assembler.
# Lifetime: Fixed in 2.36.
Patch23: binutils-gas-dwarf-level-4.patch
# Purpose: Set the sh_entsize of the AArch64's PLT section to 0.
# Lifetime: Fixed in 2.36.
Patch24: binutils-aarch64-plt-sh_entsize.patch
# Purpose: Fixes for linking LTO objects.
# Lifetime: Fixed in 2.36
Patch25: binutils-add-sym-cache-to-elf-link-hash.patch
Patch26: binutils-elf-add-objects.patch
# Purpose: Allow plugin syms to mark as-needed shared libs needed.
# Lifetime: Fixed in 2.36
Patch27: binutils-plugin-as-needed.patch
# Purpose: Fix the DWARF parser to skip DW_FORM_ref_addr types
# when attempting to determine a type's signedness.
# Lifetime: Fixed in 2.36
Patch28: binutils-dwarf-type-sign.patch
# Purpose: Fix some DWARF5 issues
# Lifetime: Fixed in 2.36 and on 2.35-branch
Patch29: binutils-dwarf5-2_35-branch.patch
# Purpose: Fix the strip program to cope when merging multiple same-named
# sections.
# Lifetime: Fixed in 2.36
Patch30: binutils-strip-merge.patch
# Purpose: Update the GOLD linker to support x86 .note.gnu.property sections.
# Lifetime: Fixed in 2.36
Patch31: binutils-gold-gnu-properties.patch
# Purpose: Fix an illegal memory access when using readelf to examine a corrupt file.
# Lifetime: Fixed in 2.36
Patch32: binutils-CVE-2021-20294.patch
# Purpose: Fix excessive memory consumption when attempting to parse corrupt
# DWARF debug information.
# Lifetime: Fixed in 2.36
Patch33: binutils-CVE-2021-3487.patch
# Purpose: Fix illegal memory access when parsing corrupt ELF files.
# Lifetime: Fixed in 2.36
Patch34: binutils-CVE-2020-35448.patch
#----------------------------------------------------------------------------
Provides: bundled(libiberty)
BuildRequires: autoconf automake
%if %{with gold}
# For now we make the binutils package require the gold sub-package.
@ -241,8 +296,8 @@ Requires: binutils-gold >= %{version}
# Perl, sed and touch are all used in the %%prep section of this spec file.
BuildRequires: perl, sed, coreutils
%if %{build_using_clang}
BuildRequires: clang
%if %{with clang}
BuildRequires: clang compiler-rt
%else
BuildRequires: gcc
%endif
@ -277,6 +332,10 @@ Requires(post): coreutils
%define _gnu %{nil}
%endif
%if %{with debuginfod}
BuildRequires: elfutils-debuginfod-client-devel
%endif
#----------------------------------------------------------------------------
%description
@ -337,7 +396,7 @@ BuildRequires: bison, m4, gcc-c++
# The GOLD testsuite needs a static libc++
BuildRequires: libstdc++-static
%if ! %{build_using_clang}
%if ! %{with clang}
BuildRequires: gcc-c++
Conflicts: gcc-c++ < 4.0.0
%endif
@ -345,32 +404,14 @@ Conflicts: gcc-c++ < 4.0.0
# The higher of these two numbers determines the default ld.
%{!?ld_gold_priority:%global ld_gold_priority 30}
%endif %%# with gold
%endif
%{!?ld_bfd_priority: %global ld_bfd_priority 50}
#----------------------------------------------------------------------------
%prep
%setup -q -n binutils-%{version}
%patch01 -p1
%patch02 -p1
%patch03 -p1
%patch04 -p1
%patch05 -p1
%patch06 -p1
%patch07 -p1
%patch08 -p1
%patch09 -p1
%patch10 -p1
%patch11 -p1
%patch12 -p1
%patch13 -p1
%patch14 -p1
%patch15 -p1
%patch16 -p1
%patch17 -p1
%patch18 -p1
%autosetup -p1 -n binutils-%{version}
# 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 ?
@ -414,11 +455,6 @@ touch */configure
%build
echo target is %{binutils_target}
%if %{build_using_clang}
# Clang does not support the -fstack-clash-protection option.
%global optflags %(echo %{optflags} | sed 's/-fstack-clash-protection//')
%endif
%ifarch %{power64}
export CFLAGS="$RPM_OPT_FLAGS -Wno-error"
%else
@ -427,33 +463,49 @@ export CFLAGS="$RPM_OPT_FLAGS"
CARGS=
case %{binutils_target} in i?86*|sparc*|ppc*|s390*|sh*|arm*|aarch64*)
%if %{with debuginfod}
CARGS="$CARGS --with-debuginfod"
%endif
case %{binutils_target} in i?86*|sparc*|ppc*|s390*|sh*|arm*|aarch64*|riscv*)
CARGS="$CARGS --enable-64-bit-bfd"
;;
esac
# Extra targets to build along with the default one.
# We add the BPF target so that strip will work on bpf files.
case %{binutils_target} in ia64*)
CARGS="$CARGS --enable-targets=i386-linux"
CARGS="$CARGS --enable-targets=ia64-linux,bpf-unknown-none"
;;
esac
case %{binutils_target} in ppc*|ppc64*)
CARGS="$CARGS --enable-targets=spu"
CARGS="$CARGS --enable-targets=spu,bpf-unknown-none"
;;
esac
case %{binutils_target} in ppc64-*)
CARGS="$CARGS --enable-targets=powerpc64le-linux"
CARGS="$CARGS --enable-targets=powerpc64le-linux,bpf-unknown-none"
;;
esac
case %{binutils_target} in ppc64le*)
CARGS="$CARGS --enable-targets=powerpc-linux"
CARGS="$CARGS --enable-targets=powerpc-linux,bpf-unknown-none"
;;
esac
case %{binutils_target} in x86_64*|i?86*|arm*|aarch64*)
CARGS="$CARGS --enable-targets=x86_64-pep"
case %{binutils_target} in s390*)
# FIXME: For some unknown reason settting --enable-targets=bpf-unknown-none
# here breaks the building of GOLD. I have no idea why, and not enough
# knowledge of how gold is configured to fix quickly. So instead I have
# found that supporting "all" targets works.
CARGS="$CARGS --enable-targets=all"
;;
esac
case %{binutils_target} in x86_64*|i?86*|arm*|aarch64*|riscv*)
CARGS="$CARGS --enable-targets=x86_64-pep,bpf-unknown-none"
;;
esac
@ -463,7 +515,7 @@ esac
CARGS="$CARGS --enable-relro=no"
%endif
%if 0%{?_with_debug:1}
%if %{with debug}
export CFLAGS="$CFLAGS -O0 -ggdb2 -Wno-error -D_FORTIFY_SOURCE=0"
%define enable_shared 0
%endif
@ -471,13 +523,24 @@ export CFLAGS="$CFLAGS -O0 -ggdb2 -Wno-error -D_FORTIFY_SOURCE=0"
# BZ 1541027 - include the linker flags from redhat-rpm-config as well.
export LDFLAGS=$RPM_LD_FLAGS
%if %{with clang}
%define _with_cc_clang 1
%endif
# Dependencies are not set up to rebuild the configure files
# in the subdirectories. So we just rebuild the ones we care
# about after applying the configure patches
pushd libiberty
autoconf
popd
pushd intl
autoconf
popd
# We could optimize the cross builds size by --enable-shared but the produced
# binaries may be less convenient in the embedded environment.
%configure \
%if %{build_using_clang}
CC=clang \
CXX=clang++ \
%endif
--quiet \
--build=%{_target_platform} --host=%{_target_platform} \
--target=%{binutils_target} \
@ -522,7 +585,8 @@ export LDFLAGS=$RPM_LD_FLAGS
%endif
$CARGS \
--enable-plugins \
--with-bugurl=http://bugzilla.redhat.com/bugzilla/
--with-bugurl=http://bugzilla.redhat.com/bugzilla/ \
|| cat config.log
%if %{with docs}
%make_build %{_smp_mflags} tooldir=%{_prefix} all
@ -562,7 +626,7 @@ if [ -f gold/testsuite/test-suite.log ]; then
rm -f binutils-%{_target_platform}-gold.log.tar.xz
fi
%endif
%endif # with testsuite
%endif
#----------------------------------------------------------------------------
@ -581,16 +645,19 @@ make prefix=%{buildroot}%{_prefix} infodir=%{buildroot}%{_infodir} install-info
# Rebuild libiberty.a with -fPIC.
# Future: Remove it together with its header file, projects should bundle it.
%make_build -C libiberty clean
%set_build_flags
%make_build CFLAGS="-g -fPIC $RPM_OPT_FLAGS" -C libiberty
# Rebuild libbfd.a with -fPIC.
# Without the hidden visibility the 3rd party shared libraries would export
# the bfd non-stable ABI.
%make_build -C bfd clean
%set_build_flags
%make_build CFLAGS="-g -fPIC $RPM_OPT_FLAGS -fvisibility=hidden" -C bfd
# Rebuild libopcodes.a with -fPIC.
%make_build -C opcodes clean
%set_build_flags
%make_build CFLAGS="-g -fPIC $RPM_OPT_FLAGS" -C opcodes
install -m 644 bfd/libbfd.a %{buildroot}%{_libdir}
@ -659,14 +726,14 @@ $OUTPUT_FORMAT
INPUT ( %{_libdir}/libopcodes.a -lbfd )
EOH
%else # !isnative
%else
# For cross-binutils we drop the documentation.
rm -rf %{buildroot}%{_infodir}
# We keep these as one can have native + cross binutils of different versions.
#rm -rf {buildroot}{_prefix}/share/locale
#rm -rf {buildroot}{_mandir}
rm -rf %{buildroot}%{_libdir}/libiberty.a
%endif # !isnative
%endif
# This one comes from gcc
rm -f %{buildroot}%{_infodir}/dir
@ -754,6 +821,7 @@ exit 0
%if %{enable_shared}
%{_libdir}/lib*.so
%{_libdir}/libctf*
%exclude %{_libdir}/libbfd.so
%exclude %{_libdir}/libopcodes.so
%endif
@ -766,7 +834,7 @@ exit 0
%{_libdir}/libbfd.so
%{_libdir}/libopcodes.so
%endif # isnative
%endif
%if %{with gold}
%files gold
@ -777,6 +845,113 @@ exit 0
#----------------------------------------------------------------------------
%changelog
* Mon Apr 19 2021 Nick Clifton <nickc@redhat.com> - 2.35-21
- Fix an illegal memory access when parsing a corrupt ELF file. (#1950481)
* Fri Apr 09 2021 Nick Clifton <nickc@redhat.com> - 2.35-20
- Fix excessive memory consumption parsing corrupt DWARF information. (#1947969)
* Fri Mar 26 2021 Nick Clifton <nickc@redhat.com> - 2.35-19
- Fix an illegal memory access when using readelf to examine a corrupt file. (#1943534)
* Mon Jan 18 2021 Nick Clifton <nickc@redhat.com> - 2.35-18
- Update the GOLD linker to handle x86 .note.gnu.property sections. (#1916925)
* Thu Jan 14 2021 Nick Clifton <nickc@redhat.com> - 2.35-17
- Fix strip when merging multiple same-named sections. (#1885607)
* Fri Jan 08 2021 Nick Clifton <nickc@redhat.com> - 2.35-16
- Fix bug running readelf on an empty file. (#1903448)
- Fix bug running readelf on a file that cannot be read. (#1913589)
* Fri Nov 27 2020 Mark Wielaard <mjw@fedoraproject.org> - 2.35-15
- Add DWARF5 fixes from 2_35-branch.
* Fri Oct 30 2020 Nick Clifton <nickc@redhat.com> - 2.35-14
- Correction for plugin as-needed patch. (#1889763)
* Tue Oct 27 2020 Nick Clifton <nickc@redhat.com> - 2.35-13
- Really fix erroneous decoding of LEB128 values. (#1891171)
* Mon Oct 26 2020 Nick Clifton <nickc@redhat.com> - 2.35-12
- Fix erroneous decoding of LEB128 values. (#188716)
* Fri Oct 09 2020 Nick Clifton <nickc@redhat.com> - 2.35-11
- Allow plugin syms to mark as-needed shared libs needed
* Fri Jul 31 2020 Jeff Law <nickc@redhat.com> - 2.35-10
- Re-enable LTO
* Fri Jul 31 2020 Jeff Law <nickc@redhat.com> - 2.35-9
- Disable LTO for bootstrapping purposes
* Fri Jul 31 2020 Nick Clifton <nickc@redhat.com> - 2.35-8
- Fix building with LTO enabled.
* Fri Jul 31 2020 Nick Clifton <nickc@redhat.com> - 2.35-7
- Set the sh_entsize field of the AArch64's PLT section to 0. (PR 26312)
* Thu Jul 30 2020 Richard W.M. Jones <rjones@redhat.com> - 2.35-6
- Disable LTO again, it causes "ar" to segfault.
* Thu Jul 30 2020 Nick Clifton <nickc@redhat.com> - 2.35-5
- Default to DWARF level 3 in the assembler.
* Mon Jul 27 2020 Fedora Release Engineering <releng@fedoraproject.org> - 2.35-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild
* Sun Jul 26 2020 Jeff Law <nickc@redhat.com> - 2.35-2
- Disable LTO for now
* Sun Jul 26 2020 Nick Clifton <nickc@redhat.com> - 2.35-1
- Rebase to GNU Binutils 2.35. (#1854613)
* Mon Jul 20 2020 Jeff Law <law@redhat.com> - 2.34-9
- Fix more configure tests compromised by LTO.
* Sun Jul 19 2020 Jeff Law <law@redhat.com> - 2.34-9
- Fix configure test compromised by LTO. Add appropriate BuildRequires
and force rebuliding the configure files in the appropriate dirs
- Fix various warnings exposed by LTO.
* Tue Jul 07 2020 Jeff Law <law@redhat.com> - 2.34-8
- Switch to using %%autosetup.
* Tue Jun 16 2020 Nick Clifton <nickc@redhat.com> - 2.34-7
- Add BPF support to the s390x target. (#1825193)
* Tue May 26 2020 Nick Clifton <nickc@redhat.com> - 2.34-6
- Enhance the error message displayed by the BFD library when it fails to load a plugin. (#1836618)
* Fri May 22 2020 Nick Clifton <nickc@redhat.com> - 2.34-5
- Rebase to tip of GNU Binutils 2.34 branch, brining in LTO fixes.
- Retire: binutils-nm-lto-plugin.patch
* Tue Apr 28 2020 Nick Clifton <nickc@redhat.com> - 2.34-4
- Fix seg fault when loading plugins via symlinks. (#1828587)
* Fri Apr 17 2020 Nick Clifton <nickc@redhat.com> - 2.34-3
- Add support for the BPF target. (#1825193)
* Sun Feb 16 2020 Nick Clifton <nickc@redhat.com> - 2.34-2
- Fix the plugin support architecture to allow proper symbol info handling. (PR 25355)
* Sun Feb 02 2020 Nick Clifton <nickc@redhat.com> - 2.34-1
- Rebase to GNU Binutils 2.34. (#1793098)
- Retire: binutils-improved-note-merging.patch
- Retire: binutils-CVE-2019-17451.patch
- Retire: binutils-CVE-2019-17450.patch
- Retire: binutils-addr2line-fixes.patch
* Tue Jan 28 2020 Fedora Release Engineering <releng@fedoraproject.org> - 2.33.1-13
- Rebuilt for https://fedoraproject.org/wiki/Fedora_32_Mass_Rebuild
* Thu Jan 23 2020 David Abdurachmanov <david.abdurachmanov@sifive.com> - 2.33.1-12
- Enable 64-bit BFD and PEP support for riscv. (#1794343)
* Thu Jan 02 2020 Nick Clifton <nickc@redhat.com> - 2.33.1-11
- Improve the accuracy of addr2line. (#1760967)
* Mon Dec 02 2019 Nick Clifton <nickc@redhat.com> - 2.33.1-10
- Re-enable strip merging build notes. (#1777760)

View File

@ -1,2 +1,2 @@
SHA512 (binutils-2.33.1.tar.xz) = b7a6767c6c7ca6b5cafa7080e6820b7bb3a53b7148348c438d99905defbdf0d30c9744a484ee01c9441a8153901808513366b15ba9533e20c9673c262ade36ac
SHA512 (binutils-2.35.tar.xz) = 9f222e4ab6720036402d03904fb11b73ab87714b85cd84997f7d357f405c7e10581d70202f9165a1ee0c70538632db27ecc9dfe627dddb1e6bc7edb1537cf786
SHA512 (binutils-2.19.50.0.1-output-format.sed) = 2f8686b0c8af13c98cda056824c2820416f6e2d003f70b78ccf5314525b9ee3684d421dfa83e638a2d42d06ea4d4bdaf5226b64d6ec26f7ff59c44ffb2a23dd2