aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorH.J. Lu <hjl.tools@gmail.com>2001-02-18 22:04:08 +0000
committerH.J. Lu <hjl.tools@gmail.com>2001-02-18 22:04:08 +0000
commitea412e04e5d92431db4b2048143535505cc33455 (patch)
tree4dfc927b3eb78d7b91f221dfcdb2c595d37d0fdb
parent47eee8a91cf1b7f05653776c054ab3f2ad81f1ab (diff)
downloadfsf-binutils-gdb-ea412e04e5d92431db4b2048143535505cc33455.zip
fsf-binutils-gdb-ea412e04e5d92431db4b2048143535505cc33455.tar.gz
fsf-binutils-gdb-ea412e04e5d92431db4b2048143535505cc33455.tar.bz2
2001-02-18 H.J. Lu <hjl@gnu.org>
* elflink.h (elf_link_input_bfd): Ignore invalid section symbol index.
-rw-r--r--bfd/ChangeLog5
-rw-r--r--bfd/elflink.h29
2 files changed, 30 insertions, 4 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index c07c5e5..945af2a 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,3 +1,8 @@
+2001-02-18 H.J. Lu <hjl@gnu.org>
+
+ * elflink.h (elf_link_input_bfd): Ignore invalid section symbol
+ index.
+
2001-02-18 Kazu Hirata <kazu@hxi.com>
* vms-misc.c: Fix formatting.
diff --git a/bfd/elflink.h b/bfd/elflink.h
index 5cbbcbb..8605c73 100644
--- a/bfd/elflink.h
+++ b/bfd/elflink.h
@@ -5515,14 +5515,24 @@ elf_link_input_bfd (finfo, input_bfd)
}
}
+ name = NULL;
if (isym->st_shndx == SHN_UNDEF)
- isec = bfd_und_section_ptr;
+ {
+ isec = bfd_und_section_ptr;
+ name = isec->name;
+ }
else if (isym->st_shndx > 0 && isym->st_shndx < SHN_LORESERVE)
isec = section_from_elf_index (input_bfd, isym->st_shndx);
else if (isym->st_shndx == SHN_ABS)
- isec = bfd_abs_section_ptr;
+ {
+ isec = bfd_abs_section_ptr;
+ name = isec->name;
+ }
else if (isym->st_shndx == SHN_COMMON)
- isec = bfd_com_section_ptr;
+ {
+ isec = bfd_com_section_ptr;
+ name = isec->name;
+ }
else
{
/* Who knows? */
@@ -5541,7 +5551,18 @@ elf_link_input_bfd (finfo, input_bfd)
/* Save away all section symbol values. */
if (isec != NULL)
- isec->symbol->value = isym->st_value;
+ {
+ if (name)
+ {
+ if (isec->symbol->value != isym->st_value)
+ (*_bfd_error_handler)
+ (_("%s: invalid section symbol index 0x%x (%s) ingored"),
+ bfd_get_filename (input_bfd), isym->st_shndx,
+ name);
+ continue;
+ }
+ isec->symbol->value = isym->st_value;
+ }
/* If this is a discarded link-once section symbol, update
it's value to that of the kept section symbol. The