elf.h, som.h (ASM_OUTPUT_EXTERNAL): Use assemble_name_raw instead of trying to save...
authorJohn David Anglin <dave.anglin@nrc-cnrc.gc.ca>
Sun, 27 Feb 2005 04:22:06 +0000 (04:22 +0000)
committerJohn David Anglin <danglin@gcc.gnu.org>
Sun, 27 Feb 2005 04:22:06 +0000 (04:22 +0000)
* pa/elf.h, pa/som.h (ASM_OUTPUT_EXTERNAL): Use assemble_name_raw
instead of trying to save and restore TREE_SYMBOL_REFERENCED.
* pa/pa64-hpux.h (ASM_OUTPUT_TYPE_DIRECTIVE): Define.
(ASM_OUTPUT_EXTERNAL): Don't save and restore TREE_SYMBOL_REFERENCED.

From-SVN: r95605

gcc/ChangeLog
gcc/config/pa/elf.h
gcc/config/pa/pa64-hpux.h
gcc/config/pa/som.h

index 92166e1c960fb56364608fd7b3bb1a7dfb6b3b5a..4552e188b9aef13ce1d22ac1b1f06270077db21a 100644 (file)
@@ -1,3 +1,10 @@
+2005-02-26  John David Anglin  <dave.anglin@nrc-cnrc.gc.ca>
+
+       * pa/elf.h, pa/som.h (ASM_OUTPUT_EXTERNAL): Use assemble_name_raw
+       instead of trying to save and restore TREE_SYMBOL_REFERENCED.
+       * pa/pa64-hpux.h (ASM_OUTPUT_TYPE_DIRECTIVE): Define.
+       (ASM_OUTPUT_EXTERNAL): Don't save and restore TREE_SYMBOL_REFERENCED.
+
 2005-02-26  Nathanael Nerode  <neroden@gcc.gnu.org>
 
        * configure.ac: Rename cc_for_cross_gnattools to host_cc_for_libada.
index 0752e7b5b29d0a04dd44e7944261250333fe2380..fe48c3d0fa847d922e6576281f82b581c9881d99 100644 (file)
@@ -1,5 +1,5 @@
 /* Definitions for ELF assembler support.
-   Copyright (C) 1999, 2003 Free Software Foundation, Inc.
+   Copyright (C) 1999, 2003, 2005 Free Software Foundation, Inc.
 
 This file is part of GCC.
 
@@ -45,27 +45,26 @@ do {  \
     } \
    } while (0)
 
-/* This is how to output a command to make the user-level label named NAME
-   defined for reference from other files.
-
-   We call assemble_name, which in turn sets TREE_SYMBOL_REFERENCED.  This
-   macro will restore the original value of TREE_SYMBOL_REFERENCED to avoid
-   placing useless function definitions in the output file.
-
-   Also note that the SOM based tools need the symbol imported as a CODE
-   symbol, while the ELF based tools require the symbol to be imported as
-   an ENTRY symbol.  What a crock.  */
-
-#define ASM_OUTPUT_EXTERNAL(FILE, DECL, NAME)  \
-  do { int save_referenced;                                    \
-       save_referenced = TREE_SYMBOL_REFERENCED (DECL_ASSEMBLER_NAME (DECL)); \
-       fputs ("\t.IMPORT ", FILE);                                     \
-        assemble_name (FILE, NAME);                            \
-       if (FUNCTION_NAME_P (NAME))                                     \
-        fputs (",ENTRY\n", FILE);                              \
-       else                                                    \
-        fputs (",DATA\n", FILE);                               \
-       TREE_SYMBOL_REFERENCED (DECL_ASSEMBLER_NAME (DECL)) = save_referenced; \
+/* This is how to output a command to make the user-level label
+   named NAME defined for reference from other files.  We use
+   assemble_name_raw instead of assemble_name since a symbol in
+   a .IMPORT directive that isn't otherwise referenced is not
+   placed in the symbol table of the assembled object.
+
+   Failure to import a function reference can cause the HP linker
+   to segmentation fault!
+
+   Note that the SOM based tools need the symbol imported as a
+   CODE symbol, while the ELF based tools require the symbol to
+   be imported as an ENTRY symbol.  */
+
+#define ASM_OUTPUT_EXTERNAL(FILE, DECL, NAME) \
+  do { fputs ("\t.IMPORT ", FILE);                                     \
+       assemble_name_raw (FILE, NAME);                                 \
+       if (FUNCTION_NAME_P (NAME))                                             \
+        fputs (",ENTRY\n", FILE);                                      \
+       else                                                            \
+        fputs (",DATA\n", FILE);                                       \
      } while (0)
 
 /* The bogus HP assembler requires ALL external references to be
index 75573ed6cbab166ed53fab34182bc8a9a4de8c7c..5de502d49c19ced5828e479cba7c50122a7e0c92 100644 (file)
@@ -174,6 +174,20 @@ Boston, MA 02111-1307, USA.  */
 /* This is how we globalize a label.  */
 #define GLOBAL_ASM_OP  "\t.globl\t"
 
+/* Hacked version from defaults.h that uses assemble_name_raw
+   instead of assemble_name.  A symbol in a type directive that
+   isn't otherwise referenced doesn't cause the symbol to be
+   placed in the symbol table of the assembled object.  */
+#undef ASM_OUTPUT_TYPE_DIRECTIVE
+#define ASM_OUTPUT_TYPE_DIRECTIVE(STREAM, NAME, TYPE)          \
+do {                                                           \
+  fputs (TYPE_ASM_OP, STREAM);                                 \
+  assemble_name_raw (STREAM, NAME);                            \
+  fputs (", ", STREAM);                                                \
+  fprintf (STREAM, TYPE_OPERAND_FMT, TYPE);                    \
+  putc ('\n', STREAM);                                         \
+} while (0)
+
 /* Hacked version from elfos.h that doesn't output a label.  */
 #undef ASM_DECLARE_FUNCTION_NAME
 #define ASM_DECLARE_FUNCTION_NAME(FILE, NAME, DECL)            \
@@ -186,15 +200,12 @@ do {                                                              \
    dynamic loader to work correctly.  This is equivalent to the
    HP assembler's .IMPORT directive but relates more directly to
    ELF object file types.  */
-#define ASM_OUTPUT_EXTERNAL(FILE, DECL, NAME)                          \
-do {                                                                   \
-  int save_referenced;                                                 \
-  save_referenced = TREE_SYMBOL_REFERENCED (DECL_ASSEMBLER_NAME (DECL));\
-  if (FUNCTION_NAME_P (NAME))                                          \
-    ASM_OUTPUT_TYPE_DIRECTIVE (FILE, NAME, "function");                        \
-  else                                                                 \
-    ASM_OUTPUT_TYPE_DIRECTIVE (FILE, NAME, "object");                  \
-  TREE_SYMBOL_REFERENCED (DECL_ASSEMBLER_NAME (DECL)) = save_referenced;\
+#define ASM_OUTPUT_EXTERNAL(FILE, DECL, NAME)                  \
+do {                                                           \
+  if (FUNCTION_NAME_P (NAME))                                  \
+    ASM_OUTPUT_TYPE_DIRECTIVE (FILE, NAME, "function");                \
+  else                                                         \
+    ASM_OUTPUT_TYPE_DIRECTIVE (FILE, NAME, "object");          \
 } while (0)
 
 /* We need set the type for external libcalls.  Also note that not all
index e06a0912493b186babee4da7ce1cd4d785758371..2585bb4d1593afdf5babc18de0e99e5d55121e31 100644 (file)
@@ -216,27 +216,26 @@ do {                                                              \
    So, we force exception information into the data section.  */
 #define TARGET_ASM_EXCEPTION_SECTION data_section
 
-/* This is how to output a command to make the user-level label named NAME
-   defined for reference from other files.
-
-   We call assemble_name, which in turn sets TREE_SYMBOL_REFERENCED.  This
-   macro will restore the original value of TREE_SYMBOL_REFERENCED to avoid
-   placing useless function definitions in the output file.
-
-   Also note that the SOM based tools need the symbol imported as a CODE
-   symbol, while the ELF based tools require the symbol to be imported as
-   an ENTRY symbol.  What a crock.  */
-
-#define ASM_OUTPUT_EXTERNAL(FILE, DECL, NAME)  \
-  do { int save_referenced;                                    \
-       save_referenced = TREE_SYMBOL_REFERENCED (DECL_ASSEMBLER_NAME (DECL)); \
-       fputs ("\t.IMPORT ", FILE);                             \
-       assemble_name (FILE, NAME);                             \
-       if (FUNCTION_NAME_P (NAME))                                     \
-        fputs (",CODE\n", FILE);                               \
-       else                                                    \
-        fputs (",DATA\n", FILE);                               \
-       TREE_SYMBOL_REFERENCED (DECL_ASSEMBLER_NAME (DECL)) = save_referenced; \
+/* This is how to output a command to make the user-level label
+   named NAME defined for reference from other files.  We use
+   assemble_name_raw instead of assemble_name since a symbol in
+   a .IMPORT directive that isn't otherwise referenced is not
+   placed in the symbol table of the assembled object.
+
+   Failure to import a function reference can cause the HP linker
+   to segmentation fault!
+
+   Note that the SOM based tools need the symbol imported as a
+   CODE symbol, while the ELF based tools require the symbol to
+   be imported as an ENTRY symbol.  */
+
+#define ASM_OUTPUT_EXTERNAL(FILE, DECL, NAME) \
+  do { fputs ("\t.IMPORT ", FILE);                                     \
+       assemble_name_raw (FILE, NAME);                                 \
+       if (FUNCTION_NAME_P (NAME))                                     \
+        fputs (",CODE\n", FILE);                                       \
+       else                                                            \
+        fputs (",DATA\n", FILE);                                       \
      } while (0)
 
 /* The bogus HP assembler requires ALL external references to be