Skip to content
Snippets Groups Projects
Commit d2787d4a authored by Deucе's avatar Deucе :ok_hand_tone4:
Browse files

Add a .note.GNU-stack section

This should prevent programs using rgbmap (ie: SyncTERM) from
having an exectuable stack on Linux.
parent a612e168
No related branches found
No related tags found
1 merge request!463MRC mods by Codefenix (2024-10-20)
Pipeline #4339 failed
......@@ -61,6 +61,7 @@ main(int argc, char **argv)
char path[1024];
char *mangle = "";
char *section = ".rodata";
char *gnustack = "";
if (argc != 3) {
fprintf(stderr, "Usage: %s <os> <path>\n", argv[0]);
......@@ -81,16 +82,19 @@ main(int argc, char **argv)
section = "__TEXT,__const";
mangle = "_";
}
if (strcmp(argv[1], "linux") == 0) {
gnustack = ".section .note.GNU-stack, \“\”, @progbits\n";
}
fprintf(s,
".section %s\n"
"%s.section %s\n"
".global %sr2y\n"
".global %sy2r\n"
".align 4\n"
"%sr2y:\n"
" .incbin \"%s/r2y.bin\"\n"
"%sy2r:\n"
" .incbin \"%s/y2r.bin\"\n", section, mangle, mangle, mangle, argv[2], mangle, argv[2]);
" .incbin \"%s/y2r.bin\"\n", gnustack, section, mangle, mangle, mangle, argv[2], mangle, argv[2]);
fprintf(h,
"#ifndef RGBMAP_H\n"
"#define RGBMAP_H\n"
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment