This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
PATCH: get PCH to fail reliably on OpenBSD
- From: Marc Espie <espie at nerim dot net>
- To: Richard Guenther <richard dot guenther at gmail dot com>
- Cc: Mark Mitchell <mark at codesourcery dot com>,Geoffrey Keating <geoffk at geoffk dot org>, gcc at gcc dot gnu dot org,gcc-patches at gcc dot gnu dot org
- Date: Mon, 31 Jan 2005 15:36:55 +0100
- Subject: PATCH: get PCH to fail reliably on OpenBSD
- References: <20050117215824.GA17231@tetto.home> <m2wtuby8h8.fsf@greed.local> <20050117232413.GA10432@tetto.home> <41ED65E4.6000400@codesourcery.com> <84fc9c000501181151434c5667@mail.gmail.com>
- Reply-to: espie at nerim dot net
Since it's a bit hard to get PCH working on OpenBSD (need relocation of
PCH), I'd like to get it to fail reliably.
Specifically, the rationale is that I'd like to get consistent results.
Without this, people are likely to use PCH, only to see it fail in random
ways, since random loading of shared libraries will allow PCH to work >90%
of the time, and fail inexplicably the rest of the time.
With this patch, PCH explicitly fails all the time
(thanks to Gunter Nikl for the pointers):
2005-01-31 Marc Espie <espie@openbsd.org>
* config/host-openbsd.c: New.
* config/x-openbsd: New.
* config.host (*-*-openbsd*): Use host fragment.
*** gcc/config.host.orig Tue Nov 30 04:11:28 2004
--- gcc/config.host Mon Jan 31 15:01:57 2005
*************** case ${host} in
*** 178,183 ****
--- 178,187 ----
out_host_hook_obj=host-solaris.o
host_xmake_file=x-solaris
;;
+ *-*-openbsd*)
+ out_host_hook_obj=host-openbsd.o
+ host_xmake_file=x-openbsd
+ ;;
*-*-linux*)
out_host_hook_obj=host-linux.o
host_xmake_file=x-linux
*** gcc/config/x-openbsd.orig Mon Jan 31 15:01:58 2005
--- gcc/config/x-openbsd Mon Jan 31 15:01:58 2005
***************
*** 0 ****
--- 1,4 ----
+ host-openbsd.o : $(srcdir)/config/host-openbsd.c $(CONFIG_H) $(SYSTEM_H) \
+ coretypes.h hosthooks.h hosthooks-def.h $(HOOKS_H)
+ $(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) \
+ $(srcdir)/config/host-openbsd.c
*** gcc/config/host-openbsd.c.orig Mon Jan 31 15:01:58 2005
--- gcc/config/host-openbsd.c Mon Jan 31 15:27:03 2005
***************
*** 0 ****
--- 1,39 ----
+ /* OpenBSD host-specific hook definitions.
+ Copyright (C) 2005 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 2, 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 COPYING. If not, write to the
+ Free Software Foundation, 59 Temple Place - Suite 330, Boston,
+ MA 02111-1307, USA. */
+
+ #include "config.h"
+ #include "system.h"
+ #include "coretypes.h"
+ #include <sys/mman.h>
+ #include "hosthooks.h"
+ #include "hosthooks-def.h"
+
+
+ #undef HOST_HOOKS_GT_PCH_USE_ADDRESS
+ #define HOST_HOOKS_GT_PCH_USE_ADDRESS openbsd_gt_pch_use_address
+
+ static int
+ openbsd_gt_pch_use_address (void *base, size_t size, int fd, size_t offset)
+ {
+ return -1;
+ }
+
+
+ const struct host_hooks host_hooks = HOST_HOOKS_INITIALIZER;