diff options
author | Mark Kettenis <kettenis@cvs.openbsd.org> | 2011-08-04 14:46:59 +0000 |
---|---|---|
committer | Mark Kettenis <kettenis@cvs.openbsd.org> | 2011-08-04 14:46:59 +0000 |
commit | d5a9e1b1b0113d933c399233f5f330f5ac4ede3e (patch) | |
tree | 17e24b350ee6322e6450185fec795dde90d14b5b | |
parent | ed3251b7fa6f43b7e0c16858a78df7fd2338c23b (diff) |
Add support for hppa64.
ok deraadt@
-rw-r--r-- | gnu/gcc/gcc/config/pa/openbsd64.h | 179 | ||||
-rw-r--r-- | gnu/usr.bin/cc/Makefile.tgt | 5 | ||||
-rw-r--r-- | gnu/usr.bin/cc/cc_tools/Makefile | 7 | ||||
-rw-r--r-- | gnu/usr.bin/cc/libgcc/Makefile | 9 |
4 files changed, 197 insertions, 3 deletions
diff --git a/gnu/gcc/gcc/config/pa/openbsd64.h b/gnu/gcc/gcc/config/pa/openbsd64.h new file mode 100644 index 00000000000..448bc5631c7 --- /dev/null +++ b/gnu/gcc/gcc/config/pa/openbsd64.h @@ -0,0 +1,179 @@ +/* Configuration file for an hppa risc OpenBSD 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. */ + + +#include <pa/pa64-regs.h> +#include <pa/pa-64.h> +#define OBSD_HAS_DECLARE_FUNCTION_NAME +#define OBSD_HAS_DECLARE_FUNCTION_SIZE +#define OBSD_HAS_DECLARE_OBJECT +#include <openbsd.h> + +/* Run-time target specifications. */ +#undef TARGET_OS_CPP_BUILTINS +#define TARGET_OS_CPP_BUILTINS() \ + do \ + { \ + OPENBSD_OS_CPP_BUILTINS_ELF(); \ + builtin_define ("__hppa64__"); \ + } \ + while (0) + +/* Define the strings used for the special svr4 .type and .size directives. + These strings generally do not vary from one system running svr4 to + another, but if a given system (e.g. m88k running svr) needs to use + different pseudo-op names for these, they may be overridden in the + file which includes this one. */ + +#undef STRING_ASM_OP +#define STRING_ASM_OP "\t.stringz\t" + +#define TEXT_SECTION_ASM_OP "\t.text" +#define DATA_SECTION_ASM_OP "\t.data" +#define BSS_SECTION_ASM_OP "\t.section\t.bss" + +/* We want local labels to start with period if made with asm_fprintf. */ +#undef LOCAL_LABEL_PREFIX +#define LOCAL_LABEL_PREFIX "." + +/* Define these to generate the Linux/ELF/SysV style of internal + labels all the time - i.e. to be compatible with + ASM_GENERATE_INTERNAL_LABEL in <elfos.h>. Compare these with the + ones in pa.h and note the lack of dollar signs in these. FIXME: + shouldn't we fix pa.h to use ASM_GENERATE_INTERNAL_LABEL instead? */ + +#undef ASM_OUTPUT_ADDR_VEC_ELT +#define ASM_OUTPUT_ADDR_VEC_ELT(FILE, VALUE) \ + if (TARGET_BIG_SWITCH) \ + fprintf (FILE, "\t.word .L%d\n", VALUE); \ + else \ + fprintf (FILE, "\tb .L%d\n\tnop\n", VALUE) + +#undef ASM_OUTPUT_ADDR_DIFF_ELT +#define ASM_OUTPUT_ADDR_DIFF_ELT(FILE, BODY, VALUE, REL) \ + if (TARGET_BIG_SWITCH) \ + fprintf (FILE, "\t.word .L%d-.L%d\n", VALUE, REL); \ + else \ + fprintf (FILE, "\tb .L%d\n\tnop\n", VALUE) + +/* Use the default. */ +#undef ASM_OUTPUT_LABEL + +/* NOTE: (*targetm.asm_out.internal_label)() is defined for us by elfos.h, and + does what we want (i.e. uses colons). It must be compatible with + ASM_GENERATE_INTERNAL_LABEL(), so do not define it here. */ + +/* Use the default. */ +#undef ASM_OUTPUT_INTERNAL_LABEL + +/* Use the default. */ +#undef TARGET_ASM_GLOBALIZE_LABEL + +/* FIXME: Hacked from the <elfos.h> one so that we avoid multiple + labels in a function declaration (since pa.c seems determined to do + it differently) */ + +#undef ASM_DECLARE_FUNCTION_NAME +#define ASM_DECLARE_FUNCTION_NAME(FILE, NAME, DECL) \ + do \ + { \ + ASM_OUTPUT_TYPE_DIRECTIVE (FILE, NAME, "function"); \ + ASM_DECLARE_RESULT (FILE, DECL_RESULT (DECL)); \ + } \ + while (0) + +/* As well as globalizing the label, we need to encode the label + to ensure a plabel is generated in an indirect call. */ + +#undef ASM_OUTPUT_EXTERNAL_LIBCALL +#define ASM_OUTPUT_EXTERNAL_LIBCALL(FILE, FUN) \ + do \ + { \ + if (!FUNCTION_NAME_P (XSTR (FUN, 0))) \ + hppa_encode_label (FUN); \ + (*targetm.asm_out.globalize_label) (FILE, XSTR (FUN, 0)); \ + } \ + while (0) + +/* OpenBSD always uses gas. */ +#undef TARGET_GAS +#define TARGET_GAS 1 + +/* XXX OpenBSD/hppa has a non-standard .comm */ + +#undef ASM_OUTPUT_ALIGNED_COMMON +#define ASM_OUTPUT_ALIGNED_COMMON(FILE, NAME, SIZE, ALIGN) \ + do \ + { \ + switch_to_section (bss_section); \ + assemble_name((FILE), (NAME)); \ + fprintf ((FILE), "\t.comm %d\n", \ + MAX ((SIZE), ((ALIGN) / BITS_PER_UNIT))); \ + } \ + while (0) + +#undef ASM_OUTPUT_ALIGNED_LOCAL +#define ASM_OUTPUT_ALIGNED_LOCAL(FILE, NAME, SIZE, ALIGN) \ + do \ + { \ + switch_to_section (bss_section); \ + fprintf((FILE), "\t.align %d\n", ((ALIGN) / BITS_PER_UNIT)); \ + assemble_name((FILE), (NAME)); \ + fprintf ((FILE), "\t.block %d\n", (SIZE)); \ + } \ + while (0) + +/* XXX Why doesn't PA support -R like everyone ??? */ +#undef LINK_SPEC +#define LINK_SPEC \ + "%{EB} %{EL} %{shared} %{non_shared} \ + %{call_shared} %{no_archive} %{exact_version} \ + %{!shared: %{!non_shared: %{!call_shared: -non_shared}}} \ + %{!dynamic-linker:-dynamic-linker /usr/libexec/ld.so} \ + %{!nostdlib:%{!r*:%{!e*:-e __start}}} -dc -dp \ + %{static:-Bstatic} %{!static:-Bdynamic} %{assert*}" + +/* Layout of source language data types. */ + +/* This must agree with <machine/_types.h> */ +#undef SIZE_TYPE +#define SIZE_TYPE "long unsigned int" + +#undef PTRDIFF_TYPE +#define PTRDIFF_TYPE "long int" + +#undef INTMAX_TYPE +#define INTMAX_TYPE "long long int" + +#undef UINTMAX_TYPE +#define UINTMAX_TYPE "long long unsigned int" + +#undef WCHAR_TYPE +#define WCHAR_TYPE "int" + +#undef WCHAR_TYPE_SIZE +#define WCHAR_TYPE_SIZE 32 + +/* 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}" diff --git a/gnu/usr.bin/cc/Makefile.tgt b/gnu/usr.bin/cc/Makefile.tgt index 71df069ab3b..8d76fa37948 100644 --- a/gnu/usr.bin/cc/Makefile.tgt +++ b/gnu/usr.bin/cc/Makefile.tgt @@ -1,5 +1,5 @@ # $FreeBSD: src/gnu/usr.bin/cc/Makefile.tgt,v 1.11.8.1 2009/04/15 03:14:26 kensmith Exp $ -# $OpenBSD: Makefile.tgt,v 1.9 2011/07/04 05:46:18 pirofti Exp $ +# $OpenBSD: Makefile.tgt,v 1.10 2011/08/04 14:46:58 kettenis Exp $ TARGET_ARCH?= ${MACHINE_ARCH} @@ -14,6 +14,9 @@ GCC_CPU= ia64 .elif ${TARGET_ARCH} == "hppa" GCC_CPU= pa TARGET_CPU_DEFAULT= MASK_PA_11 +.elif ${TARGET_ARCH} == "hppa64" +GCC_CPU= pa +TARGET_CPU_DEFAULT= MASK_PA_11|MASK_PA_20 .elif ${TARGET_ARCH} == "mips64" || ${TARGET_ARCH} == "mips64el" GCC_CPU= mips .elif ${TARGET_ARCH} == "powerpc" diff --git a/gnu/usr.bin/cc/cc_tools/Makefile b/gnu/usr.bin/cc/cc_tools/Makefile index b4662dc08ac..7ca7db44ce6 100644 --- a/gnu/usr.bin/cc/cc_tools/Makefile +++ b/gnu/usr.bin/cc/cc_tools/Makefile @@ -1,5 +1,5 @@ # $FreeBSD: src/gnu/usr.bin/cc/cc_tools/Makefile,v 1.88.8.1 2009/04/15 03:14:26 kensmith Exp $ -# $OpenBSD: Makefile,v 1.10 2011/06/25 20:56:21 miod Exp $ +# $OpenBSD: Makefile,v 1.11 2011/08/04 14:46:58 kettenis Exp $ .include <bsd.own.mk> @@ -27,6 +27,9 @@ TARGET_INC+= options.h .if ${TARGET_ARCH} == "amd64" TARGET_INC+= i386/biarch64.h .endif +.if ${TARGET_ARCH} == "hppa64" +TARGET_INC+= pa/pa64-start.h +.endif .if ${TARGET_ARCH} == "sh" TARGET_INC+= sh/little.h .endif @@ -74,6 +77,8 @@ TM_DEFINES+= TARGET_ENDIAN_DEFAULT=0 .if ${TARGET_ARCH} == "amd64" TARGET_INC+= ${GCC_CPU}/x86-64.h TARGET_INC+= ${GCC_CPU}/openbsd64.h +.elif ${TARGET_ARCH} == "hppa64" +TARGET_INC+= ${GCC_CPU}/openbsd64.h .elif ${TARGET_ARCH} == "sparc64" TARGET_INC+= ${GCC_CPU}/openbsd64.h .elif ${TARGET_ARCH} == "i386" diff --git a/gnu/usr.bin/cc/libgcc/Makefile b/gnu/usr.bin/cc/libgcc/Makefile index 73a0932af3f..722770d893d 100644 --- a/gnu/usr.bin/cc/libgcc/Makefile +++ b/gnu/usr.bin/cc/libgcc/Makefile @@ -1,5 +1,5 @@ # $FreeBSD: src/gnu/lib/libgcc/Makefile,v 1.58.8.1 2009/04/15 03:14:26 kensmith Exp $ -# $OpenBSD: Makefile,v 1.17 2010/10/23 09:46:30 miod Exp $ +# $OpenBSD: Makefile,v 1.18 2011/08/04 14:46:58 kettenis Exp $ .include <bsd.own.mk> @@ -141,6 +141,13 @@ LIB1ASMSRC = pa/milli64.S LIB2FUNCS_EXTRA = fptr.c .endif +.if ${TARGET_ARCH} == "hppa64" +CFLAGS+= -fPIC -Dpa64=1 -DELF=1 +LIB1ASMFUNCS = _divI _divU _remI _remU _div_const _mulI +LIB1ASMSRC = pa/milli64.S +LIB2FUNCS_EXTRA = fptr.c +.endif + .if ${TARGET_ARCH} == "sh" CFLAGS+= -fpic LIB1ASMSRC = sh/lib1funcs.asm |