From f1410015f0543e69e52034a5d1cb4ca1982bca34 Mon Sep 17 00:00:00 2001 From: Konstantin Belousov Date: Tue, 25 Jan 2011 21:06:49 +0000 Subject: [PATCH] Emit .note.GNU-stack for the syscall stubs generated by libc only on architectures that support this .note. In particular, do not unneccessary emit the notes on ia64 and sparc64, which ABI require non-executable stacks. Tested by: marcel --- lib/libc/sys/Makefile.inc | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/lib/libc/sys/Makefile.inc b/lib/libc/sys/Makefile.inc index 7a8947160af..fe6116ac1ae 100644 --- a/lib/libc/sys/Makefile.inc +++ b/lib/libc/sys/Makefile.inc @@ -53,16 +53,23 @@ SYM_MAPS+= ${.CURDIR}/sys/Symbol.map # Generated files CLEANFILES+= ${SASM} ${SPSEUDO} +.if ${MACHINE_CPUARCH} == "amd64" || ${MACHINE_CPUARCH} == "i386" || \ + ${MACHINE_CPUARCH} == "powerpc" +NOTE_GNU_STACK='\t.section .note.GNU-stack,"",%%progbits\n' +.else +NOTE_GNU_STACK='' +.endif + ${SASM}: printf '#include "compat.h"\n' > ${.TARGET} printf '#include "SYS.h"\nRSYSCALL(${.PREFIX})\n' >> ${.TARGET} - printf '\t.section .note.GNU-stack,"",%%progbits\n' >>${.TARGET} + printf ${NOTE_GNU_STACK} >>${.TARGET} ${SPSEUDO}: printf '#include "compat.h"\n' > ${.TARGET} printf '#include "SYS.h"\nPSEUDO(${.PREFIX:S/_//})\n' \ >> ${.TARGET} - printf '\t.section .note.GNU-stack,"",%%progbits\n' >>${.TARGET} + printf ${NOTE_GNU_STACK} >>${.TARGET} MAN+= abort2.2 accept.2 access.2 acct.2 adjtime.2 \ aio_cancel.2 aio_error.2 aio_read.2 aio_return.2 \