* elflink.h (elf_link_output_extsym): Use the right section for a
authorIan Lance Taylor <ian@airs.com>
Thu, 26 Jun 1997 05:27:56 +0000 (05:27 +0000)
committerIan Lance Taylor <ian@airs.com>
Thu, 26 Jun 1997 05:27:56 +0000 (05:27 +0000)
common symbol.
* elf32-mips.c (mips_elf_link_output_symbol_hook): If a common
symbol was in .scommon, mark it as SHN_MIPS_SCOMMON.
PR 12697.

bfd/ChangeLog
bfd/elf32-mips.c
bfd/elflink.h

index 4dc6767c5aca0e1d527ec0088d69f8a90295dd66..bc698276ca4032da0857fd9c77eb802c09e8bf57 100644 (file)
@@ -1,3 +1,10 @@
+Thu Jun 26 01:26:31 1997  Ian Lance Taylor  <ian@cygnus.com>
+
+       * elflink.h (elf_link_output_extsym): Use the right section for a
+       common symbol.
+       * elf32-mips.c (mips_elf_link_output_symbol_hook): If a common
+       symbol was in .scommon, mark it as SHN_MIPS_SCOMMON.
+
 Wed Jun 25 12:43:10 1997  H.J. Lu  <hjl@gnu.ai.mit.edu>
 
        * elflink.h (elf_merge_symbols): Resolve indirect and warning
index c094b763457d0447de3e858babf3a9dbbe83952a..af80f5f291d97bf5835a6815b8550a2ee7964626 100644 (file)
@@ -2414,7 +2414,7 @@ _bfd_mips_elf_set_section_contents (abfd, section, location, offset, count)
            size = section->_cooked_size;
          else
            size = section->_raw_size;
-         c = (PTR) bfd_zalloc (abfd, size);
+         c = (bfd_byte *) bfd_zalloc (abfd, size);
          if (c == NULL)
            return false;
          elf_section_data (section)->tdata = (PTR) c;
@@ -3711,7 +3711,7 @@ mips_elf_create_procedure_table (handle, abfd, info, s, debug)
 
   /* Set the size and contents of .rtproc section.  */
   s->_raw_size = size;
-  s->contents = rtproc;
+  s->contents = (bfd_byte *) rtproc;
 
   /* Skip this section later on (I don't think this currently
      matters, but someday it might).  */
@@ -5412,8 +5412,8 @@ mips_elf_relocate_section (output_bfd, info, input_bfd, input_section,
 }
 
 /* This hook function is called before the linker writes out a global
-   symbol.  This is where we undo the increment of the value for a
-   mips16 symbol.  */
+   symbol.  We mark symbols as small common if appropriate.  This is
+   also where we undo the increment of the value for a mips16 symbol.  */
 
 /*ARGSIGNORED*/
 static boolean
@@ -5424,9 +5424,17 @@ mips_elf_link_output_symbol_hook (abfd, info, name, sym, input_sec)
      Elf_Internal_Sym *sym;
      asection *input_sec;
 {
+  /* If we see a common symbol, which implies a relocatable link, then
+     if a symbol was small common in an input file, mark it as small
+     common in the output file.  */
+  if (sym->st_shndx == SHN_COMMON
+      && strcmp (input_sec->name, ".scommon") == 0)
+    sym->st_shndx = SHN_MIPS_SCOMMON;
+
   if (sym->st_other == STO_MIPS16
       && (sym->st_value & 1) != 0)
     --sym->st_value;
+
   return true;
 }
 \f
index d0fccf30a864b2875fb6283fbb11514598f805a5..82e10d214f4ba698ee01e11ff22f31d3dbbd6b7d 100644 (file)
@@ -4277,7 +4277,7 @@ elf_link_output_extsym (h, data)
       break;
 
     case bfd_link_hash_common:
-      input_sec = bfd_com_section_ptr;
+      input_sec = h->root.u.c.p->section;
       sym.st_shndx = SHN_COMMON;
       sym.st_value = 1 << h->root.u.c.p->alignment_power;
       break;
This page took 0.038649 seconds and 4 git commands to generate.