summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrhialto <rhialto@pkgsrc.org>2020-04-08 13:29:54 +0000
committerrhialto <rhialto@pkgsrc.org>2020-04-08 13:29:54 +0000
commit67106303191e99aa0551e6e7ae21961143e3c6ff (patch)
tree485717db84a550043dd013bfdd52c40c3d261809
parentee704b48b298e9d78d40315d6ea562edc555dc87 (diff)
downloadpkgsrc-67106303191e99aa0551e6e7ae21961143e3c6ff.tar.gz
lang/gcc7: add missing patches for precompiled headers.
Bump version, also on gcc7-libs.
-rw-r--r--lang/gcc7-libs/Makefile4
-rw-r--r--lang/gcc7/Makefile4
-rw-r--r--lang/gcc7/patches/patch-gcc_config.host18
-rw-r--r--lang/gcc7/patches/patch-gcc_config_host-netbsd.c93
4 files changed, 115 insertions, 4 deletions
diff --git a/lang/gcc7-libs/Makefile b/lang/gcc7-libs/Makefile
index 0e2b68779c3..5142abd021a 100644
--- a/lang/gcc7-libs/Makefile
+++ b/lang/gcc7-libs/Makefile
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.9 2020/03/13 15:00:36 bacon Exp $
+# $NetBSD: Makefile,v 1.10 2020/04/08 13:29:54 rhialto Exp $
GCC_PKGNAME= gcc7
.include "../../lang/${GCC_PKGNAME}/version.mk"
@@ -9,7 +9,7 @@ PKGNAME= ${GCC_PKGNAME}-libs-${GCC7_DIST_VERSION}
## The PKGREVISION of this package needs to be at least 1 more than the
## PKGREVISION of the lang/gcc7 package so that with the dependence pattern
## '{gcc7,gcc7-libs}>=7.5.*' pkg_add will choose gcc7-libs over gcc7.
-PKGREVISION= 2
+PKGREVISION= 3
CATEGORIES= lang
MASTER_SITES= # empty
diff --git a/lang/gcc7/Makefile b/lang/gcc7/Makefile
index 751ab077c2f..5bd84aada43 100644
--- a/lang/gcc7/Makefile
+++ b/lang/gcc7/Makefile
@@ -1,11 +1,11 @@
-# $NetBSD: Makefile,v 1.31 2020/04/01 14:08:14 wiz Exp $
+# $NetBSD: Makefile,v 1.32 2020/04/08 13:29:54 rhialto Exp $
GCC_PKGNAME= gcc7
.include "version.mk"
DISTNAME= gcc-${GCC7_DIST_VERSION}
PKGNAME= ${GCC_PKGNAME}-${GCC7_DIST_VERSION}
-PKGREVISION= 1
+PKGREVISION= 2
## When bumping the PKGREVISION of this package the PKGREVISION of
## lang/gcc7-libs needs to be bump to be at least 1 more than the
## PKGREVISION of this package!
diff --git a/lang/gcc7/patches/patch-gcc_config.host b/lang/gcc7/patches/patch-gcc_config.host
new file mode 100644
index 00000000000..7c3aea620e0
--- /dev/null
+++ b/lang/gcc7/patches/patch-gcc_config.host
@@ -0,0 +1,18 @@
+$NetBSD: patch-gcc_config.host,v 1.1 2020/04/08 13:29:54 rhialto 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/gcc7/patches/patch-gcc_config_host-netbsd.c b/lang/gcc7/patches/patch-gcc_config_host-netbsd.c
new file mode 100644
index 00000000000..54261d31101
--- /dev/null
+++ b/lang/gcc7/patches/patch-gcc_config_host-netbsd.c
@@ -0,0 +1,93 @@
+$NetBSD: patch-gcc_config_host-netbsd.c,v 1.1 2020/04/08 13:29:54 rhialto 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;