From 061765ced66642c0a98b9e4a76e18dc630ad3199 Mon Sep 17 00:00:00 2001 From: Alexey Neyman Date: Wed, 15 Mar 2017 01:22:19 -0700 Subject: Mark static gdb/gdbserver EXPERIMENTAL ... and default to 'n'. Signed-off-by: Alexey Neyman --- config/debug/gdb.in.gdbserver | 19 +++++++++++++++++-- config/debug/gdb.in.native | 17 ++++++++++++++++- 2 files changed, 33 insertions(+), 3 deletions(-) (limited to 'config') diff --git a/config/debug/gdb.in.gdbserver b/config/debug/gdb.in.gdbserver index 2f5576b6..07e6e139 100644 --- a/config/debug/gdb.in.gdbserver +++ b/config/debug/gdb.in.gdbserver @@ -15,15 +15,30 @@ config GDB_GDBSERVER_HAS_IPA_LIB depends on GDB_7_2_or_later default y +# gdbserver is then linked with "-static -Wl,--dynamic-list=..." which config GDB_GDBSERVER_STATIC bool prompt "Build a static gdbserver" - depends on CONFIGURE_has_static_link - default y + depends on EXPERIMENTAL help In case you have trouble with dynamic loading of shared libraries, you will find that a static gdbserver comes in handy. + However, it has been noticed at least on x86 that enabling this + option produces an invalid gdbserver binary. It is linked with + "-static -Wl,--dynamic-list=..." which + # (a) requests invalid program interpreter + # (b) crashes glibc/uClibc-ng and does not work with musl + # See https://sourceware.org/ml/libc-alpha/2017-03/msg00267.html + + It is possible it would work with other architectures, hence it is + not completely removed. Use with care and report to the mailing list + if the resulting gdbserver works. + + For further details, see: + https://sourceware.org/bugzilla/show_bug.cgi?id=19617 + https://sourceware.org/bugzilla/show_bug.cgi?id=21086 + config GDB_GDBSERVER_BUILD_IPA_LIB bool prompt "Build the IPA library" diff --git a/config/debug/gdb.in.native b/config/debug/gdb.in.native index 915debd8..8684c05f 100644 --- a/config/debug/gdb.in.native +++ b/config/debug/gdb.in.native @@ -15,9 +15,24 @@ if GDB_NATIVE config GDB_NATIVE_STATIC bool prompt "Build a static native gdb" - depends on CONFIGURE_has_static_link + depends on EXPERIMENTAL help In case you have trouble with dynamic loading of shared libraries, you will find that a static gdb comes in handy. + However, it has been noticed at least on x86 that enabling this + option produces an invalid gdb binary. It is linked with + "-static -Wl,--dynamic-list=..." which + # (a) requests invalid program interpreter + # (b) crashes glibc/uClibc-ng and does not work with musl + # See https://sourceware.org/ml/libc-alpha/2017-03/msg00267.html + + It is possible it would work with other architectures, hence it is + not completely removed. Use with care and report to the mailing list + if the resulting gdbserver works. + + For further details, see: + https://sourceware.org/bugzilla/show_bug.cgi?id=19617 + https://sourceware.org/bugzilla/show_bug.cgi?id=21086 + endif # GDB_NATIVE -- cgit v1.2.3 From 63b2a19de4b33f304b236850028b6c6f32ce51e2 Mon Sep 17 00:00:00 2001 From: Alexey Neyman Date: Fri, 17 Mar 2017 00:33:52 -0700 Subject: Add an option to "demultilib" It turns out buildroot does not currently accept a toolchain where a dynamic linker does not reside in the multi-os-directory. Unfortunately this is how glibc installs itself on AArch64 without any extra tricks. So, provide an option to force everything into /lib or /usr/lib; patch to buildroot will be worked on separately. Signed-off-by: Alexey Neyman --- config/target.in | 23 ++++++++++++++++++ scripts/build/cc/100-gcc.sh | 58 +++++++++++++++++++++++++++++---------------- 2 files changed, 61 insertions(+), 20 deletions(-) (limited to 'config') diff --git a/config/target.in b/config/target.in index a905b239..485c5876 100644 --- a/config/target.in +++ b/config/target.in @@ -51,6 +51,29 @@ config MULTILIB NOTE: The multilib feature in crosstool-NG is not well-tested. Use at your own risk, and report success and/or failure. +config DEMULTILIB + bool "Attempt to combine libraries into a single directory" + default y if !MULTILIB + depends on !MULTILIB || EXPERIMENTAL + help + Normally, Crosstool-NG installs the libraries into the directories + as the configure for these libraries determines appropriate. For + example, for AArch64 glibc wants to install the libraries into + /lib64 but the default dynamic linker path is /lib/ld-linux-aarch64.so.1 + (which is installed as a symlink to ../lib64/ld-VER.so). + + However, not all consumers of the toolchain can handle the libraries + residing in multiple directories. To appease them, crosstool-NG can + attempt to combine the libraries back into a single /lib directory and + create all other directories as symlinks to /lib. This requires all + the library names to be unique within each sysroot. + + Note that GCC may also use separate sysroots for different multilibs. + Hence it may make sense to enable this option even for multilib toolchains. + However, separate roots are rare (any other architecture aside from + SuperH using them?) and hence not well tested in crosstool-NG; therefore, + this option is experimental when MULTILIB is enabled. + #-------------------------------------- config ARCH_SUPPORTS_BOTH_MMU bool diff --git a/scripts/build/cc/100-gcc.sh b/scripts/build/cc/100-gcc.sh index 9802521d..e3ae7830 100644 --- a/scripts/build/cc/100-gcc.sh +++ b/scripts/build/cc/100-gcc.sh @@ -129,6 +129,40 @@ cc_gcc_classify_opt() { echo "unknown" } +evaluate_multilib_cflags() +{ + local multi_dir multi_os_dir multi_os_dir_gcc multi_root multi_flags multi_index multi_count + local mdir mdir_os dirtop + local f + + for arg in "$@"; do + eval "${arg// /\\ }" + done + + mdir="lib/${multi_dir}" + mdir_os="lib/${multi_os_dir_gcc}" + CT_SanitizeVarDir mdir mdir_os + CT_DoLog EXTRA " '${multi_flags}' --> ${mdir} (gcc) ${mdir_os} (os)" + for f in ${multi_flags}; do + eval ml_`cc_gcc_classify_opt ${f}`=seen + done + if [ "${CT_DEMULTILIB}" = "y" ]; then + case "${mdir_os}" in + lib/*) + ;; + *) + dirtop="${mdir_os%%/*}" + if [ ! -e "${multi_root}/${mdir_os}" ]; then + CT_DoExecLog ALL ln -sfv lib "${multi_root}/${mdir_os}" + fi + if [ ! -e "${multi_root}/usr/${mdir_os}" ]; then + CT_DoExecLog ALL ln -sfv lib "${multi_root}/usr/${mdir_os}" + fi + ;; + esac + fi +} + #------------------------------------------------------------------------------ # This function lists the multilibs configured in the compiler (even if multilib # is disabled - so that it lists the default GCC/OS directory, which may differ @@ -151,9 +185,11 @@ cc_gcc_classify_opt() { # work, but 'gcc -mabi=32 -mabi=n32' produces an internal error in ld. Thus we do # not supply target's CFLAGS in multilib builds - and after compiling pass-1 gcc, # attempt to determine which CFLAGS need to be filtered out. +# +# 3. If "demultilibing" is in effect, create top-level directories for any +# multilibs not in lib/ as symlinks to lib. cc_gcc_multilib_housekeeping() { local cc host - local flags osdir dir multilibs i f local multilib_defaults local suffix sysroot base lnk local ml_arch ml_abi ml_cpu ml_tune ml_fpu ml_float ml_endian ml_mode ml_unknown ml @@ -175,25 +211,7 @@ cc_gcc_multilib_housekeeping() { multilib_defaults=( $( cc_gcc_get_spec multilib_defaults "${cc}" | \ sed 's/\(^\|[[:space:]]\+\)\([^[:space:]]\)/ -\2/g' ) ) CT_DoLog EXTRA "gcc default flags: '${multilib_defaults}'" - - multilibs=( $( "${cc}" -print-multi-lib ) ) - if [ ${#multilibs[@]} -ne 0 ]; then - CT_DoLog EXTRA "gcc configured with these multilibs (including the default):" - for i in "${multilibs[@]}"; do - dir="lib/${i%%;*}" - flags="${i#*;}" - flags=${flags//@/ -} - flags=$( echo ${flags} ) - osdir="lib/"$( "${cc}" -print-multi-os-directory ${flags} ) - CT_SanitizeVarDir dir osdir - CT_DoLog EXTRA " '${flags}' --> ${dir} (gcc) ${osdir} (os)" - for f in ${flags}; do - eval ml_`cc_gcc_classify_opt ${f}`=seen - done - done - else - CT_DoLog WARN "no multilib configuration: GCC unusable?" - fi + CT_IterateMultilibs evaluate_multilib_cflags evaluate_cflags # Filtering out some of the options provided in CT-NG config. Then *prepend* # them to CT_TARGET_CFLAGS, like scripts/crosstool-NG.sh does. Zero out -- cgit v1.2.3