diff options
author | martin <martin> | 2015-08-05 19:51:50 +0000 |
---|---|---|
committer | martin <martin> | 2015-08-05 19:51:50 +0000 |
commit | 8f2a8b1fbb68119b42c9da6dffe974d4c274eba4 (patch) | |
tree | 6cacd80899a4253a617623ca82a1a22fbf422404 /lang | |
parent | 40a323e78b393a618a1d1e97f07c070d99d8c512 (diff) | |
download | pkgsrc-8f2a8b1fbb68119b42c9da6dffe974d4c274eba4.tar.gz |
Fix precompiled headers for NetBSD hosts (backported from the in-tree
gcc 4.8.x in NetBSD 7/-current)
Diffstat (limited to 'lang')
-rw-r--r-- | lang/gcc46/distinfo | 7 | ||||
-rw-r--r-- | lang/gcc46/patches/patch-gcc_config.host | 15 | ||||
-rw-r--r-- | lang/gcc46/patches/patch-gcc_config_host-netbsd.c | 93 | ||||
-rw-r--r-- | lang/gcc46/patches/patch-gcc_config_x-netbsd | 12 | ||||
-rw-r--r-- | lang/gcc46/patches/patch-gcc_ggc-common.c | 86 |
5 files changed, 207 insertions, 6 deletions
diff --git a/lang/gcc46/distinfo b/lang/gcc46/distinfo index 5744575e534..e54252300d0 100644 --- a/lang/gcc46/distinfo +++ b/lang/gcc46/distinfo @@ -1,4 +1,4 @@ -$NetBSD: distinfo,v 1.18 2015/01/01 01:29:56 ryoon Exp $ +$NetBSD: distinfo,v 1.19 2015/08/05 19:51:50 martin Exp $ SHA1 (gcc-4.6.4.tar.bz2) = 63933a8a5cf725626585dbba993c8b0f6db1335d RMD160 (gcc-4.6.4.tar.bz2) = 6a58b053812cf75622bc4579e020cd9471f46916 @@ -24,10 +24,11 @@ SHA1 (patch-boehm-gc_pthread__support.c) = 1028b0e8604e0477dd80ec20c04ffc0027823 SHA1 (patch-boehm-gc_tests_test.c) = f4f2c7a701ef166004746e5f819f7e04c4176b24 SHA1 (patch-boehm-gc_threadlibs.c) = 62cabc51234e1ce5c60e70bef9fc4d8f92b9739d SHA1 (patch-gcc_common.opt) = 561965695238afd4c41b75f20d84114adb4dd194 -SHA1 (patch-gcc_config.host) = 5be619aad33ee0ac05d8fb64879be5e530914122 +SHA1 (patch-gcc_config.host) = 9458bf6bc6d16abd07c66e60b04c84106fe937fd SHA1 (patch-gcc_config_arm_elf.h) = 28c67bb698ebe9a3aa45c4cff29f028c82cc7606 SHA1 (patch-gcc_config_arm_t-netbsd) = a1682f4f8dc7e393446f19f615737ddfc98fcb7f SHA1 (patch-gcc_config_exec-stack.h) = 2ff8a153a41638de2943c4109f38ea3a7c26c00d +SHA1 (patch-gcc_config_host-netbsd.c) = 765295f07edb8a68f1910e3a9b4dd2a7dcd491a5 SHA1 (patch-gcc_config_host-openbsd.c) = 109ce33dbbc19c988637d77dce4d240d6bfc912c SHA1 (patch-gcc_config_i386_i386.c) = 49ba75bb347a9c96606a7bef7e0f972488d881b3 SHA1 (patch-gcc_config_i386_openbsd.h) = 0adb1e531eb9d773cbd6944f279e949e59035bd3 @@ -36,10 +37,12 @@ SHA1 (patch-gcc_config_i386_openbsdelf.h) = cd7afa938514dc80fb53c683fb089468c935 SHA1 (patch-gcc_config_openbsd-libpthread.h) = 826aaae4b2dda5a49ec71510f0752aba3c1b0b91 SHA1 (patch-gcc_config_openbsd.h) = a396d14b2df78a4c45d3e51ef7fe960bbc8d5754 SHA1 (patch-gcc_config_t-openbsd) = 662fe8d0c4b58145fb3268bc7ac432a1616c1106 +SHA1 (patch-gcc_config_x-netbsd) = 6dc3d78e26df62054ea29f98ca51592858e671e3 SHA1 (patch-gcc_config_x-openbsd) = b307d75331b9a7f6271698c68f1647a03d204eb9 SHA1 (patch-gcc_configure) = 906906aca782c75b2a053aef272a8472f0a9a9ee SHA1 (patch-gcc_defaults.h) = 72b145fdf9baecc061e90e9634eb5f842215a962 SHA1 (patch-gcc_gcc.c) = 6b9499cf22f1018c289f2a20a4487d5f5e1a1069 +SHA1 (patch-gcc_ggc-common.c) = fa577bc25260d7e6304f166686ba51c0b677d7f6 SHA1 (patch-gcc_lto_lto.c) = 3c7df0691d300d2915388e7ef019b9717a9673d7 SHA1 (patch-gcc_opts.c) = e02ebec8a9de24492a3aba80ee8c742446f2c549 SHA1 (patch-gcc_unwind-dw2-fde-glibc.c) = 704ccc2b1058344586e0ccb8bcd291f41d93ed0a diff --git a/lang/gcc46/patches/patch-gcc_config.host b/lang/gcc46/patches/patch-gcc_config.host index c0ff78e16d4..c1e50780c3e 100644 --- a/lang/gcc46/patches/patch-gcc_config.host +++ b/lang/gcc46/patches/patch-gcc_config.host @@ -1,8 +1,11 @@ -$NetBSD: patch-gcc_config.host,v 1.1 2014/01/25 13:38:48 ryoon Exp $ +$NetBSD: patch-gcc_config.host,v 1.2 2015/08/05 19:51:50 martin Exp $ ---- gcc/config.host.orig 2011-02-15 09:49:14.000000000 +0000 -+++ gcc/config.host -@@ -268,6 +268,10 @@ case ${host} in +Add host hooks for NetBSD - needed for working precompiled headers. +http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58397 + +--- gcc/config.host.orig 2011-02-15 10:49:14.000000000 +0100 ++++ gcc/config.host 2015-08-05 21:04:37.000000000 +0200 +@@ -268,6 +268,14 @@ out_host_hook_obj=host-solaris.o host_xmake_file="${host_xmake_file} x-solaris" ;; @@ -10,6 +13,10 @@ $NetBSD: patch-gcc_config.host,v 1.1 2014/01/25 13:38:48 ryoon Exp $ + out_host_hook_obj=host-openbsd.o + host_xmake_file="${host_xmake_file} x-openbsd" + ;; ++ *-*-netbsd*) ++ out_host_hook_obj=host-netbsd.o ++ host_xmake_file="${host_xmake_file} x-netbsd" ++ ;; *-*-linux*) out_host_hook_obj=host-linux.o host_xmake_file="${host_xmake_file} x-linux" diff --git a/lang/gcc46/patches/patch-gcc_config_host-netbsd.c b/lang/gcc46/patches/patch-gcc_config_host-netbsd.c new file mode 100644 index 00000000000..ec04185b26f --- /dev/null +++ b/lang/gcc46/patches/patch-gcc_config_host-netbsd.c @@ -0,0 +1,93 @@ +$NetBSD: patch-gcc_config_host-netbsd.c,v 1.1 2015/08/05 19:51:50 martin Exp $ + +Add host hooks for NetBSD - needed for working precompiled headers. +http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58397 + +--- /dev/null 2013-09-11 20:06:51.000000000 +0200 ++++ gcc/config/host-netbsd.c 2013-09-11 20:29:31.000000000 +0200 +@@ -0,0 +1,85 @@ ++/* NetBSD host-specific hook definitions. ++ Copyright (C) 2004-2013 Free Software Foundation, Inc. ++ ++ This file is part of GCC. ++ ++ GCC is free software; you can redistribute it and/or modify it ++ under the terms of the GNU General Public License as published ++ by the Free Software Foundation; either version 3, or (at your ++ option) any later version. ++ ++ GCC is distributed in the hope that it will be useful, but WITHOUT ++ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY ++ or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public ++ License for more details. ++ ++ You should have received a copy of the GNU General Public License ++ along with GCC; see the file COPYING3. If not see ++ <http://www.gnu.org/licenses/>. */ ++ ++#include "config.h" ++#include "system.h" ++#include "coretypes.h" ++#include "hosthooks.h" ++#include "hosthooks-def.h" ++ ++ ++#undef HOST_HOOKS_GT_PCH_GET_ADDRESS ++#define HOST_HOOKS_GT_PCH_GET_ADDRESS netbsd_gt_pch_get_address ++#undef HOST_HOOKS_GT_PCH_USE_ADDRESS ++#define HOST_HOOKS_GT_PCH_USE_ADDRESS netbsd_gt_pch_use_address ++ ++/* For various ports, try to guess a fixed spot in the vm space ++ that's probably free. */ ++#if defined(__sparc64__) ++# define TRY_EMPTY_VM_SPACE 0x40000000000 ++#elif defined(_LP64) ++# define TRY_EMPTY_VM_SPACE 0x400000000000 ++#elif defined(__mips__) || defined(__vax__) || defined (__arm__) ++# define TRY_EMPTY_VM_SPACE 0x60000000 ++#else ++# define TRY_EMPTY_VM_SPACE 0xb0000000 ++#endif ++ ++/* Determine a location where we might be able to reliably allocate ++ SIZE bytes. FD is the PCH file, though we should return with the ++ file unmapped. */ ++ ++static void * ++netbsd_gt_pch_get_address (size_t size, int fd) ++{ ++ void *addr; ++ ++ addr = mmap ((void *) TRY_EMPTY_VM_SPACE, size, PROT_READ | PROT_WRITE, ++ MAP_PRIVATE | MAP_FIXED, fd, 0); ++ ++ /* If we failed the map, that means there's *no* free space. */ ++ if (addr == (void *) MAP_FAILED) ++ return NULL; ++ /* Unmap the area before returning. */ ++ munmap (addr, size); ++ ++ return addr; ++} ++ ++/* Map SIZE bytes of FD+OFFSET at BASE. Return 1 if we succeeded at ++ mapping the data at BASE, -1 if we couldn't. */ ++ ++static int ++netbsd_gt_pch_use_address (void *base, size_t size, int fd, size_t offset) ++{ ++ void *addr; ++ ++ /* We're called with size == 0 if we're not planning to load a PCH ++ file at all. This allows the hook to free any static space that ++ we might have allocated at link time. */ ++ if (size == 0) ++ return -1; ++ ++ addr = mmap (base, size, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_FIXED, fd, offset); ++ ++ return addr == base ? 1 : -1; ++} ++ ++ ++const struct host_hooks host_hooks = HOST_HOOKS_INITIALIZER; diff --git a/lang/gcc46/patches/patch-gcc_config_x-netbsd b/lang/gcc46/patches/patch-gcc_config_x-netbsd new file mode 100644 index 00000000000..b5ddff6f437 --- /dev/null +++ b/lang/gcc46/patches/patch-gcc_config_x-netbsd @@ -0,0 +1,12 @@ +$NetBSD: patch-gcc_config_x-netbsd,v 1.1 2015/08/05 19:51:50 martin Exp $ + +Add host hooks for NetBSD - needed for working precompiled headers. +http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58397 + +--- /dev/null 2013-09-11 09:12:57.000000000 +0200 ++++ gcc/config/x-netbsd 2013-09-10 18:57:27.000000000 +0200 +@@ -0,0 +1,4 @@ ++host-netbsd.o : $(srcdir)/config/host-netbsd.c $(CONFIG_H) $(SYSTEM_H) \ ++ coretypes.h hosthooks.h hosthooks-def.h $(HOOKS_H) ++ $(COMPILER) -c $(ALL_COMPILERFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) \ ++ $(srcdir)/config/host-netbsd.c diff --git a/lang/gcc46/patches/patch-gcc_ggc-common.c b/lang/gcc46/patches/patch-gcc_ggc-common.c new file mode 100644 index 00000000000..2093ecd4c23 --- /dev/null +++ b/lang/gcc46/patches/patch-gcc_ggc-common.c @@ -0,0 +1,86 @@ +$NetBSD: patch-gcc_ggc-common.c,v 1.1 2015/08/05 19:51:50 martin Exp $ + +When failing a PCH read-in, restore some globals to allow the generic +error reporting to work in pre-PCH context. + +Patch submitted upstream in http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58381 + +--- gcc/ggc-common.c.orig 2013-03-05 16:51:48.000000000 +0100 ++++ gcc/ggc-common.c 2013-09-10 17:20:52.000000000 +0200 +@@ -666,6 +666,8 @@ + size_t i; + struct mmap_info mmi; + int result; ++ struct line_maps * old_line_table = line_table; ++ location_t old_input_loc = input_location; + + /* Delete any deletable objects. This makes ggc_pch_read much + faster, as it can be sure that no GCable objects remain other +@@ -677,39 +679,60 @@ + /* Read in all the scalar variables. */ + for (rt = gt_pch_scalar_rtab; *rt; rt++) + for (rti = *rt; rti->base != NULL; rti++) +- if (fread (rti->base, rti->stride, 1, f) != 1) ++ if (fread (rti->base, rti->stride, 1, f) != 1) { ++ line_table = old_line_table; ++ input_location = old_input_loc; + fatal_error ("can%'t read PCH file: %m"); ++ } + + /* Read in all the global pointers, in 6 easy loops. */ + for (rt = gt_ggc_rtab; *rt; rt++) + for (rti = *rt; rti->base != NULL; rti++) + for (i = 0; i < rti->nelt; i++) + if (fread ((char *)rti->base + rti->stride * i, +- sizeof (void *), 1, f) != 1) ++ sizeof (void *), 1, f) != 1) { ++ line_table = old_line_table; ++ input_location = old_input_loc; + fatal_error ("can%'t read PCH file: %m"); ++ } + + for (rt = gt_pch_cache_rtab; *rt; rt++) + for (rti = *rt; rti->base != NULL; rti++) + for (i = 0; i < rti->nelt; i++) + if (fread ((char *)rti->base + rti->stride * i, +- sizeof (void *), 1, f) != 1) ++ sizeof (void *), 1, f) != 1) { ++ line_table = old_line_table; ++ input_location = old_input_loc; + fatal_error ("can%'t read PCH file: %m"); ++ } + +- if (fread (&mmi, sizeof (mmi), 1, f) != 1) ++ if (fread (&mmi, sizeof (mmi), 1, f) != 1) { ++ line_table = old_line_table; ++ input_location = old_input_loc; + fatal_error ("can%'t read PCH file: %m"); ++ } + + result = host_hooks.gt_pch_use_address (mmi.preferred_base, mmi.size, + fileno (f), mmi.offset); +- if (result < 0) ++ if (result < 0) { ++ line_table = old_line_table; ++ input_location = old_input_loc; + fatal_error ("had to relocate PCH"); ++ } + if (result == 0) + { + if (fseek (f, mmi.offset, SEEK_SET) != 0 +- || fread (mmi.preferred_base, mmi.size, 1, f) != 1) ++ || fread (mmi.preferred_base, mmi.size, 1, f) != 1) { ++ line_table = old_line_table; ++ input_location = old_input_loc; + fatal_error ("can%'t read PCH file: %m"); ++ } + } +- else if (fseek (f, mmi.offset + mmi.size, SEEK_SET) != 0) ++ else if (fseek (f, mmi.offset + mmi.size, SEEK_SET) != 0) { ++ line_table = old_line_table; ++ input_location = old_input_loc; + fatal_error ("can%'t read PCH file: %m"); ++ } + + ggc_pch_read (f, mmi.preferred_base); + |