Patchwork powerpc64le-linux support

login
register
mail settings
Submitter Alan Modra
Date May 6, 2013, 2:59 a.m.
Message ID <20130506025924.GA5221@bubble.grove.modra.org>
Download mbox | patch
Permalink /patch/241550/
State New
Headers show

Comments

Alan Modra - May 6, 2013, 2:59 a.m.
On Sun, May 05, 2013 at 04:09:30PM +0930, Alan Modra wrote:
> 	* config/rs6000/sysv4.h (ENDIAN_SELECT): Define, extracted from
> 	(ASM_SPEC): ..here.  Emit DEFAULT_ASM_ENDIAN too.
> 	(DEFAULT_ASM_ENDIAN): Define.
> 	(CC1_SPEC, LINK_TARGET_SPEC): Use ENDIAN_SELECT.
> 	* config/rs6000/linux64.h (ASM_SPEC32): Remove endian options.
> 	Update -K PIC clause from sysv4.h.
> 	(ASM_SPEC_COMMON): Use ENDIAN_SELECT.
> 	(LINK_OS_LINUX_EMUL32, LINK_OS_LINUX_EMUL64): Likewise.

I managed to get the powerpc64le gas default endian select wrong, and
missed some places that ought to be using ENDIAN_SELECT.  Committing
as obvious.

	* config/rs6000/linux.h (DEFAULT_ASM_ENDIAN): Define.
	(LINK_OS_LINUX_EMUL): Use ENDIAN_SELECT.
	* config/rs6000/linux64.h (DEFAULT_ASM_ENDIAN): Define.
	* config/rs6000/sysv4le.h (DEFAULT_ASM_ENDIAN): Define.
	(LINK_TARGET_SPEC): Use ENDIAN_SELECT.
	* config/rs6000/sysv4.h (DEFAULT_ASM_ENDIAN): Define as -mbig.

Patch

Index: gcc/config/rs6000/linux.h
===================================================================
--- gcc/config/rs6000/linux.h	(revision 198619)
+++ gcc/config/rs6000/linux.h	(working copy)
@@ -79,10 +79,17 @@ 
 #undef	LINK_OS_DEFAULT_SPEC
 #define LINK_OS_DEFAULT_SPEC "%(link_os_linux)"
 
+#undef  DEFAULT_ASM_ENDIAN
 #if (TARGET_DEFAULT & MASK_LITTLE_ENDIAN)
-#define LINK_OS_LINUX_EMUL "%{!mbig: %{!mbig-endian: -m elf32lppclinux}}%{mbig|mbig-endian: -m elf32ppclinux}"
+#define DEFAULT_ASM_ENDIAN " -mlittle"
+#define LINK_OS_LINUX_EMUL ENDIAN_SELECT(" -m elf32ppclinux",	\
+					 " -m elf32lppclinux",	\
+					 " -m elf32lppclinux")
 #else
-#define LINK_OS_LINUX_EMUL "%{!mlittle: %{!mlittle-endian: -m elf32ppclinux}}%{mlittle|mlittle-endian: -m elf32lppclinux}"
+#define DEFAULT_ASM_ENDIAN " -mbig"
+#define LINK_OS_LINUX_EMUL ENDIAN_SELECT(" -m elf32ppclinux",	\
+					 " -m elf32lppclinux",	\
+					 " -m elf32ppclinux")
 #endif
 
 #undef LINK_OS_LINUX_SPEC
Index: gcc/config/rs6000/linux64.h
===================================================================
--- gcc/config/rs6000/linux64.h	(revision 198619)
+++ gcc/config/rs6000/linux64.h	(working copy)
@@ -366,7 +375,9 @@ 
 #define GNU_USER_DYNAMIC_LINKER64 \
   CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKER64, UCLIBC_DYNAMIC_LINKER64)
 
+#undef  DEFAULT_ASM_ENDIAN
 #if (TARGET_DEFAULT & MASK_LITTLE_ENDIAN)
+#define DEFAULT_ASM_ENDIAN " -mlittle"
 #define LINK_OS_LINUX_EMUL32 ENDIAN_SELECT(" -m elf32ppclinux",		\
 					   " -m elf32lppclinux",	\
 					   " -m elf32lppclinux")
@@ -374,6 +385,7 @@ 
 					   " -m elf64lppc",		\
 					   " -m elf64lppc")
 #else
+#define DEFAULT_ASM_ENDIAN " -mbig"
 #define LINK_OS_LINUX_EMUL32 ENDIAN_SELECT(" -m elf32ppclinux",		\
 					   " -m elf32lppclinux",	\
 					   " -m elf32ppclinux")
Index: gcc/config/rs6000/sysv4le.h
===================================================================
--- gcc/config/rs6000/sysv4le.h	(revision 198619)
+++ gcc/config/rs6000/sysv4le.h	(working copy)
@@ -25,12 +25,12 @@ 
 #undef	CC1_ENDIAN_DEFAULT_SPEC
 #define	CC1_ENDIAN_DEFAULT_SPEC "%(cc1_endian_little)"
 
+#undef	DEFAULT_ASM_ENDIAN
+#define	DEFAULT_ASM_ENDIAN " -mlittle"
+
 #undef	LINK_TARGET_SPEC
-#define	LINK_TARGET_SPEC "\
-%{mbig: --oformat elf32-powerpc } %{mbig-endian: --oformat elf32-powerpc } \
-%{!mlittle: %{!mlittle-endian: %{!mbig: %{!mbig-endian: \
-    %{mcall-linux: --oformat elf32-powerpc} \
-  }}}}"
+#define	LINK_TARGET_SPEC \
+  ENDIAN_SELECT(" --oformat elf32-powerpc", "", "")
 
 #undef	MULTILIB_DEFAULTS
 #define	MULTILIB_DEFAULTS { "mlittle", "mcall-sysv" }
Index: gcc/config/rs6000/sysv4.h
===================================================================
--- gcc/config/rs6000/sysv4.h	(revision 198619)
+++ gcc/config/rs6000/sysv4.h	(working copy)
@@ -527,11 +533,7 @@ 
   "mcall-i960-old:"		LITTLE_OPT ";"	\
   ":"				DEFAULT_OPT "}"
 
-#if (TARGET_DEFAULT & MASK_LITTLE_ENDIAN)
-#define DEFAULT_ASM_ENDIAN " -mlittle"
-#else
 #define DEFAULT_ASM_ENDIAN " -mbig"
-#endif
 
 #undef	ASM_SPEC
 #define	ASM_SPEC "%(asm_cpu) \