Commit a64d8d26 authored by Natanael Copa's avatar Natanael Copa

core/gcc: hack to not link all built programs to libgcc.

parent fc2f1974
pkgname=gcc
pkgver=4.3.2
pkgrel=0
pkgrel=1
pkgdesc="The GNU Compiler Collection"
url="http://gcc.gnu.org"
license="GPL LGPL"
......@@ -13,7 +13,10 @@ source="ftp://gcc.gnu.org/pub/gcc/releases/gcc-4.3.2/gcc-core-4.3.2.tar.bz2
01_all_gcc-4.0.2-v9.0.0-start_endfile-boundschecking-no.patch
01_all_gcc-4.3.1-crtbeginTS-stuff.patch
02_all_gcc-4.3.1-v10.0.1-start_endfile.patch
gcc4-stack-protector-uclibc-no_tls.patch
gcc-4.2.0-cc1-no-stack-protector.patch
gcc-4.3.2-default-ssp-pie.patch
pt_gnu_eh_frame.patch
"
build ()
......@@ -30,10 +33,19 @@ build ()
# Don't build crtbegin/end with ssp
sed -e 's|^CRTSTUFF_CFLAGS = |CRTSTUFF_CFLAGS = -fno-stack-protector |' \
-i gcc/Makefile.in || die "Failed to update crtstuff!"
-i gcc/Makefile.in || return 1
# Don't build libgcc with SSP
sed -e 's|^LIBGCC2_CFLAGS = |LIBGCC2_CFLAGS = -fno-stack-protector -U_FORTIFY_SOURCE |' \
-i gcc/Makefile.in || return 1
mkdir build;
cd build;
# Use SSP from libc
msg "Enabling SSP from libc"
sed -e 's|^LIBGCC2_CFLAGS = |LIBGCC2_CFLAGS = -D_LIBC_PROVIDES_SSP_ |' \
-i gcc/Makefile.in || return 1
mkdir build
cd build
../configure --prefix=/usr \
--mandir=/usr/share/man \
--infodir=/usr/share/info \
......@@ -41,11 +53,13 @@ build ()
--disable-altivec \
--disable-checking \
--disable-fixed-point \
--disable-libssp \
--disable-libstdcxx-pch \
--disable-multilib \
--disable-nls \
--disable-werror \
--enable-__cxa_atexit \
--enable-cld \
--enable-languages=c,c++ \
--enable-shared \
--enable-target-optspace \
......@@ -53,8 +67,8 @@ build ()
--with-arch=i486 \
--with-system-zlib
make || return 1;
make -j1 DESTDIR="${pkgdir}" install || return 1;
make || return 1
make -j1 DESTDIR="${pkgdir}" install || return 1
}
gpp() {
......@@ -76,4 +90,7 @@ f0c6c419318537505ec2717a139a091b 00_all_gcc-4.0-cvs-incompat.patch
3cb2148075e818f09c34718725f335d9 01_all_gcc-4.0.2-v9.0.0-start_endfile-boundschecking-no.patch
1c6294b95f13a59ed7cbf7be2dde7804 01_all_gcc-4.3.1-crtbeginTS-stuff.patch
019522a38f2e25b6a820766402ff2ee4 02_all_gcc-4.3.1-v10.0.1-start_endfile.patch
cff2e73a8455bfa844dcdd9c229b0875 gcc-4.2.0-cc1-no-stack-protector.patch"
15e77082db0e1a131af98debd3016290 gcc4-stack-protector-uclibc-no_tls.patch
cff2e73a8455bfa844dcdd9c229b0875 gcc-4.2.0-cc1-no-stack-protector.patch
a7d9c722d1ae2f216948a8718f11e24e gcc-4.3.2-default-ssp-pie.patch
2db1e3482c5dd59dab70f701afa2ca80 pt_gnu_eh_frame.patch"
--- gcc-4.3.2.orig/gcc/common.opt Tue Jan 22 14:11:44 2008
+++ gcc-4.3.2/gcc/common.opt Tue Nov 18 10:00:49 2008
@@ -147,7 +147,7 @@
Warn when one local variable shadows another
Wstack-protector
-Common Var(warn_stack_protect) Warning
+Common Var(warn_stack_protect) Warning Init(1)
Warn when not issuing stack smashing protection for some reason
Wstrict-aliasing
@@ -766,7 +766,7 @@
Generate position-independent code if possible (large mode)
fPIE
-Common Report Var(flag_pie,2)
+Common Report Var(flag_pie,2) Init(2)
Generate position-independent code for executables if possible (large mode)
fpic
@@ -978,7 +978,7 @@
Use propolice as a stack protection method
fstack-protector-all
-Common Report RejectNegative Var(flag_stack_protect, 2) VarExists
+Common Report RejectNegative Var(flag_stack_protect, 2) init(2)
Use a stack protection method for every function
fstrength-reduce
diff -u gcc/config/i386/linux.h gcc/config/i386/linux.h
--- a/gcc/config/i386/linux.h 2 Jul 2005 08:52:20 -0000 1.60
+++ b/gcc/config/i386/linux.h 2 Jul 2005 08:52:20 -0000 1.60
@@ -186,7 +186,7 @@
/* This macro may be overridden in i386/k*bsd-gnu.h. */
#define REG_NAME(reg) reg
-#ifdef TARGET_LIBC_PROVIDES_SSP
+#if defined TARGET_LIBC_PROVIDES_SSP && !defined __UCLIBC__
/* i386 glibc provides __stack_chk_guard in %gs:0x14. */
#define TARGET_THREAD_SSP_OFFSET 0x14
#endif
diff -u gcc/config/i386/linux64.h gcc/config/i386/linux64.h
--- a/gcc/config/i386/linux64.h 2 Jul 2005 08:52:20 -0000 1.33
+++ b/gcc/config/i386/linux64.h 2 Jul 2005 08:52:20 -0000 1.33
@@ -74,7 +74,7 @@
/* This macro may be overridden in i386/k*bsd-gnu.h. */
#define REG_NAME(reg) reg
-#ifdef TARGET_LIBC_PROVIDES_SSP
+#if defined TARGET_LIBC_PROVIDES_SSP && !defined __UCLIBC__
/* i386 glibc provides __stack_chk_guard in %gs:0x14,
x86_64 glibc provides it in %fs:0x28. */
#define TARGET_THREAD_SSP_OFFSET (TARGET_64BIT ? 0x28 : 0x14)
diff -u gcc/config/rs6000/linux.h gcc/config/rs6000/linux.h
--- a/gcc/config/rs6000/linux.h 2 Jul 2005 08:52:11 -0000 1.53
+++ b/gcc/config/rs6000/linux.h 2 Jul 2005 08:52:11 -0000 1.53
@@ -114,7 +114,7 @@
#define MD_UNWIND_SUPPORT "config/rs6000/linux-unwind.h"
-#ifdef TARGET_LIBC_PROVIDES_SSP
+#if defined TARGET_LIBC_PROVIDES_SSP && !defined __UCLIBC__
/* ppc32 glibc provides __stack_chk_guard in -0x7008(2). */
#define TARGET_THREAD_SSP_OFFSET -0x7008
#endif
diff -u gcc/config/rs6000/linux64.h gcc/config/rs6000/linux64.h
--- a/gcc/config/rs6000/linux64.h 2 Jul 2005 08:52:15 -0000 1.81
+++ b/gcc/config/rs6000/linux64.h 2 Jul 2005 08:52:15 -0000 1.81
@@ -548,7 +548,7 @@
#define MD_UNWIND_SUPPORT "config/rs6000/linux-unwind.h"
-#ifdef TARGET_LIBC_PROVIDES_SSP
+#if defined TARGET_LIBC_PROVIDES_SSP && !defined __UCLIBC__
/* ppc32 glibc provides __stack_chk_guard in -0x7008(2),
ppc64 glibc provides it at -0x7010(13). */
#define TARGET_THREAD_SSP_OFFSET (TARGET_64BIT ? -0x7010 : -0x7008)
diff -u gcc/config/s390/linux.h gcc/config/s390/linux.h
--- a/gcc/config/s390/linux.h 2005-08-22 15:53:01.000000000 +0200 1.40
+++ b/gcc/config/s390/linux.h 2005-08-22 15:53:01.000000000 +0200 1.40
@@ -94,7 +94,7 @@
#define MD_UNWIND_SUPPORT "config/s390/linux-unwind.h"
-#ifdef TARGET_LIBC_PROVIDES_SSP
+#if defined TARGET_LIBC_PROVIDES_SSP && !defined __UCLIBC__
/* s390 glibc provides __stack_chk_guard in 0x14(tp),
s390x glibc provides it at 0x28(tp). */
#define TARGET_THREAD_SSP_OFFSET (TARGET_64BIT ? 0x28 : 0x14)
diff -u gcc/config/sparc/linux.h gcc/config/sparc/linux.h
--- a/gcc/config/sparc/linux.h 6 Jul 2005 07:48:57 -0000 1.72
+++ b/gcc/config/sparc/linux.h 6 Jul 2005 07:48:57 -0000 1.72
@@ -230,7 +230,7 @@
#undef NEED_INDICATE_EXEC_STACK
#define NEED_INDICATE_EXEC_STACK 1
-#ifdef TARGET_LIBC_PROVIDES_SSP
+#if defined TARGET_LIBC_PROVIDES_SSP && !defined __UCLIBC__
/* sparc glibc provides __stack_chk_guard in [%g7 + 0x14]. */
#define TARGET_THREAD_SSP_OFFSET 0x14
#endif
diff -u gcc/config/sparc/linux64.h gcc/config/sparc/linux64.h
--- a/gcc/config/sparc/linux64.h 6 Jul 2005 07:48:57 -0000 1.95
+++ b/gcc/config/sparc/linux64.h 6 Jul 2005 07:48:57 -0000 1.95
@@ -364,7 +364,7 @@
#undef NEED_INDICATE_EXEC_STACK
#define NEED_INDICATE_EXEC_STACK 1
-#ifdef TARGET_LIBC_PROVIDES_SSP
+#if defined TARGET_LIBC_PROVIDES_SSP && !defined __UCLIBC__
/* sparc glibc provides __stack_chk_guard in [%g7 + 0x14],
sparc64 glibc provides it at [%g7 + 0x28]. */
#define TARGET_THREAD_SSP_OFFSET (TARGET_ARCH64 ? 0x28 : 0x14)
--- gcc-4.3.2/gcc/crtstuff.c.orig Mon Nov 17 16:02:38 2008
+++ gcc-4.3.2/gcc/crtstuff.c Mon Nov 17 16:02:52 2008
@@ -94,8 +94,7 @@
#include <link.h>
/* uClibc pretends to be glibc 2.2 and DT_CONFIG is defined in its link.h.
But it doesn't use PT_GNU_EH_FRAME ELF segment currently. */
-# if !defined(__UCLIBC__) \
- && (__GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ > 2) \
+# if (__GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ > 2) \
|| (__GLIBC__ == 2 && __GLIBC_MINOR__ == 2 && defined(DT_CONFIG)))
# define USE_PT_GNU_EH_FRAME
# endif
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment