summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoakim Tjernlund <joakim.tjernlund@transmode.se>2005-05-26 21:23:03 +0000
committerJoakim Tjernlund <joakim.tjernlund@transmode.se>2005-05-26 21:23:03 +0000
commit5c48e4b530c96dff7b8293ffaa636332298169f5 (patch)
tree236b09c4a3d7b1ccc4fb4bb7b8461324c8e4cd66
parent8cc46759b24d20030ae73c16304a35758c7c328c (diff)
Add PIE support to ARM. From Peter Mazinger
-rw-r--r--extra/Configs/Config.in4
-rw-r--r--libc/sysdeps/linux/arm/Makefile16
2 files changed, 14 insertions, 6 deletions
diff --git a/extra/Configs/Config.in b/extra/Configs/Config.in
index 66c90365f..738ab9408 100644
--- a/extra/Configs/Config.in
+++ b/extra/Configs/Config.in
@@ -1110,12 +1110,12 @@ config UCLIBC_BUILD_PIE
bool "Build utilities as ET_DYN/PIE executables"
depends on UCLIBC_SECURITY
depends on HAVE_SHARED
- depends on TARGET_i386 || TARGET_powerpc || TARGET_mips || TARGET_frv
+ depends on TARGET_arm || TARGET_frv || TARGET_i386 || TARGET_mips || TARGET_powerpc
select FORCE_SHAREABLE_TEXT_SEGMENTS if BUILD_UCLIBC_LDSO
default y
help
If you answer Y here, ldd and iconv are built as ET_DYN/PIE executables.
- It requires gcc-3.4 and binutils-2.15 or later.
+ It requires gcc-3.4 and binutils-2.15 (for arm 2.16) or later.
More about ET_DYN/PIE binaries on <http://pax.grsecurity.net/> .
WARNING: This option also enables FORCE_SHAREABLE_TEXT_SEGMENTS, so all
libraries have to be built with -fPIC or -fpic, and all assembler
diff --git a/libc/sysdeps/linux/arm/Makefile b/libc/sysdeps/linux/arm/Makefile
index 94929304e..1a11e43ef 100644
--- a/libc/sysdeps/linux/arm/Makefile
+++ b/libc/sysdeps/linux/arm/Makefile
@@ -21,7 +21,7 @@ include $(TOPDIR)Rules.mak
CRT0_SRC = crt0.S
CRT0_OBJ = crt0.o crt1.o
-CRT0_DEPS=gmon-start.S
+SCRT0_OBJ = $(patsubst %,S%, $(CRT0_OBJ))
CTOR_TARGETS=$(TOPDIR)lib/crti.o $(TOPDIR)lib/crtn.o
SSRC=__longjmp.S vfork.S clone.S setjmp.S bsd-setjmp.S \
@@ -37,15 +37,24 @@ OBJ_LIST=../../../obj.sysdeps.$(TARGET_ARCH)
all: $(OBJ_LIST)
-$(OBJ_LIST): $(OBJS) $(CRT0_OBJ) $(CTOR_TARGETS)
+$(OBJ_LIST): $(OBJS) $(CRT0_OBJ) $(SCRT0_OBJ) $(CTOR_TARGETS)
echo $(patsubst %, sysdeps/linux/$(TARGET_ARCH)/%, $(OBJS)) > $(OBJ_LIST)
$(INSTALL) -d $(TOPDIR)lib/
- cp $(CRT0_OBJ) $(TOPDIR)lib/
+ cp $(CRT0_OBJ) $(SCRT0_OBJ) $(TOPDIR)lib/
+ifeq ($(strip $(UCLIBC_CTOR_DTOR)),y)
+ $(RM) $(TOPDIR)lib/Scrt0.o
+else
+ mv $(TOPDIR)lib/Scrt0.o $(TOPDIR)lib/Scrt1.o
+endif
$(CRT0_OBJ): $(CRT0_SRC)
$(CC) $(ASFLAGS) -DL_$* $< -c -o $*.o
$(STRIPTOOL) -x -R .note -R .comment $*.o
+$(SCRT0_OBJ): $(CRT0_SRC)
+ $(CC) $(ASFLAGS) $(PIEFLAG) -DL_$* $< -c -o $*.o
+ $(STRIPTOOL) -x -R .note -R .comment $*.o
+
$(SOBJS): %.o : %.S
$(CC) $(ASFLAGS) -c $< -o $@
$(STRIPTOOL) -x -R .note -R .comment $*.o
@@ -83,4 +92,3 @@ headers:
clean:
$(RM) *.[oa] *~ core
$(RM) bits/sysnum.h
- $(RM) gmon-start.S