[PATCH v2 00/12] Rebased version of Yocto patches
Done after discussion w/ Alex (thanks!). Rebased on master after 2.4.7 release. Khem Raj (3): libtool.m4: Rename the --with-sysroot option to avoid conflict with gcc/binutils libtool: Check for static libs for internal compiler libraries ltmain.in: Add missing sysroot to library path Marek Vasut (1): libtool: Fix support for NIOS2 processor Mingli Yu (2): Makefile.am: make sure autoheader run before autoconf Makefile.am: make sure autoheader run before automake Richard Purdie (6): ltmain.sh: Fix sysroot paths being encoded into RPATHs ltmain.in: Handle trailing slashes on install commands correctly libtool.m4: For reproducibility stop encoding hostname in libtool script ltmain.in: Don't encode RATHS which match default linker paths libtool.m4: Handle "/" as a sysroot correctly ltmain.in: Handle prefix-map compiler options correctly Makefile.am | 4 +-- build-aux/ltmain.in | 81 +++-- m4/libtool.m4 | 25 -- tests/sysroot.at| 6 ++-- 4 files changed, 89 insertions(+), 27 deletions(-) -- 2.35.1
[PATCH v2 02/12] ltmain.in: Handle trailing slashes on install commands correctly
From: Richard Purdie A command like: libtool --mode=install /usr/bin/install -c gck-roots-store-standalone.la '/image/usr/lib/gnome-keyring/standalone/' where the path ends with a trailing slash currently fails. This occurs in software like gnome-keyring or pulseaudio and is because the comparision code doesn't see the paths as equal. Strip both paths to ensure this works reliably. Signed-off-by: Richard Purdie --- build-aux/ltmain.in | 8 +++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/build-aux/ltmain.in b/build-aux/ltmain.in index d3a03a53..bc0a3950 100644 --- a/build-aux/ltmain.in +++ b/build-aux/ltmain.in @@ -2381,8 +2381,14 @@ func_mode_install () func_append dir "$objdir" if test -n "$relink_command"; then + # Strip any trailing slash from the destination. + func_stripname '' '/' "$libdir" + destlibdir=$func_stripname_result + func_stripname '' '/' "$destdir" + s_destdir=$func_stripname_result + # Determine the prefix the user has applied to our future dir. - inst_prefix_dir=`$ECHO "$destdir" | $SED -e "s%$libdir\$%%"` + inst_prefix_dir=`$ECHO "X$s_destdir" | $Xsed -e "s%$destlibdir\$%%"` # Don't allow the user to place us outside of our expected # location b/c this prevents finding dependent libraries that -- 2.35.1
[PATCH v2 05/12] libtool.m4: Rename the --with-sysroot option to avoid conflict with gcc/binutils
From: Khem Raj This patch renames the --with-sysroot option to --with-libtool-sysroot to avoid namespace conflict with binutils, gcc and other toolchain components since these componets also add that option to configure and this becomes confusing and conflicting otherwise. Signed-off-by: Richard Purdie --- m4/libtool.m4| 12 ++-- tests/sysroot.at | 6 +++--- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/m4/libtool.m4 b/m4/libtool.m4 index 717e7697..d89a892f 100644 --- a/m4/libtool.m4 +++ b/m4/libtool.m4 @@ -1243,28 +1243,28 @@ _LT_DECL([], [ECHO], [1], [An echo program that protects backslashes]) AC_DEFUN([_LT_WITH_SYSROOT], [m4_require([_LT_DECL_SED])dnl AC_MSG_CHECKING([for sysroot]) -AC_ARG_WITH([sysroot], -[AS_HELP_STRING([--with-sysroot@<:@=DIR@:>@], +AC_ARG_WITH([libtool-sysroot], +[AS_HELP_STRING([--with-libtool-sysroot@<:@=DIR@:>@], [Search for dependent libraries within DIR (or the compiler's sysroot if not specified).])], -[], [with_sysroot=no]) +[], [with_libtool_sysroot=no]) dnl lt_sysroot will always be passed unquoted. We quote it here dnl in case the user passed a directory name. lt_sysroot= -case $with_sysroot in #( +case $with_libtool_sysroot in #( yes) if test yes = "$GCC"; then lt_sysroot=`$CC --print-sysroot 2>/dev/null` fi ;; #( /*) - lt_sysroot=`echo "$with_sysroot" | $SED -e "$sed_quote_subst"` + lt_sysroot=`echo "$with_libtool_sysroot" | $SED -e "$sed_quote_subst"` ;; #( no|'') ;; #( *) - AC_MSG_RESULT([$with_sysroot]) + AC_MSG_RESULT([$with_libtool_sysroot]) AC_MSG_ERROR([The sysroot must be an absolute path.]) ;; esac diff --git a/tests/sysroot.at b/tests/sysroot.at index 540edde9..47fce0c2 100644 --- a/tests/sysroot.at +++ b/tests/sysroot.at @@ -65,7 +65,7 @@ while read file; do done]) LDFLAGS="$LDFLAGS --sysroot=$sysroot -no-undefined" -configure_options="$configure_options --with-sysroot=$sysroot --prefix=$prefix" +configure_options="$configure_options --with-libtool-sysroot=$sysroot --prefix=$prefix" #??? if test PATH = "$shlibpath_var"; then @@ -115,7 +115,7 @@ AM_INIT_AUTOMAKE([foreign]) AC_PROG_CC AC_CONFIG_SRCDIR([lib2.c]) LT_INIT -sysroot=$with_sysroot +sysroot=$with_libtool_sysroot AC_SUBST([sysroot]) AC_OUTPUT(Makefile) ]]) @@ -156,7 +156,7 @@ AM_INIT_AUTOMAKE([foreign]) AC_PROG_CC AC_CONFIG_SRCDIR([prog.c]) LT_INIT -sysroot=$with_sysroot +sysroot=$with_libtool_sysroot AC_SUBST([sysroot]) AC_OUTPUT(Makefile) ]]) -- 2.35.1
[PATCH v2 03/12] libtool.m4: For reproducibility stop encoding hostname in libtool script
From: Richard Purdie For reproducibilty, stop encoding the hostname into the libtool script, this isn't really adding much to debugging and most distros are carrying such a patch now as reproducibility is important. Signed-off-by: Richard Purdie --- m4/libtool.m4 | 1 - 1 file changed, 1 deletion(-) diff --git a/m4/libtool.m4 b/m4/libtool.m4 index 79a2451e..717e7697 100644 --- a/m4/libtool.m4 +++ b/m4/libtool.m4 @@ -730,7 +730,6 @@ _LT_CONFIG_SAVE_COMMANDS([ cat <<_LT_EOF >> "$cfgfile" #! $SHELL # Generated automatically by $as_me ($PACKAGE) $VERSION -# Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`: # NOTE: Changes made to this file will be lost: look at ltmain.sh. # Provide generalized library-building support services. -- 2.35.1
[PATCH v2 08/12] ltmain.in: Add missing sysroot to library path
From: Khem Raj When using a sysroot we should append it to libdir, which is helpful in cross builds as the system is staged in the sysroot. For normal builds, i.e. when lt_sysroot is not set, it will still behave the same and add -L/usr/lib to the relink command. Signed-off-by: Richard Purdie --- build-aux/ltmain.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build-aux/ltmain.in b/build-aux/ltmain.in index a4175d99..2fa055ef 100644 --- a/build-aux/ltmain.in +++ b/build-aux/ltmain.in @@ -6503,7 +6503,7 @@ func_mode_link () fi else # We cannot seem to hardcode it, guess we'll fake it. - add_dir=-L$libdir + add_dir="-L$lt_sysroot$libdir" # Try looking first in the location we're being installed to. if test -n "$inst_prefix_dir"; then case $libdir in -- 2.35.1
[PATCH v2 01/12] ltmain.sh: Fix sysroot paths being encoded into RPATHs
From: Richard Purdie There is a bug where RPATHs could end up containing sysroot values when cross compiling which is obviously incorrect. Strip out sysroot components from libdir when building RPATH values to avoid this. Signed-off-by: Richard Purdie --- build-aux/ltmain.in | 14 -- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/build-aux/ltmain.in b/build-aux/ltmain.in index a5f21a1d..d3a03a53 100644 --- a/build-aux/ltmain.in +++ b/build-aux/ltmain.in @@ -7676,9 +7676,11 @@ EOF test relink = "$opt_mode" || rpath=$compile_rpath$rpath for libdir in $rpath; do if test -n "$hardcode_libdir_flag_spec"; then + func_replace_sysroot "$libdir" + libdir=$func_replace_sysroot_result + func_stripname '=' '' "$libdir" + libdir=$func_stripname_result if test -n "$hardcode_libdir_separator"; then - func_replace_sysroot "$libdir" - libdir=$func_replace_sysroot_result if test -z "$hardcode_libdirs"; then hardcode_libdirs=$libdir else @@ -8408,6 +8410,10 @@ EOF hardcode_libdirs= for libdir in $compile_rpath $finalize_rpath; do if test -n "$hardcode_libdir_flag_spec"; then + func_replace_sysroot "$libdir" + libdir=$func_replace_sysroot_result + func_stripname '=' '' "$libdir" + libdir=$func_stripname_result if test -n "$hardcode_libdir_separator"; then if test -z "$hardcode_libdirs"; then hardcode_libdirs=$libdir @@ -8459,6 +8465,10 @@ EOF hardcode_libdirs= for libdir in $finalize_rpath; do if test -n "$hardcode_libdir_flag_spec"; then + func_replace_sysroot "$libdir" + libdir=$func_replace_sysroot_result + func_stripname '=' '' "$libdir" + libdir=$func_stripname_result if test -n "$hardcode_libdir_separator"; then if test -z "$hardcode_libdirs"; then hardcode_libdirs=$libdir -- 2.35.1
[PATCH v2 07/12] libtool: Check for static libs for internal compiler libraries
From: Khem Raj Libtool checks only for libraries linked as -l* when trying to find internal compiler libraries. Clang, however uses the absolute path to link its internal libraries e.g. compiler_rt. This patch handles clang's statically linked libraries when finding internal compiler libraries. Signed-off-by: Khem Raj Signed-off-by: Richard Purdie --- m4/libtool.m4 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/m4/libtool.m4 b/m4/libtool.m4 index d89a892f..5eac9228 100644 --- a/m4/libtool.m4 +++ b/m4/libtool.m4 @@ -7553,7 +7553,7 @@ if AC_TRY_EVAL(ac_compile); then for p in `eval "$output_verbose_link_cmd"`; do case $prev$p in --L* | -R* | -l*) +-L* | -R* | -l* | */libclang_rt.*.a) # Some compilers place space between "-{L,R}" and the path. # Remove the space. if test x-L = "$p" || -- 2.35.1
[PATCH v2 11/12] Makefile.am: make sure autoheader run before automake
From: Mingli Yu When use automake to generate Makefile.in from Makefile.am, there comes below race: | configure.ac:45: error: required file 'config-h.in' not found It is because the file config-h.in in updating process by autoheader, so make automake run after autoheader to avoid the above race. Signed-off-by: Mingli Yu Signed-off-by: Richard Purdie --- Makefile.am | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile.am b/Makefile.am index 16f7727e..eae4987e 100644 --- a/Makefile.am +++ b/Makefile.am @@ -333,7 +333,7 @@ EXTRA_DIST += $(lt_aclocal_m4) \ $(lt_obsolete_m4) \ $(stamp_mk) -$(lt_Makefile_in): $(lt_Makefile_am) $(lt_aclocal_m4) +$(lt_Makefile_in): $(lt_Makefile_am) $(lt_aclocal_m4) $(lt_config_h_in) $(AM_V_GEN)cd '$(srcdir)/$(ltdl_dir)' && $(AUTOMAKE) Makefile # Don't let unused scripts leak into the libltdl Makefile -- 2.35.1
[PATCH v2 04/12] ltmain.in: Don't encode RATHS which match default linker paths
From: Richard Purdie We don't want to add RPATHS which match default linker search paths, they're a waste of space. This patch filters libtools list of paths to encoode and removes the ones we don't need. Libtool may be passed link paths of the form "/usr/lib/../lib" so normalize the paths before comparision. Signed-off-by: Richard Purdie --- build-aux/ltmain.in | 34 -- 1 file changed, 28 insertions(+), 6 deletions(-) diff --git a/build-aux/ltmain.in b/build-aux/ltmain.in index bc0a3950..a4175d99 100644 --- a/build-aux/ltmain.in +++ b/build-aux/ltmain.in @@ -7700,8 +7700,16 @@ EOF esac fi else - eval flag=\"$hardcode_libdir_flag_spec\" - func_append dep_rpath " $flag" +# We only want to hardcode in an rpath if it isn't in the +# default dlsearch path. +func_normal_abspath "$libdir" +libdir_norm=$func_normal_abspath_result + case " $sys_lib_dlsearch_path " in + *" $libdir_norm "*) ;; + *) eval flag=\"$hardcode_libdir_flag_spec\" + func_append dep_rpath " $flag" + ;; + esac fi elif test -n "$runpath_var"; then case "$perm_rpath " in @@ -8434,8 +8442,16 @@ EOF esac fi else - eval flag=\"$hardcode_libdir_flag_spec\" - func_append rpath " $flag" +# We only want to hardcode in an rpath if it isn't in the +# default dlsearch path. +func_normal_abspath "$libdir" +libdir_norm=$func_normal_abspath_result + case " $sys_lib_dlsearch_path " in + *" $libdir_norm "*) ;; + *) eval flag=\"$hardcode_libdir_flag_spec\" + rpath+=" $flag" + ;; + esac fi elif test -n "$runpath_var"; then case "$perm_rpath " in @@ -8489,8 +8505,14 @@ EOF esac fi else - eval flag=\"$hardcode_libdir_flag_spec\" - func_append rpath " $flag" +# We only want to hardcode in an rpath if it isn't in the +# default dlsearch path. + case " $sys_lib_dlsearch_path " in + *" $libdir "*) ;; + *) eval flag=\"$hardcode_libdir_flag_spec\" + func_append rpath " $flag" + ;; + esac fi elif test -n "$runpath_var"; then case "$finalize_perm_rpath " in -- 2.35.1
[PATCH v2 06/12] Makefile.am: make sure autoheader run before autoconf
From: Mingli Yu autoheader will update ../libtool-2.4.6/libltdl/config-h.in which autoconf needs, so there comes a race sometimes as below: | configure.ac:45: error: required file 'config-h.in' not found | touch '../libtool-2.4.6/libltdl/config-h.in' So make sure autoheader run before autoconf to avoid this race. Signed-off-by: Mingli Yu Signed-off-by: Richard Purdie --- Makefile.am | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile.am b/Makefile.am index 7bd7f728..16f7727e 100644 --- a/Makefile.am +++ b/Makefile.am @@ -370,7 +370,7 @@ lt_configure_deps = $(lt_aclocal_m4) $(lt_aclocal_m4_deps) $(lt_aclocal_m4): $(lt_aclocal_m4_deps) $(AM_V_GEN)cd '$(srcdir)/$(ltdl_dir)' && $(ACLOCAL) -I ../m4 -$(lt_configure): $(lt_configure_deps) +$(lt_configure): $(lt_configure_deps) $(lt_config_h_in) $(AM_V_GEN)cd '$(srcdir)/$(ltdl_dir)' && $(AUTOCONF) $(lt_config_h_in): $(lt_configure_deps) -- 2.35.1
[PATCH v2 10/12] ltmain.in: Handle prefix-map compiler options correctly
From: Richard Purdie If lto is enabled, we need the prefix-map variables to be passed to the linker. Add these to the list of options libtool passes through. Signed-off-by: Richard Purdie --- build-aux/ltmain.in | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/build-aux/ltmain.in b/build-aux/ltmain.in index 2fa055ef..126b3097 100644 --- a/build-aux/ltmain.in +++ b/build-aux/ltmain.in @@ -5413,11 +5413,12 @@ func_mode_link () # -stdlib=*select c++ std lib with clang # -fsanitize=* Clang/GCC memory and address sanitizer # -fuse-ld=* Linker select flags for GCC + # -f*-prefix-map* needed for lto linking # -Wa,*Pass flags directly to the assembler -64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*| \ -t[45]*|-txscale*|-p|-pg|--coverage|-fprofile-*|-F*|@*|-tp=*|--sysroot=*| \ -O*|-g*|-flto*|-fwhopr*|-fuse-linker-plugin|-fstack-protector*|-stdlib=*| \ - -specs=*|-fsanitize=*|-fuse-ld=*|-Wa,*) + -specs=*|-fsanitize=*|-fuse-ld=*|-f*-prefix-map*) func_quote_arg pretty "$arg" arg=$func_quote_arg_result func_append compile_command " $arg" -- 2.35.1
[PATCH v2 09/12] libtool.m4: Handle "/" as a sysroot correctly
From: Richard Purdie Update libtool.m4 to resolve a problem with lt_sysroot not being properly updated if the option '--with[-libtool]-sysroot' is not provided when running the 'configure' script for a package so that "/" as a sysroot is handled correctly by libtool. Signed-off-by: Richard Purdie --- m4/libtool.m4 | 10 +++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/m4/libtool.m4 b/m4/libtool.m4 index 5eac9228..7d6a4564 100644 --- a/m4/libtool.m4 +++ b/m4/libtool.m4 @@ -1253,16 +1253,20 @@ dnl lt_sysroot will always be passed unquoted. We quote it here dnl in case the user passed a directory name. lt_sysroot= case $with_libtool_sysroot in #( - yes) + no) if test yes = "$GCC"; then lt_sysroot=`$CC --print-sysroot 2>/dev/null` + # Treat "/" the same a an unset sysroot. + if test "$lt_sysroot" = /; then + lt_sysroot= + fi fi ;; #( + yes|''|/) + ;; #( /*) lt_sysroot=`echo "$with_libtool_sysroot" | $SED -e "$sed_quote_subst"` ;; #( - no|'') - ;; #( *) AC_MSG_RESULT([$with_libtool_sysroot]) AC_MSG_ERROR([The sysroot must be an absolute path.]) -- 2.35.1
[PATCH v2 12/12] libtool: Fix support for NIOS2 processor
From: Marek Vasut The name of the system contains the string "nios2". This string is caught by the some of the greedy checks for OS/2 in libtool, in particular the *os2* branches of switch statements match for the nios2 string, which results in incorrect behavior of libtool. This patch adds an explicit check for *nios2* before the *os2* checks to prevent the OS/2 check incorrectly trapping the nios2 as well. Signed-off-by: Marek Vasut Signed-off-by: Richard Purdie --- build-aux/ltmain.in | 20 1 file changed, 20 insertions(+) diff --git a/build-aux/ltmain.in b/build-aux/ltmain.in index 126b3097..2acf1178 100644 --- a/build-aux/ltmain.in +++ b/build-aux/ltmain.in @@ -519,6 +519,12 @@ libtool_validate_options () test : = "$debug_cmd" || func_append preserve_args " --debug" case $host in + # For NIOS2, we want to make sure that it's not caught by the + # more general OS/2 check below. Otherwise, NIOS2 is the same + # as the default option. + *nios2*) +opt_duplicate_compiler_generated_deps=$opt_preserve_dup_deps +;; # Solaris2 added to fix http://debbugs.gnu.org/cgi/bugreport.cgi?bug=16452 # see also: http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59788 *cygwin* | *mingw* | *pw32* | *cegcc* | *solaris2* | *os2*) @@ -6275,6 +6281,15 @@ func_mode_link () if test -n "$library_names" && { test no = "$use_static_libs" || test -z "$old_library"; }; then case $host in + *nios2*) + # For NIOS2, we want to make sure that it's not caught by the + # more general OS/2 check below. Otherwise, NIOS2 is the same + # as the default option. + if test no = "$installed"; then + func_append notinst_deplibs " $lib" + need_relink=yes + fi + ;; *cygwin* | *mingw* | *cegcc* | *os2*) # No point in relinking DLLs because paths are not encoded func_append notinst_deplibs " $lib" @@ -6345,6 +6360,11 @@ func_mode_link () elif test -n "$soname_spec"; then # bleh windows case $host in + *nios2*) + # For NIOS2, we want to make sure that it's not caught by the + # more general OS/2 check below. Otherwise, NIOS2 is the same + # as the default option. + ;; *cygwin* | mingw* | *cegcc* | *os2*) func_arith $current - $age major=$func_arith_result -- 2.35.1
Re: [PATCH v2 00/12] Rebased version of Yocto patches
Can you separate the flag changes from the others? Since that's not backwards compatible it needs to be shelved for a future major release. There's similar flag changes I've been organizing into a pile. On Sat, Apr 16, 2022, 12:58 PM Sam James wrote: > Done after discussion w/ Alex (thanks!). Rebased on master after > 2.4.7 release. > > Khem Raj (3): > libtool.m4: Rename the --with-sysroot option to avoid conflict with > gcc/binutils > libtool: Check for static libs for internal compiler libraries > ltmain.in: Add missing sysroot to library path > > Marek Vasut (1): > libtool: Fix support for NIOS2 processor > > Mingli Yu (2): > Makefile.am: make sure autoheader run before autoconf > Makefile.am: make sure autoheader run before automake > > Richard Purdie (6): > ltmain.sh: Fix sysroot paths being encoded into RPATHs > ltmain.in: Handle trailing slashes on install commands correctly > libtool.m4: For reproducibility stop encoding hostname in libtool > script > ltmain.in: Don't encode RATHS which match default linker paths > libtool.m4: Handle "/" as a sysroot correctly > ltmain.in: Handle prefix-map compiler options correctly > > Makefile.am | 4 +-- > build-aux/ltmain.in | 81 +++-- > m4/libtool.m4 | 25 -- > tests/sysroot.at| 6 ++-- > 4 files changed, 89 insertions(+), 27 deletions(-) > > -- > 2.35.1 > >
Re: [PATCH v2 00/12] Rebased version of Yocto patches
My bad I just saw the follow up emails. You're all good. On Sat, Apr 16, 2022, 1:29 PM Alex Ameen wrote: > Can you separate the flag changes from the others? > Since that's not backwards compatible it needs to be shelved for a future > major release. There's similar flag changes I've been organizing into a > pile. > > On Sat, Apr 16, 2022, 12:58 PM Sam James wrote: > >> Done after discussion w/ Alex (thanks!). Rebased on master after >> 2.4.7 release. >> >> Khem Raj (3): >> libtool.m4: Rename the --with-sysroot option to avoid conflict with >> gcc/binutils >> libtool: Check for static libs for internal compiler libraries >> ltmain.in: Add missing sysroot to library path >> >> Marek Vasut (1): >> libtool: Fix support for NIOS2 processor >> >> Mingli Yu (2): >> Makefile.am: make sure autoheader run before autoconf >> Makefile.am: make sure autoheader run before automake >> >> Richard Purdie (6): >> ltmain.sh: Fix sysroot paths being encoded into RPATHs >> ltmain.in: Handle trailing slashes on install commands correctly >> libtool.m4: For reproducibility stop encoding hostname in libtool >> script >> ltmain.in: Don't encode RATHS which match default linker paths >> libtool.m4: Handle "/" as a sysroot correctly >> ltmain.in: Handle prefix-map compiler options correctly >> >> Makefile.am | 4 +-- >> build-aux/ltmain.in | 81 +++-- >> m4/libtool.m4 | 25 -- >> tests/sysroot.at| 6 ++-- >> 4 files changed, 89 insertions(+), 27 deletions(-) >> >> -- >> 2.35.1 >> >>
Re: [PATCH v2 01/12] ltmain.sh: Fix sysroot paths being encoded into RPATHs
This was all green down the line on the test suite on multiple systems ( don't get too excited yet ) until I found bugs in the testsuite... I see how this flew under the radar previously though - currently there are no tests which attempt to check RPATH or RUNPATH entries. I'll definitely be working on that... I'm going to be working out some M4 macros to abstract some functions like `lt_read_pheader([BIN], [ENTRY])', `lt_read_rpath([BIN])', and `lt_read_runpath([BIN])', so that those can be abstracted for handling non-ELF binaries. I'll make a test case to the effect of `readelf -d -W BIN|grep -v "$sysroot/";', if you have any additional input on new test cases let me know. You also helped me catch some bad regex in the existing sysroot tests that would cause them to never be run on a system which used '/' as their GCC sysroot ( all of dpkg's cross compilers seem to... ). So a big thank you for helping to catch all of these places that the tool can be improved. Naturally now that test cases aren't skipped they're red, so once I sanity check that they fail on the mainline branch I can move forward. I'm ~99% sure this patch will have no effect on those results. On 4/16/22 12:58, Sam James wrote: From: Richard Purdie There is a bug where RPATHs could end up containing sysroot values when cross compiling which is obviously incorrect. Strip out sysroot components from libdir when building RPATH values to avoid this. Signed-off-by: Richard Purdie --- build-aux/ltmain.in | 14 -- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/build-aux/ltmain.in b/build-aux/ltmain.in index a5f21a1d..d3a03a53 100644 --- a/build-aux/ltmain.in +++ b/build-aux/ltmain.in @@ -7676,9 +7676,11 @@ EOF test relink = "$opt_mode" || rpath=$compile_rpath$rpath for libdir in $rpath; do if test -n "$hardcode_libdir_flag_spec"; then + func_replace_sysroot "$libdir" + libdir=$func_replace_sysroot_result + func_stripname '=' '' "$libdir" + libdir=$func_stripname_result if test -n "$hardcode_libdir_separator"; then - func_replace_sysroot "$libdir" - libdir=$func_replace_sysroot_result if test -z "$hardcode_libdirs"; then hardcode_libdirs=$libdir else @@ -8408,6 +8410,10 @@ EOF hardcode_libdirs= for libdir in $compile_rpath $finalize_rpath; do if test -n "$hardcode_libdir_flag_spec"; then + func_replace_sysroot "$libdir" + libdir=$func_replace_sysroot_result + func_stripname '=' '' "$libdir" + libdir=$func_stripname_result if test -n "$hardcode_libdir_separator"; then if test -z "$hardcode_libdirs"; then hardcode_libdirs=$libdir @@ -8459,6 +8465,10 @@ EOF hardcode_libdirs= for libdir in $finalize_rpath; do if test -n "$hardcode_libdir_flag_spec"; then + func_replace_sysroot "$libdir" + libdir=$func_replace_sysroot_result + func_stripname '=' '' "$libdir" + libdir=$func_stripname_result if test -n "$hardcode_libdir_separator"; then if test -z "$hardcode_libdirs"; then hardcode_libdirs=$libdir