* sparc.h: Fix typo.
[deliverable/binutils-gdb.git] / ld / ldctor.c
index ab810cd096d2affca2974b609c194a1373155b93..1c8439bc871ed5aa9240f67c43853c482b6977c3 100644 (file)
@@ -1,8 +1,8 @@
 /* ldctor.c -- constructor support routines
-   Copyright (C) 1991, 92, 93, 94, 95, 96, 97, 1998
+   Copyright 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000
    Free Software Foundation, Inc.
    By Steve Chamberlain <sac@cygnus.com>
-   
+
 This file is part of GLD, the Gnu Linker.
 
 GLD is free software; you can redistribute it and/or modify
@@ -86,7 +86,8 @@ ldctor_add_set_entry (h, reloc, name, section, value)
     {
       if (p->reloc != reloc)
        {
-         einfo (_("%P%X: Different relocs used in set %s\n"), h->root.string);
+         einfo (_("%P%X: Different relocs used in set %s\n"),
+                h->root.string);
          return;
        }
 
@@ -136,7 +137,7 @@ ctor_prio (name)
   while (*name == '_')
     ++name;
 
-  if (strncmp (name, "GLOBAL_",  sizeof "GLOBAL_" - 1) != 0)
+  if (strncmp (name, "GLOBAL_", sizeof "GLOBAL_" - 1) != 0)
     return -1;
 
   name += sizeof "GLOBAL_" - 1;
@@ -165,7 +166,6 @@ ctor_cmp (p1, p2)
   const char *n2;
   int prio1;
   int prio2;
-  int ret;
 
   n1 = (*pe1)->name;
   if (n1 == NULL)
@@ -295,8 +295,9 @@ ldctor_build_sets ()
 
          /* If this is not a relocateable link, all we need is the
             size, which we can get from the input BFD.  */
-         howto = bfd_reloc_type_lookup (p->elements->section->owner,
-                                        p->reloc);
+         if (p->elements->section->owner != NULL)
+           howto = bfd_reloc_type_lookup (p->elements->section->owner,
+                                          p->reloc);
          if (howto == NULL)
            {
              einfo (_("%P%X: %s does not support reloc %s for set %s\n"),
@@ -365,6 +366,10 @@ ldctor_build_sets ()
                minfo ("%G\n", e->section->owner, e->section, e->value);
            }
 
+         /* Need SEC_KEEP for --gc-sections.  */
+         if (! bfd_is_abs_section (e->section))
+           e->section->flags |= SEC_KEEP;
+
          if (link_info.relocateable)
            lang_add_reloc (p->reloc, howto, e->section, e->name,
                            exp_intop (e->value));
This page took 0.079492 seconds and 4 git commands to generate.