[uClibc] executable stack marking

Peter S. Mazinger ps.m at gmx.net
Wed Sep 1 07:40:14 UTC 2004


Hello!

Newer binutils support the executable stack marking (GNU_STACK)
Default is non-executable for all C source, unless some, probably nested 
functions are found, but defaults to executable for assembler.
uClibc's crt files are (mostly) written in assembler, and will be marked 
as executable, so all the resulting executables will get executable 
marking.
The attached patch allows all of the assembler code been marked as 
non-executable, so any later produced binaries will also default to 
non-executable stack.
The patch requires the earlier sent generic asflags patch.

Thanks, Peter

-- 
Peter S. Mazinger <ps dot m at gmx dot net>           ID: 0xA5F059F2
Key fingerprint = 92A4 31E1 56BC 3D5A 2D08  BB6E C389 975E A5F0 59F2

____________________________________________________________________
Miert fizetsz az internetert? Korlatlan, ingyenes internet hozzaferes a FreeStarttol.
Probald ki most! http://www.freestart.hu
-------------- next part --------------
--- ./ldso/ldso/Makefile.mps	2004-08-31 14:18:57.000000000 +0200
+++ ./ldso/ldso/Makefile	2004-08-31 14:20:21.000000000 +0200
@@ -23,7 +23,7 @@ LDSO_FULLNAME=ld-uClibc-$(MAJOR_VERSION)
 
 SSPFLAGS=$(call check_gcc,-fno-stack-protector,)
 # reset to initial (disabling predefined CFLAGS)
-ASFLAGS=
+ASFLAGS=$(check_as_noexecstack)
 
 XXFLAGS=$(XWARNINGS) $(LIBRARY_CACHE) $(SSPFLAGS)
 ifeq ($(DODEBUG),y)
--- ./Rules.mak.mps	2004-08-31 14:16:37.000000000 +0200
+++ ./Rules.mak	2004-08-31 14:18:47.000000000 +0200
@@ -264,6 +264,9 @@ endif
 
 ASFLAGS = $(CFLAGS)
 
+check_as_noexecstack=$(shell if $(LD) --help | grep -q "z noexecstack"; then echo "-Wa,--noexecstack"; fi)
+ASFLAGS+=$(check_as_noexecstack)
+
 LIBGCC_CFLAGS ?= $(CFLAGS) $(CPU_CFLAGS-y)
 LIBGCC:=$(shell $(CC) $(LIBGCC_CFLAGS) -print-libgcc-file-name)
 LIBGCC_DIR:=$(dir $(LIBGCC))


More information about the uClibc mailing list