Preliminary work at making it run on i386-ELF.

From dale and me.
This commit is contained in:
espie 2003-06-26 00:19:50 +00:00
parent 39de8874c2
commit 0e31e0a30e
5 changed files with 220 additions and 13 deletions

View File

@ -1,16 +1,17 @@
# $OpenBSD: Makefile,v 1.75 2003/06/16 17:25:19 sturm Exp $
# $OpenBSD: Makefile,v 1.76 2003/06/26 00:19:50 espie Exp $
ONLY_FOR_ARCHS= alpha i386 m68k sparc sparc64 powerpc
MAKE_GXX=Yes
MAKE_FORTRAN=Yes
MAKE_OBJC=Yes
MAKE_GXX=No
MAKE_FORTRAN=No
MAKE_OBJC=No
# Java is still mostly broken (boehm-gc)
MAKE_JAVA=No
.if ${MACHINE_ARCH} == "i386"
MAKE_ADA=Yes
#MAKE_ADA=Yes
MAKE_ADA=No
#AS_PATH=/usr/bin/as
#LD_PATH=/usr/bin/ld
.else
@ -156,6 +157,10 @@ rm_dirs=zlib texinfo #boehm-gc
post-patch:
# cp -R ${FILESDIR}/config/* ${WRKSRC}
# cp -R ${FILESDIR}/include/* ${WRKSRC}/gcc/ginclude
cp ${FILESDIR}/config/gcc/config/i386/openbsdelf.h \
${WRKSRC}/gcc/config/i386/openbsdelf.h
cp ${FILESDIR}/config/gcc/config/exec-stack.h \
${WRKSRC}/gcc/config/exec-stack.h
cd ${WRKSRC} && contrib/gcc_update --touch
# rebuild configure files after patching, then move source around !!!
# XXX: don't try to autoconf the main configure file, it's not autoconf.
@ -319,7 +324,7 @@ send-results:
[ -f ${TEST_RESULT} ] && sh ${TEST_RESULT}
.if ${MACHINE_ARCH} == "i386" || ${MACHINE_ARCH} == "m68k" || ${MACHINE_ARCH} == "sparc"
.if ${MACHINE_ARCH} == "7386" || ${MACHINE_ARCH} == "m68k" || ${MACHINE_ARCH} == "sparc"
SED_PLIST=|sed -e '/^IFPIC:/s///'
.else
SED_PLIST=|sed -e '/^IFPIC:/d'

View File

@ -0,0 +1,40 @@
/* Enable stack execute around trampoline address.
Copyright (C) 2002 Free Software Foundation, Inc.
This file is part of GNU CC.
GNU CC 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.
GNU CC 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 GNU CC; see the file COPYING. If not, write to
the Free Software Foundation, 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
#undef FINALIZE_TRAMPOLINE
#define FINALIZE_TRAMPOLINE(TRAMP) \
emit_library_call(gen_rtx_SYMBOL_REF (Pmode, "__enable_execute_stack"), \
0, VOIDmode, 1, memory_address (SImode, (TRAMP)), Pmode)
#undef TRANSFER_FROM_TRAMPOLINE
#define TRANSFER_FROM_TRAMPOLINE \
extern void __enable_execute_stack (void *); \
void \
__enable_execute_stack (addr) \
void *addr; \
{ \
long size = getpagesize (); \
long mask = ~(size-1); \
char *page = (char *) (((long) addr) & mask); \
char *end = (char *) ((((long) (addr + TRAMPOLINE_SIZE)) & mask) + size); \
\
if (mprotect (page, end - page, PROT_READ | PROT_WRITE | PROT_EXEC) < 0) \
perror ("mprotect of trampoline code"); \
}

View File

@ -0,0 +1,134 @@
/* Configuration for an OpenBSD i386 target.
Copyright (C) 1999 Free Software Foundation, Inc.
This file is part of GNU CC.
GNU CC 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.
GNU CC 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 GNU CC; see the file COPYING. If not, write to
the Free Software Foundation, 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
/* This gets defined in tm.h->linux.h->svr4.h, and keeps us from using
libraries compiled with the native cc, so undef it. */
#undef NO_DOLLAR_IN_LABEL
/* Override the default comment-starter of "/". */
#undef ASM_COMMENT_START
#define ASM_COMMENT_START "#"
/* This goes away when the math-emulator is fixed */
#undef TARGET_DEFAULT
#define TARGET_DEFAULT \
(MASK_80387 | MASK_IEEE_FP | MASK_FLOAT_RETURNS | MASK_NO_FANCY_MATH_387)
/* Run-time target specifications */
#undef CPP_PREDEFINES
#define CPP_PREDEFINES "-D__unix__ -D__ELF__ -D__i386__ -D__OpenBSD__ -Asystem(unix) -Asystem(OpenBSD)"
/* As an elf system, we need crtbegin/crtend stuff. */
#undef STARTFILE_SPEC
#define STARTFILE_SPEC "\
%{!shared: %{pg:gcrt0%O%s} %{!pg:%{p:gcrt0%O%s} %{!p:crt0%O%s}} \
crtbegin%O%s} %{shared:crtbeginS%O%s}"
#undef ENDFILE_SPEC
#define ENDFILE_SPEC "%{!shared:crtend%O%s} %{shared:crtendS%O%s}"
/* Layout of source language data types. */
/* This must agree with <machine/ansi.h> */
#undef SIZE_TYPE
#define SIZE_TYPE "unsigned int"
#undef PTRDIFF_TYPE
#define PTRDIFF_TYPE "int"
#undef WCHAR_TYPE
#define WCHAR_TYPE "int"
#undef WCHAR_UNSIGNED
#define WCHAR_UNSIGNED 0
#undef WCHAR_TYPE_SIZE
#define WCHAR_TYPE_SIZE BITS_PER_WORD
/* Assembler format: overall framework. */
#undef ASM_APP_ON
#define ASM_APP_ON "#APP\n"
#undef ASM_APP_OFF
#define ASM_APP_OFF "#NO_APP\n"
#undef SET_ASM_OP
#define SET_ASM_OP "\t.set\t"
/* The following macros were originally stolen from i386v4.h.
These have to be defined to get PIC code correct. */
/* Assembler format: dispatch tables. */
/* Assembler format: sections. */
/* Stack & calling: aggregate returns. */
/* Don't default to pcc-struct-return, because gcc is the only compiler, and
we want to retain compatibility with older gcc versions. */
#define DEFAULT_PCC_STRUCT_RETURN 0
/* Assembler format: alignment output. */
#ifdef HAVE_GAS_MAX_SKIP_P2ALIGN
#define ASM_OUTPUT_MAX_SKIP_ALIGN(FILE,LOG,MAX_SKIP) \
if ((LOG) != 0) {\
if ((MAX_SKIP) == 0) fprintf ((FILE), "\t.p2align %d\n", (LOG)); \
else fprintf ((FILE), "\t.p2align %d,,%d\n", (LOG), (MAX_SKIP)); \
}
#endif
/* Stack & calling: profiling. */
/* OpenBSD's profiler recovers all information from the stack pointer.
The icky part is not here, but in machine/profile.h. */
#undef FUNCTION_PROFILER
#define FUNCTION_PROFILER(FILE, LABELNO) \
fputs (flag_pic ? "\tcall __mcount@PLT\n": "\tcall __mcount\n", FILE);
/* Assembler format: exception region output. */
/* All configurations that don't use elf must be explicit about not using
dwarf unwind information. egcs doesn't try too hard to check internal
configuration files... */
#define DWARF2_UNWIND_INFO 0
/* Assembler format: alignment output. */
/* Note that we pick up ASM_OUTPUT_MAX_SKIP_ALIGN from i386/gas.h */
/* Note that we pick up ASM_OUTPUT_MI_THUNK from unix.h. */
#undef LINK_SPEC
#define LINK_SPEC \
"%{!shared:%{!nostdlib:%{!r*:%{!e*:-e __start}}}} \
%{shared:-shared} %{R*} \
%{static:-Bstatic} \
%{!static:-Bdynamic} \
%{assert*} \
%{!dynamic-linker:-dynamic-linker /usr/libexec/ld.so}"
#define OBSD_HAS_CORRECT_SPECS
/* pick up defines for mprotect (used in TRANSFER_FROM_TRANPOLINE) */
#include <sys/types.h>
#include <sys/mman.h>

View File

@ -1,6 +1,6 @@
$OpenBSD: patch-gcc_config_gcc,v 1.14 2003/02/15 14:38:27 espie Exp $
--- gcc/config.gcc.orig Thu Jan 30 15:03:42 2003
+++ gcc/config.gcc Sun Feb 9 22:57:59 2003
$OpenBSD: patch-gcc_config_gcc,v 1.15 2003/06/26 00:19:50 espie Exp $
--- gcc/config.gcc.orig Thu Jan 30 09:03:42 2003
+++ gcc/config.gcc Thu May 22 17:53:28 2003
@@ -582,9 +582,11 @@ alpha*-*-netbsd*)
;;
@ -13,7 +13,35 @@ $OpenBSD: patch-gcc_config_gcc,v 1.14 2003/02/15 14:38:27 espie Exp $
;;
alpha*-dec-osf*)
@@ -2751,8 +2753,8 @@ romp-*-openbsd*)
@@ -1262,11 +1264,26 @@ x86_64-*-netbsd*)
tm_file="${tm_file} i386/att.h dbxelf.h elfos.h netbsd.h netbsd-elf.h i386/x86-64.h i386/netbsd64.h"
float_format=i386
;;
-i[34567]86-*-openbsd*)
+# Change ...[012] to i[34567]86-*-openbsd3.[0123] after we move to 3.4
+i[34567]86-*-openbsd2* | i[34567]86-*-openbsd3.[012])
# needed to unconfuse gdb
tmake_file="t-libc-ok t-openbsd i386/t-openbsd"
# we need collect2 until our bug is fixed...
use_collect2=yes
+ tm_file="i386/i386.h i386/att.h svr4.h i386/openbsd.h i386/perform.h"
+ gas=yes
+ gnu_ld=yes
+ stabs=yes
+ ;;
+i[34567]86-*-openbsd*)
+ # needed to unconfuse gdb
+ tmake_file="t-libc-ok t-openbsd i386/t-openbsd"
+ tm_file="i386/i386.h i386/att.h dbxelf.h elfos.h i386/i386elf.h"
+ tm_file="${tm_file} exec-stack.h"
+ tm_file="${tm_file} openbsd.h i386/openbsdelf.h"
+ gas=yes
+ gnu_ld=yes
+ stabs=yes
;;
i[34567]86-*-coff*)
tm_file=i386/i386-coff.h
@@ -2751,8 +2768,8 @@ romp-*-openbsd*)
# Nothing special
;;
powerpc-*-openbsd*)
@ -24,7 +52,7 @@ $OpenBSD: patch-gcc_config_gcc,v 1.14 2003/02/15 14:38:27 espie Exp $
;;
powerpc64-*-linux*)
tm_file="${tm_file} dbxelf.h elfos.h svr4.h freebsd-spec.h rs6000/sysv4.h rs6000/linux64.h"
@@ -3060,6 +3062,13 @@ sparc-*-openbsd*)
@@ -3060,6 +3077,13 @@ sparc-*-openbsd*)
tmake_file="t-libc-ok t-openbsd sparc/t-openbsd"
# we need collect2 until our bug is fixed...
use_collect2=yes

View File

@ -1,5 +1,5 @@
--- libstdc++-v3/src/Makefile.in.orig Tue Jan 7 04:44:01 2003
+++ libstdc++-v3/src/Makefile.in Tue Feb 11 22:24:27 2003
--- libstdc++-v3/src/Makefile.in.orig Mon Jan 6 22:44:01 2003
+++ libstdc++-v3/src/Makefile.in Thu May 22 16:36:48 2003
@@ -135,7 +135,7 @@ mkinstalldirs = $(SHELL) $(toplevel_srcd
CXX = @glibcpp_CXX@
toolexecdir = @glibcpp_toolexecdir@