This is the mail archive of the gcc-bugs@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: More real.c fall out - XFmode real_format_for_mode[] entry not initialised before use.


On Wed, Oct 02, 2002 at 10:41:06PM +0100, Graham Stott wrote:
> Ignore what I wrote I got lost in the initialisation code.
> 
> It's a m68k backend problem which has multiple definitions of 
> OVERRIDE_OPTIONS.
> The OVERRIDE_OPTIONS define in m68kelf.h doesn't call override_options which
> means that the initailisation of real_format_for_mode isn't being done for
> m68k-elf target.

Keen.  Even better, all the overrides are the same.  Sigh.

Fixed thus.


r~


        * config/m68k/m68k.h (OVERRIDE_OPTIONS): Move additional code ...
        * config/m68k/m68k.c (override_options): ... here.
        * config/m68k/m68kelf.h (OVERRIDE_OPTIONS): Remove.
        * config/m68k/m68kv4.h (OVERRIDE_OPTIONS): Remove.
        * config/m68k/linux.h (SUBTARGET_OVERRIDE_OPTIONS): Remove.
        * config/m68k/netbsd-elf.h (SUBTARGET_OVERRIDE_OPTIONS): Remove.

Index: linux.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/m68k/linux.h,v
retrieving revision 1.22
diff -u -p -r1.22 linux.h
--- linux.h	15 Apr 2002 20:35:14 -0000	1.22
+++ linux.h	4 Oct 2002 00:59:52 -0000
@@ -315,15 +315,6 @@ do {									\
    || (GET_CODE (X) == SYMBOL_REF && SYMBOL_REF_FLAG (X))       	\
    || PCREL_GENERAL_OPERAND_OK)
 
-/* Turn off function cse if we are doing PIC. We always want function
-   call to be done as `bsr foo@PLTPC', so it will force the assembler
-   to create the PLT entry for `foo'.  Doing function cse will cause
-   the address of `foo' to be loaded into a register, which is exactly
-   what we want to avoid when we are doing PIC on svr4 m68k.  */
-#undef SUBTARGET_OVERRIDE_OPTIONS
-#define SUBTARGET_OVERRIDE_OPTIONS \
-  if (flag_pic) flag_no_function_cse = 1;
-
 /* For m68k SVR4, structures are returned using the reentrant
    technique.  */
 #undef PCC_STATIC_STRUCT_RETURN
Index: m68k.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/m68k/m68k.c,v
retrieving revision 1.68
diff -u -p -r1.68 m68k.c
--- m68k.c	21 Sep 2002 16:10:35 -0000	1.68
+++ m68k.c	4 Oct 2002 00:59:52 -0000
@@ -175,6 +175,27 @@ override_options ()
 	m68k_align_funcs = i;
     }
 
+  /* -fPIC uses 32-bit pc-relative displacements, which don't exist
+     until the 68020.  */
+  if (! TARGET_68020 && flag_pic == 2)
+    error("-fPIC is not currently supported on the 68000 or 68010\n");
+
+  /* ??? A historic way of turning on pic, or is this intended to
+     be an embedded thing that doesn't have the same name binding
+     significance that it does on hosted ELF systems?  */
+  if (TARGET_PCREL && flag_pic == 0)
+    flag_pic = 1;
+
+  /* Turn off function cse if we are doing PIC.  We always want function call
+     to be done as `bsr foo@PLTPC', so it will force the assembler to create
+     the PLT entry for `foo'. Doing function cse will cause the address of
+     `foo' to be loaded into a register, which is exactly what we want to
+     avoid when we are doing PIC on svr4 m68k.  */
+  if (flag_pic)
+    flag_no_function_cse = 1;
+
+  SUBTARGET_OVERRIDE_OPTIONS;
+
   /* Tell the compiler which flavor of XFmode we're using.  */
   real_format_for_mode[XFmode - QFmode] = &ieee_extended_motorola_format;
 }
Index: m68k.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/m68k/m68k.h,v
retrieving revision 1.78
diff -u -p -r1.78 m68k.h
--- m68k.h	24 Sep 2002 12:48:58 -0000	1.78
+++ m68k.h	4 Oct 2002 00:59:53 -0000
@@ -277,15 +277,7 @@ extern int target_flags;
    Don't use this macro to turn on various extra optimizations for
    `-O'.  That is what `OPTIMIZATION_OPTIONS' is for.  */
 
-#define OVERRIDE_OPTIONS		\
-{					\
-  override_options();			\
-  if (! TARGET_68020 && flag_pic == 2)	\
-    error("-fPIC is not currently supported on the 68000 or 68010\n");	\
-  if (TARGET_PCREL && flag_pic == 0)	\
-    flag_pic = 1;			\
-  SUBTARGET_OVERRIDE_OPTIONS;		\
-}
+#define OVERRIDE_OPTIONS   override_options()
 
 /* These are meant to be redefined in the host dependent files */
 #define SUBTARGET_SWITCHES
Index: m68kelf.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/m68k/m68kelf.h,v
retrieving revision 1.15
diff -u -p -r1.15 m68kelf.h
--- m68kelf.h	25 Jul 2002 05:14:20 -0000	1.15
+++ m68kelf.h	4 Oct 2002 00:59:53 -0000
@@ -251,20 +251,6 @@ extern int switch_table_difference_label
    || (GET_CODE (X) == SYMBOL_REF && SYMBOL_REF_FLAG (X))	\
    || PCREL_GENERAL_OPERAND_OK)
 
-/* Turn off function cse if we are doing PIC. We always want function call
-   to be done as `bsr foo@PLTPC', so it will force the assembler to create 
-   the PLT entry for `foo'. Doing function cse will cause the address of `foo'
-   to be loaded into a register, which is exactly what we want to avoid when
-   we are doing PIC on svr4 m68k.  */
-#undef OVERRIDE_OPTIONS
-#define OVERRIDE_OPTIONS		\
-{					\
-  if (flag_pic) flag_no_function_cse = 1; \
-  if (! TARGET_68020 && flag_pic == 2)	\
-    error("-fPIC is not currently supported on the 68000 or 68010\n");	\
-  if (TARGET_PCREL && flag_pic == 0)	\
-    flag_pic = 1;			\
-}
 /* end of stuff from m68kv4.h */
 
 #undef SGS_CMP_ORDER
Index: m68kv4.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/m68k/m68kv4.h,v
retrieving revision 1.19
diff -u -p -r1.19 m68kv4.h
--- m68kv4.h	25 Jul 2002 05:14:20 -0000	1.19
+++ m68kv4.h	4 Oct 2002 00:59:53 -0000
@@ -283,19 +283,6 @@ int switch_table_difference_label_flag;
    || (GET_CODE (X) == SYMBOL_REF && SYMBOL_REF_FLAG (X))       	\
    || PCREL_GENERAL_OPERAND_OK)
 
-/* Turn off function cse if we are doing PIC. We always want function call
-   to be done as `bsr foo@PLTPC', so it will force the assembler to create 
-   the PLT entry for `foo'. Doing function cse will cause the address of `foo'
-   to be loaded into a register, which is exactly what we want to avoid when
-   we are doing PIC on svr4 m68k.  */
-#undef OVERRIDE_OPTIONS
-#define OVERRIDE_OPTIONS		\
-{					\
-  if (flag_pic) flag_no_function_cse = 1; \
-  if (! TARGET_68020 && flag_pic == 2)	\
-    error("-fPIC is not currently supported on the 68000 or 68010\n");	\
-}
-
 /* Output assembler code for a block containing the constant parts
    of a trampoline, leaving space for the variable parts.  */
 
Index: netbsd-elf.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/m68k/netbsd-elf.h,v
retrieving revision 1.6
diff -u -p -r1.6 netbsd-elf.h
--- netbsd-elf.h	8 Jun 2002 07:31:42 -0000	1.6
+++ netbsd-elf.h	4 Oct 2002 00:59:53 -0000
@@ -273,17 +273,6 @@ while (0)
   fprintf ((FILE), ",%u\n", (SIZE)))
 
 
-/* Turn off function cse if we are doing PIC. We always want function
-   call to be done as `bsr foo@PLTPC', so it will force the assembler
-   to create the PLT entry for `foo'.  Doing function cse will cause
-   the address of `foo' to be loaded into a register, which is exactly
-   what we want to avoid when we are doing PIC on svr4 m68k.  */
-
-#undef SUBTARGET_OVERRIDE_OPTIONS
-#define SUBTARGET_OVERRIDE_OPTIONS					\
-  if (flag_pic) flag_no_function_cse = 1;
-
-
 /* XXX
    This is the end of the chunk lifted from m68kelf.h  */
 


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