*** empty log message ***
[deliverable/binutils-gdb.git] / ld / ldmain.c
index f9e13483df995c0e4c5733699f7fb9a28b0f0fa8..1784b16c16acb87825b96c336a0a8169e12b7246 100644 (file)
@@ -1,6 +1,6 @@
 /* Main program of GNU linker.
    Copyright 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001,
-   2002, 2003, 2004, 2005
+   2002, 2003, 2004, 2005, 2006
    Free Software Foundation, Inc.
    Written by Steve Chamberlain steve@cygnus.com
 
@@ -212,7 +212,7 @@ main (int argc, char **argv)
     {
       if (*TARGET_SYSTEM_ROOT == 0)
        {
-         einfo ("%P%F: this linker was not configured to use sysroots");
+         einfo ("%P%F: this linker was not configured to use sysroots\n");
          ld_sysroot = "";
        }
       else
@@ -256,7 +256,6 @@ main (int argc, char **argv)
   command_line.warn_mismatch = TRUE;
   command_line.check_section_addresses = TRUE;
   command_line.accept_unknown_input_arch = FALSE;
-  command_line.reduce_memory_overheads = FALSE;
 
   sort_section = none;
 
@@ -304,6 +303,8 @@ main (int argc, char **argv)
   link_info.create_object_symbols_section = NULL;
   link_info.gc_sym_list = NULL;
   link_info.base_file = NULL;
+  link_info.emit_hash = TRUE;
+  link_info.emit_gnu_hash = FALSE;
   /* SVR4 linkers seem to set DT_INIT and DT_FINI based on magic _init
      and _fini symbols.  We are compatible.  */
   link_info.init_function = "_init";
@@ -313,9 +314,15 @@ main (int argc, char **argv)
   link_info.spare_dynamic_tags = 5;
   link_info.flags = 0;
   link_info.flags_1 = 0;
-  link_info.need_relax_finalize = FALSE;
+  link_info.relax_pass = 1;
   link_info.warn_shared_textrel = FALSE;
   link_info.gc_sections = FALSE;
+  link_info.print_gc_sections = FALSE;
+  link_info.dynamic = NULL;
+  link_info.reduce_memory_overheads = FALSE;
+
+  config.maxpagesize = 0;
+  config.commonpagesize = 0;
 
   ldfile_add_arch ("");
 
@@ -335,6 +342,13 @@ main (int argc, char **argv)
   if (config.hash_table_size != 0)
     bfd_hash_set_default_size (config.hash_table_size);
 
+  if (config.maxpagesize != 0)
+    bfd_emul_set_maxpagesize (default_target, config.maxpagesize);
+
+  if (config.commonpagesize != 0)
+    bfd_emul_set_commonpagesize (default_target,
+                                config.commonpagesize);
+
   ldemul_set_symbols ();
 
   if (link_info.relocatable)
@@ -594,7 +608,7 @@ get_sysroot (int argc, char **argv)
   const char *path;
 
   for (i = 1; i < argc; i++)
-    if (strncmp (argv[i], "--sysroot=", strlen ("--sysroot=")) == 0)
+    if (CONST_STRNEQ (argv[i], "--sysroot="))
       return argv[i] + strlen ("--sysroot=");
 
   path = get_relative_sysroot (BINDIR);
@@ -623,7 +637,7 @@ get_emulation (int argc, char **argv)
 
   for (i = 1; i < argc; i++)
     {
-      if (!strncmp (argv[i], "-m", 2))
+      if (CONST_STRNEQ (argv[i], "-m"))
        {
          if (argv[i][2] == '\0')
            {
@@ -777,9 +791,10 @@ add_ysym (const char *name)
   if (link_info.notice_hash == NULL)
     {
       link_info.notice_hash = xmalloc (sizeof (struct bfd_hash_table));
-      if (! bfd_hash_table_init_n (link_info.notice_hash,
-                                  bfd_hash_newfunc,
-                                  61))
+      if (!bfd_hash_table_init_n (link_info.notice_hash,
+                                 bfd_hash_newfunc,
+                                 sizeof (struct bfd_hash_entry),
+                                 61))
        einfo (_("%P%F: bfd_hash_table_init failed: %E\n"));
     }
 
@@ -795,9 +810,10 @@ add_wrap (const char *name)
   if (link_info.wrap_hash == NULL)
     {
       link_info.wrap_hash = xmalloc (sizeof (struct bfd_hash_table));
-      if (! bfd_hash_table_init_n (link_info.wrap_hash,
-                                  bfd_hash_newfunc,
-                                  61))
+      if (!bfd_hash_table_init_n (link_info.wrap_hash,
+                                 bfd_hash_newfunc,
+                                 sizeof (struct bfd_hash_entry),
+                                 61))
        einfo (_("%P%F: bfd_hash_table_init failed: %E\n"));
     }
 
@@ -827,7 +843,8 @@ add_keepsyms_file (const char *filename)
     }
 
   link_info.keep_hash = xmalloc (sizeof (struct bfd_hash_table));
-  if (! bfd_hash_table_init (link_info.keep_hash, bfd_hash_newfunc))
+  if (!bfd_hash_table_init (link_info.keep_hash, bfd_hash_newfunc,
+                           sizeof (struct bfd_hash_entry)))
     einfo (_("%P%F: bfd_hash_table_init failed: %E\n"));
 
   bufsize = 100;
@@ -1326,7 +1343,8 @@ undefined_symbol (struct bfd_link_info *info ATTRIBUTE_UNUSED,
       if (hash == NULL)
        {
          hash = xmalloc (sizeof (struct bfd_hash_table));
-         if (! bfd_hash_table_init (hash, bfd_hash_newfunc))
+         if (!bfd_hash_table_init (hash, bfd_hash_newfunc,
+                                   sizeof (struct bfd_hash_entry)))
            einfo (_("%F%P: bfd_hash_table_init failed: %E\n"));
        }
 
@@ -1507,6 +1525,13 @@ notice (struct bfd_link_info *info,
        asection *section,
        bfd_vma value)
 {
+  if (name == NULL)
+    {
+      if (command_line.cref || nocrossref_list != NULL)
+       return handle_asneeded_cref (abfd, value);
+      return TRUE;
+    }
+
   if (! info->notice_all
       || (info->notice_hash != NULL
          && bfd_hash_lookup (info->notice_hash, name, FALSE, FALSE) != NULL))
This page took 0.038155 seconds and 4 git commands to generate.