From ef8eefc5fa574a4a75dbfba7359a8c6ddb98f430 Mon Sep 17 00:00:00 2001 From: martin Date: Wed, 5 Aug 2015 20:17:51 +0000 Subject: Precompiled header fixes for NetBSD hosts. --- lang/gcc49/distinfo | 9 ++- lang/gcc49/patches/patch-gcc_config.host | 18 +++++ lang/gcc49/patches/patch-gcc_config_host-netbsd.c | 93 +++++++++++++++++++++++ lang/gcc49/patches/patch-gcc_config_x-netbsd | 12 +++ lang/gcc49/patches/patch-gcc_ggc-common.c | 86 +++++++++++++++++++++ 5 files changed, 214 insertions(+), 4 deletions(-) create mode 100644 lang/gcc49/patches/patch-gcc_config.host create mode 100644 lang/gcc49/patches/patch-gcc_config_host-netbsd.c create mode 100644 lang/gcc49/patches/patch-gcc_config_x-netbsd create mode 100644 lang/gcc49/patches/patch-gcc_ggc-common.c (limited to 'lang/gcc49') diff --git a/lang/gcc49/distinfo b/lang/gcc49/distinfo index f17d7432484..dd03d09b750 100644 --- a/lang/gcc49/distinfo +++ b/lang/gcc49/distinfo @@ -1,21 +1,22 @@ -$NetBSD: distinfo,v 1.6 2015/07/01 13:39:33 wiz Exp $ +$NetBSD: distinfo,v 1.7 2015/08/05 20:17:51 martin Exp $ -SHA1 (ecj-4.5.jar) = 58c1d79c64c8cd718550f32a932ccfde8d1e6449 -RMD160 (ecj-4.5.jar) = d3f4da657f086b6423f74e93f001132f4855368a -Size (ecj-4.5.jar) = 1470676 bytes SHA1 (gcc-4.9.3.tar.bz2) = 2e6490a908eac8b2b56b73679bd7c2a5237df1f8 RMD160 (gcc-4.9.3.tar.bz2) = 799d45b4231d9417a4648bbef224657df76fca95 Size (gcc-4.9.3.tar.bz2) = 90006707 bytes SHA1 (patch-contrib_make__sunver.pl) = 49cbd1a83c9b65d07a373262fcf6f71069283d2e SHA1 (patch-gcc_Makefile.in) = 45c7a61cf22d02299d2308ba34f0ceb272ad5c5e SHA1 (patch-gcc_config.gcc) = f8dc39c70aff31b1b9479895a14710ee9b168b3c +SHA1 (patch-gcc_config.host) = 1b1e11cd199eb93f49443d51c0063b09b7327858 SHA1 (patch-gcc_config_dragonfly-stdint.h) = 249e78bf2171fcd29eae498e41a12bf747015a19 SHA1 (patch-gcc_config_dragonfly.h) = 5d671b7cdf8b8e3798dd7ec47f56708aa3548f38 SHA1 (patch-gcc_config_dragonfly.opt) = b01bee26978f7feb62fc2ec21186449ccaea0db7 +SHA1 (patch-gcc_config_host-netbsd.c) = 765295f07edb8a68f1910e3a9b4dd2a7dcd491a5 SHA1 (patch-gcc_config_i386_dragonfly.h) = 5756b62791273f77866f06be1df0c267dc90a2ee SHA1 (patch-gcc_config_netbsd-stdint.h) = fc430c80adda9d3f58eea47816338f697a659889 +SHA1 (patch-gcc_config_x-netbsd) = 6dc3d78e26df62054ea29f98ca51592858e671e3 SHA1 (patch-gcc_configure) = eb52890725d2eabb200275b6cb61fd86d976ee31 SHA1 (patch-gcc_fortran_f95-lang.c) = 9dbac16c146821eed9b06e1e9f0da85ff5c4ee75 +SHA1 (patch-gcc_ggc-common.c) = fa577bc25260d7e6304f166686ba51c0b677d7f6 SHA1 (patch-gcc_ginclude_stddef.h) = 8af3e4b4058fc623c61e91f5771699f0ce679957 SHA1 (patch-gcc_system.h) = 4c959a6b1c4d524cbdf44cfb80f0e5758ec20783 SHA1 (patch-include_libiberty.h) = 5254c6a421ae16c71571820f6f07906367f042ba diff --git a/lang/gcc49/patches/patch-gcc_config.host b/lang/gcc49/patches/patch-gcc_config.host new file mode 100644 index 00000000000..dc59c7c0965 --- /dev/null +++ b/lang/gcc49/patches/patch-gcc_config.host @@ -0,0 +1,18 @@ +$NetBSD: patch-gcc_config.host,v 1.1 2015/08/05 20:17:51 martin Exp $ + +Add host hooks for NetBSD - needed for working precompiled headers. +http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58397 + +--- gcc/config.host.orig 2013-01-10 21:38:27.000000000 +0100 ++++ gcc/config.host 2013-09-10 20:25:36.000000000 +0200 +@@ -271,6 +271,10 @@ + 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" ++ ;; + ia64-*-hpux*) + use_long_long_for_widest_fast_int=yes + out_host_hook_obj=host-hpux.o diff --git a/lang/gcc49/patches/patch-gcc_config_host-netbsd.c b/lang/gcc49/patches/patch-gcc_config_host-netbsd.c new file mode 100644 index 00000000000..9347214dcb1 --- /dev/null +++ b/lang/gcc49/patches/patch-gcc_config_host-netbsd.c @@ -0,0 +1,93 @@ +$NetBSD: patch-gcc_config_host-netbsd.c,v 1.1 2015/08/05 20:17:51 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 ++ . */ ++ ++#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/gcc49/patches/patch-gcc_config_x-netbsd b/lang/gcc49/patches/patch-gcc_config_x-netbsd new file mode 100644 index 00000000000..a3018d0cf71 --- /dev/null +++ b/lang/gcc49/patches/patch-gcc_config_x-netbsd @@ -0,0 +1,12 @@ +$NetBSD: patch-gcc_config_x-netbsd,v 1.1 2015/08/05 20:17:51 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/gcc49/patches/patch-gcc_ggc-common.c b/lang/gcc49/patches/patch-gcc_ggc-common.c new file mode 100644 index 00000000000..f00e14bb244 --- /dev/null +++ b/lang/gcc49/patches/patch-gcc_ggc-common.c @@ -0,0 +1,86 @@ +$NetBSD: patch-gcc_ggc-common.c,v 1.1 2015/08/05 20:17:51 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); + -- cgit v1.2.3