]> git.ipfire.org Git - thirdparty/libtool.git/commitdiff
libtool: Pass the "-no-canonical-prefixes" linker flag
authorIleana Dumitrescu <ileanadumitrescu95@gmail.com>
Thu, 18 Apr 2024 16:26:55 +0000 (19:26 +0300)
committerIleana Dumitrescu <ileanadumitrescu95@gmail.com>
Thu, 18 Apr 2024 16:26:55 +0000 (19:26 +0300)
When using the -no-canonical-prefixes flag in libtool, the flag is
removed from the linking command, causing linking to fail. This adds
the flag to the list of linker flags to be passed through to the
linker.

* build-aux/ltmain.in: Pass -no-canonical-prefixes to the linker.
* Makefile.am: Added in tests/bug_62343.at.
* tests/bug_62343.at: Contains test case for bug 62343.

Makefile.am
build-aux/ltmain.in
tests/bug_62343.at [new file with mode: 0644]

index 904f3d73fc89ec0726655e6a302350c2bdc3539f..8cc621ea41a6a63e4dbe6bbb2847853b1cf58054 100644 (file)
@@ -727,6 +727,7 @@ TESTSUITE_AT        = tests/testsuite.at \
                  tests/sysroot.at \
                  tests/stresstest.at \
                  tests/cmdline_wrap.at \
+                 tests/bug_62343.at    \
                  $(NOTHING_ELSE)
 
 EXTRA_DIST     += $(testsuite) $(TESTSUITE_AT) $(package_m4)
index 090a4fe8ad1af333e3fdf961c01e07982cbf9e2e..8f10942736feb3e02c42e4c2f24674f86b88c789 100644 (file)
@@ -5412,6 +5412,7 @@ func_mode_link ()
       # -fno-sanitize*       Clang/GCC memory and address sanitizer
       # -shared-libsan       Link with shared sanitizer runtimes (Clang)
       # -static-libsan       Link with static sanitizer runtimes (Clang)
+      # -no-canonical-prefixes Do not expand any symbolic links
       # -fuse-ld=*           Linker select flags for GCC
       # -rtlib=*             select c runtime lib with clang
       # --unwindlib=*        select unwinder library with clang
@@ -5420,7 +5421,7 @@ func_mode_link ()
       # -Werror, -Werror=*   Report (specified) warnings as errors
       -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*| \
+      -O*|-g*|-flto*|-fwhopr*|-fuse-linker-plugin|-fstack-protector*|-no-canonical-prefixes| \
       -stdlib=*|-rtlib=*|--unwindlib=*| \
       -specs=*|-fsanitize=*|-fno-sanitize*|-shared-libsan|-static-libsan| \
       -ffile-prefix-map=*|-fdebug-prefix-map=*|-fmacro-prefix-map=*|-fprofile-prefix-map=*| \
diff --git a/tests/bug_62343.at b/tests/bug_62343.at
new file mode 100644 (file)
index 0000000..385cc41
--- /dev/null
@@ -0,0 +1,40 @@
+# bug_62343.at -- bug 62343   -*- Autotest -*-
+
+#   Copyright (C) 2010-2019, 2021-2024 Free Software Foundation, Inc.
+#
+#   This file is part of GNU Libtool.
+#
+# GNU Libtool is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License as
+# published by the Free Software Foundation; either version 2 of
+# the License, or (at your option) any later version.
+#
+# GNU Libtool is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with GNU Libtool; see the file COPYING.  If not, a copy
+# can be downloaded from  http://www.gnu.org/licenses/gpl.html,
+# or obtained by writing to the Free Software Foundation, Inc.,
+# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+####
+
+AT_BANNER([Testing bug 62343:])
+
+AT_SETUP([Use -no-canonical-prefixes flag])
+
+AT_DATA([x.cpp],
+[[
+void f(int *p) { *p = 21; }
+]])
+
+
+AT_CHECK([$LIBTOOL --mode=compile --tag=CXX g++ -c x.cpp], [0], [stdout], [stderr])
+
+AT_CHECK([$LIBTOOL --mode=link --tag=CXX g++ -o libx.la -no-canonical-prefixes -rpath /usr/lib64/ x.lo], [0], [stdout], [stderr])
+
+AT_CHECK([$GREP -- '-no-canonical-prefixes' stdout], [0], [ignore])
+
+AT_CLEANUP