Tue Jan 26 11:43:14 1993 Ian Lance Taylor (ian@cygnus.com)
authorIan Lance Taylor <ian@airs.com>
Tue, 26 Jan 1993 19:54:07 +0000 (19:54 +0000)
committerIan Lance Taylor <ian@airs.com>
Tue, 26 Jan 1993 19:54:07 +0000 (19:54 +0000)
* section.c (SEC_IS_COMMON): New section flag, needed for MIPS
ECOFF which has two common sections.
(bfd_com_section): Set SEC_IS_COMMON flag.
* bfd-in.h (bfd_is_com_section): New macro to test SEC_IS_COMMON.
* aoutx.h, archive.c, bout.c, coff-a29k.c, coff-m88k.c,
coff-mips.c, coffgen.c, ieee.c, oasys.c, reloc.c, syms.: Use
bfd_is_com_section macro rather than checking for equality to
bfd_com_section.

bfd/ChangeLog
bfd/aoutx.h
bfd/bout.c
bfd/coff-a29k.c
bfd/coff-mips.c

index 37b90fa..7331915 100644 (file)
@@ -1,3 +1,14 @@
+Tue Jan 26 11:43:14 1993  Ian Lance Taylor  (ian@cygnus.com)
+
+       * section.c (SEC_IS_COMMON): New section flag, needed for MIPS
+       ECOFF which has two common sections.
+       (bfd_com_section): Set SEC_IS_COMMON flag.
+       * bfd-in.h (bfd_is_com_section): New macro to test SEC_IS_COMMON.
+       * aoutx.h, archive.c, bout.c, coff-a29k.c, coff-m88k.c,
+       coff-mips.c, coffgen.c, ieee.c, oasys.c, reloc.c, syms.: Use
+       bfd_is_com_section macro rather than checking for equality to
+       bfd_com_section.
+
 Mon Jan 25 15:27:36 1993  Ian Lance Taylor  (ian@cygnus.com)
 
        * coffcode.h (_bfd_coff_mkobject_hook): Pass aouthdr argument.
index eeaa2ba..2c5907d 100644 (file)
@@ -1213,7 +1213,7 @@ DEFUN(translate_to_native_sym_flags,(sym_pointer, cache_ptr, abfd),
   {
     sym_pointer->e_type[0] = (N_UNDF | N_EXT);
   }
-  else if (bfd_get_output_section(cache_ptr) == &bfd_com_section) {
+  else if (bfd_is_com_section (bfd_get_output_section (cache_ptr))) {
       sym_pointer->e_type[0] = (N_UNDF | N_EXT);
     }    
   else {    
@@ -1469,7 +1469,7 @@ DEFUN(NAME(aout,swap_std_reloc_out),(abfd, g, natptr),
      */
      
 
-  if (output_section == &bfd_com_section 
+  if (bfd_is_com_section (output_section)
       || output_section == &bfd_abs_section
       || output_section == &bfd_und_section) 
     {
@@ -1553,7 +1553,7 @@ DEFUN(NAME(aout,swap_ext_reloc_out),(abfd, g, natptr),
      check for that here
      */
      
-  if (output_section == &bfd_com_section 
+  if (bfd_is_com_section (output_section)
       || output_section == &bfd_abs_section
       || output_section == &bfd_und_section) 
   {
@@ -1656,16 +1656,16 @@ DEFUN(NAME(aout,swap_ext_reloc_in), (abfd, bytes, cache_ptr, symbols),
 
   /* now the fun stuff */
   if (abfd->xvec->header_byteorder_big_p != false) {
-    r_index = (  ((int) bytes->r_index[0] << 16)
-              | ((int) bytes->r_index[1] << 8)
-              |  (int) bytes->r_index[2]);
+    r_index =  (bytes->r_index[0] << 16)
+            | (bytes->r_index[1] << 8)
+            |  bytes->r_index[2];
     r_extern = (0 != (bytes->r_type[0] & RELOC_EXT_BITS_EXTERN_BIG));
     r_type   =       (bytes->r_type[0] & RELOC_EXT_BITS_TYPE_BIG)
                                      >> RELOC_EXT_BITS_TYPE_SH_BIG;
   } else {
-    r_index = (  ((int) bytes->r_index[2] << 16)
-              | ((int) bytes->r_index[1] << 8)
-              |  (int) bytes->r_index[0]);
+    r_index =  (bytes->r_index[2] << 16)
+            | (bytes->r_index[1] << 8)
+            |  bytes->r_index[0];
     r_extern = (0 != (bytes->r_type[0] & RELOC_EXT_BITS_EXTERN_LITTLE));
     r_type   =       (bytes->r_type[0] & RELOC_EXT_BITS_TYPE_LITTLE)
                                      >> RELOC_EXT_BITS_TYPE_SH_LITTLE;
@@ -1693,9 +1693,9 @@ DEFUN(NAME(aout,swap_std_reloc_in), (abfd, bytes, cache_ptr, symbols),
 
   /* now the fun stuff */
   if (abfd->xvec->header_byteorder_big_p != false) {
-    r_index = (  ((int) bytes->r_index[0] << 16)
-              | ((int) bytes->r_index[1] << 8)
-              |  (int) bytes->r_index[2]);
+    r_index =  (bytes->r_index[0] << 16)
+      | (bytes->r_index[1] << 8)
+       |  bytes->r_index[2];
     r_extern  = (0 != (bytes->r_type[0] & RELOC_STD_BITS_EXTERN_BIG));
     r_pcrel   = (0 != (bytes->r_type[0] & RELOC_STD_BITS_PCREL_BIG));
     r_baserel = (0 != (bytes->r_type[0] & RELOC_STD_BITS_BASEREL_BIG));
@@ -1704,9 +1704,9 @@ DEFUN(NAME(aout,swap_std_reloc_in), (abfd, bytes, cache_ptr, symbols),
     r_length  =       (bytes->r_type[0] & RELOC_STD_BITS_LENGTH_BIG) 
                        >> RELOC_STD_BITS_LENGTH_SH_BIG;
   } else {
-    r_index = (  ((int) bytes->r_index[2] << 16)
-              | ((int) bytes->r_index[1] << 8)
-              |  (int) bytes->r_index[0]);
+    r_index =  (bytes->r_index[2] << 16)
+      | (bytes->r_index[1] << 8)
+       |  bytes->r_index[0];
     r_extern  = (0 != (bytes->r_type[0] & RELOC_STD_BITS_EXTERN_LITTLE));
     r_pcrel   = (0 != (bytes->r_type[0] & RELOC_STD_BITS_PCREL_LITTLE));
     r_baserel = (0 != (bytes->r_type[0] & RELOC_STD_BITS_BASEREL_LITTLE));
index 25a6b25..23687b3 100644 (file)
@@ -522,11 +522,11 @@ b_out_slurp_reloc_table (abfd, asect, symbols)
     cache_ptr->howto = 0;
     if (abfd->xvec->header_byteorder_big_p) 
     {
-      symnum = ((int) raw[4] << 16) | ((int) raw[5] << 8) | (int) raw[6];
+      symnum = (raw[4] << 16) | (raw[5] << 8) | raw[6];
     } 
     else
     {
-      symnum = ((int) raw[6] << 16) | ((int) raw[5] << 8) | (int) raw[4];
+      symnum = (raw[6] << 16) | (raw[5] << 8) | raw[4];
     }
 
     if (raw[7] & extern_mask) 
@@ -745,7 +745,7 @@ b_out_squirt_out_relocs (abfd, section)
 
     if (r_idx != 0)
       /* already mucked with r_extern, r_idx */;
-    else if (output_section == &bfd_com_section 
+    else if (bfd_is_com_section (output_section)
             || output_section == &bfd_abs_section
             || output_section == &bfd_und_section) 
     {
index 3dd4fac..ccc50f6 100644 (file)
@@ -42,7 +42,7 @@ asymbol *symbol;
 {                                             
   long relocation = 0;
 
-  if (symbol->section == &bfd_com_section) 
+  if (bfd_is_com_section (symbol->section))
   {
     relocation = 0;                           
   }
index 57dd096..210a493 100644 (file)
@@ -191,7 +191,7 @@ DEFUN (ecoff_new_section_hook, (abfd, section),
     section->flags |= SEC_DATA | SEC_LOAD | SEC_ALLOC | SEC_READONLY;
   else if (strcmp (section->name, _BSS) == 0
           || strcmp (section->name, _SBSS) == 0)
-    section->flags |= SEC_ALLOC;
+    section->flags |= SEC_ALLOC | SEC_IS_COMMON;
 
   /* Probably any other section name is SEC_NEVER_LOAD, but I'm
      uncertain about .init on some systems and I don't know how shared
@@ -617,17 +617,8 @@ DEFUN (ecoff_set_symbol_info, (abfd, ecoff_sym, asym, ext),
       asym->value -= asym->section->vma;
       break;
     case scSBss:
-      /* FIXME: putting global .sbss symbols in the common section is
-        wrong, because it means they may not be accessible via the gp
-        register.  But the linker checks the section a symbol is in
-        rather than checking the flags.  */
-      if (ext)
-       asym->section = &bfd_com_section;
-      else
-       {
-         asym->section = bfd_make_section_old_way (abfd, ".sbss");
-         asym->value -= asym->section->vma;
-       }
+      asym->section = bfd_make_section_old_way (abfd, ".sbss");
+      asym->value -= asym->section->vma;
       break;
     case scRData:
       asym->section = bfd_make_section_old_way (abfd, ".rdata");
@@ -637,9 +628,12 @@ DEFUN (ecoff_set_symbol_info, (abfd, ecoff_sym, asym, ext),
       asym->flags = BSF_DEBUGGING;
       break;
     case scCommon:
-    case scSCommon:
       asym->section = &bfd_com_section;
       break;
+    case scSCommon:
+      asym->section = bfd_make_section_old_way (abfd, ".sbss");
+      asym->value -= asym->section->vma;
+      break;
     case scVarRegister:
     case scVariant:
       asym->flags = BSF_DEBUGGING;
@@ -1408,7 +1402,7 @@ DEFUN (ecoff_refhi_reloc, (abfd,
   BFD_ASSERT (rello->howto->type == ECOFF_R_REFLO
              && *rello->sym_ptr_ptr == *reloc_entry->sym_ptr_ptr);
 
-  if (symbol->section == &bfd_com_section)
+  if (bfd_is_com_section (symbol->section))
     relocation = 0;
   else
     relocation = symbol->value;
@@ -1527,7 +1521,7 @@ DEFUN (ecoff_gprel_reloc, (abfd,
        }
     }
 
-  if (symbol->section == &bfd_com_section)
+  if (bfd_is_com_section (symbol->section))
     relocation = 0;
   else
     relocation = symbol->value;
@@ -2355,7 +2349,7 @@ DEFUN (ecoff_get_debug, (output_bfd, seclet, section),
          SYMR sym;
 
          ecoff_swap_sym_in (input_bfd, esym_ptr->native.lnative, &sym);
-         if (esym_ptr->symbol.section != &bfd_com_section
+         if (! bfd_is_com_section (esym_ptr->symbol.section)
              && (esym_ptr->symbol.flags & BSF_DEBUGGING) == 0
              && esym_ptr->symbol.section != &bfd_und_section)
            sym.value = (esym_ptr->symbol.value
@@ -2814,7 +2808,7 @@ DEFUN (ecoff_bfd_seclet_link, (abfd, data, relocateable),
 
          esym.asym.iss = symhdr->issExtMax;
 
-         if (sym_ptr->section == &bfd_com_section
+         if (bfd_is_com_section (sym_ptr->section)
              || sym_ptr->section == &bfd_und_section)
            esym.asym.value = sym_ptr->value;
          else