From 02b0b1aa7702634955c7972e33403e1d37ed6602 Mon Sep 17 00:00:00 2001 From: Nathan Sidwell Date: Mon, 26 Jan 2009 15:23:39 +0000 Subject: * 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. --- ld/ChangeLog | 10 ++++++++++ ld/ld.h | 7 +++---- ld/ld.texinfo | 3 +++ ld/ldmain.c | 4 +++- ld/lexsup.c | 4 ++-- 5 files changed, 21 insertions(+), 7 deletions(-) (limited to 'ld') diff --git a/ld/ChangeLog b/ld/ChangeLog index cfaec2e..92f27c6 100644 --- a/ld/ChangeLog +++ b/ld/ChangeLog @@ -1,3 +1,13 @@ +2009-01-26 Nathan Sidwell + + * 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 * pe-dll.c (tmp_seq2): New static variable. diff --git a/ld/ld.h b/ld/ld.h index 43a4ba2..3de92cd 100644 --- 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 diff --git a/ld/ld.texinfo b/ld/ld.texinfo index 3543505..1d90989 100644 --- a/ld/ld.texinfo +++ b/ld/ld.texinfo @@ -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 diff --git a/ld/ldmain.c b/ld/ldmain.c index 7060587..85b9c2b 100644 --- a/ld/ldmain.c +++ b/ld/ldmain.c @@ -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) diff --git a/ld/lexsup.c b/ld/lexsup.c index f9e6b1f..4dcfc3c 100644 --- a/ld/lexsup.c +++ b/ld/lexsup.c @@ -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; -- cgit v1.1