head 1.5; access; symbols pkgsrc-2026Q1:1.5.0.76 pkgsrc-2026Q1-base:1.5 pkgsrc-2025Q4:1.5.0.74 pkgsrc-2025Q4-base:1.5 pkgsrc-2025Q3:1.5.0.72 pkgsrc-2025Q3-base:1.5 pkgsrc-2025Q2:1.5.0.70 pkgsrc-2025Q2-base:1.5 pkgsrc-2025Q1:1.5.0.68 pkgsrc-2025Q1-base:1.5 pkgsrc-2024Q4:1.5.0.66 pkgsrc-2024Q4-base:1.5 pkgsrc-2024Q3:1.5.0.64 pkgsrc-2024Q3-base:1.5 pkgsrc-2024Q2:1.5.0.62 pkgsrc-2024Q2-base:1.5 pkgsrc-2024Q1:1.5.0.60 pkgsrc-2024Q1-base:1.5 pkgsrc-2023Q4:1.5.0.58 pkgsrc-2023Q4-base:1.5 pkgsrc-2023Q3:1.5.0.56 pkgsrc-2023Q3-base:1.5 pkgsrc-2023Q2:1.5.0.54 pkgsrc-2023Q2-base:1.5 pkgsrc-2023Q1:1.5.0.52 pkgsrc-2023Q1-base:1.5 pkgsrc-2022Q4:1.5.0.50 pkgsrc-2022Q4-base:1.5 pkgsrc-2022Q3:1.5.0.48 pkgsrc-2022Q3-base:1.5 pkgsrc-2022Q2:1.5.0.46 pkgsrc-2022Q2-base:1.5 pkgsrc-2022Q1:1.5.0.44 pkgsrc-2022Q1-base:1.5 pkgsrc-2021Q4:1.5.0.42 pkgsrc-2021Q4-base:1.5 pkgsrc-2021Q3:1.5.0.40 pkgsrc-2021Q3-base:1.5 pkgsrc-2021Q2:1.5.0.38 pkgsrc-2021Q2-base:1.5 pkgsrc-2021Q1:1.5.0.36 pkgsrc-2021Q1-base:1.5 pkgsrc-2020Q4:1.5.0.34 pkgsrc-2020Q4-base:1.5 pkgsrc-2020Q3:1.5.0.32 pkgsrc-2020Q3-base:1.5 pkgsrc-2020Q2:1.5.0.28 pkgsrc-2020Q2-base:1.5 pkgsrc-2020Q1:1.5.0.8 pkgsrc-2020Q1-base:1.5 pkgsrc-2019Q4:1.5.0.30 pkgsrc-2019Q4-base:1.5 pkgsrc-2019Q3:1.5.0.26 pkgsrc-2019Q3-base:1.5 pkgsrc-2019Q2:1.5.0.24 pkgsrc-2019Q2-base:1.5 pkgsrc-2019Q1:1.5.0.22 pkgsrc-2019Q1-base:1.5 pkgsrc-2018Q4:1.5.0.20 pkgsrc-2018Q4-base:1.5 pkgsrc-2018Q3:1.5.0.18 pkgsrc-2018Q3-base:1.5 pkgsrc-2018Q2:1.5.0.16 pkgsrc-2018Q2-base:1.5 pkgsrc-2018Q1:1.5.0.14 pkgsrc-2018Q1-base:1.5 pkgsrc-2017Q4:1.5.0.12 pkgsrc-2017Q4-base:1.5 pkgsrc-2017Q3:1.5.0.10 pkgsrc-2017Q3-base:1.5 pkgsrc-2017Q2:1.5.0.6 pkgsrc-2017Q2-base:1.5 pkgsrc-2017Q1:1.5.0.4 pkgsrc-2017Q1-base:1.5 pkgsrc-2016Q4:1.5.0.2 pkgsrc-2016Q4-base:1.5 pkgsrc-2016Q3:1.2.0.2 pkgsrc-2016Q3-base:1.2 pkgsrc-2016Q2:1.1.0.10 pkgsrc-2016Q2-base:1.1 pkgsrc-2016Q1:1.1.0.8 pkgsrc-2016Q1-base:1.1 pkgsrc-2015Q4:1.1.0.6 pkgsrc-2015Q4-base:1.1 pkgsrc-2015Q3:1.1.0.4 pkgsrc-2015Q3-base:1.1 pkgsrc-2015Q2:1.1.0.2 pkgsrc-2015Q2-base:1.1; locks; strict; comment @# @; 1.5 date 2016.12.08.19.32.10; author marino; state Exp; branches; next 1.4; commitid cQswlHEgfNLPrdxz; 1.4 date 2016.12.08.03.31.27; author marino; state Exp; branches; next 1.3; commitid rxscIO4FqeRf88xz; 1.3 date 2016.11.26.16.12.18; author marino; state Exp; branches; next 1.2; commitid SWSrMxaSlqAbJEvz; 1.2 date 2016.08.28.17.59.37; author marino; state Exp; branches; next 1.1; commitid iPXUVS9C5uhmd6kz; 1.1 date 2015.06.15.09.46.27; author marino; state Exp; branches; next ; commitid 87WzRX7CCQnXCvpy; desc @@ 1.5 log @lang/gcc5-aux: Fix runpath on NetBSD x86-64 The runpath issue only affected the x86-64 arch on NetBSD. The spec change was only effective on i386, so relocating the change enables the RUNPATH tag in the gcc libraries on the amd64 platform. @ text @--- gcc/config/dragonfly.h.orig +++ gcc/config/dragonfly.h @@@@ -84,7 +84,7 @@@@ } \ %{static:-Bstatic} \ } \ - %{!static:--hash-style=gnu} \ + %{!static:--hash-style=gnu -rpath @@PREFIX@@/@@GCCAUX@@/lib} \ %{symbolic:-Bsymbolic}" #undef LINK_SPEC --- gcc/config/i386/freebsd.h.orig +++ gcc/config/i386/freebsd.h @@@@ -77,6 +77,12 @@@@ When the -shared link option is used a final link is not being done. */ +#if 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)} \ @@@@ -88,6 +94,7 @@@@ %{rdynamic:-export-dynamic} \ -dynamic-linker %(fbsd_dynamic_linker) } \ %{static:-Bstatic}} \ + %{!static:" ELF_HASH_STYLE "-rpath @@PREFIX@@/@@GCCAUX@@/lib} \ %{symbolic:-Bsymbolic}" /* A C statement to output to the stdio stream FILE an assembler --- 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@@/@@GCCAUX@@/lib} \ %{symbolic:-Bsymbolic}" --- /dev/null +++ libgcc/config/i386/netbsd-unwind.h @@@@ -0,0 +1,178 @@@@ +/* DWARF2 EH unwinding support for NetBSD: AMD x86-64 and x86. + Copyright (C) 2015 Free Software Foundation, Inc. + Contributed by 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 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 +. */ + +/* 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/netbsd-elf.h.orig +++ gcc/config/netbsd-elf.h @@@@ -70,6 +70,7 @@@@ #define NETBSD_LINK_SPEC_ELF \ "%{assert*} %{R*} %{rpath*} \ %{shared:-shared} \ + %{!static:-rpath @@PREFIX@@/@@GCCAUX@@/lib} \ %{!shared: \ -dc -dp \ %{!nostdlib: \ @@@@ -84,3 +85,10 @@@@ #ifdef HAVE_LD_AS_NEEDED #define USE_LD_AS_NEEDED 1 #endif + +/* 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.gcc.orig +++ gcc/config.gcc @@@@ -1399,12 +1399,16 @@@@ 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 freebsd-stdint.h" extra_options="${extra_options} netbsd.opt netbsd-elf.opt" + tmake_file="${tmake_file} i386/t-crtstuff" + use_gcc_stdint=wrap ;; 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 freebsd-stdint.h" extra_options="${extra_options} netbsd.opt netbsd-elf.opt" + tmake_file="${tmake_file} i386/t-crtstuff" + use_gcc_stdint=wrap ;; 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" --- gcc/configure.orig +++ gcc/configure @@@@ -27961,6 +27961,13 @@@@ 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 --- libgcc/crtstuff.c.orig +++ libgcc/crtstuff.c @@@@ -81,7 +81,7 @@@@ #endif #if defined(TARGET_DL_ITERATE_PHDR) && \ - (defined(__DragonFly__) || defined(__FreeBSD__)) + (defined(__DragonFly__) || defined(__FreeBSD__) || defined(__NetBSD__)) #define BSD_DL_ITERATE_PHDR_AVAILABLE #endif --- libgcc/unwind-dw2-fde-dip.c.orig +++ libgcc/unwind-dw2-fde-dip.c @@@@ -65,6 +65,12 @@@@ #endif #if !defined(inhibit_libc) && defined(HAVE_LD_EH_FRAME_HDR) \ + && defined(TARGET_DL_ITERATE_PHDR) && defined(__NetBSD__) +# define ElfW(type) Elf_##type +# define USE_PT_GNU_EH_FRAME +#endif + +#if !defined(inhibit_libc) && defined(HAVE_LD_EH_FRAME_HDR) \ && defined(__OpenBSD__) # define ElfW(type) Elf_##type # define USE_PT_GNU_EH_FRAME --- libgcc/config.host.orig +++ libgcc/config.host @@@@ -240,7 +240,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. @@@@ -579,9 +580,12 @@@@ 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]) ;; --- gcc/Makefile.in.orig +++ gcc/Makefile.in @@@@ -1163,7 +1163,6 @@@@ insn-emit.o \ insn-extract.o \ insn-latencytab.o \ - insn-modes.o \ insn-opinit.o \ insn-output.o \ insn-peep.o \ @@@@ -1518,6 +1517,7 @@@@ $(OBJS-libcommon-target) @@TREEBROWSER@@ main.o c-family/cppspec.o \ $(COLLECT2_OBJS) $(EXTRA_GCC_OBJS) $(GCOV_OBJS) $(GCOV_DUMP_OBJS) \ $(GCOV_TOOL_OBJS) $(GENGTYPE_OBJS) gcc-ar.o gcc-nm.o gcc-ranlib.o \ + insn-modes.o insn-modes-ada.o \ lto-wrapper.o collect-utils.o # This lists all host object files, whether they are included in this @@@@ -1525,6 +1525,11 @@@@ 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 @@@@ -2171,6 +2176,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) @@@@ -2188,6 +2194,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 @@@@ -3333,6 +3345,9 @@@@ ( cd $(DESTDIR)$(bindir) && \ $(LN) $(GCC_INSTALL_NAME)$(exeext) $(FULL_DRIVER_NAME) ); \ 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/i386/t-dragonfly.orig +++ libgcc/config/i386/t-dragonfly @@@@ -0,0 +1,2 @@@@ +# Required for -fcilkplus support +SHLIB_MAPFILES += $(srcdir)/config/i386/libgcc-bsd.ver @ 1.4 log @lang/gcc5-aux: Fix runpath, at least for non-NetBSD platforms NetBSD doesn't seem to be honoring -rpath, at least not with binutils from base. Using binutils from pkgsrc doesn't work either because it uses the gold linker (for an unknown reason) which fails with an "unsupported operation". As a result, gcc5-aux was limited to base binutils for NetBSD 7 and later. The issue was never resolved. @ text @d253 21 a310 36 --- 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@@/@@GCCAUX@@/lib}" #define NETBSD_ENTRY_POINT "__start" @@@@ -121,3 +122,10 @@@@ #define HAVE_ENABLE_EXECUTE_STACK #define IX86_MAYBE_NO_LIBGCC_TFMODE + +/* 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 @@@@ -69,3 +69,10 @@@@ #define HAVE_ENABLE_EXECUTE_STACK #define IX86_MAYBE_NO_LIBGCC_TFMODE + +/* 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 @ 1.3 log @lang/gcc5-aux: fix allstages logic and set gcc-aux paths => gcc5-aux The disable bootstrap logic was reversed, and there were several references to gcc-aux that needed to change to gcc5-aux. @ text @d298 1 a298 1 +"%{!static:-rpath @@PREFIX@@/gcc5-aux/lib}" @ 1.2 log @lang/gcc5-aux: Upgrade version 20150422 => 20160603 (GCC 5.1 => 5.4) The signal trampoline detection for NetBSD 7 and later is still broken. Support for NetBSD 6.99 has been removed along with supporte for 32-bit DragonFly. The modifications to the testsuite were misguided and have also been removed. @ text @d298 1 a298 1 +"%{!static:-rpath @@PREFIX@@/gcc-aux/lib}" @ 1.1 log @Import lang/gcc5-aux based on gcc-5.1 This compiler package is not like the lang/gcc4* packages, but rather the lang/gcc-aux package which exists to bring GNAT, the Ada language compiler. The lang/gcc-aux package is based on gcc-4.9, and this package is based on gcc-5. This is the first gcc5 package in pkgsrc, and it does support C, C++, ObjC, and Fortran in addition to Ada thus it is very useful, but it does have a different purpose than other gcc ports. This port has had minimal testing. I verified GNAT passes 100% of the testsuite on NetBSD 6.1/amd64, but it has not been tested on any NetBSD 5, 7.0 or 7.99 platform yet. I don't have any hardware, so it will require using a VM or having others report failure/success. Due to similarity with lang/gcc-aux, chances are good that it will build and function properly on other platforms. See http://gcc.gnu.org/gcc-5/changes.html for more information about improvements over the gcc-4.9 series. @ text @d14 1 a14 1 @@@@ -90,6 +90,14 @@@@ d18 1 a18 3 +#if FBSD_MAJOR < 9 +#define ELF_HASH_STYLE "" +#elif FBSD_MAJOR < 10 d27 1 a27 1 @@@@ -101,6 +109,7 @@@@ a43 176 +++ libgcc/config/i386/freebsd-unwind.h @@@@ -0,0 +1,173 @@@@ +/* DWARF2 EH unwinding support for FreeBSD: AMD x86-64 and x86. + Copyright (C) 2015 Free Software Foundation, Inc. + Contributed by 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 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 +. */ + +/* 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 + +static _Unwind_Reason_Code +x86_64_freebsd_fallback_frame_state +(struct _Unwind_Context *context, _Unwind_FrameState *fs) +{ + struct sigframe *sf; + long new_cfa; + + /* 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. Unfortunately + this means looking frame patterns again (sys/amd64/amd64/sigtramp.S) + rather than using the robust and convenient KERN_PS_STRINGS trick. + + : 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; + + 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. + */ + +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 d255 1 a255 1 @@@@ -1393,12 +1393,16 @@@@ d276 1 a276 1 @@@@ -27806,6 +27806,13 @@@@ d352 25 d379 1 a379 1 @@@@ -1156,7 +1156,6 @@@@ d387 1 a387 1 @@@@ -1511,6 +1510,7 @@@@ d395 1 a395 1 @@@@ -1518,6 +1518,11 @@@@ d407 1 a407 1 @@@@ -2164,6 +2169,7 @@@@ d415 1 a415 1 @@@@ -2181,6 +2187,12 @@@@ d428 1 a428 1 @@@@ -3326,6 +3338,9 @@@@ d438 5 a442 32 --- libgcc/config.host.orig +++ libgcc/config.host @@@@ -240,7 +240,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. @@@@ -567,14 +568,19 @@@@ ;; 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]) ;; @