diff options
author | Kevin Buettner <kevinb@redhat.com> | 2000-09-13 01:47:16 +0000 |
---|---|---|
committer | Kevin Buettner <kevinb@redhat.com> | 2000-09-13 01:47:16 +0000 |
commit | 7f8f31f04855244cc52f41e87e017fce93be5efb (patch) | |
tree | eb15e9cb14a9cc6c2fb3eb068aa941a437e5be48 /gdb/objfiles.c | |
parent | 44ac2dc5c3001eb823b6997eab15c487ffd9bfe9 (diff) | |
download | gdb-7f8f31f04855244cc52f41e87e017fce93be5efb.tar.gz |
In objfile_relocate(), don't assume that offsets associated with one
of SECT_OFF_TEXT, SECT_OFF_DATA, or SECT_OFF_BSS will be adequate for
relocating all of the sections in an objfile.
Diffstat (limited to 'gdb/objfiles.c')
-rw-r--r-- | gdb/objfiles.c | 23 |
1 files changed, 4 insertions, 19 deletions
diff --git a/gdb/objfiles.c b/gdb/objfiles.c index e0228f55c99..60c8c6e680e 100644 --- a/gdb/objfiles.c +++ b/gdb/objfiles.c @@ -650,25 +650,10 @@ objfile_relocate (struct objfile *objfile, struct section_offsets *new_offsets) ALL_OBJFILE_OSECTIONS (objfile, s) { - flagword flags; - - flags = bfd_get_section_flags (abfd, s->the_bfd_section); - - if (flags & SEC_CODE) - { - s->addr += ANOFFSET (delta, SECT_OFF_TEXT (objfile)); - s->endaddr += ANOFFSET (delta, SECT_OFF_TEXT (objfile)); - } - else if (flags & (SEC_DATA | SEC_LOAD)) - { - s->addr += ANOFFSET (delta, SECT_OFF_DATA (objfile)); - s->endaddr += ANOFFSET (delta, SECT_OFF_DATA (objfile)); - } - else if (flags & SEC_ALLOC) - { - s->addr += ANOFFSET (delta, SECT_OFF_BSS (objfile)); - s->endaddr += ANOFFSET (delta, SECT_OFF_BSS (objfile)); - } + int idx = s->the_bfd_section->index; + + s->addr += ANOFFSET (delta, idx); + s->endaddr += ANOFFSET (delta, idx); } } |