diff options
author | Joel Holdsworth <jholdsworth@nvidia.com> | 2022-02-24 15:33:06 +0000 |
---|---|---|
committer | Chris Packham <judge.packham@gmail.com> | 2022-05-11 20:25:42 +1200 |
commit | fd694dde63635183a0496600e40e7930060f1cb0 (patch) | |
tree | 709902c994c042a6176b6d92b80df9ec40cd7e89 /scripts | |
parent | d10a4318ace8f0e668e23b919195d63a9478171c (diff) | |
download | crosstool-ng-fd694dde63635183a0496600e40e7930060f1cb0.tar.gz crosstool-ng-fd694dde63635183a0496600e40e7930060f1cb0.tar.bz2 crosstool-ng-fd694dde63635183a0496600e40e7930060f1cb0.zip |
cc/gcc: Create liblto_plugin symbolic link with correct extension
Previously, cc/gcc.sh assumed that liblto_plugin would always be
installed with the ".so" file extension. However, this assumption is
incorrect when the host machine is Windows (".dll") or MacOS (".dylib").
This patch corrects this issue by probing the file extension in similar
fashion to the way adjacent code determines the file extension of
executable binaries.
Signed-off-by: Joel Holdsworth <jholdsworth@nvidia.com>
Diffstat (limited to 'scripts')
-rw-r--r-- | scripts/build/cc/gcc.sh | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/scripts/build/cc/gcc.sh b/scripts/build/cc/gcc.sh index 2b7779a6..e32fcd0f 100644 --- a/scripts/build/cc/gcc.sh +++ b/scripts/build/cc/gcc.sh @@ -718,8 +718,12 @@ do_gcc_core_backend() { # If binutils want the LTO plugin, point them to it if [ -d "${CT_PREFIX_DIR}/lib/bfd-plugins" -a "${build_step}" = "gcc_host" ]; then local gcc_version=$(cat "${CT_SRC_DIR}/gcc/gcc/BASE-VER" ) - CT_DoExecLog ALL ln -sfv "../../libexec/gcc/${CT_TARGET}/${gcc_version}/liblto_plugin.so" \ - "${CT_PREFIX_DIR}/lib/bfd-plugins/liblto_plugin.so" + local plugins_dir="libexec/gcc/${CT_TARGET}/${gcc_version}" + file="$( ls -1 "${CT_PREFIX_DIR}/${plugins_dir}/liblto_plugin."* 2>/dev/null | \ + sort | head -n1 || true )" + [ -z "${file}" ] && ext="" || ext=".${file##*.}" + CT_DoExecLog ALL ln -sfv "../../${plugins_dir}/liblto_plugin${ext}" \ + "${CT_PREFIX_DIR}/lib/bfd-plugins/liblto_plugin${ext}" fi } @@ -1269,7 +1273,11 @@ do_gcc_backend() { # If binutils want the LTO plugin, point them to it if [ -d "${CT_PREFIX_DIR}/lib/bfd-plugins" -a "${build_step}" = "gcc_host" ]; then local gcc_version=$(cat "${CT_SRC_DIR}/gcc/gcc/BASE-VER" ) - CT_DoExecLog ALL ln -sfv "../../libexec/gcc/${CT_TARGET}/${gcc_version}/liblto_plugin.so" \ - "${CT_PREFIX_DIR}/lib/bfd-plugins/liblto_plugin.so" + local plugins_dir="libexec/gcc/${CT_TARGET}/${gcc_version}" + file="$( ls -1 "${CT_PREFIX_DIR}/${plugins_dir}/liblto_plugin."* 2>/dev/null | \ + sort | head -n1 || true )" + [ -z "${file}" ] && ext="" || ext=".${file##*.}" + CT_DoExecLog ALL ln -sfv "../../${plugins_dir}/liblto_plugin${ext}" \ + "${CT_PREFIX_DIR}/lib/bfd-plugins/liblto_plugin${ext}" fi } |