diff options
author | Alan Modra <amodra@gmail.com> | 2002-03-13 02:56:36 +0000 |
---|---|---|
committer | Alan Modra <amodra@gmail.com> | 2002-03-13 02:56:36 +0000 |
commit | 30cba02509c283d0307f9df3c89155e9d38c9737 (patch) | |
tree | 9f2c6f1f694d0a644e3295349bb60366b2e541c7 | |
parent | 4ddafab0a6fa8c3069d0b323359bf20d3b390e46 (diff) | |
download | gdb-30cba02509c283d0307f9df3c89155e9d38c9737.zip gdb-30cba02509c283d0307f9df3c89155e9d38c9737.tar.gz gdb-30cba02509c283d0307f9df3c89155e9d38c9737.tar.bz2 |
* ldlang.c (lang_check): Do relocatable link checks first, so that
warn_mismatch can't override. Check compatible and word size too.
-rw-r--r-- | ld/ChangeLog | 5 | ||||
-rw-r--r-- | ld/ldlang.c | 35 |
2 files changed, 26 insertions, 14 deletions
diff --git a/ld/ChangeLog b/ld/ChangeLog index 78ae53e..db8002a 100644 --- a/ld/ChangeLog +++ b/ld/ChangeLog @@ -1,3 +1,8 @@ +2002-03-13 Alan Modra <amodra@bigpond.net.au> + + * ldlang.c (lang_check): Do relocatable link checks first, so that + warn_mismatch can't override. Check compatible and word size too. + 2002-03-07 Daniel Jacobowitz <drow@mvista.com> * ld.texinfo: Wrap @menu in @ifnottex, not @ifinfo. diff --git a/ld/ldlang.c b/ld/ldlang.c index 413ccf8..9858fff 100644 --- a/ld/ldlang.c +++ b/ld/ldlang.c @@ -3569,8 +3569,27 @@ lang_check () file = file->input_statement.next) { input_bfd = file->input_statement.the_bfd; - compatible = bfd_arch_get_compatible (input_bfd, - output_bfd); + compatible = bfd_arch_get_compatible (input_bfd, output_bfd); + + /* In general it is not possible to perform a relocatable + link between differing object formats when the input + file has relocations, because the relocations in the + input format may not have equivalent representations in + the output format (and besides BFD does not translate + relocs for other link purposes than a final link). */ + if (link_info.relocateable + && (compatible == NULL + || bfd_get_flavour (input_bfd) != bfd_get_flavour (output_bfd) + || (input_bfd->arch_info->bits_per_word + != output_bfd->arch_info->bits_per_word)) + && (bfd_get_file_flags (input_bfd) & HAS_RELOC) != 0) + { + einfo (_("%P%F: Relocatable linking with relocations from format %s (%B) to format %s (%B) is not supported\n"), + bfd_get_target (input_bfd), input_bfd, + bfd_get_target (output_bfd), output_bfd); + /* einfo with %F exits. */ + } + if (compatible == NULL) { if (command_line.warn_mismatch) @@ -3578,18 +3597,6 @@ lang_check () bfd_printable_name (input_bfd), input_bfd, bfd_printable_name (output_bfd)); } - else if (link_info.relocateable - /* In general it is not possible to perform a relocatable - link between differing object formats when the input - file has relocations, because the relocations in the - input format may not have equivalent representations in - the output format (and besides BFD does not translate - relocs for other link purposes than a final link). */ - && bfd_get_flavour (input_bfd) != bfd_get_flavour (output_bfd) - && (bfd_get_file_flags (input_bfd) & HAS_RELOC) != 0) - einfo (_("%P%F: Relocatable linking with relocations from format %s (%B) to format %s (%B) is not supported\n"), - bfd_get_target (input_bfd), input_bfd, - bfd_get_target (output_bfd), output_bfd); else if (bfd_count_sections (input_bfd)) { /* If the input bfd has no contents, it shouldn't set the |