* coffgen.c (coff_write_symbols): Check to see if a symbol's flags
authorNick Clifton <nickc@redhat.com>
Tue, 30 Sep 2008 10:50:03 +0000 (10:50 +0000)
committerNick Clifton <nickc@redhat.com>
Tue, 30 Sep 2008 10:50:03 +0000 (10:50 +0000)
       do not match it class and if necessary update the class.
       (null_error_handler): New function.  Suppresses the generation of
       bfd error messages.
     * coff64-rs6000.c (bfd_xcoff_backend_data): Update comment.
     * config/tc-tic4x.c (tic4x_globl): Call S_SET_EXTERNAL as well as
     S_SET_STORAGE_CLASS.

bfd/ChangeLog
bfd/coff64-rs6000.c
bfd/coffgen.c
gas/ChangeLog
gas/config/tc-tic4x.c

index 9f40340abe812d1c4bb2dab0a90ac9933ca3ef71..f77553615539606bf9d84b07c669f8e495db90d7 100644 (file)
@@ -1,3 +1,12 @@
+2008-09-30  Wesley W. Terpstra  <wesley@terpstra.ca>
+           Nick Clifton  <nickc@redhat.com>
+
+       * coffgen.c (coff_write_symbols): Check to see if a symbol's flags
+       do not match it class and if necessary update the class.
+       (null_error_handler): New function.  Suppresses the generation of
+       bfd error messages.
+       * coff64-rs6000.c (bfd_xcoff_backend_data): Update comment.
+
 2008-09-30  Alan Modra  <amodra@bigpond.net.au>
 
        * Makefile.am: Run "make dep-am".
index 7a0ec1f2ca5af53bbc5e6b1a802883cb0acd11de..ee797ed4a28f23ed3443244b370b55148aaad5a6 100644 (file)
@@ -2580,7 +2580,7 @@ static const struct xcoff_backend_data_rec bfd_xcoff_backend_data =
       coff_print_aux,
       dummy_reloc16_extra_cases,
       dummy_reloc16_estimate,
-      NULL,                    /* bfd_coff_sym_is_global */
+      NULL,                    /* bfd_coff_symbol_classification */
       coff_compute_section_file_positions,
       NULL,                    /* _bfd_coff_start_final_link */
       xcoff64_ppc_relocate_section,
index 17d46a2d5b8fa1e4ba4d67798edac3bec6a12443..469cdfa495c9c27fa1d1e0dd4a2cf77be6e3fdcf 100644 (file)
@@ -1082,6 +1082,11 @@ coff_write_native_symbol (bfd *abfd,
                            debug_string_size_p);
 }
 
+static void
+null_error_handler (const char * fmt ATTRIBUTE_UNUSED, ...)
+{
+}
+
 /* Write out the COFF symbols.  */
 
 bfd_boolean
@@ -1138,6 +1143,42 @@ coff_write_symbols (bfd *abfd)
        }
       else
        {
+         if (coff_backend_info (abfd)->_bfd_coff_classify_symbol != NULL)
+           {
+             bfd_error_handler_type current_error_handler;
+             enum coff_symbol_classification class;
+             unsigned char *n_sclass;
+
+             /* Suppress error reporting by bfd_coff_classify_symbol.
+                Error messages can be generated when we are processing a local
+                symbol which has no associated section and we do not have to
+                worry about this, all we need to know is that it is local.  */
+             current_error_handler = bfd_set_error_handler (null_error_handler);
+             class = bfd_coff_classify_symbol (abfd, &c_symbol->native->u.syment);
+             (void) bfd_set_error_handler (current_error_handler);
+         
+             n_sclass = &c_symbol->native->u.syment.n_sclass;
+
+             /* If the symbol class has been changed (eg objcopy/ld script/etc)
+                we cannot retain the existing sclass from the original symbol.
+                Weak symbols only have one valid sclass, so just set it always.
+                If it is not local class and should be, set it C_STAT.
+                If it is global and not classified as global, or if it is
+                weak (which is also classified as global), set it C_EXT.  */
+
+             if (symbol->flags & BSF_WEAK)
+               *n_sclass = obj_pe (abfd) ? C_NT_WEAK : C_WEAKEXT;
+             else if (symbol->flags & BSF_LOCAL && class != COFF_SYMBOL_LOCAL)
+               *n_sclass = C_STAT;
+             else if (symbol->flags & BSF_GLOBAL
+                      && (class != COFF_SYMBOL_GLOBAL
+#ifdef COFF_WITH_PE
+                          || *n_sclass == C_NT_WEAK
+#endif
+                          || *n_sclass == C_WEAKEXT))
+               c_symbol->native->u.syment.n_sclass = C_EXT;
+           }
+
          if (!coff_write_native_symbol (abfd, c_symbol, &written,
                                         &string_size, &debug_string_section,
                                         &debug_string_size))
index 053a6ced6be32cfb4b388ec7f9c8e295faf14827..1054ef3e8db3638d6a3cb6011ba7a7ec8574ff97 100644 (file)
@@ -1,3 +1,18 @@
+2008-09-30  Wesley W. Terpstra  <wesley@terpstra.ca>
+           Nick Clifton  <nickc@redhat.com>
+
+       * config/tc-tic4x.c (tic4x_globl): Call S_SET_EXTERNAL as well as
+       S_SET_STORAGE_CLASS.
+
+2008-09-30  Wesley W. Terpstra  <wesley@terpstra.ca>
+           Nick Clifton  <nickc@redhat.com>
+
+       * coffgen.c (coff_write_symbols): Check to see if a symbol's flags
+       do not match it class and if necessary update the class.
+       (null_error_handler): New function.  Suppresses the generation of
+       bfd error messages.
+       * coff64-rs6000.c (bfd_xcoff_backend_data): Update comment.
+
 2008-09-30  Alan Modra  <amodra@bigpond.net.au>
 
        * Makefile.am: Run "make dep-am".
index c373e20565debb5dd166cbb01bfac22e30213b0d..bc92de2da553371c8c818af1914057612a1e8154 100644 (file)
@@ -821,6 +821,7 @@ tic4x_globl (int ignore ATTRIBUTE_UNUSED)
       *input_line_pointer = c;
       SKIP_WHITESPACE ();
       S_SET_STORAGE_CLASS (symbolP, C_EXT);
+      S_SET_EXTERNAL (symbolP);
       if (c == ',')
        {
          input_line_pointer++;
This page took 0.031458 seconds and 4 git commands to generate.