* config/obj-aout.c (obj_aout_frob_symbol): If N_EXT is set for an
authorIan Lance Taylor <ian@airs.com>
Fri, 25 Mar 1994 22:53:40 +0000 (22:53 +0000)
committerIan Lance Taylor <ian@airs.com>
Fri, 25 Mar 1994 22:53:40 +0000 (22:53 +0000)
N_INDR symbol, set BSF_EXPORT and clear BSF_LOCAL.

gas/ChangeLog
gas/config/obj-aout.c

index e81f66a..2911d44 100644 (file)
@@ -1,5 +1,8 @@
 Fri Mar 25 17:35:49 1994  Ian Lance Taylor  (ian@tweedledumb.cygnus.com)
 
+       * config/obj-aout.c (obj_aout_frob_symbol): If N_EXT is set for an
+       N_INDR symbol, set BSF_EXPORT and clear BSF_LOCAL.
+
        * config/tc-mips.c (append_insn): If EMBEDDED_PIC, don't swap a
        branch with an instruction that uses $at, in case the branch is
        later expanded.
index 8baa1b2..332a65f 100644 (file)
@@ -19,6 +19,7 @@ to the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
 
 #include "as.h"
 #ifdef BFD_ASSEMBLER
+#undef NO_RELOC
 #include "aout/aout64.h"
 #endif
 #include "obstack.h"
@@ -136,6 +137,11 @@ obj_aout_frob_symbol (sym, punt)
          /* Put indirect symbols in the indirect section.  */
          sym->bsym->section = &bfd_ind_section;
          sym->bsym->flags |= BSF_INDIRECT;
+         if (type & N_EXT)
+           {
+             sym->bsym->flags |= BSF_EXPORT;
+             sym->bsym->flags &=~ BSF_LOCAL;
+           }
          break;
        case N_WARNING:
          /* Mark warning symbols.  */
@@ -151,6 +157,27 @@ obj_aout_frob_symbol (sym, punt)
   S_SET_TYPE (sym, type);
 }
 
+void
+obj_aout_frob_file ()
+{
+  /* Relocation processing may require knowing the VMAs of the sections.
+     Since writing to a section will cause the BFD back end to compute the
+     VMAs, fake it out here....  */
+  bfd_byte b = 0;
+  boolean x = true;
+  if (bfd_section_size (stdoutput, text_section) != 0)
+    {
+      x = bfd_set_section_contents (stdoutput, text_section, &b, (file_ptr) 0,
+                                   (bfd_size_type) 1);
+    }
+  else if (bfd_section_size (stdoutput, data_section) != 0)
+    {
+      x = bfd_set_section_contents (stdoutput, data_section, &b, (file_ptr) 0,
+                                   (bfd_size_type) 1);
+    }
+  assert (x == true);
+}
+
 #else
 
 /* Relocation. */
@@ -167,7 +194,7 @@ obj_emit_relocations (where, fixP, segment_address_in_file)
      relax_addressT segment_address_in_file;
 {
   for (; fixP; fixP = fixP->fx_next)
-    if (fixP->fx_addsy != NULL)
+    if (fixP->fx_done == 0)
       {
        tc_aout_fix_to_chars (*where, fixP, segment_address_in_file);
        *where += md_reloc_size;
@@ -306,12 +333,10 @@ obj_crawl_symbol_chain (headers)
       if (!S_IS_REGISTER (symbolP)
          && (!S_GET_NAME (symbolP)
              || S_IS_DEBUG (symbolP)
-#ifdef TC_I960
-      /* FIXME-SOON this ifdef seems highly dubious to me.  xoxorich. */
              || !S_IS_DEFINED (symbolP)
              || S_IS_EXTERNAL (symbolP)
-#endif /* TC_I960 */
-             || (S_GET_NAME (symbolP)[0] != '\001' && (flagseen['L'] || !S_LOCAL_NAME (symbolP)))))
+             || (S_GET_NAME (symbolP)[0] != '\001'
+                 && (flagseen['L'] || !S_LOCAL_NAME (symbolP)))))
        {
          symbolP->sy_number = symbol_number++;
 
@@ -330,6 +355,9 @@ obj_crawl_symbol_chain (headers)
       else
        {
          if (S_IS_EXTERNAL (symbolP) || !S_IS_DEFINED (symbolP))
+           /* This warning should never get triggered any more.
+              Well, maybe if you're doing twisted things with
+              register names...  */
            {
              as_bad ("Local symbol %s never defined.", decode_local_label_name (S_GET_NAME (symbolP)));
            }                   /* oops. */