Index: lang/gcc/Makefile =================================================================== --- lang/gcc/Makefile +++ lang/gcc/Makefile @@ -31,7 +31,7 @@ DISTVERSION= ${PORTVERSION} GCC_VERSION= ${PORTVERSION:C/(.+)\.[0-9]{8}/\1/} SUFFIX= ${PORTVERSION:C/([0-9]+).([0-9]+).*/\1\2/} -ONLY_FOR_ARCHS= amd64 i386 powerpc powerpc64 sparc64 +ONLY_FOR_ARCHS= amd64 armv6 i386 powerpc powerpc64 sparc64 USES= gmake iconv libtool makeinfo perl5 tar:bzip2 USE_BINUTILS= yes USE_PERL5= build @@ -119,6 +119,10 @@ .endif CONFIGURE_ARGS+=--enable-languages=${LANGUAGES} +.if ${ARCH:Marm*} != "" +EXTRA_PATCHES+= ${FILESDIR}/arm-patch-gce +.endif + pre-everything:: @${ECHO_MSG} "Making GCC ${PORTVERSION} for ${CONFIGURE_TARGET} [${LANGUAGES}]" Index: lang/gcc/files/arm-patch-gce =================================================================== --- /dev/null +++ lang/gcc/files/arm-patch-gce @@ -0,0 +1,11 @@ +--- gcc/dce.c ++++ gcc/dce.c +@@ -1198,7 +1198,7 @@ run_fast_dce (void) + static bool + gate_fast_dce (void) + { +- return optimize > 0 && flag_dce ++ return optimize > 1 && flag_dce + && dbg_cnt (dce_fast); + } + Index: lang/gcc/files/patch-arm-support =================================================================== --- /dev/null +++ lang/gcc/files/patch-arm-support @@ -0,0 +1,229 @@ +--- gcc/config.gcc ++++ gcc/config.gcc +@@ -267,7 +267,6 @@ case ${target} in + arm*-wince-pe* \ + | arm*-*-ecos-elf \ + | arm*-*-elf \ +- | arm*-*-freebsd* \ + | arm*-*-linux* \ + | arm*-*-uclinux* \ + | i[34567]86-go32-* \ +@@ -865,6 +864,26 @@ arm-wrs-vxworks) + extra_options="${extra_options} arm/vxworks.opt" + tmake_file="${tmake_file} arm/t-arm arm/t-vxworks" + ;; ++arm*-*-freebsd*) ++ tm_file="dbxelf.h elfos.h arm/elf.h arm/aout.h arm/bpabi.h ${tm_file} ${fbsd_tm_file} arm/freebsd.h" ++ tmake_file="${tmake_file} arm/t-arm arm/t-bpabi" ++ case $target in ++ armv6*-*-freebsd*) ++ tm_defines="${tm_defines} TARGET_FREEBSD_ARMv6=1" ++ ;; ++ esac ++ case $target in ++ arm*hf-*-freebsd*) ++ tm_defines="${tm_defines} TARGET_FREEBSD_ARM_HARD_FLOAT=1" ++ ;; ++ esac ++ # The BPABI long long divmod functions return a 128-bit value in ++ # registers r0-r3. Correctly modeling that requires the use of ++ # TImode. ++ need_64bit_hwint=yes ++ # The EABI requires the use of __cxa_atexit. ++ default_use_cxa_atexit=yes ++ ;; + arm*-*-netbsdelf*) + tm_file="dbxelf.h elfos.h netbsd.h netbsd-elf.h arm/elf.h arm/aout.h ${tm_file} arm/netbsd-elf.h" + extra_options="${extra_options} netbsd.opt netbsd-elf.opt" +--- gcc/config.host ++++ gcc/config.host +@@ -99,7 +99,7 @@ case ${host} in + esac + + case ${host} in +- arm*-*-linux*) ++ arm*-*-freebsd* | arm*-*-linux*) + case ${target} in + arm*-*-*) + host_extra_gcc_objs="driver-arm.o" +--- gcc/config/arm/arm.c ++++ gcc/config/arm/arm.c +@@ -2062,6 +2062,8 @@ arm_option_override (void) + warning (0, "target CPU does not support unaligned accesses"); + unaligned_access = 0; + } ++ /* Force this off for now */ ++ unaligned_access = 0; + + if (TARGET_THUMB1 && flag_schedule_insns) + { +--- /dev/null ++++ gcc/config/arm/freebsd.h +@@ -0,0 +1,89 @@ ++/* Configuration file for ARM FreeBSD EABI targets. ++ Copyright (C) 2004-2013 Free Software Foundation, Inc. ++ ++ This file is part of GCC. ++ ++ GCC is free software; you can redistribute it and/or modify it ++ under the terms of the GNU General Public License as published ++ by the Free Software Foundation; either version 3, or (at your ++ option) any later version. ++ ++ GCC is distributed in the hope that it will be useful, but WITHOUT ++ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY ++ or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public ++ License for more details. ++ ++ You should have received a copy of the GNU General Public License ++ along with GCC; see the file COPYING3. If not see ++ . */ ++ ++#undef TARGET_DEFAULT_FLOAT_ABI ++#ifdef TARGET_FREEBSD_ARM_HARD_FLOAT ++#define TARGET_DEFAULT_FLOAT_ABI ARM_FLOAT_ABI_HARD ++#else ++#define TARGET_DEFAULT_FLOAT_ABI ARM_FLOAT_ABI_SOFT ++#endif ++ ++/* We default to the "aapcs-linux" ABI so that enums are int-sized by ++ default. */ ++#undef ARM_DEFAULT_ABI ++#define ARM_DEFAULT_ABI ARM_ABI_AAPCS_LINUX ++ ++#undef SUBTARGET_CPU_DEFAULT ++#ifdef TARGET_FREEBSD_ARMv6 ++#define SUBTARGET_CPU_DEFAULT TARGET_CPU_arm1176jzs ++#else ++#define SUBTARGET_CPU_DEFAULT TARGET_CPU_arm9 ++#endif ++ ++/* Clear the instruction cache from `BEG' to `END'. This makes a ++ call to the ARM_SYNC_ICACHE architecture specific syscall. */ ++#define CLEAR_INSN_CACHE(BEG, END) \ ++do \ ++ { \ ++ extern int sysarch(int number, void *args); \ ++ struct \ ++ { \ ++ unsigned int addr; \ ++ int len; \ ++ } s; \ ++ s.addr = (unsigned int)(BEG); \ ++ s.len = (END) - (BEG); \ ++ (void) sysarch (0, &s); \ ++ } \ ++while (0) ++ ++#if 0 ++/* arm.h clears this */ ++#undef SUBTARGET_CPP_SPEC ++#define SUBTARGET_CPP_SPEC FBSD_CPP_SPEC ++#endif ++ ++#undef SUBTARGET_EXTRA_ASM_SPEC ++#define SUBTARGET_EXTRA_ASM_SPEC \ ++ "%{mabi=apcs-gnu|mabi=atpcs:-meabi=gnu;:-meabi=5}" TARGET_FIX_V4BX_SPEC \ ++ "%{fpic|fpie:-k} %{fPIC|fPIE:-k}" ++ ++#undef SUBTARGET_EXTRA_SPECS ++#define SUBTARGET_EXTRA_SPECS \ ++ { "subtarget_extra_asm_spec", SUBTARGET_EXTRA_ASM_SPEC }, \ ++ { "subtarget_asm_float_spec", SUBTARGET_ASM_FLOAT_SPEC }, \ ++ { "fbsd_dynamic_linker", FBSD_DYNAMIC_LINKER } ++ ++#undef LINK_SPEC ++#define LINK_SPEC " \ ++ %{p:%nconsider using `-pg' instead of `-p' with gprof(1) } \ ++ %{v:-V} \ ++ %{assert*} %{R*} %{rpath*} %{defsym*} \ ++ %{shared:-Bshareable %{h*} %{soname*}} \ ++ %{!shared: \ ++ %{!static: \ ++ %{rdynamic:-export-dynamic} \ ++ %{!dynamic-linker:-dynamic-linker %(fbsd_dynamic_linker) }} \ ++ %{static:-Bstatic}} \ ++ %{symbolic:-Bsymbolic} \ ++ -X %{mbig-endian:-EB} %{mlittle-endian:-EL}" ++ ++#undef FPUTYPE_DEFAULT ++#define FPUTYPE_DEFAULT "vfp" ++ +--- libatomic/configure.tgt ++++ libatomic/configure.tgt +@@ -33,8 +33,14 @@ case "${target_cpu}" in + + arm*) + ARCH=arm +- # ??? Detect when -march=armv7 is already enabled. +- try_ifunc=yes ++ case "${target}" in ++ arm*-*-freebsd*) ++ ;; ++ *) ++ # ??? Detect when -march=armv7 is already enabled. ++ try_ifunc=yes ++ ;; ++ esac + ;; + + sparc) +--- libcpp/configure ++++ libcpp/configure +@@ -7152,6 +7152,7 @@ fi + case $target in + aarch64*-*-* | \ + alpha*-*-* | \ ++ arm*-*-freebsd* | \ + arm*-*-*eabi* | \ + arm*-*-rtems* | \ + arm*-*-symbianelf* | \ +--- libgcc/config.host ++++ libgcc/config.host +@@ -319,6 +319,13 @@ arm-wrs-vxworks) + tmake_file="$tmake_file arm/t-arm arm/t-vxworks t-softfp-sfdf t-softfp-excl arm/t-softfp t-softfp" + extra_parts="$extra_parts crti.o crtn.o" + ;; ++arm*-*-freebsd*) ++ tmake_file="${tmake_file} arm/t-arm arm/t-elf t-fixedpoint-gnu-prefix" ++ tmake_file="${tmake_file} arm/t-bpabi arm/t-freebsd" ++ tm_file="$tm_file arm/bpabi-lib.h" ++ unwind_header=config/arm/unwind-arm.h ++ tmake_file="$tmake_file t-softfp-sfdf t-softfp-excl arm/t-softfp t-softfp" ++ ;; + arm*-*-netbsdelf*) + tmake_file="$tmake_file arm/t-arm arm/t-netbsd t-slibgcc-gld-nover" + ;; +--- /dev/null ++++ libgcc/config/arm/t-freebsd +@@ -0,0 +1,3 @@ ++# Use a version of div0 which raises SIGFPE. ++LIB1ASMFUNCS := $(filter-out _dvmd_tls,$(LIB1ASMFUNCS)) _dvmd_lnx ++ +--- libgcc/config/arm/unwind-arm.h ++++ libgcc/config/arm/unwind-arm.h +@@ -48,7 +48,8 @@ extern "C" { + if (!tmp) + return 0; + +-#if (defined(linux) && !defined(__uClinux__)) || defined(__NetBSD__) ++#if (defined(linux) && !defined(__uClinux__)) || defined(__NetBSD__) \ ++ || defined(__FreeBSD__) + /* Pc-relative indirect. */ + #define _GLIBCXX_OVERRIDE_TTYPE_ENCODING (DW_EH_PE_pcrel | DW_EH_PE_indirect) + tmp += ptr; +--- libstdc++-v3/configure.host ++++ libstdc++-v3/configure.host +@@ -353,6 +353,9 @@ case "${host}" in + ;; + esac + ;; ++ arm*-*-freebsd-*) ++ port_specific_symbol_files="\$(srcdir)/../config/os/gnu-linux/arm-eabi-extra.ver" ++ ;; + powerpc*-*-darwin*) + port_specific_symbol_files="\$(srcdir)/../config/os/bsd/darwin/ppc-extra.ver" + ;; +-- +2.1.0 +