summaryrefslogtreecommitdiff
path: root/bfd/elf.c
diff options
context:
space:
mode:
authordougkwan <dougkwan>2012-05-08 17:18:16 +0000
committerdougkwan <dougkwan>2012-05-08 17:18:16 +0000
commit45d8bc9e8d78042bc5d9678a9535a0bccc9ba5b7 (patch)
treea27ae6e7507e9bfc88c010cc89ce2aed0d000b38 /bfd/elf.c
parent86e40049f11d2c0e6a4831a5816c170474b0d229 (diff)
downloadgdb-45d8bc9e8d78042bc5d9678a9535a0bccc9ba5b7.tar.gz
2012-05-08 Ben Cheng <bccheng@google.com>
* bfd/elf.c: Preserve the original p_align and p_flags if they are valid.
Diffstat (limited to 'bfd/elf.c')
-rw-r--r--bfd/elf.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/bfd/elf.c b/bfd/elf.c
index d040d147000..9481c0e1d56 100644
--- a/bfd/elf.c
+++ b/bfd/elf.c
@@ -4931,8 +4931,14 @@ assign_file_positions_for_non_load_sections (bfd *abfd,
else
abort ();
p->p_memsz = p->p_filesz;
- p->p_align = 1;
- p->p_flags = (lp->p_flags & ~PF_W);
+ /* Preserve the alignment and flags if they are valid. The gold
+ linker generates RW/4 for the PT_GNU_RELRO section. It is better
+ for objcopy/strip to honor these attributes otherwise gdb will
+ choke when using separate debug files. */
+ if (!m->p_align_valid)
+ p->p_align = 1;
+ if (!m->p_flags_valid)
+ p->p_flags = (lp->p_flags & ~PF_W);
}
else
{