aboutsummaryrefslogtreecommitdiff
path: root/gold/object.cc
diff options
context:
space:
mode:
authorIan Lance Taylor <iant@google.com>2007-10-23 05:05:48 +0000
committerIan Lance Taylor <iant@google.com>2007-10-23 05:05:48 +0000
commit35cdfc9a874553807400007ffa36cf2884ba40f6 (patch)
tree2cb1c5ca78a50b21d20e709d9d066fad27f1f6e5 /gold/object.cc
parent5cab6006497314f0d6785c5a5898be9f28713c72 (diff)
downloadgdb-35cdfc9a874553807400007ffa36cf2884ba40f6.zip
gdb-35cdfc9a874553807400007ffa36cf2884ba40f6.tar.gz
gdb-35cdfc9a874553807400007ffa36cf2884ba40f6.tar.bz2
Add support for PT_GNU_STACK.
Diffstat (limited to 'gold/object.cc')
-rw-r--r--gold/object.cc17
1 files changed, 17 insertions, 0 deletions
diff --git a/gold/object.cc b/gold/object.cc
index 64cecc8..9e4b58d 100644
--- a/gold/object.cc
+++ b/gold/object.cc
@@ -427,6 +427,11 @@ Sized_relobj<size, big_endian>::do_layout(Symbol_table* symtab,
std::vector<Map_to_output>& map_sections(this->map_to_output());
map_sections.resize(shnum);
+ // Whether we've seen a .note.GNU-stack section.
+ bool seen_gnu_stack = false;
+ // The flags of a .note.GNU-stack section.
+ uint64_t gnu_stack_flags = 0;
+
// Keep track of which sections to omit.
std::vector<bool> omit(shnum, false);
@@ -451,6 +456,16 @@ Sized_relobj<size, big_endian>::do_layout(Symbol_table* symtab,
omit[i] = true;
}
+ // The .note.GNU-stack section is special. It gives the
+ // protection flags that this object file requires for the stack
+ // in memory.
+ if (strcmp(name, ".note.GNU-stack") == 0)
+ {
+ seen_gnu_stack = true;
+ gnu_stack_flags |= shdr.get_sh_flags();
+ omit[i] = true;
+ }
+
bool discard = omit[i];
if (!discard)
{
@@ -481,6 +496,8 @@ Sized_relobj<size, big_endian>::do_layout(Symbol_table* symtab,
map_sections[i].offset = offset;
}
+ layout->layout_gnu_stack(seen_gnu_stack, gnu_stack_flags);
+
delete sd->section_headers;
sd->section_headers = NULL;
delete sd->section_names;