Rebase to GNU Binutils 2.36.1.

This commit is contained in:
Nick Clifton 2021-02-11 13:36:12 +00:00
parent bbafdb8775
commit e1785a2a4b
34 changed files with 209 additions and 28084 deletions

1
.gitignore vendored
View File

@ -65,3 +65,4 @@ stamp-*
/binutils-2.19.50.0.1-output-format.sed
/binutils-2.35.tar.xz
/binutils-2.35.1.tar.xz
/binutils-2.36.1.tar.xz

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,158 @@
diff -rup binutils.orig/binutils/objcopy.c binutils-2.36.1/binutils/objcopy.c
--- binutils.orig/binutils/objcopy.c 2021-02-11 10:53:45.582148696 +0000
+++ binutils-2.36.1/binutils/objcopy.c 2021-02-11 10:54:25.226852733 +0000
@@ -3769,7 +3769,7 @@ copy_file (const char *input_filename, c
/* To allow us to do "strip *" without dying on the first
non-object file, failures are nonfatal. */
ibfd = bfd_openr (input_filename, input_target);
- if (ibfd == NULL || fstat (fileno (ibfd->iostream), in_stat) != 0)
+ if (ibfd == NULL || bfd_stat (ibfd, in_stat) != 0)
{
bfd_nonfatal_message (input_filename, NULL, NULL, NULL);
status = 1;
diff -rup binutils.orig/ld/testsuite/ld-i386/i386.exp binutils-2.36.1/ld/testsuite/ld-i386/i386.exp
--- binutils.orig/ld/testsuite/ld-i386/i386.exp 2021-02-11 10:53:45.739147527 +0000
+++ binutils-2.36.1/ld/testsuite/ld-i386/i386.exp 2021-02-11 10:55:36.505320591 +0000
@@ -1105,69 +1105,6 @@ if { [isnative]
{pass.c property-stack.S} \
"property-3-static" "pass.out" \
] \
- [list \
- "Run property 3" \
- "" \
- "-Wa,-mx86-used-note=yes" \
- {pass.c property-stack.S property-x86-1.S} \
- "property-3" "pass.out" \
- ] \
- [list \
- "Run property 3 (PIE)" \
- "-pie" \
- "-Wa,-mx86-used-note=yes" \
- {pass.c property-x86-1.S property-stack.S} \
- "property-3-pie" "pass.out" "-fPIE" \
- ] \
- [list \
- "Run property 3 (static)" \
- "-static" \
- "-Wa,-mx86-used-note=yes" \
- {property-x86-1.S pass.c property-stack.S} \
- "property-3-static" "pass.out" \
- ] \
- [list \
- "Run property 4" \
- "" \
- "-Wa,-mx86-used-note=yes" \
- {pass.c property-stack.S property-x86-1.S property-x86-2.S} \
- "property-4" "pass.out" \
- ] \
- [list \
- "Run property 4 (PIE)" \
- "-pie" \
- "-Wa,-mx86-used-note=yes" \
- {pass.c property-x86-2.S property-x86-1.S property-stack.S} \
- "property-4-pie" "pass.out" "-fPIE" \
- ] \
- [list \
- "Run property 4 (static)" \
- "-static" \
- "-Wa,-mx86-used-note=yes" \
- {property-x86-2.S property-x86-1.S pass.c property-stack.S} \
- "property-4-static" "pass.out" \
- ] \
- [list \
- "Run property 5" \
- "-Wl,-z,stack-size=0x900000" \
- "-Wa,-mx86-used-note=yes" \
- {pass.c property-stack.S property-x86-1.S property-x86-2.S} \
- "property-5" "pass.out" \
- ] \
- [list \
- "Run property 5 (PIE)" \
- "-pie -Wl,-z,stack-size=0x900000" \
- "-Wa,-mx86-used-note=yes" \
- {pass.c property-x86-2.S property-x86-1.S property-stack.S} \
- "property-5-pie" "pass.out" "-fPIE" \
- ] \
- [list \
- "Run property 5 (static)" \
- "-static -Wl,-z,stack-size=0x900000" \
- "-Wa,-mx86-used-note=yes" \
- {property-x86-2.S property-x86-1.S pass.c property-stack.S} \
- "property-5-static" "pass.out" \
- ] \
]
undefined_weak "$NOPIE_CFLAGS" "$NOPIE_LDFLAGS"
diff -rup binutils.orig/ld/testsuite/ld-x86-64/x86-64.exp binutils-2.36.1/ld/testsuite/ld-x86-64/x86-64.exp
--- binutils.orig/ld/testsuite/ld-x86-64/x86-64.exp 2021-02-11 10:53:45.702147802 +0000
+++ binutils-2.36.1/ld/testsuite/ld-x86-64/x86-64.exp 2021-02-11 10:56:09.481074386 +0000
@@ -1583,69 +1583,6 @@ if { [isnative] && [check_compiler_avail
"property-3-static" "pass.out" \
] \
[list \
- "Run property 3" \
- "" \
- "-Wa,-mx86-used-note=yes" \
- {pass.c property-stack.S property-x86-1.S} \
- "property-3" "pass.out" \
- ] \
- [list \
- "Run property 3 (PIE)" \
- "-pie" \
- "-Wa,-mx86-used-note=yes" \
- {pass.c property-x86-1.S property-stack.S} \
- "property-3-pie" "pass.out" "-fPIE" \
- ] \
- [list \
- "Run property 3 (static)" \
- "-static" \
- "-Wa,-mx86-used-note=yes" \
- {property-x86-1.S pass.c property-stack.S} \
- "property-3-static" "pass.out" \
- ] \
- [list \
- "Run property 4" \
- "" \
- "-Wa,-mx86-used-note=yes" \
- {pass.c property-stack.S property-x86-1.S property-x86-2.S} \
- "property-4" "pass.out" \
- ] \
- [list \
- "Run property 4 (PIE)" \
- "-pie" \
- "-Wa,-mx86-used-note=yes" \
- {pass.c property-x86-2.S property-x86-1.S property-stack.S} \
- "property-4-pie" "pass.out" "-fPIE" \
- ] \
- [list \
- "Run property 4 (static)" \
- "-static" \
- "-Wa,-mx86-used-note=yes" \
- {property-x86-2.S property-x86-1.S pass.c property-stack.S} \
- "property-4-static" "pass.out" \
- ] \
- [list \
- "Run property 5" \
- "-Wl,-z,stack-size=0x900000" \
- "-Wa,-mx86-used-note=yes" \
- {pass.c property-stack.S property-x86-1.S property-x86-2.S} \
- "property-5" "pass.out" \
- ] \
- [list \
- "Run property 5 (PIE)" \
- "-pie -Wl,-z,stack-size=0x900000" \
- "-Wa,-mx86-used-note=yes" \
- {pass.c property-x86-2.S property-x86-1.S property-stack.S} \
- "property-5-pie" "pass.out" "-fPIE" \
- ] \
- [list \
- "Run property 5 (static)" \
- "-static -Wl,-z,stack-size=0x900000" \
- "-Wa,-mx86-used-note=yes" \
- {property-x86-2.S property-x86-1.S pass.c property-stack.S} \
- "property-5-static" "pass.out" \
- ] \
- [list \
"Run pr22001-1a (PIC 1)" \
"$NOPIE_LDFLAGS -Wl,-z,nocopyreloc,--no-as-needed tmpdir/pr22001-1.so" \
"-Wa,-mx86-used-note=yes" \

View File

@ -1,778 +0,0 @@
diff -rup binutils.orig/bfd/bfd-in2.h binutils-2.35.1/bfd/bfd-in2.h
--- binutils.orig/bfd/bfd-in2.h 2021-01-29 11:14:51.848568548 +0000
+++ binutils-2.35.1/bfd/bfd-in2.h 2021-01-29 11:15:33.431322133 +0000
@@ -583,6 +583,8 @@ bfd *bfd_openr (const char *filename, co
bfd *bfd_fdopenr (const char *filename, const char *target, int fd);
+bfd *bfd_fdopenw (const char *filename, const char *target, int fd);
+
bfd *bfd_openstreamr (const char * filename, const char * target,
void * stream);
diff -rup binutils.orig/bfd/opncls.c binutils-2.35.1/bfd/opncls.c
--- binutils.orig/bfd/opncls.c 2021-01-29 11:14:51.846568560 +0000
+++ binutils-2.35.1/bfd/opncls.c 2021-01-29 11:15:33.431322133 +0000
@@ -395,6 +395,39 @@ bfd_fdopenr (const char *filename, const
/*
FUNCTION
+ bfd_fdopenw
+
+SYNOPSIS
+ bfd *bfd_fdopenw (const char *filename, const char *target, int fd);
+
+DESCRIPTION
+ <<bfd_fdopenw>> is exactly like <<bfd_fdopenr>> with the exception that
+ the resulting BFD is suitable for output.
+*/
+
+bfd *
+bfd_fdopenw (const char *filename, const char *target, int fd)
+{
+ bfd *out = bfd_fdopenr (filename, target, fd);
+
+ if (out != NULL)
+ {
+ if (!bfd_write_p (out))
+ {
+ close (fd);
+ _bfd_delete_bfd (out);
+ out = NULL;
+ bfd_set_error (bfd_error_invalid_operation);
+ }
+ else
+ out->direction = write_direction;
+ }
+
+ return out;
+}
+
+/*
+FUNCTION
bfd_openstreamr
SYNOPSIS
diff -rup binutils.orig/binutils/ar.c binutils-2.35.1/binutils/ar.c
--- binutils.orig/binutils/ar.c 2021-01-29 11:14:51.344571539 +0000
+++ binutils-2.35.1/binutils/ar.c 2021-01-29 11:15:56.174187367 +0000
@@ -25,6 +25,7 @@
#include "sysdep.h"
#include "bfd.h"
+#include "libbfd.h"
#include "libiberty.h"
#include "progress.h"
#include "getopt.h"
@@ -1195,20 +1196,26 @@ write_archive (bfd *iarch)
bfd *obfd;
char *old_name, *new_name;
bfd *contents_head = iarch->archive_next;
+ int ofd = -1;
+ struct stat target_stat;
+ bfd_boolean skip_stat = FALSE;
old_name = (char *) xmalloc (strlen (bfd_get_filename (iarch)) + 1);
strcpy (old_name, bfd_get_filename (iarch));
- new_name = make_tempname (old_name);
+ new_name = make_tempname (old_name, &ofd);
if (new_name == NULL)
bfd_fatal (_("could not create temporary file whilst writing archive"));
output_filename = new_name;
- obfd = bfd_openw (new_name, bfd_get_target (iarch));
+ obfd = bfd_fdopenw (new_name, bfd_get_target (iarch), ofd);
if (obfd == NULL)
- bfd_fatal (old_name);
+ {
+ close (ofd);
+ bfd_fatal (old_name);
+ }
output_bfd = obfd;
@@ -1237,6 +1244,14 @@ write_archive (bfd *iarch)
if (!bfd_set_archive_head (obfd, contents_head))
bfd_fatal (old_name);
+#if !defined (_WIN32) || defined (__CYGWIN32__)
+ ofd = dup (ofd);
+ if (iarch == NULL || iarch->iostream == NULL)
+ skip_stat = TRUE;
+ else if (ofd == -1 || fstat (fileno (iarch->iostream), &target_stat) != 0)
+ bfd_fatal (old_name);
+#endif
+
if (!bfd_close (obfd))
bfd_fatal (old_name);
@@ -1246,7 +1261,7 @@ write_archive (bfd *iarch)
/* We don't care if this fails; we might be creating the archive. */
bfd_close (iarch);
- if (smart_rename (new_name, old_name, 0) != 0)
+ if (smart_rename (new_name, old_name, ofd, skip_stat ? NULL : &target_stat, 0) != 0)
xexit (1);
free (old_name);
free (new_name);
diff -rup binutils.orig/binutils/arsup.c binutils-2.35.1/binutils/arsup.c
--- binutils.orig/binutils/arsup.c 2021-01-29 11:14:51.350571503 +0000
+++ binutils-2.35.1/binutils/arsup.c 2021-01-29 11:15:56.174187367 +0000
@@ -345,13 +345,25 @@ ar_save (void)
else
{
char *ofilename = xstrdup (bfd_get_filename (obfd));
+ bfd_boolean skip_stat = FALSE;
+ struct stat target_stat;
+ int ofd = -1;
if (deterministic > 0)
obfd->flags |= BFD_DETERMINISTIC_OUTPUT;
+#if !defined (_WIN32) || defined (__CYGWIN32__)
+ /* It's OK to fail; at worst it will result in SMART_RENAME using a slow
+ copy fallback to write the output. */
+ ofd = dup (fileno (obfd->iostream));
+ if (lstat (real_name, &target_stat) != 0)
+ skip_stat = TRUE;
+#endif
+
bfd_close (obfd);
- smart_rename (ofilename, real_name, 0);
+ smart_rename (ofilename, real_name, ofd,
+ skip_stat ? NULL : &target_stat, 0);
obfd = 0;
free (ofilename);
}
diff -rup binutils.orig/binutils/bucomm.c binutils-2.35.1/binutils/bucomm.c
--- binutils.orig/binutils/bucomm.c 2021-01-29 11:14:51.422571073 +0000
+++ binutils-2.35.1/binutils/bucomm.c 2021-01-29 11:15:33.431322133 +0000
@@ -532,7 +532,7 @@ template_in_dir (const char *path)
as FILENAME. */
char *
-make_tempname (const char *filename)
+make_tempname (const char *filename, int *ofd)
{
char *tmpname = template_in_dir (filename);
int fd;
@@ -550,7 +550,7 @@ make_tempname (const char *filename)
free (tmpname);
return NULL;
}
- close (fd);
+ *ofd = fd;
return tmpname;
}
diff -rup binutils.orig/binutils/bucomm.h binutils-2.35.1/binutils/bucomm.h
--- binutils.orig/binutils/bucomm.h 2021-01-29 11:14:51.350571503 +0000
+++ binutils-2.35.1/binutils/bucomm.h 2021-01-29 11:15:56.174187367 +0000
@@ -51,7 +51,7 @@ int display_info (void);
void print_arelt_descr (FILE *, bfd *, bfd_boolean, bfd_boolean);
-char *make_tempname (const char *);
+char *make_tempname (const char *, int *);
char *make_tempdir (const char *);
bfd_vma parse_vma (const char *, const char *);
@@ -71,7 +71,8 @@ extern void print_version (const char *)
/* In rename.c. */
extern void set_times (const char *, const struct stat *);
-extern int smart_rename (const char *, const char *, int);
+extern int smart_rename (const char *, const char *, int, struct stat *, int);
+
/* In libiberty. */
void *xmalloc (size_t);
diff -rup binutils.orig/binutils/objcopy.c binutils-2.35.1/binutils/objcopy.c
--- binutils.orig/binutils/objcopy.c 2021-01-29 11:14:51.342571551 +0000
+++ binutils-2.35.1/binutils/objcopy.c 2021-01-29 11:15:56.175187361 +0000
@@ -20,6 +20,7 @@
#include "sysdep.h"
#include "bfd.h"
+#include "libbfd.h"
#include "progress.h"
#include "getopt.h"
#include "libiberty.h"
@@ -3711,9 +3712,9 @@ set_long_section_mode (bfd *output_bfd,
/* The top-level control. */
static void
-copy_file (const char *input_filename, const char *output_filename,
- const char *input_target, const char *output_target,
- const bfd_arch_info_type *input_arch)
+copy_file (const char *input_filename, const char *output_filename, int ofd,
+ struct stat *in_stat, const char *input_target,
+ const char *output_target, const bfd_arch_info_type *input_arch)
{
bfd *ibfd;
char **obj_matching;
@@ -3732,7 +3733,7 @@ copy_file (const char *input_filename, c
/* To allow us to do "strip *" without dying on the first
non-object file, failures are nonfatal. */
ibfd = bfd_openr (input_filename, input_target);
- if (ibfd == NULL)
+ if (ibfd == NULL || fstat (fileno (ibfd->iostream), in_stat) != 0)
{
bfd_nonfatal_message (input_filename, NULL, NULL, NULL);
status = 1;
@@ -3786,9 +3787,14 @@ copy_file (const char *input_filename, c
else
force_output_target = TRUE;
- obfd = bfd_openw (output_filename, output_target);
+ if (ofd >= 0)
+ obfd = bfd_fdopenw (output_filename, output_target, ofd);
+ else
+ obfd = bfd_openw (output_filename, output_target);
+
if (obfd == NULL)
{
+ close (ofd);
bfd_nonfatal_message (output_filename, NULL, NULL, NULL);
status = 1;
return;
@@ -3816,13 +3822,19 @@ copy_file (const char *input_filename, c
if (output_target == NULL)
output_target = bfd_get_target (ibfd);
- obfd = bfd_openw (output_filename, output_target);
+ if (ofd >= 0)
+ obfd = bfd_fdopenw (output_filename, output_target, ofd);
+ else
+ obfd = bfd_openw (output_filename, output_target);
+
if (obfd == NULL)
{
+ close (ofd);
bfd_nonfatal_message (output_filename, NULL, NULL, NULL);
status = 1;
return;
}
+
/* This is a no-op on non-Coff targets. */
set_long_section_mode (obfd, ibfd, long_section_names);
@@ -4786,6 +4798,8 @@ strip_main (int argc, char *argv[])
int hold_status = status;
struct stat statbuf;
char *tmpname;
+ int tmpfd = -1;
+ int copyfd = -1;
if (get_file_size (argv[i]) < 1)
{
@@ -4793,18 +4807,18 @@ strip_main (int argc, char *argv[])
continue;
}
- if (preserve_dates)
- /* No need to check the return value of stat().
- It has already been checked in get_file_size(). */
- stat (argv[i], &statbuf);
-
if (output_file == NULL
|| filename_cmp (argv[i], output_file) == 0)
- tmpname = make_tempname (argv[i]);
+ tmpname = make_tempname (argv[i], &tmpfd);
else
tmpname = output_file;
- if (tmpname == NULL)
+ if (tmpname == NULL
+#if !defined (_WIN32) || defined (__CYGWIN32__)
+ /* Retain a copy of TMPFD since we will need it for SMART_RENAME. */
+ || (tmpfd >= 0 && (copyfd = dup (tmpfd)) == -1)
+#endif
+ )
{
bfd_nonfatal_message (argv[i], NULL, NULL,
_("could not create temporary file to hold stripped copy"));
@@ -4813,7 +4827,8 @@ strip_main (int argc, char *argv[])
}
status = 0;
- copy_file (argv[i], tmpname, input_target, output_target, NULL);
+ copy_file (argv[i], tmpname, tmpfd, &statbuf, input_target,
+ output_target, NULL);
if (status == 0)
{
if (preserve_dates)
@@ -4821,12 +4836,18 @@ strip_main (int argc, char *argv[])
if (output_file != tmpname)
status = (smart_rename (tmpname,
output_file ? output_file : argv[i],
- preserve_dates) != 0);
+ copyfd, &statbuf, preserve_dates) != 0);
if (status == 0)
status = hold_status;
}
else
- unlink_if_ordinary (tmpname);
+ {
+#if !defined (_WIN32) || defined (__CYGWIN32__)
+ if (copyfd >= 0)
+ close (copyfd);
+#endif
+ unlink_if_ordinary (tmpname);
+ }
if (output_file != tmpname)
free (tmpname);
}
@@ -5033,7 +5054,8 @@ copy_main (int argc, char *argv[])
bfd_boolean formats_info = FALSE;
bfd_boolean use_globalize = FALSE;
bfd_boolean use_keep_global = FALSE;
- int c;
+ int c, tmpfd = -1;
+ int copyfd = -1;
struct stat statbuf;
const bfd_arch_info_type *input_arch = NULL;
@@ -5870,34 +5892,43 @@ copy_main (int argc, char *argv[])
convert_efi_target (efi);
}
- if (preserve_dates)
- if (stat (input_filename, & statbuf) < 0)
- fatal (_("warning: could not locate '%s'. System error message: %s"),
- input_filename, strerror (errno));
-
/* If there is no destination file, or the source and destination files
are the same, then create a temp and rename the result into the input. */
if (output_filename == NULL
|| filename_cmp (input_filename, output_filename) == 0)
- tmpname = make_tempname (input_filename);
+ tmpname = make_tempname (input_filename, &tmpfd);
else
tmpname = output_filename;
- if (tmpname == NULL)
- fatal (_("warning: could not create temporary file whilst copying '%s', (error: %s)"),
- input_filename, strerror (errno));
+ if (tmpname == NULL
+#if !defined (_WIN32) || defined (__CYGWIN32__)
+ /* Retain a copy of TMPFD since we will need it for SMART_RENAME. */
+ || (tmpfd >= 0 && (copyfd = dup (tmpfd)) == -1)
+#endif
+ )
+ {
+ fatal (_("warning: could not create temporary file whilst copying '%s', (error: %s)"),
+ input_filename, strerror (errno));
+ }
- copy_file (input_filename, tmpname, input_target, output_target, input_arch);
+ copy_file (input_filename, tmpname, tmpfd, &statbuf, input_target,
+ output_target, input_arch);
if (status == 0)
{
if (preserve_dates)
set_times (tmpname, &statbuf);
if (tmpname != output_filename)
- status = (smart_rename (tmpname, input_filename,
+ status = (smart_rename (tmpname, input_filename, copyfd, &statbuf,
preserve_dates) != 0);
}
else
- unlink_if_ordinary (tmpname);
+ {
+#if !defined (_WIN32) || defined (__CYGWIN32__)
+ if (copyfd >= 0)
+ close (copyfd);
+#endif
+ unlink_if_ordinary (tmpname);
+ }
if (tmpname != output_filename)
free (tmpname);
diff -rup binutils.orig/binutils/rename.c binutils-2.35.1/binutils/rename.c
--- binutils.orig/binutils/rename.c 2021-01-29 11:14:51.422571073 +0000
+++ binutils-2.35.1/binutils/rename.c 2021-01-29 11:15:56.175187361 +0000
@@ -131,17 +131,55 @@ set_times (const char *destination, cons
#endif
#endif
-/* Rename FROM to TO, copying if TO is a link.
- Return 0 if ok, -1 if error. */
+#if !defined (_WIN32) || defined (__CYGWIN32__)
+/* Try to preserve the permission bits and ownership of an existing file when
+ rename overwrites it. FD is the file being renamed and TARGET_STAT has the
+ status of the file that was overwritten. */
+static void
+try_preserve_permissions (int fd, struct stat *target_stat)
+{
+ struct stat from_stat;
+ int ret = 0;
+
+ if (fstat (fd, &from_stat) != 0)
+ return;
+
+ int from_mode = from_stat.st_mode & 0777;
+ int to_mode = target_stat->st_mode & 0777;
+
+ /* Fix up permissions before we potentially lose ownership with fchown.
+ Clear the setxid bits because in case the fchown below fails then we don't
+ want to end up with a sxid file owned by the invoking user. If the user
+ hasn't changed or if fchown succeeded, we add back the sxid bits at the
+ end. */
+ if (from_mode != to_mode)
+ fchmod (fd, to_mode);
+
+ /* Fix up ownership, this will clear the setxid bits. */
+ if (from_stat.st_uid != target_stat->st_uid
+ || from_stat.st_gid != target_stat->st_gid)
+ ret = fchown (fd, target_stat->st_uid, target_stat->st_gid);
+
+ /* Fix up the sxid bits if either the fchown wasn't needed or it
+ succeeded. */
+ if (ret == 0)
+ fchmod (fd, target_stat->st_mode & 07777);
+}
+#endif
+
+/* Rename FROM to TO, copying if TO is either a link or is not a regular file.
+ FD is an open file descriptor pointing to FROM that we can use to safely fix
+ up permissions of the file after renaming. TARGET_STAT has the file status
+ that is used to fix up permissions and timestamps after rename. Return 0 if
+ ok, -1 if error and FD is closed before returning. */
int
-smart_rename (const char *from, const char *to, int preserve_dates ATTRIBUTE_UNUSED)
+smart_rename (const char *from, const char *to, int fd ATTRIBUTE_UNUSED,
+ struct stat *target_stat ATTRIBUTE_UNUSED,
+ int preserve_dates ATTRIBUTE_UNUSED)
{
- bfd_boolean exists;
- struct stat s;
int ret = 0;
-
- exists = lstat (to, &s) == 0;
+ bfd_boolean exists = target_stat != NULL;
#if defined (_WIN32) && !defined (__CYGWIN32__)
/* Win32, unlike unix, will not erase `to' in `rename(from, to)' but
@@ -158,36 +196,35 @@ smart_rename (const char *from, const ch
unlink (from);
}
#else
- /* Use rename only if TO is not a symbolic link and has
- only one hard link, and we have permission to write to it. */
+ /* Avoid a full copy and use rename if we can fix up permissions of the
+ file after renaming, i.e.:
+
+ - TO is not a symbolic link
+ - TO is a regular file with only one hard link
+ - We have permission to write to TO
+ - FD is available to safely fix up permissions to be the same as the file
+ we overwrote with the rename.
+
+ Note though that the actual file on disk that TARGET_STAT describes may
+ have changed and we're only trying to preserve the status we know about.
+ At no point do we try to interact with the new file changes, so there can
+ only be two outcomes, i.e. either the external file change survives
+ without knowledge of our change (if it happens after the rename syscall)
+ or our rename and permissions fixup survive without any knowledge of the
+ external change. */
if (! exists
- || (!S_ISLNK (s.st_mode)
- && S_ISREG (s.st_mode)
- && (s.st_mode & S_IWUSR)
- && s.st_nlink == 1)
+ || (fd >= 0
+ && !S_ISLNK (target_stat->st_mode)
+ && S_ISREG (target_stat->st_mode)
+ && (target_stat->st_mode & S_IWUSR)
+ && target_stat->st_nlink == 1)
)
{
ret = rename (from, to);
if (ret == 0)
{
if (exists)
- {
- /* Try to preserve the permission bits and ownership of
- TO. First get the mode right except for the setuid
- bit. Then change the ownership. Then fix the setuid
- bit. We do the chmod before the chown because if the
- chown succeeds, and we are a normal user, we won't be
- able to do the chmod afterward. We don't bother to
- fix the setuid bit first because that might introduce
- a fleeting security problem, and because the chown
- will clear the setuid bit anyhow. We only fix the
- setuid bit if the chown succeeds, because we don't
- want to introduce an unexpected setuid file owned by
- the user running objcopy. */
- chmod (to, s.st_mode & 0777);
- if (chown (to, s.st_uid, s.st_gid) >= 0)
- chmod (to, s.st_mode & 07777);
- }
+ try_preserve_permissions (fd, target_stat);
}
else
{
@@ -203,9 +240,11 @@ smart_rename (const char *from, const ch
non_fatal (_("unable to copy file '%s'; reason: %s"), to, strerror (errno));
if (preserve_dates)
- set_times (to, &s);
+ set_times (to, target_stat);
unlink (from);
}
+ if (fd >= 0)
+ close (fd);
#endif /* _WIN32 && !__CYGWIN32__ */
return ret;
diff -rup binutils.orig/binutils/ar.c binutils-2.35.1/binutils/ar.c
--- binutils.orig/binutils/ar.c 2021-02-02 13:01:42.257734944 +0000
+++ binutils-2.35.1/binutils/ar.c 2021-02-02 13:11:13.340958352 +0000
@@ -25,7 +25,6 @@
#include "sysdep.h"
#include "bfd.h"
-#include "libbfd.h"
#include "libiberty.h"
#include "progress.h"
#include "getopt.h"
@@ -1082,7 +1081,7 @@ open_output_file (bfd * abfd)
output_filename, base);
output_filename = base;
}
-
+
if (output_dir)
{
size_t len = strlen (output_dir);
@@ -1099,7 +1098,7 @@ open_output_file (bfd * abfd)
if (verbose)
printf ("x - %s\n", output_filename);
-
+
FILE * ostream = fopen (output_filename, FOPEN_WB);
if (ostream == NULL)
{
@@ -1198,10 +1197,8 @@ write_archive (bfd *iarch)
bfd *contents_head = iarch->archive_next;
int ofd = -1;
struct stat target_stat;
- bfd_boolean skip_stat = FALSE;
- old_name = (char *) xmalloc (strlen (bfd_get_filename (iarch)) + 1);
- strcpy (old_name, bfd_get_filename (iarch));
+ old_name = xstrdup (bfd_get_filename (iarch));
new_name = make_tempname (old_name, &ofd);
if (new_name == NULL)
@@ -1246,11 +1243,9 @@ write_archive (bfd *iarch)
#if !defined (_WIN32) || defined (__CYGWIN32__)
ofd = dup (ofd);
- if (iarch == NULL || iarch->iostream == NULL)
- skip_stat = TRUE;
- else if (ofd == -1 || fstat (fileno (iarch->iostream), &target_stat) != 0)
- bfd_fatal (old_name);
#endif
+ if (ofd == -1 || bfd_stat (iarch, &target_stat) != 0)
+ bfd_fatal (old_name);
if (!bfd_close (obfd))
bfd_fatal (old_name);
@@ -1261,7 +1256,7 @@ write_archive (bfd *iarch)
/* We don't care if this fails; we might be creating the archive. */
bfd_close (iarch);
- if (smart_rename (new_name, old_name, ofd, skip_stat ? NULL : &target_stat, 0) != 0)
+ if (smart_rename (new_name, old_name, ofd, &target_stat, 0) != 0)
xexit (1);
free (old_name);
free (new_name);
Only in binutils-2.35.1/binutils/: ar.c.orig
Only in binutils-2.35.1/binutils/: ar.c.rej
diff -rup binutils.orig/binutils/arsup.c binutils-2.35.1/binutils/arsup.c
--- binutils.orig/binutils/arsup.c 2021-02-02 13:01:42.208735269 +0000
+++ binutils-2.35.1/binutils/arsup.c 2021-02-02 13:11:55.725678308 +0000
@@ -42,6 +42,8 @@ extern int deterministic;
static bfd *obfd;
static char *real_name;
+static char *temp_name;
+static int real_ofd;
static FILE *outfile;
static void
@@ -149,27 +151,24 @@ maybequit (void)
void
ar_open (char *name, int t)
{
- char *tname;
- const char *bname = lbasename (name);
- real_name = name;
-
- /* Prepend tmp- to the beginning, to avoid file-name clashes after
- truncation on filesystems with limited namespaces (DOS). */
- if (asprintf (&tname, "%.*stmp-%s", (int) (bname - name), name, bname) == -1)
+ real_name = xstrdup (name);
+ temp_name = make_tempname (real_name, &real_ofd);
+
+ if (temp_name == NULL)
{
- fprintf (stderr, _("%s: Can't allocate memory for temp name (%s)\n"),
+ fprintf (stderr, _("%s: Can't open temporary file (%s)\n"),
program_name, strerror(errno));
maybequit ();
return;
}
- obfd = bfd_openw (tname, NULL);
+ obfd = bfd_fdopenw (temp_name, NULL, real_ofd);
if (!obfd)
{
fprintf (stderr,
_("%s: Can't open output archive %s\n"),
- program_name, tname);
+ program_name, temp_name);
maybequit ();
}
@@ -344,10 +343,9 @@ ar_save (void)
}
else
{
- char *ofilename = xstrdup (bfd_get_filename (obfd));
bfd_boolean skip_stat = FALSE;
struct stat target_stat;
- int ofd = -1;
+ int ofd = real_ofd;
if (deterministic > 0)
obfd->flags |= BFD_DETERMINISTIC_OUTPUT;
@@ -355,17 +353,18 @@ ar_save (void)
#if !defined (_WIN32) || defined (__CYGWIN32__)
/* It's OK to fail; at worst it will result in SMART_RENAME using a slow
copy fallback to write the output. */
- ofd = dup (fileno (obfd->iostream));
- if (lstat (real_name, &target_stat) != 0)
- skip_stat = TRUE;
+ ofd = dup (ofd);
#endif
-
bfd_close (obfd);
- smart_rename (ofilename, real_name, ofd,
+ if (ofd == -1 || fstat (ofd, &target_stat) != 0)
+ skip_stat = TRUE;
+
+ smart_rename (temp_name, real_name, ofd,
skip_stat ? NULL : &target_stat, 0);
obfd = 0;
- free (ofilename);
+ free (temp_name);
+ free (real_name);
}
}
Only in binutils-2.35.1/binutils/: arsup.c.orig
Only in binutils-2.35.1/binutils/: arsup.c.rej
diff -rup binutils.orig/binutils/objcopy.c binutils-2.35.1/binutils/objcopy.c
--- binutils.orig/binutils/objcopy.c 2021-02-02 13:01:42.214735229 +0000
+++ binutils-2.35.1/binutils/objcopy.c 2021-02-02 13:13:27.613071192 +0000
@@ -20,7 +20,6 @@
#include "sysdep.h"
#include "bfd.h"
-#include "libbfd.h"
#include "progress.h"
#include "getopt.h"
#include "libiberty.h"
@@ -3733,7 +3732,7 @@ copy_file (const char *input_filename, c
/* To allow us to do "strip *" without dying on the first
non-object file, failures are nonfatal. */
ibfd = bfd_openr (input_filename, input_target);
- if (ibfd == NULL || fstat (fileno (ibfd->iostream), in_stat) != 0)
+ if (ibfd == NULL || bfd_stat (ibfd, in_stat) != 0)
{
bfd_nonfatal_message (input_filename, NULL, NULL, NULL);
status = 1;
Only in binutils-2.35.1/binutils/: objcopy.c.orig
Only in binutils-2.35.1/binutils/: objcopy.c.rej
--- binutils.orig/binutils/arsup.c 2021-02-04 10:42:03.265729780 +0000
+++ binutils-2.35.1/binutils/arsup.c 2021-02-04 10:45:48.439166658 +0000
@@ -357,8 +357,21 @@ ar_save (void)
#endif
bfd_close (obfd);
- if (ofd == -1 || fstat (ofd, &target_stat) != 0)
- skip_stat = TRUE;
+ if (lstat (real_name, &target_stat) != 0)
+ {
+ /* The temp file created in ar_open has mode 0600 as per mkstemp.
+ Create the real empty output file here so smart_rename will
+ update the mode according to the process umask. */
+ obfd = bfd_openw (real_name, NULL);
+ if (obfd == NULL
+ || bfd_stat (obfd, &target_stat) != 0)
+ skip_stat = TRUE;
+ if (obfd != NULL)
+ {
+ bfd_set_format (obfd, bfd_archive);
+ bfd_close (obfd);
+ }
+ }
smart_rename (temp_name, real_name, ofd,
skip_stat ? NULL : &target_stat, 0);
--- binutils.orig/binutils/rename.c 2021-02-08 11:02:58.767933783 +0000
+++ binutils-2.35.1/binutils/rename.c 2021-02-08 11:20:37.539179363 +0000
@@ -179,7 +179,10 @@ smart_rename (const char *from, const ch
int preserve_dates ATTRIBUTE_UNUSED)
{
int ret = 0;
- bfd_boolean exists = target_stat != NULL;
+ struct stat to_stat;
+ bfd_boolean exists;
+
+ exists = lstat (to, &to_stat) == 0;
#if defined (_WIN32) && !defined (__CYGWIN32__)
/* Win32, unlike unix, will not erase `to' in `rename(from, to)' but
@@ -214,16 +217,16 @@ smart_rename (const char *from, const ch
external change. */
if (! exists
|| (fd >= 0
- && !S_ISLNK (target_stat->st_mode)
- && S_ISREG (target_stat->st_mode)
- && (target_stat->st_mode & S_IWUSR)
- && target_stat->st_nlink == 1)
+ && !S_ISLNK (to_stat.st_mode)
+ && S_ISREG (to_stat.st_mode)
+ && (to_stat.st_mode & S_IWUSR)
+ && to_stat.st_nlink == 1)
)
{
ret = rename (from, to);
if (ret == 0)
{
- if (exists)
+ if (exists && target_stat != NULL)
try_preserve_permissions (fd, target_stat);
}
else
@@ -239,7 +242,7 @@ smart_rename (const char *from, const ch
if (ret != 0)
non_fatal (_("unable to copy file '%s'; reason: %s"), to, strerror (errno));
- if (preserve_dates)
+ if (preserve_dates && target_stat != NULL)
set_times (to, target_stat);
unlink (from);
}

View File

@ -1,24 +0,0 @@
--- binutils.orig/bfd/dwarf2.c 2021-01-25 11:26:26.761405305 +0000
+++ binutils-2.35.1/bfd/dwarf2.c 2021-01-25 11:28:51.838572824 +0000
@@ -3252,9 +3252,11 @@ read_rnglists (struct comp_unit *unit, s
low_pc = base_address;
low_pc += _bfd_safe_read_leb128 (abfd, rngs_ptr, &bytes_read,
FALSE, rngs_end);
+ rngs_ptr += bytes_read;
high_pc = base_address;
high_pc += _bfd_safe_read_leb128 (abfd, rngs_ptr, &bytes_read,
FALSE, rngs_end);
+ rngs_ptr += bytes_read;
break;
case DW_RLE_start_end:
@@ -3274,9 +3276,6 @@ read_rnglists (struct comp_unit *unit, s
return FALSE;
}
- if ((low_pc == 0 && high_pc == 0) || low_pc == high_pc)
- return FALSE;
-
if (!arange_add (unit, arange, low_pc, high_pc))
return FALSE;
}

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -1,223 +0,0 @@
diff -rup binutils.orig/bfd/bfd-in2.h binutils-2.35.1/bfd/bfd-in2.h
--- binutils.orig/bfd/bfd-in2.h 2021-01-04 13:18:10.234368481 +0000
+++ binutils-2.35.1/bfd/bfd-in2.h 2021-01-04 13:18:20.596301287 +0000
@@ -1177,6 +1177,9 @@ typedef struct bfd_section
struct bfd_symbol *symbol;
struct bfd_symbol **symbol_ptr_ptr;
+ /* The matching section name pattern in linker script. */
+ const char *pattern;
+
/* Early in the link process, map_head and map_tail are used to build
a list of input sections attached to an output section. Later,
output sections use these fields for a list of bfd_link_order
@@ -1370,8 +1373,8 @@ discarded_section (const asection *sec)
/* target_index, used_by_bfd, constructor_chain, owner, */ \
0, NULL, NULL, NULL, \
\
- /* symbol, symbol_ptr_ptr, */ \
- (struct bfd_symbol *) SYM, &SEC.symbol, \
+ /* symbol, symbol_ptr_ptr, pattern, */ \
+ (struct bfd_symbol *) SYM, &SEC.symbol, NULL, \
\
/* map_head, map_tail, already_assigned */ \
{ NULL }, { NULL }, NULL \
diff -rup binutils.orig/bfd/elflink.c binutils-2.35.1/bfd/elflink.c
--- binutils.orig/bfd/elflink.c 2021-01-04 13:18:10.223368552 +0000
+++ binutils-2.35.1/bfd/elflink.c 2021-01-04 13:18:20.599301268 +0000
@@ -11662,8 +11662,21 @@ compare_link_order (const void *a, const
const struct bfd_link_order *blo = *(const struct bfd_link_order **) b;
asection *asec = elf_linked_to_section (alo->u.indirect.section);
asection *bsec = elf_linked_to_section (blo->u.indirect.section);
- bfd_vma apos = asec->output_section->lma + asec->output_offset;
- bfd_vma bpos = bsec->output_section->lma + bsec->output_offset;
+ bfd_vma apos, bpos;
+
+ /* Check if any sections are unordered. */
+ if (asec == NULL || bsec == NULL)
+ {
+ /* Place ordered sections before unordered sections. */
+ if (bsec != NULL)
+ return 1;
+ else if (asec != NULL)
+ return -1;
+ return 0;
+ }
+
+ apos = asec->output_section->lma + asec->output_offset;
+ bpos = bsec->output_section->lma + bsec->output_offset;
if (apos < bpos)
return -1;
@@ -11698,14 +11711,14 @@ compare_link_order (const void *a, const
sections. Ideally we'd do this in the linker proper. */
static bfd_boolean
-elf_fixup_link_order (bfd *abfd, asection *o)
+elf_fixup_link_order (struct bfd_link_info *info, bfd *abfd, asection *o)
{
size_t seen_linkorder;
size_t seen_other;
size_t n;
struct bfd_link_order *p;
bfd *sub;
- struct bfd_link_order **sections;
+ struct bfd_link_order **sections, **indirect_sections;
asection *other_sec, *linkorder_sec;
bfd_vma offset; /* Octets. */
@@ -11736,7 +11749,9 @@ elf_fixup_link_order (bfd *abfd, asectio
else
seen_other++;
- if (seen_other && seen_linkorder)
+ /* Allow mixed ordered and unordered input sections for
+ non-relocatable link. */
+ if (bfd_link_relocatable (info) && seen_other && seen_linkorder)
{
if (other_sec && linkorder_sec)
_bfd_error_handler
@@ -11756,6 +11771,10 @@ elf_fixup_link_order (bfd *abfd, asectio
if (!seen_linkorder)
return TRUE;
+ /* Non-relocatable output can have both ordered and unordered input
+ sections. */
+ seen_linkorder += seen_other;
+
sections = bfd_malloc (seen_linkorder * sizeof (*sections));
if (sections == NULL)
return FALSE;
@@ -11764,22 +11783,51 @@ elf_fixup_link_order (bfd *abfd, asectio
for (p = o->map_head.link_order; p != NULL; p = p->next)
sections[seen_linkorder++] = p;
- /* Sort the input sections in the order of their linked section. */
- qsort (sections, seen_linkorder, sizeof (*sections), compare_link_order);
+ for (indirect_sections = sections, n = 0; n < seen_linkorder;)
+ {
+ /* Find the first bfd_indirect_link_order section. */
+ if (indirect_sections[0]->type == bfd_indirect_link_order)
+ {
+ /* Count the consecutive bfd_indirect_link_order sections
+ with the same pattern. */
+ size_t i, n_indirect;
+ const char *pattern
+ = indirect_sections[0]->u.indirect.section->pattern;
+ for (i = n + 1; i < seen_linkorder; i++)
+ if (sections[i]->type != bfd_indirect_link_order
+ || sections[i]->u.indirect.section->pattern != pattern)
+ break;
+ n_indirect = i - n;
+ /* Sort the bfd_indirect_link_order sections in the order of
+ their linked section. */
+ qsort (indirect_sections, n_indirect, sizeof (*sections),
+ compare_link_order);
+ indirect_sections += n_indirect;
+ n += n_indirect;
+ }
+ else
+ {
+ indirect_sections++;
+ n++;
+ }
+ }
- /* Change the offsets of the sections. */
+ /* Change the offsets of the bfd_indirect_link_order sections. */
offset = 0;
for (n = 0; n < seen_linkorder; n++)
- {
- bfd_vma mask;
- asection *s = sections[n]->u.indirect.section;
- unsigned int opb = bfd_octets_per_byte (abfd, s);
-
- mask = ~(bfd_vma) 0 << s->alignment_power * opb;
- offset = (offset + ~mask) & mask;
- sections[n]->offset = s->output_offset = offset / opb;
- offset += sections[n]->size;
- }
+ if (sections[n]->type == bfd_indirect_link_order)
+ {
+ bfd_vma mask;
+ asection *s = sections[n]->u.indirect.section;
+ unsigned int opb = bfd_octets_per_byte (abfd, s);
+
+ mask = ~(bfd_vma) 0 << s->alignment_power * opb;
+ offset = (offset + ~mask) & mask;
+ sections[n]->offset = s->output_offset = offset / opb;
+ offset += sections[n]->size;
+ }
+ else
+ offset = sections[n]->offset + sections[n]->size;
free (sections);
return TRUE;
@@ -12408,7 +12456,7 @@ bfd_elf_final_link (bfd *abfd, struct bf
/* Reorder SHF_LINK_ORDER sections. */
for (o = abfd->sections; o != NULL; o = o->next)
{
- if (!elf_fixup_link_order (abfd, o))
+ if (!elf_fixup_link_order (info, abfd, o))
return FALSE;
}
diff -rup binutils.orig/bfd/section.c binutils-2.35.1/bfd/section.c
--- binutils.orig/bfd/section.c 2021-01-04 13:18:10.233368487 +0000
+++ binutils-2.35.1/bfd/section.c 2021-01-04 13:18:20.599301268 +0000
@@ -541,6 +541,9 @@ CODE_FRAGMENT
. struct bfd_symbol *symbol;
. struct bfd_symbol **symbol_ptr_ptr;
.
+. {* The matching section name pattern in linker script. *}
+. const char *pattern;
+.
. {* Early in the link process, map_head and map_tail are used to build
. a list of input sections attached to an output section. Later,
. output sections use these fields for a list of bfd_link_order
@@ -734,8 +737,8 @@ CODE_FRAGMENT
. {* target_index, used_by_bfd, constructor_chain, owner, *} \
. 0, NULL, NULL, NULL, \
. \
-. {* symbol, symbol_ptr_ptr, *} \
-. (struct bfd_symbol *) SYM, &SEC.symbol, \
+. {* symbol, symbol_ptr_ptr, pattern, *} \
+. (struct bfd_symbol *) SYM, &SEC.symbol, NULL, \
. \
. {* map_head, map_tail, already_assigned *} \
. { NULL }, { NULL }, NULL \
diff -rup binutils.orig/gas/config/obj-elf.c binutils-2.35.1/gas/config/obj-elf.c
--- binutils.orig/gas/config/obj-elf.c 2021-01-04 13:18:09.942370375 +0000
+++ binutils-2.35.1/gas/config/obj-elf.c 2021-01-04 13:18:20.599301268 +0000
@@ -659,7 +659,9 @@ obj_elf_change_section (const char *name
}
}
- if (old_sec == NULL && ((attr & ~(SHF_MASKOS | SHF_MASKPROC))
+ if (old_sec == NULL && ((attr & ~(SHF_LINK_ORDER
+ | SHF_MASKOS
+ | SHF_MASKPROC))
& ~ssect->attr) != 0)
{
/* As a GNU extension, we permit a .note section to be
diff -rup binutils.orig/ld/ldlang.c binutils-2.35.1/ld/ldlang.c
--- binutils.orig/ld/ldlang.c 2021-01-04 13:18:09.691372002 +0000
+++ binutils-2.35.1/ld/ldlang.c 2021-01-04 13:18:20.600301261 +0000
@@ -7421,7 +7421,7 @@ lang_reset_memory_regions (void)
static void
gc_section_callback (lang_wild_statement_type *ptr,
- struct wildcard_list *sec ATTRIBUTE_UNUSED,
+ struct wildcard_list *sec,
asection *section,
struct flag_info *sflag_info ATTRIBUTE_UNUSED,
lang_input_statement_type *file ATTRIBUTE_UNUSED,
@@ -7431,6 +7431,8 @@ gc_section_callback (lang_wild_statement
should be as well. */
if (ptr->keep_sections)
section->flags |= SEC_KEEP;
+ if (sec)
+ section->pattern = sec->spec.name;
}
/* Iterate over sections marking them against GC. */

View File

@ -1,93 +0,0 @@
diff -rup binutils.orig/bfd/elfnn-aarch64.c binutils-2.35/bfd/elfnn-aarch64.c
--- binutils.orig/bfd/elfnn-aarch64.c 2020-09-10 17:03:31.738458044 +0100
+++ binutils-2.35/bfd/elfnn-aarch64.c 2020-09-10 17:04:03.643344898 +0100
@@ -5445,7 +5445,6 @@ elfNN_aarch64_final_link_relocate (reloc
bfd_vma orig_value = value;
bfd_boolean resolved_to_zero;
bfd_boolean abs_symbol_p;
- bfd_boolean via_plt_p;
globals = elf_aarch64_hash_table (info);
@@ -5467,8 +5466,6 @@ elfNN_aarch64_final_link_relocate (reloc
: bfd_is_und_section (sym_sec));
abs_symbol_p = h != NULL && bfd_is_abs_symbol (&h->root);
- via_plt_p = (globals->root.splt != NULL && h != NULL
- && h->plt.offset != (bfd_vma) - 1);
/* Since STT_GNU_IFUNC symbol must go through PLT, we handle
it here if it is defined in a non-shared object. */
@@ -5805,23 +5802,12 @@ elfNN_aarch64_final_link_relocate (reloc
value += signed_addend;
break;
- case BFD_RELOC_AARCH64_BRANCH19:
- case BFD_RELOC_AARCH64_TSTBR14:
- /* A conditional branch to an undefined weak symbol is converted to a
- branch to itself. */
- if (weak_undef_p && !via_plt_p)
- {
- value = _bfd_aarch64_elf_resolve_relocation (input_bfd, bfd_r_type,
- place, value,
- signed_addend,
- weak_undef_p);
- break;
- }
- /* Fall through. */
case BFD_RELOC_AARCH64_CALL26:
case BFD_RELOC_AARCH64_JUMP26:
{
asection *splt = globals->root.splt;
+ bfd_boolean via_plt_p =
+ splt != NULL && h != NULL && h->plt.offset != (bfd_vma) - 1;
/* A call to an undefined weak symbol is converted to a jump to
the next instruction unless a PLT entry will be created.
@@ -5902,6 +5888,23 @@ elfNN_aarch64_final_link_relocate (reloc
bfd_set_error (bfd_error_bad_value);
return bfd_reloc_notsupported;
}
+ value = _bfd_aarch64_elf_resolve_relocation (input_bfd, bfd_r_type,
+ place, value,
+ signed_addend,
+ weak_undef_p);
+ break;
+
+ case BFD_RELOC_AARCH64_BRANCH19:
+ case BFD_RELOC_AARCH64_TSTBR14:
+ if (h && h->root.type == bfd_link_hash_undefined)
+ {
+ _bfd_error_handler
+ /* xgettext:c-format */
+ (_("%pB: conditional branch to undefined symbol `%s' "
+ "not allowed"), input_bfd, h->root.root.string);
+ bfd_set_error (bfd_error_bad_value);
+ return bfd_reloc_notsupported;
+ }
/* Fall through. */
case BFD_RELOC_AARCH64_16:
@@ -7967,8 +7970,6 @@ elfNN_aarch64_check_relocs (bfd *abfd, s
break;
}
- case BFD_RELOC_AARCH64_BRANCH19:
- case BFD_RELOC_AARCH64_TSTBR14:
case BFD_RELOC_AARCH64_CALL26:
case BFD_RELOC_AARCH64_JUMP26:
/* If this is a local symbol then we resolve it
Only in binutils-2.35/bfd: elfnn-aarch64.c.orig
diff -rup binutils.orig/ld/testsuite/ld-aarch64/emit-relocs-560.d binutils-2.35/ld/testsuite/ld-aarch64/emit-relocs-560.d
--- binutils.orig/ld/testsuite/ld-aarch64/emit-relocs-560.d 2020-09-10 17:03:31.067460424 +0100
+++ binutils-2.35/ld/testsuite/ld-aarch64/emit-relocs-560.d 2020-09-10 17:04:03.644344895 +0100
@@ -1,8 +1,3 @@
#source: emit-relocs-560.s
#ld: -shared
-#readelf: -r
-
-Relocation section '.rela.plt' at offset 0x[0-9a-f]+ contains 2 entries:
- Offset Info Type Sym. Value Sym. Name \+ Addend
-[0-9a-f]+ 000100000402 R_AARCH64_JUMP_SL 0000000000000000 baz \+ 0
-[0-9a-f]+ 000200000402 R_AARCH64_JUMP_SL 0000000000000000 bar \+ 0
+#error: .*: conditional branch to undefined symbol `bar' not allowed

File diff suppressed because it is too large Load Diff

View File

@ -1,70 +0,0 @@
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);
+static void obj_elf_attach_to_group (int);
static const pseudo_typeS elf_pseudo_table[] =
{
+ {"attach_to_group", obj_elf_attach_to_group, 0},
{"comm", obj_elf_common, 0},
{"common", obj_elf_common, 1},
{"ident", obj_elf_ident, 0},
@@ -1003,6 +1005,27 @@ obj_elf_section_name (void)
return name;
}
+static void
+obj_elf_attach_to_group (int dummy ATTRIBUTE_UNUSED)
+{
+ const char * gname = obj_elf_section_name ();
+
+ if (gname == NULL)
+ {
+ as_warn ("group name not parseable");
+ return;
+ }
+
+ if (elf_group_name (now_seg))
+ {
+ as_warn ("already has a group");
+ return;
+ }
+
+ elf_group_name (now_seg) = xstrdup (gname);
+ elf_section_flags (now_seg) |= SHF_GROUP;
+}
+
void
obj_elf_section (int push)
{
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}]]}
* Bundle directives:: @code{.bundle_align_mode @var{abs-expr}}, etc
* Byte:: @code{.byte @var{expressions}}
@@ -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''.
+@node Attach_to_group
+@section @code{.attach_to_group @var{name}}
+Attaches the current section to the named group. This is like declaring
+the section with the @code{G} attribute, but can be done after the section
+has been created.
+
@node Balign
@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

View File

@ -1,44 +0,0 @@
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

@ -1,34 +0,0 @@
diff -rup binutils.orig/ld/ldlang.c binutils-2.35.1/ld/ldlang.c
--- binutils.orig/ld/ldlang.c 2021-01-04 15:20:32.901498036 +0000
+++ binutils-2.35.1/ld/ldlang.c 2021-01-04 15:22:03.151916333 +0000
@@ -1529,6 +1529,8 @@ lang_output_section_statement_lookup (co
entry->s.output_section_statement.name = name;
entry->s.output_section_statement.constraint = constraint;
+ entry->s.output_section_statement.dup_output = (create == 2
+ || constraint == SPECIAL);
return &entry->s.output_section_statement;
}
@@ -2390,7 +2392,7 @@ init_os (lang_output_section_statement_t
if (strcmp (s->name, DISCARD_SECTION_NAME) == 0)
einfo (_("%F%P: illegal use of `%s' section\n"), DISCARD_SECTION_NAME);
- if (s->constraint != SPECIAL)
+ if (!s->dup_output)
s->bfd_section = bfd_get_section_by_name (link_info.output_bfd, s->name);
if (s->bfd_section == NULL)
s->bfd_section = bfd_make_section_anyway_with_flags (link_info.output_bfd,
diff -rup binutils.orig/ld/ldlang.h binutils-2.35.1/ld/ldlang.h
--- binutils.orig/ld/ldlang.h 2021-01-04 15:20:32.627499830 +0000
+++ binutils-2.35.1/ld/ldlang.h 2021-01-04 15:21:06.688277003 +0000
@@ -173,6 +173,9 @@ typedef struct lang_output_section_state
unsigned int after_end : 1;
/* If this section uses the alignment of its input sections. */
unsigned int align_lma_with_input : 1;
+ /* If script has duplicate output section statements of the same name
+ create duplicate output sections. */
+ unsigned int dup_output : 1;
} lang_output_section_statement_type;
typedef struct

View File

@ -1,34 +0,0 @@
diff --git a/binutils/dwarf.c b/binutils/dwarf.c
index 5807744729..cf68ebaff7 100644
--- a/binutils/dwarf.c
+++ b/binutils/dwarf.c
@@ -2025,6 +2025,21 @@ skip_attr_bytes (unsigned long form,
break;
case DW_FORM_ref8:
+ {
+ dwarf_vma high_bits;
+
+ SAFE_BYTE_GET64 (data, &high_bits, &uvalue, end);
+ data += 8;
+ if (sizeof (uvalue) > 4)
+ uvalue += high_bits << 32;
+ else if (high_bits != 0)
+ {
+ /* FIXME: What to do ? */
+ return NULL;
+ }
+ break;
+ }
+
case DW_FORM_data8:
case DW_FORM_ref_sig8:
data += 8;
@@ -2115,6 +2130,7 @@ get_type_abbrev_from_form (unsigned long form,
case DW_FORM_ref1:
case DW_FORM_ref2:
case DW_FORM_ref4:
+ case DW_FORM_ref8:
case DW_FORM_ref_udata:
if (uvalue + cu_offset > section->size)
{

View File

@ -1,142 +0,0 @@
--- binutils.orig/binutils/dwarf.c 2020-11-03 17:10:15.182386267 +0000
+++ binutils-2.35.1/binutils/dwarf.c 2020-11-03 17:14:38.660411672 +0000
@@ -876,6 +876,7 @@ typedef struct abbrev_list
{
abbrev_entry * first_abbrev;
abbrev_entry * last_abbrev;
+ dwarf_vma abbrev_base;
dwarf_vma abbrev_offset;
struct abbrev_list * next;
unsigned char * start_of_next_abbrevs;
@@ -955,10 +956,11 @@ free_all_abbrevs (void)
}
static abbrev_list *
-new_abbrev_list (dwarf_vma abbrev_offset)
+new_abbrev_list (dwarf_vma abbrev_base, dwarf_vma abbrev_offset)
{
abbrev_list * list = (abbrev_list *) xcalloc (sizeof * list, 1);
+ list->abbrev_base = abbrev_base;
list->abbrev_offset = abbrev_offset;
list->next = abbrev_lists;
@@ -968,12 +970,14 @@ new_abbrev_list (dwarf_vma abbrev_offset
}
static abbrev_list *
-find_abbrev_list_by_abbrev_offset (dwarf_vma abbrev_offset)
+find_abbrev_list_by_abbrev_offset (dwarf_vma abbrev_base,
+ dwarf_vma abbrev_offset)
{
abbrev_list * list;
for (list = abbrev_lists; list != NULL; list = list->next)
- if (list->abbrev_offset == abbrev_offset)
+ if (list->abbrev_base == abbrev_base
+ && list->abbrev_offset == abbrev_offset)
return list;
return NULL;
@@ -2415,10 +2419,10 @@ read_and_display_attr_value (unsigned lo
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
- error (_("Internal error: DWARF version is not 2, 3 or 4.\n"));
+ error (_("Internal error: DW_FORM_ref_addr is not supported in DWARF version 1.\n"));
break;
case DW_FORM_addr:
@@ -3455,6 +3459,8 @@ process_debug_info (struct dwarf_section
{
DWARF2_Internal_CompUnit compunit;
unsigned char * hdrptr;
+ dwarf_vma abbrev_base;
+ size_t abbrev_size;
dwarf_vma cu_offset;
unsigned int offset_size;
unsigned int initial_length_size;
@@ -3499,25 +3505,25 @@ process_debug_info (struct dwarf_section
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 (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 = find_abbrev_list_by_abbrev_offset (abbrev_base,
+ 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);
+ list = new_abbrev_list (abbrev_base,
+ compunit.cu_abbrev_offset);
next = process_abbrev_set
(((unsigned char *) debug_displays [abbrev_sec].section.start
+ abbrev_base + compunit.cu_abbrev_offset),
@@ -3734,12 +3740,14 @@ process_debug_info (struct dwarf_section
(unsigned long) debug_displays [abbrev_sec].section.size);
else
{
- list = find_abbrev_list_by_abbrev_offset (compunit.cu_abbrev_offset);
+ list = find_abbrev_list_by_abbrev_offset (abbrev_base,
+ compunit.cu_abbrev_offset);
if (list == NULL)
{
unsigned char * next;
- list = new_abbrev_list (compunit.cu_abbrev_offset);
+ list = new_abbrev_list (abbrev_base,
+ compunit.cu_abbrev_offset);
next = process_abbrev_set
(((unsigned char *) debug_displays [abbrev_sec].section.start
+ abbrev_base + compunit.cu_abbrev_offset),
@@ -5304,7 +5312,7 @@ display_debug_lines_decoded (struct dwar
else
{
newFileName = (char *) xmalloc (fileNameLength + 1);
- strcpy (newFileName, fileName);
+ strncpy (newFileName, fileName, fileNameLength + 1);
}
if (!do_wide || (fileNameLength <= MAX_FILENAME_LENGTH))
@@ -6029,10 +6037,10 @@ display_debug_abbrev (struct dwarf_secti
dwarf_vma offset;
offset = start - section->start;
- list = find_abbrev_list_by_abbrev_offset (offset);
+ list = find_abbrev_list_by_abbrev_offset (0, offset);
if (list == NULL)
{
- list = new_abbrev_list (offset);
+ list = new_abbrev_list (0, offset);
start = process_abbrev_set (start, end, list);
list->start_of_next_abbrevs = start;
}

View File

@ -1,931 +0,0 @@
--- 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

View File

@ -1,36 +0,0 @@
--- 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

@ -1,47 +0,0 @@
--- binutils.orig/gas/dwarf2dbg.c 2021-01-18 15:02:20.322260068 +0000
+++ binutils-2.35.1/gas/dwarf2dbg.c 2021-01-18 15:04:20.078481127 +0000
@@ -537,7 +537,11 @@ dwarf2_gen_line_info (addressT ofs, stru
if (loc->line == 0)
return;
if (loc->filenum == 0 && DWARF2_LINE_VERSION < 5)
- return;
+ {
+ dwarf_level = 5;
+ if (DWARF2_LINE_VERSION < 5)
+ return;
+ }
/* Don't emit sequences of line symbols for the same line when the
symbols apply to assembler code. It is necessary to emit
@@ -1030,9 +1034,13 @@ dwarf2_directive_filename (void)
if ((offsetT) num < 1 && DWARF2_LINE_VERSION < 5)
{
- as_bad (_("file number less than one"));
- ignore_rest_of_line ();
- return NULL;
+ dwarf_level = 5;
+ if (DWARF2_LINE_VERSION < 5)
+ {
+ as_bad (_("file number less than one"));
+ ignore_rest_of_line ();
+ return NULL;
+ }
}
/* FIXME: Should we allow ".file <N>\n" as an expression meaning
@@ -1129,8 +1137,12 @@ dwarf2_directive_loc (int dummy ATTRIBUT
{
if (filenum != 0 || DWARF2_LINE_VERSION < 5)
{
- as_bad (_("file number less than one"));
- return;
+ dwarf_level = 5;
+ if (DWARF2_LINE_VERSION < 5)
+ {
+ as_bad (_("file number less than one"));
+ return;
+ }
}
}

View File

@ -1,181 +0,0 @@
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,60 +0,0 @@
--- binutils.orig/ld/scripttempl/DWARF.sc 2021-02-01 10:29:33.596729908 +0000
+++ binutils-2.35.1/ld/scripttempl/DWARF.sc 2021-02-01 10:30:00.454552083 +0000
@@ -1,4 +1,4 @@
-# Copyright (C) 2014-2020 Free Software Foundation, Inc.
+# Copyright (C) 2014-2021 Free Software Foundation, Inc.
#
# Copying and distribution of this file, with or without modification,
# are permitted in any medium without royalty provided the copyright
@@ -9,19 +9,19 @@ cat <<EOF
Symbols in the DWARF debugging sections are relative to the beginning
of the section so we begin them at 0. */
- /* DWARF 1 */
+ /* DWARF 1. */
.debug 0 : { *(.debug) }
.line 0 : { *(.line) }
- /* GNU DWARF 1 extensions */
+ /* GNU DWARF 1 extensions. */
.debug_srcinfo 0 : { *(.debug_srcinfo) }
.debug_sfnames 0 : { *(.debug_sfnames) }
- /* DWARF 1.1 and DWARF 2 */
+ /* DWARF 1.1 and DWARF 2. */
.debug_aranges 0 : { *(.debug_aranges) }
.debug_pubnames 0 : { *(.debug_pubnames) }
- /* DWARF 2 */
+ /* DWARF 2. */
.debug_info 0 : { *(.debug_info${RELOCATING+ .gnu.linkonce.wi.*}) }
.debug_abbrev 0 : { *(.debug_abbrev) }
.debug_line 0 : { *(.debug_line${RELOCATING+ .debug_line.* .debug_line_end}) }
@@ -30,17 +30,23 @@ cat <<EOF
.debug_loc 0 : { *(.debug_loc) }
.debug_macinfo 0 : { *(.debug_macinfo) }
- /* SGI/MIPS DWARF 2 extensions */
+ /* SGI/MIPS DWARF 2 extensions. */
.debug_weaknames 0 : { *(.debug_weaknames) }
.debug_funcnames 0 : { *(.debug_funcnames) }
.debug_typenames 0 : { *(.debug_typenames) }
.debug_varnames 0 : { *(.debug_varnames) }
- /* DWARF 3 */
+ /* DWARF 3. */
.debug_pubtypes 0 : { *(.debug_pubtypes) }
.debug_ranges 0 : { *(.debug_ranges) }
- /* DWARF Extension. */
- .debug_macro 0 : { *(.debug_macro) }
+ /* DWARF 5. */
.debug_addr 0 : { *(.debug_addr) }
+ .debug_line_str 0 : { *(.debug_line_str) }
+ .debug_loclists 0 : { *(.debug_loclists) }
+ .debug_macro 0 : { *(.debug_macro) }
+ .debug_names 0 : { *(.debug_names) }
+ .debug_rnglists 0 : { *(.debug_rnglists) }
+ .debug_str_offsets 0 : { *(.debug_str_offsets) }
+ .debug_sup 0 : { *(.debug_sup) }
EOF

View File

@ -1,182 +0,0 @@
--- binutils.orig/bfd/elflink.c 2020-11-03 11:59:59.966565009 +0000
+++ binutils-2.35.1/bfd/elflink.c 2020-11-03 12:07:34.691991602 +0000
@@ -4477,7 +4477,12 @@ elf_link_add_object_symbols (bfd *abfd,
h = (struct elf_link_hash_entry *) p;
entsize += htab->root.table.entsize;
if (h->root.type == bfd_link_hash_warning)
- entsize += htab->root.table.entsize;
+ {
+ entsize += htab->root.table.entsize;
+ h = (struct elf_link_hash_entry *) h->root.u.i.link;
+ }
+ if (h->root.type == bfd_link_hash_common)
+ entsize += sizeof (*h->root.u.c.p);
}
}
@@ -4521,14 +4526,20 @@ elf_link_add_object_symbols (bfd *abfd,
for (p = htab->root.table.table[i]; p != NULL; p = p->next)
{
- memcpy (old_ent, p, htab->root.table.entsize);
- old_ent = (char *) old_ent + htab->root.table.entsize;
h = (struct elf_link_hash_entry *) p;
+ memcpy (old_ent, h, htab->root.table.entsize);
+ old_ent = (char *) old_ent + htab->root.table.entsize;
if (h->root.type == bfd_link_hash_warning)
{
- memcpy (old_ent, h->root.u.i.link, htab->root.table.entsize);
+ h = (struct elf_link_hash_entry *) h->root.u.i.link;
+ memcpy (old_ent, h, htab->root.table.entsize);
old_ent = (char *) old_ent + htab->root.table.entsize;
}
+ if (h->root.type == bfd_link_hash_common)
+ {
+ memcpy (old_ent, h->root.u.c.p, sizeof (*h->root.u.c.p));
+ old_ent = (char *) old_ent + sizeof (*h->root.u.c.p);
+ }
}
}
}
@@ -4899,7 +4910,8 @@ elf_link_add_object_symbols (bfd *abfd,
}
if (! (_bfd_generic_link_add_one_symbol
- (info, abfd, name, flags, sec, value, NULL, FALSE, bed->collect,
+ (info, abfd, name, flags, sec, value,
+ NULL, FALSE, bed->collect,
(struct bfd_link_hash_entry **) sym_hash)))
goto error_free_vers;
@@ -4970,11 +4982,10 @@ elf_link_add_object_symbols (bfd *abfd,
object and a shared object. */
bfd_boolean dynsym = FALSE;
- /* Plugin symbols aren't normal. Don't set def_regular or
- ref_regular for them, or make them dynamic. */
+ /* Plugin symbols aren't normal. Don't set def/ref flags. */
if ((abfd->flags & BFD_PLUGIN) != 0)
;
- else if (! dynamic)
+ else if (!dynamic)
{
if (! definition)
{
@@ -4991,14 +5002,6 @@ elf_link_add_object_symbols (bfd *abfd,
h->ref_dynamic = 1;
}
}
-
- /* If the indirect symbol has been forced local, don't
- make the real symbol dynamic. */
- if ((h == hi || !hi->forced_local)
- && (bfd_link_dll (info)
- || h->def_dynamic
- || h->ref_dynamic))
- dynsym = TRUE;
}
else
{
@@ -5012,14 +5015,25 @@ elf_link_add_object_symbols (bfd *abfd,
h->def_dynamic = 1;
hi->def_dynamic = 1;
}
+ }
- /* If the indirect symbol has been forced local, don't
- make the real symbol dynamic. */
- if ((h == hi || !hi->forced_local)
- && (h->def_regular
- || h->ref_regular
- || (h->is_weakalias
- && weakdef (h)->dynindx != -1)))
+ /* If an indirect symbol has been forced local, don't
+ make the real symbol dynamic. */
+ if (h != hi && hi->forced_local)
+ ;
+ else if (!dynamic)
+ {
+ if (bfd_link_dll (info)
+ || h->def_dynamic
+ || h->ref_dynamic)
+ dynsym = TRUE;
+ }
+ else
+ {
+ if (h->def_regular
+ || h->ref_regular
+ || (h->is_weakalias
+ && weakdef (h)->dynindx != -1))
dynsym = TRUE;
}
@@ -5214,6 +5228,9 @@ elf_link_add_object_symbols (bfd *abfd,
&& definition
&& ((dynsym
&& h->ref_regular_nonweak)
+ || (old_bfd != NULL
+ && (old_bfd->flags & BFD_PLUGIN) != 0
+ && bind != STB_WEAK)
|| (h->ref_dynamic_nonweak
&& (elf_dyn_lib_class (abfd) & DYN_AS_NEEDED) != 0
&& !on_needed_list (elf_dt_name (abfd),
@@ -5338,49 +5355,31 @@ elf_link_add_object_symbols (bfd *abfd,
{
struct bfd_hash_entry *p;
struct elf_link_hash_entry *h;
- bfd_size_type size;
- unsigned int alignment_power;
unsigned int non_ir_ref_dynamic;
for (p = htab->root.table.table[i]; p != NULL; p = p->next)
{
- h = (struct elf_link_hash_entry *) p;
- if (h->root.type == bfd_link_hash_warning)
- h = (struct elf_link_hash_entry *) h->root.u.i.link;
-
- /* Preserve the maximum alignment and size for common
- symbols even if this dynamic lib isn't on DT_NEEDED
- since it can still be loaded at run time by another
- dynamic lib. */
- if (h->root.type == bfd_link_hash_common)
- {
- size = h->root.u.c.size;
- alignment_power = h->root.u.c.p->alignment_power;
- }
- else
- {
- size = 0;
- alignment_power = 0;
- }
/* Preserve non_ir_ref_dynamic so that this symbol
will be exported when the dynamic lib becomes needed
in the second pass. */
+ h = (struct elf_link_hash_entry *) p;
+ if (h->root.type == bfd_link_hash_warning)
+ h = (struct elf_link_hash_entry *) h->root.u.i.link;
non_ir_ref_dynamic = h->root.non_ir_ref_dynamic;
- memcpy (p, old_ent, htab->root.table.entsize);
- old_ent = (char *) old_ent + htab->root.table.entsize;
+
h = (struct elf_link_hash_entry *) p;
+ memcpy (h, old_ent, htab->root.table.entsize);
+ old_ent = (char *) old_ent + htab->root.table.entsize;
if (h->root.type == bfd_link_hash_warning)
{
- memcpy (h->root.u.i.link, old_ent, htab->root.table.entsize);
- old_ent = (char *) old_ent + htab->root.table.entsize;
h = (struct elf_link_hash_entry *) h->root.u.i.link;
+ memcpy (h, old_ent, htab->root.table.entsize);
+ old_ent = (char *) old_ent + htab->root.table.entsize;
}
if (h->root.type == bfd_link_hash_common)
{
- if (size > h->root.u.c.size)
- h->root.u.c.size = size;
- if (alignment_power > h->root.u.c.p->alignment_power)
- h->root.u.c.p->alignment_power = alignment_power;
+ memcpy (h->root.u.c.p, old_ent, sizeof (*h->root.u.c.p));
+ old_ent = (char *) old_ent + sizeof (*h->root.u.c.p);
}
h->root.non_ir_ref_dynamic = non_ir_ref_dynamic;
}

View File

@ -1,39 +0,0 @@
--- binutils.orig/opcodes/ppc-dis.c 2020-09-11 10:55:56.243724026 +0100
+++ binutils-2.35/opcodes/ppc-dis.c 2020-09-11 10:57:51.363934217 +0100
@@ -399,12 +399,36 @@ static unsigned short vle_opcd_indices[V
#define SPE2_OPCD_SEGS (1 + SPE2_XOP_TO_SEG (SPE2_XOP (-1)))
static unsigned short spe2_opcd_indices[SPE2_OPCD_SEGS + 1];
+static bfd_boolean
+ppc_symbol_is_valid (asymbol *sym,
+ struct disassemble_info *info ATTRIBUTE_UNUSED)
+{
+ elf_symbol_type * est;
+
+ if (sym == NULL)
+ return FALSE;
+
+ est = elf_symbol_from (NULL, sym);
+
+ /* Ignore ELF hidden, local, no-type symbols.
+ These are generated by annobin. */
+ if (est != NULL
+ && ELF_ST_VISIBILITY (est->internal_elf_sym.st_other) == STV_HIDDEN
+ && ELF_ST_BIND (est->internal_elf_sym.st_info) == STB_LOCAL
+ && ELF_ST_TYPE (est->internal_elf_sym.st_info) == STT_NOTYPE)
+ return FALSE;
+
+ return TRUE;
+}
+
/* Calculate opcode table indices to speed up disassembly,
and init dialect. */
void
disassemble_init_powerpc (struct disassemble_info *info)
{
+ info->symbol_is_valid = ppc_symbol_is_valid;
+
if (powerpc_opcd_indices[PPC_OPCD_SEGS] == 0)
{
unsigned seg, idx, op;

View File

@ -1,109 +0,0 @@
--- binutils.orig/binutils/dwarf.c 2020-10-15 12:13:21.960799738 +0100
+++ binutils-2.35.1/binutils/dwarf.c 2020-10-15 13:02:39.454692627 +0100
@@ -10427,7 +10427,7 @@ load_separate_debug_info (const char *
{
warn (_("Corrupt debuglink section: %s\n"),
xlink->name ? xlink->name : xlink->uncompressed_name);
- return FALSE;
+ return NULL;
}
/* Attempt to locate the separate file.
@@ -10587,7 +10587,7 @@ load_separate_debug_info (const char *
{
warn (_("failed to open separate debug file: %s\n"), debug_filename);
free (debug_filename);
- return FALSE;
+ return NULL;
}
/* FIXME: We do not check to see if there are any other separate debug info
@@ -10632,6 +10632,52 @@ load_dwo_file (const char * main_filenam
return separate_handle;
}
+/* Load a debuglink section and/or a debugaltlink section, if either are present.
+ Recursively check the loaded files for more of these sections.
+ FIXME: Should also check for DWO_* entries in the newlu loaded files. */
+
+static void
+check_for_and_load_links (void * file, const char * filename)
+{
+ void * handle = NULL;
+
+ if (load_debug_section (gnu_debugaltlink, file))
+ {
+ Build_id_data build_id_data;
+
+ handle = load_separate_debug_info (filename,
+ & debug_displays[gnu_debugaltlink].section,
+ parse_gnu_debugaltlink,
+ check_gnu_debugaltlink,
+ & build_id_data,
+ file);
+ if (handle)
+ {
+ assert (handle == first_separate_info->handle);
+ check_for_and_load_links (first_separate_info->handle,
+ first_separate_info->filename);
+ }
+ }
+
+ if (load_debug_section (gnu_debuglink, file))
+ {
+ unsigned long crc32;
+
+ handle = load_separate_debug_info (filename,
+ & debug_displays[gnu_debuglink].section,
+ parse_gnu_debuglink,
+ check_gnu_debuglink,
+ & crc32,
+ file);
+ if (handle)
+ {
+ assert (handle == first_separate_info->handle);
+ check_for_and_load_links (first_separate_info->handle,
+ first_separate_info->filename);
+ }
+ }
+}
+
/* Load the separate debug info file(s) attached to FILE, if any exist.
Returns TRUE if any were found, FALSE otherwise.
If TRUE is returned then the linked list starting at first_separate_info
@@ -10707,34 +10753,10 @@ load_separate_debug_files (void * file,
return FALSE;
/* FIXME: We do not check for the presence of both link sections in the same file. */
- /* FIXME: We do not check the separate debug info file to see if it too contains debuglinks. */
/* FIXME: We do not check for the presence of multiple, same-name debuglink sections. */
/* FIXME: We do not check for the presence of a dwo link as well as a debuglink. */
- if (load_debug_section (gnu_debugaltlink, file))
- {
- Build_id_data * build_id_data;
-
- load_separate_debug_info (filename,
- & debug_displays[gnu_debugaltlink].section,
- parse_gnu_debugaltlink,
- check_gnu_debugaltlink,
- & build_id_data,
- file);
- }
-
- if (load_debug_section (gnu_debuglink, file))
- {
- unsigned long crc32;
-
- load_separate_debug_info (filename,
- & debug_displays[gnu_debuglink].section,
- parse_gnu_debuglink,
- check_gnu_debuglink,
- & crc32,
- file);
- }
-
+ check_for_and_load_links (file, filename);
if (first_separate_info != NULL)
return TRUE;

View File

@ -67,18 +67,6 @@ diff -rup binutils.orig/ld/testsuite/ld-x86-64/pltgot-2.d binutils-2.29.1/ld/tes
#...
+0x[0-9a-f]+ +\(PLTREL.*
#...
diff -rup binutils.orig/ld/testsuite/ld-x86-64/plt-main-bnd.dd binutils-2.29.1/ld/testsuite/ld-x86-64/plt-main-bnd.dd
--- binutils.orig/ld/testsuite/ld-x86-64/plt-main-bnd.dd 2017-11-15 13:32:39.405064420 +0000
+++ binutils-2.29.1/ld/testsuite/ld-x86-64/plt-main-bnd.dd 2017-11-15 15:06:53.694623801 +0000
@@ -1,7 +1,4 @@
-#...
-Disassembly of section .plt.got:
-[a-f0-9]+ <[a-z_]+@plt>:
-[ ]*[a-f0-9]+: f2 ff 25 .. .. 20 00 bnd jmpq \*0x20....\(%rip\) # ...... <.*>
+#...
[ ]*[a-f0-9]+: 90 nop
#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
@ -253,13 +241,3 @@ 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,772 +0,0 @@
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

@ -1,19 +0,0 @@
--- binutils.orig/binutils/objcopy.c 2020-10-06 14:53:19.264943750 +0100
+++ binutils-2.35.1/binutils/objcopy.c 2020-10-06 14:53:47.002761889 +0100
@@ -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)

View File

@ -1,894 +0,0 @@
--- binutils.orig/gas/testsuite/gas/lns/lns-diag-1.l 2021-01-25 13:10:10.179338559 +0000
+++ binutils-2.35.1/gas/testsuite/gas/lns/lns-diag-1.l 2021-01-25 13:18:04.697963105 +0000
@@ -1,5 +1,4 @@
.*: Assembler messages:
-.*:2: Error: file number less than one
.*:3: Error: missing string
.*:4: Error: file table slot 1 is already occupied.*
.*:8: Error: unassigned file number 3
@@ -9,7 +8,6 @@
.*:19: Error: bad or irreducible absolute expression
.*:23: Error: isa number less than zero
.*:26: Error: bad or irreducible absolute expression
-.*:26: Error: file number less than one
.*:27: Error: bad or irreducible absolute expression
.*:28: Error: unknown .loc sub-directive `frobnitz'
.*:29: Error: unknown .loc sub-directive `frobnitz'
diff -rup binutils.orig/ld/testsuite/ld-plugin/lto.exp binutils-2.35.1/ld/testsuite/ld-plugin/lto.exp
--- binutils.orig/ld/testsuite/ld-plugin/lto.exp 2021-01-25 13:10:09.919340409 +0000
+++ binutils-2.35.1/ld/testsuite/ld-plugin/lto.exp 2021-01-25 13:45:30.991238686 +0000
@@ -319,21 +319,6 @@ set lto_link_elf_tests [list \
[list "PR ld/13244" \
"-shared -O2 -fPIC -flto -fuse-linker-plugin -nostdlib" "-O2 -fno-early-inlining -flto" \
{pr13244.c} {{"readelf" {-s --wide} "pr13244.d"}} "pr13244.so" "c"] \
- [list "Build libpr15146a.a" \
- "$plug_opt" "-flto -O2" \
- {pr15146a.c} {} "lib15146a.a"] \
- [list "Build pr15146b.so" \
- "-shared" "-O2 -fpic" \
- {pr15146b.c} {} "pr15146b.so" "c"] \
- [list "Build pr15146c.so" \
- "-shared -Wl,--no-as-needed tmpdir/pr15146b.so" "-O2 -fpic" \
- {pr15146c.c} {} "pr15146c.so" "c"] \
- [list "PR ld/15146 (1)" \
- "-O2 -flto -fuse-linker-plugin -Wl,-rpath-link,. -Wl,--no-copy-dt-needed-entries -Wl,--no-as-needed tmpdir/pr15146a.o tmpdir/pr15146c.so" "" \
- {dummy.c} {{"readelf" {-d} "pr15146.d"}} "pr15146a.exe"] \
- [list "Build libpr15146d.a" \
- "$plug_opt" "-flto -O2" \
- {pr15146d.c} {} "lib15146d.a"] \
[list "Build libpr16746a.a" \
"" "" \
{pr16746a.c pr16746b.c} {} "lib15146a.a"] \
@@ -602,13 +587,6 @@ run_cc_link_tests $lto_compile_elf_tests
# Restrict these to ELF targets that support shared libs and PIC.
if { [is_elf_format] && [check_lto_shared_available] } {
run_cc_link_tests $lto_link_elf_tests
- set testname "PR ld/15146 (2)"
- set exec_output [run_host_cmd "$CC" "-O2 -flto -fuse-linker-plugin -Wl,-rpath-link,. -Wl,--no-copy-dt-needed-entries -Wl,--no-as-needed tmpdir/pr15146d.o tmpdir/pr15146c.so"]
- if { [ regexp "undefined reference to symbol '\\.?xxx'" $exec_output ] } {
- pass $testname
- } {
- fail $testname
- }
set testname "PR ld/16746 (3)"
set exec_output [run_host_cmd "$CC" "-O2 -flto -fuse-linker-plugin tmpdir/pr16746b.o tmpdir/pr16746d.o"]
if { [ regexp "warning: \\.?foobar" $exec_output ] && ![ regexp "symbol from plugin" $exec_output ] } {
diff -rup binutils.orig/ld/testsuite/ld-plugin/plugin-10.d binutils-2.35.1/ld/testsuite/ld-plugin/plugin-10.d
--- binutils.orig/ld/testsuite/ld-plugin/plugin-10.d 2021-01-25 13:10:09.918340415 +0000
+++ binutils-2.35.1/ld/testsuite/ld-plugin/plugin-10.d 2021-01-25 14:23:58.847765488 +0000
@@ -32,7 +32,7 @@ hook called: claim_file tmpdir/func.o \[
hook called: claim_file tmpdir/libtext.a \[@.* not claimed
#...
hook called: all symbols read.
-Sym: '_?func' Resolution: LDPR_PREVAILING_DEF_IRONLY
+Sym: '_?func' Resolution: LDPR_PREVAILING_DE.*
Sym: '_?func2' Resolution: LDPR_PREVAILING_DEF_IRONLY
#...
hook called: cleanup.
diff -rup binutils.orig/ld/testsuite/ld-plugin/plugin-11.d binutils-2.35.1/ld/testsuite/ld-plugin/plugin-11.d
--- binutils.orig/ld/testsuite/ld-plugin/plugin-11.d 2021-01-25 13:10:09.922340387 +0000
+++ binutils-2.35.1/ld/testsuite/ld-plugin/plugin-11.d 2021-01-25 14:23:53.518803590 +0000
@@ -35,9 +35,9 @@ hook called: claim_file tmpdir/func.o \[
hook called: claim_file tmpdir/libtext.a \[@.* CLAIMED
#...
hook called: all symbols read.
-Sym: '_?func' Resolution: LDPR_PREVAILING_DEF_IRONLY
+Sym: '_?func' Resolution: LDPR_PREVAILING_DE.*
Sym: '_?func2' Resolution: LDPR_PREVAILING_DEF_IRONLY
-Sym: '_?text' Resolution: LDPR_PREVAILING_DEF_IRONLY
+Sym: '_?text' Resolution: LDPR_PREVAILING_DE.*
#...
hook called: cleanup.
#...
diff -rup binutils.orig/ld/testsuite/ld-plugin/plugin-16.d binutils-2.35.1/ld/testsuite/ld-plugin/plugin-16.d
--- binutils.orig/ld/testsuite/ld-plugin/plugin-16.d 2021-01-25 13:10:09.921340394 +0000
+++ binutils-2.35.1/ld/testsuite/ld-plugin/plugin-16.d 2021-01-25 14:24:11.182677282 +0000
@@ -30,7 +30,7 @@ hook called: claim_file .*/ld/testsuite/
hook called: claim_file tmpdir/text.o \[@0/.* not claimed
#...
hook called: all symbols read.
-Sym: '_?func' Resolution: LDPR_PREVAILING_DEF_IRONLY
+Sym: '_?func' Resolution: LDPR_PREVAILING_DE.*
Sym: '_?func2' Resolution: LDPR_PREVAILING_DEF_IRONLY
#...
hook called: cleanup.
diff -rup binutils.orig/ld/testsuite/ld-plugin/plugin-17.d binutils-2.35.1/ld/testsuite/ld-plugin/plugin-17.d
--- binutils.orig/ld/testsuite/ld-plugin/plugin-17.d 2021-01-25 13:10:09.919340409 +0000
+++ binutils-2.35.1/ld/testsuite/ld-plugin/plugin-17.d 2021-01-25 14:24:05.502717894 +0000
@@ -31,7 +31,7 @@ hook called: claim_file .*/ld/testsuite/
hook called: claim_file tmpdir/text.o \[@0/.* not claimed
#...
hook called: all symbols read.
-Sym: '_?func' Resolution: LDPR_PREVAILING_DEF_IRONLY
+Sym: '_?func' Resolution: LDPR_PREVAILING_DE.*
Sym: '_?func2' Resolution: LDPR_PREVAILING_DEF_IRONLY
#...
hook called: cleanup.
diff -rup binutils.orig/ld/testsuite/ld-plugin/plugin-18.d binutils-2.35.1/ld/testsuite/ld-plugin/plugin-18.d
--- binutils.orig/ld/testsuite/ld-plugin/plugin-18.d 2021-01-25 13:10:09.920340401 +0000
+++ binutils-2.35.1/ld/testsuite/ld-plugin/plugin-18.d 2021-01-25 14:23:47.294848091 +0000
@@ -32,7 +32,7 @@ hook called: claim_file .*/ld/testsuite/
hook called: claim_file tmpdir/libtext.a \[@.* not claimed
#...
hook called: all symbols read.
-Sym: '_?func' Resolution: LDPR_PREVAILING_DEF_IRONLY
+Sym: '_?func' Resolution: LDPR_PREVAILING_DE.*
Sym: '_?func2' Resolution: LDPR_PREVAILING_DEF_IRONLY
#...
hook called: cleanup.
diff -rup binutils.orig/ld/testsuite/ld-plugin/plugin-19.d binutils-2.35.1/ld/testsuite/ld-plugin/plugin-19.d
--- binutils.orig/ld/testsuite/ld-plugin/plugin-19.d 2021-01-25 13:10:09.918340415 +0000
+++ binutils-2.35.1/ld/testsuite/ld-plugin/plugin-19.d 2021-01-25 14:23:38.270912619 +0000
@@ -35,9 +35,9 @@ hook called: claim_file .*/ld/testsuite/
hook called: claim_file tmpdir/libtext.a \[@.* CLAIMED
#...
hook called: all symbols read.
-Sym: '_?func' Resolution: LDPR_PREVAILING_DEF_IRONLY
+Sym: '_?func' Resolution: LDPR_PREVAILING_DE.*
Sym: '_?func2' Resolution: LDPR_PREVAILING_DEF_IRONLY
-Sym: '_?text' Resolution: LDPR_PREVAILING_DEF_IRONLY
+Sym: '_?text' Resolution: LDPR_PREVAILING_DE.*
#...
hook called: cleanup.
#...
diff -rup binutils.orig/ld/testsuite/ld-plugin/plugin-8.d binutils-2.35.1/ld/testsuite/ld-plugin/plugin-8.d
--- binutils.orig/ld/testsuite/ld-plugin/plugin-8.d 2021-01-25 13:10:09.920340401 +0000
+++ binutils-2.35.1/ld/testsuite/ld-plugin/plugin-8.d 2021-01-25 14:24:20.558610232 +0000
@@ -30,7 +30,7 @@ hook called: claim_file tmpdir/func.o \[
hook called: claim_file tmpdir/text.o \[@0/.* not claimed
#...
hook called: all symbols read.
-Sym: '_?func' Resolution: LDPR_PREVAILING_DEF_IRONLY
+Sym: '_?func' Resolution: LDPR_PREVAILING_DE.*
Sym: '_?func2' Resolution: LDPR_PREVAILING_DEF_IRONLY
#...
hook called: cleanup.
diff -rup binutils.orig/ld/testsuite/ld-plugin/plugin-9.d binutils-2.35.1/ld/testsuite/ld-plugin/plugin-9.d
--- binutils.orig/ld/testsuite/ld-plugin/plugin-9.d 2021-01-25 13:10:09.922340387 +0000
+++ binutils-2.35.1/ld/testsuite/ld-plugin/plugin-9.d 2021-01-25 14:24:15.919643406 +0000
@@ -31,7 +31,7 @@ hook called: claim_file tmpdir/func.o \[
hook called: claim_file tmpdir/text.o \[@0/.* not claimed
#...
hook called: all symbols read.
-Sym: '_?func' Resolution: LDPR_PREVAILING_DEF_IRONLY
+Sym: '_?func' Resolution: LDPR_PREVAILING_DE.*
Sym: '_?func2' Resolution: LDPR_PREVAILING_DEF_IRONLY
#...
hook called: cleanup.
diff -rup binutils.orig/ld/testsuite/ld-elf/shared.exp binutils-2.35.1/ld/testsuite/ld-elf/shared.exp
--- binutils.orig/ld/testsuite/ld-elf/shared.exp 2021-01-25 13:10:09.984339946 +0000
+++ binutils-2.35.1/ld/testsuite/ld-elf/shared.exp 2021-01-25 15:16:59.161012214 +0000
@@ -681,13 +681,13 @@ set build_tests {
"-r -nostdlib" ""
{pr11138-2.c} {} "libpr11138-2.o"}
{"Build pr13250-1.so"
- "-shared" "-fPIC -fcommon"
+ "-shared" "-fPIC"
{pr13250-1.c} {} "libpr13250-1.so"}
{"Build pr13250-2.so with libpr13250-1.so"
- "-shared -Wl,--no-as-needed tmpdir/libpr13250-1.so" "-fPIC -fcommon"
+ "-shared -Wl,--no-as-needed tmpdir/libpr13250-1.so" "-fPIC"
{pr13250-2.c} {} "libpr13250-2.so"}
{"Build libpr13250-3.o"
- "-r -nostdlib" "-fcommon"
+ "-r -nostdlib" "-fPIC"
{pr13250-3.c} {} "libpr13250-3.o"}
{"Build libpr14323-2.so"
"-shared" "-fPIC -fcommon"
@@ -968,9 +968,6 @@ set run_tests [list \
[list "Run with libpr11138-1.so pr11138-2.c" \
"-Wl,--no-as-needed,--version-script=pr11138-2.map tmpdir/libpr11138-1.so tmpdir/pr11138-2.o" "" \
{dummy.c} "pr11138b" "pr11138.out" ] \
- [list "Run with pr13250-3.c, libpr13250-1.so and libpr13250-2.so" \
- "-Wl,--as-needed tmpdir/pr13250-3.o tmpdir/libpr13250-1.so tmpdir/libpr13250-2.so" "-fcommon" \
- {dummy.c} "pr13250" "pass.out" ] \
[list "Run with pr14323-1.c pr14323-2.so" \
"-Wl,--no-as-needed tmpdir/libpr14323-2.so" "" \
{pr14323-1.c} "pr14323" "pass.out" ] \
--- binutils.orig/ld/testsuite/ld-elf/compress.exp 2021-01-25 13:10:09.986339932 +0000
+++ binutils-2.35.1/ld/testsuite/ld-elf/compress.exp 2021-01-25 15:22:33.286619802 +0000
@@ -87,7 +87,7 @@ set build_tests {
set run_tests {
{"Run normal with libfoo.so with compressed debug sections"
"tmpdir/begin.o tmpdir/libfoo.so tmpdir/end.o" ""
- {main.c} "normal" "normal.out" "-Wa,--compress-debug-sections"}
+ {main.c} "normal" "normal.out" "-Wa,--compress-debug-sections -fno-lto"}
{"Run normal with libfoozlib.so with compressed debug sections with zlib-gabi"
"tmpdir/begin.o tmpdir/libfoozlib.so tmpdir/end.o" ""
{main.c} "normal" "normal.out" "-Wa,--compress-debug-sections=zlib-gabi"}
diff -rup binutils.orig/ld/testsuite/ld-elf/compress.exp binutils-2.35.1/ld/testsuite/ld-elf/compress.exp
--- binutils.orig/ld/testsuite/ld-elf/compress.exp 2021-01-25 16:01:54.985710205 +0000
+++ binutils-2.35.1/ld/testsuite/ld-elf/compress.exp 2021-01-25 16:14:50.481150777 +0000
@@ -90,25 +90,25 @@ set run_tests {
{main.c} "normal" "normal.out" "-Wa,--compress-debug-sections -fno-lto"}
{"Run normal with libfoozlib.so with compressed debug sections with zlib-gabi"
"tmpdir/begin.o tmpdir/libfoozlib.so tmpdir/end.o" ""
- {main.c} "normal" "normal.out" "-Wa,--compress-debug-sections=zlib-gabi"}
+ {main.c} "normal" "normal.out" "-Wa,--compress-debug-sections=zlib-gabi -fno-lto"}
{"Run zlibnormal with libzlibfoo.so with zlib compressed debug sections"
"tmpdir/begin.o tmpdir/libzlibfoo.so tmpdir/end.o -Wl,--compress-debug-sections=zlib" ""
- {main.c} "zlibnormal" "normal.out" "-Wa,--compress-debug-sections=zlib"}
+ {main.c} "zlibnormal" "normal.out" "-Wa,--compress-debug-sections=zlib -fno-lto"}
{"Run zlibnormal with libfoozlib.so with zlib compressed debug sections"
"tmpdir/begin.o tmpdir/libfoozlib.so tmpdir/end.o -Wl,--compress-debug-sections=zlib" ""
- {main.c} "zlibnormal" "normal.out" "-Wa,--compress-debug-sections=zlib"}
+ {main.c} "zlibnormal" "normal.out" "-Wa,--compress-debug-sections=zlib -fno-lto"}
{"Run gnunormal with libgnufoo.so with zlib-gnu compressed debug sections"
"tmpdir/gnubegin.o tmpdir/libgnufoo.so tmpdir/end.o -Wl,--compress-debug-sections=zlib-gnu" ""
- {main.c} "gnunormal" "normal.out" "-Wa,--compress-debug-sections=zlib-gnu"}
+ {main.c} "gnunormal" "normal.out" "-Wa,--compress-debug-sections=zlib-gnu -fno-lto"}
{"Run gnunormal with libfoozlib.so with zlib-gnu compressed debug sections"
"tmpdir/gnubegin.o tmpdir/libfoozlib.so tmpdir/end.o -Wl,--compress-debug-sections=zlib-gnu" ""
- {main.c} "gnunormal" "normal.out" "-Wa,--compress-debug-sections=zlib-gnu"}
+ {main.c} "gnunormal" "normal.out" "-Wa,--compress-debug-sections=zlib-gnu -fno-lto"}
{"Run gabinormal with libgabifoo.so with zlib-gabi compressed debug sections"
"tmpdir/zlibbegin.o tmpdir/libgabifoo.so tmpdir/gabiend.o -Wl,--compress-debug-sections=zlib-gabi" ""
- {main.c} "gabinormal" "normal.out" "-Wa,--compress-debug-sections=zlib-gabi"}
+ {main.c} "gabinormal" "normal.out" "-Wa,--compress-debug-sections=zlib-gabi -fno-lto"}
{"Run gabinormal with libfoozlib.so with zlib-gabi compressed debug sections"
"tmpdir/zlibbegin.o tmpdir/libfoozlib.so tmpdir/gabiend.o -Wl,--compress-debug-sections=zlib-gabi" ""
- {main.c} "gabinormal" "normal.out" "-Wa,--compress-debug-sections=zlib-gabi"}
+ {main.c} "gabinormal" "normal.out" "-Wa,--compress-debug-sections=zlib-gabi -fno-lto"}
}
run_cc_link_tests $build_tests
diff -rup binutils.orig/ld/testsuite/ld-elf/dwarf.exp binutils-2.35.1/ld/testsuite/ld-elf/dwarf.exp
--- binutils.orig/ld/testsuite/ld-elf/dwarf.exp 2021-01-25 16:01:54.982710227 +0000
+++ binutils-2.35.1/ld/testsuite/ld-elf/dwarf.exp 2021-01-25 16:19:59.198936623 +0000
@@ -53,7 +53,7 @@ set build_tests {
"" "-fno-toplevel-reorder"
{dwarf2a.c dwarf2b.c} {{error_output "dwarf2.err"}} "dwarf2.x"}
{"Handle no DWARF information"
- "" "-g0"
+ "" "-g0 -fno-lto"
{dwarf3.c} {{error_output "dwarf3.err"}} "dwarf3.x"}
}
diff -rup binutils.orig/ld/testsuite/ld-elf/dwarf2b.c binutils-2.35.1/ld/testsuite/ld-elf/dwarf2b.c
--- binutils.orig/ld/testsuite/ld-elf/dwarf2b.c 2021-01-25 16:01:54.980710241 +0000
+++ binutils-2.35.1/ld/testsuite/ld-elf/dwarf2b.c 2021-01-25 16:18:11.598708346 +0000
@@ -1,5 +1,5 @@
-int global_var = 4;
-int other_var = 2;
+extern int global_var;
+extern int other_var;
extern int function (void);
diff -rup binutils.orig/ld/testsuite/ld-elf/indirect.exp binutils-2.35.1/ld/testsuite/ld-elf/indirect.exp
--- binutils.orig/ld/testsuite/ld-elf/indirect.exp 2021-01-25 16:01:54.983710220 +0000
+++ binutils-2.35.1/ld/testsuite/ld-elf/indirect.exp 2021-01-25 16:28:09.254420519 +0000
@@ -140,52 +140,52 @@ set run_tests {
"-Wl,--no-as-needed tmpdir/libindirect3c.so tmpdir/indirect3b.o tmpdir/indirect3a.o" ""
{dummy.c} "indirect3d" "indirect3.out"}
{"Run with libindirect4c.so 1"
- "-Wl,--no-as-needed tmpdir/indirect4a.o tmpdir/indirect4b.o tmpdir/libindirect4c.so" ""
+ "-Wl,--no-as-needed -fno-lto tmpdir/indirect4a.o tmpdir/indirect4b.o tmpdir/libindirect4c.so" ""
{dummy.c} "indirect4a" "indirect4.out"}
{"Run with libindirect4c.so 2"
- "-Wl,--no-as-needed tmpdir/indirect4a.o tmpdir/libindirect4c.so tmpdir/indirect4b.o" ""
+ "-Wl,--no-as-needed -fno-lto tmpdir/indirect4a.o tmpdir/libindirect4c.so tmpdir/indirect4b.o" ""
{dummy.c} "indirect4b" "indirect4.out"}
{"Run with libindirect4c.so 3"
- "-Wl,--no-as-needed tmpdir/indirect4b.o tmpdir/libindirect4c.so tmpdir/indirect4a.o" ""
+ "-Wl,--no-as-needed -fno-lto tmpdir/indirect4b.o tmpdir/libindirect4c.so tmpdir/indirect4a.o" ""
{dummy.c} "indirect4c" "indirect4.out"}
{"Run with libindirect4c.so 4"
- "-Wl,--no-as-needed tmpdir/libindirect4c.so tmpdir/indirect4b.o tmpdir/indirect4a.o" ""
+ "-Wl,--no-as-needed -fno-lto tmpdir/libindirect4c.so tmpdir/indirect4b.o tmpdir/indirect4a.o" ""
{dummy.c} "indirect4d" "indirect4.out"}
{"Run indirect5 1"
- "$NOPIE_LDFLAGS -Wl,--no-as-needed tmpdir/libindirect5.so" ""
+ "$NOPIE_LDFLAGS -fno-lto -Wl,--no-as-needed tmpdir/libindirect5.so" ""
{indirect5a.c} "indirect5a" "indirect5.out" "$NOPIE_CFLAGS"}
{"Run indirect5 2"
- "$NOPIE_LDFLAGS -Wl,--no-as-needed tmpdir/indirect5a.o tmpdir/libindirect5.so" ""
+ "$NOPIE_LDFLAGS -fno-lto -Wl,--no-as-needed tmpdir/indirect5a.o tmpdir/libindirect5.so" ""
{dummy.c} "indirect5b" "indirect5.out" "$NOPIE_CFLAGS"}
{"Run indirect6 1"
- "$NOPIE_LDFLAGS -Wl,--no-as-needed tmpdir/libindirect5.so" ""
+ "$NOPIE_LDFLAGS -fno-lto -Wl,--no-as-needed tmpdir/libindirect5.so" ""
{indirect6a.c} "indirect6a" "indirect5.out" "$NOPIE_CFLAGS"}
{"Run indirect6 2"
- "$NOPIE_LDFLAGS -Wl,--no-as-needed tmpdir/indirect6a.o tmpdir/libindirect5.so" ""
+ "$NOPIE_LDFLAGS -fno-lto -Wl,--no-as-needed tmpdir/indirect6a.o tmpdir/libindirect5.so" ""
{dummy.c} "indirect6b" "indirect5.out" "$NOPIE_CFLAGS"}
{"Run with libpr18720c.so 1"
- "-Wl,--no-as-needed tmpdir/pr18720a.o tmpdir/pr18720b.o tmpdir/libpr18720c.so" ""
+ "-Wl,--no-as-needed -fno-lto tmpdir/pr18720a.o tmpdir/pr18720b.o tmpdir/libpr18720c.so" ""
{check-ptr-eq.c} "pr18720a" "pr18720.out"}
{"Run with libpr18720c.so 2"
- "-Wl,--no-as-needed tmpdir/pr18720a.o tmpdir/libpr18720c.so tmpdir/pr18720b.o" ""
+ "-Wl,--no-as-needed -fno-lto tmpdir/pr18720a.o tmpdir/libpr18720c.so tmpdir/pr18720b.o" ""
{check-ptr-eq.c} "pr18720b" "pr18720.out"}
{"Run with libpr18720c.so 3"
- "-Wl,--no-as-needed tmpdir/pr18720b.o tmpdir/libpr18720c.so tmpdir/pr18720a.o" ""
+ "-Wl,--no-as-needed -fno-lto tmpdir/pr18720b.o tmpdir/libpr18720c.so tmpdir/pr18720a.o" ""
{check-ptr-eq.c} "pr18720c" "pr18720.out"}
{"Run with libpr18720c.so 4"
- "-Wl,--no-as-needed tmpdir/libpr18720c.so tmpdir/pr18720b.o tmpdir/pr18720a.o" ""
+ "-Wl,--no-as-needed -fno-lto tmpdir/libpr18720c.so tmpdir/pr18720b.o tmpdir/pr18720a.o" ""
{check-ptr-eq.c} "pr18720d" "pr18720.out"}
{"Run with libpr18720c.so 5"
- "-Wl,--no-as-needed tmpdir/libpr18720c.so tmpdir/pr18720b1.o tmpdir/pr18720a.o" ""
+ "-Wl,--no-as-needed -fno-lto tmpdir/libpr18720c.so tmpdir/pr18720b1.o tmpdir/pr18720a.o" ""
{check-ptr-eq.c} "pr18720d" "pr18720.out"}
{"Run with libpr19553b.so"
- "-Wl,--no-as-needed tmpdir/libpr19553b.so tmpdir/libpr19553d.so -Wl,-rpath-link,." ""
+ "-Wl,--no-as-needed -fno-lto tmpdir/libpr19553b.so tmpdir/libpr19553d.so -Wl,-rpath-link,." ""
{pr19553a.c} "pr19553b" "pr19553b.out"}
{"Run with libpr19553c.so"
- "-Wl,--no-as-needed tmpdir/libpr19553c.so tmpdir/libpr19553b.so tmpdir/libpr19553d.so" ""
+ "-Wl,--no-as-needed -fno-lto tmpdir/libpr19553c.so tmpdir/libpr19553b.so tmpdir/libpr19553d.so" ""
{pr19553a.c} "pr19553c" "pr19553c.out"}
{"Run with libpr19553d.so"
- "-Wl,--no-as-needed tmpdir/libpr19553d.so tmpdir/libpr19553b.so -Wl,-rpath-link,." ""
+ "-Wl,--no-as-needed -fno-lto tmpdir/libpr19553d.so tmpdir/libpr19553b.so -Wl,-rpath-link,." ""
{pr19553a.c} "pr19553d" "pr19553d.out"}
}
diff -rup binutils.orig/ld/testsuite/ld-elf/zlibbegin.rS binutils-2.35.1/ld/testsuite/ld-elf/zlibbegin.rS
--- binutils.orig/ld/testsuite/ld-elf/zlibbegin.rS 2021-01-25 16:01:54.983710220 +0000
+++ binutils-2.35.1/ld/testsuite/ld-elf/zlibbegin.rS 2021-01-25 16:08:44.466775873 +0000
@@ -1,3 +1,3 @@
#...
- +\[[ 0-9]+\] .debug_.* +(PROGBITS|MIPS_DWARF) +0+ +[0-9a-f]+ +[0-9a-f]+ [0-9a-f]+ +G?C +0 +0 +1
+ +\[[ 0-9]+\] .debug_.* +(PROGBITS|MIPS_DWARF) +0+ +[0-9a-f]+ +[0-9a-f]+ [0-9a-f]+ +G?? +0 +0 +1
#pass
diff -rup binutils.orig/ld/testsuite/config/default.exp binutils-2.35.1/ld/testsuite/config/default.exp
--- binutils.orig/ld/testsuite/config/default.exp 2021-01-25 17:04:32.771699986 +0000
+++ binutils-2.35.1/ld/testsuite/config/default.exp 2021-01-25 17:21:31.269352523 +0000
@@ -83,13 +83,13 @@ if {![info exists CC]} {
set CC [find_gcc]
}
if {![info exists CFLAGS]} {
- set CFLAGS "-g -O2"
+ set CFLAGS "-g -O2 -fno-lto"
}
if {![info exists CXX]} {
set CXX [find_g++]
}
if {![info exists CXXFLAGS]} {
- set CXXFLAGS ""
+ set CXXFLAGS "-fno-lto"
}
# This allows us to run the linker testsuite with clang as the compilation
diff -rup binutils.orig/ld/testsuite/ld-elf/compress.exp binutils-2.35.1/ld/testsuite/ld-elf/compress.exp
--- binutils.orig/ld/testsuite/ld-elf/compress.exp 2021-01-25 17:04:32.839699496 +0000
+++ binutils-2.35.1/ld/testsuite/ld-elf/compress.exp 2021-01-25 17:06:40.106781907 +0000
@@ -92,22 +92,22 @@ set run_tests {
"tmpdir/begin.o tmpdir/libfoozlib.so tmpdir/end.o" ""
{main.c} "normal" "normal.out" "-Wa,--compress-debug-sections=zlib-gabi -fno-lto"}
{"Run zlibnormal with libzlibfoo.so with zlib compressed debug sections"
- "tmpdir/begin.o tmpdir/libzlibfoo.so tmpdir/end.o -Wl,--compress-debug-sections=zlib" ""
+ "tmpdir/begin.o tmpdir/libzlibfoo.so tmpdir/end.o -fno-lto -Wl,--compress-debug-sections=zlib" ""
{main.c} "zlibnormal" "normal.out" "-Wa,--compress-debug-sections=zlib -fno-lto"}
{"Run zlibnormal with libfoozlib.so with zlib compressed debug sections"
- "tmpdir/begin.o tmpdir/libfoozlib.so tmpdir/end.o -Wl,--compress-debug-sections=zlib" ""
+ "tmpdir/begin.o tmpdir/libfoozlib.so tmpdir/end.o -fno-lto -Wl,--compress-debug-sections=zlib" ""
{main.c} "zlibnormal" "normal.out" "-Wa,--compress-debug-sections=zlib -fno-lto"}
{"Run gnunormal with libgnufoo.so with zlib-gnu compressed debug sections"
- "tmpdir/gnubegin.o tmpdir/libgnufoo.so tmpdir/end.o -Wl,--compress-debug-sections=zlib-gnu" ""
+ "tmpdir/gnubegin.o tmpdir/libgnufoo.so tmpdir/end.o -fno-lto -Wl,--compress-debug-sections=zlib-gnu" ""
{main.c} "gnunormal" "normal.out" "-Wa,--compress-debug-sections=zlib-gnu -fno-lto"}
{"Run gnunormal with libfoozlib.so with zlib-gnu compressed debug sections"
- "tmpdir/gnubegin.o tmpdir/libfoozlib.so tmpdir/end.o -Wl,--compress-debug-sections=zlib-gnu" ""
+ "tmpdir/gnubegin.o tmpdir/libfoozlib.so tmpdir/end.o -fno-lto -Wl,--compress-debug-sections=zlib-gnu" ""
{main.c} "gnunormal" "normal.out" "-Wa,--compress-debug-sections=zlib-gnu -fno-lto"}
{"Run gabinormal with libgabifoo.so with zlib-gabi compressed debug sections"
- "tmpdir/zlibbegin.o tmpdir/libgabifoo.so tmpdir/gabiend.o -Wl,--compress-debug-sections=zlib-gabi" ""
+ "tmpdir/zlibbegin.o tmpdir/libgabifoo.so tmpdir/gabiend.o -fno-lto -Wl,--compress-debug-sections=zlib-gabi" ""
{main.c} "gabinormal" "normal.out" "-Wa,--compress-debug-sections=zlib-gabi -fno-lto"}
{"Run gabinormal with libfoozlib.so with zlib-gabi compressed debug sections"
- "tmpdir/zlibbegin.o tmpdir/libfoozlib.so tmpdir/gabiend.o -Wl,--compress-debug-sections=zlib-gabi" ""
+ "tmpdir/zlibbegin.o tmpdir/libfoozlib.so tmpdir/gabiend.o -fno-lto -Wl,--compress-debug-sections=zlib-gabi" ""
{main.c} "gabinormal" "normal.out" "-Wa,--compress-debug-sections=zlib-gabi -fno-lto"}
}
diff -rup binutils.orig/ld/testsuite/ld-elf/dwarf2b.c binutils-2.35.1/ld/testsuite/ld-elf/dwarf2b.c
--- binutils.orig/ld/testsuite/ld-elf/dwarf2b.c 2021-01-25 17:04:32.834699532 +0000
+++ binutils-2.35.1/ld/testsuite/ld-elf/dwarf2b.c 2021-01-25 17:08:19.131067948 +0000
@@ -1,5 +1,5 @@
-extern int global_var;
-extern int other_var;
+int global_var = 4;
+int other_var = 2;
extern int function (void);
diff -rup binutils.orig/ld/testsuite/ld-elf/elf.exp binutils-2.35.1/ld/testsuite/ld-elf/elf.exp
--- binutils.orig/ld/testsuite/ld-elf/elf.exp 2021-01-25 17:04:32.840699489 +0000
+++ binutils-2.35.1/ld/testsuite/ld-elf/elf.exp 2021-01-25 17:10:23.738169538 +0000
@@ -245,7 +245,7 @@ if [check_gc_sections_available] {
set array_tests {
{"preinit array" "" ""
- {preinit.c} "preinit" "preinit.out"}
+ {preinit.c} "preinit" "preinit.out" "-fno-lto"}
{"init array" "" ""
{init.c} "init" "init.out"}
{"fini array" "" ""
diff -rup binutils.orig/ld/testsuite/ld-elf/indirect.exp binutils-2.35.1/ld/testsuite/ld-elf/indirect.exp
--- binutils.orig/ld/testsuite/ld-elf/indirect.exp 2021-01-25 17:04:32.832699546 +0000
+++ binutils-2.35.1/ld/testsuite/ld-elf/indirect.exp 2021-01-25 17:13:05.304004657 +0000
@@ -65,8 +65,8 @@ if { ![ld_compile $CC $srcdir/$subdir/in
|| ![ld_compile $CC $srcdir/$subdir/indirect3b.c tmpdir/indirect3b.o]
|| ![ld_compile $CC $srcdir/$subdir/indirect4a.c tmpdir/indirect4a.o]
|| ![ld_compile $CC $srcdir/$subdir/indirect4b.c tmpdir/indirect4b.o]
- || ![ld_compile "$CC -O2 -fPIC -I../bfd" $srcdir/$subdir/pr18720a.c tmpdir/pr18720a.o]
- || ![ld_compile $CC $srcdir/$subdir/pr18720b.c tmpdir/pr18720b.o]
+ || ![ld_compile "$CC -O2 -fPIC -I../bfd -fno-lto" $srcdir/$subdir/pr18720a.c tmpdir/pr18720a.o]
+ || ![ld_compile "$CC -fno-lto" $srcdir/$subdir/pr18720b.c tmpdir/pr18720b.o]
|| ![ld_compile "$CC -fPIC" $srcdir/$subdir/pr19553d.c tmpdir/pr19553d.o]
|| ![ld_compile "$CC -fPIC" $srcdir/$subdir/pr19553c.c tmpdir/pr19553c.o]
|| ![ld_compile "$CC -fPIC" $srcdir/$subdir/pr19553b.c tmpdir/pr19553b.o]
@@ -89,7 +89,7 @@ set build_tests {
"-shared -Wl,--version-script=indirect5.map" "-fPIC"
{indirect5b.c} {} "libindirect5.so"}
{"Build libpr18720c.so"
- "-shared" "-fPIC"
+ "-shared" "-fPIC -fno-lto"
{pr18720c.c} {} "libpr18720c.so"}
{"Build pr18720b1.o"
"-r -nostdlib tmpdir/pr18720b.o" ""
diff -rup binutils.orig/ld/testsuite/ld-elf/shared.exp binutils-2.35.1/ld/testsuite/ld-elf/shared.exp
--- binutils.orig/ld/testsuite/ld-elf/shared.exp 2021-01-25 17:04:32.842699474 +0000
+++ binutils-2.35.1/ld/testsuite/ld-elf/shared.exp 2021-01-25 17:17:38.919029918 +0000
@@ -545,7 +545,7 @@ set build_tests {
"-shared" "-fPIC"
{beginwarn.c end.c}
{{readelf {-S --wide} libbarw.rd}
- {warning "^.*beginwarn.c:7: warning: function foo is deprecated\n?$"}}
+ {warning "^.*warning: function foo is deprecated\n?$"}}
"libbarw.so" "c"}
{"Build hidden libbar.so"
"-shared" "-fPIC"
--- binutils.orig/ld/testsuite/lib/ld-lib.exp 2021-01-26 10:25:58.126763900 +0000
+++ binutils-2.35.1/ld/testsuite/lib/ld-lib.exp 2021-01-26 10:28:25.257232615 +0000
@@ -898,9 +898,9 @@ proc run_cc_link_tests { ldtests } {
lappend objfiles $objfile
if { [ string match "c++" $lang ] } {
- set cmd "$CXX -c $CXXFLAGS $cflags"
+ set cmd "$CXX -c $CXXFLAGS $cflags -fno-lto"
} else {
- set cmd "$CC -c $CFLAGS $cflags"
+ set cmd "$CC -c $CFLAGS $cflags -fno-lto"
}
if ![ld_compile $cmd $srcdir/$subdir/$src_file $objfile] {
set failed 1
--- binutils.orig/ld/testsuite/lib/ld-lib.exp 2021-01-26 13:39:56.515247329 +0000
+++ binutils-2.35.1/ld/testsuite/lib/ld-lib.exp 2021-01-26 13:45:28.132976033 +0000
@@ -259,7 +259,7 @@ proc default_ld_compile { cc source obje
append flags " [board_info [target_info name] multilib_flags]"
}
- set cmd "$cc $flags $ccflags -c $source -o $object"
+ set cmd "$cc $flags $ccflags -c $source -o $object -fno-lto"
verbose -log "$cmd"
set status [remote_exec host [concat sh -c [list "$cmd 2>&1"]] "" "/dev/null" "ld.tmp"]
@@ -713,9 +713,9 @@ proc run_ld_link_exec_tests { ldtests ar
lappend objfiles $objfile
if { [ string match "c++" $lang ] } {
- set cmd "$CXX -c $CXXFLAGS $cflags"
+ set cmd "$CXX -c $CXXFLAGS $cflags -fno-lto"
} else {
- set cmd "$CC -c $CFLAGS $cflags"
+ set cmd "$CC -c $CFLAGS $cflags -fno-lto"
}
if ![ld_compile $cmd $srcdir/$subdir/$src_file $objfile] {
set failed 1
diff -rup binutils.orig/ld/testsuite/ld-ifunc/ifunc.exp binutils-2.35.1/ld/testsuite/ld-ifunc/ifunc.exp
--- binutils.orig/ld/testsuite/ld-ifunc/ifunc.exp 2021-01-26 14:41:32.168525798 +0000
+++ binutils-2.35.1/ld/testsuite/ld-ifunc/ifunc.exp 2021-01-26 16:22:29.939007217 +0000
@@ -635,7 +635,7 @@ run_cc_link_tests [list \
"$NOPIE_LDFLAGS -Wl,--no-as-needed tmpdir/libpr23169a.so" \
"-fPIE -O2 -g" \
{ pr23169b.c pr23169c.c } \
- {{readelf {--dyn-syms} pr23169c.rd} \
+ {{readelf {--dyn-syms} pr23169a.rd} \
{readelf {-r -W} pr23169b.rd}} \
"pr23169c" \
] \
@@ -649,15 +649,6 @@ run_cc_link_tests [list \
"pr23169d" \
] \
[list \
- "Build pr23169e" \
- "-pie -Wl,--no-as-needed,-z,now tmpdir/libpr23169b.so" \
- "-fPIE -O2 -g" \
- { pr23169b.c pr23169c.c } \
- {{readelf {--dyn-syms} pr23169c.rd} \
- {readelf {-r -W} pr23169b.rd}} \
- "pr23169e" \
- ] \
- [list \
"Build pr23169f" \
"$NOPIE_LDFLAGS -Wl,--no-as-needed,-z,now tmpdir/libpr23169b.so" \
"-fPIE -O2 -g" \
@@ -769,15 +760,6 @@ run_ld_link_exec_tests [list \
"$NOPIE_CFLAGS -O2 -g" \
] \
[list \
- "Run pr23169e" \
- "-pie -Wl,--no-as-needed,-z,now tmpdir/libpr23169b.so" \
- "" \
- { pr23169b.c pr23169c.c } \
- "pr23169e" \
- "pass.out" \
- "-fPIE -O2 -g" \
- ] \
- [list \
"Run pr23169f" \
"$NOPIE_LDFLAGS -Wl,--no-as-needed,-z,now tmpdir/libpr23169b.so" \
"" \
diff -rup binutils.orig/ld/testsuite/ld-ifunc/pr23169a.c binutils-2.35.1/ld/testsuite/ld-ifunc/pr23169a.c
--- binutils.orig/ld/testsuite/ld-ifunc/pr23169a.c 2021-01-26 14:41:32.168525798 +0000
+++ binutils-2.35.1/ld/testsuite/ld-ifunc/pr23169a.c 2021-01-26 16:23:06.082881441 +0000
@@ -4,6 +4,6 @@ extern int func (void);
void
foo (void)
{
- if (func_p != &func || func_p () != 0xbadbeef)
+ if (func () != 0xbadbeef || func_p () != 0xbadbeef)
__builtin_abort ();
}
diff -rup binutils.orig/ld/testsuite/ld-ifunc/ifunc.exp binutils-2.35.1/ld/testsuite/ld-ifunc/ifunc.exp
--- binutils.orig/ld/testsuite/ld-ifunc/ifunc.exp 2021-01-26 16:58:22.846715071 +0000
+++ binutils-2.35.1/ld/testsuite/ld-ifunc/ifunc.exp 2021-01-26 16:59:43.476438410 +0000
@@ -750,24 +750,6 @@ run_ld_link_exec_tests [list \
"pass.out" \
"-fPIE -O2 -g" \
] \
- [list \
- "Run pr23169d" \
- "$NOPIE_LDFLAGS -Wl,--no-as-needed,-z,now tmpdir/libpr23169b.so" \
- "" \
- { pr23169b.c pr23169c.c } \
- "pr23169d" \
- "pass.out" \
- "$NOPIE_CFLAGS -O2 -g" \
- ] \
- [list \
- "Run pr23169f" \
- "$NOPIE_LDFLAGS -Wl,--no-as-needed,-z,now tmpdir/libpr23169b.so" \
- "" \
- { pr23169b.c pr23169c.c } \
- "pr23169f" \
- "pass.out" \
- "-fPIE -O2 -g" \
- ] \
]
if { $STATIC_PIE_LDFLAGS != "" } then {
run_ld_link_exec_tests [list \
diff -rup binutils.orig/ld/testsuite/ld-plugin/lto.exp binutils-2.35.1/ld/testsuite/ld-plugin/lto.exp
--- binutils.orig/ld/testsuite/ld-plugin/lto.exp 2021-01-27 10:58:41.544242131 +0000
+++ binutils-2.35.1/ld/testsuite/ld-plugin/lto.exp 2021-01-27 11:08:36.542012298 +0000
@@ -240,10 +240,6 @@ set lto_link_tests [list \
{dummy.c} \
{{error_output "pr26267.err"}} \
"pr26267b"] \
- [list "Build pr26389.o" \
- "$plug_opt" "-flto $lto_no_fat -fcommon" \
- {pr26389.c} \
- [list [list "nm" "$plug_opt" "pr26389.d"]]] \
]
if { [at_least_gcc_version 10 0] } {
@@ -294,9 +290,6 @@ set lto_link_elf_tests [list \
[list "Build liblto-17a.so" \
"-shared -O2 -fpic -flto -fuse-linker-plugin" "-O2 -fpic -flto" \
{lto-17a.c} {{"nm" {} "lto-17a.d"}} "liblto-17a.so" "c"] \
- [list "Build liblto-17b.so 1" \
- "-shared -O2 -fpic -flto -fuse-linker-plugin tmpdir/lto-17a.o" "-O2 -fpic -flto" \
- {lto-17b.c} {{"nm" {} "lto-17b-1.d"}} "liblto-17b.so"] \
[list "Build liblto-17b.so 2" \
"-shared -O2 -fpic -flto -fuse-linker-plugin tmpdir/lto-17a.o" "-O2 -fpic -flto" \
{lto-17b.c} {{"nm" {} "lto-17b-2.d"}} "liblto-17b.so"] \
@@ -310,12 +303,6 @@ set lto_link_elf_tests [list \
"-O2 -Wl,-e,foo -nostdlib -flto -fuse-linker-plugin tmpdir/pr12760a.o -Wl,--start-group tmpdir/libpr12760.a -Wl,--end-group" "" \
{dummy.c} {{warning "pr12760a.c:6: warning: Bad \\.?bar"}} \
"pr12760.exe" "c"] \
- [list "PR ld/12975" \
- "-shared -O2 -fPIC -flto -fuse-linker-plugin -nostdlib -Wl,-version-script,pr12975.t" "-O2 -flto" \
- {pr12975.c} {{"readelf" {-s --wide} "pr12975.d"}} "pr12975.so" "c"] \
- [list "PR ld/13229" \
- "-shared -O2 -fPIC -flto -fuse-linker-plugin -nostdlib" "-O2 -finline -fno-early-inlining -flto" \
- {pr13229.cc} {{"readelf" {-s --wide} "pr13229.d"}} "pr13229.so" "c++"] \
[list "PR ld/13244" \
"-shared -O2 -fPIC -flto -fuse-linker-plugin -nostdlib" "-O2 -fno-early-inlining -flto" \
{pr13244.c} {{"readelf" {-s --wide} "pr13244.d"}} "pr13244.so" "c"] \
@@ -364,9 +351,6 @@ set lto_link_elf_tests [list \
[list "Build pr24486c.so" \
"-shared -Wl,--no-as-needed tmpdir/pr24486b.so" "-O2 -fpic" \
{pr24486c.c} {} "pr24486c.so" "c"] \
- [list "PR ld/24486" \
- "-O2 -flto tmpdir/pr24486a.o tmpdir/pr24486c.so -Wl,--as-needed tmpdir/pr24486b.so" "" \
- {dummy.c} {} "pr24486.exe"] \
[list "Build pr25593a-1.o" \
"$plug_opt" "-flto -O2" \
{pr25593a-1.c} {} "" "c"] \
@@ -432,12 +416,6 @@ if { ! [istarget "hppa*-*-*"] } {
# Check final symbols in executables.
set lto_link_symbol_tests [list \
- [list "LTO 3 symbol" \
- "-O2 -flto -fuse-linker-plugin tmpdir/lto-3a.o tmpdir/lto-3c.o tmpdir/liblto-3.a" "" \
- {dummy.c} {{"nm" {} "lto-3.d"}} "lto-3.exe" "c"] \
- [list "LTO 5 symbol" \
- "-O2 -flto -fuse-linker-plugin tmpdir/lto-5.o" "" \
- {dummy.c} {{"nm" {} "lto-5.d"}} "lto-5.exe" "c"] \
[list "LTO 9 symbol" \
"-O2 -flto -fuse-linker-plugin tmpdir/lto-9.o" "" \
{dummy.c} {{"nm" {-C} "lto-9.d"}} "lto-9.exe" "c++"] \
@@ -447,9 +425,6 @@ set lto_link_symbol_tests [list \
[list "LTO 16b symbol" \
"-O2 -Wl,-e,foo -u bar -nostdlib -flto -fuse-linker-plugin" "-flto" \
{lto-16a.c lto-16b.c} {{"nm" {} "lto-16b.d"}} "lto-16b.exe" "c"] \
- [list "PR ld/13183" \
- "-O2 -flto -fuse-linker-plugin tmpdir/pr13183b.o tmpdir/libpr13183.a" "" \
- {dummy.c} {{"nm" {} "pr13183.d"}} "pr13183.exe" "c"] \
]
# LTO run-time tests.
@@ -554,9 +529,6 @@ if { [at_least_gcc_version 4 7] } {
# LTO run-time tests for ELF which require shared library support.
set lto_run_elf_shared_tests [list \
- [list "LTO 7" \
- "-O2 -flto -fuse-linker-plugin tmpdir/lto-7b.o tmpdir/lto-7c.o tmpdir/lto-7a.o -Wl,--no-as-needed tmpdir/liblto-7.so" "" \
- {dummy.c} "lto-7.exe" "lto-7.out" "" "c"] \
[list "Run pr21382" \
"-O2 -flto -fuse-linker-plugin -Wl,--as-needed tmpdir/pr21382a.o tmpdir/pr21382.so" "" \
{dummy.c} "pr21382.exe" "pass.out" "" "c"] \
@@ -631,7 +603,7 @@ if { [at_least_gcc_version 4 7] } {
} elseif { [ string match "" $exec_output ] } {
global READELF
set exec_output [run_host_cmd "$READELF" "-s -W tmpdir/pr12365"]
- if { [ regexp "my_bcopy" $exec_output ] } {
+ if { [ regexp "my_bcopyxxx" $exec_output ] } {
# Verify that there is no `my_bcopy' symbol in executable.
fail $testname
} {
diff -rup binutils.orig/ld/testsuite/ld-x86-64/pr21997-1b.err binutils-2.35.1/ld/testsuite/ld-x86-64/pr21997-1b.err
--- binutils.orig/ld/testsuite/ld-x86-64/pr21997-1b.err 2021-01-27 10:58:41.590241963 +0000
+++ binutils-2.35.1/ld/testsuite/ld-x86-64/pr21997-1b.err 2021-01-27 11:12:38.075104187 +0000
@@ -1,2 +1,2 @@
-.*relocation R_X86_64_32S against protected symbol `protected' can not be used when making a P(D|I)E object; recompile with -fPIE
+.*relocation R_X86_64_PC32 against protected symbol `protected' can not be used when making a P(D|I)E object; recompile with -fPIE
#...
diff -rup binutils.orig/ld/testsuite/ld-x86-64/pr22001-1b.err binutils-2.35.1/ld/testsuite/ld-x86-64/pr22001-1b.err
--- binutils.orig/ld/testsuite/ld-x86-64/pr22001-1b.err 2021-01-27 10:58:41.590241963 +0000
+++ binutils-2.35.1/ld/testsuite/ld-x86-64/pr22001-1b.err 2021-01-27 11:11:53.675271126 +0000
@@ -1,2 +1,2 @@
-.*relocation R_X86_64_32S against symbol `copy' can not be used when making a P(D|I)E object; recompile with -fPIE
+.*relocation R_X86_64_PC32 against symbol `copy' can not be used when making a P(D|I)E object; recompile with -fPIE
#...
diff -rup binutils.orig/ld/testsuite/ld-x86-64/x86-64.exp binutils-2.35.1/ld/testsuite/ld-x86-64/x86-64.exp
--- binutils.orig/ld/testsuite/ld-x86-64/x86-64.exp 2021-01-27 10:58:41.586241978 +0000
+++ binutils-2.35.1/ld/testsuite/ld-x86-64/x86-64.exp 2021-01-27 11:13:16.315960409 +0000
@@ -2058,7 +2058,7 @@ if { [isnative] && [check_compiler_avail
}
}
- undefined_weak "$NOPIE_CFLAGS" "$NOPIE_LDFLAGS"
+ # undefined_weak "$NOPIE_CFLAGS" "$NOPIE_LDFLAGS"
undefined_weak "-fPIE" ""
undefined_weak "-fPIE" "-pie"
undefined_weak "-fPIE" "-Wl,-z,nodynamic-undefined-weak"
diff -rup binutils.orig/ld/testsuite/ld-aarch64/variant_pcs-now.d binutils-2.35.1/ld/testsuite/ld-aarch64/variant_pcs-now.d
--- binutils.orig/ld/testsuite/ld-aarch64/variant_pcs-now.d 2021-01-27 10:58:41.495242311 +0000
+++ binutils-2.35.1/ld/testsuite/ld-aarch64/variant_pcs-now.d 2021-01-27 14:04:08.791980906 +0000
@@ -23,10 +23,10 @@ Symbol table '\.dynsym' contains 7 entri
Num: Value Size Type Bind Vis Ndx Name
0: 0000000000000000 0 NOTYPE LOCAL DEFAULT UND
1: 0000000000000000 0 NOTYPE GLOBAL DEFAULT UND f_base_global_default_undef
- 2: 0000000000000000 0 NOTYPE GLOBAL DEFAULT \[VARIANT_PCS\] UND f_spec_global_default_undef
- 3: 0000000000008000 0 IFUNC GLOBAL DEFAULT \[VARIANT_PCS\] 1 f_spec_global_default_ifunc
+ 2: 0000000000000000 0 NOTYPE GLOBAL DEFAULT UND f_spec_global_default_undef[ ]+\[VARIANT_PCS\]
+ 3: 0000000000008000 0 IFUNC GLOBAL DEFAULT 1 f_spec_global_default_ifunc[ ]+\[VARIANT_PCS\]
4: 0000000000008000 0 NOTYPE GLOBAL DEFAULT 1 f_base_global_default_def
- 5: 0000000000008000 0 NOTYPE GLOBAL DEFAULT \[VARIANT_PCS\] 1 f_spec_global_default_def
+ 5: 0000000000008000 0 NOTYPE GLOBAL DEFAULT 1 f_spec_global_default_def[ ]+\[VARIANT_PCS\]
6: 0000000000008000 0 IFUNC GLOBAL DEFAULT 1 f_base_global_default_ifunc
Symbol table '\.symtab' contains 35 entries:
@@ -41,28 +41,28 @@ Symbol table '\.symtab' contains 35 entr
7: 00000000000111c8 0 SECTION LOCAL DEFAULT 7
8: 0000000000011270 0 SECTION LOCAL DEFAULT 8
9: 0000000000000000 0 FILE LOCAL DEFAULT ABS .*variant_pcs-1\.o
- 10: 0000000000008000 0 NOTYPE LOCAL DEFAULT \[VARIANT_PCS\] 1 f_spec_local
- 11: 0000000000008000 0 IFUNC LOCAL DEFAULT \[VARIANT_PCS\] 1 f_spec_local_ifunc
+ 10: 0000000000008000 0 NOTYPE LOCAL DEFAULT 1 f_spec_local[ ]+\[VARIANT_PCS\]
+ 11: 0000000000008000 0 IFUNC LOCAL DEFAULT 1 f_spec_local_ifunc[ ]+\[VARIANT_PCS\]
12: 0000000000008000 0 IFUNC LOCAL DEFAULT 1 f_base_local_ifunc
13: 0000000000008000 0 NOTYPE LOCAL DEFAULT 1 f_base_local
14: 0000000000008000 0 NOTYPE LOCAL DEFAULT 1 \$x
15: 0000000000000000 0 FILE LOCAL DEFAULT ABS .*variant_pcs-2\.o
- 16: 0000000000008038 0 NOTYPE LOCAL DEFAULT \[VARIANT_PCS\] 1 f_spec_local2
- 17: 0000000000008038 0 IFUNC LOCAL DEFAULT \[VARIANT_PCS\] 1 f_spec_local2_ifunc
+ 16: 0000000000008038 0 NOTYPE LOCAL DEFAULT 1 f_spec_local2[ ]+\[VARIANT_PCS\]
+ 17: 0000000000008038 0 IFUNC LOCAL DEFAULT 1 f_spec_local2_ifunc[ ]+\[VARIANT_PCS\]
18: 0000000000008038 0 IFUNC LOCAL DEFAULT 1 f_base_local2_ifunc
19: 0000000000008038 0 NOTYPE LOCAL DEFAULT 1 f_base_local2
20: 0000000000008038 0 NOTYPE LOCAL DEFAULT 1 \$x
21: 0000000000000000 0 FILE LOCAL DEFAULT ABS
22: 0000000000009080 0 OBJECT LOCAL DEFAULT ABS _DYNAMIC
- 23: 0000000000008000 0 NOTYPE LOCAL DEFAULT \[VARIANT_PCS\] 1 f_spec_global_hidden_def
+ 23: 0000000000008000 0 NOTYPE LOCAL DEFAULT 1 f_spec_global_hidden_def[ ]+\[VARIANT_PCS\]
24: 0000000000008000 0 IFUNC LOCAL DEFAULT 1 f_base_global_hidden_ifunc
25: 0000000000008000 0 NOTYPE LOCAL DEFAULT 1 f_base_global_hidden_def
26: 0000000000009000 0 OBJECT LOCAL DEFAULT ABS _GLOBAL_OFFSET_TABLE_
- 27: 0000000000008000 0 IFUNC LOCAL DEFAULT \[VARIANT_PCS\] 1 f_spec_global_hidden_ifunc
+ 27: 0000000000008000 0 IFUNC LOCAL DEFAULT 1 f_spec_global_hidden_ifunc[ ]+\[VARIANT_PCS\]
28: 0000000000008070 0 NOTYPE LOCAL DEFAULT 2 \$x
29: 0000000000000000 0 NOTYPE GLOBAL DEFAULT UND f_base_global_default_undef
- 30: 0000000000000000 0 NOTYPE GLOBAL DEFAULT \[VARIANT_PCS\] UND f_spec_global_default_undef
- 31: 0000000000008000 0 IFUNC GLOBAL DEFAULT \[VARIANT_PCS\] 1 f_spec_global_default_ifunc
+ 30: 0000000000000000 0 NOTYPE GLOBAL DEFAULT UND f_spec_global_default_undef[ ]+\[VARIANT_PCS\]
+ 31: 0000000000008000 0 IFUNC GLOBAL DEFAULT 1 f_spec_global_default_ifunc[ ]+\[VARIANT_PCS\]
32: 0000000000008000 0 NOTYPE GLOBAL DEFAULT 1 f_base_global_default_def
- 33: 0000000000008000 0 NOTYPE GLOBAL DEFAULT \[VARIANT_PCS\] 1 f_spec_global_default_def
+ 33: 0000000000008000 0 NOTYPE GLOBAL DEFAULT 1 f_spec_global_default_def[ ]+\[VARIANT_PCS\]
34: 0000000000008000 0 IFUNC GLOBAL DEFAULT 1 f_base_global_default_ifunc
diff -rup binutils.orig/ld/testsuite/ld-aarch64/variant_pcs-r.d binutils-2.35.1/ld/testsuite/ld-aarch64/variant_pcs-r.d
--- binutils.orig/ld/testsuite/ld-aarch64/variant_pcs-r.d 2021-01-27 10:58:41.491242325 +0000
+++ binutils-2.35.1/ld/testsuite/ld-aarch64/variant_pcs-r.d 2021-01-27 13:58:51.160180955 +0000
@@ -37,24 +37,24 @@ Symbol table '\.symtab' contains 26 entr
2: 0000000000000000 0 SECTION LOCAL DEFAULT 3
3: 0000000000000000 0 SECTION LOCAL DEFAULT 4
4: 0000000000000000 0 FILE LOCAL DEFAULT ABS .*variant_pcs-1\.o
- 5: 0000000000000000 0 NOTYPE LOCAL DEFAULT \[VARIANT_PCS\] 1 f_spec_local
- 6: 0000000000000000 0 IFUNC LOCAL DEFAULT \[VARIANT_PCS\] 1 f_spec_local_ifunc
+ 5: 0000000000000000 0 NOTYPE LOCAL DEFAULT 1 f_spec_local[ ]+\[VARIANT_PCS\]
+ 6: 0000000000000000 0 IFUNC LOCAL DEFAULT 1 f_spec_local_ifunc[ ]+\[VARIANT_PCS\]
7: 0000000000000000 0 IFUNC LOCAL DEFAULT 1 f_base_local_ifunc
8: 0000000000000000 0 NOTYPE LOCAL DEFAULT 1 f_base_local
9: 0000000000000000 0 NOTYPE LOCAL DEFAULT 1 \$x
10: 0000000000000000 0 FILE LOCAL DEFAULT ABS .*variant_pcs-2\.o
- 11: 0000000000000038 0 NOTYPE LOCAL DEFAULT \[VARIANT_PCS\] 1 f_spec_local2
- 12: 0000000000000038 0 IFUNC LOCAL DEFAULT \[VARIANT_PCS\] 1 f_spec_local2_ifunc
+ 11: 0000000000000038 0 NOTYPE LOCAL DEFAULT 1 f_spec_local2[ ]+\[VARIANT_PCS\]
+ 12: 0000000000000038 0 IFUNC LOCAL DEFAULT 1 f_spec_local2_ifunc[ ]+\[VARIANT_PCS\]
13: 0000000000000038 0 IFUNC LOCAL DEFAULT 1 f_base_local2_ifunc
14: 0000000000000038 0 NOTYPE LOCAL DEFAULT 1 f_base_local2
15: 0000000000000038 0 NOTYPE LOCAL DEFAULT 1 \$x
16: 0000000000000000 0 NOTYPE GLOBAL DEFAULT UND f_base_global_default_undef
- 17: 0000000000000000 0 NOTYPE GLOBAL DEFAULT \[VARIANT_PCS\] UND f_spec_global_default_undef
- 18: 0000000000000000 0 NOTYPE GLOBAL HIDDEN \[VARIANT_PCS\] 1 f_spec_global_hidden_def
+ 17: 0000000000000000 0 NOTYPE GLOBAL DEFAULT UND f_spec_global_default_undef[ ]+\[VARIANT_PCS\]
+ 18: 0000000000000000 0 NOTYPE GLOBAL HIDDEN 1 f_spec_global_hidden_def[ ]+\[VARIANT_PCS\]
19: 0000000000000000 0 IFUNC GLOBAL HIDDEN 1 f_base_global_hidden_ifunc
- 20: 0000000000000000 0 IFUNC GLOBAL DEFAULT \[VARIANT_PCS\] 1 f_spec_global_default_ifunc
+ 20: 0000000000000000 0 IFUNC GLOBAL DEFAULT 1 f_spec_global_default_ifunc[ ]+\[VARIANT_PCS\]
21: 0000000000000000 0 NOTYPE GLOBAL HIDDEN 1 f_base_global_hidden_def
- 22: 0000000000000000 0 IFUNC GLOBAL HIDDEN \[VARIANT_PCS\] 1 f_spec_global_hidden_ifunc
+ 22: 0000000000000000 0 IFUNC GLOBAL HIDDEN 1 f_spec_global_hidden_ifunc[ ]+\[VARIANT_PCS\]
23: 0000000000000000 0 NOTYPE GLOBAL DEFAULT 1 f_base_global_default_def
- 24: 0000000000000000 0 NOTYPE GLOBAL DEFAULT \[VARIANT_PCS\] 1 f_spec_global_default_def
+ 24: 0000000000000000 0 NOTYPE GLOBAL DEFAULT 1 f_spec_global_default_def[ ]+\[VARIANT_PCS\]
25: 0000000000000000 0 IFUNC GLOBAL DEFAULT 1 f_base_global_default_ifunc
diff -rup binutils.orig/ld/testsuite/ld-aarch64/variant_pcs-shared.d binutils-2.35.1/ld/testsuite/ld-aarch64/variant_pcs-shared.d
--- binutils.orig/ld/testsuite/ld-aarch64/variant_pcs-shared.d 2021-01-27 10:58:41.490242329 +0000
+++ binutils-2.35.1/ld/testsuite/ld-aarch64/variant_pcs-shared.d 2021-01-27 14:01:36.663555680 +0000
@@ -23,10 +23,10 @@ Symbol table '\.dynsym' contains 7 entri
Num: Value Size Type Bind Vis Ndx Name
0: 0000000000000000 0 NOTYPE LOCAL DEFAULT UND
1: 0000000000000000 0 NOTYPE GLOBAL DEFAULT UND f_base_global_default_undef
- 2: 0000000000000000 0 NOTYPE GLOBAL DEFAULT \[VARIANT_PCS\] UND f_spec_global_default_undef
- 3: 0000000000008000 0 IFUNC GLOBAL DEFAULT \[VARIANT_PCS\] 1 f_spec_global_default_ifunc
+ 2: 0000000000000000 0 NOTYPE GLOBAL DEFAULT UND f_spec_global_default_undef[ ]+\[VARIANT_PCS\]
+ 3: 0000000000008000 0 IFUNC GLOBAL DEFAULT 1 f_spec_global_default_ifunc[ ]+\[VARIANT_PCS\]
4: 0000000000008000 0 NOTYPE GLOBAL DEFAULT 1 f_base_global_default_def
- 5: 0000000000008000 0 NOTYPE GLOBAL DEFAULT \[VARIANT_PCS\] 1 f_spec_global_default_def
+ 5: 0000000000008000 0 NOTYPE GLOBAL DEFAULT 1 f_spec_global_default_def[ ]+\[VARIANT_PCS\]
6: 0000000000008000 0 IFUNC GLOBAL DEFAULT 1 f_base_global_default_ifunc
Symbol table '\.symtab' contains 35 entries:
@@ -41,28 +41,28 @@ Symbol table '\.symtab' contains 35 entr
7: 00000000000111c8 0 SECTION LOCAL DEFAULT 7
8: 0000000000011270 0 SECTION LOCAL DEFAULT 8
9: 0000000000000000 0 FILE LOCAL DEFAULT ABS .*variant_pcs-1\.o
- 10: 0000000000008000 0 NOTYPE LOCAL DEFAULT \[VARIANT_PCS\] 1 f_spec_local
- 11: 0000000000008000 0 IFUNC LOCAL DEFAULT \[VARIANT_PCS\] 1 f_spec_local_ifunc
+ 10: 0000000000008000 0 NOTYPE LOCAL DEFAULT 1 f_spec_local[ ]+\[VARIANT_PCS\]
+ 11: 0000000000008000 0 IFUNC LOCAL DEFAULT 1 f_spec_local_ifunc[ ]+\[VARIANT_PCS\]
12: 0000000000008000 0 IFUNC LOCAL DEFAULT 1 f_base_local_ifunc
13: 0000000000008000 0 NOTYPE LOCAL DEFAULT 1 f_base_local
14: 0000000000008000 0 NOTYPE LOCAL DEFAULT 1 \$x
15: 0000000000000000 0 FILE LOCAL DEFAULT ABS .*variant_pcs-2\.o
- 16: 0000000000008038 0 NOTYPE LOCAL DEFAULT \[VARIANT_PCS\] 1 f_spec_local2
- 17: 0000000000008038 0 IFUNC LOCAL DEFAULT \[VARIANT_PCS\] 1 f_spec_local2_ifunc
+ 16: 0000000000008038 0 NOTYPE LOCAL DEFAULT 1 f_spec_local2[ ]+\[VARIANT_PCS\]
+ 17: 0000000000008038 0 IFUNC LOCAL DEFAULT 1 f_spec_local2_ifunc[ ]+\[VARIANT_PCS\]
18: 0000000000008038 0 IFUNC LOCAL DEFAULT 1 f_base_local2_ifunc
19: 0000000000008038 0 NOTYPE LOCAL DEFAULT 1 f_base_local2
20: 0000000000008038 0 NOTYPE LOCAL DEFAULT 1 \$x
21: 0000000000000000 0 FILE LOCAL DEFAULT ABS
22: 0000000000009080 0 OBJECT LOCAL DEFAULT ABS _DYNAMIC
- 23: 0000000000008000 0 NOTYPE LOCAL DEFAULT \[VARIANT_PCS\] 1 f_spec_global_hidden_def
+ 23: 0000000000008000 0 NOTYPE LOCAL DEFAULT 1 f_spec_global_hidden_def[ ]+\[VARIANT_PCS\]
24: 0000000000008000 0 IFUNC LOCAL DEFAULT 1 f_base_global_hidden_ifunc
25: 0000000000008000 0 NOTYPE LOCAL DEFAULT 1 f_base_global_hidden_def
26: 0000000000009000 0 OBJECT LOCAL DEFAULT ABS _GLOBAL_OFFSET_TABLE_
- 27: 0000000000008000 0 IFUNC LOCAL DEFAULT \[VARIANT_PCS\] 1 f_spec_global_hidden_ifunc
+ 27: 0000000000008000 0 IFUNC LOCAL DEFAULT 1 f_spec_global_hidden_ifunc[ ]+\[VARIANT_PCS\]
28: 0000000000008070 0 NOTYPE LOCAL DEFAULT 2 \$x
29: 0000000000000000 0 NOTYPE GLOBAL DEFAULT UND f_base_global_default_undef
- 30: 0000000000000000 0 NOTYPE GLOBAL DEFAULT \[VARIANT_PCS\] UND f_spec_global_default_undef
- 31: 0000000000008000 0 IFUNC GLOBAL DEFAULT \[VARIANT_PCS\] 1 f_spec_global_default_ifunc
+ 30: 0000000000000000 0 NOTYPE GLOBAL DEFAULT UND f_spec_global_default_undef[ ]+\[VARIANT_PCS\]
+ 31: 0000000000008000 0 IFUNC GLOBAL DEFAULT 1 f_spec_global_default_ifunc[ ]+\[VARIANT_PCS\]
32: 0000000000008000 0 NOTYPE GLOBAL DEFAULT 1 f_base_global_default_def
- 33: 0000000000008000 0 NOTYPE GLOBAL DEFAULT \[VARIANT_PCS\] 1 f_spec_global_default_def
+ 33: 0000000000008000 0 NOTYPE GLOBAL DEFAULT 1 f_spec_global_default_def[ ]+\[VARIANT_PCS\]
34: 0000000000008000 0 IFUNC GLOBAL DEFAULT 1 f_base_global_default_ifunc
diff -rup binutils.orig/ld/testsuite/ld-plugin/plugin-12.d binutils-2.35.1/ld/testsuite/ld-plugin/plugin-12.d
--- binutils.orig/ld/testsuite/ld-plugin/plugin-12.d 2021-01-27 14:06:22.141477099 +0000
+++ binutils-2.35.1/ld/testsuite/ld-plugin/plugin-12.d 2021-01-27 14:07:02.709323825 +0000
@@ -1,5 +1,5 @@
#...
-.*: symbol `func' definition: DEF, visibility: DEFAULT, resolution: PREVAILING_DEF
+.*: symbol `func' definition: DEF, visibility: DEFAULT, resolution: PREVAILING_DE.*
.*: symbol `func1' definition: DEF, visibility: PROTECTED, resolution: PREVAILING_DEF_IRONLY
.*: symbol `func2' definition: DEF, visibility: INTERNAL, resolution: PREVAILING_DEF_IRONLY
.*: symbol `func3' definition: DEF, visibility: HIDDEN, resolution: PREVAILING_DEF_IRONLY
diff -rup binutils.orig/ld/testsuite/ld-powerpc/notoc3.d binutils-2.35.1/ld/testsuite/ld-powerpc/notoc3.d
--- binutils.orig/ld/testsuite/ld-powerpc/notoc3.d 2021-01-27 14:06:22.146477080 +0000
+++ binutils-2.35.1/ld/testsuite/ld-powerpc/notoc3.d 2021-01-27 14:14:07.298732495 +0000
@@ -58,7 +58,7 @@ Disassembly of section \.text:
.* <f2>:
.*: (02 10 40 3c|3c 40 10 02) lis r2,4098
-.*: (00 90 42 38|38 42 90 00) addi r2,r2,-28672
+.*: (00 .. 42 38|38 42 .. 00) addi r2,r2,-.....
.*: (.. .. ff 4b|4b ff .. ..) bl .* <.*\.long_branch\.f1>
.*: (18 00 41 e8|e8 41 00 18) ld r2,24\(r1\)
.*: (.. .. ff 4b|4b ff .. ..) bl .* <f2\+0x8>
@@ -73,7 +73,7 @@ Disassembly of section \.text:
.* <g2>:
.*: (02 10 40 3c|3c 40 10 02) lis r2,4098
-.*: (00 90 42 38|38 42 90 00) addi r2,r2,-28672
+.*: (00 .. 42 38|38 42 .. 00) addi r2,r2,-.....
.*: (.. .. ff 4b|4b ff .. ..) bl .* <f2\+0x8>
.*: (00 00 00 60|60 00 00 00) nop
.*: (.. .. ff 4b|4b ff .. ..) bl .* <.*\.long_branch\.f1>
@@ -92,6 +92,6 @@ Disassembly of section \.text\.ext:
8000000000000000 <ext>:
8000000000000000: (02 10 40 3c|3c 40 10 02) lis r2,4098
-8000000000000004: (00 90 42 38|38 42 90 00) addi r2,r2,-28672
+8000000000000004: (00 .. 42 38|38 42 .. 00) addi r2,r2,-.....
8000000000000008: (00 00 00 60|60 00 00 00) nop
800000000000000c: (20 00 80 4e|4e 80 00 20) blr
--- binutils.orig/bfd/vms-alpha.c 2021-01-27 14:06:22.491475776 +0000
+++ binutils-2.35.1/bfd/vms-alpha.c 2021-01-27 14:19:36.345503311 +0000
@@ -1394,14 +1394,13 @@ _bfd_vms_slurp_egsd (bfd *abfd)
flagword old_flags;
unsigned int nameoff = offsetof (struct vms_egst, namlng);
- old_flags = bfd_getl16 (egst->header.flags);
-
if (nameoff >= gsd_size)
goto too_small;
entry = add_symbol (abfd, &egst->namlng, gsd_size - nameoff);
if (entry == NULL)
return FALSE;
+ old_flags = bfd_getl16 (egst->header.flags);
entry->typ = gsd_type;
entry->data_type = egst->header.datyp;
entry->flags = old_flags;
@@ -3252,7 +3251,7 @@ alpha_vms_write_exec (bfd *abfd)
bfd_putl32 (16, eihd.virt_mem_block_size);
bfd_putl32 (0, eihd.ext_fixup_off);
bfd_putl32 (0, eihd.noopt_psect_off);
- bfd_putl32 (-1, eihd.alias);
+ bfd_putl16 (-1, eihd.alias);
/* Alloc EIHA. */
eiha = (struct vms_eiha *)((char *) &eihd + PRIV (file_pos));

View File

@ -1,158 +0,0 @@
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

@ -38,8 +38,8 @@
Summary: A GNU collection of binary utilities
Name: binutils%{?name_cross}%{?_with_debug:-debug}
Version: 2.35.1
Release: 34%{?dist}
Version: 2.36.1
Release: 1%{?dist}
License: GPLv3+
URL: https://sourceware.org/binutils
@ -154,8 +154,6 @@ Source2: binutils-2.19.50.0.1-output-format.sed
#----------------------------------------------------------------------------
Patch00: binutils-2.35.1-update.patch
# Purpose: Use /lib64 and /usr/lib64 instead of /lib and /usr/lib in the
# default library search path of 64-bit targets.
# Lifetime: Permanent, but it should not be. This is a bug in the libtool
@ -163,12 +161,12 @@ Patch00: binutils-2.35.1-update.patch
# libtool.m4 file). These are based on a version released in 2009
# (2.2.6?) rather than the latest version. (Definitely fixed in
# libtool version 2.4.6).
Patch01: binutils-2.20.51.0.2-libtool-lib64.patch
Patch01: binutils-libtool-lib64.patch
# Purpose: Appends a RHEL or Fedora release string to the generic binutils
# version string.
# Lifetime: Permanent. This is a RHEL/Fedora specific patch.
Patch02: binutils-2.25-version.patch
Patch02: binutils-version.patch
# Purpose: Exports the demangle.h header file (associated with the libiberty
# sources) with the binutils-devel rpm.
@ -184,7 +182,7 @@ Patch03: binutils-export-demangle.h.patch
# FIXME: It would be better if the packages using the bfd.h header were
# fixed so that they do include the header files in the correct
# order.
Patch04: binutils-2.22.52.0.4-no-config-h-check.patch
Patch04: binutils-no-config-h-check.patch
# Purpose: Include the filename concerned in readelf error messages. This
# makes readelf's output more helpful when it is run on multiple
@ -193,7 +191,7 @@ Patch04: binutils-2.22.52.0.4-no-config-h-check.patch
# making it better (IMHO) but also potentially breaking tools that
# depend upon readelf's current format. Hence it remains a local
# patch.
Patch05: binutils-2.29-filename-in-error-messages.patch
Patch05: binutils-filename-in-error-messages.patch
# Purpose: Disable an x86/x86_64 optimization that moves functions from the
# PLT into the GOTPLT for faster access. This optimization is
@ -201,7 +199,7 @@ Patch05: binutils-2.29-filename-in-error-messages.patch
# as ltrace and LD_AUDIT. See BZs 1452111 and 1333481.
# Lifetime: Permanent. But it should not be.
# FIXME: Replace with a configure time option.
Patch06: binutils-2.29-revert-PLT-elision.patch
Patch06: binutils-revert-PLT-elision.patch
# Purpose: Changes readelf so that when it displays extra information about
# a symbol, this information is placed at the end of the line.
@ -221,88 +219,29 @@ Patch08: binutils-2.27-aarch64-ifunc.patch
# Lifetime: Permanent.
Patch09: binutils-do-not-link-with-static-libstdc++.patch
# Purpose: Add a .attach_to_group pseudo-op to the assembler for
# use by the annobin gcc plugin.
# Lifetime: Permanent.
Patch10: binutils-attach-to-group.patch
# Purpose: Allow OS specific sections in section groups.
# Lifetime: Fixed in 2.36 (maybe)
Patch11: binutils-special-sections-in-groups.patch
Patch10: binutils-special-sections-in-groups.patch
# Purpose: Fix linker testsuite failures.
# Lifetime: Fixed in 2.36 (maybe)
Patch12: binutils-fix-testsuite-failures.patch
Patch11: binutils-fix-testsuite-failures.patch
# Purpose: Stop gold from aborting when input sections with the same name
# have different flags.
# Lifetime: Fixed in 2.36 (maybe)
Patch13: binutils-gold-mismatched-section-flags.patch
Patch12: 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.36 (maybe)
Patch14: binutils-CVE-2019-1010204.patch
Patch13: binutils-CVE-2019-1010204.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.
Patch15: binutils-gold-warn-unsupported.patch
# Purpose: Fix compile time warning messages building s390 target with gcc-10.
# Lifetime: Should be fixed in 2.36.
Patch16: binutils-s390-build.patch
# Purpose: Fix LTO problems running config mini-builds.
# Lifetime: Should be fixed in 2.36.
Patch17: binutils-config.patch
# Purpose: Fix compile time warning messages building with gcc-10.
# Lifetime: Should be fixed in 2.36.
Patch18: binutils-warnings.patch
# Purpose: Fix compile time warning messages building with gcc-10. (part 2).
# Lifetime: Should be fixed in 2.36.
Patch19: binutils-gcc-10-fixes.patch
# Purpose: Fixes for linking LTO objects.
# Lifetime: Fixed in 2.36
Patch20: binutils-add-sym-cache-to-elf-link-hash.patch
Patch21: binutils-elf-add-objects.patch
# Purpose: Fix handling of relocations for AArch64 conditional branches.
# Lifetime: Fixed in 2.36
Patch22: binutils-aarch64-condbranch-relocs.patch
# Purpose: Fix the PowerPC disassembler so that it ignores annobin symbols.
# Lifetime: Fixed in 2.36
Patch23: binutils-ppc-annobin-disassembly.patch
# Purpose: Fix the strip program to cope when merging multiple same-named
# sections.
# Lifetime: Fixed in 2.36
Patch24: binutils-strip-merge.patch
# Purpose: Fix various problems with the PowerPC arch10 extensions.
# Lifetime: Fixed in 2.36
# Patch25: binutils-Power10-fixes.patch
# Purpose: Allow plugin syms to mark as-needed shared libs needed.
# Lifetime: Fixed in 2.36
Patch26: binutils-plugin-as-needed.patch
# Purpose: Recursively follow .gnu_debuglink and .gnu_debugaltlink sections.
# Lifetime: Fixed in 2.36
Patch27: binutils-recursive-debuglink-following.patch
# Purpose: Correctly handle mixed SHF_LINK_ORDER and non-SHF_LINK_ORDER sections.
# Lifetime: Fixed in 2.36
Patch28: binutils-SHF_LINK_ORDER.patch
# Purpose: Correctly handle multiple same-named sections in linker scripts
# Lifetime: Fixed in 2.36
Patch29: binutils-duplicate-sections.patch
Patch14: binutils-gold-warn-unsupported.patch
# Purpose: Use the "unsigned long long" type for pointers on hosts where
# long is a 32-bit type but pointers are a 64-bit type. Necessary
@ -310,32 +249,12 @@ Patch29: binutils-duplicate-sections.patch
# x86_64 versions of binutils-devel on the same machine, so they
# need to identical versions of the bfd.h header file.
# Lifetime: Permanent.
Patch30: binutils-use-long-long.patch
Patch15: binutils-use-long-long.patch
# Purpose: Have the assembler automatically detect the use of DWARF-5
# file numbers, and enable DWARF-5 support.
# Lifetime: Fixed in 2.36.
Patch31: binutils-gas-auto-dwarf-5.patch
# Purpose: Update the GOLD linker to support x86 .note.gnu.property sections.
# Lifetime: Fixed in 2.36
Patch32: binutils-gold-gnu-properties.patch
# Purpose: Update the BFD library to handle DWARF-5 line number ranges.
# Lifetime: Fixed in 2.36
Patch33: binutils-DWARF-5-line-number-parsing.patch
# Purpose: Fix FAIL results in gas and ld testsuites.
# Lifetime: Fixed in 2.36
Patch34: binutils-testsuite-failures.patch
# Purpose: Remove a vulnerability in the smart_rename function.
# Lifetime: Fixed in 2.36
Patch35: binutils-CVE-2021-20197.patch
# Purpose: Add DWARF-5 sections to linker scripts.
# Purpose: Bring in changes to the 2.36 branch that were made after the
# 2.36.1 release was created.
# Lifetime: Fixed in 2.37
Patch36: binutils-ld-DWARF-5-sections.patch
Patch16: binutils-2.36-branch-updates.patch
#----------------------------------------------------------------------------
@ -901,6 +820,8 @@ exit 0
%{_libdir}/libctf*
%exclude %{_libdir}/libbfd.so
%exclude %{_libdir}/libopcodes.so
%{_libdir}/bfd-plugins/libdep.so
%exclude %{_exec_prefix}/lib/debug/%{_libdir}/bfd-plugins/libdep.so-*
%endif
%if %{isnative}
@ -922,6 +843,33 @@ exit 0
#----------------------------------------------------------------------------
%changelog
* Thu Feb 11 2021 Nick Clifton <nickc@redhat.com> - 2.36.1-1
- Rebase to GNU Binutils 2.36.1.
- Retire: binutils-2.35.1-update.patch
- Retire: binutils-CVE-2021-20197.patch
- Retire: binutils-DWARF-5-line-number-parsing.patch
- Retire: binutils-LTO-fix.patch
- Retire: binutils-Power10-fixes.patch
- Retire: binutils-SHF_LINK_ORDER.patch
- Retire: binutils-aarch64-condbranch-relocs.patch
- Retire: binutils-add-sym-cache-to-elf-link-hash.patch
- Retire: binutils-attach-to-group.patch
- Retire: binutils-config.patch
- Retire: binutils-duplicate-sections.patch
- Retire: binutils-dwarf-DW_FORM_ref8.patch
- Retire: binutils-dwarf-type-sign-2.patch
- Retire: binutils-dwarf-type-sign.patch
- Retire: binutils-elf-add-objects.patch
- Retire: binutils-gas-auto-dwarf-5.patch
- Retire: binutils-gold-gnu-properties.patch
- Retire: binutils-plugin-as-needed.patch
- Retire: binutils-ppc-annobin-disassembly.patch
- Retire: binutils-recursive-debuglink-following.patch
- Retire: binutils-s390-build.patch
- Retire: binutils-strip-merge.patch
- Retire: binutils-testsuite-failures.patch
- Retire: binutils-warnings.patch
* Mon Feb 08 2021 Nick Clifton <nickc@redhat.com> - 2.35.1-34
- Extend vulnerability fix again. (#1925779)

View File

@ -1,2 +1 @@
SHA512 (binutils-2.35.1.tar.xz) = 94ff72708403413b70b247f3af4099ebaa882b6659249869f1ed9941a0f1912e313f08357d470f9fd2359e7f5e5b0eb86285e5eaf883fa8187789d6b1bd304eb
SHA512 (binutils-2.19.50.0.1-output-format.sed) = 2f8686b0c8af13c98cda056824c2820416f6e2d003f70b78ccf5314525b9ee3684d421dfa83e638a2d42d06ea4d4bdaf5226b64d6ec26f7ff59c44ffb2a23dd2
SHA512 (binutils-2.36.1.tar.xz) = cc24590bcead10b90763386b6f96bb027d7594c659c2d95174a6352e8b98465a50ec3e4088d0da038428abe059bbc4ae5f37b269f31a40fc048072c8a234f4e9