+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.
+
2004-08-20 Nathan Sidwell <nathan@codesourcery.com>
* fold-const.c (int_const_binop): Don't generate non-overflowing
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);
|| 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)
{
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
{
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
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 ();
}
&& DECL_ONE_ONLY (exp)
&& !DECL_WEAK (exp)
&& DECL_INITIAL (exp))
- one_only_data_section ();
+ som_one_only_data_section ();
else
data_section ();
}
goto LABEL
\f
#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).
#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).
$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