Bladeren bron

Patch from Peter S. Mazinger to simplify PIE handling

Eric Andersen 21 jaren geleden
bovenliggende
commit
5941632e79
5 gewijzigde bestanden met toevoegingen van 7 en 19 verwijderingen
  1. 3 3
      Rules.mak
  2. 4 6
      extra/Configs/Config.in
  3. 0 2
      libc/sysdeps/linux/frv/Makefile
  4. 0 4
      libc/sysdeps/linux/i386/Makefile
  5. 0 4
      libc/sysdeps/linux/powerpc/Makefile

+ 3 - 3
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

+ 4 - 6
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

+ 0 - 2
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

+ 0 - 4
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

+ 0 - 4
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