diff options
author | Xavier Leroy <xavier.leroy@inria.fr> | 2008-08-01 08:04:57 +0000 |
---|---|---|
committer | Xavier Leroy <xavier.leroy@inria.fr> | 2008-08-01 08:04:57 +0000 |
commit | 1f93465a0e797d61d7de5c09c259ae1691f83efe (patch) | |
tree | 9672bc400d0610534c84aaebc11f5cb6f4ceb143 /asmcomp | |
parent | 50af4a8c98541bd9e87776a858dd892915dc6598 (diff) | |
download | ocaml-1f93465a0e797d61d7de5c09c259ae1691f83efe.tar.gz |
PR#4564 (partial): mark stack as non-executable on Linux/ELF
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@8962 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
Diffstat (limited to 'asmcomp')
-rw-r--r-- | asmcomp/amd64/emit.mlp | 6 | ||||
-rw-r--r-- | asmcomp/i386/emit.mlp | 5 |
2 files changed, 9 insertions, 2 deletions
diff --git a/asmcomp/amd64/emit.mlp b/asmcomp/amd64/emit.mlp index ec021ca359..c38a73e8c2 100644 --- a/asmcomp/amd64/emit.mlp +++ b/asmcomp/amd64/emit.mlp @@ -752,4 +752,8 @@ let end_assembly() = efa_label_rel = (fun lbl ofs -> ` .long ({emit_label lbl} - .) + {emit_int32 ofs}\n`); efa_def_label = (fun l -> `{emit_label l}:\n`); - efa_string = (fun s -> emit_string_directive " .asciz " s) } + efa_string = (fun s -> emit_string_directive " .asciz " s) }; + if Config.system = "linux" then + (* Mark stack as non-executable, PR#4564 *) + ` .section .note.GNU-stack,\"\",%progbits\n` + diff --git a/asmcomp/i386/emit.mlp b/asmcomp/i386/emit.mlp index fe1291e021..aaaba421a4 100644 --- a/asmcomp/i386/emit.mlp +++ b/asmcomp/i386/emit.mlp @@ -986,4 +986,7 @@ let end_assembly() = if use_ascii_dir then emit_string_directive " .ascii " s else emit_bytes_directive " .byte " s) }; - if macosx then emit_external_symbols () + if macosx then emit_external_symbols (); + if Config.system = "linux_elf" then + (* Mark stack as non-executable, PR#4564 *) + `\n .section .note.GNU-stack,\"\",%progbits\n` |