summaryrefslogtreecommitdiffstats
path: root/binutils-2.22/bfd
diff options
context:
space:
mode:
Diffstat (limited to 'binutils-2.22/bfd')
-rw-r--r--binutils-2.22/bfd/elf.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/binutils-2.22/bfd/elf.c b/binutils-2.22/bfd/elf.c
index aa40c33..c0bcaac 100644
--- a/binutils-2.22/bfd/elf.c
+++ b/binutils-2.22/bfd/elf.c
@@ -4926,8 +4926,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 doing cross-debugging. */
+ if (!m->p_align_valid)
+ p->p_align = 1;
+ if (!m->p_flags_valid)
+ p->p_flags = (lp->p_flags & ~PF_W);
}
else
{