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]

Re: [PATCH][RFC] -EB / -EL don't properly affect gcc predefined symbols


Andrew Pinski <pinskia@gmail.com> writes:
> On Fri, 2006-10-13 at 14:32 +0900, Hiroki Kaminaga wrote:
>> > The attached patch is the more correct way to solve this.
>> 
>> Your patch would cause `-profile' option not to set `-p' to cc1. Is this OK?
> Not really, the following patch on top of the previous fixes the above
> problem:
> Index: config/mips/linux.h
> ===================================================================
> --- config/mips/linux.h (revision 117683)
> +++ config/mips/linux.h (working copy)
> @@ -49,6 +49,8 @@ Boston, MA 02110-1301, USA.  */
>  #undef MD_EXEC_PREFIX
>  #undef MD_STARTFILE_PREFIX
>
> +#define SUBTARGET_CC1_SPEC "%{profile:-p}"
> +
>  /* If we don't set MASK_ABICALLS, we can't default to PIC.  */
>  #undef TARGET_DEFAULT
>  #define TARGET_DEFAULT MASK_ABICALLS

config/mips/linux.h is included after config/mips/mips.h (a historical
wart) so you need to undef SUBTARGET_CC1_SPEC first.  I've applied the
following after testing on mips64-linux-gnu.

Richard


gcc/
2006-10-17  Andrew Pinsiki  <pinskia@gmail.com>
	    Richard Sandiford  <richard@codesourcery.com>

	PR target/29413
	* config/mips/linux.h (SUBTARGET_CC1_SPEC): Override.
	* config/mips/mips.h (CC1_SPEC): Override any earlier definition.

Index: gcc/config/mips/linux.h
===================================================================
--- gcc/config/mips/linux.h	(revision 117786)
+++ gcc/config/mips/linux.h	(working copy)
@@ -89,9 +89,15 @@ #define TARGET_OS_CPP_BUILTINS()				\
     builtin_define ("_MIPS_SZINT=32");				\
   } while (0)
 
-#undef  SUBTARGET_CPP_SPEC
+#undef SUBTARGET_CPP_SPEC
 #define SUBTARGET_CPP_SPEC "%{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.  */
Index: gcc/config/mips/mips.h
===================================================================
--- gcc/config/mips/mips.h	(revision 117786)
+++ gcc/config/mips/mips.h	(working copy)
@@ -865,13 +865,12 @@ #define SUBTARGET_CC1_SPEC ""
 
 /* CC1_SPEC is the set of arguments to pass to the compiler proper.  */
 
-#ifndef CC1_SPEC
+#undef CC1_SPEC
 #define CC1_SPEC "\
 %{gline:%{!g:%{!g0:%{!g1:%{!g2: -g1}}}}} \
 %{G*} %{EB:-meb} %{EL:-mel} %{EB:%{EL:%emay not use both -EB and -EL}} \
 %{save-temps: } \
 %(subtarget_cc1_spec)"
-#endif
 
 /* Preprocessor specs.  */
 


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