diff options
-rw-r--r-- | Rules.mak | 18 | ||||
-rw-r--r-- | libc/sysdeps/linux/i386/clone.S | 13 | ||||
-rw-r--r-- | libc/sysdeps/linux/i386/mmap64.S | 5 | ||||
-rw-r--r-- | libc/sysdeps/linux/i386/syscall.S | 5 | ||||
-rw-r--r-- | libc/sysdeps/linux/i386/vfork.S | 5 | ||||
-rw-r--r-- | libcrypt/des.c | 4 | ||||
-rw-r--r-- | utils/Makefile | 11 |
7 files changed, 35 insertions, 26 deletions
@@ -222,6 +222,12 @@ endif ifeq ($(strip $(TARGET_ARCH)),frv) CPU_LDFLAGS-$(CONFIG_FRV)+=-melf32frvfd CPU_CFLAGS-$(CONFIG_FRV)+=-mfdpic + # 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 + # and calls through PLTs, dynamic resolution of symbols, etc, + # which would break as well, but -Bsymbolic comes to the rescue. + export LDPIEFLAG:=-shared -Bsymbolic UCLIBC_LDSO=ld.so.1 endif @@ -230,7 +236,17 @@ ifndef PIEFLAG ifneq ($(UCLIBC_BUILD_PIE),y) export PIEFLAG:= else -export PIEFLAG:=$(call check_gcc,$(PIEFLAG_NAME),) +export PIEFLAG:=$(call check_gcc,$(PIEFLAG_NAME),$(PICFLAG)) +endif +endif +# We need to keep track of both the CC PIE flag (above) as +# well as the LD PIE flag (below) because we can't rely on +# gcc passing -pie if we used -fPIE +ifndef LDPIEFLAG +ifneq ($(UCLIBC_BUILD_PIE),y) +export LDPIEFLAG:= +else +export LDPIEFLAG:=$(shell $(LD) --help | grep -q pie && echo "-Wl,-pie") endif endif diff --git a/libc/sysdeps/linux/i386/clone.S b/libc/sysdeps/linux/i386/clone.S index fbbb7d4cf..259982230 100644 --- a/libc/sysdeps/linux/i386/clone.S +++ b/libc/sysdeps/linux/i386/clone.S @@ -51,19 +51,19 @@ __clone: /* no NULL function pointers */ movl FUNC(%esp),%ecx #ifdef __PIC__ - jecxz __error + jecxz __syscall_error #else testl %ecx,%ecx - jz __error + jz __syscall_error #endif /* no NULL stack pointers */ movl STACK(%esp),%ecx #ifdef __PIC__ - jecxz __error + jecxz __syscall_error #else testl %ecx,%ecx - jz __error + jz __syscall_error #endif /* Insert the argument onto the new stack. Make sure the new @@ -96,7 +96,7 @@ __clone: popl %ebx test %eax,%eax - jl __error + jl __syscall_error jz .Lthread_start ret @@ -114,9 +114,6 @@ __clone: movl $__NR_exit, %eax int $0x80 -__error: - jmp __syscall_error - .size __clone,.-__clone .weak clone diff --git a/libc/sysdeps/linux/i386/mmap64.S b/libc/sysdeps/linux/i386/mmap64.S index 34cee1640..5c89c983b 100644 --- a/libc/sysdeps/linux/i386/mmap64.S +++ b/libc/sysdeps/linux/i386/mmap64.S @@ -76,7 +76,7 @@ mmap64: /* If 0 > %eax > -4096 there was an error. */ cmpl $-4095,%eax - ja __error + ja __syscall_error /* Successful; return the syscall's value. */ ret @@ -89,9 +89,6 @@ L_einval: movl $-EINVAL, %eax jmp __error -__error: - jmp __syscall_error - .size mmap64,.-mmap64 #endif diff --git a/libc/sysdeps/linux/i386/syscall.S b/libc/sysdeps/linux/i386/syscall.S index 44eb00f49..19adf97a8 100644 --- a/libc/sysdeps/linux/i386/syscall.S +++ b/libc/sysdeps/linux/i386/syscall.S @@ -45,10 +45,7 @@ syscall: popl %ebp cmpl $-4095,%eax - jae __error + jae __syscall_error ret /* Return to caller. */ -__error: - jmp __syscall_error - .size syscall,.-syscall diff --git a/libc/sysdeps/linux/i386/vfork.S b/libc/sysdeps/linux/i386/vfork.S index 19c1210cb..d382dbac3 100644 --- a/libc/sysdeps/linux/i386/vfork.S +++ b/libc/sysdeps/linux/i386/vfork.S @@ -23,12 +23,9 @@ __vfork: int $0x80 pushl %ecx cmpl $-4095,%eax - jae __error + jae __syscall_error ret -__error: - jmp __syscall_error - .size __vfork,.-__vfork diff --git a/libcrypt/des.c b/libcrypt/des.c index 270fe26ab..3b49a7af6 100644 --- a/libcrypt/des.c +++ b/libcrypt/des.c @@ -611,7 +611,7 @@ setkey(const char *key) if (*key++ & 1) p[i] |= bits8[j]; } - des_setkey(p); + des_setkey((char *)p); } @@ -625,7 +625,7 @@ encrypt(char *block, int flag) des_init(); setup_salt(0L); - p = block; + p = (u_char*)block; for (i = 0; i < 2; i++) { io[i] = 0L; for (j = 0; j < 32; j++) diff --git a/utils/Makefile b/utils/Makefile index fcd38fea4..7023a9b21 100644 --- a/utils/Makefile +++ b/utils/Makefile @@ -46,22 +46,27 @@ readelf: readelf.c $(CC) $(CFLAGS) $^ -o $@ $(STRIPTOOL) -s -x -R .note -R .comment $@ +ifeq ($(strip $(UCLIBC_STATIC_LDCONFIG)),y) +LDCONFIG_CFLAGS := -static +else +LDCONFIG_CFLAGS := $(PIEFLAG) $(LDPIEFLAG) +endif ldconfig: ldconfig.c - $(CC) $(CFLAGS) $(if $(filter $(UCLIBC_STATIC_LDCONFIG),y),-static) \ + $(CC) $(CFLAGS) $(LDCONFIG_CFLAGS) \ -DUCLIBC_RUNTIME_PREFIX=\"$(RUNTIME_PREFIX)\" \ -DUCLIBC_LDSO=$(UCLIBC_LDSO) -I. -I../ldso/include \ $^ -o $@ $(STRIPTOOL) -s -x -R .note -R .comment $@ ldd: ldd.c - $(CC) $(CFLAGS) $(PIEFLAG) \ + $(CC) $(CFLAGS) $(PIEFLAG) $(LDPIEFLAG) \ -DUCLIBC_RUNTIME_PREFIX=\"$(RUNTIME_PREFIX)\" \ -DUCLIBC_LDSO=$(UCLIBC_LDSO) -I. -I../ldso/include \ $^ -o $@ $(STRIPTOOL) -s -x -R .note -R .comment $@ iconv: ../libc/misc/wchar/wchar.c - $(CC) $(CFLAGS) $(PIEFLAG) -Wl,-s \ + $(CC) $(CFLAGS) $(PIEFLAG) $(LDPIEFLAG) \ -DL_iconv_main \ $^ -o $@ $(STRIPTOOL) -s -x -R .note -R .comment $@ |