Re: [PATCH v2 01/12] ltmain.sh: Fix sysroot paths being encoded into RPATHs
Alex Ameen <[email protected]> Sat, 16 Apr 2022 23:55:56 -0500
| Newsgroups | gmane.comp.gnu.libtool.patches |
|---|---|
| Message-ID | <[email protected]> |
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 <[email protected]> > > 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 <[email protected]> > --- > 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