diff options
author | Doug Kwan <dougkwan@google.com> | 2012-05-08 17:18:21 +0000 |
---|---|---|
committer | Doug Kwan <dougkwan@google.com> | 2012-05-08 17:18:21 +0000 |
commit | 2d16d28e5c20aacc9637f589558c118d6fe1a17c (patch) | |
tree | e3cdfd9f108a5acf1a3f868041e52d2ac511830f /bfd/elf.c | |
parent | c0749c4da289fcb4d15459236087d453ee872387 (diff) | |
download | gdb-2d16d28e5c20aacc9637f589558c118d6fe1a17c.zip gdb-2d16d28e5c20aacc9637f589558c118d6fe1a17c.tar.gz gdb-2d16d28e5c20aacc9637f589558c118d6fe1a17c.tar.bz2 |
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.c | 10 |
1 files changed, 8 insertions, 2 deletions
@@ -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 { |