Ticket #8421: 0001-Fix-precompiled-header-support.patch

File 0001-Fix-precompiled-header-support.patch, 3.7 KB (added by hamish, 13 years ago)
  • gcc/gcc/config.host

    From 688e7cd1a56eaa301824361a6b3584795c08e602 Mon Sep 17 00:00:00 2001
    From: Hamish Morrison <hamish@lavabit.com>
    Date: Mon, 26 Mar 2012 04:43:28 +0000
    Subject: [PATCH] Fix precompiled header support
    
    ---
     gcc/gcc/config.host         |    6 ++++-
     gcc/gcc/config/host-haiku.c |   55 +++++++++++++++++++++++++++++++++++++++++++
     gcc/gcc/config/x-haiku      |    4 +++
     3 files changed, 64 insertions(+), 1 deletions(-)
     create mode 100644 gcc/gcc/config/host-haiku.c
     create mode 100644 gcc/gcc/config/x-haiku
    
    diff --git a/gcc/gcc/config.host b/gcc/gcc/config.host
    index d0342b9..874cf5b 100644
    a b  
    6262#           different from the default "liblto_plugin.so".
    6363
    6464# When setting any of these variables, check to see if a corresponding
    65 # variable is present in config.build; if so, you will likely want to 
     65# variable is present in config.build; if so, you will likely want to
    6666# set it in both places.
    6767
    6868# Default settings.
    case ${host} in  
    264264  rs6000-ibm-aix* | powerpc-ibm-aix*)
    265265    host_xmake_file="${host_xmake_file} rs6000/x-aix"
    266266    ;;
     267  *-*-haiku*)
     268    out_host_hook_obj=host-haiku.o
     269    host_xmake_file="${host_xmake_file} x-haiku"
     270    ;;
    267271  *-*-solaris2*)
    268272    out_host_hook_obj=host-solaris.o
    269273    host_xmake_file="${host_xmake_file} x-solaris"
  • new file gcc/gcc/config/host-haiku.c

    diff --git a/gcc/gcc/config/host-haiku.c b/gcc/gcc/config/host-haiku.c
    new file mode 100644
    index 0000000..c06d39f
    - +  
     1/* Haiku host-specific hook definitions.
     2   Copyright (C) 2004, 2005, 2007, 2008, 2010 Free Software Foundation, Inc.
     3
     4   This file is part of GCC.
     5
     6   GCC is free software; you can redistribute it and/or modify it
     7   under the terms of the GNU General Public License as published
     8   by the Free Software Foundation; either version 3, or (at your
     9   option) any later version.
     10
     11   GCC is distributed in the hope that it will be useful, but WITHOUT
     12   ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
     13   or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public
     14   License for more details.
     15
     16   You should have received a copy of the GNU General Public License
     17   along with GCC; see the file COPYING3.  If not see
     18   <http://www.gnu.org/licenses/>.  */
     19
     20#include "config.h"
     21#include "system.h"
     22#include "coretypes.h"
     23#include "hosthooks.h"
     24#include "hosthooks-def.h"
     25
     26#include <kernel/OS.h>
     27
     28#undef HOST_HOOKS_GT_PCH_USE_ADDRESS
     29#define HOST_HOOKS_GT_PCH_USE_ADDRESS haiku_gt_pch_use_address
     30
     31/* On Haiku, mmap ignores the address parameter unless MAP_FIXED is set.
     32   We can't use MAP_FIXED straight off as this could map over something
     33   else, so we use create_area first to ensure the region is free.  */
     34
     35static int
     36haiku_gt_pch_use_address (void *base, size_t size, int fd, size_t offset)
     37{
     38  void *addr = base;
     39
     40  if (size == 0)
     41    return -1;
     42
     43  if (create_area ("pch", &addr, B_EXACT_ADDRESS, size, B_NO_LOCK,
     44      B_READ_AREA | B_WRITE_AREA) < 0)
     45    return -1;
     46
     47  /* Since it succeeded we can now safely map over it with MAP_FIXED.  */
     48  addr = mmap (base, size, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_FIXED,
     49               fd, offset);
     50
     51  return addr == base ? 1 : -1;
     52}
     53
     54
    055
  • new file gcc/gcc/config/x-haiku

    +const struct host_hooks host_hooks = HOST_HOOKS_INITIALIZER;
    diff --git a/gcc/gcc/config/x-haiku b/gcc/gcc/config/x-haiku
    new file mode 100644
    index 0000000..4d05aca
    - +  
     1host-haiku.o : $(srcdir)/config/host-haiku.c $(CONFIG_H) $(SYSTEM_H) \
     2  coretypes.h hosthooks.h hosthooks-def.h $(HOOKS_H)
     3    $(COMPILER) -c $(ALL_COMPILERFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) \
     4        $(srcdir)/config/host-haiku.c