Fix inconsistencies with GNU-stack note:

- always use __ELF__ && __linux, not just __ELF__ or just __linux__
- remember to pop back to the previous section where it is missing
XXX: need to file this bug with the GNU folks.
This commit is contained in:
christos 2015-11-07 16:53:07 +00:00
parent b16a5c9dec
commit bb5915f98c
10 changed files with 12 additions and 9 deletions

View File

@ -22,8 +22,9 @@
# see the files COPYING3 and COPYING.RUNTIME respectively. If not, see # see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
# <http://www.gnu.org/licenses/>. # <http://www.gnu.org/licenses/>.
#ifdef __ELF__ #if defined(__ELF__) && defined(__linux__)
.section .note.GNU-stack,"" .section .note.GNU-stack,""
.previous
#endif #endif
.set noreorder .set noreorder

View File

@ -853,7 +853,7 @@ __morestack_make_guard:
.quad __morestack_load_mmap .quad __morestack_load_mmap
#endif #endif
#ifdef __ELF__ #if defined(__ELF__) && defined(__linux__)
.section .note.GNU-stack,"",@progbits .section .note.GNU-stack,"",@progbits
.section .note.GNU-split-stack,"",@progbits .section .note.GNU-split-stack,"",@progbits
.section .note.GNU-no-split-stack,"",@progbits .section .note.GNU-no-split-stack,"",@progbits

View File

@ -107,6 +107,6 @@ GTM_longjmp:
ret ret
.end GTM_longjmp .end GTM_longjmp
#ifdef __linux__ #if defined(__ELF__) && defined(__linux__)
.section .note.GNU-stack, "", @progbits .section .note.GNU-stack, "", @progbits
#endif #endif

View File

@ -159,6 +159,6 @@ GTM_longjmp:
cfi_endproc cfi_endproc
.size GTM_longjmp, . - GTM_longjmp .size GTM_longjmp, . - GTM_longjmp
#ifdef __linux__ #if defined(__ELF__) && defined(__linux__)
.section .note.GNU-stack, "", %progbits .section .note.GNU-stack, "", %progbits
#endif #endif

View File

@ -428,6 +428,6 @@ FUNC GTM_longjmp
cfi_endproc cfi_endproc
END GTM_longjmp END GTM_longjmp
#ifdef __linux__ #if defined(__ELF__) && defined(__linux__)
.section .note.GNU-stack, "", @progbits .section .note.GNU-stack, "", @progbits
#endif #endif

View File

@ -105,4 +105,6 @@ GTM_longjmp:
.size GTM_longjmp, .-GTM_longjmp .size GTM_longjmp, .-GTM_longjmp
#if defined(__ELF__) && defined(__linux__)
.section .note.GNU-stack, "", @progbits .section .note.GNU-stack, "", @progbits
#endif

View File

@ -117,6 +117,6 @@ GTM_longjmp:
.size GTM_longjmp, . - GTM_longjmp .size GTM_longjmp, . - GTM_longjmp
#ifdef __linux__ #if defined(__ELF__) && defined(__linux__)
.section .note.GNU-stack, "", %progbits .section .note.GNU-stack, "", %progbits
#endif #endif

View File

@ -92,6 +92,6 @@ GTM_longjmp:
cfi_endproc cfi_endproc
.size GTM_longjmp, . - GTM_longjmp .size GTM_longjmp, . - GTM_longjmp
#ifdef __linux__ #if defined(__ELF__) && defined(__linux__)
.section .note.GNU-stack, "", @progbits .section .note.GNU-stack, "", @progbits
#endif #endif

View File

@ -142,6 +142,6 @@ SYM(GTM_longjmp):
HIDDEN(GTM_longjmp) HIDDEN(GTM_longjmp)
SIZE(GTM_longjmp) SIZE(GTM_longjmp)
#ifdef __linux__ #if defined(__ELF__) && defined(__linux__)
.section .note.GNU-stack, "", @progbits .section .note.GNU-stack, "", @progbits
#endif #endif

View File

@ -166,7 +166,7 @@ __tsan_report_race_thunk:
ret ret
.cfi_endproc .cfi_endproc
#ifdef __linux__ #if defined(__ELF__) && defined(__linux__)
/* We do not need executable stack. */ /* We do not need executable stack. */
.section .note.GNU-stack,"",@progbits .section .note.GNU-stack,"",@progbits
#endif #endif