head 1.9; access; symbols pkgsrc-2026Q1:1.9.0.88 pkgsrc-2026Q1-base:1.9 pkgsrc-2025Q4:1.9.0.86 pkgsrc-2025Q4-base:1.9 pkgsrc-2025Q3:1.9.0.84 pkgsrc-2025Q3-base:1.9 pkgsrc-2025Q2:1.9.0.82 pkgsrc-2025Q2-base:1.9 pkgsrc-2025Q1:1.9.0.80 pkgsrc-2025Q1-base:1.9 pkgsrc-2024Q4:1.9.0.78 pkgsrc-2024Q4-base:1.9 pkgsrc-2024Q3:1.9.0.76 pkgsrc-2024Q3-base:1.9 pkgsrc-2024Q2:1.9.0.74 pkgsrc-2024Q2-base:1.9 pkgsrc-2024Q1:1.9.0.72 pkgsrc-2024Q1-base:1.9 pkgsrc-2023Q4:1.9.0.70 pkgsrc-2023Q4-base:1.9 pkgsrc-2023Q3:1.9.0.68 pkgsrc-2023Q3-base:1.9 pkgsrc-2023Q2:1.9.0.66 pkgsrc-2023Q2-base:1.9 pkgsrc-2023Q1:1.9.0.64 pkgsrc-2023Q1-base:1.9 pkgsrc-2022Q4:1.9.0.62 pkgsrc-2022Q4-base:1.9 pkgsrc-2022Q3:1.9.0.60 pkgsrc-2022Q3-base:1.9 pkgsrc-2022Q2:1.9.0.58 pkgsrc-2022Q2-base:1.9 pkgsrc-2022Q1:1.9.0.56 pkgsrc-2022Q1-base:1.9 pkgsrc-2021Q4:1.9.0.54 pkgsrc-2021Q4-base:1.9 pkgsrc-2021Q3:1.9.0.52 pkgsrc-2021Q3-base:1.9 pkgsrc-2021Q2:1.9.0.50 pkgsrc-2021Q2-base:1.9 pkgsrc-2021Q1:1.9.0.48 pkgsrc-2021Q1-base:1.9 pkgsrc-2020Q4:1.9.0.46 pkgsrc-2020Q4-base:1.9 pkgsrc-2020Q3:1.9.0.44 pkgsrc-2020Q3-base:1.9 pkgsrc-2020Q2:1.9.0.40 pkgsrc-2020Q2-base:1.9 pkgsrc-2020Q1:1.9.0.20 pkgsrc-2020Q1-base:1.9 pkgsrc-2019Q4:1.9.0.42 pkgsrc-2019Q4-base:1.9 pkgsrc-2019Q3:1.9.0.38 pkgsrc-2019Q3-base:1.9 pkgsrc-2019Q2:1.9.0.36 pkgsrc-2019Q2-base:1.9 pkgsrc-2019Q1:1.9.0.34 pkgsrc-2019Q1-base:1.9 pkgsrc-2018Q4:1.9.0.32 pkgsrc-2018Q4-base:1.9 pkgsrc-2018Q3:1.9.0.30 pkgsrc-2018Q3-base:1.9 pkgsrc-2018Q2:1.9.0.28 pkgsrc-2018Q2-base:1.9 pkgsrc-2018Q1:1.9.0.26 pkgsrc-2018Q1-base:1.9 pkgsrc-2017Q4:1.9.0.24 pkgsrc-2017Q4-base:1.9 pkgsrc-2017Q3:1.9.0.22 pkgsrc-2017Q3-base:1.9 pkgsrc-2017Q2:1.9.0.18 pkgsrc-2017Q2-base:1.9 pkgsrc-2017Q1:1.9.0.16 pkgsrc-2017Q1-base:1.9 pkgsrc-2016Q4:1.9.0.14 pkgsrc-2016Q4-base:1.9 pkgsrc-2016Q3:1.9.0.12 pkgsrc-2016Q3-base:1.9 pkgsrc-2016Q2:1.9.0.10 pkgsrc-2016Q2-base:1.9 pkgsrc-2016Q1:1.9.0.8 pkgsrc-2016Q1-base:1.9 pkgsrc-2015Q4:1.9.0.6 pkgsrc-2015Q4-base:1.9 pkgsrc-2015Q3:1.9.0.4 pkgsrc-2015Q3-base:1.9 pkgsrc-2015Q2:1.9.0.2 pkgsrc-2015Q2-base:1.9 pkgsrc-2015Q1:1.8.0.8 pkgsrc-2015Q1-base:1.8 pkgsrc-2014Q4:1.8.0.6 pkgsrc-2014Q4-base:1.8 pkgsrc-2014Q3:1.8.0.4 pkgsrc-2014Q3-base:1.8 pkgsrc-2014Q2:1.8.0.2 pkgsrc-2014Q2-base:1.8 pkgsrc-2014Q1:1.5.0.8 pkgsrc-2014Q1-base:1.5 pkgsrc-2013Q4:1.5.0.6 pkgsrc-2013Q4-base:1.5 pkgsrc-2013Q3:1.5.0.4 pkgsrc-2013Q3-base:1.5 pkgsrc-2013Q2:1.5.0.2 pkgsrc-2013Q2-base:1.5 pkgsrc-2013Q1:1.4.0.4 pkgsrc-2013Q1-base:1.4 pkgsrc-2012Q4:1.4.0.2 pkgsrc-2012Q4-base:1.4 pkgsrc-2012Q3:1.3.0.2 pkgsrc-2012Q3-base:1.3; locks; strict; comment @# @; 1.9 date 2015.06.14.19.46.51; author marino; state Exp; branches; next 1.8; commitid i4MzQbttad2UYqpy; 1.8 date 2014.05.13.08.18.04; author marino; state Exp; branches; next 1.7; commitid XdLxngfsFVtTVlAx; 1.7 date 2014.05.09.09.50.47; author marino; state Exp; branches; next 1.6; commitid Oy5437kz9RaFzQzx; 1.6 date 2014.04.30.16.24.39; author marino; state Exp; branches; next 1.5; commitid iQlusHIUi1LI2Jyx; 1.5 date 2013.04.12.15.40.54; author marino; state Exp; branches; next 1.4; 1.4 date 2012.10.01.17.26.52; author marino; state Exp; branches; next 1.3; 1.3 date 2012.08.03.08.53.57; author marino; state Exp; branches; next 1.2; 1.2 date 2012.07.14.21.53.05; author marino; state Exp; branches; next 1.1; 1.1 date 2012.07.08.19.30.38; author marino; state Exp; branches; next ; desc @@ 1.9 log @lang/gcc-aux: various fixes, remove NLS option This update is a by-product of working on new package, gcc5-aux, and applying those concepts here. Several changes were made, including: - Version date was not updated when version changed from 4.9.0 => 4.9.2 (revbump occurred instead). Remove revbump and fix date - Remove DragonFly-i386 from permitted platforms. This platform will be completely unsupported when DragonFly 4.2 is released (very soon) - Remove references to OpenBSD and MirBSD. Support was never activated due to technical issues and likely will not happen. - Reindent (cosmetic) - It is seemingly impossible to work around NetBSD's binary compatibility scheme (e.g. __socket30, __nanosleep50). These weak symbols are simply ignored by Ada's pragma Import and no c-tricks seem to avoid conflicts. (Why can't NetBSD use symbol versioning???) Anyway, having NetBSD- specific copies of source files to handle a couple of symbol differences is simply not sustainable, so move to a new scheme where these are replaced on the fly. By the way, this problem basically means that I cannot fix GNAT upstream, even if I found somebody to sponsor getting the NUMEROUS non-ada patches upstream. GCC devs would laugh at me if I describe why I want to introduce so many new but similar files to support NetBSD. So it's very likely never going to happen. - Disable libitm and libcilkrts by default. They are out of scope and not worth building / fixing. - Apparently NLS support doesn't build on NetBSD 6.1? Nobody reported this to me, but there are linking issues. I'm just removing the option (which was on by default) until further notice. Having NLS support on by default was questionable anyway. - Remove exetim mods, this was wrong (for all BSD platforms) - Android support leaked in, but it's not used here - The diff-ada file dropped about 150k in size, and could have been more had the android osinte file been masked too. @ text @--- gcc/DEV-PHASE.orig +++ gcc/DEV-PHASE @@@@ -0,0 +1 @@@@ +release --- /dev/null +++ gcc/config/dragonfly-stdint.h @@@@ -0,0 +1,56 @@@@ +/* Definitions for types for DragonFly systems. + Copyright (C) 2009 Free Software Foundation, Inc. + Contributed by Gerald Pfeifer . + +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. + +Under Section 7 of GPL version 3, you are granted additional +permissions described in the GCC Runtime Library Exception, version +3.1, as published by the Free Software Foundation. + +You should have received a copy of the GNU General Public License and +a copy of the GCC Runtime Library Exception along with this program; +see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +. */ + +#define SIG_ATOMIC_TYPE "int" + +#define INT8_TYPE "signed char" +#define INT16_TYPE "short int" +#define INT32_TYPE "int" +#define INT64_TYPE (LONG_TYPE_SIZE == 64 ? "long int" : "long long int") +#define UINT8_TYPE "unsigned char" +#define UINT16_TYPE "short unsigned int" +#define UINT32_TYPE "unsigned int" +#define UINT64_TYPE (LONG_TYPE_SIZE == 64 ? "long unsigned int" : "long long unsigned int") + +#define INT_LEAST8_TYPE INT8_TYPE +#define INT_LEAST16_TYPE INT16_TYPE +#define INT_LEAST32_TYPE INT32_TYPE +#define INT_LEAST64_TYPE INT64_TYPE +#define UINT_LEAST8_TYPE UINT8_TYPE +#define UINT_LEAST16_TYPE UINT16_TYPE +#define UINT_LEAST32_TYPE UINT32_TYPE +#define UINT_LEAST64_TYPE UINT64_TYPE + +#define INT_FAST8_TYPE INT32_TYPE +#define INT_FAST16_TYPE INT32_TYPE +#define INT_FAST32_TYPE INT32_TYPE +#define INT_FAST64_TYPE INT64_TYPE +#define UINT_FAST8_TYPE UINT32_TYPE +#define UINT_FAST16_TYPE UINT32_TYPE +#define UINT_FAST32_TYPE UINT32_TYPE +#define UINT_FAST64_TYPE UINT64_TYPE + +#define INTPTR_TYPE (LONG_TYPE_SIZE == 64 ? INT64_TYPE : INT32_TYPE) +#define UINTPTR_TYPE (LONG_TYPE_SIZE == 64 ? UINT64_TYPE : UINT32_TYPE) --- /dev/null +++ gcc/config/dragonfly.h @@@@ -0,0 +1,136 @@@@ +/* Base configuration file for all DragonFly targets. + Copyright (C) 1999, 2000, 2001, 2007, 2008 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 +. */ + +/* Common DragonFly configuration. + All DragonFly architectures should include this file, which will specify + their commonalities. + Adapted from gcc/config/i386/freebsd-elf.h by + David O'Brien . + Further work by David O'Brien and + Loren J. Rittle . */ + +#undef TARGET_OS_CPP_BUILTINS +#define TARGET_OS_CPP_BUILTINS() \ + do \ + { \ + builtin_define_std ("unix"); \ + builtin_define ("__DragonFly__"); \ + builtin_assert ("system=unix"); \ + builtin_assert ("system=bsd"); \ + builtin_assert ("system=DragonFly"); \ + } \ + while (0) + +#undef CPP_SPEC +#define CPP_SPEC \ + "%(cpp_cpu) %(cpp_arch) %{posix:-D_POSIX_SOURCE}" + +#undef STARTFILE_SPEC +#define STARTFILE_SPEC \ + "%{!shared: \ + %{pg:gcrt1.o%s} \ + %{!pg: \ + %{p:gcrt1.o%s} \ + %{!p: \ + %{profile: gcrt1.o%s} \ + %{!profile: \ + %{pie: Scrt1.o%s;:crt1.o%s}}}}} \ + crti.o%s \ + %{shared|pie:crtbeginS.o%s;:crtbegin.o%s}" + +#undef ENDFILE_SPEC +#define ENDFILE_SPEC \ + "%{shared|pie:crtendS.o%s;:crtend.o%s} crtn.o%s" + +#undef LIB_SPEC +#define LIB_SPEC \ + "%{pthread:-lpthread} -lc" + +#if defined(HAVE_LD_EH_FRAME_HDR) +#define LINK_EH_SPEC "--eh-frame-hdr" +#endif + +/* Provide a LINK_SPEC appropriate for DragonFly. Here we provide support + for the special GCC options -static and -shared, which allow us to + link things in one of these three modes by applying the appropriate + combinations of options at link-time. + + When the -shared link option is used a final link is not being + done. */ + +#define DFBSD_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 %(dfbsd_dynamic_linker) \ + } \ + %{static:-Bstatic} \ + } \ + %{!static:--hash-style=gnu -rpath @@PREFIX@@/gcc-aux/lib} \ + %{symbolic:-Bsymbolic}" + +#undef LINK_SPEC +#define LINK_SPEC DFBSD_LINK_SPEC + +#define DFBSD_DYNAMIC_LINKER "/usr/libexec/ld-elf.so.2" + + +/* Use --as-needed -lgcc_s for eh support. */ +#ifdef HAVE_LD_AS_NEEDED +#define USE_LD_AS_NEEDED 1 +#endif + +/************************[ Target stuff ]***********************************/ + +/* All DragonFly Architectures support the ELF object file format. */ +#undef OBJECT_FORMAT_ELF +#define OBJECT_FORMAT_ELF + +/* Don't assume anything about the header files. */ +#undef NO_IMPLICIT_EXTERN_C +#define NO_IMPLICIT_EXTERN_C 1 + +/* Follow DragonFly's standard headers (, etc...). */ + +#undef WCHAR_TYPE +#define WCHAR_TYPE "int" + +#undef WINT_TYPE +#define WINT_TYPE "int" + +/* + * Profile libraries are found at /usr/lib/profile with standard names + * #define MATH_LIBRARY_PROFILE "m_p" + */ + +/* Code generation parameters. */ + +/* Use periods rather than dollar signs in special g++ assembler names. + This ensures the configuration knows our system correctly so we can link + with libraries compiled with the native cc. */ +#undef NO_DOLLAR_IN_LABEL + +/* Used by libgcc2.c. We support file locking with fcntl / F_SETLKW. + This enables the test coverage code to use file locking when exiting a + program, which avoids race conditions if the program has forked. */ +#define TARGET_POSIX_IO --- /dev/null +++ gcc/config/dragonfly.opt @@@@ -0,0 +1,65 @@@@ +; DragonFlyBSD options. + +; Copyright (C) 2010, 2011 +; 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 +; . + +; See the GCC internals manual (options.texi) for a description of this file's format. + +; Please try to keep this file in ASCII collating order. + +assert +Driver Separate + +assert= +Driver JoinedOrMissing + +defsym +Driver Separate + +defsym= +Driver JoinedOrMissing + +posix +Driver + +profile +Driver + +pthread +Driver + +rdynamic +Driver + +rpath-link +Driver Separate + +rpath-link= +Driver JoinedOrMissing + +rpath= +Driver JoinedOrMissing + +soname +Driver Separate + +soname= +Driver JoinedOrMissing + +; This comment is to ensure we retain the blank line above. --- /dev/null +++ gcc/config/netbsd-stdint.h @@@@ -0,0 +1,56 @@@@ +/* Definitions for types for NetBSD systems. + Copyright (C) 2009 Free Software Foundation, Inc. + Contributed by Gerald Pfeifer . + +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. + +Under Section 7 of GPL version 3, you are granted additional +permissions described in the GCC Runtime Library Exception, version +3.1, as published by the Free Software Foundation. + +You should have received a copy of the GNU General Public License and +a copy of the GCC Runtime Library Exception along with this program; +see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +. */ + +#define SIG_ATOMIC_TYPE "int" + +#define INT8_TYPE "signed char" +#define INT16_TYPE "short int" +#define INT32_TYPE "int" +#define INT64_TYPE (LONG_TYPE_SIZE == 64 ? "long int" : "long long int") +#define UINT8_TYPE "unsigned char" +#define UINT16_TYPE "short unsigned int" +#define UINT32_TYPE "unsigned int" +#define UINT64_TYPE (LONG_TYPE_SIZE == 64 ? "long unsigned int" : "long long unsigned int") + +#define INT_LEAST8_TYPE "signed char" +#define INT_LEAST16_TYPE "short int" +#define INT_LEAST32_TYPE "int" +#define INT_LEAST64_TYPE (LONG_TYPE_SIZE == 64 ? "long int" : "long long int") +#define UINT_LEAST8_TYPE "unsigned char" +#define UINT_LEAST16_TYPE "short unsigned int" +#define UINT_LEAST32_TYPE "unsigned int" +#define UINT_LEAST64_TYPE (LONG_TYPE_SIZE == 64 ? "long unsigned int" : "long long unsigned int") + +#define INT_FAST8_TYPE "int" +#define INT_FAST16_TYPE "int" +#define INT_FAST32_TYPE "int" +#define INT_FAST64_TYPE (LONG_TYPE_SIZE == 64 ? "long int" : "long long int") +#define UINT_FAST8_TYPE "unsigned int" +#define UINT_FAST16_TYPE "unsigned int" +#define UINT_FAST32_TYPE "unsigned int" +#define UINT_FAST64_TYPE (LONG_TYPE_SIZE == 64 ? "long unsigned int" : "long long unsigned int") + +#define INTPTR_TYPE (LONG_TYPE_SIZE == 64 ? "long int" : "int") +#define UINTPTR_TYPE (LONG_TYPE_SIZE == 64 ? "long unsigned int" : "unsigned int") --- /dev/null +++ gcc/config/i386/dragonfly.h @@@@ -0,0 +1,105 @@@@ +/* Definitions for Intel 386 running DragonFly with ELF format + Copyright (C) 1996, 2000, 2002, 2004, 2007, 2010, 2011 + Free Software Foundation, Inc. + Contributed by Eric Youngdale. + Modified for stabs-in-ELF by H.J. Lu. + Adapted from GNU/Linux version by John Polstra. + Continued development by David O'Brien + +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 +. */ + + +/* Override the default comment-starter of "/". */ +#undef ASM_COMMENT_START +#define ASM_COMMENT_START "#" + +#undef ASM_APP_ON +#define ASM_APP_ON "#APP\n" + +#undef ASM_APP_OFF +#define ASM_APP_OFF "#NO_APP\n" + +#undef DBX_REGISTER_NUMBER +#define DBX_REGISTER_NUMBER(n) \ + (TARGET_64BIT ? dbx64_register_map[n] : svr4_dbx_register_map[n]) + +#undef NO_PROFILE_COUNTERS +#define NO_PROFILE_COUNTERS 1 + +/* Tell final.c that we don't need a label passed to mcount. */ + +#undef MCOUNT_NAME +#define MCOUNT_NAME ".mcount" + +/* Make gcc agree with . */ + +#undef SIZE_TYPE +#define SIZE_TYPE (TARGET_64BIT ? "long unsigned int" : "unsigned int") + +#undef PTRDIFF_TYPE +#define PTRDIFF_TYPE (TARGET_64BIT ? "long int" : "int") + +#undef WCHAR_TYPE_SIZE +#define WCHAR_TYPE_SIZE (TARGET_64BIT ? 32 : BITS_PER_WORD) + +#undef SUBTARGET_EXTRA_SPECS /* i386.h bogusly defines it. */ +#define SUBTARGET_EXTRA_SPECS \ + { "dfbsd_dynamic_linker", DFBSD_DYNAMIC_LINKER } + + +/* A C statement to output to the stdio stream FILE an assembler + command to advance the location counter to a multiple of 1< and std::numeric_limits correct. */ +#undef TARGET_96_ROUND_53_LONG_DOUBLE +#define TARGET_96_ROUND_53_LONG_DOUBLE (!TARGET_64BIT) + +/* Put all *tf routines in libgcc. */ +#undef LIBGCC2_HAS_TF_MODE +#define LIBGCC2_HAS_TF_MODE 1 +#define LIBGCC2_TF_CEXT q +#define TF_SIZE 113 + +/* Static stack checking is supported by means of probes. */ +#define STACK_CHECK_STATIC_BUILTIN 1 + +/* Support for i386 has been removed from DragonFly for several releases */ +#define SUBTARGET32_DEFAULT_CPU "i486" + +#define TARGET_ASM_FILE_END file_end_indicate_exec_stack + --- gcc/config/i386/freebsd.h.orig +++ gcc/config/i386/freebsd.h @@@@ -90,6 +90,14 @@@@ When the -shared link option is used a final link is not being done. */ +#if FBSD_MAJOR < 9 +#define ELF_HASH_STYLE "" +#elif FBSD_MAJOR < 10 +#define ELF_HASH_STYLE "--hash-style=both " +#else +#define ELF_HASH_STYLE "--hash-style=gnu " +#endif + #undef LINK_SPEC #define LINK_SPEC "\ %{p:%nconsider using '-pg' instead of '-p' with gprof(1)} \ @@@@ -101,6 +109,7 @@@@ %{rdynamic:-export-dynamic} \ -dynamic-linker %(fbsd_dynamic_linker) } \ %{static:-Bstatic}} \ + %{!static:" ELF_HASH_STYLE "-rpath @@PREFIX@@/gcc-aux/lib} \ %{symbolic:-Bsymbolic}" /* A C statement to output to the stdio stream FILE an assembler @@@@ -147,3 +156,5 @@@@ #define TARGET_ASM_FILE_END file_end_indicate_exec_stack +/* Compile in __enable_execute_stack (void *) (see config.host) */ +#define HAVE_ENABLE_EXECUTE_STACK --- gcc/config/i386/freebsd64.h.orig +++ gcc/config/i386/freebsd64.h @@@@ -41,4 +41,5 @@@@ %{rdynamic:-export-dynamic} \ -dynamic-linker %(fbsd_dynamic_linker) } \ %{static:-Bstatic}} \ + %{!static:" ELF_HASH_STYLE "-rpath @@PREFIX@@/gcc-aux/lib} \ %{symbolic:-Bsymbolic}" --- gcc/config/i386/netbsd-elf.h.orig +++ gcc/config/i386/netbsd-elf.h @@@@ -38,7 +38,8 @@@@ /* Provide a LINK_SPEC appropriate for a NetBSD/i386 ELF target. */ #undef LINK_SPEC -#define LINK_SPEC NETBSD_LINK_SPEC_ELF +#define LINK_SPEC NETBSD_LINK_SPEC_ELF \ +"%{!static:-rpath @@PREFIX@@/gcc-aux/lib}" #define NETBSD_ENTRY_POINT "__start" @@@@ -119,3 +120,9 @@@@ #define DEFAULT_PCC_STRUCT_RETURN 1 #define HAVE_ENABLE_EXECUTE_STACK +/* Define this to be nonzero if static stack checking is supported. */ +#define STACK_CHECK_STATIC_BUILTIN 1 + +#if defined(HAVE_LD_EH_FRAME_HDR) +#define LINK_EH_SPEC "%{!static:--eh-frame-hdr} " +#endif --- gcc/config/i386/netbsd64.h.orig +++ gcc/config/i386/netbsd64.h @@@@ -67,3 +67,10 @@@@ } #define HAVE_ENABLE_EXECUTE_STACK + +/* Define this to be nonzero if static stack checking is supported. */ +#define STACK_CHECK_STATIC_BUILTIN 1 + +#if defined(HAVE_LD_EH_FRAME_HDR) +#define LINK_EH_SPEC "%{!static:--eh-frame-hdr} " +#endif --- gcc/ginclude/stddef.h.orig +++ gcc/ginclude/stddef.h @@@@ -50,6 +50,11 @@@@ one less case to deal with in the following. */ #if defined (__BSD_NET2__) || defined (____386BSD____) || (defined (__FreeBSD__) && (__FreeBSD__ < 5)) || defined(__NetBSD__) #include +#if !defined(_MACHINE_ANSI_H_) +#if defined(_I386_ANSI_H_) || defined(_X86_64_ANSI_H_) +#define _MACHINE_ANSI_H_ +#endif +#endif #endif /* On FreeBSD 5, machine/ansi.h does not exist anymore... */ #if defined (__FreeBSD__) && (__FreeBSD__ >= 5) @@@@ -133,6 +138,7 @@@@ #ifndef _BSD_PTRDIFF_T_ #ifndef ___int_ptrdiff_t_h #ifndef _GCC_PTRDIFF_T +#ifndef _PTRDIFF_T_DECLARED /* DragonFly */ #define _PTRDIFF_T #define _T_PTRDIFF_ #define _T_PTRDIFF @@@@ -141,10 +147,12 @@@@ #define _BSD_PTRDIFF_T_ #define ___int_ptrdiff_t_h #define _GCC_PTRDIFF_T +#define _PTRDIFF_T_DECLARED #ifndef __PTRDIFF_TYPE__ #define __PTRDIFF_TYPE__ long int #endif typedef __PTRDIFF_TYPE__ ptrdiff_t; +#endif /* _PTRDIFF_T_DECLARED */ #endif /* _GCC_PTRDIFF_T */ #endif /* ___int_ptrdiff_t_h */ #endif /* _BSD_PTRDIFF_T_ */ @@@@ -198,6 +206,7 @@@@ #define _GCC_SIZE_T #define _SIZET_ #if (defined (__FreeBSD__) && (__FreeBSD__ >= 5)) \ + || defined(__DragonFly__) \ || defined(__FreeBSD_kernel__) /* __size_t is a typedef on FreeBSD 5, must not trash it. */ #elif defined (__VMS__) --- include/libiberty.h.orig +++ include/libiberty.h @@@@ -106,7 +106,16 @@@@ to find the declaration so provide a fully prototyped one. If it is 1, we found it so don't provide any declaration at all. */ #if !HAVE_DECL_BASENAME -#if defined (__GNU_LIBRARY__ ) || defined (__linux__) || defined (__FreeBSD__) || defined (__OpenBSD__) || defined(__NetBSD__) || defined (__CYGWIN__) || defined (__CYGWIN32__) || defined (__MINGW32__) || defined (HAVE_DECL_BASENAME) +#if defined (__GNU_LIBRARY__ ) \ + || defined (__linux__) \ + || defined (__DragonFly__) \ + || defined (__FreeBSD__) \ + || defined (__OpenBSD__) \ + || defined (__NetBSD__) \ + || defined (__CYGWIN__) \ + || defined (__CYGWIN32__) \ + || defined (__MINGW32__) \ + || defined (HAVE_DECL_BASENAME) extern char *basename (const char *) ATTRIBUTE_RETURNS_NONNULL ATTRIBUTE_NONNULL(1); #else /* Do not allow basename to be used if there is no prototype seen. We --- libgcc/crtstuff.c.orig +++ libgcc/crtstuff.c @@@@ -79,11 +79,19 @@@@ } #endif +#if defined(TARGET_DL_ITERATE_PHDR) && \ + ( defined(__FreeBSD__) \ + || defined(__OpenBSD__) \ + || defined(__NetBSD__) \ + || defined(__DragonFly__)) +#define BSD_DL_ITERATE_PHDR_AVAILABLE +#endif + #if defined(OBJECT_FORMAT_ELF) \ && !defined(OBJECT_FORMAT_FLAT) \ && defined(HAVE_LD_EH_FRAME_HDR) \ && !defined(inhibit_libc) && !defined(CRTSTUFFT_O) \ - && defined(__FreeBSD__) && __FreeBSD__ >= 7 + && defined(BSD_DL_ITERATE_PHDR_AVAILABLE) #include # define USE_PT_GNU_EH_FRAME #endif --- /dev/null +++ libgcc/enable-execute-stack-freebsd.c @@@@ -0,0 +1,58 @@@@ +/* Implement __enable_execute_stack using mprotect(2). + Copyright (C) 2011, 2012 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. + + Under Section 7 of GPL version 3, you are granted additional + permissions described in the GCC Runtime Library Exception, version + 3.1, as published by the Free Software Foundation. + + You should have received a copy of the GNU General Public License and + a copy of the GCC Runtime Library Exception along with this program; + see the files COPYING3 and COPYING.RUNTIME respectively. If not, see + . */ + +#include +#include +#include + +#define STACK_PROT_RWX (PROT_READ | PROT_WRITE | PROT_EXEC) + +extern void __enable_execute_stack (void *); + +void +__enable_execute_stack (void *addr) +{ + static int size; + static long mask; + char *page, *ends; + long page_addr, ends_addr; + + if (size == 0) + { + size = getpagesize (); + mask = ~((long) size - 1); + } + page_addr = (long) addr; + ends_addr = (long) (addr + __LIBGCC_TRAMPOLINE_SIZE__); + + page = (char *) (page_addr & mask); + ends = (char *) ((ends_addr & mask) + size); + + /* + * Note that no errors should be emitted by mprotect; it is considered + * dangerous for library calls to send messages to stdout/stderr. + */ + if (mprotect (page, ends - page, STACK_PROT_RWX) < 0) + abort (); +} --- libgcc/unwind-dw2-fde-dip.c.orig +++ libgcc/unwind-dw2-fde-dip.c @@@@ -58,11 +58,19 @@@@ #endif #if !defined(inhibit_libc) && defined(HAVE_LD_EH_FRAME_HDR) \ - && defined(__FreeBSD__) && __FreeBSD__ >= 7 + && defined(TARGET_DL_ITERATE_PHDR) \ + && (defined(__FreeBSD__) || defined(__DragonFly__)) # define ElfW __ElfN # define USE_PT_GNU_EH_FRAME #endif +#if !defined(inhibit_libc) && defined(HAVE_LD_EH_FRAME_HDR) \ + && defined(TARGET_DL_ITERATE_PHDR) \ + && (defined(__OpenBSD__) || defined(__NetBSD__)) +# define ElfW(n) Elf_##n +# define USE_PT_GNU_EH_FRAME +#endif + #if !defined(inhibit_libc) && defined(HAVE_LD_EH_FRAME_HDR) \ && defined(__OpenBSD__) # define ElfW(type) Elf_##type --- /dev/null +++ libgcc/config/i386/dragonfly-unwind.h @@@@ -0,0 +1,158 @@@@ +/* DWARF2 EH unwinding support for DragonFly BSD: AMD x86-64 and x86. + Copyright (C) 2010 John Marino */ + +/* Do code reading to identify a signal frame, and set the frame + state data appropriately. See unwind-dw2.c for the structs. */ + +#include +#include +#include +#include +#include + + +#define REG_NAME(reg) sf_uc.uc_mcontext.mc_## reg + +#ifdef __x86_64__ +#define MD_FALLBACK_FRAME_STATE_FOR x86_64_dragonfly_fallback_frame_state + + +static void +x86_64_sigtramp_range (unsigned char **start, unsigned char **end) +{ + unsigned long ps_strings; + int mib[2]; + size_t len; + + mib[0] = CTL_KERN; + mib[1] = KERN_PS_STRINGS; + len = sizeof (ps_strings); + sysctl (mib, 2, &ps_strings, &len, NULL, 0); + + *start = (unsigned char *)ps_strings - 32; + *end = (unsigned char *)ps_strings; +} + + +static _Unwind_Reason_Code +x86_64_dragonfly_fallback_frame_state +(struct _Unwind_Context *context, _Unwind_FrameState *fs) +{ + unsigned char *pc = context->ra; + unsigned char *sigtramp_start, *sigtramp_end; + struct sigframe *sf; + long new_cfa; + + x86_64_sigtramp_range(&sigtramp_start, &sigtramp_end); + if (pc >= sigtramp_end || pc < sigtramp_start) + return _URC_END_OF_STACK; + + sf = (struct sigframe *) context->cfa; + new_cfa = sf->REG_NAME(rsp); + fs->regs.cfa_how = CFA_REG_OFFSET; + /* Register 7 is rsp */ + fs->regs.cfa_reg = 7; + fs->regs.cfa_offset = new_cfa - (long) context->cfa; + + /* The SVR4 register numbering macros aren't usable in libgcc. */ + fs->regs.reg[0].how = REG_SAVED_OFFSET; + fs->regs.reg[0].loc.offset = (long)&sf->REG_NAME(rax) - new_cfa; + fs->regs.reg[1].how = REG_SAVED_OFFSET; + fs->regs.reg[1].loc.offset = (long)&sf->REG_NAME(rdx) - new_cfa; + fs->regs.reg[2].how = REG_SAVED_OFFSET; + fs->regs.reg[2].loc.offset = (long)&sf->REG_NAME(rcx) - new_cfa; + fs->regs.reg[3].how = REG_SAVED_OFFSET; + fs->regs.reg[3].loc.offset = (long)&sf->REG_NAME(rbx) - new_cfa; + fs->regs.reg[4].how = REG_SAVED_OFFSET; + fs->regs.reg[4].loc.offset = (long)&sf->REG_NAME(rsi) - new_cfa; + fs->regs.reg[5].how = REG_SAVED_OFFSET; + fs->regs.reg[5].loc.offset = (long)&sf->REG_NAME(rdi) - new_cfa; + fs->regs.reg[6].how = REG_SAVED_OFFSET; + fs->regs.reg[6].loc.offset = (long)&sf->REG_NAME(rbp) - new_cfa; + fs->regs.reg[8].how = REG_SAVED_OFFSET; + fs->regs.reg[8].loc.offset = (long)&sf->REG_NAME(r8) - new_cfa; + fs->regs.reg[9].how = REG_SAVED_OFFSET; + fs->regs.reg[9].loc.offset = (long)&sf->REG_NAME(r9) - new_cfa; + fs->regs.reg[10].how = REG_SAVED_OFFSET; + fs->regs.reg[10].loc.offset = (long)&sf->REG_NAME(r10) - new_cfa; + fs->regs.reg[11].how = REG_SAVED_OFFSET; + fs->regs.reg[11].loc.offset = (long)&sf->REG_NAME(r11) - new_cfa; + fs->regs.reg[12].how = REG_SAVED_OFFSET; + fs->regs.reg[12].loc.offset = (long)&sf->REG_NAME(r12) - new_cfa; + fs->regs.reg[13].how = REG_SAVED_OFFSET; + fs->regs.reg[13].loc.offset = (long)&sf->REG_NAME(r13) - new_cfa; + fs->regs.reg[14].how = REG_SAVED_OFFSET; + fs->regs.reg[14].loc.offset = (long)&sf->REG_NAME(r14) - new_cfa; + fs->regs.reg[15].how = REG_SAVED_OFFSET; + fs->regs.reg[15].loc.offset = (long)&sf->REG_NAME(r15) - new_cfa; + fs->regs.reg[16].how = REG_SAVED_OFFSET; + fs->regs.reg[16].loc.offset = (long)&sf->REG_NAME(rip) - new_cfa; + fs->retaddr_column = 16; + fs->signal_frame = 1; + return _URC_NO_REASON; +} + +#else /* Next section is for i386 */ + +#define MD_FALLBACK_FRAME_STATE_FOR x86_dragonfly_fallback_frame_state + + +static void +x86_sigtramp_range (unsigned char **start, unsigned char **end) +{ + unsigned long ps_strings; + int mib[2]; + size_t len; + + mib[0] = CTL_KERN; + mib[1] = KERN_PS_STRINGS; + len = sizeof (ps_strings); + sysctl (mib, 2, &ps_strings, &len, NULL, 0); + + *start = (unsigned char *)ps_strings - 128; + *end = (unsigned char *)ps_strings; +} + + +static _Unwind_Reason_Code +x86_dragonfly_fallback_frame_state +(struct _Unwind_Context *context, _Unwind_FrameState *fs) +{ + unsigned char *pc = context->ra; + unsigned char *sigtramp_start, *sigtramp_end; + struct sigframe *sf; + long new_cfa; + + x86_sigtramp_range(&sigtramp_start, &sigtramp_end); + + if (pc >= sigtramp_end || pc < sigtramp_start) + return _URC_END_OF_STACK; + + sf = (struct sigframe *) context->cfa; + new_cfa = sf->REG_NAME(esp); + fs->regs.cfa_how = CFA_REG_OFFSET; + fs->regs.cfa_reg = 4; + fs->regs.cfa_offset = new_cfa - (long) context->cfa; + + /* The SVR4 register numbering macros aren't usable in libgcc. */ + fs->regs.reg[0].how = REG_SAVED_OFFSET; + fs->regs.reg[0].loc.offset = (long)&sf->REG_NAME(eax) - new_cfa; + fs->regs.reg[3].how = REG_SAVED_OFFSET; + fs->regs.reg[3].loc.offset = (long)&sf->REG_NAME(ebx) - new_cfa; + fs->regs.reg[1].how = REG_SAVED_OFFSET; + fs->regs.reg[1].loc.offset = (long)&sf->REG_NAME(ecx) - new_cfa; + fs->regs.reg[2].how = REG_SAVED_OFFSET; + fs->regs.reg[2].loc.offset = (long)&sf->REG_NAME(edx) - new_cfa; + fs->regs.reg[6].how = REG_SAVED_OFFSET; + fs->regs.reg[6].loc.offset = (long)&sf->REG_NAME(esi) - new_cfa; + fs->regs.reg[7].how = REG_SAVED_OFFSET; + fs->regs.reg[7].loc.offset = (long)&sf->REG_NAME(edi) - new_cfa; + fs->regs.reg[5].how = REG_SAVED_OFFSET; + fs->regs.reg[5].loc.offset = (long)&sf->REG_NAME(ebp) - new_cfa; + fs->regs.reg[8].how = REG_SAVED_OFFSET; + fs->regs.reg[8].loc.offset = (long)&sf->REG_NAME(eip) - new_cfa; + fs->retaddr_column = 8; + fs->signal_frame = 1; + return _URC_NO_REASON; +} +#endif /* ifdef __x86_64__ */ --- /dev/null +++ libgcc/config/i386/freebsd-unwind.h @@@@ -0,0 +1,198 @@@@ +/* DWARF2 EH unwinding support for FreeBSD: AMD x86-64 and x86. + * Copyright (C) 2010, 2012, 2014 John Marino + * + * Do code reading to identify a signal frame, and set the frame + * state data appropriately. See unwind-dw2.c for the structs. + */ + +#include +#include +#include +#include + +#define REG_NAME(reg) sf_uc.uc_mcontext.mc_## reg + +#ifdef __x86_64__ +#define MD_FALLBACK_FRAME_STATE_FOR x86_64_freebsd_fallback_frame_state + +#if (__FreeBSD__ < 9) +#include +static void +x86_64_sigtramp_range (unsigned char **start, unsigned char **end) +{ + unsigned long ps_strings; + int mib[2]; + size_t len; + + mib[0] = CTL_KERN; + mib[1] = KERN_PS_STRINGS; + len = sizeof (ps_strings); + sysctl (mib, 2, &ps_strings, &len, NULL, 0); + + *start = (unsigned char *)ps_strings - 32; + *end = (unsigned char *)ps_strings; +} +#endif + + +static _Unwind_Reason_Code +x86_64_freebsd_fallback_frame_state +(struct _Unwind_Context *context, _Unwind_FrameState *fs) +{ + struct sigframe *sf; + long new_cfa; + +#if (__FreeBSD__ < 9) + unsigned char *pc = context->ra; + unsigned char *sigtramp_start, *sigtramp_end; + + x86_64_sigtramp_range(&sigtramp_start, &sigtramp_end); + if (pc >= sigtramp_end || pc < sigtramp_start) + return _URC_END_OF_STACK; +#else + /* Prior to FreeBSD 9, the signal trampoline was located immediately + before the ps_strings. To support non-executable stacks on AMD64, + the sigtramp was moved to a shared page for FreeBSD 9. We are + stuck looking for frame patterns again (sys/amd64/amd64/sigtramp.S): + + : lea 0x10(%rsp),%rdi + : pushq $0x0 + : mov $0x1a1,%rax + : syscall + + If we can't find this pattern, we're at the end of the stack. + */ + + if (!( *(unsigned int *)(context->ra) == 0x247c8d48 + && *(unsigned int *)(context->ra + 4) == 0x48006a10 + && *(unsigned int *)(context->ra + 8) == 0x01a1c0c7 + && *(unsigned int *)(context->ra + 12) == 0x050f0000 )) + return _URC_END_OF_STACK; +#endif + + sf = (struct sigframe *) context->cfa; + new_cfa = sf->REG_NAME(rsp); + fs->regs.cfa_how = CFA_REG_OFFSET; + /* Register 7 is rsp */ + fs->regs.cfa_reg = 7; + fs->regs.cfa_offset = new_cfa - (long) context->cfa; + + /* The SVR4 register numbering macros aren't usable in libgcc. */ + fs->regs.reg[0].how = REG_SAVED_OFFSET; + fs->regs.reg[0].loc.offset = (long)&sf->REG_NAME(rax) - new_cfa; + fs->regs.reg[1].how = REG_SAVED_OFFSET; + fs->regs.reg[1].loc.offset = (long)&sf->REG_NAME(rdx) - new_cfa; + fs->regs.reg[2].how = REG_SAVED_OFFSET; + fs->regs.reg[2].loc.offset = (long)&sf->REG_NAME(rcx) - new_cfa; + fs->regs.reg[3].how = REG_SAVED_OFFSET; + fs->regs.reg[3].loc.offset = (long)&sf->REG_NAME(rbx) - new_cfa; + fs->regs.reg[4].how = REG_SAVED_OFFSET; + fs->regs.reg[4].loc.offset = (long)&sf->REG_NAME(rsi) - new_cfa; + fs->regs.reg[5].how = REG_SAVED_OFFSET; + fs->regs.reg[5].loc.offset = (long)&sf->REG_NAME(rdi) - new_cfa; + fs->regs.reg[6].how = REG_SAVED_OFFSET; + fs->regs.reg[6].loc.offset = (long)&sf->REG_NAME(rbp) - new_cfa; + fs->regs.reg[8].how = REG_SAVED_OFFSET; + fs->regs.reg[8].loc.offset = (long)&sf->REG_NAME(r8) - new_cfa; + fs->regs.reg[9].how = REG_SAVED_OFFSET; + fs->regs.reg[9].loc.offset = (long)&sf->REG_NAME(r9) - new_cfa; + fs->regs.reg[10].how = REG_SAVED_OFFSET; + fs->regs.reg[10].loc.offset = (long)&sf->REG_NAME(r10) - new_cfa; + fs->regs.reg[11].how = REG_SAVED_OFFSET; + fs->regs.reg[11].loc.offset = (long)&sf->REG_NAME(r11) - new_cfa; + fs->regs.reg[12].how = REG_SAVED_OFFSET; + fs->regs.reg[12].loc.offset = (long)&sf->REG_NAME(r12) - new_cfa; + fs->regs.reg[13].how = REG_SAVED_OFFSET; + fs->regs.reg[13].loc.offset = (long)&sf->REG_NAME(r13) - new_cfa; + fs->regs.reg[14].how = REG_SAVED_OFFSET; + fs->regs.reg[14].loc.offset = (long)&sf->REG_NAME(r14) - new_cfa; + fs->regs.reg[15].how = REG_SAVED_OFFSET; + fs->regs.reg[15].loc.offset = (long)&sf->REG_NAME(r15) - new_cfa; + fs->regs.reg[16].how = REG_SAVED_OFFSET; + fs->regs.reg[16].loc.offset = (long)&sf->REG_NAME(rip) - new_cfa; + fs->retaddr_column = 16; + fs->signal_frame = 1; + return _URC_NO_REASON; +} + +#else /* Next section is for i386 */ + +#define MD_FALLBACK_FRAME_STATE_FOR x86_freebsd_fallback_frame_state + +/* + * We can't use KERN_PS_STRINGS anymore if we want to support FreeBSD32 + * compat on AMD64. The sigtramp is in a shared page in that case so the + * x86_sigtramp_range only works on a true i386 system. We have to + * search for the sigtramp frame if we want it working everywhere. + +#include +static void +x86_sigtramp_range (unsigned char **start, unsigned char **end) +{ + unsigned long ps_strings; + int mib[2]; + size_t len; + + mib[0] = CTL_KERN; + mib[1] = KERN_PS_STRINGS; + len = sizeof (ps_strings); + sysctl (mib, 2, &ps_strings, &len, NULL, 0); + + *start = (unsigned char *)ps_strings - 128; + *end = (unsigned char *)ps_strings; +} +*/ + + +static _Unwind_Reason_Code +x86_freebsd_fallback_frame_state +(struct _Unwind_Context *context, _Unwind_FrameState *fs) +{ + struct sigframe *sf; + long new_cfa; + +/* + * i386 sigtramp frame we are looking for follows. + * Apparently PSL_VM is variable, so we can't look past context->ra + 4 + * : + * 0: ff 54 24 10 call *0x10(%esp) *SIGF_HANDLER + * 4: 8d 44 24 20 lea 0x20(%esp),%eax SIGF_UC + * 8: 50 push %eax + * 9: f7 40 54 00 00 02 00 testl $0x20000,0x54(%eax) $PSL_VM + * 10: 75 03 jne 15 + * 12: 8e 68 14 mov 0x14(%eax),%gs UC_GS + * 15: b8 a1 01 00 00 mov 0x1a1,%eax $SYS_sigreturn + */ + + if (!( *(unsigned int *)(context->ra - 4) == 0x102454ff + && *(unsigned int *)(context->ra) == 0x2024448d )) + return _URC_END_OF_STACK; + + sf = (struct sigframe *) context->cfa; + new_cfa = sf->REG_NAME(esp); + fs->regs.cfa_how = CFA_REG_OFFSET; + fs->regs.cfa_reg = 4; + fs->regs.cfa_offset = new_cfa - (long) context->cfa; + + /* The SVR4 register numbering macros aren't usable in libgcc. */ + fs->regs.reg[0].how = REG_SAVED_OFFSET; + fs->regs.reg[0].loc.offset = (long)&sf->REG_NAME(eax) - new_cfa; + fs->regs.reg[3].how = REG_SAVED_OFFSET; + fs->regs.reg[3].loc.offset = (long)&sf->REG_NAME(ebx) - new_cfa; + fs->regs.reg[1].how = REG_SAVED_OFFSET; + fs->regs.reg[1].loc.offset = (long)&sf->REG_NAME(ecx) - new_cfa; + fs->regs.reg[2].how = REG_SAVED_OFFSET; + fs->regs.reg[2].loc.offset = (long)&sf->REG_NAME(edx) - new_cfa; + fs->regs.reg[6].how = REG_SAVED_OFFSET; + fs->regs.reg[6].loc.offset = (long)&sf->REG_NAME(esi) - new_cfa; + fs->regs.reg[7].how = REG_SAVED_OFFSET; + fs->regs.reg[7].loc.offset = (long)&sf->REG_NAME(edi) - new_cfa; + fs->regs.reg[5].how = REG_SAVED_OFFSET; + fs->regs.reg[5].loc.offset = (long)&sf->REG_NAME(ebp) - new_cfa; + fs->regs.reg[8].how = REG_SAVED_OFFSET; + fs->regs.reg[8].loc.offset = (long)&sf->REG_NAME(eip) - new_cfa; + fs->retaddr_column = 8; + fs->signal_frame = 1; + return _URC_NO_REASON; +} +#endif /* ifdef __x86_64__ */ --- /dev/null +++ libgcc/config/i386/netbsd-unwind.h @@@@ -0,0 +1,169 @@@@ +/* DWARF2 EH unwinding support for x86 NetBSD + Copyright (C) 2010 John Marino (www.dragonlace.net) */ + +/* Do code reading to identify a signal frame, and set the frame + state data appropriately. See unwind-dw2.c for the structs. */ + +#include +#include + +#define REG_NAME(reg) sf_uc.uc_mcontext.__gregs[_REG_## reg] + +#ifdef __x86_64__ + + + + +#define MD_FALLBACK_FRAME_STATE_FOR x86_64_netbsd_fallback_frame_state + +static _Unwind_Reason_Code +x86_64_netbsd_fallback_frame_state +(struct _Unwind_Context *context, _Unwind_FrameState *fs) +{ + /* signal_frame is sigframe_siginfo minus sf_ra handler return address */ + struct signal_frame { + siginfo_t sf_si; /* actual saved siginfo */ + ucontext_t sf_uc; /* actual saved ucontext */ + }; + struct signal_frame *sf; + long new_cfa; + + /* We are looking for the following signal trampoline pattern. If we don't + find it, we are at the end of the stack and can't unwind. + + <__sigtramp_siginfo_2+12>: mov $0xffffffffffffffff,%rdi + <__sigtramp_siginfo_2+19>: mov $0x1,%rax + <__sigtramp_siginfo_2+26>: syscall + */ + + if ( *(unsigned int *) (context->ra + 12) == 0xffc7c748 + && *(unsigned int *) (context->ra + 16) == 0x48ffffff + && *(unsigned int *) (context->ra + 20) == 0x0001c0c7 + && *(unsigned int *) (context->ra + 24) == 0x050f0000 ) + { + sf = (struct signal_frame *) context->cfa; + new_cfa = sf->REG_NAME(RSP); + fs->regs.cfa_how = CFA_REG_OFFSET; + fs->regs.cfa_reg = 7; + fs->regs.cfa_offset = new_cfa - (long) context->cfa; + } + else + { + return _URC_END_OF_STACK; + } + + /* The SVR4 register numbering macros aren't usable in libgcc. */ + fs->regs.reg[ 0].how = REG_SAVED_OFFSET; + fs->regs.reg[ 0].loc.offset = (long)&sf->REG_NAME(RAX) - new_cfa; + fs->regs.reg[ 1].how = REG_SAVED_OFFSET; + fs->regs.reg[ 1].loc.offset = (long)&sf->REG_NAME(RDX) - new_cfa; + fs->regs.reg[ 2].how = REG_SAVED_OFFSET; + fs->regs.reg[ 2].loc.offset = (long)&sf->REG_NAME(RCX) - new_cfa; + fs->regs.reg[ 3].how = REG_SAVED_OFFSET; + fs->regs.reg[ 3].loc.offset = (long)&sf->REG_NAME(RBX) - new_cfa; + fs->regs.reg[ 4].how = REG_SAVED_OFFSET; + fs->regs.reg[ 4].loc.offset = (long)&sf->REG_NAME(RSI) - new_cfa; + fs->regs.reg[ 5].how = REG_SAVED_OFFSET; + fs->regs.reg[ 5].loc.offset = (long)&sf->REG_NAME(RDI) - new_cfa; + fs->regs.reg[ 6].how = REG_SAVED_OFFSET; + fs->regs.reg[ 6].loc.offset = (long)&sf->REG_NAME(RBP) - new_cfa; + fs->regs.reg[ 8].how = REG_SAVED_OFFSET; + fs->regs.reg[ 8].loc.offset = (long)&sf->REG_NAME(R8) - new_cfa; + fs->regs.reg[ 9].how = REG_SAVED_OFFSET; + fs->regs.reg[ 9].loc.offset = (long)&sf->REG_NAME(R9) - new_cfa; + fs->regs.reg[10].how = REG_SAVED_OFFSET; + fs->regs.reg[10].loc.offset = (long)&sf->REG_NAME(R10) - new_cfa; + fs->regs.reg[11].how = REG_SAVED_OFFSET; + fs->regs.reg[11].loc.offset = (long)&sf->REG_NAME(R11) - new_cfa; + fs->regs.reg[12].how = REG_SAVED_OFFSET; + fs->regs.reg[12].loc.offset = (long)&sf->REG_NAME(R12) - new_cfa; + fs->regs.reg[13].how = REG_SAVED_OFFSET; + fs->regs.reg[13].loc.offset = (long)&sf->REG_NAME(R13) - new_cfa; + fs->regs.reg[14].how = REG_SAVED_OFFSET; + fs->regs.reg[14].loc.offset = (long)&sf->REG_NAME(R14) - new_cfa; + fs->regs.reg[15].how = REG_SAVED_OFFSET; + fs->regs.reg[15].loc.offset = (long)&sf->REG_NAME(R15) - new_cfa; + fs->regs.reg[16].how = REG_SAVED_OFFSET; + fs->regs.reg[16].loc.offset = (long)&sf->REG_NAME(RIP) - new_cfa; + fs->retaddr_column = 16; + fs->signal_frame = 1; + return _URC_NO_REASON; +} + + + + +#else /* Next section is for i386 */ + + + + +#define MD_FALLBACK_FRAME_STATE_FOR x86_netbsd_fallback_frame_state + +static _Unwind_Reason_Code +x86_netbsd_fallback_frame_state +(struct _Unwind_Context *context, _Unwind_FrameState *fs) +{ + /* signal_frame is sigframe_siginfo minus sf_ra handler return address */ + struct signal_frame { + int sf_signum; /* "signum" argument for handler" */ + siginfo_t *sf_sip; /* "sip" argument for handler" */ + ucontext_t *sf_ucp; /* "ucp" argument for handler" */ + siginfo_t sf_si; /* actual saved siginfo */ + ucontext_t sf_uc; /* actual saved ucontext */ + }; + struct signal_frame *sf; + long new_cfa; + + /* We are looking for the following signal trampoline pattern. If we don't + find it, we are at the end of the stack and can't unwind. + + <__sigtramp_siginfo_2+18>: movl $0xffffffff,0x4(%esp) + <__sigtramp_siginfo_2+26>: mov $0x1,%eax + <__sigtramp_siginfo_2+31>: int $0x80 + */ + + if ( *(unsigned int *) (context->ra + 18) == 0x042444c7 + && *(unsigned int *) (context->ra + 22) == 0xffffffff + && *(unsigned char *) (context->ra + 26) == 0xb8 + && *(unsigned int *) (context->ra + 27) == 0x00000001 + && *(unsigned short *) (context->ra + 31) == 0x80cd ) + { + sf = (struct signal_frame *) context->cfa; + new_cfa = sf->REG_NAME(ESP); + fs->regs.cfa_how = CFA_REG_OFFSET; + fs->regs.cfa_reg = 4; + fs->regs.cfa_offset = new_cfa - (long) context->cfa; + } + else + { + return _URC_END_OF_STACK; + } + + /* The SVR4 register numbering macros aren't usable in libgcc. */ + fs->regs.reg[0].how = REG_SAVED_OFFSET; + fs->regs.reg[0].loc.offset = (long)&sf->REG_NAME(EAX) - new_cfa; + fs->regs.reg[3].how = REG_SAVED_OFFSET; + fs->regs.reg[3].loc.offset = (long)&sf->REG_NAME(EBX) - new_cfa; + fs->regs.reg[1].how = REG_SAVED_OFFSET; + fs->regs.reg[1].loc.offset = (long)&sf->REG_NAME(ECX) - new_cfa; + fs->regs.reg[2].how = REG_SAVED_OFFSET; + fs->regs.reg[2].loc.offset = (long)&sf->REG_NAME(EDX) - new_cfa; + fs->regs.reg[6].how = REG_SAVED_OFFSET; + fs->regs.reg[6].loc.offset = (long)&sf->REG_NAME(ESI) - new_cfa; + fs->regs.reg[7].how = REG_SAVED_OFFSET; + fs->regs.reg[7].loc.offset = (long)&sf->REG_NAME(EDI) - new_cfa; + fs->regs.reg[5].how = REG_SAVED_OFFSET; + fs->regs.reg[5].loc.offset = (long)&sf->REG_NAME(EBP) - new_cfa; + fs->regs.reg[8].how = REG_SAVED_OFFSET; + fs->regs.reg[8].loc.offset = (long)&sf->REG_NAME(EIP) - new_cfa; + fs->retaddr_column = 8; + fs->signal_frame = 1; + return _URC_NO_REASON; +} + + + + +#endif /* ifdef __x86_64__ */ + --- libiberty/getpagesize.c.orig +++ libiberty/getpagesize.c @@@@ -20,6 +20,7 @@@@ */ +#ifndef __ANDROID__ #ifndef VMS #include "config.h" @@@@ -88,3 +89,4 @@@@ } #endif /* VMS */ +#endif /* __ANDROID__ */ --- libiberty/setproctitle.c.orig +++ libiberty/setproctitle.c @@@@ -40,9 +40,11 @@@@ void setproctitle (const char *name ATTRIBUTE_UNUSED, ...) { +#ifndef __ANDROID__ #ifdef PR_SET_NAME /* On GNU/Linux this sets the top visible "comm", but not necessarily the name visible in ps. */ prctl (PR_SET_NAME, name); #endif +#endif } --- gcc/config.gcc.orig +++ gcc/config.gcc @@@@ -687,6 +687,26 @@@@ # need_64bit_hwint=yes # system compiler has this for all arch! use_gcc_stdint=wrap ;; +*-*-dragonfly*) + gas=yes + gnu_ld=yes + tmake_file="t-slibgcc" + case ${enable_threads} in + "" | yes | posix) + thread_file='posix' + ;; + no | gnat | single) + # Let these non-posix thread selections fall through if requested + ;; + *) + echo 'Unknown thread configuration for DragonFly BSD' + exit 1 + ;; + esac + extra_options="$extra_options rpath.opt dragonfly.opt" + default_use_cxa_atexit=yes + use_gcc_stdint=wrap + ;; *-*-linux* | frv-*-*linux* | *-*-kfreebsd*-gnu | *-*-knetbsd*-gnu | *-*-gnu* | *-*-kopensolaris*-gnu) extra_options="$extra_options gnu-user.opt" gas=yes @@@@ -743,6 +763,7 @@@@ target_has_targetcm=yes ;; *-*-netbsd*) + use_gcc_stdint=wrap tmake_file="t-slibgcc" gas=yes gnu_ld=yes @@@@ -1357,6 +1378,14 @@@@ tm_file="${tm_file} i386/unix.h i386/att.h dbxelf.h elfos.h newlib-stdint.h i386/i386elf.h i386/x86-64.h i386/rdos.h i386/rdos64.h" tmake_file="i386/t-i386elf t-svr4" ;; +i[34567]86-*-dragonfly*) + tm_file="${tm_file} i386/unix.h i386/att.h dbxelf.h elfos.h dragonfly.h dragonfly-stdint.h i386/dragonfly.h" + tmake_file="${tmake_file} i386/t-crtstuff" + ;; +x86_64-*-dragonfly*) + tm_file="${tm_file} i386/unix.h i386/att.h dbxelf.h elfos.h dragonfly.h dragonfly-stdint.h i386/x86-64.h i386/dragonfly.h" + tmake_file="${tmake_file} i386/t-crtstuff" + ;; i[34567]86-*-freebsd*) tm_file="${tm_file} i386/unix.h i386/att.h dbxelf.h elfos.h ${fbsd_tm_file} i386/freebsd.h" ;; @@@@ -1364,12 +1393,14 @@@@ 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" ;; i[34567]86-*-netbsdelf*) - tm_file="${tm_file} i386/unix.h i386/att.h dbxelf.h elfos.h netbsd.h netbsd-elf.h i386/netbsd-elf.h" + tm_file="${tm_file} i386/unix.h i386/att.h dbxelf.h elfos.h netbsd.h netbsd-elf.h i386/netbsd-elf.h netbsd-stdint.h" extra_options="${extra_options} netbsd.opt netbsd-elf.opt" + tmake_file="${tmake_file} i386/t-crtstuff" ;; x86_64-*-netbsd*) - tm_file="${tm_file} i386/unix.h i386/att.h dbxelf.h elfos.h netbsd.h netbsd-elf.h i386/x86-64.h i386/netbsd64.h" + tm_file="${tm_file} i386/unix.h i386/att.h dbxelf.h elfos.h netbsd.h netbsd-elf.h i386/x86-64.h i386/netbsd64.h netbsd-stdint.h" extra_options="${extra_options} netbsd.opt netbsd-elf.opt" + tmake_file="${tmake_file} i386/t-crtstuff" ;; i[34567]86-*-openbsd2.*|i[34567]86-*openbsd3.[0123]) tm_file="i386/i386.h i386/unix.h i386/bsd.h i386/gas.h i386/gstabs.h openbsd-oldgas.h openbsd.h i386/openbsd.h" @@@@ -1380,6 +1411,7 @@@@ use_collect2=yes ;; i[34567]86-*-openbsd*) + tm_defines="${tm_defines} PIE_DEFAULT=1" tm_file="${tm_file} i386/unix.h i386/att.h dbxelf.h elfos.h" tm_file="${tm_file} openbsd.h openbsd-stdint.h openbsd-libpthread.h i386/openbsdelf.h" extra_options="${extra_options} openbsd.opt" @@@@ -1387,6 +1419,7 @@@@ gnu_ld=yes ;; x86_64-*-openbsd*) + tm_defines="${tm_defines} PIE_DEFAULT=1" tm_file="${tm_file} i386/unix.h i386/att.h dbxelf.h elfos.h" tm_file="${tm_file} openbsd.h openbsd-stdint.h openbsd-libpthread.h i386/x86-64.h i386/openbsdelf.h" extra_options="${extra_options} openbsd.opt" @@@@ -2935,6 +2968,12 @@@@ arch_without_sse2=yes arch_without_64bit=yes ;; + i386-*-openbsd*) + arch=i486 + cpu=generic + arch_without_sse2=yes + arch_without_64bit=yes + ;; i386-*-*) arch=i386 cpu=i386 @@@@ -4114,6 +4153,8 @@@@ ;; i[34567]86-*-mingw* | x86_64-*-mingw*) ;; + i[34567]86-*-dragonfly* | x86_64-*-dragonfly*) + ;; i[34567]86-*-freebsd* | x86_64-*-freebsd*) ;; ia64*-*-linux*) --- gcc/configure.orig +++ gcc/configure @@@@ -27477,6 +27477,20 @@@@ gcc_cv_target_dl_iterate_phdr=no fi ;; + *-*-dragonfly* | *-*-freebsd*) + if grep dl_iterate_phdr $target_header_dir/sys/link_elf.h > /dev/null 2>&1; then + gcc_cv_target_dl_iterate_phdr=yes + else + gcc_cv_target_dl_iterate_phdr=no + fi + ;; + *-*-netbsd*) + if grep dl_iterate_phdr $target_header_dir/link_elf.h > /dev/null 2>&1; then + gcc_cv_target_dl_iterate_phdr=yes + else + gcc_cv_target_dl_iterate_phdr=no + fi + ;; esac if test x$gcc_cv_target_dl_iterate_phdr = xyes; then --- gcc/Makefile.in.orig +++ gcc/Makefile.in @@@@ -1152,7 +1152,6 @@@@ insn-emit.o \ insn-extract.o \ insn-latencytab.o \ - insn-modes.o \ insn-opinit.o \ insn-output.o \ insn-peep.o \ @@@@ -1487,13 +1486,18 @@@@ ALL_HOST_BACKEND_OBJS = $(GCC_OBJS) $(OBJS) $(OBJS-libcommon) \ $(OBJS-libcommon-target) @@TREEBROWSER@@ main.o c-family/cppspec.o \ $(COLLECT2_OBJS) $(EXTRA_GCC_OBJS) $(GCOV_OBJS) $(GCOV_DUMP_OBJS) \ - lto-wrapper.o + insn-modes.o insn-modes-ada.o lto-wrapper.o # This lists all host object files, whether they are included in this # compilation or not. ALL_HOST_OBJS = $(ALL_HOST_FRONTEND_OBJS) $(ALL_HOST_BACKEND_OBJS) BACKEND = libbackend.a main.o @@TREEBROWSER@@ libcommon-target.a libcommon.a \ + insn-modes.o \ + $(CPPLIB) $(LIBDECNUMBER) + +BACKEND2 = libbackend.a main.o @@TREEBROWSER@@ libcommon-target.a libcommon.a \ + insn-modes-ada.o \ $(CPPLIB) $(LIBDECNUMBER) # This is defined to "yes" if Tree checking is enabled, which roughly means @@@@ -2124,6 +2128,7 @@@@ insn-modes.c: s-modes; @@true insn-modes.h: s-modes-h; @@true +insn-modes-ada.c: s-modes-ada; @@true min-insn-modes.c: s-modes-m; @@true s-modes: build/genmodes$(build_exeext) @@@@ -2141,6 +2146,12 @@@@ $(SHELL) $(srcdir)/../move-if-change tmp-min-modes.c min-insn-modes.c $(STAMP) s-modes-m +s-modes-ada: s-modes + $(shell sed -e 's/: TARGET_96_ROUND_53_LONG_DOUBLE \? &ieee_extended_intel_96_round_53_format //' \ + < insn-modes.c > tmp-modes-ada.c) + $(SHELL) $(srcdir)/../move-if-change tmp-modes-ada.c insn-modes-ada.c + $(STAMP) s-modes-ada + insn-preds.c: s-preds; @@true tm-preds.h: s-preds-h; @@true tm-constrs.h: s-constrs-h; @@true @@@@ -3219,6 +3230,9 @@@@ ( cd $(DESTDIR)$(bindir) && \ $(LN) $(GCC_INSTALL_NAME)$(exeext) $(target_noncanonical)-gcc-$(version)$(exeext) ); \ fi + -if [ -f gnat1$(exeext) ] ; then \ + ( cd $(DESTDIR)$(bindir) && $(LN) $(GCC_INSTALL_NAME)$(exeext) ada$(exeext) ) \ + fi -if [ ! -f gcc-cross$(exeext) ] \ && [ "$(GCC_INSTALL_NAME)" != "$(GCC_TARGET_INSTALL_NAME)" ]; then \ rm -f $(DESTDIR)$(bindir)/$(target_noncanonical)-gcc-tmp$(exeext); \ --- libgcc/config.host.orig +++ libgcc/config.host @@@@ -207,6 +207,11 @@@@ tmake_file="$tmake_file t-darwin ${cpu_type}/t-darwin t-libgcc-pic t-slibgcc-darwin" extra_parts="crt3.o crttms.o crttme.o" ;; +*-*-dragonfly*) + tmake_file="$tmake_file t-crtstuff-pic t-libgcc-pic t-eh-dw2-dip" + tmake_file="$tmake_file t-slibgcc t-slibgcc-gld t-slibgcc-elf-ver" + extra_parts="crtbegin.o crtend.o crtbeginS.o crtendS.o" + ;; *-*-freebsd*) # This is the generic ELF configuration of FreeBSD. Later # machine-specific sections may refine and add to this @@@@ -238,7 +243,8 @@@@ extra_parts="crtbegin.o crtbeginS.o crtend.o crtendS.o" ;; *-*-netbsd*) - tmake_file="$tmake_file t-crtstuff-pic t-libgcc-pic t-slibgcc t-slibgcc-gld t-slibgcc-elf-ver" + tmake_file="$tmake_file t-crtstuff-pic t-libgcc-pic t-eh-dw2-dip" + tmake_file="$tmake_file t-slibgcc t-slibgcc-gld t-slibgcc-elf-ver" # NetBSD 1.7 and later are set up to use GCC's crtstuff for # ELF configurations. We will clear extra_parts in the # a.out configurations. @@@@ -302,7 +308,10 @@@@ esac case ${host} in -*-*-darwin* | *-*-freebsd* | *-*-netbsd* | *-*-openbsd* | *-*-solaris2*) +*-*-dragonfly* | *-*-freebsd* | *-*-netbsd* | *-*-openbsd*) + enable_execute_stack=enable-execute-stack-freebsd.c + ;; +*-*-darwin* | *-*-solaris2*) enable_execute_stack=enable-execute-stack-mprotect.c ;; i[34567]86-*-mingw* | x86_64-*-mingw*) @@@@ -545,16 +554,29 @@@@ x86_64-*-elf*) tmake_file="$tmake_file i386/t-crtstuff t-crtstuff-pic t-libgcc-pic" ;; +i[34567]86-*-dragonfly*) + tmake_file="${tmake_file} i386/t-dragonfly i386/t-crtstuff" + md_unwind_header=i386/dragonfly-unwind.h + ;; +x86_64-*-dragonfly*) + tmake_file="${tmake_file} i386/t-dragonfly i386/t-crtstuff" + md_unwind_header=i386/dragonfly-unwind.h + ;; i[34567]86-*-freebsd*) tmake_file="${tmake_file} i386/t-freebsd i386/t-crtstuff" + md_unwind_header=i386/freebsd-unwind.h ;; x86_64-*-freebsd*) tmake_file="${tmake_file} i386/t-freebsd i386/t-crtstuff" + md_unwind_header=i386/freebsd-unwind.h ;; i[34567]86-*-netbsdelf*) + tmake_file="${tmake_file} i386/t-crtstuff" + md_unwind_header=i386/netbsd-unwind.h ;; x86_64-*-netbsd*) tmake_file="${tmake_file} i386/t-crtstuff" + md_unwind_header=i386/netbsd-unwind.h ;; i[34567]86-*-openbsd2.*|i[34567]86-*openbsd3.[0123]) ;; @@@@ -1262,6 +1284,7 @@@@ i[34567]86-*-solaris2* | x86_64-*-solaris2.1[0-9]* | \ i[34567]86-*-cygwin* | x86_64-*-cygwin* | \ i[34567]86-*-mingw* | x86_64-*-mingw* | \ + i[34567]86-*-dragonfly* | x86_64-*-dragonfly* | \ i[34567]86-*-freebsd* | x86_64-*-freebsd* | \ i[34567]86-*-openbsd* | x86_64-*-openbsd*) tmake_file="${tmake_file} t-softfp-tf" --- libcilkrts/runtime/os-unix.c.orig +++ libcilkrts/runtime/os-unix.c @@@@ -56,6 +56,12 @@@@ // Uses sysconf(_SC_NPROCESSORS_ONLN) in verbose output #elif defined __FreeBSD__ // No additional include files +#elif defined __DragonFly__ +// No additional include files +#elif defined __NetBSD__ +// No additional include files +#elif defined __OpenBSD__ +// No additional include files #elif defined __CYGWIN__ // Cygwin on Windows - no additional include files #elif defined __VXWORKS__ @@@@ -374,7 +380,8 @@@@ assert((unsigned)count == count); return count; -#elif defined __FreeBSD__ || defined __CYGWIN__ +#elif defined __FreeBSD__ || defined __CYGWIN__ || defined __DragonFly__ \ + || defined __NetBSD__ || defined __OpenBSD__ int ncores = sysconf(_SC_NPROCESSORS_ONLN); return ncores; @@@@ -402,6 +409,12 @@@@ // On MacOS, call sched_yield to yield quantum. I'm not sure why we // don't do this on Linux also. sched_yield(); +#elif defined(__DragonFly__) + sched_yield(); +#elif defined(__NetBSD__) + sched_yield(); +#elif defined(__OpenBSD__) + sched_yield(); #elif defined(__MIC__) // On MIC, pthread_yield() really trashes things. Arch's measurements // showed that calling _mm_delay_32() (or doing nothing) was a better --- libitm/configure.tgt.orig +++ libitm/configure.tgt @@@@ -139,6 +139,7 @@@@ ;; *-*-gnu* | *-*-k*bsd*-gnu \ + | *-*-dragonfly* \ | *-*-netbsd* | *-*-freebsd* | *-*-openbsd* \ | *-*-solaris2* | *-*-sysv4* | *-*-hpux11* \ | *-*-darwin* | *-*-aix*) @ 1.8 log @lang/gcc-aux: Enable dl_iterate_phdr and link with gold These changes are for NetBSD only although non-functional OpenBSD support continues to be added. The biggest change is configuring the compiler to use the gold linker from binutils 2.24 instead of the system linker. The ld.bfd linker from binutils 2.24 is buggy on NetBSD and OpenBSD; it cannot properly produce/recognize PIC files in every case, which is why gcc-aux had been limited to the system linker. The system linker was too old for gcc-aux and devel/gps failed to link because of it. At the same time, the dormant dl_iterate_phdr support has been activated for NetBSD. It seems to work; the Ada testsuite still passes perfectly. Due to lack of testing, gold is restricted from building on NetBSD 5, which means lang/gcc-aux will fail to build as a result. If someone verifies gold builds on NetBSD 5, then the restriction on binutils can be removed and lang/gcc-aux will be able to build on NetBSD 5 again. @ text @a329 56 --- gcc/config/openbsd-libpthread.h.orig +++ gcc/config/openbsd-libpthread.h @@@@ -18,5 +18,5 @@@@ along with GCC; see the file COPYING3. If not see . */ -#define OBSD_LIB_SPEC "%{!shared:%{pthread:-lpthread} -lc}" +#define OBSD_LIB_SPEC "%{pthread:-lpthread%{!shared:%{p|pg:_p}}} %{!shared:-lc%{p:_p}%{!p:%{pg:_p}}}" --- gcc/config/openbsd.h.orig +++ gcc/config/openbsd.h @@@@ -108,9 +108,9 @@@@ This two-stage defines makes it easy to pick that for targets that have subspecs. */ #ifdef CPP_CPU_SPEC -#define OBSD_CPP_SPEC "%(cpp_cpu) %{posix:-D_POSIX_SOURCE} %{pthread:-D_POSIX_THREADS}" +#define OBSD_CPP_SPEC "%(cpp_cpu) %{posix:-D_POSIX_SOURCE} %{pthread:-D_REENTRANT}" #else -#define OBSD_CPP_SPEC "%{posix:-D_POSIX_SOURCE} %{pthread:-D_POSIX_THREADS}" +#define OBSD_CPP_SPEC "%{posix:-D_POSIX_SOURCE} %{pthread:-D_REENTRANT}" #endif #undef LIB_SPEC @@@@ -143,6 +143,9 @@@@ #define LIB_SPEC OBSD_LIB_SPEC #endif +#undef LINK_PIE_SPEC +#define LINK_PIE_SPEC "%{pie:-pie} %{p|pg|nopie:-nopie} " + #define TARGET_POSIX_IO /* All new versions of OpenBSD have C99 functions. We redefine this hook @@@@ -285,5 +288,12 @@@@ /* Storage layout. */ +/* Silence "unsafe GNU crap" messages */ +#define NO_UNSAFE_BUILTINS + +/* The system headers on OpenBSD are C++-aware. */ +#undef NO_IMPLICIT_EXTERN_C +#define NO_IMPLICIT_EXTERN_C + #define HAVE_ENABLE_EXECUTE_STACK --- gcc/config/openbsd.opt.orig +++ gcc/config/openbsd.opt @@@@ -32,4 +32,7 @@@@ pthread Driver +rdynamic +Driver + ; This comment is to ensure we retain the blank line above. a511 40 --- gcc/config/i386/openbsd.h.orig +++ gcc/config/i386/openbsd.h @@@@ -38,10 +38,10 @@@@ /* This must agree with */ #undef SIZE_TYPE -#define SIZE_TYPE "unsigned int" +#define SIZE_TYPE "long unsigned int" #undef PTRDIFF_TYPE -#define PTRDIFF_TYPE "int" +#define PTRDIFF_TYPE "long int" #undef WCHAR_TYPE #define WCHAR_TYPE "int" @@@@ -49,6 +49,9 @@@@ #undef WCHAR_TYPE_SIZE #define WCHAR_TYPE_SIZE 32 +#undef WINT_TYPE +#define WINT_TYPE "int" + /* Assembler format: overall framework. */ #undef ASM_APP_ON --- gcc/config/i386/openbsdelf.h.orig +++ gcc/config/i386/openbsdelf.h @@@@ -97,9 +97,12 @@@@ %{shared:-shared} %{R*} \ %{static:-Bstatic} \ %{!static:-Bdynamic} \ + %{rdynamic:-export-dynamic} \ %{assert*} \ -dynamic-linker /usr/libexec/ld.so" +#define SUBTARGET32_DEFAULT_CPU "i486" + #undef STARTFILE_SPEC #define STARTFILE_SPEC "\ %{!shared: %{pg:gcrt0%O%s} %{!pg:%{p:gcrt0%O%s} %{!p:crt0%O%s}} \ a1244 54 --- gcc/builtins.c.orig +++ gcc/builtins.c @@@@ -125,9 +125,11 @@@@ static rtx expand_builtin_mempcpy (tree, rtx, enum machine_mode); static rtx expand_builtin_mempcpy_args (tree, tree, tree, rtx, enum machine_mode, int); +#ifndef NO_UNSAFE_BUILTINS static rtx expand_builtin_strcpy (tree, rtx); static rtx expand_builtin_strcpy_args (tree, tree, rtx); static rtx expand_builtin_stpcpy (tree, rtx, enum machine_mode); +#endif static rtx expand_builtin_strncpy (tree, rtx); static rtx builtin_memset_gen_str (void *, HOST_WIDE_INT, enum machine_mode); static rtx expand_builtin_memset (tree, rtx, enum machine_mode); @@@@ -3370,6 +3372,7 @@@@ # define CODE_FOR_movstr CODE_FOR_nothing #endif +#ifndef NO_UNSAFE_BUILTINS /* Expand into a movstr instruction, if one is available. Return NULL_RTX if we failed, the caller should emit a normal call, otherwise try to get the result in TARGET, if convenient. If ENDP is 0 return the @@@@ -3521,6 +3524,7 @@@@ return expand_movstr (dst, src, target, /*endp=*/2); } } +#endif /* Callback routine for store_by_pieces. Read GET_MODE_BITSIZE (MODE) bytes from constant string DATA + OFFSET and return it as target @@@@ -6140,9 +6144,11 @@@@ break; case BUILT_IN_STRCPY: +#ifndef NO_UNSAFE_BUILTINS target = expand_builtin_strcpy (exp, target); if (target) return target; +#endif break; case BUILT_IN_STRNCPY: @@@@ -6152,9 +6158,11 @@@@ break; case BUILT_IN_STPCPY: +#ifndef NO_UNSAFE_BUILTINS target = expand_builtin_stpcpy (exp, target, mode); if (target) return target; +#endif break; case BUILT_IN_MEMCPY: d1282 1 a1282 1 @@@@ -1352,6 +1373,14 @@@@ d1297 1 a1297 1 @@@@ -1359,12 +1388,14 @@@@ d1314 1 a1314 1 @@@@ -1375,6 +1406,7 @@@@ d1322 1 a1322 1 @@@@ -1382,6 +1414,7 @@@@ d1330 1 a1330 1 @@@@ -2927,6 +2960,12 @@@@ d1343 1 a1343 1 @@@@ -4109,6 +4148,8 @@@@ d1354 1 a1354 1 @@@@ -27421,6 +27421,20 @@@@ d1426 1 a1426 1 @@@@ -3217,6 +3228,9 @@@@ d1550 1 a1550 1 @@@@ -138,6 +138,7 @@@@ @ 1.7 log @lang/gcc-aux: Primarily add Solaris i386 and x86_64 targets I was never able to build gcc-aux with multilib support when it was based on gcc 4.7. It turns out that this is because Ada support for multilib was broken per GCC's bugzilla. It's been fixed since. After some significant effort and many hours, I finally produced a multilib bootstrap for Solaris. It can produce other multilib compilers (x86-64) and it can produce 32-bit only compilers (i386). This was tested on a stock OmniOS x86-64 installation and the Joyent dev area (i386). Solaris has not supported static linking since Solaris 9, so it is not possible to create a static bootstrap like the BSDs have, nor is it possible to build the compiler statically, so that option is disabled. That means it is unlikely that the bootstrap will run on Solaris 10 or Solaris 11, but this theory has not been tested. Much of the changes to the diff-* patchsets are a result of OpenBSD work. An OpenBSD static bootstrap has been created against devel/binutils, and as a result it fails to find system libraries such as libc and libm. That is a side note explaining the OpenBSD additions. There are some DragonFly and NetBSD changes in the diff-* patches though. The bootstrap target was significantly modified, mainly to capture the special needs of creating a Solaris bootstrap. The creation of the bootstrap tarball was put in it's own target. The zlib and math libraries were connected to the bootstrap option. It's not a good idea to use system zlib on Illumos because the zlib header is not guaranteed to be installed. The feature to rebuild the compiler with the installed gcc-aux was fixed; it should use it's own c++ compiler instead of the system c++ compiler. OpenBSD 5.5 does not support "cp -a", so this was changed to "cp -RpP" for portability reasons. @ text @d353 11 a363 1 @@@@ -285,5 +285,9 @@@@ d367 3 d1341 54 d1464 30 a1493 1 @@@@ -4109,6 +4140,8 @@@@ d1515 7 a1521 7 +# *-*-netbsd* | *-*-openbsd*) +# if grep dl_iterate_phdr $target_header_dir/link_elf.h > /dev/null 2>&1; then +# gcc_cv_target_dl_iterate_phdr=yes +# else +# gcc_cv_target_dl_iterate_phdr=no +# fi +# ;; @ 1.6 log @lang/gcc-aux: Change base of gcc 4.7.3 to gcc 4.9.0 It appears that gcc-aux is the first gcc 4.9.0 in pkgsrc. It's purpose is to build the Ada packages in pkgsrc, but it also supports C, C++, Objective-C, and Fortran languages by default. GCC 4.9 was released on 22 April 2014. Of note, GCC 4.9 fully supports the new Ada-2012 standard. The rest of the changes since GCC 4.8.2 are too numerous to mention, but a decent summary can be found here: http://gcc.gnu.org/gcc-4.9/changes.html FreeBSD support was added, but SunOS support was temporarily disabled. This is due to all new bootstraps being provided, but the SunOS bootstrap is not yet ready. Currently supported platforms are * NetBSD i386 and x86-64 * DragonFly i386 and x86-64 * FreeBSD i386 and x86-64 All platform fully pass the Ada testsuite: * http://www.dragonlace.net/gnataux/netbsd32/ * http://www.dragonlace.net/gnataux/netbsd64/ * http://www.dragonlace.net/gnataux/dragonfly32/ * http://www.dragonlace.net/gnataux/dragonfly64/ * http://www.dragonlace.net/gnataux/freebsd32/ * http://www.dragonlace.net/gnataux/freebsd64/ @ text @d1 4 d330 43 d555 40 d597 1 a597 1 @@@@ -50,12 +50,21 @@@@ d609 1 a609 11 #include #endif +#if defined(__DragonFly__) +#include +#endif + /* In 4.3bsd-net2, machine/ansi.h defines these symbols, which are defined if the corresponding type is *not* defined. FreeBSD-2.1 defines _MACHINE_ANSI_H_ instead of _ANSI_H_. @@@@ -133,6 +142,7 @@@@ d617 1 a617 1 @@@@ -141,10 +151,12 @@@@ d630 1 a630 1 @@@@ -198,6 +210,7 @@@@ a637 9 @@@@ -306,7 +319,7 @@@@ /* FreeBSD 5 can't be handled well using "traditional" logic above since it no longer defines _BSD_RUNE_T_ yet still desires to export rune_t in some cases... */ -#if defined (__FreeBSD__) && (__FreeBSD__ >= 5) +#if defined (__DragonFly__) || (defined (__FreeBSD__) && (__FreeBSD__ >= 5)) #if !defined (_ANSI_SOURCE) && !defined (_POSIX_SOURCE) #if __BSD_VISIBLE #ifndef _RUNE_T_DECLARED @ 1.5 log @lang/gcc-aux: Update to gcc 4.7.3 (version 20130411) This is a bug fix release. The official change page is http://gcc.gnu.org/gcc-4.7/changes.html According to it, 119 bugs have been resolved since version 4.7.2 was released (3 P1 bugs, 27 P2 bugs). @ text @a0 140 --- gcc/DEV-PHASE.orig +++ gcc/DEV-PHASE @@@@ -0,0 +1 @@@@ +release --- gcc/config.gcc.orig +++ gcc/config.gcc @@@@ -581,6 +581,9 @@@@ "" | yes | posix) thread_file='posix' ;; + gnat | single) + # Let these non-posix thread selections fall through if requested + ;; *) echo 'Unknown thread configuration for FreeBSD' exit 1 @@@@ -597,6 +600,26 @@@@ # need_64bit_hwint=yes # system compiler has this for all arch! use_gcc_stdint=wrap ;; +*-*-dragonfly*) + gas=yes + gnu_ld=yes + tmake_file="t-slibgcc" + case ${enable_threads} in + "" | yes | posix) + thread_file='posix' + ;; + no | gnat | single) + # Let these non-posix thread selections fall through if requested + ;; + *) + echo 'Unknown thread configuration for DragonFly BSD' + exit 1 + ;; + esac + extra_options="$extra_options rpath.opt dragonfly.opt" + default_use_cxa_atexit=yes + use_gcc_stdint=wrap + ;; *-*-linux* | frv-*-*linux* | *-*-kfreebsd*-gnu | *-*-knetbsd*-gnu | *-*-gnu* | *-*-kopensolaris*-gnu) extra_options="$extra_options gnu-user.opt" gas=yes @@@@ -652,6 +675,7 @@@@ esac ;; *-*-netbsd*) + use_gcc_stdint=wrap tmake_file="t-slibgcc" gas=yes gnu_ld=yes @@@@ -903,7 +927,32 @@@@ tm_file="dbxelf.h elfos.h arm/unknown-elf.h arm/elf.h arm/aout.h arm/arm.h arm/rtems-elf.h rtems.h newlib-stdint.h" tmake_file="arm/t-arm arm/t-arm-elf t-rtems arm/t-rtems" ;; -arm*-*-eabi* | arm*-*-symbianelf* | arm*-*-rtems*) +arm*-android-eabi*) + gas=yes + gnu_ld=yes + case ${enable_threads} in + "" | yes | posix) thread_file='posix' ;; + esac + tm_file="dbxelf.h elfos.h gnu-user.h linux.h linux-android.h glibc-stdint.h" + tm_file="$tm_file arm/elf.h arm/linux-gas.h arm/linux-elf.h arm/bpabi.h arm/linux-eabi.h" + tm_file="$tm_file ../../libgcc/config/arm/bpabi-lib.h arm/aout.h arm/arm.h" + + tm_defines="$tm_defines DEFAULT_LIBC=LIBC_BIONIC ANDROID_DEFAULT=1" + case $target in + arm*b-*) + tm_defines="$tm_defines TARGET_BIG_ENDIAN_DEFAULT=1" + ;; + esac + extra_options="$extra_options linux.opt linux-android.opt" + default_use_cxa_atexit=yes + use_gcc_tgmath=no + use_gcc_stdint=wrap + + # 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 + ;; +arm*-*-symbianelf* | arm*-*-rtems*) # The BPABI long long divmod functions return a 128-bit value in # registers r0-r3. Correctly modeling that requires the use of # TImode. @@@@ -912,11 +961,6 @@@@ tm_file="dbxelf.h elfos.h arm/unknown-elf.h arm/elf.h arm/bpabi.h" tmake_file="arm/t-arm arm/t-arm-elf" case ${target} in - arm*-*-eabi*) - tm_file="$tm_file newlib-stdint.h" - tmake_file="${tmake_file} arm/t-bpabi" - use_gcc_stdint=wrap - ;; arm*-*-rtems*) tm_file="${tm_file} rtems.h arm/rtems-eabi.h newlib-stdint.h" tmake_file="${tmake_file} arm/t-bpabi t-rtems arm/t-rtems-eabi" @@@@ -1216,19 +1260,31 @@@@ x86_64-*-elf*) tm_file="${tm_file} i386/unix.h i386/att.h dbxelf.h elfos.h newlib-stdint.h i386/i386elf.h i386/x86-64.h" ;; +i[34567]86-*-dragonfly*) + tm_file="${tm_file} i386/unix.h i386/att.h dbxelf.h elfos.h dragonfly.h dragonfly-stdint.h i386/dragonfly.h" + tmake_file="${tmake_file} i386/t-crtstuff" + ;; +x86_64-*-dragonfly*) + tm_file="${tm_file} i386/unix.h i386/att.h dbxelf.h elfos.h dragonfly.h dragonfly-stdint.h i386/x86-64.h i386/dragonfly.h" + tmake_file="${tmake_file} i386/t-crtstuff" + ;; i[34567]86-*-freebsd*) tm_file="${tm_file} i386/unix.h i386/att.h dbxelf.h elfos.h ${fbsd_tm_file} i386/freebsd.h" + tmake_file="${tmake_file} i386/t-crtstuff" ;; x86_64-*-freebsd*) 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" + tmake_file="${tmake_file} i386/t-crtstuff" ;; i[34567]86-*-netbsdelf*) - tm_file="${tm_file} i386/unix.h i386/att.h dbxelf.h elfos.h netbsd.h netbsd-elf.h i386/netbsd-elf.h" + tm_file="${tm_file} i386/unix.h i386/att.h dbxelf.h elfos.h netbsd.h netbsd-elf.h i386/netbsd-elf.h netbsd-stdint.h" extra_options="${extra_options} netbsd.opt netbsd-elf.opt" + tmake_file="${tmake_file} i386/t-crtstuff" ;; x86_64-*-netbsd*) - tm_file="${tm_file} i386/unix.h i386/att.h dbxelf.h elfos.h netbsd.h netbsd-elf.h i386/x86-64.h i386/netbsd64.h" + tm_file="${tm_file} i386/unix.h i386/att.h dbxelf.h elfos.h netbsd.h netbsd-elf.h i386/x86-64.h i386/netbsd64.h netbsd-stdint.h" extra_options="${extra_options} netbsd.opt netbsd-elf.opt" + tmake_file="${tmake_file} i386/t-crtstuff" ;; i[34567]86-*-openbsd2.*|i[34567]86-*openbsd3.[0123]) tm_file="i386/i386.h i386/unix.h i386/bsd.h i386/gas.h i386/gstabs.h openbsd-oldgas.h openbsd.h i386/openbsd.h" @@@@ -3577,6 +3633,8 @@@@ ;; i[34567]86-*-cygwin* | i[34567]86-*-mingw* | x86_64-*-mingw*) ;; + i[34567]86-*-dragonfly* | x86_64-*-dragonfly*) + ;; i[34567]86-*-freebsd* | x86_64-*-freebsd*) ;; ia64*-*-linux*) d151 1 a151 1 + %{!static:--hash-style=both -rpath @@PREFIX@@/gcc-aux/lib} \ d436 1 a436 1 @@@@ -91,6 +91,12 @@@@ d442 2 d445 1 a445 1 +#define ELF_HASH_STYLE "--hash-style=both " d451 1 a451 1 @@@@ -102,6 +108,7 @@@@ d459 1 a459 1 @@@@ -148,3 +155,5 @@@@ d510 1 a510 1 @@@@ -53,12 +53,21 @@@@ d532 1 a532 1 @@@@ -136,6 +145,7 @@@@ d540 1 a540 1 @@@@ -144,10 +154,12 @@@@ d553 1 a553 1 @@@@ -201,6 +213,7 @@@@ d560 2 a561 2 #else @@@@ -307,7 +320,7 @@@@ d587 1 a587 1 extern char *basename (const char *); a589 95 --- libgcc/config.host.orig +++ libgcc/config.host @@@@ -174,6 +174,17 @@@@ tmake_file="$tmake_file t-darwin ${cpu_type}/t-darwin t-libgcc-pic t-slibgcc-darwin" extra_parts="crt3.o crttms.o crttme.o" ;; +arm*-android-eabi*) + tmake_file="t-slibgcc-elf-ver t-linux arm/t-arm" + tmake_file="$tmake_file arm/t-arm-elf arm/t-bpabi arm/t-linux-eabi t-slibgcc-libgcc" + tmake_file="$tmake_file arm/t-linux-androideabi arm/t-arm-softfp soft-fp/t-softfp" + extra_parts="crtbegin.o crtbeginS.o crtbeginT.o crtend.o crtendS.o" + ;; +*-*-dragonfly*) + tmake_file="$tmake_file t-crtstuff-pic t-libgcc-pic t-eh-dw2-dip" + tmake_file="$tmake_file t-slibgcc t-slibgcc-gld t-slibgcc-elf-ver" + extra_parts="crtbegin.o crtend.o crtbeginS.o crtendS.o" + ;; *-*-freebsd*) # This is the generic ELF configuration of FreeBSD. Later # machine-specific sections may refine and add to this @@@@ -202,7 +213,8 @@@@ extra_parts="crtbegin.o crtbeginS.o crtend.o crtendS.o" ;; *-*-netbsd*) - tmake_file="$tmake_file t-crtstuff-pic t-libgcc-pic t-slibgcc t-slibgcc-gld t-slibgcc-elf-ver" + tmake_file="$tmake_file t-crtstuff-pic t-libgcc-pic t-eh-dw2-dip" + tmake_file="$tmake_file t-slibgcc t-slibgcc-gld t-slibgcc-elf-ver" # NetBSD 1.7 and later are set up to use GCC's crtstuff for # ELF configurations. We will clear extra_parts in the # a.out configurations. @@@@ -266,8 +278,10 @@@@ esac case ${host} in -*-*-darwin* | *-*-freebsd* | *-*-netbsd* | *-*-openbsd* | *-*-solaris2* | \ - alpha*-dec-osf5.1*) +*-*-freebsd* | *-*-dragonfly* | *-*-netbsd* | *-*-openbsd*) + enable_execute_stack=enable-execute-stack-freebsd.c + ;; +*-*-darwin* | *-*-solaris2* | alpha*-dec-osf5.1*) enable_execute_stack=enable-execute-stack-mprotect.c ;; i[34567]86-*-mingw* | x86_64-*-mingw*) @@@@ -358,11 +372,11 @@@@ tmake_file="$tmake_file arm/t-arm arm/t-elf t-softfp-sfdf t-softfp-excl arm/t-softfp t-softfp" extra_parts="$extra_parts crti.o crtn.o" ;; -arm*-*-eabi* | arm*-*-symbianelf* | arm*-*-rtems*) +arm*-*-symbianelf* | arm*-*-rtems*) tmake_file="${tmake_file} arm/t-arm arm/t-elf t-fixedpoint-gnu-prefix" tm_file="$tm_file arm/bpabi-lib.h" case ${host} in - arm*-*-eabi* | arm*-*-rtems*) + arm*-*-rtems*) tmake_file="${tmake_file} arm/t-bpabi" extra_parts="crtbegin.o crtend.o crti.o crtn.o" ;; @@@@ -526,16 +540,29 @@@@ x86_64-*-elf*) tmake_file="$tmake_file i386/t-crtstuff t-crtstuff-pic t-libgcc-pic" ;; +i[34567]86-*-dragonfly*) + tmake_file="${tmake_file} i386/t-dragonfly i386/t-crtstuff" + md_unwind_header=i386/dragonfly-unwind.h + ;; +x86_64-*-dragonfly*) + tmake_file="${tmake_file} i386/t-dragonfly i386/t-crtstuff" + md_unwind_header=i386/dragonfly-unwind.h + ;; i[34567]86-*-freebsd*) tmake_file="${tmake_file} i386/t-freebsd i386/t-crtstuff" + md_unwind_header=i386/freebsd-unwind.h ;; x86_64-*-freebsd*) tmake_file="${tmake_file} i386/t-freebsd i386/t-crtstuff" + md_unwind_header=i386/freebsd-unwind.h ;; i[34567]86-*-netbsdelf*) + tmake_file="${tmake_file} i386/t-crtstuff" + md_unwind_header=i386/netbsd-unwind.h ;; x86_64-*-netbsd*) tmake_file="${tmake_file} i386/t-crtstuff" + md_unwind_header=i386/netbsd-unwind.h ;; i[34567]86-*-openbsd2.*|i[34567]86-*openbsd3.[0123]) ;; @@@@ -1167,6 +1194,7 @@@@ i[34567]86-*-gnu* | \ i[34567]86-*-solaris2* | x86_64-*-solaris2.1[0-9]* | \ i[34567]86-*-cygwin* | i[34567]86-*-mingw* | x86_64-*-mingw* | \ + i[34567]86-*-dragonfly* | x86_64-*-dragonfly* | \ i[34567]86-*-freebsd* | x86_64-*-freebsd*) tmake_file="${tmake_file} t-softfp-tf" if test "${host_address}" = 32; then d592 1 a592 1 @@@@ -81,11 +81,19 @@@@ d676 1 a676 1 @@@@ -54,11 +54,19 @@@@ d860 1 a860 1 @@@@ -0,0 +1,179 @@@@ d862 5 a866 4 + Copyright (C) 2010, 2012 John Marino + +/* Do code reading to identify a signal frame, and set the frame + state data appropriately. See unwind-dw2.c for the structs. */ a901 2 + unsigned char *pc = context->ra; + unsigned char *sigtramp_start, *sigtramp_end; d906 3 d982 6 d1004 1 a1010 2 + unsigned char *pc = context->ra; + unsigned char *sigtramp_start, *sigtramp_end; d1014 12 a1025 1 + x86_sigtramp_range(&sigtramp_start, &sigtramp_end); d1027 2 a1028 1 + if (pc >= sigtramp_end || pc < sigtramp_start) d1260 78 d1340 1 a1340 1 @@@@ -26902,6 +26902,20 @@@@ d1351 7 a1357 7 + *-*-netbsd*) + if grep dl_iterate_phdr $target_header_dir/link_elf.h > /dev/null 2>&1; then + gcc_cv_target_dl_iterate_phdr=yes + else + gcc_cv_target_dl_iterate_phdr=no + fi + ;; d1363 1 a1363 2 @@@@ -1165,7 +1165,6 @@@@ insn-automata.o \ d1366 1 d1371 1 a1371 1 @@@@ -1484,13 +1483,18 @@@@ d1373 4 a1376 4 $(OBJS-libcommon-target) @@TREEBROWSER@@ main.o gccspec.o cppspec.o \ $(COLLECT2_OBJS) $(EXTRA_GCC_OBJS) mips-tfile.o mips-tdump.o \ - $(GCOV_OBJS) $(GCOV_DUMP_OBJS) + $(GCOV_OBJS) $(GCOV_DUMP_OBJS) insn-modes.o insn-modes-ada.o d1382 2 a1383 3 -BACKEND = main.o @@TREEBROWSER@@ libbackend.a libcommon-target.a libcommon.a \ +BACKEND = main.o @@TREEBROWSER@@ insn-modes.o libbackend.a \ + libcommon-target.a libcommon.a \ d1386 2 a1387 2 +BACKEND2 = main.o @@TREEBROWSER@@ insn-modes-ada.o libbackend.a \ + libcommon-target.a libcommon.a \ d1390 2 a1391 11 MOSTLYCLEANFILES = insn-flags.h insn-config.h insn-codes.h \ @@@@ -3522,6 +3526,8 @@@@ $(TM_H) $(RTL_H) $(DIAGNOSTIC_CORE_H) insn-config.h $(RECOG_H) insn-modes.o : insn-modes.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \ $(MACHMODE_H) +insn-modes-ada.o : insn-modes-ada.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \ + $(TM_H) $(MACHMODE_H) insn-opinit.o : insn-opinit.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \ $(TM_H) $(RTL_H) $(TM_P_H) insn-config.h $(FLAGS_H) $(RECOG_H) \ $(EXPR_H) $(OPTABS_H) reload.h @@@@ -3615,6 +3621,7 @@@@ d1399 1 a1399 1 @@@@ -3632,6 +3639,12 @@@@ d1412 4 a1415 22 @@@@ -4394,7 +4407,7 @@@@ DESTDIR=$(@@D) \ $(SHELL) $(srcdir)/doc/install.texi2html -MANFILES = doc/gcov.1 doc/cpp.1 doc/gcc.1 doc/gfdl.7 doc/gpl.7 doc/fsf-funding.7 +MANFILES = doc/gcov.1 doc/cpp.1 doc/gcc.1 generated-manpages: man @@@@ -4546,7 +4559,7 @@@@ # Install the driver last so that the window when things are # broken is small. install: install-common $(INSTALL_HEADERS) \ - install-cpp install-man install-info install-@@POSUB@@ \ + install-cpp install-man install-@@POSUB@@ \ install-driver install-lto-wrapper install-gcc-ar ifeq ($(enable_plugin),yes) @@@@ -4671,6 +4684,9 @@@@ -rm -f $(DESTDIR)$(bindir)/$(target_noncanonical)-gcc-$(version)$(exeext) -( cd $(DESTDIR)$(bindir) && \ $(LN) $(GCC_INSTALL_NAME)$(exeext) $(target_noncanonical)-gcc-$(version)$(exeext) ) d1419 125 a1543 26 -if [ -f gcc-cross$(exeext) ] ; then \ if [ -d $(DESTDIR)$(gcc_tooldir)/bin/. ] ; then \ rm -f $(DESTDIR)$(gcc_tooldir)/bin/gcc$(exeext); \ @@@@ -4744,10 +4760,7 @@@@ install-man: lang.install-man \ $(DESTDIR)$(man1dir)/$(GCC_INSTALL_NAME)$(man1ext) \ $(DESTDIR)$(man1dir)/$(CPP_INSTALL_NAME)$(man1ext) \ - $(DESTDIR)$(man1dir)/$(GCOV_INSTALL_NAME)$(man1ext) \ - $(DESTDIR)$(man7dir)/fsf-funding$(man7ext) \ - $(DESTDIR)$(man7dir)/gfdl$(man7ext) \ - $(DESTDIR)$(man7dir)/gpl$(man7ext) + $(DESTDIR)$(man1dir)/$(GCOV_INSTALL_NAME)$(man1ext) $(DESTDIR)$(man7dir)/%$(man7ext): doc/%.7 installdirs -rm -f $@@ --- configure.orig +++ configure @@@@ -14419,7 +14419,7 @@@@ _ACEOF if ac_fn_c_try_compile "$LINENO"; then : { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; }; stage1_cflags="$stage1_cflags -fkeep-inline-functions" +$as_echo "yes" >&6; }; else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } @ 1.4 log @lang/gcc-aux 4.7.1: Upgrade to version 4.7.2 The GCC projected released version 4.7.2 on 20 September. There were few diff changes (only core and ada) between it and version 4.7.1, so it's a straightforward update. Release announcement: http://gcc.gnu.org/ml/gcc/2012-09/msg00181.html Notable Excerpts: GCC 4.7.2 is the first bug-fix release containing important fixes for regressions and serious bugs in GCC 4.7.1 with over 70 bugs fixed since the previous release A notable change in GCC 4.7.2 compared to 4.7.1 are ABI bug fixes related to some C++11 templates (std::list and std::pair). As a result, code using those templates in C++11 mode is again ABI compatible with code in C++03/C++98 mode or C++11 mode of GCC 4.6 and earlier, but might be ABI incompatible with code compiled by GCC 4.7.1 or 4.7.0 in C++11 mode. @ text @d52 3 a54 3 @@@@ -893,7 +917,32 @@@@ tm_file="dbxelf.h elfos.h newlib-stdint.h arm/unknown-elf.h arm/elf.h arm/aout.h arm/arm.h arm/ecos-elf.h" tmake_file="arm/t-arm arm/t-arm-elf" d56 1 a56 1 -arm*-*-eabi* | arm*-*-symbianelf* | arm*-*-rtemseabi*) d82 1 a82 1 +arm*-*-symbianelf* | arm*-*-rtemseabi*) d86 1 a86 1 @@@@ -902,11 +951,6 @@@@ d95 1 a95 1 arm*-*-rtemseabi*) d98 1 a98 1 @@@@ -1208,19 +1252,31 @@@@ d132 1 a132 1 @@@@ -3554,6 +3610,8 @@@@ d771 1 a771 1 @@@@ -354,11 +368,11 @@@@ d775 2 a776 2 -arm*-*-eabi* | arm*-*-symbianelf* | arm*-*-rtemseabi*) +arm*-*-symbianelf* | arm*-*-rtemseabi*) d780 2 a781 2 - arm*-*-eabi* | arm*-*-rtemseabi*) + arm*-*-rtemseabi*) d815 1 a815 1 @@@@ -1163,6 +1190,7 @@@@ d928 2 a929 2 && defined(TARGET_DL_ITERATE_PHDR) \ && defined(__sun__) && defined(__svr4__) d1476 1 a1476 1 @@@@ -26856,6 +26856,20 @@@@ d1499 1 a1499 1 @@@@ -1150,7 +1150,6 @@@@ d1507 1 a1507 1 @@@@ -1469,13 +1468,18 @@@@ d1528 1 a1528 1 @@@@ -3506,6 +3510,8 @@@@ d1537 1 a1537 1 @@@@ -3599,6 +3605,7 @@@@ d1545 1 a1545 1 @@@@ -3616,6 +3623,12 @@@@ d1558 1 a1558 1 @@@@ -4378,7 +4391,7 @@@@ d1567 1 a1567 1 @@@@ -4530,7 +4543,7 @@@@ d1576 1 a1576 1 @@@@ -4655,6 +4668,9 @@@@ d1586 1 a1586 1 @@@@ -4728,10 +4744,7 @@@@ @ 1.3 log @lang/gcc-aux: add gcc-aux/lib runpath to LINK_SPEC The libraries of gcc-aux are not located on standard search paths for the runtime linker to find. Moreover, libraries from other versions of gcc may be and in that case rtld will link the wrong library. To fix this, an rpath to ${PREFIX}/gcc-aux/lib will be inserted into every dynamic binary created by gcc-aux. Other changes include: 1) simpler and more robust detection of an existing gcc-aux compiler to be used rather than the older bootstrap compiler. 2) Fixed FreeBSD support. FreeBSD bootstraps are available but not yet listed due to lack of testing (however, it should work out of the box) 3) Fixed some c++ testsuite directives for dejagnu @ text @d7 1 a7 1 @@@@ -573,6 +573,9 @@@@ d17 1 a17 1 @@@@ -589,6 +592,26 @@@@ d44 1 a44 1 @@@@ -644,6 +667,7 @@@@ d52 1 a52 1 @@@@ -885,7 +909,32 @@@@ d86 1 a86 1 @@@@ -894,11 +943,6 @@@@ d98 1 a98 1 @@@@ -1196,19 +1240,31 @@@@ d132 1 a132 1 @@@@ -3530,6 +3586,8 @@@@ d576 14 a589 1 @@@@ -102,6 +102,7 @@@@ d593 1 a593 1 + %{!static:--hash-style=both -rpath @@PREFIX@@/gcc-aux/lib} \ d597 1 a597 1 @@@@ -148,3 +149,5 @@@@ d603 8 d785 1 a785 1 @@@@ -523,16 +537,29 @@@@ d815 1 a815 1 @@@@ -1160,6 +1187,7 @@@@ d1476 1 a1476 1 @@@@ -26810,6 +26810,20 @@@@ d1600 1 a1600 1 @@@@ -14412,7 +14412,7 @@@@ @ 1.2 log @lang/gcc-aux: Fix c/c++ precision on FreeBSD/DragonFly Until now, GCC builders had to choose between Ada and C/C++ on the following platforms: i386-FreeBSD i386-DragonFly On these platforms, depending on the value of the configuration macro TARGET_96_ROUND_53_LONG_DOUBLE, either Ada precision or C/C++ long double precision was broken. The reason is that the floating point unit of these platforms round off real-time calculations to 53-bit mantissas. GCC will adjust accordingly to compensate. Since a common backend is used for all languages, one had to choice which language they wanted correct. The solution is to break out the object file responsible for this from the common backend library. Ada now receives an altered version of insn-modes.o, one that instructs the FPU not to round off the results. This is all handled by patched Makefiles. Other changes: - Configure DragonFly to add ".note.GNU-stack" section to assembly files to determine if program needs executable stacks - Skip 2 subtests of Wconversion-real on i386 FreeBSD and DragonFly. Due to the rounding behavior mentioned above, they fail to produce error messages as expected. It's not possible to set target with xfail, and every target && target seems not work work. So we will assume all gcc-aux platform targets are long-double capabile and just set xfail for x86 FreeBSD and DragonFly. - Rework Fortran large real test 2 to skip on x86_64 *BSD. This test should pass on x86 machines. - Rework Fortran large real test 3 to be skipped when compiles with -O0 only x86_64 machines. All other combinations will pass. - Rename C format test typedef from quad_t to quad2_t. DragonFly has a standard type called quad_t and the type conflict causes a large number of gcc tests to fail. - Add dummy dg-error line to avoid an assembly comparison tests on large files not built (test was marked as UNSUPPORTED but dejagnu is too dumb to know not to check for the tests' products.) - Reorder path passed during build when using an already-built gcc-aux compiler to build new compiler. If gnat-aux is also installed, it would use the gnat* tools from that compiler rather than gcc-aux which results in build failure (different versions of tools are getting used together resulting in build failure). @ text @d98 1 a98 1 @@@@ -1196,6 +1240,14 @@@@ d112 1 d114 1 a114 1 @@@@ -1203,12 +1255,14 @@@@ d116 1 d132 1 a132 1 @@@@ -3530,6 +3584,8 @@@@ d202 1 a202 1 @@@@ -0,0 +1,135 @@@@ d289 3 a291 2 + %{static:-Bstatic}} \ + %{!static:--hash-style=both} \ d576 9 a584 1 @@@@ -148,3 +148,34 @@@@ d588 2 a589 31 +/* Through FreeBSD 8.2 at least, stack is denied execution rights by libthr + This only affects AMD64 since i386 ignores the nx bit (non-PAE) + However, it's still included in i386 because it's possible an AMD64 + machine will be required to run a binary generated by i386 GNAT. + perms = PROT_READ | PROT_WRITE | PROT_EXEC; +*/ +#define ENABLE_EXECUTE_STACK \ +extern void __enable_execute_stack (void *); \ +void \ +__enable_execute_stack (void *addr) \ +{ \ + extern int getpagesize (void); \ + extern int mprotect (void *, size_t, int); \ + \ + static int size; \ + long mask; \ + char *page, *ends; \ + long page_addr = (long) addr; \ + long ends_addr = (long) (addr + TRAMPOLINE_SIZE); \ + int perms = 7; \ + \ + if (size == 0) \ + { \ + size = getpagesize(); \ + } \ + mask = ~((long) size - 1); \ + page = (char *) (page_addr & mask); \ + ends = (char *) ((ends_addr & mask) + size); \ + (void) mprotect (page, ends - page, perms); \ +} + d592 11 a602 1 @@@@ -119,3 +119,9 @@@@ d737 2 a738 1 @@@@ -267,6 +279,7 @@@@ d741 6 a746 3 *-*-darwin* | *-*-freebsd* | *-*-netbsd* | *-*-openbsd* | *-*-solaris2* | \ + *-*-dragonfly* | \ alpha*-dec-osf5.1*) d749 2 a750 1 @@@@ -354,11 +367,11 @@@@ d764 1 a764 1 @@@@ -523,16 +536,29 @@@@ d794 1 a794 1 @@@@ -1160,6 +1186,7 @@@@ d825 61 d1072 1 a1072 1 @@@@ -0,0 +1,184 @@@@ d1074 1 a1074 27 + Copyright (C) 2004, 2005, 2006 Free Software Foundation, Inc. + Copyright (C) 2010 John Marino + +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 2, or (at your option) +any later version. + +In addition to the permissions in the GNU General Public License, the +Free Software Foundation gives you unlimited permission to link the +compiled version of this file with other programs, and to distribute +those programs without any restriction coming from the use of this +file. (The General Public License restrictions do apply in other +respects; for example, they cover modification of the file, and +distribution when not linked into another program.) + +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 COPYING. If not, write to +the Free Software Foundation, 51 Franklin Street, Fifth Floor, +Boston, MA 02110-1301, USA. */ a1079 1 +#include a1083 1 + d1089 2 a1090 1 + d1106 1 d1118 1 d1122 20 d1192 1 a1192 1 + @ 1.1 log @Import lang/gcc-aux based on gcc-4.7.1 The primary difference between this compiler package and lang/gcc47 is that lang/gcc-aux supports the Ada language. Additionally, it is intended that the USE_LANGUAGES makefile variable whill be extended to recognize "ada" as a valid language, and that specifying it will cause lang/gcc-aux to be used to build the package. All current Ada-based packages will be modified to build with USE_LANGUAGES+= ada rather than specifying a dependency on lang/gnat-aux, the other Ada-capable compiler in pkgsrc based on gcc-4.6.3. lang/gcc-aux supports C, C++, Objective-C, Fortran, and Ada by default, but the latter four languages can be disabled via the options framework. The three non-default options are "nls", "testsuite" and "static" which enable Native Language Support, languages tests, and building the compiler statically. The "static" option is unalterably enabled for NetBSD in order to use dl_iterate_phdr error handling on NetBSD 6. On the NetBSD 6 beta builds, exceptions won't unwind properly with the libgcc_s shared library, and the issue seems to be external to gcc-aux. It's hoped the libgcc_s exception handling works on NetBSD 5.x series as dl_iterate_phdr isn't supported by rtld there, but gcc-aux hasn't been tested on 5.x yet. lang/gcc-aux can be built by 5 platforms currently: NetBSD i386/x86_64, DragonFly i386/x86_64, and OpenSolaris i386. New platform support requires new bootstraps. FreeBSD i386/x86_64 could be added easily as bootstrap compilers are available for FreeBSD ports lang/gnat-aux. OpenBSD bootstrap compilers have been built but never used, but further patches are on a couple of gcc's configuration files are needed as well as testing to provide OpenBSD support. All five platforms pass all tests (over 3200) in the Ada testsuite. See http://gcc.gnu.org/gcc-4.7/changes.html for more information about improvements over the GCC 4.6 series. @ text @d465 1 a465 1 @@@@ -0,0 +1,101 @@@@ d467 2 a468 1 + Copyright (C) 1996, 2000, 2002, 2004, 2007 Free Software Foundation, Inc. d552 2 a553 2 +/* DragonFly sets the rounding precision of the FPU to 53 bits, but GNAT + resets it to full precision. */ d555 1 a555 1 +#define TARGET_96_ROUND_53_LONG_DOUBLE 0 d568 3 d573 1 a573 15 @@@@ -127,10 +127,10 @@@@ #undef DEFAULT_PCC_STRUCT_RETURN #define DEFAULT_PCC_STRUCT_RETURN 0 -/* FreeBSD sets the rounding precision of the FPU to 53 bits. Let the - compiler get the contents of and std::numeric_limits correct. */ +/* FreeBSD sets the rounding precision of the FPU to 53 bits, but GNAT + resets it to full precision. */ #undef TARGET_96_ROUND_53_LONG_DOUBLE -#define TARGET_96_ROUND_53_LONG_DOUBLE (!TARGET_64BIT) +#define TARGET_96_ROUND_53_LONG_DOUBLE 0 /* Put all *tf routines in libgcc. */ #undef LIBGCC2_HAS_TF_MODE @@@@ -148,3 +148,35 @@@@ a607 1 + d1425 60 a1484 1 @@@@ -4378,7 +4378,7 @@@@ d1493 1 a1493 1 @@@@ -4530,7 +4530,7 @@@@ d1502 1 a1502 1 @@@@ -4655,6 +4655,9 @@@@ d1512 1 a1512 1 @@@@ -4728,10 +4731,7 @@@@ @