crtend*: Add GNU_STACK note
Add a GNU_STACK marker to crtend* files. This tells the linker that these files do not require an executable stack. When linking, a missing GNU_STACK marker in any .o file can prevent the compiler from automatically marking the final executable as NX safe (executable stack not required). In Android, we normally work around this by adding -Wa,--noexecstack / -Wl,-z,noexecstack. For files like crtend.S / crtend_so.S, which are included in every executable / shared library, it's better to add the GNU_STACK note directly to the assembly file. This allows the compiler to automatically mark the final executable as NX safe without any special command line options. References: http://www.gentoo.org/proj/en/hardened/gnu-stack.xml Change-Id: I07bd058f9f60ddd8b146e0fb36ba26ff84c0357d
This commit is contained in:
parent
a1822dced3
commit
6eee1fc68f
2 changed files with 6 additions and 0 deletions
|
@ -38,3 +38,6 @@
|
|||
.section .ctors, "aw"
|
||||
.long 0
|
||||
|
||||
#if defined(__linux__) && defined(__ELF__)
|
||||
.section .note.GNU-stack,"",%progbits
|
||||
#endif
|
||||
|
|
|
@ -36,3 +36,6 @@
|
|||
.section .fini_array, "aw"
|
||||
.long 0
|
||||
|
||||
#if defined(__linux__) && defined(__ELF__)
|
||||
.section .note.GNU-stack,"",%progbits
|
||||
#endif
|
||||
|
|
Loading…
Reference in a new issue