From 201881d6ca47150fb4037c9babbcf6717471da60 Mon Sep 17 00:00:00 2001 From: Michael Forney Date: Wed, 21 Oct 2020 15:32:14 -0700 Subject: gas: emit GNU-stack note so that stack is not executable MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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. --- gas.c | 1 + 1 file changed, 1 insertion(+) 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"); } -- cgit 1.4.1