* lexsup.c (parse_args): Set check_section_addresses to 1 or 0.
authorNathan Sidwell <nathan@codesourcery.com>
Mon, 26 Jan 2009 15:23:39 +0000 (15:23 +0000)
committerNathan Sidwell <nathan@codesourcery.com>
Mon, 26 Jan 2009 15:23:39 +0000 (15:23 +0000)
* ld.h (args_type): Make check_section_addresses a char.
ldlang.c (lang_process): Don't consider relocatable flag when
checking for overlap.
* ldmain.c (main): Default check_section_addresses to -1. Check it
for relocatable links.
* ld.texinfo (--check-sections): Update documentation.

ld/ChangeLog
ld/ld.h
ld/ld.texinfo
ld/ldmain.c
ld/lexsup.c

index cfaec2e..92f27c6 100644 (file)
@@ -1,3 +1,13 @@
+2009-01-26  Nathan Sidwell  <nathan@codesourcery.com>
+
+       * lexsup.c (parse_args): Set check_section_addresses to 1 or 0.
+       * ld.h (args_type): Make check_section_addresses a char.
+       ldlang.c (lang_process): Don't consider relocatable flag when
+       checking for overlap.
+       * ldmain.c (main): Default check_section_addresses to -1. Check it
+       for relocatable links.
+       * ld.texinfo (--check-sections): Update documentation.
+
 2009-01-26  Kai Tietz  <kai.tietz@onevision.com>
 
        * pe-dll.c (tmp_seq2): New static variable.
diff --git a/ld/ld.h b/ld/ld.h
index 43a4ba2..3de92cd 100644 (file)
--- a/ld/ld.h
+++ b/ld/ld.h
@@ -167,10 +167,9 @@ typedef struct {
      search.  */
   bfd_boolean warn_search_mismatch;
 
-
-  /* If TRUE (the default) check section addresses, once compute,
-     fpor overlaps.  */
-  bfd_boolean check_section_addresses;
+  /* If non-zero check section addresses, once computed,
+     for overlaps.  Relocatable links only check when this is > 0.  */
+  signed char check_section_addresses;
 
   /* If TRUE allow the linking of input files in an unknown architecture
      assuming that the user knows what they are doing.  This was the old
index 3543505..1d90989 100644 (file)
@@ -1205,6 +1205,9 @@ perform this check, and if it finds any overlaps it will produce
 suitable error messages.  The linker does know about, and does make
 allowances for sections in overlays.  The default behaviour can be
 restored by using the command line switch @option{--check-sections}.
+Section overlap is not usually checked for relocatable links.  You can
+force checking in that case by using the @option{--check-sections}
+option.
 
 @cindex cross reference table
 @kindex --cref
index 7060587..85b9c2b 100644 (file)
@@ -251,7 +251,7 @@ main (int argc, char **argv)
 
   command_line.warn_mismatch = TRUE;
   command_line.warn_search_mismatch = TRUE;
-  command_line.check_section_addresses = TRUE;
+  command_line.check_section_addresses = -1;
 
   /* We initialize DEMANGLING based on the environment variable
      COLLECT_NO_DEMANGLE.  The gcc collect2 program will demangle the
@@ -292,6 +292,8 @@ main (int argc, char **argv)
 
   if (link_info.relocatable)
     {
+      if (command_line.check_section_addresses < 0)
+       command_line.check_section_addresses = 0;
       if (command_line.relax)
        einfo (_("%P%F: --relax and -r may not be used together\n"));
       if (link_info.shared)
index f9e6b1f..4dcfc3c 100644 (file)
@@ -1411,10 +1411,10 @@ parse_args (unsigned argc, char **argv)
            config.split_by_file = 1;
          break;
        case OPTION_CHECK_SECTIONS:
-         command_line.check_section_addresses = TRUE;
+         command_line.check_section_addresses = 1;
          break;
        case OPTION_NO_CHECK_SECTIONS:
-         command_line.check_section_addresses = FALSE;
+         command_line.check_section_addresses = 0;
          break;
        case OPTION_ACCEPT_UNKNOWN_INPUT_ARCH:
          command_line.accept_unknown_input_arch = TRUE;