summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDmitriy Ivanov <dimitry@google.com>2015-05-04 11:11:23 -0700
committerDimitry Ivanov <dimitry@google.com>2015-05-04 18:35:43 +0000
commit064a9800f372b8efd6d7b08150ab5204e5304c84 (patch)
treed356fec037b01ef45e9eac481fc3d1c5cdd9cee4
parentdc145b510640202a60b0dfaef9d56cd8fc1c05a9 (diff)
downloadbionic-064a9800f372b8efd6d7b08150ab5204e5304c84.zip
bionic-064a9800f372b8efd6d7b08150ab5204e5304c84.tar.gz
bionic-064a9800f372b8efd6d7b08150ab5204e5304c84.tar.bz2
Do not adjust PT_GNU_STACK segment
Bug: http://b/20687795 Bug: http://b/18051137 Change-Id: Ie8af3892cfbebcc0249e7981284c4ad97ff40317
-rw-r--r--tools/relocation_packer/src/elf_file.cc7
1 files changed, 7 insertions, 0 deletions
diff --git a/tools/relocation_packer/src/elf_file.cc b/tools/relocation_packer/src/elf_file.cc
index d06bd63..102d614 100644
--- a/tools/relocation_packer/src/elf_file.cc
+++ b/tools/relocation_packer/src/elf_file.cc
@@ -312,6 +312,13 @@ static void AdjustProgramHeaderOffsets(typename ELF::Phdr* program_headers,
for (size_t i = 0; i < count; ++i) {
typename ELF::Phdr* program_header = &program_headers[i];
+ // Do not adjust PT_GNU_STACK - it confuses gdb and results
+ // in incorrect unwinding if the executable is stripped after
+ // packing.
+ if (program_header->p_type == PT_GNU_STACK) {
+ continue;
+ }
+
if (program_header->p_offset > hole_start) {
// The hole start is past this segment, so adjust offset.
program_header->p_offset += hole_size;