aboutsummaryrefslogtreecommitdiff
path: root/bfd/elf.c
diff options
context:
space:
mode:
authorIan Lance Taylor <ian@airs.com>1996-01-12 22:47:04 +0000
committerIan Lance Taylor <ian@airs.com>1996-01-12 22:47:04 +0000
commit14899eb7f2e442c1b7f133a805ae9dfa39d3cc1a (patch)
tree76e354f53816436ee1b06e3aaeac00f2faaa6f2d /bfd/elf.c
parent2a4e49a9255d84df66e7eb5d252436ba5ee3f624 (diff)
downloadgdb-14899eb7f2e442c1b7f133a805ae9dfa39d3cc1a.zip
gdb-14899eb7f2e442c1b7f133a805ae9dfa39d3cc1a.tar.gz
gdb-14899eb7f2e442c1b7f133a805ae9dfa39d3cc1a.tar.bz2
* elf.c (assign_file_positions_for_segments): If a segment
contains no sections, don't mark it as readable.
Diffstat (limited to 'bfd/elf.c')
-rw-r--r--bfd/elf.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/bfd/elf.c b/bfd/elf.c
index dab0c4d..3a7d2af 100644
--- a/bfd/elf.c
+++ b/bfd/elf.c
@@ -1908,6 +1908,8 @@ assign_file_positions_for_segments (abfd)
if (m->p_flags_valid)
p->p_flags = m->p_flags;
+ else
+ p->p_flags = 0;
if (p->p_type == PT_LOAD && m->count > 0)
off += (m->sections[0]->vma - off) % bed->maxpagesize;
@@ -1937,6 +1939,8 @@ assign_file_positions_for_segments (abfd)
if (m->includes_filehdr)
{
+ if (! m->p_flags_valid)
+ p->p_flags |= PF_R;
p->p_offset = 0;
p->p_filesz = bed->s->sizeof_ehdr;
p->p_memsz = bed->s->sizeof_ehdr;
@@ -1956,6 +1960,8 @@ assign_file_positions_for_segments (abfd)
if (m->includes_phdrs)
{
+ if (! m->p_flags_valid)
+ p->p_flags |= PF_R;
if (m->includes_filehdr)
{
if (p->p_type == PT_LOAD)
@@ -1998,8 +2004,6 @@ assign_file_positions_for_segments (abfd)
}
}
- if (! m->p_flags_valid)
- p->p_flags = PF_R;
for (i = 0, secpp = m->sections; i < m->count; i++, secpp++)
{
asection *sec;
@@ -2043,6 +2047,7 @@ assign_file_positions_for_segments (abfd)
if (! m->p_flags_valid)
{
+ p->p_flags |= PF_R;
if ((flags & SEC_CODE) != 0)
p->p_flags |= PF_X;
if ((flags & SEC_READONLY) == 0)