[PATCHv2] Change the library search path when using --with-advance-toolchain
diff mbox series

Message ID 20191004213134.8417-1-tuliom@linux.ibm.com
State New
Headers show
Series
  • [PATCHv2] Change the library search path when using --with-advance-toolchain
Related show

Commit Message

Tulio Magno Quites Machado Filho Oct. 4, 2019, 9:31 p.m. UTC
Michael Meissner <meissner@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  <tuliom@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(-)

Comments

Segher Boessenkool Oct. 5, 2019, 5:20 p.m. UTC | #1
On Fri, Oct 04, 2019 at 06:31:34PM -0300, Tulio Magno Quites Machado Filho wrote:
> 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.

This is fine, approved for all branches.  Thank you!  And thanks to Mike
for the testing.


Segher


> 2019-10-04  Tulio Magno Quites Machado Filho  <tuliom@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.
Michael Meissner Oct. 7, 2019, 8:46 p.m. UTC | #2
On Fri, Oct 04, 2019 at 06:31:34PM -0300, Tulio Magno Quites Machado Filho wrote:
> Michael Meissner <meissner@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.

Once I fixed the perl script to remove the extra -L's from the spec config.cfg
file that the perl script had put in for the previous version of
--with-advance-toolchain=<xxx>, I was able to link one of the problematical
benchmarks (2017 roms_r in this case).
Segher Boessenkool Oct. 8, 2019, 3:10 p.m. UTC | #3
On Fri, Oct 04, 2019 at 06:31:34PM -0300, Tulio Magno Quites Machado Filho wrote:
> 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  <tuliom@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.

Committed ( https://gcc.gnu.org/r276702 ).  Thanks!


Segher
Peter Bergner Oct. 23, 2019, 9:47 p.m. UTC | #4
On 10/5/19 12:20 PM, Segher Boessenkool wrote:
> On Fri, Oct 04, 2019 at 06:31:34PM -0300, Tulio Magno Quites Machado Filho wrote:
>> 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.
> 
> This is fine, approved for all branches.  Thank you!  And thanks to Mike
> for the testing.

I've committed the back ports to the FSF 7, 8 and 9 branches now after
clean bootstraps and regtesting.

Peter

Patch
diff mbox series

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"