aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Forney <[email protected]>2020-10-21 15:32:14 -0700
committerQuentin Carbonneaux <[email protected]>2021-03-02 08:36:23 +0100
commit201881d6ca47150fb4037c9babbcf6717471da60 (patch)
tree2ce4c6c69899da8f1a73db2e1813500c780c5670
parent2feb742b6911b385fc80177f8df77315fef9cd37 (diff)
gas: emit GNU-stack note so that stack is not executable
GNU ld uses the presence of these notes to determine the flags of the final GNU_STACK program header. If they are present in every object, then the resulting executable's GNU_STACK uses flags RW instead of RWE. Reported by Érico Nogueira Rolim.
-rw-r--r--gas.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/gas.c b/gas.c
index 227c297..339154e 100644
--- a/gas.c
+++ b/gas.c
@@ -122,4 +122,5 @@ gasemitfin(FILE *f)
stash = b->link;
free(b);
}
+ fprintf(f, ".section .note.GNU-stack,\"\",@progbits\n");
}