[PATCH] ldscript: Omit exec_prefix from SEARCH_DIR when sysroot is specified
Jan Beulich
jbeulich@suse.com
Thu Jul 3 14:57:23 GMT 2025
On 03.07.2025 16:51, Mark Goncharov wrote:
> Ping
>
> * jimw@sifive.com
> * amodra@gmail.com
>
> ________________________________
> From: Mark Goncharov
> Sent: 01 July 2025 09:05:44
I'm sorry to say that, but aren't you a little too quick with your pings?
Give it a week at least, I would say. Unless it's a really, really critical
problem you're fixing.
Jan
> To: binutils@sourceware.org
> Cc: Mark Goncharov
> Subject: [PATCH] ldscript: Omit exec_prefix from SEARCH_DIR when sysroot is specified
>
> The libpath value directly influences the SEARCH_DIR entries in the generated linker scripts.
> When creating entries with SEARCH_DIR("=/[path]"), the linker automatically substitutes the sysroot path for the '=' symbol.
> As a result, when building with the --with-sysroot flag specified, explicitly adding exec_prefix to the library search path becomes incorrectly.
>
> Signed-off-by: Mark Goncharov <mark.goncharov@syntacore.com>
> ---
> ld/genscripts.sh | 9 ++++++---
> 1 file changed, 6 insertions(+), 3 deletions(-)
>
> diff --git a/ld/genscripts.sh b/ld/genscripts.sh
> index 77a1fb465ad..c2f230a6434 100755
> --- a/ld/genscripts.sh
> +++ b/ld/genscripts.sh
> @@ -248,9 +248,12 @@ append_to_lib_path()
> # except when LIBPATH=":".
> if [ "${LIB_PATH}" != ":" ] ; then
> libs=
> + if [ "x${use_sysroot}" != "xyes" ] ; then
> + libpath_exec_prefix="${exec_prefix}/"
> + fi
> if [ "x${TOOL_LIB}" = "x" ] ; then
> if [ "x${NATIVE}" = "xyes" ] ; then
> - libs="${exec_prefix}/${target_alias}/lib"
> + libs="${libpath_exec_prefix}/${target_alias}/lib"
> fi
> else
> # For multilib'ed targets, ensure both ${target_alias}/lib${LIBPATH_SUFFIX}
> @@ -261,10 +264,10 @@ if [ "${LIB_PATH}" != ":" ] ; then
> for libpath_suffix in ${LIBPATH_SUFFIX}; do
> case "${NATIVE}:${libpath_suffix}:${TOOL_LIB}" in
> :* | *::* | *:*:*${libpath_suffix}) ;;
> - *) libs="${exec_prefix}/${target_alias}/lib${libpath_suffix}" ;;
> + *) libs="${libpath_exec_prefix}/${target_alias}/lib${libpath_suffix}" ;;
> esac
> done
> - libs="${exec_prefix}/${TOOL_LIB}/lib ${libs}"
> + libs="${libpath_exec_prefix}/${TOOL_LIB}/lib ${libs}"
> fi
> append_to_lib_path ${libs}
> fi
> --
> 2.43.0
>
>
More information about the Binutils
mailing list