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