Rebase to 2.40.

Retire: binutils-package-metadata.patch
Retire: binutils-gas-dwarf-skip-empty-functions.patch
Retire: binutils-CVE-38128-dwarf-abbrev-parsing.patch
Retire: binutils-readelf-no-sections.patch
Retire: binutils-libiberty-configure-compile-warnings.patch
Retire: binutils-CVE-2022-4285.patch
This commit is contained in:
Nick Clifton 2023-02-14 14:42:20 +00:00
parent 6bfd06790b
commit d8e1d9b57a
13 changed files with 816 additions and 2132 deletions

1
.gitignore vendored
View File

@ -69,3 +69,4 @@ stamp-*
/binutils-2.37.tar.xz
/binutils-2.38.tar.xz
/binutils-2.39.tar.xz
/binutils-2.40.tar.xz

View File

@ -1,13 +0,0 @@
--- binutils.orig/bfd/elf.c 2022-12-13 15:21:20.040233487 +0000
+++ binutils-2.39/bfd/elf.c 2022-12-13 15:22:33.580986232 +0000
@@ -8868,7 +8868,9 @@ _bfd_elf_slurp_version_tables (bfd *abfd
bfd_set_error (bfd_error_file_too_big);
goto error_return_verref;
}
- elf_tdata (abfd)->verref = (Elf_Internal_Verneed *) bfd_alloc (abfd, amt);
+ if (amt == 0)
+ goto error_return_verref;
+ elf_tdata (abfd)->verref = (Elf_Internal_Verneed *) bfd_zalloc (abfd, amt);
if (elf_tdata (abfd)->verref == NULL)
goto error_return_verref;

View File

@ -1,15 +0,0 @@
--- binutils.orig/binutils/dwarf.c 2022-08-31 11:58:08.918685348 +0100
+++ binutils-2.39/binutils/dwarf.c 2022-08-31 15:24:13.881865797 +0100
@@ -6365,7 +6365,11 @@ display_debug_abbrev (struct dwarf_secti
list->start_of_next_abbrevs = start;
}
else
- start = list->start_of_next_abbrevs;
+ {
+ if (start == list->start_of_next_abbrevs)
+ break;
+ start = list->start_of_next_abbrevs;
+ }
if (list->first_abbrev == NULL)
continue;

View File

@ -1,7 +1,7 @@
diff -rup binutils.orig/configure binutils-2.30/configure
--- binutils.orig/configure 2018-09-24 17:50:06.967172922 +0100
+++ binutils-2.30/configure 2018-09-24 17:51:16.648624865 +0100
@@ -4996,49 +4996,6 @@ if test -z "$LD"; then
diff -rup binutils.orig/configure binutils-2.40/configure
--- binutils.orig/configure 2023-02-13 14:43:00.728877170 +0000
+++ binutils-2.40/configure 2023-02-13 14:43:13.671864892 +0000
@@ -5442,49 +5442,6 @@ if test -z "$LD"; then
fi
fi
@ -51,10 +51,10 @@ diff -rup binutils.orig/configure binutils-2.30/configure
if test -n "$ac_tool_prefix"; then
diff -rup binutils.orig/configure.ac binutils-2.30/configure.ac
--- binutils.orig/configure.ac 2018-09-24 17:50:07.241170767 +0100
+++ binutils-2.30/configure.ac 2018-09-24 17:50:29.908992486 +0100
@@ -1288,26 +1288,6 @@ if test -z "$LD"; then
diff -rup binutils.orig/configure.ac binutils-2.40/configure.ac
--- binutils.orig/configure.ac 2023-02-13 14:43:00.728877170 +0000
+++ binutils-2.40/configure.ac 2023-02-13 14:43:13.671864892 +0000
@@ -1435,26 +1435,6 @@ if test -z "$LD"; then
fi
fi
@ -79,5 +79,7 @@ diff -rup binutils.orig/configure.ac binutils-2.30/configure.ac
-fi
-
ACX_PROG_GNAT
ACX_PROG_GDC
ACX_PROG_CMP_IGNORE_INITIAL
Only in binutils-2.40: configure.ac.orig
Only in binutils-2.40: configure.orig

View File

@ -1,9 +1,12 @@
--- binutils.orig/binutils/readelf.c 2021-07-19 12:39:14.206556025 +0100
+++ binutils-2.37/binutils/readelf.c 2021-07-19 12:44:37.712728732 +0100
@@ -21873,45 +21873,52 @@ process_file (char * file_name)
diff -rup binutils.orig/binutils/readelf.c binutils-2.40/binutils/readelf.c
--- binutils.orig/binutils/readelf.c 2023-02-13 14:38:44.081029276 +0000
+++ binutils-2.40/binutils/readelf.c 2023-02-13 14:38:56.201022315 +0000
@@ -22858,46 +22858,53 @@ process_file (char * file_name)
Filedata * filedata = NULL;
struct stat statbuf;
char armag[SARMAG];
bool ret = true;
- bool ret = true;
+ bool ret = false;
+ char * name;
+ char * saved_program_name;
+
@ -66,8 +69,8 @@
+ goto done;
}
filedata->file_size = (bfd_size_type) statbuf.st_size;
@@ -21919,33 +21926,39 @@ process_file (char * file_name)
filedata->file_size = statbuf.st_size;
@@ -22905,33 +22912,39 @@ process_file (char * file_name)
if (memcmp (armag, ARMAG, SARMAG) == 0)
{
@ -121,14 +124,4 @@
free (ba_cache.strtab);
ba_cache.strtab = NULL;
--- binutils.orig/binutils/readelf.c 2021-08-10 10:15:22.088016072 +0100
+++ binutils-2.37/binutils/readelf.c 2021-08-10 10:15:55.567907891 +0100
@@ -21884,7 +21884,7 @@ process_file (char * file_name)
Filedata * filedata = NULL;
struct stat statbuf;
char armag[SARMAG];
- bool ret = true;
+ bool ret = false;
char * name;
char * saved_program_name;
Only in binutils-2.40/binutils: readelf.c.orig

View File

@ -1,93 +0,0 @@
From b53c44bfe31fb036f212275b6d70edd5eee7b088 Mon Sep 17 00:00:00 2001
From: Jan Beulich via Binutils <binutils@sourceware.org>
Date: Tue, 9 Aug 2022 13:12:03 +0200
Subject: [PATCH] gas/Dwarf: properly skip zero-size functions
PR gas/29451
While out_debug_abbrev() properly skips such functions, out_debug_info()
mistakenly didn't. It needs to calculate the high_pc expression ahead of
time, in order to skip emitting any data for the function if the value
is zero.
The one case which would still leave a zero-size entry is when
symbol_get_obj(symp)->size ends up evaluating to zero. I hope we can
expect that to not be the case, otherwise we'd need to have a way to
post-process .debug_info contents between resolving expressions and
actually writing the data out to the file. Even then it wouldn't be
entirely obvious in which way to alter the data.
---
gas/dwarf2dbg.c | 39 ++++++++++++++++++++-------------------
1 file changed, 20 insertions(+), 19 deletions(-)
diff --git a/gas/dwarf2dbg.c b/gas/dwarf2dbg.c
index 868ec79ee2c..f346bd6a412 100644
--- a/gas/dwarf2dbg.c
+++ b/gas/dwarf2dbg.c
@@ -2882,6 +2882,7 @@ out_debug_info (segT info_seg, segT abbrev_seg, segT line_seg, segT str_seg,
{
const char *name;
size_t len;
+ expressionS size = { .X_op = O_constant };
/* Skip warning constructs (see above). */
if (symbol_get_bfdsym (symp)->flags & BSF_WARNING)
@@ -2895,6 +2896,18 @@ out_debug_info (segT info_seg, segT abbrev_seg, segT line_seg, segT str_seg,
if (!S_IS_DEFINED (symp) || !S_IS_FUNCTION (symp))
continue;
+#if defined (OBJ_ELF) /* || defined (OBJ_MAYBE_ELF) */
+ size.X_add_number = S_GET_SIZE (symp);
+ if (size.X_add_number == 0 && IS_ELF
+ && symbol_get_obj (symp)->size != NULL)
+ {
+ size.X_op = O_add;
+ size.X_op_symbol = make_expr_symbol (symbol_get_obj (symp)->size);
+ }
+#endif
+ if (size.X_op == O_constant && size.X_add_number == 0)
+ continue;
+
subseg_set (str_seg, 0);
name_sym = symbol_temp_new_now_octets ();
name = S_GET_NAME (symp);
@@ -2920,29 +2933,17 @@ out_debug_info (segT info_seg, segT abbrev_seg, segT line_seg, segT str_seg,
emit_expr (&exp, sizeof_address);
/* DW_AT_high_pc */
- exp.X_op = O_constant;
-#if defined (OBJ_ELF) /* || defined (OBJ_MAYBE_ELF) */
- exp.X_add_number = S_GET_SIZE (symp);
- if (exp.X_add_number == 0 && IS_ELF
- && symbol_get_obj (symp)->size != NULL)
- {
- exp.X_op = O_add;
- exp.X_op_symbol = make_expr_symbol (symbol_get_obj (symp)->size);
- }
-#else
- exp.X_add_number = 0;
-#endif
if (DWARF2_VERSION < 4)
{
- if (exp.X_op == O_constant)
- exp.X_op = O_symbol;
- exp.X_add_symbol = symp;
- emit_expr (&exp, sizeof_address);
+ if (size.X_op == O_constant)
+ size.X_op = O_symbol;
+ size.X_add_symbol = symp;
+ emit_expr (&size, sizeof_address);
}
- else if (exp.X_op == O_constant)
- out_uleb128 (exp.X_add_number);
+ else if (size.X_op == O_constant)
+ out_uleb128 (size.X_add_number);
else
- emit_leb128_expr (symbol_get_value_expression (exp.X_op_symbol), 0);
+ emit_leb128_expr (symbol_get_value_expression (size.X_op_symbol), 0);
}
/* End of children. */
--
2.37.1

View File

@ -1,283 +0,0 @@
diff -rup binutils.orig/libiberty/acinclude.m4 binutils-2.39/libiberty/acinclude.m4
--- binutils.orig/libiberty/acinclude.m4 2022-11-23 14:41:57.639262100 +0000
+++ binutils-2.39/libiberty/acinclude.m4 2022-11-23 14:43:07.139042148 +0000
@@ -24,6 +24,8 @@ AC_CACHE_CHECK([for working strncmp], ac
[AC_TRY_RUN([
/* Test by Jim Wilson and Kaveh Ghazi.
Check whether strncmp reads past the end of its string parameters. */
+#include <stdlib.h>
+#include <string.h>
#include <sys/types.h>
#ifdef HAVE_FCNTL_H
@@ -51,7 +53,8 @@ AC_CACHE_CHECK([for working strncmp], ac
#define MAP_LEN 0x10000
-main ()
+int
+main (void)
{
#if defined(HAVE_MMAP) || defined(HAVE_MMAP_ANYWHERE)
char *p;
@@ -157,7 +160,10 @@ 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([#include <stdlib.h>
+
+int
+find_stack_direction (void)
{
static char *addr = 0;
auto char dummy;
@@ -169,7 +175,9 @@ AC_CACHE_CHECK(stack direction for C all
else
return (&dummy > addr) ? 1 : -1;
}
-main ()
+
+int
+main (void)
{
exit (find_stack_direction() < 0);
}],
diff -rup binutils.orig/libiberty/configure binutils-2.39/libiberty/configure
--- binutils.orig/libiberty/configure 2022-11-23 14:41:57.652262059 +0000
+++ binutils-2.39/libiberty/configure 2022-11-23 14:46:31.556395168 +0000
@@ -1766,7 +1766,7 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_
/* end confdefs.h. */
$4
int
-main ()
+main (void)
{
static int test_array [1 - 2 * !(($2) >= 0)];
test_array [0] = 0;
@@ -1783,7 +1783,7 @@ if ac_fn_c_try_compile "$LINENO"; then :
/* end confdefs.h. */
$4
int
-main ()
+main (void)
{
static int test_array [1 - 2 * !(($2) <= $ac_mid)];
test_array [0] = 0;
@@ -1810,7 +1810,7 @@ else
/* end confdefs.h. */
$4
int
-main ()
+main (void)
{
static int test_array [1 - 2 * !(($2) < 0)];
test_array [0] = 0;
@@ -1827,7 +1827,7 @@ if ac_fn_c_try_compile "$LINENO"; then :
/* end confdefs.h. */
$4
int
-main ()
+main (void)
{
static int test_array [1 - 2 * !(($2) >= $ac_mid)];
test_array [0] = 0;
@@ -1862,7 +1862,7 @@ while test "x$ac_lo" != "x$ac_hi"; do
/* end confdefs.h. */
$4
int
-main ()
+main (void)
{
static int test_array [1 - 2 * !(($2) <= $ac_mid)];
test_array [0] = 0;
@@ -1892,7 +1892,7 @@ static unsigned long int ulongval () { r
#include <stdio.h>
#include <stdlib.h>
int
-main ()
+main (void)
{
FILE *f = fopen ("conftest.val", "w");
@@ -1952,7 +1952,7 @@ else
/* end confdefs.h. */
$4
int
-main ()
+main (void)
{
if (sizeof ($2))
return 0;
@@ -1965,7 +1965,7 @@ if ac_fn_c_try_compile "$LINENO"; then :
/* end confdefs.h. */
$4
int
-main ()
+main (void)
{
if (sizeof (($2)))
return 0;
@@ -2037,7 +2037,7 @@ choke me
#endif
int
-main ()
+main (void)
{
return $2 ();
;
@@ -2077,7 +2077,7 @@ else
/* end confdefs.h. */
$4
int
-main ()
+main (void)
{
#ifndef $as_decl_name
#ifdef __cplusplus
@@ -3459,7 +3459,7 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_
/* end confdefs.h. */
#include <stdio.h>
int
-main ()
+main (void)
{
printf ("hello world\n");
;
@@ -3487,7 +3487,7 @@ else
/* end confdefs.h. */
int
-main ()
+main (void)
{
;
@@ -3627,7 +3627,7 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_
/* end confdefs.h. */
#include <stdio.h>
int
-main ()
+main (void)
{
FILE *f = fopen ("conftest.out", "w");
return ferror (f) || fclose (f) != 0;
@@ -3692,7 +3692,7 @@ else
/* end confdefs.h. */
int
-main ()
+main (void)
{
;
@@ -3743,7 +3743,7 @@ else
/* end confdefs.h. */
int
-main ()
+main (void)
{
#ifndef __GNUC__
choke me
@@ -3784,7 +3784,7 @@ else
/* end confdefs.h. */
int
-main ()
+main (void)
{
;
@@ -3799,7 +3799,7 @@ else
/* end confdefs.h. */
int
-main ()
+main (void)
{
;
@@ -3815,7 +3815,7 @@ else
/* end confdefs.h. */
int
-main ()
+main (void)
{
;
@@ -3901,7 +3901,7 @@ int pairnames (int, char **, FILE *(*)(s
int argc;
char **argv;
int
-main ()
+main (void)
{
return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1];
;
@@ -6919,7 +6919,10 @@ else
else
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
-find_stack_direction ()
+#include <stdlib.h>
+
+int
+find_stack_direction (void)
{
static char *addr = 0;
auto char dummy;
@@ -6931,7 +6934,9 @@ find_stack_direction ()
else
return (&dummy > addr) ? 1 : -1;
}
-main ()
+
+int
+main (int)
{
exit (find_stack_direction() < 0);
}
@@ -7756,6 +7761,8 @@ else
/* Test by Jim Wilson and Kaveh Ghazi.
Check whether strncmp reads past the end of its string parameters. */
+#include <stdlib.h>
+#include <string.h>
#include <sys/types.h>
#ifdef HAVE_FCNTL_H
@@ -7783,7 +7790,8 @@ else
#define MAP_LEN 0x10000
-main ()
+int
+main (void)
{
#if defined(HAVE_MMAP) || defined(HAVE_MMAP_ANYWHERE)
char *p;
diff -rup binutils.orig/gas/acinclude.m4 binutils-2.39/gas/acinclude.m4
--- binutils.orig/gas/acinclude.m4 2022-11-23 14:56:11.793442492 +0000
+++ binutils-2.39/gas/acinclude.m4 2022-11-23 14:59:17.778057190 +0000
@@ -23,6 +23,7 @@ AC_DEFUN([GAS_WORKING_ASSERT],
[AC_MSG_CHECKING([for working assert macro])
AC_CACHE_VAL(gas_cv_assert_ok,
AC_TRY_LINK([#include <assert.h>
+#include <string.h>
#include <stdio.h>], [
/* check for requoting problems */
static int a, b, c, d;
diff -rup binutils.orig/gas/configure binutils-2.39/gas/configure
--- binutils.orig/gas/configure 2022-11-23 14:56:12.402441231 +0000
+++ binutils-2.39/gas/configure 2022-11-23 14:59:37.266016817 +0000
@@ -13758,6 +13758,7 @@ else
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#include <assert.h>
+#include <string.h>
#include <stdio.h>
int
main ()

View File

@ -1,197 +0,0 @@
diff -rup binutils.orig/gold/Makefile.am binutils-2.38/gold/Makefile.am
--- binutils.orig/gold/Makefile.am 2022-08-04 11:11:01.788495165 +0100
+++ binutils-2.38/gold/Makefile.am 2022-08-04 11:12:26.124013955 +0100
@@ -35,7 +35,7 @@ THREADFLAGS = @PTHREAD_CFLAGS@
THREADLIBS = @PTHREAD_LIBS@
AM_CFLAGS = $(WARN_CFLAGS) $(LFS_CFLAGS) $(RANDOM_SEED_CFLAGS) $(ZLIBINC) $(THREADFLAGS)
-AM_CXXFLAGS = $(WARN_CXXFLAGS) $(LFS_CFLAGS) $(RANDOM_SEED_CFLAGS) $(ZLIBINC) $(THREADFLAGS)
+AM_CXXFLAGS = $(WARN_CXXFLAGS) $(LFS_CFLAGS) $(RANDOM_SEED_CFLAGS) $(ZLIBINC) $(THREADFLAGS) $(JANSSON_CFLAGS)
AM_LDFLAGS = $(THREADFLAGS)
AM_CPPFLAGS = \
@@ -187,7 +187,7 @@ libgold_a_LIBADD = $(LIBOBJS)
sources_var = main.cc
deps_var = $(TARGETOBJS) libgold.a $(LIBIBERTY) $(LIBINTL_DEP)
ldadd_var = $(TARGETOBJS) libgold.a $(LIBIBERTY) $(GOLD_LDADD) $(LIBINTL) \
- $(THREADLIBS) $(LIBDL) $(ZLIB)
+ $(THREADLIBS) $(LIBDL) $(ZLIB) $(JANSSON_LIBS)
ldflags_var = $(GOLD_LDFLAGS)
ld_new_SOURCES = $(sources_var)
@@ -201,12 +201,12 @@ incremental_dump_SOURCES = incremental-d
incremental_dump_DEPENDENCIES = $(TARGETOBJS) libgold.a $(LIBIBERTY) \
$(LIBINTL_DEP)
incremental_dump_LDADD = $(TARGETOBJS) libgold.a $(LIBIBERTY) $(LIBINTL) \
- $(THREADLIBS) $(LIBDL) $(ZLIB)
+ $(THREADLIBS) $(LIBDL) $(ZLIB) $(JANSSON_LIBS)
dwp_SOURCES = dwp.cc
dwp_DEPENDENCIES = libgold.a $(LIBIBERTY) $(LIBINTL_DEP)
dwp_LDADD = libgold.a $(LIBIBERTY) $(GOLD_LDADD) $(LIBINTL) $(THREADLIBS) \
- $(LIBDL) $(ZLIB)
+ $(LIBDL) $(ZLIB) $(JANSSON_LIBS)
dwp_LDFLAGS = $(GOLD_LDFLAGS)
CONFIG_STATUS_DEPENDENCIES = $(srcdir)/../bfd/development.sh
diff -rup binutils.orig/gold/configure.ac binutils-2.38/gold/configure.ac
--- binutils.orig/gold/configure.ac 2022-08-04 11:11:01.783495194 +0100
+++ binutils-2.38/gold/configure.ac 2022-08-04 11:12:26.124013955 +0100
@@ -591,6 +591,32 @@ if test "$threads" = "yes"; then
fi
AM_CONDITIONAL(THREADS, test "$threads" = "yes")
+# Used to validate --package-metadata= input. Disabled by default.
+AC_ARG_ENABLE([jansson],
+ [AS_HELP_STRING([--enable-jansson],
+ [enable jansson [default=no]])],
+ [enable_jansson=$enableval],
+ [enable_jansson="no"])
+
+if test "x$enable_jansson" != "xno"; then
+ PKG_PROG_PKG_CONFIG
+ AS_IF([test -n "$PKG_CONFIG"],
+ [
+ PKG_CHECK_MODULES(JANSSON, [jansson],
+ [
+ AC_DEFINE(HAVE_JANSSON, 1, [The jansson library is to be used])
+ AC_SUBST([JANSSON_CFLAGS])
+ AC_SUBST([JANSSON_LIBS])
+ ],
+ [
+ AC_MSG_ERROR([Cannot find jansson library])
+ ])
+ ],
+ [
+ AC_MSG_ERROR([Cannot find pkg-config])
+ ])
+fi
+
dnl We have to check these in C, not C++, because autoconf generates
dnl tests which have no type information, and current glibc provides
dnl multiple declarations of functions like basename when compiling
diff -rup binutils.orig/gold/layout.cc binutils-2.38/gold/layout.cc
--- binutils.orig/gold/layout.cc 2022-08-04 11:11:01.783495194 +0100
+++ binutils-2.38/gold/layout.cc 2022-08-04 11:12:26.125013949 +0100
@@ -38,6 +38,9 @@
#include <windows.h>
#include <rpcdce.h>
#endif
+#ifdef HAVE_JANSSON
+#include <jansson.h>
+#endif
#include "parameters.h"
#include "options.h"
@@ -2439,6 +2442,7 @@ Layout::create_notes()
this->create_gold_note();
this->create_stack_segment();
this->create_build_id();
+ this->create_package_metadata();
}
// Create the dynamic sections which are needed before we read the
@@ -3536,6 +3540,52 @@ Layout::create_build_id()
}
}
+// If --package-metadata was used, set up the package metadata note.
+// https://systemd.io/ELF_PACKAGE_METADATA/
+
+void
+Layout::create_package_metadata()
+{
+ if (!parameters->options().user_set_package_metadata())
+ return;
+
+ const char* desc = parameters->options().package_metadata();
+ if (strcmp(desc, "") == 0)
+ return;
+
+#ifdef HAVE_JANSSON
+ json_error_t json_error;
+ json_t *json = json_loads(desc, 0, &json_error);
+ if (json)
+ json_decref(json);
+ else
+ {
+ gold_fatal(_("error: --package-metadata=%s does not contain valid "
+ "JSON: %s\n"),
+ desc, json_error.text);
+ }
+#endif
+
+ // Create the note.
+ size_t trailing_padding;
+ // Ensure the trailing NULL byte is always included, as per specification.
+ size_t descsz = strlen(desc) + 1;
+ Output_section* os = this->create_note("FDO", elfcpp::FDO_PACKAGING_METADATA,
+ ".note.package", descsz, true,
+ &trailing_padding);
+ if (os == NULL)
+ return;
+
+ Output_section_data* posd = new Output_data_const(desc, descsz, 4);
+ os->add_output_section_data(posd);
+
+ if (trailing_padding != 0)
+ {
+ posd = new Output_data_zero_fill(trailing_padding, 0);
+ os->add_output_section_data(posd);
+ }
+}
+
// If we have both .stabXX and .stabXXstr sections, then the sh_link
// field of the former should point to the latter. I'm not sure who
// started this, but the GNU linker does it, and some tools depend
diff -rup binutils.orig/gold/layout.h binutils-2.38/gold/layout.h
--- binutils.orig/gold/layout.h 2022-08-04 11:11:01.788495165 +0100
+++ binutils-2.38/gold/layout.h 2022-08-04 11:12:26.125013949 +0100
@@ -1107,6 +1107,10 @@ class Layout
void
create_build_id();
+ // Create a package metadata note if needed.
+ void
+ create_package_metadata();
+
// Link .stab and .stabstr sections.
void
link_stabs_sections();
@@ -1453,6 +1457,8 @@ class Layout
Gdb_index* gdb_index_data_;
// The space for the build ID checksum if there is one.
Output_section_data* build_id_note_;
+ // The space for the package metadata JSON if there is one.
+ Output_section_data* package_metadata_note_;
// The output section containing dwarf abbreviations
Output_reduced_debug_abbrev_section* debug_abbrev_;
// The output section containing the dwarf debug info tree
diff -rup binutils.orig/gold/options.h binutils-2.38/gold/options.h
--- binutils.orig/gold/options.h 2022-08-04 11:11:01.785495182 +0100
+++ binutils-2.38/gold/options.h 2022-08-04 11:12:26.125013949 +0100
@@ -1102,6 +1102,10 @@ class General_options
DEFINE_bool(p, options::ONE_DASH, 'p', false,
N_("Ignored for ARM compatibility"), NULL);
+ DEFINE_optional_string(package_metadata, options::TWO_DASHES, '\0', NULL,
+ N_("Generate package metadata note"),
+ N_("[=JSON]"));
+
DEFINE_bool(pie, options::ONE_DASH, '\0', false,
N_("Create a position independent executable"),
N_("Do not create a position independent executable"));
diff -rup binutils.orig/elfcpp/elfcpp.h binutils-2.38/elfcpp/elfcpp.h
--- binutils.orig/elfcpp/elfcpp.h 2022-08-04 11:11:00.940500003 +0100
+++ binutils-2.38/elfcpp/elfcpp.h 2022-08-04 11:12:26.124013955 +0100
@@ -999,7 +999,9 @@ enum
// string.
NT_GNU_GOLD_VERSION = 4,
// Program property note, as described in "Linux Extensions to the gABI".
- NT_GNU_PROPERTY_TYPE_0 = 5
+ NT_GNU_PROPERTY_TYPE_0 = 5,
+ // FDO .note.package notes as defined on https://systemd.io/ELF_PACKAGE_METADATA/
+ FDO_PACKAGING_METADATA = 0xcafe1a7e
};
// The OS values which may appear in word 0 of a NT_GNU_ABI_TAG note.

View File

@ -1,29 +0,0 @@
--- binutils.orig/binutils/readelf.c 2022-10-03 13:20:42.707527855 +0100
+++ binutils-2.39/binutils/readelf.c 2022-10-03 13:21:25.785436781 +0100
@@ -6357,6 +6357,13 @@ get_32bit_section_headers (Filedata * fi
/* PR binutils/17531: Cope with unexpected section header sizes. */
if (size == 0 || num == 0)
return false;
+
+ /* The section header cannot be at the start of the file - that is
+ where the ELF file header is located. A file with absolutely no
+ sections in it will use a shoff of 0. */
+ if (filedata->file_header.e_shoff == 0)
+ return false;
+
if (size < sizeof * shdrs)
{
if (! probe)
@@ -6421,6 +6428,12 @@ get_64bit_section_headers (Filedata * fi
if (size == 0 || num == 0)
return false;
+ /* The section header cannot be at the start of the file - that is
+ where the ELF file header is located. A file with absolutely no
+ sections in it will use a shoff of 0. */
+ if (filedata->file_header.e_shoff == 0)
+ return false;
+
if (size < sizeof * shdrs)
{
if (! probe)

View File

@ -123,82 +123,6 @@ diff -rup binutils.orig/ld/testsuite/ld-x86-64/pr20830b-now.d binutils-2.29.1/ld
0+18 0000000000000010 0000001c FDE cie=00000000 pc=0000000000000138..0000000000000144
DW_CFA_nop
DW_CFA_nop
diff -rup binutils.orig/ld/testsuite/ld-x86-64/pr21038a.d binutils-2.29.1/ld/testsuite/ld-x86-64/pr21038a.d
--- binutils.orig/ld/testsuite/ld-x86-64/pr21038a.d 2017-11-15 13:32:39.408064384 +0000
+++ binutils-2.29.1/ld/testsuite/ld-x86-64/pr21038a.d 2017-11-15 15:19:48.097433680 +0000
@@ -19,7 +19,8 @@ Contents of the .eh_frame section:
DW_CFA_offset: r16 \(rip\) at cfa-8
DW_CFA_nop
DW_CFA_nop
-
+#pass
+
0+18 0000000000000014 0000001c FDE cie=00000000 pc=00000000000001c8..00000000000001d4
DW_CFA_nop
DW_CFA_nop
diff -rup binutils.orig/ld/testsuite/ld-x86-64/pr21038a-now.d binutils-2.29.1/ld/testsuite/ld-x86-64/pr21038a-now.d
--- binutils.orig/ld/testsuite/ld-x86-64/pr21038a-now.d 2017-11-15 13:32:39.401064469 +0000
+++ binutils-2.29.1/ld/testsuite/ld-x86-64/pr21038a-now.d 2017-11-15 15:10:56.077760324 +0000
@@ -20,7 +20,8 @@ Contents of the .eh_frame section:
DW_CFA_offset: r16 \(rip\) at cfa-8
DW_CFA_nop
DW_CFA_nop
-
+#pass
+
0+18 0000000000000014 0000001c FDE cie=00000000 pc=00000000000001c8..00000000000001d4
DW_CFA_nop
DW_CFA_nop
diff -rup binutils.orig/ld/testsuite/ld-x86-64/pr21038b.d binutils-2.29.1/ld/testsuite/ld-x86-64/pr21038b.d
--- binutils.orig/ld/testsuite/ld-x86-64/pr21038b.d 2017-11-15 13:32:39.405064420 +0000
+++ binutils-2.29.1/ld/testsuite/ld-x86-64/pr21038b.d 2017-11-15 15:10:42.828916844 +0000
@@ -19,6 +19,7 @@ Contents of the .eh_frame section:
DW_CFA_offset: r16 \(rip\) at cfa-8
DW_CFA_nop
DW_CFA_nop
+#pass
0+18 0000000000000014 0000001c FDE cie=00000000 pc=00000000000001d8..00000000000001dd
DW_CFA_nop
diff -rup binutils.orig/ld/testsuite/ld-x86-64/pr21038b-now.d binutils-2.29.1/ld/testsuite/ld-x86-64/pr21038b-now.d
--- binutils.orig/ld/testsuite/ld-x86-64/pr21038b-now.d 2017-11-15 13:32:39.416064288 +0000
+++ binutils-2.29.1/ld/testsuite/ld-x86-64/pr21038b-now.d 2017-11-15 15:11:11.550577531 +0000
@@ -20,7 +20,8 @@ Contents of the .eh_frame section:
DW_CFA_offset: r16 \(rip\) at cfa-8
DW_CFA_nop
DW_CFA_nop
-
+#pass
+
0+18 0000000000000014 0000001c FDE cie=00000000 pc=00000000000001d8..00000000000001dd
DW_CFA_nop
DW_CFA_nop
diff -rup binutils.orig/ld/testsuite/ld-x86-64/pr21038c.d binutils-2.29.1/ld/testsuite/ld-x86-64/pr21038c.d
--- binutils.orig/ld/testsuite/ld-x86-64/pr21038c.d 2017-11-15 13:32:39.411064348 +0000
+++ binutils-2.29.1/ld/testsuite/ld-x86-64/pr21038c.d 2017-11-15 15:09:52.664509478 +0000
@@ -19,7 +19,8 @@ Contents of the .eh_frame section:
DW_CFA_offset: r16 \(rip\) at cfa-8
DW_CFA_nop
DW_CFA_nop
-
+#pass
+
0+18 0000000000000014 0000001c FDE cie=00000000 pc=0000000000000220..0000000000000231
DW_CFA_nop
DW_CFA_nop
diff -rup binutils.orig/ld/testsuite/ld-x86-64/pr21038c-now.d binutils-2.29.1/ld/testsuite/ld-x86-64/pr21038c-now.d
--- binutils.orig/ld/testsuite/ld-x86-64/pr21038c-now.d 2017-11-15 13:32:39.413064324 +0000
+++ binutils-2.29.1/ld/testsuite/ld-x86-64/pr21038c-now.d 2017-11-15 15:11:22.975442559 +0000
@@ -20,7 +20,8 @@ Contents of the .eh_frame section:
DW_CFA_offset: r16 \(rip\) at cfa-8
DW_CFA_nop
DW_CFA_nop
-
+#pass
+
0+18 0000000000000014 0000001c FDE cie=00000000 pc=0000000000000220..0000000000000231
DW_CFA_nop
DW_CFA_nop
diff -rup binutils.orig/ld/testsuite/ld-x86-64/tlspic2.rd binutils-2.29.1/ld/testsuite/ld-x86-64/tlspic2.rd
--- binutils.orig/ld/testsuite/ld-x86-64/tlspic2.rd 2017-11-15 13:32:39.417064276 +0000
+++ binutils-2.29.1/ld/testsuite/ld-x86-64/tlspic2.rd 2017-11-15 15:05:02.950932110 +0000

File diff suppressed because it is too large Load Diff

View File

@ -1,8 +1,8 @@
Summary: A GNU collection of binary utilities
Name: binutils%{?_with_debug:-debug}
Version: 2.39
Release: 10%{?dist}
Version: 2.40
Release: 1%{?dist}
License: GPLv3+
URL: https://sourceware.org/binutils
@ -235,57 +235,33 @@ Patch12: binutils-gold-mismatched-section-flags.patch
# Lifetime: Permanent.
Patch13: binutils-gold-warn-unsupported.patch
# Purpose: Fix testsuite failures due to the patches applied here.
# Lifetime: Permanent, but varying with each new rebase.
Patch14: binutils-testsuite-fixes.patch
# Purpose: Enable the creation of .note.gnu.property sections by the GOLD
# linker for x86 binaries.
# Lifetime: Fixed in 2.38 maybe
Patch15: binutils-gold-i386-gnu-property-notes.patch
# Lifetime: Permanent.
Patch14: binutils-gold-i386-gnu-property-notes.patch
# Purpose: Allow the binutils to be configured with any (recent) version of
# autoconf.
# Lifetime: Fixed in 2.39 (maybe ?)
Patch16: binutils-autoconf-version.patch
Patch15: binutils-autoconf-version.patch
# Purpose: Stop libtool from inserting useless runpaths into binaries.
# Lifetime: Who knows.
Patch17: binutils-libtool-no-rpath.patch
Patch16: binutils-libtool-no-rpath.patch
%if %{enable_new_dtags}
# Purpose: Change ld man page so that it says that --enable-new-dtags is the default.
# Lifetime: Permanent
Patch18: binutils-update-linker-manual.patch
Patch17: binutils-update-linker-manual.patch
%endif
# Purpose: Add a --package-metadata option to the linkers.
# Lifetime: Fixed in 2.40
Patch19: binutils-package-metadata.patch
# Purpose: Stop the assembler from generating DIE information for zero-sized functions.
# Lifetime: Fixed in 2.40
Patch20: binutils-gas-dwarf-skip-empty-functions.patch
# Purpose: Stop an infinite loop in the binutils DWARF decoder. (CVE 2022-38128)
# Lifetime: Fixed in 2.40
Patch21: binutils-CVE-38128-dwarf-abbrev-parsing.patch
# Purpose: Stop readelf from incorrectly decoding ELF files with no sections.
# Lifetime: Fixed in 2.40
Patch22: binutils-readelf-no-sections.patch
# Purpose: Stop compile time warnings from configure test files in the libiberty directory.
# Lifetime: Fixed in 2.40
Patch23: binutils-libiberty-configure-compile-warnings.patch
# Purpose: Fix a potential reference of a NULL pointer.
# Lifetime: Fixed in 2.40
Patch24: binutils-CVE-2022-4285.patch
# Purpose: Speed up objcopy's note merging algorithm.
# Lifetime: Fixed in 2.41
Patch25: binutils-objcopy-note-merge-speedup.patch
Patch18: binutils-objcopy-note-merge-speedup.patch
# # Purpose: Fix testsuite failures due to the patches applied here.
# # Lifetime: Permanent, but varying with each new rebase.
Patch19: binutils-testsuite-fixes.patch
#----------------------------------------------------------------------------
@ -788,8 +764,13 @@ run_tests()
pushd build-$target
if test x$native == x1 ; then
make -k check < /dev/null || :
make -k check-gas check-binutils check-ld < /dev/null
%if %{with gold}
# The GOLD testsuite always returns an error code, even if no tests fail.
make -k check-gold < /dev/null || :
%endif
else
# Do not try running linking tests for the cross-binutils.
make -k check-gas check-binutils < /dev/null || :
fi
@ -1146,6 +1127,7 @@ exit 0
%{_infodir}/ld.info.*
%{_infodir}/bfd.info.*
%{_infodir}/ctf-spec.info.*
%{_infodir}/sframe-spec.info.*
%exclude %{_infodir}/gprofng*
%endif
@ -1217,6 +1199,15 @@ exit 0
#----------------------------------------------------------------------------
%changelog
* Mon Feb 13 2023 Nick Clifton <nickc@redhat.com> - 2.40-1
- Rebase to 2.40.
- Retire: binutils-package-metadata.patch
- Retire: binutils-gas-dwarf-skip-empty-functions.patch
- Retire: binutils-CVE-38128-dwarf-abbrev-parsing.patch
- Retire: binutils-readelf-no-sections.patch
- Retire: binutils-libiberty-configure-compile-warnings.patch
- Retire: binutils-CVE-2022-4285.patch
* Tue Jan 31 2023 Nick Clifton <nickc@redhat.com> - 2.39-10
- Spec File: Add (disabled by default) support for cross-builds of the binutils.

View File

@ -1,2 +1 @@
SHA512 (binutils-2.39.tar.xz) = 68e038f339a8c21faa19a57bbc447a51c817f47c2e06d740847c6e9cc3396c025d35d5369fa8c3f8b70414757c89f0e577939ddc0d70f283182504920f53b0a3
SHA512 (binutils-2.19.50.0.1-output-format.sed) = 2f8686b0c8af13c98cda056824c2820416f6e2d003f70b78ccf5314525b9ee3684d421dfa83e638a2d42d06ea4d4bdaf5226b64d6ec26f7ff59c44ffb2a23dd2
SHA512 (binutils-2.40.tar.xz) = a37e042523bc46494d99d5637c3f3d8f9956d9477b748b3b1f6d7dfbb8d968ed52c932e88a4e946c6f77b8f48f1e1b360ca54c3d298f17193f3b4963472f6925