Add a flag to asection, linker_has_input, and use it to reliably
[deliverable/binutils-gdb.git] / bfd / coff-ppc.c
index 1ad4cca06dc80277a73e4b05b5b6d25048496278..2bf296ab803d186d5ba89d71bb0a5e106b092aa0 100644 (file)
@@ -1,5 +1,6 @@
 /* BFD back-end for PowerPC Microsoft Portable Executable files.
-   Copyright 1990, 91, 92, 93, 94, 95, 96, 97, 98, 1999
+   Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
+   2000, 2001
    Free Software Foundation, Inc.
 
    Original version pieced together by Kim Knuttila (krk@cygnus.com)
@@ -85,7 +86,7 @@ extern void dump_toc PARAMS ((PTR));
 #define HASH_CHECK(addr) \
  if (strcmp(addr->eye_catcher, EYE) != 0) \
   { \
-    fprintf(stderr,\
+    fprintf (stderr,\
     _("File %s, line %d, Hash check failure, bad eye %8s\n"), \
     __FILE__, __LINE__, addr->eye_catcher); \
     abort (); \
@@ -218,7 +219,6 @@ ppc_coff_link_hash_table_create (abfd)
 /* Now, tailor coffcode.h to use our hash stuff */
 
 #define coff_bfd_link_hash_table_create ppc_coff_link_hash_table_create
-
 \f
 /* The nt loader points the toc register to &toc + 32768, in order to */
 /* use the complete range of a 16-bit displacement. We have to adjust */
@@ -316,7 +316,6 @@ ppc_coff_link_hash_table_create (abfd)
 #define EXTRACT_FLAGS(x) ((x) & IMAGE_REL_PPC_FLAGMASK)
 #define EXTRACT_JUNK(x)  \
            ((x) & ~(IMAGE_REL_PPC_TYPEMASK | IMAGE_REL_PPC_FLAGMASK))
-
 \f
 /* static helper functions to make relocation work */
 /* (Work In Progress) */
@@ -344,7 +343,6 @@ static bfd_reloc_status_type ppc_pair_reloc PARAMS ((bfd *abfd,
                                                     asection *section,
                                                     bfd *output_bfd,
                                                     char **error));
-
 \f
 static bfd_reloc_status_type ppc_toc16_reloc PARAMS ((bfd *abfd,
                                                      arelent *reloc,
@@ -388,7 +386,6 @@ static bfd_reloc_status_type ppc_imglue_reloc PARAMS ((bfd *abfd,
                                                       char **error));
 
 static boolean in_reloc_p PARAMS((bfd *abfd, reloc_howto_type *howto));
-
 \f
 /* FIXME: It'll take a while to get through all of these. I only need a few to
    get us started, so those I'll make sure work. Those marked FIXME are either
@@ -769,9 +766,7 @@ static reloc_howto_type ppc_coff_howto_table[] =
         false),                /* pcrel_offset */
 
 };
-
 \f
-
 /* Some really cheezy macros that can be turned on to test stderr :-) */
 
 #ifdef DEBUG_RELOC
@@ -781,13 +776,13 @@ static reloc_howto_type ppc_coff_howto_table[] =
    if (i == 0)                                               \
      {                                                       \
        i = 1;                                                \
-       fprintf(stderr,_("Unimplemented Relocation -- %s\n"),x); \
+       fprintf (stderr,_("Unimplemented Relocation -- %s\n"),x); \
      }                                                       \
 }
 
 #define DUMP_RELOC(n,r)                              \
 {                                                    \
-   fprintf(stderr,"%s sym %d, addr %d, addend %d\n", \
+   fprintf (stderr,"%s sym %d, addr %d, addend %d\n", \
           n, (*(r->sym_ptr_ptr))->name,             \
           r->address, r->addend);                   \
 }
@@ -803,7 +798,7 @@ static reloc_howto_type ppc_coff_howto_table[] =
 
 #define DUMP_RELOC2(n,r)                     \
 {                                            \
-   fprintf(stderr,"%s sym %d, r_vaddr %d %s\n", \
+   fprintf (stderr,"%s sym %d, r_vaddr %d %s\n", \
           n, r->r_symndx, r->r_vaddr,\
           (((r->r_type) & IMAGE_REL_PPC_TOCDEFN) == 0) \
           ?" ":" TOCDEFN"  );      \
@@ -814,7 +809,6 @@ static reloc_howto_type ppc_coff_howto_table[] =
 #define DUMP_RELOC(n,r)
 #define DUMP_RELOC2(n,r)
 #endif
-
 \f
 /* toc construction and management routines */
 
@@ -994,7 +988,6 @@ ppc_mark_symbol_as_glue(abfd, sym, rel)
 
 #endif /* COFF_IMAGE_WITH_PE */
 \f
-
 /* Return true if this relocation should
    appear in the output .reloc section.  */
 
@@ -1258,7 +1251,7 @@ coff_ppc_relocate_section (output_bfd, info, input_bfd, input_section,
                               priv,
                               strdup(name));
 
-                   bfd_put_32(output_bfd,
+                   bfd_put_32 (output_bfd,
                               val,
                               toc_section->contents + our_toc_offset);
 
@@ -1318,7 +1311,7 @@ coff_ppc_relocate_section (output_bfd, info, input_bfd, input_section,
                    record_toc(toc_section, our_toc_offset, pub, strdup(name));
 
                    /* write out the toc entry */
-                   bfd_put_32(output_bfd,
+                   bfd_put_32 (output_bfd,
                               val,
                               toc_section->contents + our_toc_offset);
 
@@ -1383,8 +1376,8 @@ coff_ppc_relocate_section (output_bfd, info, input_bfd, input_section,
                my_name = h->root.root.root.string;
                if (h->symbol_is_glue == 1)
                  {
-                   x = bfd_get_32(input_bfd, loc);
-                   bfd_put_32(input_bfd, h->glue_insn, loc);
+                   x = bfd_get_32 (input_bfd, loc);
+                   bfd_put_32 (input_bfd, h->glue_insn, loc);
                  }
              }
          }
@@ -1410,13 +1403,13 @@ coff_ppc_relocate_section (output_bfd, info, input_bfd, input_section,
                my_name = h->root.root.root.string;
              }
 
-           fprintf(stderr,
+           fprintf (stderr,
                    _("Warning: unsupported reloc %s <file %s, section %s>\n"),
                    howto->name,
                    bfd_get_filename(input_bfd),
                    input_section->name);
 
-           fprintf(stderr,"sym %ld (%s), r_vaddr %ld (%lx)\n",
+           fprintf (stderr,"sym %ld (%s), r_vaddr %ld (%lx)\n",
                    rel->r_symndx, my_name, (long) rel->r_vaddr,
                    (unsigned long) rel->r_vaddr);
          }
@@ -1649,11 +1642,11 @@ dump_toc (vfile)
   FILE *file = (FILE *) vfile;
   struct list_ele *t;
 
-  fprintf(file, _(h1));
-  fprintf(file, _(h2));
-  fprintf(file, _(h3));
+  fprintf (file, _(h1));
+  fprintf (file, _(h2));
+  fprintf (file, _(h3));
 
-  for(t = head; t != 0; t=t->next)
+  for (t = head; t != 0; t=t->next)
     {
       const char *cat = "";
 
@@ -1670,22 +1663,22 @@ dump_toc (vfile)
            cat = _("IAT reference ");
          else
            {
-             fprintf(file,
+             fprintf (file,
                      _("**** global_toc_size %ld(%lx), thunk_size %ld(%lx)\n"),
                      global_toc_size, global_toc_size, thunk_size, thunk_size);
              cat = _("Out of bounds!");
            }
        }
 
-      fprintf(file,
+      fprintf (file,
              " %04lx    (%d)", (unsigned long) t->offset, t->offset - 32768);
-      fprintf(file,
+      fprintf (file,
              "    %s %s\n",
              cat, t->name);
 
     }
 
-  fprintf(file, "\n");
+  fprintf (file, "\n");
 }
 
 boolean
@@ -1865,7 +1858,6 @@ ppc_pair_reloc (abfd,
 
   return bfd_reloc_undefined;
 }
-
 \f
 static bfd_reloc_status_type
 ppc_toc16_reloc (abfd,
@@ -2000,9 +1992,7 @@ ppc_imglue_reloc (abfd,
 
   return bfd_reloc_ok;
 }
-
 \f
-
 #define MAX_RELOC_INDEX  \
       (sizeof (ppc_coff_howto_table) / sizeof (ppc_coff_howto_table[0]) - 1)
 
@@ -2067,7 +2057,7 @@ ppc_coff_rtype2howto (relent, internal)
        howto = ppc_coff_howto_table + IMAGE_REL_PPC_TOCREL16;
       break;
     default:
-      fprintf(stderr,
+      fprintf (stderr,
              _("Warning: Unsupported reloc %s [%d] used -- it may not work.\n"),
              ppc_coff_howto_table[r_type].name,
              r_type);
@@ -2142,7 +2132,7 @@ coff_ppc_rtype_to_howto (abfd, sec, rel, h, sym, addendp)
       howto = ppc_coff_howto_table + r_type;
       break;
     default:
-      fprintf(stderr,
+      fprintf (stderr,
              _("Warning: Unsupported reloc %s [%d] used -- it may not work.\n"),
              ppc_coff_howto_table[r_type].name,
              r_type);
@@ -2183,7 +2173,6 @@ ppc_coff_reloc_type_lookup (abfd, code)
 }
 
 #undef HOW2MAP
-
 \f
 /* Tailor coffcode.h -- macro heaven.  */
 
@@ -2229,9 +2218,7 @@ static void ppc_coff_swap_sym_in_hook PARAMS ((bfd *, PTR, PTR));
   COFF_ALIGNMENT_FIELD_EMPTY, COFF_ALIGNMENT_FIELD_EMPTY, 1 }
 
 #include "coffcode.h"
-
 \f
-
 #ifndef COFF_IMAGE_WITH_PE
 /* FIXME:
    What we're trying to do here is allocate a toc section (early), and attach
@@ -2826,7 +2813,6 @@ ppc_bfd_coff_final_link (abfd, info)
 }
 #endif
 \f
-
 /* Forward declaration for use by alternative_target field.  */
 #ifdef TARGET_BIG_SYM
 extern const bfd_target TARGET_BIG_SYM;
This page took 0.026791 seconds and 4 git commands to generate.