diff options
author | 2020-03-30 09:24:26 +0900 | |
---|---|---|
committer | 2020-03-30 09:24:26 +0900 | |
commit | 5b80bfd7bffd4c20d80b7c70a7130529e9a755dd (patch) | |
tree | b4bb18dcd1487dbf1ea8127e5671b7bb2eded033 /bsp/meta-synopsys/recipes-devtools/binutils | |
parent | 706ad73eb02caf8532deaf5d38995bd258725cb8 (diff) |
agl-basesystem
Diffstat (limited to 'bsp/meta-synopsys/recipes-devtools/binutils')
11 files changed, 610 insertions, 0 deletions
diff --git a/bsp/meta-synopsys/recipes-devtools/binutils/binutils-arc.inc b/bsp/meta-synopsys/recipes-devtools/binutils/binutils-arc.inc new file mode 100644 index 00000000..2b397fb7 --- /dev/null +++ b/bsp/meta-synopsys/recipes-devtools/binutils/binutils-arc.inc @@ -0,0 +1,26 @@ +LIC_FILES_CHKSUM="\ + file://COPYING;md5=59530bdf33659b29e73d4adb9f9f6552\ + file://COPYING.LIB;md5=9f604d8a4f8e74f4f5140845a21b6674\ + file://COPYING3;md5=d32239bcb673463ab874e80d47fae504\ + file://COPYING3.LIB;md5=6a6a8e020838b23406c81b19c1d46df6\ + file://gas/COPYING;md5=d32239bcb673463ab874e80d47fae504\ + file://include/COPYING;md5=59530bdf33659b29e73d4adb9f9f6552\ + file://include/COPYING3;md5=d32239bcb673463ab874e80d47fae504\ + file://libiberty/COPYING.LIB;md5=a916467b91076e631dd8edb7424769c7\ + file://bfd/COPYING;md5=d32239bcb673463ab874e80d47fae504\ + " + +SRCREV ?= "arc-2018.09-release" + +SRC_URI = "\ + git://github.com/foss-for-synopsys-dwc-arc-processors/binutils-gdb;protocol=https;branch=arc-2018.09; \ + file://0004-Point-scripts-location-to-libdir.patch \ + file://0005-Only-generate-an-RPATH-entry-if-LD_RUN_PATH-is-not-e.patch \ + file://0008-don-t-let-the-distro-compiler-point-to-the-wrong-ins.patch \ + file://0009-warn-for-uses-of-system-directories-when-cross-linki.patch \ +" +S = "${WORKDIR}/git" + +do_configure_prepend () { + rm -rf ${S}/gdb ${S}/libdecnumber ${S}/readline ${S}/sim +} diff --git a/bsp/meta-synopsys/recipes-devtools/binutils/binutils-cross-canadian_arc.bb b/bsp/meta-synopsys/recipes-devtools/binutils/binutils-cross-canadian_arc.bb new file mode 100644 index 00000000..76b62771 --- /dev/null +++ b/bsp/meta-synopsys/recipes-devtools/binutils/binutils-cross-canadian_arc.bb @@ -0,0 +1,3 @@ +require recipes-devtools/binutils/binutils.inc +require recipes-devtools/binutils/binutils-${PV}.inc +require recipes-devtools/binutils/binutils-cross-canadian.inc diff --git a/bsp/meta-synopsys/recipes-devtools/binutils/binutils-cross_arc.bb b/bsp/meta-synopsys/recipes-devtools/binutils/binutils-cross_arc.bb new file mode 100644 index 00000000..a8b918e1 --- /dev/null +++ b/bsp/meta-synopsys/recipes-devtools/binutils/binutils-cross_arc.bb @@ -0,0 +1,3 @@ +require recipes-devtools/binutils/binutils.inc +require recipes-devtools/binutils/binutils-${PV}.inc +require recipes-devtools/binutils/binutils-cross.inc diff --git a/bsp/meta-synopsys/recipes-devtools/binutils/binutils-crosssdk_arc.bb b/bsp/meta-synopsys/recipes-devtools/binutils/binutils-crosssdk_arc.bb new file mode 100644 index 00000000..c31f3a59 --- /dev/null +++ b/bsp/meta-synopsys/recipes-devtools/binutils/binutils-crosssdk_arc.bb @@ -0,0 +1,13 @@ +require recipes-devtools/binutils/binutils-cross_${PV}.bb + +inherit crosssdk + +PN = "binutils-crosssdk-${SDK_SYS}" + +PROVIDES = "virtual/${TARGET_PREFIX}binutils-crosssdk" + +SRC_URI += "file://0001-binutils-crosssdk-Generate-relocatable-SDKs.patch" + +do_configure_prepend () { + sed -i 's#/usr/local/lib /lib /usr/lib#${SDKPATHNATIVE}/lib ${SDKPATHNATIVE}/usr/lib /usr/local/lib /lib /usr/lib#' ${S}/ld/configure.tgt +} diff --git a/bsp/meta-synopsys/recipes-devtools/binutils/binutils/0001-binutils-crosssdk-Generate-relocatable-SDKs.patch b/bsp/meta-synopsys/recipes-devtools/binutils/binutils/0001-binutils-crosssdk-Generate-relocatable-SDKs.patch new file mode 100644 index 00000000..6bdb407b --- /dev/null +++ b/bsp/meta-synopsys/recipes-devtools/binutils/binutils/0001-binutils-crosssdk-Generate-relocatable-SDKs.patch @@ -0,0 +1,62 @@ +From 4a99f058030c86794bb96b582a7dbd631f963b06 Mon Sep 17 00:00:00 2001 +From: Khem Raj <raj.khem@gmail.com> +Date: Mon, 2 Mar 2015 01:58:54 +0000 +Subject: [PATCH 01/15] binutils-crosssdk: Generate relocatable SDKs + +This patch will modify the ELF linker scripts so that the crosssdk +linker will generate binaries with a 4096 bytes PT_INTERP section. When the binaries +will be relocated, at SDK install time, the interpreter path can be easily +changed by the relocating script. + +Upstream-Status: Inappropriate [SDK specific] + +Signed-off-by: Laurentiu Palcu <laurentiu.palcu@intel.com> +Signed-off-by: Khem Raj <raj.khem@gmail.com> +--- + ld/genscripts.sh | 3 +++ + ld/scripttempl/elf.sc | 4 ++-- + 2 files changed, 5 insertions(+), 2 deletions(-) + +diff --git a/ld/genscripts.sh b/ld/genscripts.sh +index 370b22269d..a5c367aa8f 100755 +--- a/ld/genscripts.sh ++++ b/ld/genscripts.sh +@@ -279,6 +279,7 @@ DATA_ALIGNMENT_u="${DATA_ALIGNMENT_u-${DATA_ALIGNMENT_r}}" + LD_FLAG=r + DATA_ALIGNMENT=${DATA_ALIGNMENT_r} + DEFAULT_DATA_ALIGNMENT="ALIGN(${SEGMENT_SIZE})" ++PARTIAL_LINKING=" " + ( echo "/* Script for ld -r: link without relocation */" + . ${CUSTOMIZER_SCRIPT} + . ${srcdir}/scripttempl/${SCRIPT_NAME}.sc +@@ -287,10 +288,12 @@ DEFAULT_DATA_ALIGNMENT="ALIGN(${SEGMENT_SIZE})" + LD_FLAG=u + DATA_ALIGNMENT=${DATA_ALIGNMENT_u} + CONSTRUCTING=" " ++PARTIAL_LINKING=" " + ( echo "/* Script for ld -Ur: link w/out relocation, do create constructors */" + . ${CUSTOMIZER_SCRIPT} + . ${srcdir}/scripttempl/${SCRIPT_NAME}.sc + ) | sed -e '/^ *$/d;s/[ ]*$//' > ldscripts/${EMULATION_NAME}.xu ++unset PARTIAL_LINKING + + DATA_ALIGNMENT=${DATA_ALIGNMENT_} + RELOCATING=" " +diff --git a/ld/scripttempl/elf.sc b/ld/scripttempl/elf.sc +index 444aef2942..afa99f736d 100644 +--- a/ld/scripttempl/elf.sc ++++ b/ld/scripttempl/elf.sc +@@ -139,8 +139,8 @@ if test -z "$DATA_SEGMENT_ALIGN"; then + DATA_SEGMENT_RELRO_END=". = DATA_SEGMENT_RELRO_END (${SEPARATE_GOTPLT-0}, .);" + fi + fi +-if test -z "${INITIAL_READONLY_SECTIONS}${CREATE_SHLIB}"; then +- INITIAL_READONLY_SECTIONS=".interp ${RELOCATING-0} : { *(.interp) }" ++if test -z "${INITIAL_READONLY_SECTIONS}${CREATE_SHLIB}${PARTIAL_LINKING}"; then ++ INITIAL_READONLY_SECTIONS=".interp ${RELOCATING-0} : { *(.interp); . = 0x1000; }" + fi + if test -z "$PLT"; then + IPLT=".iplt ${RELOCATING-0} : { *(.iplt) }" +-- +2.18.0 + diff --git a/bsp/meta-synopsys/recipes-devtools/binutils/binutils/0002-binutils-cross-Do-not-generate-linker-script-directo.patch b/bsp/meta-synopsys/recipes-devtools/binutils/binutils/0002-binutils-cross-Do-not-generate-linker-script-directo.patch new file mode 100644 index 00000000..02082138 --- /dev/null +++ b/bsp/meta-synopsys/recipes-devtools/binutils/binutils/0002-binutils-cross-Do-not-generate-linker-script-directo.patch @@ -0,0 +1,63 @@ +From 6e78b1c88c040a742b7af82542ac7eb92eddda3d Mon Sep 17 00:00:00 2001 +From: Khem Raj <raj.khem@gmail.com> +Date: Mon, 6 Mar 2017 23:37:05 -0800 +Subject: [PATCH 02/15] binutils-cross: Do not generate linker script + directories + +We don't place target libraries within ${exec_prefix}, we'd always place these +within the target sysroot within the standard library directories. Worse, the +append_to_lib_path code prefixes these paths with the sysroot which makes even +less sense. + +These directories therefore don't make sense in our case and mean we have to +relocate all the linker scripts if they're present. Dropping them +gives a reasonable performance improvement/simplification. + +Upstream-Status: Inappropriate + +RP 2017/01/30 + +Signed-off-by: Khem Raj <raj.khem@gmail.com> +--- + ld/genscripts.sh | 25 ------------------------- + 1 file changed, 25 deletions(-) + +diff --git a/ld/genscripts.sh b/ld/genscripts.sh +index a5c367aa8f..6cc9eed976 100755 +--- a/ld/genscripts.sh ++++ b/ld/genscripts.sh +@@ -189,31 +189,6 @@ append_to_lib_path() + fi + } + +-# Always search $(tooldir)/lib, aka /usr/local/TARGET/lib when native +-# except when LIBPATH=":". +-if [ "${LIB_PATH}" != ":" ] ; then +- libs= +- if [ "x${TOOL_LIB}" = "x" ] ; then +- if [ "x${NATIVE}" = "xyes" ] ; then +- libs="${exec_prefix}/${target_alias}/lib" +- fi +- else +- # For multilib'ed targets, ensure both ${target_alias}/lib${LIBPATH_SUFFIX} +- # and ${TOOL_LIB}/lib${LIBPATH_SUFFIX} are in the default search path, +- # because 64bit libraries may be in both places, depending on +- # cross-development setup method (e.g.: /usr/s390x-linux/lib64 +- # vs. /usr/s390-linux/lib64) +- for libpath_suffix in ${LIBPATH_SUFFIX}; do +- case "${NATIVE}:${libpath_suffix}:${TOOL_LIB}" in +- :* | *::* | *:*:*${libpath_suffix}) ;; +- *) libs="${exec_prefix}/${target_alias}/lib${libpath_suffix}" ;; +- esac +- done +- libs="${exec_prefix}/${TOOL_LIB}/lib ${libs}" +- fi +- append_to_lib_path ${libs} +-fi +- + if [ "x${LIB_PATH}" = "x" ] && [ "x${USE_LIBPATH}" = xyes ] ; then + libs=${NATIVE_LIB_DIRS} + if [ "x${NATIVE}" = "xyes" ] ; then +-- +2.18.0 + diff --git a/bsp/meta-synopsys/recipes-devtools/binutils/binutils/0004-Point-scripts-location-to-libdir.patch b/bsp/meta-synopsys/recipes-devtools/binutils/binutils/0004-Point-scripts-location-to-libdir.patch new file mode 100644 index 00000000..bf1c1be2 --- /dev/null +++ b/bsp/meta-synopsys/recipes-devtools/binutils/binutils/0004-Point-scripts-location-to-libdir.patch @@ -0,0 +1,42 @@ +From 48ad5292b10408d4e5d5739022753a7183a1cbb3 Mon Sep 17 00:00:00 2001 +From: Khem Raj <raj.khem@gmail.com> +Date: Mon, 2 Mar 2015 01:09:58 +0000 +Subject: [PATCH 04/15] Point scripts location to libdir + +Upstream-Status: Inappropriate [debian patch] + +Signed-off-by: Khem Raj <raj.khem@gmail.com> +--- + ld/Makefile.am | 2 +- + ld/Makefile.in | 2 +- + 2 files changed, 2 insertions(+), 2 deletions(-) + +diff --git a/ld/Makefile.am b/ld/Makefile.am +index d86ad0940c..c95b0ef025 100644 +--- a/ld/Makefile.am ++++ b/ld/Makefile.am +@@ -57,7 +57,7 @@ endif + # 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@ +diff --git a/ld/Makefile.in b/ld/Makefile.in +index 4792b2b013..789df2d01b 100644 +--- a/ld/Makefile.in ++++ b/ld/Makefile.in +@@ -563,7 +563,7 @@ AM_CFLAGS = $(WARN_CFLAGS) $(ELF_CLFAGS) + # 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 +-- +2.18.0 + diff --git a/bsp/meta-synopsys/recipes-devtools/binutils/binutils/0005-Only-generate-an-RPATH-entry-if-LD_RUN_PATH-is-not-e.patch b/bsp/meta-synopsys/recipes-devtools/binutils/binutils/0005-Only-generate-an-RPATH-entry-if-LD_RUN_PATH-is-not-e.patch new file mode 100644 index 00000000..1f589718 --- /dev/null +++ b/bsp/meta-synopsys/recipes-devtools/binutils/binutils/0005-Only-generate-an-RPATH-entry-if-LD_RUN_PATH-is-not-e.patch @@ -0,0 +1,41 @@ +From 79e53510b1f9e16a21db312698fb1c1c442481e7 Mon Sep 17 00:00:00 2001 +From: Khem Raj <raj.khem@gmail.com> +Date: Mon, 2 Mar 2015 01:27:17 +0000 +Subject: [PATCH 05/15] Only generate an RPATH entry if LD_RUN_PATH is not + empty + +for cases where -rpath isn't specified. debian (#151024) + +Upstream-Status: Pending + +Signed-off-by: Chris Chimelis <chris@debian.org> +Signed-off-by: Khem Raj <raj.khem@gmail.com> +--- + ld/emultempl/elf32.em | 4 ++++ + 1 file changed, 4 insertions(+) + +diff --git a/ld/emultempl/elf32.em b/ld/emultempl/elf32.em +index 1ad9d6b6fa..6a025a45b4 100644 +--- a/ld/emultempl/elf32.em ++++ b/ld/emultempl/elf32.em +@@ -1471,6 +1471,8 @@ fragment <<EOF + && 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 @@ gld${EMULATION_NAME}_before_allocation (void) + rpath = command_line.rpath; + if (rpath == NULL) + rpath = (const char *) getenv ("LD_RUN_PATH"); ++ if ((rpath) && (strlen (rpath) == 0)) ++ rpath = NULL; + + for (abfd = link_info.input_bfds; abfd; abfd = abfd->link.next) + if (bfd_get_flavour (abfd) == bfd_target_elf_flavour) +-- +2.18.0 + diff --git a/bsp/meta-synopsys/recipes-devtools/binutils/binutils/0008-don-t-let-the-distro-compiler-point-to-the-wrong-ins.patch b/bsp/meta-synopsys/recipes-devtools/binutils/binutils/0008-don-t-let-the-distro-compiler-point-to-the-wrong-ins.patch new file mode 100644 index 00000000..6999ed9c --- /dev/null +++ b/bsp/meta-synopsys/recipes-devtools/binutils/binutils/0008-don-t-let-the-distro-compiler-point-to-the-wrong-ins.patch @@ -0,0 +1,35 @@ +From ca25d55cef8398bad508c2b2be29aea5aa3c4d26 Mon Sep 17 00:00:00 2001 +From: Khem Raj <raj.khem@gmail.com> +Date: Mon, 2 Mar 2015 01:39:01 +0000 +Subject: [PATCH 08/15] don't let the distro compiler point to the wrong + installation location + +Thanks to RP for helping find the source code causing the issue. + +2010/08/13 +Nitin A Kamble <nitin.a.kamble@intel.com> + +Upstream-Status: Inappropriate [embedded specific] + +Signed-off-by: Khem Raj <raj.khem@gmail.com> +--- + libiberty/Makefile.in | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/libiberty/Makefile.in b/libiberty/Makefile.in +index ed1b334c36..d4ffd8b57b 100644 +--- a/libiberty/Makefile.in ++++ b/libiberty/Makefile.in +@@ -364,7 +364,8 @@ install-strip: install + # multilib-specific flags, it's overridden by FLAGS_TO_PASS from the + # default multilib, so we have to take CFLAGS into account as well, + # since it will be passed the multilib flags. +-MULTIOSDIR = `$(CC) $(CFLAGS) -print-multi-os-directory` ++#MULTIOSDIR = `$(CC) $(CFLAGS) -print-multi-os-directory` ++MULTIOSDIR = "" + install_to_libdir: all + if test -n "${target_header_dir}"; then \ + ${mkinstalldirs} $(DESTDIR)$(libdir)/$(MULTIOSDIR); \ +-- +2.18.0 + diff --git a/bsp/meta-synopsys/recipes-devtools/binutils/binutils/0009-warn-for-uses-of-system-directories-when-cross-linki.patch b/bsp/meta-synopsys/recipes-devtools/binutils/binutils/0009-warn-for-uses-of-system-directories-when-cross-linki.patch new file mode 100644 index 00000000..9a9e3196 --- /dev/null +++ b/bsp/meta-synopsys/recipes-devtools/binutils/binutils/0009-warn-for-uses-of-system-directories-when-cross-linki.patch @@ -0,0 +1,273 @@ +From a3667059fc0d52d890b505bed0e5050ea3d7002e Mon Sep 17 00:00:00 2001 +From: Khem Raj <raj.khem@gmail.com> +Date: Fri, 15 Jan 2016 06:31:09 +0000 +Subject: [PATCH 09/15] warn for uses of system directories when cross linking + +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.in (--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. + +Upstream-Status: Pending + +Signed-off-by: Mark Hatle <mark.hatle@windriver.com> +Signed-off-by: Scott Garman <scott.a.garman@intel.com> +Signed-off-by: Khem Raj <raj.khem@gmail.com> +--- + ld/config.in | 3 +++ + ld/configure | 16 ++++++++++++++++ + 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 | 16 ++++++++++++++++ + 9 files changed, 86 insertions(+) + +diff --git a/ld/config.in b/ld/config.in +index d93c9b0830..5da2742bea 100644 +--- 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 + +diff --git a/ld/configure b/ld/configure +index 2b291f0da8..facc386563 100755 +--- a/ld/configure ++++ b/ld/configure +@@ -826,6 +826,7 @@ with_lib_path + enable_targets + enable_64_bit_bfd + with_sysroot ++enable_poison_system_directories + enable_gold + enable_got + enable_compressed_debug_sections +@@ -1490,6 +1491,8 @@ Optional Features: + --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) +@@ -16618,6 +16621,19 @@ 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-gold was given. + if test "${enable_gold+set}" = set; then : + enableval=$enable_gold; case "${enableval}" in +diff --git a/ld/configure.ac b/ld/configure.ac +index d10c553650..9f1b57b120 100644 +--- a/ld/configure.ac ++++ b/ld/configure.ac +@@ -94,6 +94,16 @@ AC_SUBST(use_sysroot) + 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. +diff --git a/ld/ld.h b/ld/ld.h +index ba914b921e..9df17dab6c 100644 +--- a/ld/ld.h ++++ b/ld/ld.h +@@ -180,6 +180,14 @@ typedef struct + in the linker script. */ + bfd_boolean force_group_allocation; + ++ /* 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; ++ + /* Big or little endian as set on command line. */ + enum endian_enum endian; + +diff --git a/ld/ld.texi b/ld/ld.texi +index b9fe2324da..43486605e0 100644 +--- a/ld/ld.texi ++++ b/ld/ld.texi +@@ -2479,6 +2479,18 @@ string identifying the original linked file does not change. + + 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 +diff --git a/ld/ldfile.c b/ld/ldfile.c +index a72ff13526..dc5148f748 100644 +--- a/ld/ldfile.c ++++ b/ld/ldfile.c +@@ -116,6 +116,23 @@ ldfile_add_library_path (const char *name, bfd_boolean cmdline) + 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. */ +diff --git a/ld/ldlex.h b/ld/ldlex.h +index 04d6fd5f96..d7df005bb2 100644 +--- a/ld/ldlex.h ++++ b/ld/ldlex.h +@@ -148,6 +148,8 @@ enum option_values + 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. */ +diff --git a/ld/ldmain.c b/ld/ldmain.c +index f31eeb29c3..25f8497888 100644 +--- a/ld/ldmain.c ++++ b/ld/ldmain.c +@@ -268,6 +268,8 @@ main (int argc, char **argv) + 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 +diff --git a/ld/lexsup.c b/ld/lexsup.c +index 86a033a383..4a40d48020 100644 +--- a/ld/lexsup.c ++++ b/ld/lexsup.c +@@ -543,6 +543,14 @@ static const struct ld_option ld_options[] = + { {"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) +@@ -1577,6 +1585,14 @@ parse_args (unsigned argc, char **argv) + einfo (_("%F%P: invalid argument to option" + " \"--orphan-handling\"\n")); + 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; + } + } + +-- +2.18.0 + diff --git a/bsp/meta-synopsys/recipes-devtools/binutils/binutils_arc.bb b/bsp/meta-synopsys/recipes-devtools/binutils/binutils_arc.bb new file mode 100644 index 00000000..09c6a886 --- /dev/null +++ b/bsp/meta-synopsys/recipes-devtools/binutils/binutils_arc.bb @@ -0,0 +1,49 @@ +require recipes-devtools/binutils/binutils.inc +require recipes-devtools/binutils/binutils-${PV}.inc + +DEPENDS += "flex bison zlib" + +EXTRA_OECONF += "--with-sysroot=/ \ + --enable-install-libbfd \ + --enable-install-libiberty \ + --enable-shared \ + --with-system-zlib \ + " + +EXTRA_OEMAKE_append_libc-musl = "\ + gt_cv_func_gnugettext1_libc=yes \ + gt_cv_func_gnugettext2_libc=yes \ + " +EXTRA_OECONF_class-native = "--enable-targets=all \ + --enable-64-bit-bfd \ + --enable-install-libiberty \ + --enable-install-libbfd \ + --disable-werror" + +do_install_class-native () { + autotools_do_install + + # Install the libiberty header + install -d ${D}${includedir} + install -m 644 ${S}/include/ansidecl.h ${D}${includedir} + install -m 644 ${S}/include/libiberty.h ${D}${includedir} + + # We only want libiberty, libbfd and libopcodes + rm -rf ${D}${bindir} + rm -rf ${D}${prefix}/${TARGET_SYS} + rm -rf ${D}${prefix}/lib/ldscripts + rm -rf ${D}${prefix}/share/info + rm -rf ${D}${prefix}/share/locale + rm -rf ${D}${prefix}/share/man + rmdir ${D}${prefix}/share || : + rmdir ${D}/${libdir}/gcc-lib || : + rmdir ${D}/${libdir}64/gcc-lib || : + rmdir ${D}/${libdir} || : + rmdir ${D}/${libdir}64 || : +} + +# Split out libbfd-*.so so including perf doesn't include extra stuff +PACKAGE_BEFORE_PN += "libbfd" +FILES_libbfd = "${libdir}/libbfd-*.so" + +BBCLASSEXTEND = "native nativesdk" |