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: Partially fix hppa64-hpux bootstrap, 2/2


> Bootstrapping hppa64-hp-hpux11.11, using HP's "cc +DD64" for the
> initial compiler, currently fails in two places because this initial
> compiler does no dead/unreachable code stripping, even at the level of
> unused static functions.  And then when you fix those, cc1 crashes
> with a bus error somewhere in the dynamic linker if the argument list
> is a certain length, but let's get these out of the way first.

I committed the following.  It is based on the patch which Zack sent
but I have renamed a few functions and macros, and made a few other minor
changes.  This patch is mainly a reorganization and shouldn't have
any functional effect other than always defining the SOM section functions
to eliminate the bootstrap problem noted above.

With this change and <http://gcc.gnu.org/ml/gcc-patches/2004-08/msg01369.html>,
I am successfully able to bootstrap using HP cc on both hppa2.0w-hp-hpux11.00
and hppa64-hp-hpux11.00.  For the 64-bit bootstrap, I used
CC="cc +DA2.0W -Ae -Wp,-H16376".

Committed to main.

Dave
-- 
J. David Anglin                                  dave.anglin@nrc-cnrc.gc.ca
National Research Council of Canada              (613) 990-0752 (FAX: 952-6602)

2004-08-20  Zack Weinberg  <zack@codesourcery.com>
	    John David Anglin  <dave.anglin@nrc-cnrc.gc.ca>

        * config/pa/pa-protos.h (readonly_data, one_only_readonly_data_section,
	one_only_data_section): Rename to som_readonly_data_section,
	som_one_only_readonly_data_section and som_one_only_data_section.
        * config/pa/pa.c (ONE_ONLY_TEXT_SECTION_ASM_OP, NEW_TEXT_SECTION_ASM_OP,
	DEFAULT_TEXT_SECTION_ASM_OP): Delete conditional defines.
	(som_text_section_asm_op): Replace ONE_ONLY_TEXT_SECTION_ASM_OP,
	NEW_TEXT_SECTION_ASM_OP and DEFAULT_TEXT_SECTION_ASM_OP with actual
	string values.
	(pa_select_section): Use renamed section functions.
	* config/pa/pa.h (EXTRA_SECTIONS, EXTRA_SECTION_FUNCTIONS,
        SOM_READONLY_DATA_SECTION_FUNCTION,
	SOM_ONE_ONLY_READONLY_DATA_SECTION_FUNCTION,
        SOM_ONE_ONLY_DATA_SECTION_FUNCTION, FORGET_SECTION_FUNCTION):
        Define here ...
        * config/pa/som.h: ... not here.
        (DEFAULT_TEXT_SECTION_ASM_OP, NEW_TEXT_SECTION_ASM_OP,
	ONE_ONLY_TEXT_SECTION_ASM_OP, READONLY_DATA_ASM_OP,
	ONE_ONLY_READONLY_DATA_SECTION_ASM_OP,
        ONE_ONLY_DATA_SECTION_ASM_OP): Delete.
        (READONLY_DATA_SECTION): Use som_readonly_data_section.

Index: config/pa/pa-protos.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/pa/pa-protos.h,v
retrieving revision 1.36
diff -u -3 -p -r1.36 pa-protos.h
--- config/pa/pa-protos.h	5 Aug 2004 20:57:05 -0000	1.36
+++ config/pa/pa-protos.h	19 Aug 2004 16:07:38 -0000
@@ -177,7 +177,7 @@ extern void pa_asm_output_aligned_local 
 					 unsigned int);
 
 /* Functions in varasm.c used by pa.c.  */
-extern void readonly_data (void);
-extern void one_only_readonly_data_section (void);
-extern void one_only_data_section (void);
+extern void som_readonly_data_section (void);
+extern void som_one_only_readonly_data_section (void);
+extern void som_one_only_data_section (void);
 extern void forget_section (void);
Index: config/pa/pa.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/pa/pa.c,v
retrieving revision 1.272
diff -u -3 -p -r1.272 pa.c
--- config/pa/pa.c	18 Aug 2004 21:08:28 -0000	1.272
+++ config/pa/pa.c	19 Aug 2004 16:07:39 -0000
@@ -9236,27 +9236,18 @@ cmpib_comparison_operator (rtx op, enum 
 	      || GET_CODE (op) == LEU));
 }
 
-#ifndef ONE_ONLY_TEXT_SECTION_ASM_OP
-#define ONE_ONLY_TEXT_SECTION_ASM_OP ""
-#endif
-
-#ifndef NEW_TEXT_SECTION_ASM_OP
-#define NEW_TEXT_SECTION_ASM_OP ""
-#endif
-
-#ifndef DEFAULT_TEXT_SECTION_ASM_OP
-#define DEFAULT_TEXT_SECTION_ASM_OP ""
-#endif
-
-/* Select and return a TEXT_SECTION_ASM_OP for the current function.
+/* Return a string to output before text in the current function.
 
    This function is only used with SOM.  Because we don't support
    named subspaces, we can only create a new subspace or switch back
-   into the default text subspace.  */
+   to the default text subspace.  */
 const char *
 som_text_section_asm_op (void)
 {
-  if (TARGET_SOM && TARGET_GAS)
+  if (!TARGET_SOM)
+    return "";
+
+  if (TARGET_GAS)
     {
       if (cfun && !cfun->machine->in_nsubspa)
 	{
@@ -9269,9 +9260,10 @@ som_text_section_asm_op (void)
 	  if (cfun->decl
 	      && DECL_ONE_ONLY (cfun->decl)
 	      && !DECL_WEAK (cfun->decl))
-	    return ONE_ONLY_TEXT_SECTION_ASM_OP;
+	    return
+ "\t.SPACE $TEXT$\n\t.NSUBSPA $CODE$,QUAD=0,ALIGN=8,ACCESS=44,SORT=24,COMDAT";
 
-	  return NEW_TEXT_SECTION_ASM_OP;
+	  return "\t.SPACE $TEXT$\n\t.NSUBSPA $CODE$";
 	}
       else
 	{
@@ -9279,13 +9271,13 @@ som_text_section_asm_op (void)
 	     function has been completed.  So, we are changing to the
 	     text section to output debugging information.  Do this in
 	     the default text section.  We need to forget that we are
-	     in the text section so that text_section will call us the
-	     next time around.  */
+	     in the text section so that the function text_section in
+	     varasm.c will call us the next time around.  */
 	  forget_section ();
 	}
     }
 
-  return DEFAULT_TEXT_SECTION_ASM_OP;
+  return "\t.SPACE $TEXT$\n\t.SUBSPA $CODE$";
 }
 
 /* On hpux10, the linker will give an error if we have a reference
@@ -9308,7 +9300,7 @@ pa_select_section (tree exp, int reloc,
       if (TARGET_SOM
 	  && DECL_ONE_ONLY (exp)
 	  && !DECL_WEAK (exp))
-	one_only_readonly_data_section ();
+	som_one_only_readonly_data_section ();
       else
 	readonly_data_section ();
     }
@@ -9320,7 +9312,7 @@ pa_select_section (tree exp, int reloc,
 	   && DECL_ONE_ONLY (exp)
 	   && !DECL_WEAK (exp)
 	   && DECL_INITIAL (exp))
-    one_only_data_section ();
+    som_one_only_data_section ();
   else
     data_section ();
 }
Index: config/pa/pa.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/pa/pa.h,v
retrieving revision 1.231
diff -u -3 -p -r1.231 pa.h
--- config/pa/pa.h	18 Aug 2004 17:05:09 -0000	1.231
+++ config/pa/pa.h	19 Aug 2004 16:07:40 -0000
@@ -1653,12 +1653,78 @@ do { 									\
     goto LABEL
 
 #define TARGET_ASM_SELECT_SECTION  pa_select_section
-   
+
 /* Return a nonzero value if DECL has a section attribute.  */
 #define IN_NAMED_SECTION_P(DECL) \
   ((TREE_CODE (DECL) == FUNCTION_DECL || TREE_CODE (DECL) == VAR_DECL) \
    && DECL_SECTION_NAME (DECL) != NULL_TREE)
 
+/* The following extra sections and extra section functions are only used
+   for SOM, but they must be provided unconditionally because pa.c's calls
+   to the functions might not get optimized out when other object formats
+   are in use.  */
+
+#define EXTRA_SECTIONS							\
+  in_som_readonly_data,							\
+  in_som_one_only_readonly_data,					\
+  in_som_one_only_data
+
+#define EXTRA_SECTION_FUNCTIONS						\
+  SOM_READONLY_DATA_SECTION_FUNCTION					\
+  SOM_ONE_ONLY_READONLY_DATA_SECTION_FUNCTION				\
+  SOM_ONE_ONLY_DATA_SECTION_FUNCTION					\
+  FORGET_SECTION_FUNCTION
+
+/* SOM puts readonly data in the default $LIT$ subspace when PIC code
+   is not being generated.  */
+#define SOM_READONLY_DATA_SECTION_FUNCTION				\
+void									\
+som_readonly_data_section (void)					\
+{									\
+  if (!TARGET_SOM)							\
+    return;								\
+  if (in_section != in_som_readonly_data)				\
+    {									\
+      in_section = in_som_readonly_data;				\
+      fputs ("\t.SPACE $TEXT$\n\t.SUBSPA $LIT$\n", asm_out_file);	\
+    }									\
+}
+
+/* When secondary definitions are not supported, SOM makes readonly data one
+   only by creating a new $LIT$ subspace in $TEXT$ with the comdat flag.  */
+#define SOM_ONE_ONLY_READONLY_DATA_SECTION_FUNCTION			\
+void									\
+som_one_only_readonly_data_section (void)				\
+{									\
+  if (!TARGET_SOM)							\
+    return;								\
+  in_section = in_som_one_only_readonly_data;				\
+  fputs ("\t.SPACE $TEXT$\n"						\
+	 "\t.NSUBSPA $LIT$,QUAD=0,ALIGN=8,ACCESS=0x2c,SORT=16,COMDAT\n",\
+	 asm_out_file);							\
+}
+
+/* When secondary definitions are not supported, SOM makes data one only by
+   creating a new $DATA$ subspace in $PRIVATE$ with the comdat flag.  */
+#define SOM_ONE_ONLY_DATA_SECTION_FUNCTION				\
+void									\
+som_one_only_data_section (void)					\
+{									\
+  if (!TARGET_SOM)							\
+    return;								\
+  in_section = in_som_one_only_data;					\
+  fputs ("\t.SPACE $PRIVATE$\n"						\
+	 "\t.NSUBSPA $DATA$,QUAD=1,ALIGN=8,ACCESS=31,SORT=24,COMDAT\n",	\
+	 asm_out_file);							\
+}
+
+#define FORGET_SECTION_FUNCTION						\
+void									\
+forget_section (void)							\
+{									\
+  in_section = no_section;						\
+}
+
 /* Define this macro if references to a symbol must be treated
    differently depending on something about the variable or
    function named by the symbol (such as what section it is in).
Index: config/pa/som.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/pa/som.h,v
retrieving revision 1.49
diff -u -3 -p -r1.49 som.h
--- config/pa/som.h	5 Aug 2004 20:57:06 -0000	1.49
+++ config/pa/som.h	19 Aug 2004 16:07:40 -0000
@@ -206,84 +206,15 @@ do {								\
 
 #define TARGET_ASM_FILE_START pa_som_file_start
 
-/* Select and return a TEXT_SECTION_ASM_OP string.  */
+/* String to output before text.  */
 #define TEXT_SECTION_ASM_OP som_text_section_asm_op ()
 
-/* Output before code in the default text section.  */
-#define DEFAULT_TEXT_SECTION_ASM_OP "\t.SPACE $TEXT$\n\t.SUBSPA $CODE$"
-
-/* Output before text in a new subspace.  This allows the linker to
-   place stubs between functions.  */
-#define NEW_TEXT_SECTION_ASM_OP "\t.SPACE $TEXT$\n\t.NSUBSPA $CODE$"
-    
-/* Output before text in a new one-only subspace.  */
-#define ONE_ONLY_TEXT_SECTION_ASM_OP "\t.SPACE $TEXT$\n\
-\t.NSUBSPA $CODE$,QUAD=0,ALIGN=8,ACCESS=44,SORT=24,COMDAT"
-
-/* Output before read-only data.  */
-#define READONLY_DATA_ASM_OP "\t.SPACE $TEXT$\n\t.SUBSPA $LIT$\n"
-
-/* Output before one-only readonly data.  We make readonly data one only
-   by creating a new $LIT$ subspace in $TEXT$ with the comdat flag.  */
-#define ONE_ONLY_READONLY_DATA_SECTION_ASM_OP "\t.SPACE $TEXT$\n\
-\t.NSUBSPA $LIT$,QUAD=0,ALIGN=8,ACCESS=0x2c,SORT=16,COMDAT\n"
-
-/* Output before writable data.  */
+/* String to output before writable data.  */
 #define DATA_SECTION_ASM_OP "\t.SPACE $PRIVATE$\n\t.SUBSPA $DATA$\n"
 
-/* Output before one-only data.  We make data one only by creating
-   a new $DATA$ subspace in $PRIVATE$ with the comdat flag.  */
-#define ONE_ONLY_DATA_SECTION_ASM_OP "\t.SPACE $PRIVATE$\n\
-\t.NSUBSPA $DATA$,QUAD=1,ALIGN=8,ACCESS=31,SORT=24,COMDAT\n"
-
-/* Output before uninitialized data.  */
+/* String to output before uninitialized data.  */
 #define BSS_SECTION_ASM_OP "\t.SPACE $PRIVATE$\n\t.SUBSPA $BSS$\n"
 
-#define EXTRA_SECTIONS							\
-  in_readonly_data,							\
-  in_one_only_readonly_data,						\
-  in_one_only_data
-
-#define EXTRA_SECTION_FUNCTIONS						\
-  READONLY_DATA_FUNCTION						\
-  ONE_ONLY_READONLY_DATA_SECTION_FUNCTION				\
-  ONE_ONLY_DATA_SECTION_FUNCTION					\
-  FORGET_SECTION_FUNCTION
-
-#define READONLY_DATA_FUNCTION						\
-void									\
-readonly_data (void)							\
-{									\
-  if (in_section != in_readonly_data)					\
-    {									\
-      in_section = in_readonly_data;					\
-      fputs (READONLY_DATA_ASM_OP, asm_out_file);			\
-    }									\
-}									\
-
-#define ONE_ONLY_READONLY_DATA_SECTION_FUNCTION				\
-void									\
-one_only_readonly_data_section (void)					\
-{									\
-  in_section = in_one_only_readonly_data;				\
-  fputs (ONE_ONLY_READONLY_DATA_SECTION_ASM_OP, asm_out_file);		\
-}									\
-
-#define ONE_ONLY_DATA_SECTION_FUNCTION					\
-void									\
-one_only_data_section (void)						\
-{									\
-  in_section = in_one_only_data;					\
-  fputs (ONE_ONLY_DATA_SECTION_ASM_OP, asm_out_file);			\
-}
-
-#define FORGET_SECTION_FUNCTION						\
-void									\
-forget_section (void)							\
-{									\
-  in_section = no_section;						\
-}									\
-
 /* FIXME: HPUX ld generates incorrect GOT entries for "T" fixups
    which reference data within the $TEXT$ space (for example constant
    strings in the $LIT$ subspace).
@@ -296,7 +227,8 @@ forget_section (void)							\
    $TEXT$ space during PIC generation.  Instead place all constant
    data into the $PRIVATE$ subspace (this reduces sharing, but it
    works correctly).  */
-#define READONLY_DATA_SECTION (flag_pic ? data_section : readonly_data)
+#define READONLY_DATA_SECTION \
+  (flag_pic ? data_section : som_readonly_data_section)
 
 /* We must not have a reference to an external symbol defined in a
    shared library in a readonly section, else the SOM linker will


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