diff options
author | John David Anglin <dave.anglin@nrc-cnrc.gc.ca> | 2004-07-20 19:52:11 +0000 |
---|---|---|
committer | John David Anglin <danglin@gcc.gnu.org> | 2004-07-20 19:52:11 +0000 |
commit | 9a55eab313314c6004a3833cd20df6e7f77d59ea (patch) | |
tree | 8b633e8e0a3ee97b566dbc21ed663fcfbc863f2a | |
parent | da7404533a349c82050d029dfd7d24e168e743f9 (diff) | |
download | gcc-9a55eab313314c6004a3833cd20df6e7f77d59ea.zip gcc-9a55eab313314c6004a3833cd20df6e7f77d59ea.tar.gz gcc-9a55eab313314c6004a3833cd20df6e7f77d59ea.tar.bz2 |
re PR c++/14607 (Duplicate symbol "vtable for node" in files div.o and env.o)
PR c++/14607
* config/pa/pa-hpux10.h (SUPPORTS_ONE_ONLY): Define.
(MAKE_DECL_ONE_ONLY): Undefine.
* pa-protos.h (som_text_section_asm_op, one_only_readonly_data_section,
readonly_data, one_only_data_section, forget_section): New prototypes.
* pa.c (pa_init_machine_status, som_text_section_asm_op): New
functions.
(pa_select_section): Add one-only (COMDAT) support.
* pa.h (struct machine_function): Define.
* som.h (ASM_OUTPUT_FUNCTION_PREFIX): Delete.
(TEXT_SECTION_ASM_OP): Call som_text_section_asm_op.
(DEFAULT_TEXT_SECTION_ASM_OP, NEW_TEXT_SECTION_ASM_OP,
ONE_ONLY_TEXT_SECTION_ASM_OP, ONE_ONLY_READONLY_DATA_SECTION_ASM_OP,
ONE_ONLY_DATA_SECTION_ASM_OP): New defines.
(EXTRA_SECTIONS): Add in_one_only_readonly_data and in_one_only_data.
(EXTRA_SECTION_FUNCTIONS): Rework to use individual function macros.
(READONLY_DATA_FUNCTION, ONE_ONLY_READONLY_DATA_SECTION_FUNCTION,
ONE_ONLY_DATA_SECTION_FUNCTION, FORGET_SECTION_FUNCTION): New defines
for EXTRA_SECTION_FUNCTIONS.
* doc/install.texi: Update binutils requirements.
From-SVN: r84970
-rw-r--r-- | gcc/ChangeLog | 23 | ||||
-rw-r--r-- | gcc/config/pa/pa-hpux10.h | 7 | ||||
-rw-r--r-- | gcc/config/pa/pa-protos.h | 8 | ||||
-rw-r--r-- | gcc/config/pa/pa.c | 91 | ||||
-rw-r--r-- | gcc/config/pa/pa.h | 6 | ||||
-rw-r--r-- | gcc/config/pa/som.h | 95 | ||||
-rw-r--r-- | gcc/doc/install.texi | 16 |
7 files changed, 206 insertions, 40 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index c1c7e01..20048bd 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,26 @@ +2004-07-20 John David Anglin <dava.anglin@nrc-cnrc.gc.ca> + + PR c++/14607 + * config/pa/pa-hpux10.h (SUPPORTS_ONE_ONLY): Define. + (MAKE_DECL_ONE_ONLY): Undefine. + * pa-protos.h (som_text_section_asm_op, one_only_readonly_data_section, + readonly_data, one_only_data_section, forget_section): New prototypes. + * pa.c (pa_init_machine_status, som_text_section_asm_op): New + functions. + (pa_select_section): Add one-only (COMDAT) support. + * pa.h (struct machine_function): Define. + * som.h (ASM_OUTPUT_FUNCTION_PREFIX): Delete. + (TEXT_SECTION_ASM_OP): Call som_text_section_asm_op. + (DEFAULT_TEXT_SECTION_ASM_OP, NEW_TEXT_SECTION_ASM_OP, + ONE_ONLY_TEXT_SECTION_ASM_OP, ONE_ONLY_READONLY_DATA_SECTION_ASM_OP, + ONE_ONLY_DATA_SECTION_ASM_OP): New defines. + (EXTRA_SECTIONS): Add in_one_only_readonly_data and in_one_only_data. + (EXTRA_SECTION_FUNCTIONS): Rework to use individual function macros. + (READONLY_DATA_FUNCTION, ONE_ONLY_READONLY_DATA_SECTION_FUNCTION, + ONE_ONLY_DATA_SECTION_FUNCTION, FORGET_SECTION_FUNCTION): New defines + for EXTRA_SECTION_FUNCTIONS. + * doc/install.texi: Update binutils requirements. + 2004-07-20 Nathan Sidwell <nathan@codesourcery.com> * dbxout.c (dbxout_type): Fix printf format. diff --git a/gcc/config/pa/pa-hpux10.h b/gcc/config/pa/pa-hpux10.h index d3b5d85..6c4dbf5 100644 --- a/gcc/config/pa/pa-hpux10.h +++ b/gcc/config/pa/pa-hpux10.h @@ -136,3 +136,10 @@ Boston, MA 02111-1307, USA. */ better than the assembler shipped with older versions of hpux. */ #undef NEW_HP_ASSEMBLER #define NEW_HP_ASSEMBLER 1 + +/* CVS GAS as of 4/28/04 supports a comdat parameter for the .nsubspa + directive. This provides one only linkage semantics even though we + don't have weak support. */ +#undef SUPPORTS_ONE_ONLY +#define SUPPORTS_ONE_ONLY (TARGET_GAS) +#undef MAKE_DECL_ONE_ONLY diff --git a/gcc/config/pa/pa-protos.h b/gcc/config/pa/pa-protos.h index 0e0dc74..7c9350c 100644 --- a/gcc/config/pa/pa-protos.h +++ b/gcc/config/pa/pa-protos.h @@ -135,6 +135,7 @@ extern int zdepi_cint_p (unsigned HOST_WIDE_INT); extern void override_options (void); extern void output_ascii (FILE *, const char *, int); +extern const char * som_text_section_asm_op (void); extern HOST_WIDE_INT compute_frame_size (HOST_WIDE_INT, int *); extern int and_mask_p (unsigned HOST_WIDE_INT); extern int cint_ok_for_move (HOST_WIDE_INT); @@ -151,7 +152,6 @@ extern int cmpib_comparison_operator (rtx, enum machine_mode); #endif - #ifdef TREE_CODE extern int reloc_needed (tree); #ifdef RTX_CODE @@ -164,3 +164,9 @@ extern int function_arg_partial_nregs (CUMULATIVE_ARGS *, tree, int); extern bool pa_return_in_memory (tree, tree); #endif /* TREE_CODE */ + +/* 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 forget_section (void); diff --git a/gcc/config/pa/pa.c b/gcc/config/pa/pa.c index bd8b0a4..20c0b83 100644 --- a/gcc/config/pa/pa.c +++ b/gcc/config/pa/pa.c @@ -143,6 +143,7 @@ static void pa_hpux_init_libfuncs (void); static rtx pa_struct_value_rtx (tree, int); static bool pa_pass_by_reference (CUMULATIVE_ARGS *ca, enum machine_mode, tree, bool); +static struct machine_function * pa_init_machine_status (void); /* Save the operands last given to a compare for use when we @@ -464,6 +465,8 @@ override_options (void) targetm.asm_out.unaligned_op.si = NULL; targetm.asm_out.unaligned_op.di = NULL; } + + init_machine_status = pa_init_machine_status; } static void @@ -475,6 +478,16 @@ pa_init_builtins (void) #endif } +/* Function to init struct machine_function. + This will be called, via a pointer variable, + from push_function_context. */ + +static struct machine_function * +pa_init_machine_status (void) +{ + return ggc_alloc_cleared (sizeof (machine_function)); +} + /* If FROM is a probable pointer register, mark TO as a probable pointer register with the same pointer alignment as FROM. */ @@ -4210,6 +4223,14 @@ pa_output_function_epilogue (FILE *file, HOST_WIDE_INT size ATTRIBUTE_UNUSED) fputs ("\t.EXIT\n\t.PROCEND\n", file); + if (TARGET_SOM && TARGET_GAS) + { + /* We done with this subspace except possibly for some additional + debug information. Forget that we are in this subspace to ensure + that the next function is output in its own subspace. */ + forget_section (); + } + if (INSN_ADDRESSES_SET_P ()) { insn = get_last_nonnote_insn (); @@ -7995,8 +8016,9 @@ pa_asm_output_mi_thunk (FILE *file, tree thunk_fndecl, HOST_WIDE_INT delta, fprintf (file, "\t.align 4\n"); ASM_OUTPUT_LABEL (file, label); fprintf (file, "\t.word P'%s\n", fname); - function_section (thunk_fndecl); } + else if (TARGET_SOM && TARGET_GAS) + forget_section (); current_thunk_number++; nbytes = ((nbytes + FUNCTION_BOUNDARY / BITS_PER_UNIT - 1) @@ -9144,6 +9166,58 @@ 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. + + 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. */ +const char * +som_text_section_asm_op (void) +{ + if (TARGET_SOM && TARGET_GAS) + { + if (cfun && !cfun->machine->in_nsubspa) + { + /* We only want to emit a .nsubspa directive once at the + start of the function. */ + cfun->machine->in_nsubspa = 1; + + /* Create a new subspace for the text. This provides + better stub placement and one-only functions. */ + if (cfun->decl + && DECL_ONE_ONLY (cfun->decl) + && !DECL_WEAK (cfun->decl)) + return ONE_ONLY_TEXT_SECTION_ASM_OP; + + return NEW_TEXT_SECTION_ASM_OP; + } + else + { + /* There isn't a current function or the body of the current + 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. */ + forget_section (); + } + } + + return DEFAULT_TEXT_SECTION_ASM_OP; +} + /* On hpux10, the linker will give an error if we have a reference in the read-only data section to a symbol defined in a shared library. Therefore, expressions that might require a reloc can @@ -9160,10 +9234,23 @@ pa_select_section (tree exp, int reloc, && (DECL_INITIAL (exp) == error_mark_node || TREE_CONSTANT (DECL_INITIAL (exp))) && !reloc) - readonly_data_section (); + { + if (TARGET_SOM + && DECL_ONE_ONLY (exp) + && !DECL_WEAK (exp)) + one_only_readonly_data_section (); + else + readonly_data_section (); + } else if (TREE_CODE_CLASS (TREE_CODE (exp)) == 'c' && !reloc) readonly_data_section (); + else if (TARGET_SOM + && TREE_CODE (exp) == VAR_DECL + && DECL_ONE_ONLY (exp) + && !DECL_WEAK (exp) + && DECL_INITIAL (exp)) + one_only_data_section (); else data_section (); } diff --git a/gcc/config/pa/pa.h b/gcc/config/pa/pa.h index 9e259f3..80f70de 100644 --- a/gcc/config/pa/pa.h +++ b/gcc/config/pa/pa.h @@ -430,6 +430,12 @@ do { \ #define CAN_DEBUG_WITHOUT_FP /* target machine storage layout */ +typedef struct machine_function GTY(()) +{ + /* Flag indicating that a .NSUBSPA directive has been output for + this function. */ + int in_nsubspa; +} machine_function; /* Define this macro if it is advisable to hold scalars in registers in a wider mode than that declared by the program. In such cases, diff --git a/gcc/config/pa/som.h b/gcc/config/pa/som.h index ae52cd0..d8082d8 100644 --- a/gcc/config/pa/som.h +++ b/gcc/config/pa/som.h @@ -1,5 +1,5 @@ /* Definitions for SOM assembler support. - Copyright (C) 1999, 2001, 2002, 2003 Free Software Foundation, Inc. + Copyright (C) 1999, 2001, 2002, 2003, 2004 Free Software Foundation, Inc. This file is part of GCC. @@ -129,19 +129,6 @@ do { \ #endif -/* NAME refers to the function's name. If we are placing each function into - its own section, we need to switch to the section for this function. Note - that the section name will have a "." prefix. */ -#define ASM_OUTPUT_FUNCTION_PREFIX(FILE, NAME) \ - { \ - const char *name = (*targetm.strip_name_encoding) (NAME); \ - if (TARGET_GAS && in_section == in_text) \ - fputs ("\t.NSUBSPA $CODE$,QUAD=0,ALIGN=8,ACCESS=44,CODE_ONLY\n", FILE); \ - else if (TARGET_GAS) \ - fprintf (FILE, \ - "\t.SUBSPA .%s\n", name); \ - } - #define ASM_DECLARE_FUNCTION_NAME(FILE, NAME, DECL) \ do { tree fntype = TREE_TYPE (TREE_TYPE (DECL)); \ tree tree_type = TREE_TYPE (DECL); \ @@ -219,30 +206,84 @@ do { \ #define TARGET_ASM_FILE_START pa_som_file_start -/* Output before code. */ +/* Select and return a TEXT_SECTION_ASM_OP string. */ +#define TEXT_SECTION_ASM_OP som_text_section_asm_op () -/* Supposedly the assembler rejects the command if there is no tab! */ -#define TEXT_SECTION_ASM_OP "\t.SPACE $TEXT$\n\t.SUBSPA $CODE$\n" +/* Output before code in the default text section. */ +#define DEFAULT_TEXT_SECTION_ASM_OP "\t.SPACE $TEXT$\n\t.SUBSPA $CODE$" -/* Output before read-only data. */ +/* 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" -/* Supposedly the assembler rejects the command if there is no tab! */ +/* Output before read-only data. */ #define READONLY_DATA_ASM_OP "\t.SPACE $TEXT$\n\t.SUBSPA $LIT$\n" -#define EXTRA_SECTIONS in_readonly_data +/* 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. */ +#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. */ +#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 \ -extern void readonly_data (void); \ + 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; \ - fprintf (asm_out_file, "%s\n", READONLY_DATA_ASM_OP); \ + 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). @@ -255,18 +296,8 @@ readonly_data (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) -/* Output before writable data. */ - -/* Supposedly the assembler rejects the command if there is no tab! */ -#define DATA_SECTION_ASM_OP "\t.SPACE $PRIVATE$\n\t.SUBSPA $DATA$\n" - -/* Output before uninitialized data. */ - -#define BSS_SECTION_ASM_OP "\t.SPACE $PRIVATE$\n\t.SUBSPA $BSS$\n" - /* We must not have a reference to an external symbol defined in a shared library in a readonly section, else the SOM linker will complain. diff --git a/gcc/doc/install.texi b/gcc/doc/install.texi index a3a73bb..0af4aa7 100644 --- a/gcc/doc/install.texi +++ b/gcc/doc/install.texi @@ -2607,9 +2607,8 @@ longer a multiple of 2 bytes. @heading @anchor{hppa*-hp-hpux*}hppa*-hp-hpux* Support for HP-UX version 9 and older was discontinued in GCC 3.4. -We @emph{highly} recommend using gas/binutils 2.8 or newer on all hppa -platforms; you may encounter a variety of problems when using the HP -assembler. +We @emph{highly} recommend using gas/binutils on all hppa platforms; +you may encounter a variety of problems when using the HP assembler. Specifically, @option{-g} does not work on HP-UX (since that system uses a peculiar debugging format which GCC does not know about), unless you @@ -2664,6 +2663,13 @@ the 3-stage comparison test to fail during a @samp{make bootstrap}. You should be able to continue by saying @samp{make all} after getting the failure from @samp{make bootstrap}. +GCC 3.5 requires CVS binutils as of April 28, 2004 or later. Earlier +versions require binutils 2.8 or later. + +The C++ ABI has changed incompatibly in GCC 3.5. COMDAT subspaces are +used for one-only code and data. This resolves many of the previous +problems in using C++ on this target. However, the ABI is not compatible +with the one implemented under HP-UX 11 using secondary definitions. @html <hr /> @@ -2732,8 +2738,8 @@ result, it's not possible to switch linkers in the middle of a GCC build. This has been been reported to sometimes occur in unified builds of binutils and GCC. -With GCC 3.0 through 3.2, you must use binutils 2.11 or above. As of -GCC 3.3, binutils 2.14 or later is required. +GCC 3.0 through 3.2 require binutils 2.11 or above. GCC 3.3 through +GCC 3.5 require binutils 2.14 or later. Although the HP assembler can be used for an initial build, it shouldn't be used with any languages other than C and perhaps Fortran due to its |