summaryrefslogtreecommitdiff
path: root/bfd/dwarf2.c
diff options
context:
space:
mode:
authorAndrew Stubbs <andrew.stubbs@st.com>2009-03-12 10:57:18 +0000
committerAndrew Stubbs <andrew.stubbs@st.com>2009-03-12 10:57:18 +0000
commit2403a4ebad80a7484b1c622ac1e74298a17ffd0d (patch)
tree165479d69770832ab6fa387c173ee17df4927561 /bfd/dwarf2.c
parent034a5e0b6af820d3f7e67e958564a1ee713cc5a5 (diff)
downloadbinutils-redhat-2403a4ebad80a7484b1c622ac1e74298a17ffd0d.tar.gz
2009-03-12 Andrew Stubbs <ams@codesourcery.com>
* dwarf2.c (read_section): Always check the offset, even when the section has been read before.
Diffstat (limited to 'bfd/dwarf2.c')
-rw-r--r--bfd/dwarf2.c76
1 files changed, 38 insertions, 38 deletions
diff --git a/bfd/dwarf2.c b/bfd/dwarf2.c
index 0c18253405..40b83b7175 100644
--- a/bfd/dwarf2.c
+++ b/bfd/dwarf2.c
@@ -417,49 +417,49 @@ read_section (bfd * abfd,
bfd_boolean section_is_compressed = FALSE;
/* read_section is a noop if the section has already been read. */
- if (*section_buffer)
- return TRUE;
-
- msec = bfd_get_section_by_name (abfd, section_name);
- if (! msec && compressed_section_name)
- {
- msec = bfd_get_section_by_name (abfd, compressed_section_name);
- section_is_compressed = TRUE;
- }
- if (! msec)
- {
- (*_bfd_error_handler) (_("Dwarf Error: Can't find %s section."), section_name);
- bfd_set_error (bfd_error_bad_value);
- return FALSE;
- }
-
- if (syms)
- {
- *section_size = msec->size;
- *section_buffer
- = bfd_simple_get_relocated_section_contents (abfd, msec, NULL, syms);
- if (! *section_buffer)
- return FALSE;
- }
- else
+ if (!*section_buffer)
{
- *section_size = msec->rawsize ? msec->rawsize : msec->size;
- *section_buffer = bfd_malloc (*section_size);
- if (! *section_buffer)
- return FALSE;
- if (! bfd_get_section_contents (abfd, msec, *section_buffer,
- 0, *section_size))
- return FALSE;
- }
-
- if (section_is_compressed)
- {
- if (! bfd_uncompress_section_contents (section_buffer, section_size))
+ msec = bfd_get_section_by_name (abfd, section_name);
+ if (! msec && compressed_section_name)
+ {
+ msec = bfd_get_section_by_name (abfd, compressed_section_name);
+ section_is_compressed = TRUE;
+ }
+ if (! msec)
{
- (*_bfd_error_handler) (_("Dwarf Error: unable to decompress %s section."), compressed_section_name);
+ (*_bfd_error_handler) (_("Dwarf Error: Can't find %s section."), section_name);
bfd_set_error (bfd_error_bad_value);
return FALSE;
}
+
+ if (syms)
+ {
+ *section_size = msec->size;
+ *section_buffer
+ = bfd_simple_get_relocated_section_contents (abfd, msec, NULL, syms);
+ if (! *section_buffer)
+ return FALSE;
+ }
+ else
+ {
+ *section_size = msec->rawsize ? msec->rawsize : msec->size;
+ *section_buffer = bfd_malloc (*section_size);
+ if (! *section_buffer)
+ return FALSE;
+ if (! bfd_get_section_contents (abfd, msec, *section_buffer,
+ 0, *section_size))
+ return FALSE;
+ }
+
+ if (section_is_compressed)
+ {
+ if (! bfd_uncompress_section_contents (section_buffer, section_size))
+ {
+ (*_bfd_error_handler) (_("Dwarf Error: unable to decompress %s section."), compressed_section_name);
+ bfd_set_error (bfd_error_bad_value);
+ return FALSE;
+ }
+ }
}
/* It is possible to get a bad value for the offset into the section