diff --git a/binutils-config.patch b/binutils-config.patch new file mode 100644 index 0000000..8456584 --- /dev/null +++ b/binutils-config.patch @@ -0,0 +1,44 @@ +diff -Nrup a/libiberty/aclocal.m4 b/libiberty/aclocal.m4 +--- a/libiberty/aclocal.m4 2019-01-19 09:01:34.000000000 -0700 ++++ b/libiberty/aclocal.m4 2020-01-09 22:00:27.183312982 -0700 +@@ -147,7 +147,7 @@ if test $ac_cv_os_cray = yes; then + fi + + AC_CACHE_CHECK(stack direction for C alloca, ac_cv_c_stack_direction, +-[AC_TRY_RUN([find_stack_direction () ++[AC_TRY_RUN([__attribute__ ((noclone,noinline)) find_stack_direction () + { + static char *addr = 0; + auto char dummy; +diff --git a/config/intdiv0.m4 b/config/intdiv0.m4 +index 55dddcf1..ba906efc 100644 +--- a/config/intdiv0.m4 ++++ b/config/intdiv0.m4 +@@ -31,10 +31,10 @@ sigfpe_handler (sig) int sig; + exit (sig != SIGFPE); + } + +-int x = 1; +-int y = 0; +-int z; +-int nan; ++volatile int x = 1; ++volatile int y = 0; ++volatile int z; ++volatile int nan; + + int main () + { +diff --git a/libiberty/configure.ac b/libiberty/configure.ac +index f1ce7601..fc20d228 100644 +--- a/libiberty/configure.ac ++++ b/libiberty/configure.ac +@@ -661,7 +661,7 @@ if test -z "${setobjs}"; then + for v in $vars; do + AC_MSG_CHECKING([for $v]) + AC_CACHE_VAL(libiberty_cv_var_$v, +- [AC_LINK_IFELSE([AC_LANG_PROGRAM([[int *p;]],[[extern int $v []; p = $v;]])], ++ [AC_LINK_IFELSE([AC_LANG_PROGRAM([[__attribute__ ((used)) int *p;]],[[extern int $v []; p = $v;]])], + [eval "libiberty_cv_var_$v=yes"], + [eval "libiberty_cv_var_$v=no"])]) + if eval "test \"`echo '$libiberty_cv_var_'$v`\" = yes"; then diff --git a/binutils-warnings.patch b/binutils-warnings.patch new file mode 100644 index 0000000..d75d0c4 --- /dev/null +++ b/binutils-warnings.patch @@ -0,0 +1,171 @@ +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/gold/target-reloc.h b/gold/target-reloc.h +index 071f211e..0f81dd13 100644 +--- a/gold/target-reloc.h ++++ b/gold/target-reloc.h +@@ -259,7 +259,7 @@ issue_discarded_error( + &is_ordinary); + if (orig_shndx != elfcpp::SHN_UNDEF) + { +- unsigned int key_symndx; ++ unsigned int key_symndx = 0; + Relobj* kept_obj = object->find_kept_section_object(orig_shndx, + &key_symndx); + if (key_symndx != 0) +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) diff --git a/cross-binutils.spec b/cross-binutils.spec index d10306b..f072a95 100644 --- a/cross-binutils.spec +++ b/cross-binutils.spec @@ -65,7 +65,7 @@ Summary: A GNU collection of cross-compilation binary utilities Name: %{cross}-binutils Version: 2.34 -Release: 2%{?dist} +Release: 3%{?dist} License: GPLv3+ URL: https://sourceware.org/binutils @@ -177,6 +177,8 @@ Patch15: binutils-CVE-2019-1010204.patch # Lifetime: Fixed in 2.35 Patch16: binutils-nm-lto-plugin.patch +Patch20: binutils-config.patch +Patch21: binutils-warnings.patch #---------------------------------------------------------------------------- BuildRequires: texinfo >= 4.0, gettext, flex, bison, zlib-devel @@ -185,6 +187,7 @@ BuildRequires: /usr/bin/pod2man # Perl, sed and touch are all used in the %prep section of this spec file. BuildRequires: gcc, perl, sed, coreutils BuildRequires: findutils +BuildRequires: autoconf automake Provides: bundled(libiberty) @@ -299,6 +302,9 @@ cd %{srcdir} %patch15 -p1 %patch16 -p1 +%patch20 -p1 +%patch21 -p1 + # We cannot run autotools as there is an exact requirement of autoconf-2.59. # On ppc64 and aarch64, we might use 64KiB pages @@ -516,6 +522,16 @@ function config_target () { cd .. } +# Dependencies are not set up to rebuild the configure files +# in the subdirectories. So we just rebuild the ones we care +# about after applying the configure patches +pushd %{srcdir}/libiberty +autoconf +popd +pushd %{srcdir}/intl +autoconf +popd + for target in `cat target.list` do config_target $target @@ -768,6 +784,10 @@ cd - %do_files xtensa-linux-gnu %{build_xtensa} %changelog +* Mon Jul 20 2020 Jeff Law - 2.34-3 +- Fix configure tests compromised by LTO +- Work around diagnostics exposed by LTO + * Thu Feb 27 2020 Peter Robinson - 2.34-2 - Fix the plugin support architecture to allow proper symbol info handling. (PR 25355)