This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[2/8] Handle sysroots on AIX (needs build-system maintainer)
- From: Richard Sandiford <richards at transitive dot com>
- To: gcc-patches at gcc dot gnu dot org
- Date: Tue, 02 Jun 2009 13:10:14 +0100
- Subject: [2/8] Handle sysroots on AIX (needs build-system maintainer)
- References: <g44ouyhmgm.fsf@richards-desktop.transitives.com>
[Build or global write maintainer needed for point (2) below.]
This patch adds --sysroot support to the AIX configurations. There are
three changes:
(1) Add %R to absolute spec filenames (pretty trivial).
(2) Make TARGET_SYSTEM_ROOT available to the libgcc makefiles
(needed by (3)).
(3) Add $(TARGET_SYSTEM_ROOT) to absolute filenames in the t-aix*
libgcc fragments.
We used to assume that the syscall lists aren't available for cross builds:
#ifndef CROSS_DIRECTORY_STRUCTURE
#define LINK_LIBG_SPEC "-bexport:/usr/lib/libg.exp"
#else
#define LINK_LIBG_SPEC ""
#endif
But you can't really build anything useful without access to the core
libraries and syscall lists, so I think we should just drop this
behaviour and require --sysroot instead. I've therefore used the
!CROSS_DIRECTORY_STRUCTURE for cross builds too and applied (1) to it.
Tested on powerpc-ibm-aix6.1 and x86_64-linux-gnu. OK to install?
Richard
gcc/
* Makefile.in (libgcc.mvars): Add TARGET_SYSTEM_ROOT.
* config/rs6000/aix.h (LINK_SYSCALLS_SPEC): Add %R to the
!CROSS_DIRECTORY_STRUCTURE alternative and use it for
CROSS_DIRECTORY_STRUCTURE too.
(LINK_LIBG_SPEC): Likewise.
(LIB_SPEC): Add %R to sysroot paths.
* config/rs6000/aix43.h (CPP_SPEC): Add %R to sysroot paths.
(CPLUSPLUS_CPP_SPEC, LIB_SPEC): Likewise.
* config/rs6000/aix51.h: As for aix43.h.
* config/rs6000/aix52.h: Likewise.
* config/rs6000/aix53.h: Likewise.
* config/rs6000/aix61.h: Likewise.
* config/rs6000/t-aix52 (SHLIB_LINK): Add $(TARGET_SYSTEM_ROOT)
to the beginning of sysroot paths.
Index: gcc/Makefile.in
===================================================================
--- gcc/Makefile.in 2009-06-02 13:05:47.000000000 +0100
+++ gcc/Makefile.in 2009-06-02 13:06:03.000000000 +0100
@@ -1753,6 +1753,7 @@ libgcc.mvars: config.status Makefile $(L
echo CRTSTUFF_CFLAGS = '$(CRTSTUFF_CFLAGS)' >> tmp-libgcc.mvars
echo CRTSTUFF_T_CFLAGS = '$(CRTSTUFF_T_CFLAGS)' >> tmp-libgcc.mvars
echo CRTSTUFF_T_CFLAGS_S = '$(CRTSTUFF_T_CFLAGS_S)' >> tmp-libgcc.mvars
+ echo TARGET_SYSTEM_ROOT = '$(TARGET_SYSTEM_ROOT)' >> tmp-libgcc.mvars
mv tmp-libgcc.mvars libgcc.mvars
Index: gcc/config/rs6000/aix.h
===================================================================
--- gcc/config/rs6000/aix.h 2009-06-02 13:05:47.000000000 +0100
+++ gcc/config/rs6000/aix.h 2009-06-02 13:06:03.000000000 +0100
@@ -120,18 +120,10 @@ #define ASM_DEFAULT_SPEC ""
/* #define ASM_SPEC "-u %(asm_cpu)" */
/* Default location of syscalls.exp under AIX */
-#ifndef CROSS_DIRECTORY_STRUCTURE
-#define LINK_SYSCALLS_SPEC "-bI:/lib/syscalls.exp"
-#else
-#define LINK_SYSCALLS_SPEC ""
-#endif
+#define LINK_SYSCALLS_SPEC "-bI:%R/lib/syscalls.exp"
/* Default location of libg.exp under AIX */
-#ifndef CROSS_DIRECTORY_STRUCTURE
-#define LINK_LIBG_SPEC "-bexport:/usr/lib/libg.exp"
-#else
-#define LINK_LIBG_SPEC ""
-#endif
+#define LINK_LIBG_SPEC "-bexport:%R/usr/lib/libg.exp"
/* Define the options for the binder: Start text at 512, align all segments
to 512 bytes, and warn if there is text relocation.
@@ -152,8 +144,8 @@ #define LINK_SPEC "-T512 -H512 %{!r:-bte
%{!shared:%{g*: %(link_libg) }} %{shared:-bM:SRE}"
/* Profiled library versions are used by linking with special directories. */
-#define LIB_SPEC "%{pg:-L/lib/profiled -L/usr/lib/profiled}\
-%{p:-L/lib/profiled -L/usr/lib/profiled} %{!shared:%{g*:-lg}} -lc"
+#define LIB_SPEC "%{pg:-L%R/lib/profiled -L%R/usr/lib/profiled}\
+%{p:-L%R/lib/profiled -L%R/usr/lib/profiled} %{!shared:%{g*:-lg}} -lc"
/* Static linking with shared libstdc++ requires libsupc++ as well. */
#define LIBSTDCXX_STATIC "-lstdc++ -lsupc++"
Index: gcc/config/rs6000/aix43.h
===================================================================
--- gcc/config/rs6000/aix43.h 2009-06-02 13:05:47.000000000 +0100
+++ gcc/config/rs6000/aix43.h 2009-06-02 13:06:03.000000000 +0100
@@ -104,7 +104,7 @@ #define TARGET_OS_CPP_BUILTINS() \
#define CPP_SPEC "%{posix: -D_POSIX_SOURCE}\
%{ansi: -D_ANSI_C_SOURCE}\
%{maix64: -D__64BIT__}\
- %{mpe: -I/usr/lpp/ppe.poe/include}\
+ %{mpe: -I%R/usr/lpp/ppe.poe/include}\
%{pthread: -D_THREAD_SAFE}"
/* The GNU C++ standard library requires that these macros be
@@ -113,7 +113,7 @@ #define CPP_SPEC "%{posix: -D_POSIX_SOUR
#define CPLUSPLUS_CPP_SPEC \
"-D_ALL_SOURCE \
%{maix64: -D__64BIT__} \
- %{mpe: -I/usr/lpp/ppe.poe/include} \
+ %{mpe: -I%R/usr/lpp/ppe.poe/include} \
%{pthread: -D_THREAD_SAFE}"
#undef TARGET_DEFAULT
@@ -141,11 +141,11 @@ #define TARGET_ALTIVEC_ABI 0
#define MULTILIB_DEFAULTS { "mcpu=common" }
#undef LIB_SPEC
-#define LIB_SPEC "%{pg:-L/lib/profiled -L/usr/lib/profiled}\
- %{p:-L/lib/profiled -L/usr/lib/profiled}\
+#define LIB_SPEC "%{pg:-L%R/lib/profiled -L%R/usr/lib/profiled}\
+ %{p:-L%R/lib/profiled -L%R/usr/lib/profiled}\
%{!maix64:%{!shared:%{g*:-lg}}}\
- %{mpe:-L/usr/lpp/ppe.poe/lib -lmpi -lvtd}\
- %{pthread:-L/usr/lib/threads -lpthreads -lc_r /usr/lib/libc.a}\
+ %{mpe:-L%R/usr/lpp/ppe.poe/lib -lmpi -lvtd}\
+ %{pthread:-L%R/usr/lib/threads -lpthreads -lc_r %R/usr/lib/libc.a}\
%{!pthread:-lc}"
#undef LINK_SPEC
Index: gcc/config/rs6000/aix51.h
===================================================================
--- gcc/config/rs6000/aix51.h 2009-06-02 13:05:47.000000000 +0100
+++ gcc/config/rs6000/aix51.h 2009-06-02 13:06:03.000000000 +0100
@@ -101,7 +101,7 @@ #define TARGET_OS_CPP_BUILTINS() \
#define CPP_SPEC "%{posix: -D_POSIX_SOURCE} \
%{ansi: -D_ANSI_C_SOURCE} \
%{maix64: -D__64BIT__} \
- %{mpe: -I/usr/lpp/ppe.poe/include} \
+ %{mpe: -I%R/usr/lpp/ppe.poe/include} \
%{pthread: -D_THREAD_SAFE}"
/* The GNU C++ standard library requires that these macros be
@@ -110,7 +110,7 @@ #define CPP_SPEC "%{posix: -D_POSIX_SOUR
#define CPLUSPLUS_CPP_SPEC \
"-D_ALL_SOURCE \
%{maix64: -D__64BIT__} \
- %{mpe: -I/usr/lpp/ppe.poe/include} \
+ %{mpe: -I%R/usr/lpp/ppe.poe/include} \
%{pthread: -D_THREAD_SAFE}"
#undef TARGET_DEFAULT
@@ -138,10 +138,10 @@ #define TARGET_ALTIVEC_ABI 0
#define MULTILIB_DEFAULTS { "mcpu=common" }
#undef LIB_SPEC
-#define LIB_SPEC "%{pg:-L/lib/profiled -L/usr/lib/profiled}\
- %{p:-L/lib/profiled -L/usr/lib/profiled}\
+#define LIB_SPEC "%{pg:-L%R/lib/profiled -L%R/usr/lib/profiled}\
+ %{p:-L%R/lib/profiled -L%R/usr/lib/profiled}\
%{!maix64:%{!shared:%{g*:-lg}}}\
- %{mpe:-L/usr/lpp/ppe.poe/lib -lmpi -lvtd}\
+ %{mpe:-L%R/usr/lpp/ppe.poe/lib -lmpi -lvtd}\
%{pthread:-lpthreads} -lc"
#undef LINK_SPEC
Index: gcc/config/rs6000/aix52.h
===================================================================
--- gcc/config/rs6000/aix52.h 2009-06-02 13:05:47.000000000 +0100
+++ gcc/config/rs6000/aix52.h 2009-06-02 13:06:03.000000000 +0100
@@ -99,7 +99,7 @@ #define TARGET_OS_CPP_BUILTINS() \
#define CPP_SPEC "%{posix: -D_POSIX_SOURCE} \
%{ansi: -D_ANSI_C_SOURCE} \
%{maix64: -D__64BIT__} \
- %{mpe: -I/usr/lpp/ppe.poe/include} \
+ %{mpe: -I%R/usr/lpp/ppe.poe/include} \
%{pthread: -D_THREAD_SAFE}"
/* The GNU C++ standard library requires that these macros be
@@ -108,7 +108,7 @@ #define CPP_SPEC "%{posix: -D_POSIX_SOUR
#define CPLUSPLUS_CPP_SPEC \
"-D_ALL_SOURCE \
%{maix64: -D__64BIT__} \
- %{mpe: -I/usr/lpp/ppe.poe/include} \
+ %{mpe: -I%R/usr/lpp/ppe.poe/include} \
%{pthread: -D_THREAD_SAFE}"
#undef TARGET_DEFAULT
@@ -140,10 +140,10 @@ #define TARGET_ALTIVEC_ABI 0
#undef MULTILIB_DEFAULTS
#undef LIB_SPEC
-#define LIB_SPEC "%{pg:-L/lib/profiled -L/usr/lib/profiled}\
- %{p:-L/lib/profiled -L/usr/lib/profiled}\
+#define LIB_SPEC "%{pg:-L%R/lib/profiled -L%R/usr/lib/profiled}\
+ %{p:-L%R/lib/profiled -L%R/usr/lib/profiled}\
%{!maix64:%{!shared:%{g*:-lg}}}\
- %{mpe:-L/usr/lpp/ppe.poe/lib -lmpi -lvtd}\
+ %{mpe:-L%R/usr/lpp/ppe.poe/lib -lmpi -lvtd}\
%{pthread:-lpthreads} -lc"
#undef LINK_SPEC
Index: gcc/config/rs6000/aix53.h
===================================================================
--- gcc/config/rs6000/aix53.h 2009-06-02 13:05:47.000000000 +0100
+++ gcc/config/rs6000/aix53.h 2009-06-02 13:06:03.000000000 +0100
@@ -101,7 +101,7 @@ #define TARGET_OS_CPP_BUILTINS() \
#define CPP_SPEC "%{posix: -D_POSIX_SOURCE} \
%{ansi: -D_ANSI_C_SOURCE} \
%{maix64: -D__64BIT__} \
- %{mpe: -I/usr/lpp/ppe.poe/include} \
+ %{mpe: -I%R/usr/lpp/ppe.poe/include} \
%{pthread: -D_THREAD_SAFE}"
/* The GNU C++ standard library requires that these macros be
@@ -110,7 +110,7 @@ #define CPP_SPEC "%{posix: -D_POSIX_SOUR
#define CPLUSPLUS_CPP_SPEC \
"-D_ALL_SOURCE \
%{maix64: -D__64BIT__} \
- %{mpe: -I/usr/lpp/ppe.poe/include} \
+ %{mpe: -I%R/usr/lpp/ppe.poe/include} \
%{pthread: -D_THREAD_SAFE}"
#undef TARGET_DEFAULT
@@ -136,10 +136,10 @@ #define TARGET_POWER 0
#undef MULTILIB_DEFAULTS
#undef LIB_SPEC
-#define LIB_SPEC "%{pg:-L/lib/profiled -L/usr/lib/profiled}\
- %{p:-L/lib/profiled -L/usr/lib/profiled}\
+#define LIB_SPEC "%{pg:-L%R/lib/profiled -L%R/usr/lib/profiled}\
+ %{p:-L%R/lib/profiled -L%R/usr/lib/profiled}\
%{!maix64:%{!shared:%{g*:-lg}}}\
- %{mpe:-L/usr/lpp/ppe.poe/lib -lmpi -lvtd}\
+ %{mpe:-L%R/usr/lpp/ppe.poe/lib -lmpi -lvtd}\
%{pthread:-lpthreads} -lc"
#undef LINK_SPEC
Index: gcc/config/rs6000/aix61.h
===================================================================
--- gcc/config/rs6000/aix61.h 2009-06-02 13:05:47.000000000 +0100
+++ gcc/config/rs6000/aix61.h 2009-06-02 13:06:03.000000000 +0100
@@ -102,7 +102,7 @@ #define TARGET_OS_CPP_BUILTINS() \
#define CPP_SPEC "%{posix: -D_POSIX_SOURCE} \
%{ansi: -D_ANSI_C_SOURCE} \
%{maix64: -D__64BIT__} \
- %{mpe: -I/usr/lpp/ppe.poe/include} \
+ %{mpe: -I%R/usr/lpp/ppe.poe/include} \
%{pthread: -D_THREAD_SAFE}"
/* The GNU C++ standard library requires that these macros be
@@ -111,7 +111,7 @@ #define CPP_SPEC "%{posix: -D_POSIX_SOUR
#define CPLUSPLUS_CPP_SPEC \
"-D_ALL_SOURCE -D__COMPATMATH__ \
%{maix64: -D__64BIT__} \
- %{mpe: -I/usr/lpp/ppe.poe/include} \
+ %{mpe: -I%R/usr/lpp/ppe.poe/include} \
%{pthread: -D_THREAD_SAFE}"
#undef TARGET_DEFAULT
@@ -137,10 +137,10 @@ #define TARGET_POWER 0
#undef MULTILIB_DEFAULTS
#undef LIB_SPEC
-#define LIB_SPEC "%{pg:-L/lib/profiled -L/usr/lib/profiled}\
- %{p:-L/lib/profiled -L/usr/lib/profiled}\
+#define LIB_SPEC "%{pg:-L%R/lib/profiled -L%R/usr/lib/profiled}\
+ %{p:-L%R/lib/profiled -L%R/usr/lib/profiled}\
%{!maix64:%{!shared:%{g*:-lg}}}\
- %{mpe:-L/usr/lpp/ppe.poe/lib -lmpi -lvtd}\
+ %{mpe:-L%R/usr/lpp/ppe.poe/lib -lmpi -lvtd}\
%{pthread:-lpthreads} -lc"
#undef LINK_SPEC
Index: gcc/config/rs6000/t-aix52
===================================================================
--- gcc/config/rs6000/t-aix52 2009-06-02 13:05:47.000000000 +0100
+++ gcc/config/rs6000/t-aix52 2009-06-02 13:06:03.000000000 +0100
@@ -47,7 +47,7 @@ SHLIB_LINK = $(GCC_FOR_TARGET) $(LIBGCC2
-Wl,-bE:@shlib_map_file@ -o @multilib_dir@/shr.o \
@multilib_flags@ @shlib_objs@ -lc \
`case @multilib_dir@ in \
- *pthread*) echo -L/usr/lib/threads -lpthreads -lc_r /usr/lib/libc.a ;; \
+ *pthread*) echo -L$(TARGET_SYSTEM_ROOT)/usr/lib/threads -lpthreads -lc_r $(TARGET_SYSTEM_ROOT)/usr/lib/libc.a ;; \
*) echo -lc ;; esac` ; \
rm -f @multilib_dir@/tmp-@shlib_base_name@.a ; \
$(AR_CREATE_FOR_TARGET) @multilib_dir@/tmp-@shlib_base_name@.a \