Michael Meissner <meiss...@linux.ibm.com> writes:

> And then I built Spec 2006 and 2017 with my normal options on a power8 system
> running Ubuntu and an older set of host libraries.  If I have this patch
> installed, it breaks linking some/all of the C++ and Fortran benchmarks,
> because it finds the host C++/Fortran libraries before the AT 12.0 libraries.

You have an usecase where the compiler has a different prefix.
That requires an extra library directory, but it still has to come after
the user lib directory.

---8<---

Remove all -L directories from LINK_OS_EXTRA_SPEC32 and
LINK_OS_EXTRA_SPEC64 so that user directories specified at
build time have higher preference over the advance toolchain libraries.

Set MD_STARTFILE_PREFIX to $prefix/lib/ and MD_STARTFILE_PREFIX_1 to
$at/lib/ so that a compiler library has preference over the Advance
Toolchain libraries.

2019-10-04  Tulio Magno Quites Machado Filho  <tul...@linux.ibm.com>

        * config.gcc: Move -L usage from LINK_OS_EXTRA_SPEC32 and
        LINK_OS_EXTRA_SPEC64 to MD_STARTFILE_PREFIX and
        MD_STARTFILE_PREFIX_1 when using --with-advance-toolchain.
---
 gcc/config.gcc | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/gcc/config.gcc b/gcc/config.gcc
index 481bc9586a7..511aeb454bf 100644
--- a/gcc/config.gcc
+++ b/gcc/config.gcc
@@ -4782,14 +4782,12 @@ case "${target}" in
                         echo "#undef  LINK_OS_EXTRA_SPEC32"
                         echo "#define LINK_OS_EXTRA_SPEC32" \
                              "\"%(link_os_new_dtags)" \
-                             "-rpath $prefix/lib -rpath $at/lib" \
-                             "-L $prefix/lib -L $at/lib\""
+                             "-rpath $prefix/lib -rpath $at/lib\""
                         echo
                         echo "#undef  LINK_OS_EXTRA_SPEC64"
                         echo "#define LINK_OS_EXTRA_SPEC64" \
                              "\"%(link_os_new_dtags)" \
-                             "-rpath $prefix/lib64 -rpath $at/lib64" \
-                             "-L $prefix/lib64 -L $at/lib64\""
+                             "-rpath $prefix/lib64 -rpath $at/lib64\""
                         echo
                         echo "#undef  LINK_OS_NEW_DTAGS_SPEC"
                         echo "#define LINK_OS_NEW_DTAGS_SPEC" \
@@ -4802,7 +4800,10 @@ case "${target}" in
                         echo "#define MD_EXEC_PREFIX \"$at/bin/\""
                         echo
                         echo "#undef  MD_STARTFILE_PREFIX"
-                        echo "#define MD_STARTFILE_PREFIX \"$at/lib/\"") \
+                        echo "#define MD_STARTFILE_PREFIX \"$prefix/lib/\""
+                        echo
+                        echo "#undef  MD_STARTFILE_PREFIX_1"
+                        echo "#define MD_STARTFILE_PREFIX_1 \"$at/lib/\"") \
                            > advance-toolchain.h
                    else
                        echo "Unknown advance-toolchain $with_advance_toolchain"
-- 
2.14.5

Reply via email to