1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/patches/gcc/4.4.4/280-freebsd.patch Thu Jul 15 22:34:31 2010 +0200
1.3 @@ -0,0 +1,96 @@
1.4 +diff -durN gcc-4.4.0.orig/gcc/config/freebsd-spec.h gcc-4.4.0/gcc/config/freebsd-spec.h
1.5 +
1.6 +diff -durN gcc-4.4.4.orig/gcc/config/freebsd-spec.h gcc-4.4.4/gcc/config/freebsd-spec.h
1.7 +--- gcc-4.4.4.orig/gcc/config/freebsd-spec.h 2009-04-10 01:23:07.000000000 +0200
1.8 ++++ gcc-4.4.4/gcc/config/freebsd-spec.h 2010-05-16 19:36:15.000000000 +0200
1.9 +@@ -61,6 +61,8 @@
1.10 + builtin_assert ("system=unix"); \
1.11 + builtin_assert ("system=bsd"); \
1.12 + builtin_assert ("system=FreeBSD"); \
1.13 ++ if(!(flag_iso && (c_dialect_cxx () ? cxx_dialect == cxx98 : !flag_isoc99))) \
1.14 ++ builtin_define("_LONGLONG"); \
1.15 + FBSD_TARGET_CPU_CPP_BUILTINS(); \
1.16 + } \
1.17 + while (0)
1.18 +diff -durN gcc-4.4.4.orig/gcc/config/t-freebsd-eh gcc-4.4.4/gcc/config/t-freebsd-eh
1.19 +--- gcc-4.4.4.orig/gcc/config/t-freebsd-eh 1970-01-01 01:00:00.000000000 +0100
1.20 ++++ gcc-4.4.4/gcc/config/t-freebsd-eh 2010-05-16 19:36:15.000000000 +0200
1.21 +@@ -0,0 +1,4 @@
1.22 ++# Use unwind-dw2-fde-glibc
1.23 ++LIB2ADDEH = $(srcdir)/unwind-dw2.c $(srcdir)/unwind-dw2-fde-glibc.c \
1.24 ++ $(srcdir)/unwind-sjlj.c $(srcdir)/gthr-gnat.c $(srcdir)/unwind-c.c
1.25 ++LIB2ADDEHDEP = unwind.inc unwind-dw2-fde.h unwind-dw2-fde.c
1.26 +diff -durN gcc-4.4.4.orig/gcc/config.gcc gcc-4.4.4/gcc/config.gcc
1.27 +--- gcc-4.4.4.orig/gcc/config.gcc 2010-05-16 19:13:30.000000000 +0200
1.28 ++++ gcc-4.4.4/gcc/config.gcc 2010-05-16 19:36:15.000000000 +0200
1.29 +@@ -456,7 +456,7 @@
1.30 + # pleases around the provided core setting.
1.31 + gas=yes
1.32 + gnu_ld=yes
1.33 +- extra_parts="crtbegin.o crtend.o crtbeginS.o crtendS.o"
1.34 ++ extra_parts="crtbegin.o crtend.o crtbeginS.o crtendS.o crtbeginT.o"
1.35 + fbsd_major=`echo ${target} | sed -e 's/.*freebsd//g' | sed -e 's/\..*//g'`
1.36 + tm_defines="${tm_defines} FBSD_MAJOR=${fbsd_major}"
1.37 + tmake_file="t-slibgcc-elf-ver t-freebsd"
1.38 +@@ -1042,6 +1042,10 @@
1.39 + ;;
1.40 + i[34567]86-*-freebsd*)
1.41 + tm_file="${tm_file} i386/unix.h i386/att.h dbxelf.h elfos.h ${fbsd_tm_file} i386/freebsd.h"
1.42 ++ fbsd_major=`echo ${target} | sed -e 's/.*freebsd//g' | sed -e 's/\..*//g'`
1.43 ++ if test ${fbsd_major} -ge 7; then
1.44 ++ tmake_file="${tmake_file} t-freebsd-eh"
1.45 ++ fi
1.46 + ;;
1.47 + x86_64-*-freebsd*)
1.48 + tm_file="${tm_file} i386/unix.h i386/att.h dbxelf.h elfos.h ${fbsd_tm_file} i386/x86-64.h i386/freebsd.h i386/freebsd64.h"
1.49 +diff -durN gcc-4.4.4.orig/gcc/crtstuff.c gcc-4.4.4/gcc/crtstuff.c
1.50 +--- gcc-4.4.4.orig/gcc/crtstuff.c 2009-04-10 01:23:07.000000000 +0200
1.51 ++++ gcc-4.4.4/gcc/crtstuff.c 2010-05-16 19:36:15.000000000 +0200
1.52 +@@ -85,13 +85,15 @@
1.53 + && !defined(OBJECT_FORMAT_FLAT) \
1.54 + && defined(HAVE_LD_EH_FRAME_HDR) \
1.55 + && !defined(inhibit_libc) && !defined(CRTSTUFFT_O) \
1.56 +- && defined(__GLIBC__) && __GLIBC__ >= 2
1.57 ++ && ((defined(__GLIBC__) && __GLIBC__ >= 2) \
1.58 ++ || (defined(__FreeBSD_version) && __FreeBSD_version >= 700022))
1.59 + #include <link.h>
1.60 + /* uClibc pretends to be glibc 2.2 and DT_CONFIG is defined in its link.h.
1.61 + But it doesn't use PT_GNU_EH_FRAME ELF segment currently. */
1.62 + # if !defined(__UCLIBC__) \
1.63 +- && (__GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ > 2) \
1.64 +- || (__GLIBC__ == 2 && __GLIBC_MINOR__ == 2 && defined(DT_CONFIG)))
1.65 ++ || (__GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ > 2) \
1.66 ++ || (__GLIBC__ == 2 && __GLIBC_MINOR__ == 2 && defined(DT_CONFIG))) \
1.67 ++ || (__FreeBSD_version >= 700022)
1.68 + # define USE_PT_GNU_EH_FRAME
1.69 + # endif
1.70 + #endif
1.71 +diff -durN gcc-4.4.4.orig/gcc/unwind-dw2-fde-glibc.c gcc-4.4.4/gcc/unwind-dw2-fde-glibc.c
1.72 +--- gcc-4.4.4.orig/gcc/unwind-dw2-fde-glibc.c 2009-04-10 01:23:07.000000000 +0200
1.73 ++++ gcc-4.4.4/gcc/unwind-dw2-fde-glibc.c 2010-05-16 19:36:15.000000000 +0200
1.74 +@@ -46,8 +46,9 @@
1.75 + #include "gthr.h"
1.76 +
1.77 + #if !defined(inhibit_libc) && defined(HAVE_LD_EH_FRAME_HDR) \
1.78 +- && (__GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ > 2) \
1.79 +- || (__GLIBC__ == 2 && __GLIBC_MINOR__ == 2 && defined(DT_CONFIG)))
1.80 ++ && ((__GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ > 2) \
1.81 ++ || (__GLIBC__ == 2 && __GLIBC_MINOR__ == 2 && defined(DT_CONFIG))) \
1.82 ++ || (__FreeBSD_version >= 700022 ))
1.83 +
1.84 + #ifndef __RELOC_POINTER
1.85 + # define __RELOC_POINTER(ptr, base) ((ptr) + (base))
1.86 +@@ -63,6 +64,13 @@
1.87 + #define PT_GNU_EH_FRAME (PT_LOOS + 0x474e550)
1.88 + #endif
1.89 +
1.90 ++/* Support FreeBSD */
1.91 ++#ifndef ElfW
1.92 ++# ifdef __ElfN
1.93 ++# define ElfW __ElfN
1.94 ++# endif
1.95 ++#endif
1.96 ++
1.97 + struct unw_eh_callback_data
1.98 + {
1.99 + _Unwind_Ptr pc;