summaryrefslogtreecommitdiffstats
path: root/lld/ELF/Writer.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lld/ELF/Writer.cpp')
-rw-r--r--lld/ELF/Writer.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/lld/ELF/Writer.cpp b/lld/ELF/Writer.cpp
index 90462ecc7eb..ee1889286ba 100644
--- a/lld/ELF/Writer.cpp
+++ b/lld/ELF/Writer.cpp
@@ -399,6 +399,14 @@ template <class ELFT> static void createSyntheticSections() {
InX::Iplt = make<PltSection>(true);
Add(InX::Iplt);
+ // .note.GNU-stack is always added when we are creating a re-linkable
+ // object file. Other linkers are using the presence of this marker
+ // section to control the executable-ness of the stack area, but that
+ // is irrelevant these days. Stack area should always be non-executable
+ // by default. So we emit this section unconditionally.
+ if (Config->Relocatable)
+ Add(make<GnuStackSection>());
+
if (!Config->Relocatable) {
if (Config->EhFrameHdr) {
InX::EhFrameHdr = make<EhFrameHeader>();
OpenPOWER on IntegriCloud