This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] split mips/gnu-user.h from mips/linux.h


Hi!

This patch splits those bits from:

config/mips/linux.h
config/mips/linux64.h

which are applicable to GNU userland, into:

config/mips/gnu-user.h
config/mips/gnu-user64

respectively.  It is analogous to the split that was performed for
config/i386/* by Joseph Myers in r172271.

I've verified that my patch doesn't cause any regression (resulting
gcc/xgcc is identical both for mips-*-linux and mips64*-linux).

-- 
Robert Millan
2011-07-19  Robert Millan  <rmh@gnu.org>

	* config/mips/gnu-user.h: Copy from linux.h.  Update comments.
	(GLIBC_DYNAMIC_LINKER): Remove.

	* config/mips/gnu-user64.h: Copy from linux64.h.  Update comments.
	(GLIBC_DYNAMIC_LINKER32, GLIBC_DYNAMIC_LINKER64)
	(GLIBC_DYNAMIC_LINKERN32, UCLIBC_DYNAMIC_LINKERN32)
	(BIONIC_DYNAMIC_LINKERN32, GNU_USER_DYNAMIC_LINKERN32): Remove.
	(LINK_SPEC): Use GNU_USER_DYNAMIC_LINKER32,
	GNU_USER_DYNAMIC_LINKER64 and GNU_USER_LINK_EMULATIONN32.

	* config/mips/linux.h: Remove everything except for ...
	(GLIBC_DYNAMIC_LINKER): ... this macro.

	* config/mips/linux64.h: Remove everything except for ...
	(GLIBC_DYNAMIC_LINKER32, GLIBC_DYNAMIC_LINKER64)
	(GLIBC_DYNAMIC_LINKERN32, UCLIBC_DYNAMIC_LINKERN32)
	(BIONIC_DYNAMIC_LINKERN32): ... these macros.
	(GNU_USER_LINK_EMULATION32, GNU_USER_LINK_EMULATION64)
	(GNU_USER_LINK_EMULATIONN32): New macros.

	* config.gcc (mips64*-*-linux* | mipsisa64*-*-linux* |
	mips-*-linux*): Use the new headers.

Index: gcc/config.gcc
===================================================================
--- gcc/config.gcc	(revision 176425)
+++ gcc/config.gcc	(working copy)
@@ -1820,7 +1820,7 @@
 	extra_options="${extra_options} netbsd.opt netbsd-elf.opt"
 	;;
 mips64*-*-linux* | mipsisa64*-*-linux*)
-	tm_file="dbxelf.h elfos.h gnu-user.h linux.h glibc-stdint.h ${tm_file} mips/linux.h mips/linux64.h"
+	tm_file="dbxelf.h elfos.h gnu-user.h linux.h glibc-stdint.h ${tm_file} mips/gnu-user.h mips/gnu-user64.h mips/linux64.h"
 	tmake_file="${tmake_file} mips/t-linux64 mips/t-libgcc-mips16"
 	tm_defines="${tm_defines} MIPS_ABI_DEFAULT=ABI_N32"
 	case ${target} in
@@ -1842,7 +1842,7 @@
 	test x$with_llsc != x || with_llsc=yes
 	;;
 mips*-*-linux*)				# Linux MIPS, either endian.
-        tm_file="dbxelf.h elfos.h gnu-user.h linux.h glibc-stdint.h ${tm_file} mips/linux.h"
+        tm_file="dbxelf.h elfos.h gnu-user.h linux.h glibc-stdint.h ${tm_file} mips/gnu-user.h mips/linux.h"
 	tmake_file="${tmake_file} mips/t-libgcc-mips16"
 	if test x$enable_targets = xall; then
 		tm_file="${tm_file} mips/linux64.h"
Index: gcc/config/mips/linux.h
===================================================================
--- gcc/config/mips/linux.h	(revision 176425)
+++ gcc/config/mips/linux.h	(working copy)
@@ -1,6 +1,5 @@
 /* Definitions for MIPS running Linux-based GNU systems with ELF format.
-   Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
-   2007, 2008, 2010, 2011 Free Software Foundation, Inc.
+   Copyright (C) 2011 Free Software Foundation, Inc.
 
 This file is part of GCC.
 
@@ -18,125 +17,4 @@
 along with GCC; see the file COPYING3.  If not see
 <http://www.gnu.org/licenses/>.  */
 
-#undef WCHAR_TYPE
-#define WCHAR_TYPE "int"
-
-#undef WCHAR_TYPE_SIZE
-#define WCHAR_TYPE_SIZE 32
-
-#undef ASM_DECLARE_OBJECT_NAME
-#define ASM_DECLARE_OBJECT_NAME mips_declare_object_name
-
-/* If we don't set MASK_ABICALLS, we can't default to PIC.  */
-#undef TARGET_DEFAULT
-#define TARGET_DEFAULT MASK_ABICALLS
-
-#define TARGET_OS_CPP_BUILTINS()				\
-  do {								\
-    GNU_USER_TARGET_OS_CPP_BUILTINS();				\
-    /* The GNU C++ standard library requires this.  */		\
-    if (c_dialect_cxx ())					\
-      builtin_define ("_GNU_SOURCE");				\
-  } while (0)
-
-#undef SUBTARGET_CPP_SPEC
-#define SUBTARGET_CPP_SPEC "%{posix:-D_POSIX_SOURCE} %{pthread:-D_REENTRANT}"
-
-/* A standard GNU/Linux mapping.  On most targets, it is included in
-   CC1_SPEC itself by config/linux.h, but mips.h overrides CC1_SPEC
-   and provides this hook instead.  */
-#undef SUBTARGET_CC1_SPEC
-#define SUBTARGET_CC1_SPEC "%{profile:-p}"
-
-/* From iris5.h */
-/* -G is incompatible with -KPIC which is the default, so only allow objects
-   in the small data section if the user explicitly asks for it.  */
-#undef MIPS_DEFAULT_GVALUE
-#define MIPS_DEFAULT_GVALUE 0
-
 #define GLIBC_DYNAMIC_LINKER "/lib/ld.so.1"
-
-/* Borrowed from sparc/linux.h */
-#undef LINK_SPEC
-#define LINK_SPEC \
- "%(endian_spec) \
-  %{shared:-shared} \
-  %{!shared: \
-    %{!static: \
-      %{rdynamic:-export-dynamic} \
-      -dynamic-linker " GNU_USER_DYNAMIC_LINKER "} \
-      %{static:-static}}"
-
-#undef SUBTARGET_ASM_SPEC
-#define SUBTARGET_ASM_SPEC \
-  "%{!mno-abicalls:%{mplt:-call_nonpic;:-KPIC}}"
-
-/* The MIPS assembler has different syntax for .set. We set it to
-   .dummy to trap any errors.  */
-#undef SET_ASM_OP
-#define SET_ASM_OP "\t.dummy\t"
-
-#undef ASM_OUTPUT_DEF
-#define ASM_OUTPUT_DEF(FILE,LABEL1,LABEL2)				\
- do {									\
-	fputc ( '\t', FILE);						\
-	assemble_name (FILE, LABEL1);					\
-	fputs ( " = ", FILE);						\
-	assemble_name (FILE, LABEL2);					\
-	fputc ( '\n', FILE);						\
- } while (0)
-
-/* The glibc _mcount stub will save $v0 for us.  Don't mess with saving
-   it, since ASM_OUTPUT_REG_PUSH/ASM_OUTPUT_REG_POP do not work in the
-   presence of $gp-relative calls.  */
-#undef ASM_OUTPUT_REG_PUSH
-#undef ASM_OUTPUT_REG_POP
-
-#undef LIB_SPEC
-#define LIB_SPEC "\
-%{pthread:-lpthread} \
-%{shared:-lc} \
-%{!shared: \
-  %{profile:-lc_p} %{!profile:-lc}}"
-
-#ifdef HAVE_AS_NO_SHARED
-/* Default to -mno-shared for non-PIC.  */
-# define NO_SHARED_SPECS \
-  "%{mshared|mno-shared|fpic|fPIC|fpie|fPIE:;:-mno-shared}"
-#else
-# define NO_SHARED_SPECS ""
-#endif
-
-/* -march=native handling only makes sense with compiler running on
-   a MIPS chip.  */
-#if defined(__mips__)
-extern const char *host_detect_local_cpu (int argc, const char **argv);
-# define EXTRA_SPEC_FUNCTIONS \
-  { "local_cpu_detect", host_detect_local_cpu },
-
-# define MARCH_MTUNE_NATIVE_SPECS				\
-  " %{march=native:%<march=native %:local_cpu_detect(arch)}"	\
-  " %{mtune=native:%<mtune=native %:local_cpu_detect(tune)}"
-#else
-# define MARCH_MTUNE_NATIVE_SPECS ""
-#endif
-
-#define LINUX_DRIVER_SELF_SPECS \
-  NO_SHARED_SPECS							\
-  MARCH_MTUNE_NATIVE_SPECS,						\
-  /* -mplt has no effect without -mno-shared.  Simplify later		\
-     specs handling by removing a redundant option.  */			\
-  "%{!mno-shared:%<mplt}",						\
-  /* -mplt likewise has no effect for -mabi=64 without -msym32.  */	\
-  "%{mabi=64:%{!msym32:%<mplt}}"
-
-#undef DRIVER_SELF_SPECS
-#define DRIVER_SELF_SPECS \
-  BASE_DRIVER_SELF_SPECS, \
-  LINUX_DRIVER_SELF_SPECS
-
-/* Similar to standard Linux, but adding -ffast-math support.  */
-#undef  ENDFILE_SPEC
-#define ENDFILE_SPEC \
-  "%{Ofast|ffast-math|funsafe-math-optimizations:crtfastmath.o%s} \
-   %{shared|pie:crtendS.o%s;:crtend.o%s} crtn.o%s"
Index: gcc/config/mips/gnu-user.h
===================================================================
--- gcc/config/mips/gnu-user.h	(revision 176425)
+++ gcc/config/mips/gnu-user.h	(working copy)
@@ -1,4 +1,4 @@
-/* Definitions for MIPS running Linux-based GNU systems with ELF format.
+/* Definitions for MIPS systems using GNU userspace.
    Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
    2007, 2008, 2010, 2011 Free Software Foundation, Inc.
 
@@ -54,8 +54,6 @@
 #undef MIPS_DEFAULT_GVALUE
 #define MIPS_DEFAULT_GVALUE 0
 
-#define GLIBC_DYNAMIC_LINKER "/lib/ld.so.1"
-
 /* Borrowed from sparc/linux.h */
 #undef LINK_SPEC
 #define LINK_SPEC \
Index: gcc/config/mips/linux64.h
===================================================================
--- gcc/config/mips/linux64.h	(revision 176425)
+++ gcc/config/mips/linux64.h	(working copy)
@@ -19,22 +19,10 @@
 along with GCC; see the file COPYING3.  If not see
 <http://www.gnu.org/licenses/>.  */
 
-/* Force the default endianness and ABI flags onto the command line
-   in order to make the other specs easier to write.  */
-#undef DRIVER_SELF_SPECS
-#define DRIVER_SELF_SPECS \
-  BASE_DRIVER_SELF_SPECS, \
-  LINUX_DRIVER_SELF_SPECS \
-  " %{!EB:%{!EL:%(endian_spec)}}" \
-  " %{!mabi=*: -" MULTILIB_ABI_DEFAULT "}"
+#define GNU_USER_LINK_EMULATION32 "elf32%{EB:b}%{EL:l}tsmip"
+#define GNU_USER_LINK_EMULATION64 "elf64%{EB:b}%{EL:l}tsmip"
+#define GNU_USER_LINK_EMULATIONN32 "elf32%{EB:b}%{EL:l}tsmipn32"
 
-#undef LIB_SPEC
-#define LIB_SPEC "\
-%{pthread:-lpthread} \
-%{shared:-lc} \
-%{!shared: \
-  %{profile:-lc_p} %{!profile:-lc}}"
-
 #define GLIBC_DYNAMIC_LINKER32 "/lib/ld.so.1"
 #define GLIBC_DYNAMIC_LINKER64 "/lib64/ld.so.1"
 #define GLIBC_DYNAMIC_LINKERN32 "/lib32/ld.so.1"
@@ -43,28 +31,3 @@
 #define GNU_USER_DYNAMIC_LINKERN32 \
   CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKERN32, UCLIBC_DYNAMIC_LINKERN32, \
 			 BIONIC_DYNAMIC_LINKERN32)
-
-#undef LINK_SPEC
-#define LINK_SPEC "\
-%{G*} %{EB} %{EL} %{mips1} %{mips2} %{mips3} %{mips4} \
-%{shared} \
- %(endian_spec) \
-  %{!shared: \
-    %{!static: \
-      %{rdynamic:-export-dynamic} \
-      %{mabi=n32: -dynamic-linker " GNU_USER_DYNAMIC_LINKERN32 "} \
-      %{mabi=64: -dynamic-linker " GNU_USER_DYNAMIC_LINKER64 "} \
-      %{mabi=32: -dynamic-linker " GNU_USER_DYNAMIC_LINKER32 "}} \
-    %{static:-static}} \
-%{mabi=n32:-melf32%{EB:b}%{EL:l}tsmipn32} \
-%{mabi=64:-melf64%{EB:b}%{EL:l}tsmip} \
-%{mabi=32:-melf32%{EB:b}%{EL:l}tsmip}"
-
-#undef LOCAL_LABEL_PREFIX
-#define LOCAL_LABEL_PREFIX (TARGET_OLDABI ? "$" : ".")
-
-/* GNU/Linux doesn't use the same floating-point format that IRIX uses
-   for long double.  There's no need to override this here, since
-   ieee_quad_format is the default, but let's put this here to make
-   sure nobody thinks we just forgot to set it to something else.  */
-#define MIPS_TFMODE_FORMAT mips_quad_format
Index: gcc/config/mips/gnu-user64.h
===================================================================
--- gcc/config/mips/gnu-user64.h	(revision 176425)
+++ gcc/config/mips/gnu-user64.h	(working copy)
@@ -1,5 +1,4 @@
-/* Definitions for MIPS running Linux-based GNU systems with ELF format
-   using n32/64 abi.
+/* Definitions for MIPS systems using GNU userspace and n32/64 abi.
    Copyright 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2010, 2011
    Free Software Foundation, Inc.
 
@@ -35,15 +34,6 @@
 %{!shared: \
   %{profile:-lc_p} %{!profile:-lc}}"
 
-#define GLIBC_DYNAMIC_LINKER32 "/lib/ld.so.1"
-#define GLIBC_DYNAMIC_LINKER64 "/lib64/ld.so.1"
-#define GLIBC_DYNAMIC_LINKERN32 "/lib32/ld.so.1"
-#define UCLIBC_DYNAMIC_LINKERN32 "/lib32/ld-uClibc.so.0"
-#define BIONIC_DYNAMIC_LINKERN32 "/system/bin/linker32"
-#define GNU_USER_DYNAMIC_LINKERN32 \
-  CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKERN32, UCLIBC_DYNAMIC_LINKERN32, \
-			 BIONIC_DYNAMIC_LINKERN32)
-
 #undef LINK_SPEC
 #define LINK_SPEC "\
 %{G*} %{EB} %{EL} %{mips1} %{mips2} %{mips3} %{mips4} \
@@ -56,9 +46,9 @@
       %{mabi=64: -dynamic-linker " GNU_USER_DYNAMIC_LINKER64 "} \
       %{mabi=32: -dynamic-linker " GNU_USER_DYNAMIC_LINKER32 "}} \
     %{static:-static}} \
-%{mabi=n32:-melf32%{EB:b}%{EL:l}tsmipn32} \
-%{mabi=64:-melf64%{EB:b}%{EL:l}tsmip} \
-%{mabi=32:-melf32%{EB:b}%{EL:l}tsmip}"
+%{mabi=n32:-m" GNU_USER_LINK_EMULATIONN32 "} \
+%{mabi=64:-m" GNU_USER_LINK_EMULATION64 "} \
+%{mabi=32:-m" GNU_USER_LINK_EMULATION32 "}"
 
 #undef LOCAL_LABEL_PREFIX
 #define LOCAL_LABEL_PREFIX (TARGET_OLDABI ? "$" : ".")

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]