summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Andersen <andersen@codepoet.org>2004-12-22 18:58:12 +0000
committerEric Andersen <andersen@codepoet.org>2004-12-22 18:58:12 +0000
commit5941632e79effa6654512aa391a6d569cde68b94 (patch)
tree791f10bb689006199d5fb4bf1780d3afc26a8cf5
parent4a56d69f1e77a362a51255c125d471fb468f9517 (diff)
Patch from Peter S. Mazinger to simplify PIE handling
-rw-r--r--Rules.mak6
-rw-r--r--extra/Configs/Config.in10
-rw-r--r--libc/sysdeps/linux/frv/Makefile2
-rw-r--r--libc/sysdeps/linux/i386/Makefile4
-rw-r--r--libc/sysdeps/linux/powerpc/Makefile4
5 files changed, 7 insertions, 19 deletions
diff --git a/Rules.mak b/Rules.mak
index b7b4df385..644d4c3ca 100644
--- a/Rules.mak
+++ b/Rules.mak
@@ -91,6 +91,7 @@ OPTIMIZATION:=
PICFLAG:=-fPIC
PIEFLAG:=$(call check_gcc,-fPIE,)
ifeq ($(strip $(PIEFLAG)),-fPIE)
+# should add check if ld supports -pie
LDPIEFLAG:=-Wl,-pie
endif
@@ -184,14 +185,13 @@ ifeq ($(strip $(TARGET_ARCH)),powerpc)
# enough. Therefore use -fpic which will reduce code size and generates
# faster code.
PICFLAG:=-fpic
- PIEFLAG=$(call check_gcc,-fpie,)
+ PIEFLAG:=$(call check_gcc,-fpie,)
endif
ifeq ($(strip $(TARGET_ARCH)),frv)
CPU_LDFLAGS-$(CONFIG_FRV)+=-melf32frvfd
CPU_CFLAGS-$(CONFIG_FRV)+=-mfdpic
PICFLAG=-fPIC -DPIC
- PIEFLAG=-fpie
# Using -pie causes the program to have an interpreter, which is
# forbidden, so we must make do with -shared. Unfortunately,
# -shared by itself would get us global function descriptors
@@ -226,7 +226,7 @@ ifeq ($(strip $(TARGET_ARCH)),arm)
endif
endif
-ifneq ($(strip $(UCLIBC_PIE_SUPPORT)),y)
+ifneq ($(UCLIBC_PIE_SUPPORT),y)
PIEFLAG=
LDPIEFLAG=
endif
diff --git a/extra/Configs/Config.in b/extra/Configs/Config.in
index c65a767e7..65f9b32d3 100644
--- a/extra/Configs/Config.in
+++ b/extra/Configs/Config.in
@@ -206,16 +206,14 @@ config FORCE_SHAREABLE_TEXT_SEGMENTS
coded shared libraries.
config UCLIBC_PIE_SUPPORT
- bool "Support ET_DYN in shared library loader"
+ bool "Build utilities as ET_DYN/PIE executables"
depends on HAVE_SHARED
- depends on TARGET_i386 || TARGET_powerpc
+ depends on TARGET_i386 || TARGET_powerpc || TARGET_frv
select FORCE_SHAREABLE_TEXT_SEGMENTS if BUILD_UCLIBC_LDSO
default n
help
- If you answer Y here, Scrt1.o will be built to allow the creation of
- ET_DYN/PIE executables.
- It requires binutils-2.14.90.0.6 or later and the usage of the
- -pie option.
+ If you answer Y here, ldd and iconv are built as ET_DYN/PIE executables.
+ This requires gcc-3.4 and binutils-2.15 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/frv/Makefile b/libc/sysdeps/linux/frv/Makefile
index fc1cf327c..f2e169d74 100644
--- a/libc/sysdeps/linux/frv/Makefile
+++ b/libc/sysdeps/linux/frv/Makefile
@@ -22,9 +22,7 @@ include $(TOPDIR)Rules.mak
CRT0_SRC = crt0.S
CRT0_OBJ = crt0.o crt1.o
-ifeq ($(strip $(UCLIBC_PIE_SUPPORT)),y)
SCRT0_OBJ = $(patsubst %,S%, $(CRT0_OBJ))
-endif
CRT0_DEPS=gmon-start.S
CTOR_TARGETS = crti.o crtn.o
diff --git a/libc/sysdeps/linux/i386/Makefile b/libc/sysdeps/linux/i386/Makefile
index 6b6a9d6dc..c48a44092 100644
--- a/libc/sysdeps/linux/i386/Makefile
+++ b/libc/sysdeps/linux/i386/Makefile
@@ -21,9 +21,7 @@ include $(TOPDIR)Rules.mak
CRT0_SRC = crt0.S
CRT0_OBJ = crt0.o crt1.o
-ifeq ($(strip $(UCLIBC_PIE_SUPPORT)),y)
SCRT0_OBJ = $(patsubst %,S%, $(CRT0_OBJ))
-endif
CRT0_DEPS=gmon-start.S
CTOR_TARGETS=$(TOPDIR)lib/crti.o $(TOPDIR)lib/crtn.o
@@ -43,13 +41,11 @@ $(LIBC): ar-target
ar-target: $(OBJS) $(CRT0_OBJ) $(SCRT0_OBJ) $(CTOR_TARGETS)
$(AR) $(ARFLAGS) $(LIBC) $(OBJS)
cp $(CRT0_OBJ) $(SCRT0_OBJ) $(TOPDIR)lib/
-ifeq ($(strip $(UCLIBC_PIE_SUPPORT)),y)
ifeq ($(strip $(UCLIBC_CTOR_DTOR)),y)
$(RM) $(TOPDIR)lib/Scrt0.o
else
mv $(TOPDIR)lib/Scrt0.o $(TOPDIR)lib/Scrt1.o
endif
-endif
$(CRT0_OBJ): $(CRT0_SRC)
$(CC) $(ASFLAGS) -DL_$* $< -c -o $*.o
diff --git a/libc/sysdeps/linux/powerpc/Makefile b/libc/sysdeps/linux/powerpc/Makefile
index bc2f7d5d9..b2da65eba 100644
--- a/libc/sysdeps/linux/powerpc/Makefile
+++ b/libc/sysdeps/linux/powerpc/Makefile
@@ -21,9 +21,7 @@ include $(TOPDIR)Rules.mak
CRT0_SRC = crt0.S
CRT0_OBJ = crt0.o crt1.o
-ifeq ($(strip $(UCLIBC_PIE_SUPPORT)),y)
SCRT0_OBJ = $(patsubst %,S%, $(CRT0_OBJ))
-endif
CRT0_DEPS=gmon-start.S
CTOR_TARGETS=$(TOPDIR)lib/crti.o $(TOPDIR)lib/crtn.o
@@ -43,13 +41,11 @@ $(LIBC): ar-target
ar-target: $(OBJS) $(CRT0_OBJ) $(SCRT0_OBJ) $(CTOR_TARGETS)
$(AR) $(ARFLAGS) $(LIBC) $(OBJS)
cp $(CRT0_OBJ) $(SCRT0_OBJ) $(TOPDIR)lib/
-ifeq ($(strip $(UCLIBC_PIE_SUPPORT)),y)
ifeq ($(strip $(UCLIBC_CTOR_DTOR)),y)
$(RM) $(TOPDIR)lib/Scrt0.o
else
mv $(TOPDIR)lib/Scrt0.o $(TOPDIR)lib/Scrt1.o
endif
-endif
$(CRT0_OBJ): $(CRT0_SRC)
$(CC) $(ASFLAGS) -DL_$* $< -c -o $*.o