summaryrefslogtreecommitdiff
path: root/gdb/elfread.c
diff options
context:
space:
mode:
authorAlan Hayward <alan.hayward@arm.com>2018-06-04 17:21:04 +0100
committerAlan Hayward <alan.hayward@arm.com>2018-06-04 17:23:07 +0100
commit62b74cb8b00ca2b42de30ceff4d2f1552b77a10d (patch)
tree5388b0ad1f7fc2d51c67bc87e932fb6acdb4b87f /gdb/elfread.c
parentbaf00c2d75351de7a42dae32aea3a71c8902cd25 (diff)
downloadbinutils-gdb-62b74cb8b00ca2b42de30ceff4d2f1552b77a10d.tar.gz
Use ELF_SECTION_IN_SEGMENT to map segments
The macro ELF_SECTION_IN_SEGMENT should be used when calculating if a section maps to a segment. gdb/ * elfread.c (elf_symfile_segments): Use ELF_SECTION_IN_SEGMENT.
Diffstat (limited to 'gdb/elfread.c')
-rw-r--r--gdb/elfread.c7
1 files changed, 2 insertions, 5 deletions
diff --git a/gdb/elfread.c b/gdb/elfread.c
index b4b4a1b24c0..0fe2adbd4d2 100644
--- a/gdb/elfread.c
+++ b/gdb/elfread.c
@@ -120,17 +120,14 @@ elf_symfile_segments (bfd *abfd)
for (i = 0, sect = abfd->sections; sect != NULL; i++, sect = sect->next)
{
int j;
- CORE_ADDR vma;
if ((bfd_get_section_flags (abfd, sect) & SEC_ALLOC) == 0)
continue;
- vma = bfd_get_section_vma (abfd, sect);
+ Elf_Internal_Shdr *this_hdr = &elf_section_data (sect)->this_hdr;
for (j = 0; j < num_segments; j++)
- if (segments[j]->p_memsz > 0
- && vma >= segments[j]->p_vaddr
- && (vma - segments[j]->p_vaddr) < segments[j]->p_memsz)
+ if (ELF_SECTION_IN_SEGMENT (this_hdr, segments[j]))
{
data->segment_info[i] = j + 1;
break;