diff options
Diffstat (limited to 'packages/binutils/2.31.1')
14 files changed, 872 insertions, 0 deletions
diff --git a/packages/binutils/2.31.1/0000-sh-conf.patch b/packages/binutils/2.31.1/0000-sh-conf.patch new file mode 100644 index 0000000..f4fb760 --- /dev/null +++ b/packages/binutils/2.31.1/0000-sh-conf.patch @@ -0,0 +1,34 @@ +r10231 | lethal | 2005-05-02 09:58:00 -0400 (Mon, 02 May 2005) | 13 lines + +Likewise, binutils has no idea about any of these new targets either, so we +fix that up too.. now we're able to actually build a real toolchain for +sh2a_nofpu- and other more ineptly named toolchains (and yes, there are more +inept targets than that one, really. Go look, I promise). + +--- + configure | 2 +- + configure.ac | 2 +- + 2 files changed, 2 insertions(+), 2 deletions(-) + +--- a/configure ++++ b/configure +@@ -3855,7 +3855,7 @@ + nvptx*-*-*) + noconfigdirs="$noconfigdirs target-libssp target-libstdc++-v3 target-libobjc" + ;; +- sh-*-*) ++ sh*-*-*) + case "${target}" in + sh*-*-elf) + ;; +--- a/configure.ac ++++ b/configure.ac +@@ -1152,7 +1152,7 @@ + nvptx*-*-*) + noconfigdirs="$noconfigdirs target-libssp target-libstdc++-v3 target-libobjc" + ;; +- sh-*-*) ++ sh*-*-*) + case "${target}" in + sh*-*-elf) + ;; diff --git a/packages/binutils/2.31.1/0001-ld_makefile_patch.patch b/packages/binutils/2.31.1/0001-ld_makefile_patch.patch new file mode 100644 index 0000000..f73ff26 --- /dev/null +++ b/packages/binutils/2.31.1/0001-ld_makefile_patch.patch @@ -0,0 +1,27 @@ +--- + ld/Makefile.am | 2 +- + ld/Makefile.in | 2 +- + 2 files changed, 2 insertions(+), 2 deletions(-) + +--- a/ld/Makefile.am ++++ b/ld/Makefile.am +@@ -57,7 +57,7 @@ + # We put the scripts in the directory $(scriptdir)/ldscripts. + # We can't put the scripts in $(datadir) because the SEARCH_DIR + # directives need to be different for native and cross linkers. +-scriptdir = $(tooldir)/lib ++scriptdir = $(libdir) + + EMUL = @EMUL@ + EMULATION_OFILES = @EMULATION_OFILES@ +--- a/ld/Makefile.in ++++ b/ld/Makefile.in +@@ -563,7 +563,7 @@ + # We put the scripts in the directory $(scriptdir)/ldscripts. + # We can't put the scripts in $(datadir) because the SEARCH_DIR + # directives need to be different for native and cross linkers. +-scriptdir = $(tooldir)/lib ++scriptdir = $(libdir) + BASEDIR = $(srcdir)/.. + BFDDIR = $(BASEDIR)/bfd + INCDIR = $(BASEDIR)/include diff --git a/packages/binutils/2.31.1/0002-check_ldrunpath_length.patch b/packages/binutils/2.31.1/0002-check_ldrunpath_length.patch new file mode 100644 index 0000000..c0803d6 --- /dev/null +++ b/packages/binutils/2.31.1/0002-check_ldrunpath_length.patch @@ -0,0 +1,24 @@ +--- + ld/emultempl/elf32.em | 4 ++++ + 1 file changed, 4 insertions(+) + +--- a/ld/emultempl/elf32.em ++++ b/ld/emultempl/elf32.em +@@ -1471,6 +1471,8 @@ + && command_line.rpath == NULL) + { + path = (const char *) getenv ("LD_RUN_PATH"); ++ if ((path) && (strlen (path) == 0)) ++ path = NULL; + if (path + && gld${EMULATION_NAME}_search_needed (path, &n, force)) + break; +@@ -1751,6 +1753,8 @@ + rpath = command_line.rpath; + if (rpath == NULL) + rpath = (const char *) getenv ("LD_RUN_PATH"); ++ if ((rpath) && (*rpath == '\0')) ++ rpath = NULL; + + for (abfd = link_info.input_bfds; abfd; abfd = abfd->link.next) + if (bfd_get_flavour (abfd) == bfd_target_elf_flavour) diff --git a/packages/binutils/2.31.1/0003-MinGW-w64-winpthreads-doesnt-have-pthread_mutexattr_settype.patch b/packages/binutils/2.31.1/0003-MinGW-w64-winpthreads-doesnt-have-pthread_mutexattr_settype.patch new file mode 100644 index 0000000..99dee96 --- /dev/null +++ b/packages/binutils/2.31.1/0003-MinGW-w64-winpthreads-doesnt-have-pthread_mutexattr_settype.patch @@ -0,0 +1,15 @@ +--- + gold/gold-threads.cc | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/gold/gold-threads.cc ++++ b/gold/gold-threads.cc +@@ -101,7 +101,7 @@ + int err = pthread_mutexattr_init(&attr); + if (err != 0) + gold_fatal(_("pthead_mutexattr_init failed: %s"), strerror(err)); +-#ifdef PTHREAD_MUTEX_ADAPTIVE_NP ++#if defined(PTHREAD_MUTEX_ADAPTIVE_NP) && !defined(_WIN32) + err = pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_ADAPTIVE_NP); + if (err != 0) + gold_fatal(_("pthread_mutexattr_settype failed: %s"), strerror(err)); diff --git a/packages/binutils/2.31.1/0004-Dont-link-to-libfl-as-its-unnecessary.patch b/packages/binutils/2.31.1/0004-Dont-link-to-libfl-as-its-unnecessary.patch new file mode 100644 index 0000000..9e9138b --- /dev/null +++ b/packages/binutils/2.31.1/0004-Dont-link-to-libfl-as-its-unnecessary.patch @@ -0,0 +1,105 @@ +--- + binutils/configure | 3 +++ + binutils/configure.ac | 3 +++ + gas/configure | 3 +++ + gas/configure.ac | 3 +++ + ld/configure | 3 +++ + ld/configure.ac | 3 +++ + 6 files changed, 18 insertions(+) + +--- a/binutils/configure ++++ b/binutils/configure +@@ -12445,6 +12445,7 @@ + done + test -n "$YACC" || YACC="yacc" + ++save_LIBS=$LIBS + for ac_prog in flex lex + do + # Extract the first word of "$ac_prog", so it can be a program name with args. +@@ -12608,6 +12609,8 @@ + if test "$LEX" = :; then + LEX=${am_missing_run}flex + fi ++LIBS=$save_LIBS ++LEXLIB= + + ALL_LINGUAS="bg ca da es fi fr hr id it ja pt ro ru rw sk sr sv tr uk vi zh_CN zh_TW" + # If we haven't got the data from the intl directory, +--- a/binutils/configure.ac ++++ b/binutils/configure.ac +@@ -86,7 +86,10 @@ + fi + + AC_PROG_YACC ++save_LIBS=$LIBS + AM_PROG_LEX ++LIBS=$save_LIBS ++LEXLIB= + + ALL_LINGUAS="bg ca da es fi fr hr id it ja pt ro ru rw sk sr sv tr uk vi zh_CN zh_TW" + ZW_GNU_GETTEXT_SISTER_DIR +--- a/gas/configure ++++ b/gas/configure +@@ -13344,6 +13344,7 @@ + done + test -n "$YACC" || YACC="yacc" + ++save_LIBS=$LIBS + for ac_prog in flex lex + do + # Extract the first word of "$ac_prog", so it can be a program name with args. +@@ -13507,6 +13508,8 @@ + if test "$LEX" = :; then + LEX=${am_missing_run}flex + fi ++LIBS=$save_LIBS ++LEXLIB= + + ALL_LINGUAS="es fi fr id ja ru rw sv tr uk zh_CN" + # If we haven't got the data from the intl directory, +--- a/gas/configure.ac ++++ b/gas/configure.ac +@@ -795,7 +795,10 @@ + AC_DEFINE_UNQUOTED(TARGET_OS, "${target_os}", [Target OS.]) + + AC_PROG_YACC ++save_LIBS=$LIBS + AM_PROG_LEX ++LIBS=$save_LIBS ++LEXLIB= + + ALL_LINGUAS="es fi fr id ja ru rw sv tr uk zh_CN" + ZW_GNU_GETTEXT_SISTER_DIR +--- a/ld/configure ++++ b/ld/configure +@@ -16536,6 +16536,7 @@ + done + test -n "$YACC" || YACC="yacc" + ++save_LIBS=$LIBS + for ac_prog in flex lex + do + # Extract the first word of "$ac_prog", so it can be a program name with args. +@@ -16699,6 +16700,8 @@ + if test "$LEX" = :; then + LEX=${am_missing_run}flex + fi ++LIBS=$save_LIBS ++LEXLIB= + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to enable maintainer-specific portions of Makefiles" >&5 +--- a/ld/configure.ac ++++ b/ld/configure.ac +@@ -243,7 +243,10 @@ + AC_EXEEXT + + AC_PROG_YACC ++save_LIBS=$LIBS + AM_PROG_LEX ++LIBS=$save_LIBS ++LEXLIB= + + AM_MAINTAINER_MODE + AM_CONDITIONAL(GENINSRC_NEVER, false) diff --git a/packages/binutils/2.31.1/0005-Darwin-gold-binary-cc-include-string-not-cstring.patch b/packages/binutils/2.31.1/0005-Darwin-gold-binary-cc-include-string-not-cstring.patch new file mode 100644 index 0000000..fbc4041 --- /dev/null +++ b/packages/binutils/2.31.1/0005-Darwin-gold-binary-cc-include-string-not-cstring.patch @@ -0,0 +1,15 @@ +--- + gold/binary.cc | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/gold/binary.cc ++++ b/gold/binary.cc +@@ -23,7 +23,7 @@ + #include "gold.h" + + #include <cerrno> +-#include <cstring> ++#include <string> + + #include "elfcpp.h" + #include "stringpool.h" diff --git a/packages/binutils/2.31.1/0006-Darwin-Two-fixes-from-Android-NDK-PTHREAD_ONCE_INIT-wcsncasecmp.patch b/packages/binutils/2.31.1/0006-Darwin-Two-fixes-from-Android-NDK-PTHREAD_ONCE_INIT-wcsncasecmp.patch new file mode 100644 index 0000000..8e71dbb --- /dev/null +++ b/packages/binutils/2.31.1/0006-Darwin-Two-fixes-from-Android-NDK-PTHREAD_ONCE_INIT-wcsncasecmp.patch @@ -0,0 +1,70 @@ +From c39479f4ab4d372b518957871e1f205a03e7c3d6 Mon Sep 17 00:00:00 2001 +From: Andrew Hsieh <andrewhsieh@google.com> +Date: Wed, 18 Mar 2015 10:57:24 +0800 +Subject: [PATCH] Fix darwin build + +1. In Drawin PTHREAD_ONCE_INIT is {0x30B1BCBA, {0}} and the GCC < 4.4 + doesn't support ended initializer list +2. wcsncasecmp doesn't exist in MacSDK10.6.x + +Change-Id: I69204a72f853f5263dffedc448379d75ed4eca2e +--- + bfd/peXXigen.c | 22 ++++++++++++++++++++++ + gold/gold-threads.cc | 15 ++++++++++++--- + 2 files changed, 34 insertions(+), 3 deletions(-) + +--- a/bfd/peXXigen.c ++++ b/bfd/peXXigen.c +@@ -3621,6 +3621,28 @@ + } + #endif /* HAVE_WCHAR_H and not Cygwin/Mingw */ + ++#if defined __APPLE__ && __DARWIN_C_LEVEL < 200809L ++/* wcsncasecmp isn't always defined in Mac SDK */ ++static int ++wcsncasecmp(const wchar_t *s1, const wchar_t *s2, size_t n) ++{ ++ wchar_t c1, c2; ++ ++ if (n == 0) ++ return (0); ++ for (; *s1; s1++, s2++) ++ { ++ c1 = towlower(*s1); ++ c2 = towlower(*s2); ++ if (c1 != c2) ++ return ((int)c1 - c2); ++ if (--n == 0) ++ return (0); ++ } ++ return (-*s2); ++} ++#endif ++ + /* Perform a comparison of two entries. */ + static signed int + rsrc_cmp (bfd_boolean is_name, rsrc_entry * a, rsrc_entry * b) +--- a/gold/gold-threads.cc ++++ b/gold/gold-threads.cc +@@ -284,9 +284,18 @@ + class Once_initialize + { + public: +- Once_initialize() +- : once_(PTHREAD_ONCE_INIT) +- { } ++ Once_initialize() ++#if !defined(__APPLE__) ++ : once_(PTHREAD_ONCE_INIT) ++ { } ++#else ++// In Drawin PTHREAD_ONCE_INIT is {0x30B1BCBA, {0}} and the GCC < 4.4 doesn't support ++// extended initializer list as above */ ++ { ++ pthread_once_t once_2 = PTHREAD_ONCE_INIT; ++ once_ = once_2; ++ } ++#endif + + // Return a pointer to the pthread_once_t variable. + pthread_once_t* diff --git a/packages/binutils/2.31.1/0007-sysroot.patch b/packages/binutils/2.31.1/0007-sysroot.patch new file mode 100644 index 0000000..ba7940a --- /dev/null +++ b/packages/binutils/2.31.1/0007-sysroot.patch @@ -0,0 +1,41 @@ +Signed-off-by: Sven Rebhan <odinshorse@googlemail.com> + +Always try to prepend the sysroot prefix to absolute filenames first. + +http://bugs.gentoo.org/275666 +http://sourceware.org/bugzilla/show_bug.cgi?id=10340 + +--- + ld/ldfile.c | 11 +++++++++-- + 1 file changed, 9 insertions(+), 2 deletions(-) + +--- a/ld/ldfile.c ++++ b/ld/ldfile.c +@@ -338,18 +338,25 @@ + directory first. */ + if (!entry->flags.maybe_archive) + { +- if (entry->flags.sysrooted && IS_ABSOLUTE_PATH (entry->filename)) ++ /* For absolute pathnames, try to always open the file in the ++ sysroot first. If this fails, try to open the file at the ++ given location. */ ++ entry->flags.sysrooted = is_sysrooted_pathname (entry->filename); ++ if (!entry->flags.sysrooted && IS_ABSOLUTE_PATH (entry->filename) ++ && ld_sysroot) + { + char *name = concat (ld_sysroot, entry->filename, + (const char *) NULL); + if (ldfile_try_open_bfd (name, entry)) + { + entry->filename = name; ++ entry->flags.sysrooted = TRUE; + return TRUE; + } + free (name); + } +- else if (ldfile_try_open_bfd (entry->filename, entry)) ++ ++ if (ldfile_try_open_bfd (entry->filename, entry)) + return TRUE; + + if (IS_ABSOLUTE_PATH (entry->filename)) diff --git a/packages/binutils/2.31.1/0008-poison-system-directories.patch b/packages/binutils/2.31.1/0008-poison-system-directories.patch new file mode 100644 index 0000000..0a8079f --- /dev/null +++ b/packages/binutils/2.31.1/0008-poison-system-directories.patch @@ -0,0 +1,279 @@ +Patch adapted to binutils 2.23.2 and extended to use +BR_COMPILER_PARANOID_UNSAFE_PATH by Thomas Petazzoni. + +[Gustavo: adapt to binutils 2.25] +Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com> +Signed-off-by: Gustavo Zacarias <gustavo@zacarias.com.ar> + +Upstream-Status: Inappropriate [distribution: codesourcery] + +Patch originally created by Mark Hatle, forward-ported to +binutils 2.21 by Scott Garman. + +purpose: warn for uses of system directories when cross linking + +Code Merged from Sourcery G++ binutils 2.19 - 4.4-277 + +2008-07-02 Joseph Myers <joseph@codesourcery.com> + + ld/ + * ld.h (args_type): Add error_poison_system_directories. + * ld.texinfo (--error-poison-system-directories): Document. + * ldfile.c (ldfile_add_library_path): Check + command_line.error_poison_system_directories. + * ldmain.c (main): Initialize + command_line.error_poison_system_directories. + * lexsup.c (enum option_values): Add + OPTION_ERROR_POISON_SYSTEM_DIRECTORIES. + (ld_options): Add --error-poison-system-directories. + (parse_args): Handle new option. + +2007-06-13 Joseph Myers <joseph@codesourcery.com> + + ld/ + * config.in: Regenerate. + * ld.h (args_type): Add poison_system_directories. + * ld.texinfo (--no-poison-system-directories): Document. + * ldfile.c (ldfile_add_library_path): Check + command_line.poison_system_directories. + * ldmain.c (main): Initialize + command_line.poison_system_directories. + * lexsup.c (enum option_values): Add + OPTION_NO_POISON_SYSTEM_DIRECTORIES. + (ld_options): Add --no-poison-system-directories. + (parse_args): Handle new option. + +2007-04-20 Joseph Myers <joseph@codesourcery.com> + + Merge from Sourcery G++ binutils 2.17: + + 2007-03-20 Joseph Myers <joseph@codesourcery.com> + Based on patch by Mark Hatle <mark.hatle@windriver.com>. + ld/ + * configure.ac (--enable-poison-system-directories): New option. + * configure, config.in: Regenerate. + * ldfile.c (ldfile_add_library_path): If + ENABLE_POISON_SYSTEM_DIRECTORIES defined, warn for use of /lib, + /usr/lib, /usr/local/lib or /usr/X11R6/lib. + +Signed-off-by: Mark Hatle <mark.hatle@windriver.com> +Signed-off-by: Scott Garman <scott.a.garman@intel.com> + +--- + ld/config.in | 3 +++ + ld/configure | 14 ++++++++++++++ + ld/configure.ac | 10 ++++++++++ + ld/ld.h | 8 ++++++++ + ld/ld.texi | 12 ++++++++++++ + ld/ldfile.c | 17 +++++++++++++++++ + ld/ldlex.h | 2 ++ + ld/ldmain.c | 2 ++ + ld/lexsup.c | 21 +++++++++++++++++++++ + 9 files changed, 89 insertions(+) + +--- a/ld/config.in ++++ b/ld/config.in +@@ -31,6 +31,9 @@ + language is requested. */ + #undef ENABLE_NLS + ++/* Define to warn for use of native system library directories */ ++#undef ENABLE_POISON_SYSTEM_DIRECTORIES ++ + /* Additional extension a shared object might have. */ + #undef EXTRA_SHLIB_EXTENSION + +--- a/ld/configure ++++ b/ld/configure +@@ -822,6 +822,7 @@ + enable_targets + enable_64_bit_bfd + with_sysroot ++enable_poison_system_directories + enable_gold + enable_got + enable_compressed_debug_sections +@@ -1486,6 +1487,8 @@ + --disable-largefile omit support for large files + --enable-targets alternative target configurations + --enable-64-bit-bfd 64-bit support (on hosts with narrower word sizes) ++ --enable-poison-system-directories ++ warn for use of native system library directories + --enable-gold[=ARG] build gold [ARG={default,yes,no}] + --enable-got=<type> GOT handling scheme (target, single, negative, + multigot) +@@ -15803,7 +15806,18 @@ + fi + + ++# Check whether --enable-poison-system-directories was given. ++if test "${enable_poison_system_directories+set}" = set; then : ++ enableval=$enable_poison_system_directories; ++else ++ enable_poison_system_directories=no ++fi ++ ++if test "x${enable_poison_system_directories}" = "xyes"; then + ++$as_echo "#define ENABLE_POISON_SYSTEM_DIRECTORIES 1" >>confdefs.h ++ ++fi + + # Check whether --enable-got was given. + if test "${enable_got+set}" = set; then : +--- a/ld/configure.ac ++++ b/ld/configure.ac +@@ -94,6 +94,16 @@ + AC_SUBST(TARGET_SYSTEM_ROOT) + AC_SUBST(TARGET_SYSTEM_ROOT_DEFINE) + ++AC_ARG_ENABLE([poison-system-directories], ++ AS_HELP_STRING([--enable-poison-system-directories], ++ [warn for use of native system library directories]),, ++ [enable_poison_system_directories=no]) ++if test "x${enable_poison_system_directories}" = "xyes"; then ++ AC_DEFINE([ENABLE_POISON_SYSTEM_DIRECTORIES], ++ [1], ++ [Define to warn for use of native system library directories]) ++fi ++ + dnl Use --enable-gold to decide if this linker should be the default. + dnl "install_as_default" is set to false if gold is the default linker. + dnl "installed_linker" is the installed BFD linker name. +--- a/ld/ld.h ++++ b/ld/ld.h +@@ -175,6 +175,14 @@ + /* If set, display the target memory usage (per memory region). */ + bfd_boolean print_memory_usage; + ++ /* If TRUE (the default) warn for uses of system directories when ++ cross linking. */ ++ bfd_boolean poison_system_directories; ++ ++ /* If TRUE (default FALSE) give an error for uses of system ++ directories when cross linking instead of a warning. */ ++ bfd_boolean error_poison_system_directories; ++ + /* Should we force section groups to be resolved? Controlled with + --force-group-allocation on the command line or FORCE_GROUP_ALLOCATION + in the linker script. */ +--- a/ld/ld.texi ++++ b/ld/ld.texi +@@ -2479,6 +2479,18 @@ + + Passing @code{none} for @var{style} disables the setting from any + @code{--build-id} options earlier on the command line. ++ ++@kindex --no-poison-system-directories ++@item --no-poison-system-directories ++Do not warn for @option{-L} options using system directories such as ++@file{/usr/lib} when cross linking. This option is intended for use ++in chroot environments when such directories contain the correct ++libraries for the target system rather than the host. ++ ++@kindex --error-poison-system-directories ++@item --error-poison-system-directories ++Give an error instead of a warning for @option{-L} options using ++system directories when cross linking. + @end table + + @c man end +--- a/ld/ldfile.c ++++ b/ld/ldfile.c +@@ -116,6 +116,23 @@ + new_dirs->name = concat (ld_sysroot, name + strlen ("$SYSROOT"), (const char *) NULL); + else + new_dirs->name = xstrdup (name); ++ ++#ifdef ENABLE_POISON_SYSTEM_DIRECTORIES ++ if (command_line.poison_system_directories ++ && ((!strncmp (name, "/lib", 4)) ++ || (!strncmp (name, "/usr/lib", 8)) ++ || (!strncmp (name, "/usr/local/lib", 14)) ++ || (!strncmp (name, "/usr/X11R6/lib", 14)))) ++ { ++ if (command_line.error_poison_system_directories) ++ einfo (_("%X%P: error: library search path \"%s\" is unsafe for " ++ "cross-compilation\n"), name); ++ else ++ einfo (_("%P: warning: library search path \"%s\" is unsafe for " ++ "cross-compilation\n"), name); ++ } ++#endif ++ + } + + /* Try to open a BFD for a lang_input_statement. */ +--- a/ld/ldlex.h ++++ b/ld/ldlex.h +@@ -148,6 +148,8 @@ + OPTION_REQUIRE_DEFINED_SYMBOL, + OPTION_ORPHAN_HANDLING, + OPTION_FORCE_GROUP_ALLOCATION, ++ OPTION_NO_POISON_SYSTEM_DIRECTORIES, ++ OPTION_ERROR_POISON_SYSTEM_DIRECTORIES, + }; + + /* The initial parser states. */ +--- a/ld/ldmain.c ++++ b/ld/ldmain.c +@@ -268,6 +268,8 @@ + command_line.warn_mismatch = TRUE; + command_line.warn_search_mismatch = TRUE; + command_line.check_section_addresses = -1; ++ command_line.poison_system_directories = TRUE; ++ command_line.error_poison_system_directories = FALSE; + + /* We initialize DEMANGLING based on the environment variable + COLLECT_NO_DEMANGLE. The gcc collect2 program will demangle the +--- a/ld/lexsup.c ++++ b/ld/lexsup.c +@@ -543,6 +543,14 @@ + { {"orphan-handling", required_argument, NULL, OPTION_ORPHAN_HANDLING}, + '\0', N_("=MODE"), N_("Control how orphan sections are handled."), + TWO_DASHES }, ++ { {"no-poison-system-directories", no_argument, NULL, ++ OPTION_NO_POISON_SYSTEM_DIRECTORIES}, ++ '\0', NULL, N_("Do not warn for -L options using system directories"), ++ TWO_DASHES }, ++ { {"error-poison-system-directories", no_argument, NULL, ++ OPTION_ERROR_POISON_SYSTEM_DIRECTORIES}, ++ '\0', NULL, N_("Give an error for -L options using system directories"), ++ TWO_DASHES }, + }; + + #define OPTION_COUNT ARRAY_SIZE (ld_options) +@@ -555,6 +563,7 @@ + int ingroup = 0; + char *default_dirlist = NULL; + char *shortopts; ++ char *BR_paranoid_env; + struct option *longopts; + struct option *really_longopts; + int last_optind; +@@ -1543,6 +1552,14 @@ + } + break; + ++ case OPTION_NO_POISON_SYSTEM_DIRECTORIES: ++ command_line.poison_system_directories = FALSE; ++ break; ++ ++ case OPTION_ERROR_POISON_SYSTEM_DIRECTORIES: ++ command_line.error_poison_system_directories = TRUE; ++ break; ++ + case OPTION_PUSH_STATE: + input_flags.pushed = xmemdup (&input_flags, + sizeof (input_flags), +@@ -1586,6 +1603,10 @@ + command_line.soname = NULL; + } + ++ BR_paranoid_env = getenv("BR_COMPILER_PARANOID_UNSAFE_PATH"); ++ if (BR_paranoid_env && strlen(BR_paranoid_env) > 0) ++ command_line.error_poison_system_directories = TRUE; ++ + while (ingroup) + { + lang_leave_group (); diff --git a/packages/binutils/2.31.1/0009-xtensa-fix-relaxation-of-undefined-weak-references-i.patch b/packages/binutils/2.31.1/0009-xtensa-fix-relaxation-of-undefined-weak-references-i.patch new file mode 100644 index 0000000..2c70bd2 --- /dev/null +++ b/packages/binutils/2.31.1/0009-xtensa-fix-relaxation-of-undefined-weak-references-i.patch @@ -0,0 +1,43 @@ +From 5d3a462f05cba5b0c0c96de899b84fb84155c760 Mon Sep 17 00:00:00 2001 +From: Max Filippov <jcmvbkbc@gmail.com> +Date: Sun, 22 Jul 2018 13:52:28 -0700 +Subject: [PATCH] xtensa: fix relaxation of undefined weak references in + shared objects + +The change c451bb34ae8b ("xtensa: don't emit dynamic relocation for weak +undefined symbol") didn't properly handle shrinking of relocation +sections due to coalescing of references to a dynamic undefined weak +symbol in a shared object, which resulted in the following assertion +failure in ld when linking uClibc-ng libthread_db for xtensa: + + BFD (GNU Binutils) 2.31 internal error, aborting at elf32-xtensa.c:3269 + in elf_xtensa_finish_dynamic_sections + +Shrink dynamic relocations section for dynamic undefined weak symbols +when linking a shared object. + +bfd/ +2018-07-23 Max Filippov <jcmvbkbc@gmail.com> + + * elf32-xtensa.c (shrink_dynamic_reloc_sections): Shrink dynamic + relocations section for dynamic undefined weak symbols when + linking a shared object. + +Signed-off-by: Max Filippov <jcmvbkbc@gmail.com> +Backported from: 5d3a462f05cba5b0c0c96de899b84fb84155c760 +--- + bfd/elf32-xtensa.c | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +--- a/bfd/elf32-xtensa.c ++++ b/bfd/elf32-xtensa.c +@@ -10022,7 +10022,8 @@ + if ((r_type == R_XTENSA_32 || r_type == R_XTENSA_PLT) + && (input_section->flags & SEC_ALLOC) != 0 + && (dynamic_symbol || bfd_link_pic (info)) +- && (!h || h->root.type != bfd_link_hash_undefweak)) ++ && (!h || h->root.type != bfd_link_hash_undefweak ++ || (dynamic_symbol && bfd_link_dll (info)))) + { + asection *srel; + bfd_boolean is_plt = FALSE; diff --git a/packages/binutils/2.31.1/0010-xtensa-move-dynamic-relocations-sections-consistency.patch b/packages/binutils/2.31.1/0010-xtensa-move-dynamic-relocations-sections-consistency.patch new file mode 100644 index 0000000..710d368 --- /dev/null +++ b/packages/binutils/2.31.1/0010-xtensa-move-dynamic-relocations-sections-consistency.patch @@ -0,0 +1,85 @@ +From f82863d797e461b936dff2b659a3aa65088ee87e Mon Sep 17 00:00:00 2001 +From: Max Filippov <jcmvbkbc@gmail.com> +Date: Sun, 22 Jul 2018 18:59:11 -0700 +Subject: [PATCH] xtensa: move dynamic relocations sections consistency + check + +The function elf_xtensa_finish_dynamic_sections checks that sizes of +sections .rela.dyn and .rela.plt match number of corresponding relocation +records, but the check is only done when .rela.plt is non-empty, so, e.g. +it is never run for the static PIE. +Rearrange the test so that .rela.dyn and .rela.plt are checked always. + +bfd/ +2018-07-23 Max Filippov <jcmvbkbc@gmail.com> + + * elf32-xtensa.c (elf_xtensa_finish_dynamic_sections): Move + relocation sections consistency check to always check both + .rela.dyn and .rela.plt when they exist. Rearrange variable + definition and assignment places. + +Signed-off-by: Max Filippov <jcmvbkbc@gmail.com> +Backported from: f82863d797e461b936dff2b659a3aa65088ee87e +--- + bfd/elf32-xtensa.c | 22 +++++++++++----------- + 1 file changed, 11 insertions(+), 11 deletions(-) + +--- a/bfd/elf32-xtensa.c ++++ b/bfd/elf32-xtensa.c +@@ -3156,7 +3156,7 @@ + { + struct elf_xtensa_link_hash_table *htab; + bfd *dynobj; +- asection *sdyn, *srelplt, *sgot, *sxtlit, *sgotloc; ++ asection *sdyn, *srelplt, *srelgot, *sgot, *sxtlit, *sgotloc; + Elf32_External_Dyn *dyncon, *dynconend; + int num_xtlit_entries = 0; + +@@ -3186,15 +3186,15 @@ + } + + srelplt = htab->elf.srelplt; ++ srelgot = htab->elf.srelgot; + if (srelplt && srelplt->size != 0) + { +- asection *sgotplt, *srelgot, *spltlittbl; ++ asection *sgotplt, *spltlittbl; + int chunk, plt_chunks, plt_entries; + Elf_Internal_Rela irela; + bfd_byte *loc; + unsigned rtld_reloc; + +- srelgot = htab->elf.srelgot; + spltlittbl = htab->spltlittbl; + BFD_ASSERT (srelgot != NULL && spltlittbl != NULL); + +@@ -3260,14 +3260,6 @@ + spltlittbl->contents + (chunk * 8) + 4); + } + +- /* All the dynamic relocations have been emitted at this point. +- Make sure the relocation sections are the correct size. */ +- if (srelgot->size != (sizeof (Elf32_External_Rela) +- * srelgot->reloc_count) +- || srelplt->size != (sizeof (Elf32_External_Rela) +- * srelplt->reloc_count)) +- abort (); +- + /* The .xt.lit.plt section has just been modified. This must + happen before the code below which combines adjacent literal + table entries, and the .xt.lit.plt contents have to be forced to +@@ -3282,6 +3274,14 @@ + spltlittbl->flags &= ~SEC_HAS_CONTENTS; + } + ++ /* All the dynamic relocations have been emitted at this point. ++ Make sure the relocation sections are the correct size. */ ++ if ((srelgot && srelgot->size != (sizeof (Elf32_External_Rela) ++ * srelgot->reloc_count)) ++ || (srelplt && srelplt->size != (sizeof (Elf32_External_Rela) ++ * srelplt->reloc_count))) ++ abort (); ++ + /* Combine adjacent literal table entries. */ + BFD_ASSERT (! bfd_link_relocatable (info)); + sxtlit = bfd_get_section_by_name (output_bfd, ".xt.lit"); diff --git a/packages/binutils/2.31.1/0011-Restore-build-on-x86_64-w64-mingw32.patch b/packages/binutils/2.31.1/0011-Restore-build-on-x86_64-w64-mingw32.patch new file mode 100644 index 0000000..d94293d --- /dev/null +++ b/packages/binutils/2.31.1/0011-Restore-build-on-x86_64-w64-mingw32.patch @@ -0,0 +1,122 @@ +From be07c0ea2b943fe0bc8009432eadf157bbc2b718 Mon Sep 17 00:00:00 2001 +From: Alexey Neyman <stilor@att.net> +Date: Sun, 7 Oct 2018 11:57:49 -0700 +Subject: [PATCH] Restore build on x86_64-w64-mingw32 + + * gold/configure.ac: Add checks for link, mkdtemp. + * gold/configure: Regenerated. + * gold/config.in: Regenerated. + * gold/plugin.cc (Plugin_recorder::init): Fall back to mktemp + if mkdtemp is not available. + (link_or_copy_file): Fall back to copy if link() is not available. + +Signed-off-by: Alexey Neyman <stilor@att.net> +--- + gold/config.in | 6 ++++++ + gold/configure | 9 ++++++++- + gold/configure.ac | 5 ++++- + gold/plugin.cc | 14 ++++++++++++++ + 4 files changed, 32 insertions(+), 2 deletions(-) + +--- a/gold/config.in ++++ b/gold/config.in +@@ -103,6 +103,9 @@ + /* Define if your <locale.h> file defines LC_MESSAGES. */ + #undef HAVE_LC_MESSAGES + ++/* Define to 1 if you have the `link' function. */ ++#undef HAVE_LINK ++ + /* Define to 1 if you have the <locale.h> header file. */ + #undef HAVE_LOCALE_H + +@@ -112,6 +115,9 @@ + /* Define to 1 if you have the <memory.h> header file. */ + #undef HAVE_MEMORY_H + ++/* Define to 1 if you have the `mkdtemp' function. */ ++#undef HAVE_MKDTEMP ++ + /* Define to 1 if you have the `mmap' function. */ + #undef HAVE_MMAP + +--- a/gold/configure ++++ b/gold/configure +@@ -7977,7 +7977,7 @@ + + done + +-for ac_func in chsize mmap ++for ac_func in chsize mmap link + do : + as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` + ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var" +@@ -9878,6 +9878,13 @@ + fi + done + ++ac_fn_cxx_check_func "$LINENO" "mkdtemp" "ac_cv_func_mkdtemp" ++if test "x$ac_cv_func_mkdtemp" = xyes; then : ++ ++$as_echo "#define HAVE_MKDTEMP 1" >>confdefs.h ++ ++fi ++ + ac_fn_cxx_check_decl "$LINENO" "basename" "ac_cv_have_decl_basename" "$ac_includes_default" + if test "x$ac_cv_have_decl_basename" = xyes; then : + ac_have_decl=1 +--- a/gold/configure.ac ++++ b/gold/configure.ac +@@ -529,7 +529,7 @@ + AC_SUBST(LFS_CFLAGS) + + AC_CHECK_HEADERS(sys/mman.h) +-AC_CHECK_FUNCS(chsize mmap) ++AC_CHECK_FUNCS(chsize mmap link) + AC_REPLACE_FUNCS(pread ftruncate ffsll) + + AC_CACHE_CHECK([mremap with MREMAP_MAYMOVE], [gold_cv_lib_mremap_maymove], +@@ -614,6 +614,9 @@ + AC_SUBST(DLOPEN_LIBS) + + AC_CHECK_FUNCS(mallinfo posix_fallocate fallocate readv sysconf times) ++AC_CHECK_FUNC([mkdtemp], ++ AC_DEFINE([HAVE_MKDTEMP], 1, ++ [Define to 1 if you have the `mkdtemp' function.])) + AC_CHECK_DECLS([basename, ffs, asprintf, vasprintf, snprintf, vsnprintf, strverscmp, strndup, memmem]) + + # Use of ::std::tr1::unordered_map::rehash causes undefined symbols +--- a/gold/plugin.cc ++++ b/gold/plugin.cc +@@ -508,8 +508,20 @@ + // Create a temporary directory where we can stash the log and + // copies of replacement files. + char dir_template[] = "gold-recording-XXXXXX"; ++#ifdef HAVE_MKDTEMP + if (mkdtemp(dir_template) == NULL) + return false; ++#else ++ if (mktemp(dir_template) == NULL) ++ return false; ++#if defined (_WIN32) && !defined (__CYGWIN32__) ++ if (mkdir(dir_template) != 0) ++ return false; ++#else ++ if (mkdir(dir_template, 0700) != 0) ++ return false; ++#endif ++#endif + + size_t len = strlen(dir_template) + 1; + char* tempdir = new char[len]; +@@ -562,8 +574,10 @@ + { + static char buf[4096]; + ++#ifdef HAVE_LINK + if (::link(inname, outname) == 0) + return true; ++#endif + + int in = ::open(inname, O_RDONLY); + if (in < 0) diff --git a/packages/binutils/2.31.1/chksum b/packages/binutils/2.31.1/chksum new file mode 100644 index 0000000..a94831b --- /dev/null +++ b/packages/binutils/2.31.1/chksum @@ -0,0 +1,12 @@ +md5 binutils-2.31.1.tar.xz 5b7c9d4ce96f507d95c1b9a255e52418 +sha1 binutils-2.31.1.tar.xz 3b031410897fe224412f3a6a1b052402d2fbcc6a +sha256 binutils-2.31.1.tar.xz 5d20086ecf5752cc7d9134246e9588fa201740d540f7eb84d795b1f7a93bca86 +sha512 binutils-2.31.1.tar.xz 0fca326feb1d5f5fe505a827b20237fe3ec9c13eaf7ec7e35847fd71184f605ba1cefe1314b1b8f8a29c0aa9d88162849ee1c1a3e70c2f7407d88339b17edb30 +md5 binutils-2.31.1.tar.bz2 84edf97113788f106d6ee027f10b046a +sha1 binutils-2.31.1.tar.bz2 1c5b0801b4857031d5626d917808cbd5c6401a4b +sha256 binutils-2.31.1.tar.bz2 ffcc382695bf947da6135e7436b8ed52d991cf270db897190f19d6f9838564d0 +sha512 binutils-2.31.1.tar.bz2 b42954e6f49a0adcd2676bdd77dfb59bfc25cec8184b007521d1e2b1d5d0593b58639e3d9448d5a40fe024c3cea386a37743627d6bb16d502f52a4a32b9573bd +md5 binutils-2.31.1.tar.gz b88812a18c7d850e015235c1cea75a23 +sha1 binutils-2.31.1.tar.gz 1c18b9375eb1d3a1ee118ddbd9ab08bfd7dc7b27 +sha256 binutils-2.31.1.tar.gz e88f8d36bd0a75d3765a4ad088d819e35f8d7ac6288049780e2fefcad18dde88 +sha512 binutils-2.31.1.tar.gz 6e8867cacf58a6f79122ccee00afbb894c1709375580afc14b523dc7d123029bf2532f9f71e4c6c7072b2d708cc97a370c922d80fa17b3ee3ddeb49110cd749b diff --git a/packages/binutils/2.31.1/version.desc b/packages/binutils/2.31.1/version.desc new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/packages/binutils/2.31.1/version.desc |