aboutsummaryrefslogtreecommitdiff
path: root/bfd/elf.c
diff options
context:
space:
mode:
authorIan Lance Taylor <ian@airs.com>1996-08-05 20:45:55 +0000
committerIan Lance Taylor <ian@airs.com>1996-08-05 20:45:55 +0000
commitb944e7e855f74a833fb8ae9f60e4e13a0947ab73 (patch)
tree4d5f5b0ea3315c636c60b73f15f25f667fb5911a /bfd/elf.c
parentd22ec3b090a9e7fb20af27e6dc3bf0ca4c99bf55 (diff)
downloadgdb-b944e7e855f74a833fb8ae9f60e4e13a0947ab73.zip
gdb-b944e7e855f74a833fb8ae9f60e4e13a0947ab73.tar.gz
gdb-b944e7e855f74a833fb8ae9f60e4e13a0947ab73.tar.bz2
* elf.c (_bfd_elf_make_section_from_shdr): For a loadable section,
only get the LMA from the phdr if they are in the same part of the file.
Diffstat (limited to 'bfd/elf.c')
-rw-r--r--bfd/elf.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/bfd/elf.c b/bfd/elf.c
index 7eb5540..4978957 100644
--- a/bfd/elf.c
+++ b/bfd/elf.c
@@ -228,7 +228,11 @@ _bfd_elf_make_section_from_shdr (abfd, hdr, name)
&& phdr->p_paddr != 0
&& phdr->p_vaddr != phdr->p_paddr
&& phdr->p_vaddr <= hdr->sh_addr
- && phdr->p_vaddr + phdr->p_memsz >= hdr->sh_addr + hdr->sh_size)
+ && phdr->p_vaddr + phdr->p_memsz >= hdr->sh_addr + hdr->sh_size
+ && ((flags & SEC_LOAD) == 0
+ || (phdr->p_offset <= hdr->sh_offset
+ && (phdr->p_offset + phdr->p_filesz
+ >= hdr->sh_offset + hdr->sh_size))))
{
newsect->lma += phdr->p_paddr - phdr->p_vaddr;
break;