From a5ab4f4dfacd1938a64df4d07df346774f62c541 Mon Sep 17 00:00:00 2001 From: nsfisis Date: Wed, 13 Aug 2025 02:25:32 +0900 Subject: feat: output .note.GNU-stack section and remove "-z noexecstack" from ld flags --- codegen.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'codegen.c') diff --git a/codegen.c b/codegen.c index 59cee04..92a8619 100644 --- a/codegen.c +++ b/codegen.c @@ -531,6 +531,10 @@ void codegen(Program* prog) { printf(".intel_syntax noprefix\n\n"); + // For GNU ld: + // https://sourceware.org/binutils/docs/ld/Options.html + printf(".section .note.GNU-stack,\"\",@progbits\n\n"); + printf(".section .rodata\n\n"); for (int i = 0; prog->str_literals[i]; ++i) { printf(".Lstr__%d:\n", i + 1); -- cgit v1.2.3-70-g09d2