[v4,RESEND,2/2] libgcc: Dont use TARGET_SYSTEM_ROOT from gcc
Commit Message
Following Andrew Pinski's suggestions in
https://gcc.gnu.org/pipermail/gcc-patches/2025-July/689683.html, just
use the output of:
$(CC) -print-sysroot
It is just used in one spot, in an AIX code-path. I just made (within
make) a shell variable to use instead.
I don't have AIX on-hand to test this, however.
gcc/ChangeLog:
* Makefile.in: No longer include TARGET_SYSTEM_ROOT in
libgcc.mvars.
libgcc/ChangeLog:
* config/rs6000/t-slibgcc-aix: Instead of using a
TARGET_SYSTEM_ROOT make variable, just define a shell variable
as part of the rule and use that.
Suggested-by: Andrew Pinski <quic_apinski@quicinc.com>
Signed-off-by: John Ericson <git@JohnEricson.me>
---
gcc/Makefile.in | 1 -
libgcc/config/rs6000/t-slibgcc-aix | 8 ++++++--
2 files changed, 6 insertions(+), 3 deletions(-)
Comments
On Sun, 7 Dec 2025, John Ericson wrote:
> Following Andrew Pinski's suggestions in
> https://gcc.gnu.org/pipermail/gcc-patches/2025-July/689683.html, just
> use the output of:
>
> $(CC) -print-sysroot
>
> It is just used in one spot, in an AIX code-path. I just made (within
> make) a shell variable to use instead.
>
> I don't have AIX on-hand to test this, however.
This is another patch I already approved in July in the absence of more
specific maintainer objections.
@@ -2503,7 +2503,6 @@ libgcc.mvars: config.status Makefile specs xgcc$(exeext)
: > tmp-libgcc.mvars
echo GCC_CFLAGS = '$(GCC_CFLAGS)' >> tmp-libgcc.mvars
echo INHIBIT_LIBC_CFLAGS = '$(INHIBIT_LIBC_CFLAGS)' >> tmp-libgcc.mvars
- echo TARGET_SYSTEM_ROOT = '$(TARGET_SYSTEM_ROOT)' >> tmp-libgcc.mvars
mv tmp-libgcc.mvars libgcc.mvars
@@ -40,7 +40,9 @@ SHLIB_LINK = \
-Wl,-bE:@shlib_map_file@ -o shr.o \
@multilib_flags@ @shlib_objs@ -lc \
`case @multilib_dir@ in \
- *pthread*) echo -L$(TARGET_SYSTEM_ROOT)/usr/lib/threads -lpthreads -lc_r $(TARGET_SYSTEM_ROOT)/usr/lib/libc.a ;; \
+ *pthread*) \
+ TARGET_SYSTEM_ROOT=\`$(CC) -print-sysroot\`; \
+ echo -L$$TARGET_SYSTEM_ROOT/usr/lib/threads -lpthreads -lc_r $$TARGET_SYSTEM_ROOT/usr/lib/libc.a ;; \
*) echo -lc ;; esac` ; \
rm -f tmp-@shlib_base_name@.a ; \
$(AR_CREATE_FOR_TARGET) tmp-@shlib_base_name@.a shr.o ; \
@@ -53,7 +55,9 @@ SHLIB_LINK = \
-Wl,-bE:@shlib_map_file@ -o $$shr.o \
@multilib_flags@ @shlib_objs@ -lc \
`case @multilib_dir@ in \
- *pthread*) echo -L$(TARGET_SYSTEM_ROOT)/usr/lib/threads -lpthreads -lc_r $(TARGET_SYSTEM_ROOT)/usr/lib/libc.a ;; \
+ *pthread*) \
+ TARGET_SYSTEM_ROOT=\`$(CC) -print-sysroot\`; \
+ echo -L$$TARGET_SYSTEM_ROOT/usr/lib/threads -lpthreads -lc_r $$TARGET_SYSTEM_ROOT/usr/lib/libc.a ;; \
*) echo -lc ;; esac` ; \
$(STRIP_FOR_TARGET) -X32_64 -e $$shr.o ; \
{ echo "\#! $(SHLIB_SONAME)($$shr.o)" ; \