summary refs log tree commit diff
diff options
context:
space:
mode:
authorÉrico Nogueira <erico.erc@gmail.com>2021-07-11 16:12:19 -0300
committerQuentin Carbonneaux <quentin@c9x.me>2021-08-02 10:55:10 +0200
commit0437e97a1bb126cfa1974dad7b5479fa4b407f46 (patch)
treeb5afb3e175585449e6c8eb5083a2a1dad676c096
parent3da3815a674c922c520e013b30eb96c7491a5e85 (diff)
downloadroux-0437e97a1bb126cfa1974dad7b5479fa4b407f46.tar.gz
gas: always emit GNU-stack note
In cases where stash was 0, gasemitfin exits immediately and the
GNU-stack note isn't added to the asm output. This would result in an
executable where GNU_STACK uses flags RWE instead of the desired RW.
-rw-r--r--gas.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/gas.c b/gas.c
index d339f3e..6d89a89 100644
--- a/gas.c
+++ b/gas.c
@@ -98,6 +98,8 @@ gasemitfin(FILE *f)
 	int sz, i;
 	double d;
 
+	fprintf(f, ".section .note.GNU-stack,\"\",@progbits\n");
+
 	if (!stash)
 		return;
 	fprintf(f, "/* floating point constants */\n.data\n");
@@ -126,5 +128,4 @@ gasemitfin(FILE *f)
 		stash = b->link;
 		free(b);
 	}
-	fprintf(f, ".section .note.GNU-stack,\"\",@progbits\n");
 }