From 29b6e00368b4f74c4d4a1cd22da7fdabdcd1d6ea Mon Sep 17 00:00:00 2001 From: Chris Packham Date: Mon, 8 Aug 2022 21:09:12 +1200 Subject: binutils: Add binutils 2.39 https://sourceware.org/pipermail/binutils/2022-August/122246.html Add binutils 2.39 and regenerate patches. 0008-binutils-2.38-vs.-ppc32-linux-kernel.patch is dropped as it has been applied upstream. Add a milestone for 2.39 which will be handy for Loongarch. Binutils now requires bison >= 3.0.4 to build gprofng for x86/aarch64 so we build our own bison when the host bison does not meet that requirement (which appears to be the case on macOS). Signed-off-by: Chris Packham --- config/binutils/binutils.in | 6 + config/configure.in.in | 3 + configure.ac | 7 + packages/binutils/2.39/0000-sh-conf.patch | 32 +++ .../2.39/0001-check_ldrunpath_length.patch | 29 +++ ...winpthreads-doesnt-have-pthread_mutexattr.patch | 21 ++ ...003-Dont-link-to-libfl-as-its-unnecessary.patch | 110 ++++++++ ...gold-binary-cc-include-string-not-cstring.patch | 20 ++ packages/binutils/2.39/0005-Fix-darwin-build.patch | 70 +++++ packages/binutils/2.39/0006-sysroot.patch | 45 ++++ .../2.39/0007-poison-system-directories.patch | 283 +++++++++++++++++++++ packages/binutils/2.39/chksum | 12 + packages/binutils/2.39/version.desc | 0 packages/binutils/package.desc | 2 +- 14 files changed, 639 insertions(+), 1 deletion(-) create mode 100644 packages/binutils/2.39/0000-sh-conf.patch create mode 100644 packages/binutils/2.39/0001-check_ldrunpath_length.patch create mode 100644 packages/binutils/2.39/0002-MinGW-w64-winpthreads-doesnt-have-pthread_mutexattr.patch create mode 100644 packages/binutils/2.39/0003-Dont-link-to-libfl-as-its-unnecessary.patch create mode 100644 packages/binutils/2.39/0004-Darwin-gold-binary-cc-include-string-not-cstring.patch create mode 100644 packages/binutils/2.39/0005-Fix-darwin-build.patch create mode 100644 packages/binutils/2.39/0006-sysroot.patch create mode 100644 packages/binutils/2.39/0007-poison-system-directories.patch create mode 100644 packages/binutils/2.39/chksum create mode 100644 packages/binutils/2.39/version.desc diff --git a/config/binutils/binutils.in b/config/binutils/binutils.in index 286ed4b5..2aa877fc 100644 --- a/config/binutils/binutils.in +++ b/config/binutils/binutils.in @@ -24,6 +24,12 @@ config BINUTILS_FORCE_LD_BFD_DEFAULT config BINUTILS_FORCE_LD_BFD_ONLY bool +# Binutils 2.39 requires bison 3.0.4 or later for gprofng on x86/aarch64 +config BINUTILS_DEP_BISON + def_bool y + depends on BINUTILS_2_39_or_later && !CONFIGURE_has_bison_3_0_4_or_newer && (ARCH_X86 || (ARCH_ARM && ARCH_64)) + select COMP_TOOLS_BISON + choice bool prompt "Linkers to enable" diff --git a/config/configure.in.in b/config/configure.in.in index a43fb61b..c67fd35f 100644 --- a/config/configure.in.in +++ b/config/configure.in.in @@ -54,6 +54,9 @@ config CONFIGURE_has_python_3_4_or_newer config CONFIGURE_has_bison_2_7_or_newer @KCONFIG_bison_2_7_or_newer@ +config CONFIGURE_has_bison_3_0_4_or_newer + @KCONFIG_bison_3_0_4_or_newer@ + config CONFIGURE_has_python @KCONFIG_python@ diff --git a/configure.ac b/configure.ac index ba951f25..7e1a9acd 100644 --- a/configure.ac +++ b/configure.ac @@ -274,6 +274,13 @@ CTNG_PROG_VERSION_REQ_ANY([BISON], [\(GNU Bison\) (2\.[7-9]|2\.[1-9][0-9]|[3-9]\.)], [bison_2_7_or_newer]) +CTNG_PROG_VERSION_REQ_ANY([BISON], + [bison >= 3.0.4], + [bison], + [bison], + [\(GNU Bison\) (3\.0\.[4-9]|3\.[1-9]|[4-9]\.)], + [bison_3_0_4_or_newer]) + AC_SUBST([kconfig_options]) AC_CHECK_PROGS([dtc], [dtc]) diff --git a/packages/binutils/2.39/0000-sh-conf.patch b/packages/binutils/2.39/0000-sh-conf.patch new file mode 100644 index 00000000..8e975da0 --- /dev/null +++ b/packages/binutils/2.39/0000-sh-conf.patch @@ -0,0 +1,32 @@ +From 0d37b5114a1caa2e1cb8e5273b6a674abee37b91 Mon Sep 17 00:00:00 2001 +From: Chris Packham +Date: Mon, 8 Aug 2022 20:31:10 +1200 +Subject: [PATCH] sh conf + +--- + configure | 2 +- + configure.ac | 2 +- + 2 files changed, 2 insertions(+), 2 deletions(-) + +--- a/configure ++++ b/configure +@@ -3911,7 +3911,7 @@ + nvptx*-*-*) + noconfigdirs="$noconfigdirs target-libssp target-libstdc++-v3 target-libobjc" + ;; +- sh-*-*) ++ sh*-*-*) + case "${target}" in + sh*-*-elf) + ;; +--- a/configure.ac ++++ b/configure.ac +@@ -1189,7 +1189,7 @@ + nvptx*-*-*) + noconfigdirs="$noconfigdirs target-libssp target-libstdc++-v3 target-libobjc" + ;; +- sh-*-*) ++ sh*-*-*) + case "${target}" in + sh*-*-elf) + ;; diff --git a/packages/binutils/2.39/0001-check_ldrunpath_length.patch b/packages/binutils/2.39/0001-check_ldrunpath_length.patch new file mode 100644 index 00000000..d67a67f8 --- /dev/null +++ b/packages/binutils/2.39/0001-check_ldrunpath_length.patch @@ -0,0 +1,29 @@ +From 3c0df45053b5988491bbb407f875fee8a0faa25b Mon Sep 17 00:00:00 2001 +From: Chris Packham +Date: Mon, 8 Aug 2022 20:36:31 +1200 +Subject: [PATCH] check_ldrunpath_length + +--- + ld/ldelf.c | 4 ++++ + 1 file changed, 4 insertions(+) + +--- a/ld/ldelf.c ++++ b/ld/ldelf.c +@@ -1127,6 +1127,8 @@ + && command_line.rpath == NULL) + { + path = (const char *) getenv ("LD_RUN_PATH"); ++ if (path && *path == '\0') ++ path = NULL; + if (path + && ldelf_search_needed (path, &n, force, + is_linux, elfsize)) +@@ -1801,6 +1803,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.39/0002-MinGW-w64-winpthreads-doesnt-have-pthread_mutexattr.patch b/packages/binutils/2.39/0002-MinGW-w64-winpthreads-doesnt-have-pthread_mutexattr.patch new file mode 100644 index 00000000..f02496ca --- /dev/null +++ b/packages/binutils/2.39/0002-MinGW-w64-winpthreads-doesnt-have-pthread_mutexattr.patch @@ -0,0 +1,21 @@ +From 4a797d00aac6f4a15fcd17c34da65a316e788f16 Mon Sep 17 00:00:00 2001 +From: Chris Packham +Date: Mon, 8 Aug 2022 20:37:03 +1200 +Subject: [PATCH] MinGW w64 winpthreads doesn't have + pthread_mutexattr_settype + +--- + 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.39/0003-Dont-link-to-libfl-as-its-unnecessary.patch b/packages/binutils/2.39/0003-Dont-link-to-libfl-as-its-unnecessary.patch new file mode 100644 index 00000000..ccaffff7 --- /dev/null +++ b/packages/binutils/2.39/0003-Dont-link-to-libfl-as-its-unnecessary.patch @@ -0,0 +1,110 @@ +From 4afcbb7decf230fdf7a02a5fe9dd1b5dfaab5712 Mon Sep 17 00:00:00 2001 +From: Chris Packham +Date: Mon, 8 Aug 2022 20:37:24 +1200 +Subject: [PATCH] Don't link to libfl as it's unnecessary + +--- + 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 +@@ -12289,6 +12289,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. +@@ -12452,6 +12453,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 +@@ -137,7 +137,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 +@@ -12932,6 +12932,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. +@@ -13095,6 +13096,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 +@@ -933,7 +933,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 +@@ -16448,6 +16448,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. +@@ -16611,6 +16612,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 +@@ -346,7 +346,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.39/0004-Darwin-gold-binary-cc-include-string-not-cstring.patch b/packages/binutils/2.39/0004-Darwin-gold-binary-cc-include-string-not-cstring.patch new file mode 100644 index 00000000..a94a9894 --- /dev/null +++ b/packages/binutils/2.39/0004-Darwin-gold-binary-cc-include-string-not-cstring.patch @@ -0,0 +1,20 @@ +From 5a41f20a5be6d38fd33beae8a5e0af902acc6e71 Mon Sep 17 00:00:00 2001 +From: Chris Packham +Date: Mon, 8 Aug 2022 20:37:47 +1200 +Subject: [PATCH] Darwin gold binary cc include string not cstring + +--- + 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 +-#include ++#include + + #include "elfcpp.h" + #include "stringpool.h" diff --git a/packages/binutils/2.39/0005-Fix-darwin-build.patch b/packages/binutils/2.39/0005-Fix-darwin-build.patch new file mode 100644 index 00000000..be6abe78 --- /dev/null +++ b/packages/binutils/2.39/0005-Fix-darwin-build.patch @@ -0,0 +1,70 @@ +From 2b887f9f158c963d0ffb9759c9ff4d89c88b7ed1 Mon Sep 17 00:00:00 2001 +From: Andrew Hsieh +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 +@@ -3641,6 +3641,28 @@ + } + #endif /* 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 (bool 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.39/0006-sysroot.patch b/packages/binutils/2.39/0006-sysroot.patch new file mode 100644 index 00000000..29dfe2ee --- /dev/null +++ b/packages/binutils/2.39/0006-sysroot.patch @@ -0,0 +1,45 @@ +From 57da8086f8bd7c3184b9e2144083553c46ce4ae4 Mon Sep 17 00:00:00 2001 +From: Sven Rebhan +Date: Mon, 8 Aug 2022 20:46:29 +1200 +Subject: [PATCH] sysroot + +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 + +Signed-off-by: Sven Rebhan +--- + ld/ldfile.c | 11 +++++++++-- + 1 file changed, 9 insertions(+), 2 deletions(-) + +--- a/ld/ldfile.c ++++ b/ld/ldfile.c +@@ -340,18 +340,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.39/0007-poison-system-directories.patch b/packages/binutils/2.39/0007-poison-system-directories.patch new file mode 100644 index 00000000..9db86425 --- /dev/null +++ b/packages/binutils/2.39/0007-poison-system-directories.patch @@ -0,0 +1,283 @@ +From 6d79a3e0fadbc0e619b039db2c73353d68036acc Mon Sep 17 00:00:00 2001 +From: Scott Garman +Date: Mon, 8 Aug 2022 20:48:32 +1200 +Subject: [PATCH] poison system directories + +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 +Signed-off-by: Gustavo Zacarias + +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 + + 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 + + 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 + + Merge from Sourcery G++ binutils 2.17: + + 2007-03-20 Joseph Myers + Based on patch by Mark Hatle . + 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 +Signed-off-by: Scott Garman +--- + 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 +@@ -55,6 +55,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 +@@ -836,6 +836,7 @@ + enable_targets + enable_64_bit_bfd + with_sysroot ++enable_poison_system_directories + enable_gold + enable_got + enable_compressed_debug_sections +@@ -1514,6 +1515,8 @@ + --enable-checking enable run-time checks + --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= GOT handling scheme (target, single, negative, + multigot) +@@ -15370,7 +15373,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 +@@ -102,6 +102,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 +@@ -157,6 +157,14 @@ + /* If set, display the target memory usage (per memory region). */ + bool print_memory_usage; + ++ /* If TRUE (the default) warn for uses of system directories when ++ cross linking. */ ++ bool poison_system_directories; ++ ++ /* If TRUE (default FALSE) give an error for uses of system ++ directories when cross linking instead of a warning. */ ++ bool 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 +@@ -2947,6 +2947,18 @@ + occurrence of the --package-metdata option. + If the linker has been built with libjansson, then the JSON string + will be validated. ++ ++@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 +@@ -117,6 +117,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 +@@ -168,6 +168,8 @@ + OPTION_NO_WARN_EXECSTACK, + OPTION_WARN_RWX_SEGMENTS, + OPTION_NO_WARN_RWX_SEGMENTS, ++ OPTION_NO_POISON_SYSTEM_DIRECTORIES, ++ OPTION_ERROR_POISON_SYSTEM_DIRECTORIES, + }; + + /* The initial parser states. */ +--- a/ld/ldmain.c ++++ b/ld/ldmain.c +@@ -321,6 +321,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 = true; + + /* 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 +@@ -608,6 +608,14 @@ + " is: share-unconflicted (default),\n" + " share-duplicated"), + 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) +@@ -620,6 +628,7 @@ + int ingroup = 0; + char *default_dirlist = NULL; + char *shortopts; ++ char *BR_paranoid_env; + struct option *longopts; + struct option *really_longopts; + int last_optind; +@@ -1679,6 +1688,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), +@@ -1824,6 +1841,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) + { + einfo (_("%P: missing --end-group; added as last command line option\n")); diff --git a/packages/binutils/2.39/chksum b/packages/binutils/2.39/chksum new file mode 100644 index 00000000..113a2dc9 --- /dev/null +++ b/packages/binutils/2.39/chksum @@ -0,0 +1,12 @@ +md5 binutils-2.39.tar.xz f7e986ae9ff06405cafb2e585ee36d27 +sha1 binutils-2.39.tar.xz f17653e7b1d1fa5242a408919845da23e8cc5141 +sha256 binutils-2.39.tar.xz 645c25f563b8adc0a81dbd6a41cffbf4d37083a382e02d5d3df4f65c09516d00 +sha512 binutils-2.39.tar.xz 68e038f339a8c21faa19a57bbc447a51c817f47c2e06d740847c6e9cc3396c025d35d5369fa8c3f8b70414757c89f0e577939ddc0d70f283182504920f53b0a3 +md5 binutils-2.39.tar.bz2 ec642a2a02029501f68911b507453b89 +sha1 binutils-2.39.tar.bz2 d9028547385694d61d98fb4e2882a2b9c40ce7e9 +sha256 binutils-2.39.tar.bz2 da24a84fef220102dd24042df06fdea851c2614a5377f86effa28f33b7b16148 +sha512 binutils-2.39.tar.bz2 faa592dd48fc715901ad704ac96dbd34b1792c51e77c7a92a387964b0700703c74be07de45cc4751945c8c0674368c73dc17bbc563d1d2cd235b5ebd8c6e7efb +md5 binutils-2.39.tar.gz ab6825df57514ec172331e988f55fc10 +sha1 binutils-2.39.tar.gz a1124fb0991b2161947dedb7698637a80e053731 +sha256 binutils-2.39.tar.gz d12ea6f239f1ffe3533ea11ad6e224ffcb89eb5d01bbea589e9158780fa11f10 +sha512 binutils-2.39.tar.gz b446f60e03c88d70e37089240b7ef563da31fbbf5f41a4de4cf576fa33ab1b184714657eac88aa05b5a051524af9fb9ec12a90d0bb33b16d181a4eb4aa388842 diff --git a/packages/binutils/2.39/version.desc b/packages/binutils/2.39/version.desc new file mode 100644 index 00000000..e69de29b diff --git a/packages/binutils/package.desc b/packages/binutils/package.desc index 9202960a..259ce6c7 100644 --- a/packages/binutils/package.desc +++ b/packages/binutils/package.desc @@ -2,6 +2,6 @@ repository='git git://sourceware.org/git/binutils-gdb.git' mirrors='$(CT_Mirrors GNU binutils) $(CT_Mirrors sourceware binutils/releases)' relevantpattern='*.*|.' origin='GNU' -milestones='2.26 2.27 2.30' +milestones='2.26 2.27 2.30 2.39' archive_formats='.tar.xz .tar.bz2 .tar.gz' signature_format='packed/.sig' -- cgit v1.2.3