From 99c11254007ee9ded08e8aa42614e65b21fc7e59 Mon Sep 17 00:00:00 2001 From: danglin Date: Fri, 20 Aug 2004 15:11:43 +0000 Subject: [PATCH] * 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. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@86325 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 24 +++++++++++++++ gcc/config/pa/pa-protos.h | 6 ++-- gcc/config/pa/pa.c | 36 +++++++++------------- gcc/config/pa/pa.h | 68 ++++++++++++++++++++++++++++++++++++++++- gcc/config/pa/som.h | 78 +++-------------------------------------------- 5 files changed, 113 insertions(+), 99 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index d0e31e4..06a8bd4 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,27 @@ +2004-08-20 Zack Weinberg + John David Anglin + + * 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 * fold-const.c (int_const_binop): Don't generate non-overflowing diff --git a/gcc/config/pa/pa-protos.h b/gcc/config/pa/pa-protos.h index c27ef12..46d26b6 100644 --- a/gcc/config/pa/pa-protos.h +++ b/gcc/config/pa/pa-protos.h @@ -177,7 +177,7 @@ extern void pa_asm_output_aligned_local (FILE *, const char *, 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); diff --git a/gcc/config/pa/pa.c b/gcc/config/pa/pa.c index be1c4bd..a35820b 100644 --- a/gcc/config/pa/pa.c +++ b/gcc/config/pa/pa.c @@ -9236,27 +9236,18 @@ cmpib_comparison_operator (rtx op, enum machine_mode mode) || 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 (); } diff --git a/gcc/config/pa/pa.h b/gcc/config/pa/pa.h index aefecd2..b7e32c4 100644 --- a/gcc/config/pa/pa.h +++ b/gcc/config/pa/pa.h @@ -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). diff --git a/gcc/config/pa/som.h b/gcc/config/pa/som.h index a87b2fd..ff152ae 100644 --- a/gcc/config/pa/som.h +++ b/gcc/config/pa/som.h @@ -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 -- 2.7.4