diff options
author | Ian Lance Taylor <ian@airs.com> | 1995-10-25 17:58:30 +0000 |
---|---|---|
committer | Ian Lance Taylor <ian@airs.com> | 1995-10-25 17:58:30 +0000 |
commit | afe07862713ef8193a4d7e1110d5e187c0d2f1ad (patch) | |
tree | 2b32e5a7f3e0e5dda5e726732e70c659c6cdc6fa /bfd/xcofflink.c | |
parent | 585c92fe44cf3e5ac92fe6f7c01e24053e3e45a4 (diff) | |
download | fsf-binutils-gdb-afe07862713ef8193a4d7e1110d5e187c0d2f1ad.zip fsf-binutils-gdb-afe07862713ef8193a4d7e1110d5e187c0d2f1ad.tar.gz fsf-binutils-gdb-afe07862713ef8193a4d7e1110d5e187c0d2f1ad.tar.bz2 |
only read the section relocs if there are some
Diffstat (limited to 'bfd/xcofflink.c')
-rw-r--r-- | bfd/xcofflink.c | 84 |
1 files changed, 44 insertions, 40 deletions
diff --git a/bfd/xcofflink.c b/bfd/xcofflink.c index 55a0cf1..47ab49f 100644 --- a/bfd/xcofflink.c +++ b/bfd/xcofflink.c @@ -2328,64 +2328,68 @@ xcoff_mark (info, sec) /* Look through the section relocs. */ - rel = xcoff_read_internal_relocs (sec->owner, sec, true, - (bfd_byte *) NULL, false, - (struct internal_reloc *) NULL); - if (rel == NULL) - return false; - relend = rel + sec->reloc_count; - for (; rel < relend; rel++) + if ((sec->flags & SEC_RELOC) != 0 + && sec->reloc_count > 0) { - asection *rsec; - struct xcoff_link_hash_entry *h; + rel = xcoff_read_internal_relocs (sec->owner, sec, true, + (bfd_byte *) NULL, false, + (struct internal_reloc *) NULL); + if (rel == NULL) + return false; + relend = rel + sec->reloc_count; + for (; rel < relend; rel++) + { + asection *rsec; + struct xcoff_link_hash_entry *h; - if ((unsigned int) rel->r_symndx - > obj_raw_syment_count (sec->owner)) - continue; + if ((unsigned int) rel->r_symndx + > obj_raw_syment_count (sec->owner)) + continue; - h = obj_xcoff_sym_hashes (sec->owner)[rel->r_symndx]; - if (h != NULL - && (h->flags & XCOFF_MARK) == 0) - { - h->flags |= XCOFF_MARK; - if (h->root.type == bfd_link_hash_defined - || h->root.type == bfd_link_hash_defweak) + h = obj_xcoff_sym_hashes (sec->owner)[rel->r_symndx]; + if (h != NULL + && (h->flags & XCOFF_MARK) == 0) { - asection *hsec; + h->flags |= XCOFF_MARK; + if (h->root.type == bfd_link_hash_defined + || h->root.type == bfd_link_hash_defweak) + { + asection *hsec; - hsec = h->root.u.def.section; - if ((hsec->flags & SEC_MARK) == 0) + hsec = h->root.u.def.section; + if ((hsec->flags & SEC_MARK) == 0) + { + if (! xcoff_mark (info, hsec)) + return false; + } + } + + if (h->toc_section != NULL + && (h->toc_section->flags & SEC_MARK) == 0) { - if (! xcoff_mark (info, hsec)) + if (! xcoff_mark (info, h->toc_section)) return false; } } - if (h->toc_section != NULL - && (h->toc_section->flags & SEC_MARK) == 0) + rsec = xcoff_data (sec->owner)->csects[rel->r_symndx]; + if (rsec != NULL + && (rsec->flags & SEC_MARK) == 0) { - if (! xcoff_mark (info, h->toc_section)) + if (! xcoff_mark (info, rsec)) return false; } } - rsec = xcoff_data (sec->owner)->csects[rel->r_symndx]; - if (rsec != NULL - && (rsec->flags & SEC_MARK) == 0) + if (! info->keep_memory + && coff_section_data (sec->owner, sec) != NULL + && coff_section_data (sec->owner, sec)->relocs != NULL + && ! coff_section_data (sec->owner, sec)->keep_relocs) { - if (! xcoff_mark (info, rsec)) - return false; + free (coff_section_data (sec->owner, sec)->relocs); + coff_section_data (sec->owner, sec)->relocs = NULL; } } - - if (! info->keep_memory - && coff_section_data (sec->owner, sec) != NULL - && coff_section_data (sec->owner, sec)->relocs != NULL - && ! coff_section_data (sec->owner, sec)->keep_relocs) - { - free (coff_section_data (sec->owner, sec)->relocs); - coff_section_data (sec->owner, sec)->relocs = NULL; - } } return true; |