diff options
author | Saleem Abdulrasool <compnerd@compnerd.org> | 2016-06-22 22:09:42 +0000 |
---|---|---|
committer | Saleem Abdulrasool <compnerd@compnerd.org> | 2016-06-22 22:09:42 +0000 |
commit | 4c71a477ac0bd7b19c72d7625861f1f18c15b278 (patch) | |
tree | c2fd3c01e223cdac2b2042c6d323b2e2f59cd695 /lib/builtins/assembly.h | |
parent | 1b1a91100eca99b8eef8fa9b5ffe471d3cf27af4 (diff) |
builtins: tag with noexecstack
These routines do not require executable stacks. However, by default ELFish
linkers may assume an executable stack on GNUish environments (and some non-GNU
ones too!). The GNU extension to add a note to indicate a non-executable stack
is honoured by these environments to mark the stack as non-executable (the
compiler normally emits this directive on appropriate targets whenever
possible). This allows normal builds from getting executable stacks due to
linking to the compiler rt builtins.
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@273500 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/builtins/assembly.h')
-rw-r--r-- | lib/builtins/assembly.h | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/lib/builtins/assembly.h b/lib/builtins/assembly.h index c28970534..5fc74f68f 100644 --- a/lib/builtins/assembly.h +++ b/lib/builtins/assembly.h @@ -30,6 +30,8 @@ #define SYMBOL_IS_FUNC(name) #define CONST_SECTION .const +#define NO_EXEC_STACK_DIRECTIVE + #elif defined(__ELF__) #define HIDDEN(name) .hidden name @@ -42,6 +44,12 @@ #endif #define CONST_SECTION .section .rodata +#if defined(__GNU__) || defined(__ANDROID__) || defined(__FreeBSD__) +#define NO_EXEC_STACK_DIRECTIVE .section .note.GNU-stack,"",%progbits +#else +#define NO_EXEC_STACK_DIRECTIVE +#endif + #else // !__APPLE__ && !__ELF__ #define HIDDEN(name) @@ -54,6 +62,8 @@ .endef #define CONST_SECTION .section .rdata,"rd" +#define NO_EXEC_STACK_DIRECTIVE + #endif #if defined(__arm__) |