diff options
author | Daniel Jacobowitz <drow@false.org> | 2004-08-21 01:13:22 +0000 |
---|---|---|
committer | Daniel Jacobowitz <drow@false.org> | 2004-08-21 01:13:22 +0000 |
commit | ea5158d820d069db7995f69bd84663394bb299f1 (patch) | |
tree | 7bc0287a7ae764953e5478d172b29b49b9356183 | |
parent | d64e52d5a66fd103f751489aea1cf7dd0dd04803 (diff) | |
download | gdb-ea5158d820d069db7995f69bd84663394bb299f1.zip gdb-ea5158d820d069db7995f69bd84663394bb299f1.tar.gz gdb-ea5158d820d069db7995f69bd84663394bb299f1.tar.bz2 |
* elflink.c (_bfd_elf_section_already_linked): Handle
SEC_LINK_DUPLICATES_SAME_CONTENTS.
-rw-r--r-- | bfd/ChangeLog | 5 | ||||
-rw-r--r-- | bfd/elflink.c | 30 |
2 files changed, 35 insertions, 0 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog index a854b12..7b77585 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,3 +1,8 @@ +2004-08-20 Daniel Jacobowitz <dan@debian.org> + + * elflink.c (_bfd_elf_section_already_linked): Handle + SEC_LINK_DUPLICATES_SAME_CONTENTS. + 2004-08-19 Mark Mitchell <mark@codesourcery.com> * config.bfd (arm*-*-symbianelf*): New target. diff --git a/bfd/elflink.c b/bfd/elflink.c index 7793e82..3831072 100644 --- a/bfd/elflink.c +++ b/bfd/elflink.c @@ -9366,6 +9366,36 @@ _bfd_elf_section_already_linked (bfd *abfd, struct bfd_section * sec) (_("%B: duplicate section `%A' has different size\n"), abfd, sec); break; + + case SEC_LINK_DUPLICATES_SAME_CONTENTS: + if (sec->size != l->sec->size) + (*_bfd_error_handler) + (_("%B: duplicate section `%A' has different size\n"), + abfd, sec); + else if (sec->size != 0) + { + bfd_byte *sec_contents, *l_sec_contents; + + if (!bfd_malloc_and_get_section (abfd, sec, &sec_contents)) + (*_bfd_error_handler) + (_("%B: warning: could not read contents of section `%A'\n"), + abfd, sec); + else if (!bfd_malloc_and_get_section (l->sec->owner, l->sec, + &l_sec_contents)) + (*_bfd_error_handler) + (_("%B: warning: could not read contents of section `%A'\n"), + l->sec->owner, l->sec); + else if (memcmp (sec_contents, l_sec_contents, sec->size) != 0) + (*_bfd_error_handler) + (_("%B: warning: duplicate section `%A' has different contents\n"), + abfd, sec); + + if (sec_contents) + free (sec_contents); + if (l_sec_contents) + free (l_sec_contents); + } + break; } /* Set the output_section field so that lang_add_section |