summaryrefslogtreecommitdiff
path: root/lang/gcc48
diff options
context:
space:
mode:
authormartin <martin>2013-09-11 19:05:19 +0000
committermartin <martin>2013-09-11 19:05:19 +0000
commitc5fa131f0a8f203e11930a935ad044aff208119d (patch)
tree0020fa8b04cd70f3298fb108716f7d4335c774c0 /lang/gcc48
parent7b11e7b36e6e5bee9108325ae706d08b79c8f9ee (diff)
downloadpkgsrc-c5fa131f0a8f203e11930a935ad044aff208119d.tar.gz
Make it buildable on NetBSD/sparc64 (by avoiding a SIGSEGV in a SIGSEGV
handler). Make precompiled headers work on NetBSD hosts (by choosing a hopefully stable virtual address for precompiled header symbol tables). Both reported upstream.
Diffstat (limited to 'lang/gcc48')
-rw-r--r--lang/gcc48/distinfo9
-rw-r--r--lang/gcc48/patches/patch-gcc_config.host18
-rw-r--r--lang/gcc48/patches/patch-gcc_config_host-netbsd.c93
-rw-r--r--lang/gcc48/patches/patch-gcc_config_x-netbsd12
-rw-r--r--lang/gcc48/patches/patch-gcc_ggc-common.c86
5 files changed, 214 insertions, 4 deletions
diff --git a/lang/gcc48/distinfo b/lang/gcc48/distinfo
index 8fa73f5fa07..ee6f43d8428 100644
--- a/lang/gcc48/distinfo
+++ b/lang/gcc48/distinfo
@@ -1,20 +1,21 @@
-$NetBSD: distinfo,v 1.7 2013/06/12 19:46:01 wiz Exp $
+$NetBSD: distinfo,v 1.8 2013/09/11 19:05:19 martin Exp $
-SHA1 (ecj-4.5.jar) = 58c1d79c64c8cd718550f32a932ccfde8d1e6449
-RMD160 (ecj-4.5.jar) = d3f4da657f086b6423f74e93f001132f4855368a
-Size (ecj-4.5.jar) = 1470676 bytes
SHA1 (gcc-4.8.1.tar.bz2) = 4e655032cda30e1928fcc3f00962f4238b502169
RMD160 (gcc-4.8.1.tar.bz2) = a92c8fb9e70ad2a1caa9b3a79639a096f04382e0
Size (gcc-4.8.1.tar.bz2) = 86753166 bytes
SHA1 (patch-gcc_Makefile.in) = b2bceb34537de1cf704f18a59aa4e4d4a4551c62
SHA1 (patch-gcc_config.gcc) = ac175c5eecf3dd53508479b30bf5c59cc0a5fca9
+SHA1 (patch-gcc_config.host) = 1b1e11cd199eb93f49443d51c0063b09b7327858
SHA1 (patch-gcc_config_dragonfly-stdint.h) = 740dc819b446d5f1476506322c4b280ffdb5a6c0
SHA1 (patch-gcc_config_dragonfly.h) = 82f549cdc7543b4bf413a44d481ef42b10f59c82
SHA1 (patch-gcc_config_dragonfly.opt) = 92f615c73c2e94664bae5b5935ab8b09bca15f73
+SHA1 (patch-gcc_config_host-netbsd.c) = 8f13b09dd7006d456cd1c66e895be504e9537880
SHA1 (patch-gcc_config_i386_dragonfly.h) = 0d3f785434c02beb9c4561fe59842a970e8f7896
SHA1 (patch-gcc_config_netbsd-stdint.h) = 025fc883101a187e84ed4c0772406720d645d550
+SHA1 (patch-gcc_config_x-netbsd) = 6dc3d78e26df62054ea29f98ca51592858e671e3
SHA1 (patch-gcc_configure) = a4b670d0c54c410d38715b7a2a572a7048e3ec5e
SHA1 (patch-gcc_fortran_f95-lang.c) = 06470dbee79f8c762675d3060a870b7dd9ba38f8
+SHA1 (patch-gcc_ggc-common.c) = fa577bc25260d7e6304f166686ba51c0b677d7f6
SHA1 (patch-gcc_ginclude_stddef.h) = 50be7c9469ac58c79e10abda5e7cfef5f91dd249
SHA1 (patch-gcc_system.h) = 4c959a6b1c4d524cbdf44cfb80f0e5758ec20783
SHA1 (patch-include_libiberty.h) = ad2c64e9a14405c89b02ff68811b1c889405d0a1
diff --git a/lang/gcc48/patches/patch-gcc_config.host b/lang/gcc48/patches/patch-gcc_config.host
new file mode 100644
index 00000000000..da17a98cfda
--- /dev/null
+++ b/lang/gcc48/patches/patch-gcc_config.host
@@ -0,0 +1,18 @@
+$NetBSD: patch-gcc_config.host,v 1.1 2013/09/11 19:05:19 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/gcc48/patches/patch-gcc_config_host-netbsd.c b/lang/gcc48/patches/patch-gcc_config_host-netbsd.c
new file mode 100644
index 00000000000..70272b521df
--- /dev/null
+++ b/lang/gcc48/patches/patch-gcc_config_host-netbsd.c
@@ -0,0 +1,93 @@
+$NetBSD: patch-gcc_config_host-netbsd.c,v 1.1 2013/09/11 19:05:19 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__)
++# 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/gcc48/patches/patch-gcc_config_x-netbsd b/lang/gcc48/patches/patch-gcc_config_x-netbsd
new file mode 100644
index 00000000000..9a5c95bae25
--- /dev/null
+++ b/lang/gcc48/patches/patch-gcc_config_x-netbsd
@@ -0,0 +1,12 @@
+$NetBSD: patch-gcc_config_x-netbsd,v 1.1 2013/09/11 19:05:19 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/gcc48/patches/patch-gcc_ggc-common.c b/lang/gcc48/patches/patch-gcc_ggc-common.c
new file mode 100644
index 00000000000..54144a8fb2b
--- /dev/null
+++ b/lang/gcc48/patches/patch-gcc_ggc-common.c
@@ -0,0 +1,86 @@
+$NetBSD: patch-gcc_ggc-common.c,v 1.1 2013/09/11 19:05:19 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);
+