From f51dfe4da5c967c6ec1e8b8baabad7748f8dfaa6 Mon Sep 17 00:00:00 2001 From: rupp Date: Fri, 14 Aug 2009 20:38:36 +0000 Subject: [PATCH] * config.gcc (ia64-hp-*vms*): Insert ia64/t-ia64 in tmake_file. * config/ia64/t-vms: New file. * config/ia64/vms64.h: New file. * config/ia64/vms.h: New file. * config/ia64/vms-crtinit.asm: New file. * config/ia64/vms_symvec_libgcc_s.opt: New file. * config/ia64/vms-unwind.h: New file. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@150776 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 11 ++ gcc/config.gcc | 2 +- gcc/config/ia64/t-vms | 49 +++++ gcc/config/ia64/vms-crtinit.asm | 24 +++ gcc/config/ia64/vms-unwind.h | 307 ++++++++++++++++++++++++++++++++ gcc/config/ia64/vms.h | 231 ++++++++++++++++++++++++ gcc/config/ia64/vms64.h | 41 +++++ gcc/config/ia64/vms_symvec_libgcc_s.opt | 89 +++++++++ 8 files changed, 753 insertions(+), 1 deletion(-) create mode 100644 gcc/config/ia64/t-vms create mode 100644 gcc/config/ia64/vms-crtinit.asm create mode 100644 gcc/config/ia64/vms-unwind.h create mode 100644 gcc/config/ia64/vms.h create mode 100644 gcc/config/ia64/vms64.h create mode 100644 gcc/config/ia64/vms_symvec_libgcc_s.opt diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 881903f8461..f89660bbc20 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,14 @@ +2009-08-14 Douglas B Rupp + Tristan Gingold + + * config.gcc (ia64-hp-*vms*): Insert ia64/t-ia64 in tmake_file. + * config/ia64/t-vms: New file. + * config/ia64/vms64.h: New file. + * config/ia64/vms.h: New file. + * config/ia64/vms-crtinit.asm: New file. + * config/ia64/vms_symvec_libgcc_s.opt: New file. + * config/ia64/vms-unwind.h: New file. + 2009-08-14 Uros Bizjak * config/alpha/alpha.c (alpha_emit_conditional_move): Handle diff --git a/gcc/config.gcc b/gcc/config.gcc index d3546774685..c8eb88e1665 100644 --- a/gcc/config.gcc +++ b/gcc/config.gcc @@ -1424,7 +1424,7 @@ ia64*-*-hpux*) ia64-hp-*vms*) tm_file="${tm_file} elfos.h ia64/sysv4.h ia64/elf.h ia64/vms.h ia64/vms64.h" xm_file="vms/xm-vms.h vms/xm-vms64.h" - tmake_file="vms/t-vms vms/t-vms64 ia64/t-vms" + tmake_file="vms/t-vms vms/t-vms64 ia64/t-ia64 ia64/t-vms" xmake_file=vms/x-vms target_cpu_default="0" if test x$gas = xyes diff --git a/gcc/config/ia64/t-vms b/gcc/config/ia64/t-vms new file mode 100644 index 00000000000..d77a2cf3796 --- /dev/null +++ b/gcc/config/ia64/t-vms @@ -0,0 +1,49 @@ +# Copyright (C) 2009 +# 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 +# . + +# Enable the crtbegin/end rules disabled in t-ia64 +T = + +# VMS_EXTRA_PARTS is defined in x-vms and represent object files that +# are only needed for VMS targets, but can only be compiled on a VMS host +# (because they need DEC C). +EXTRA_PARTS = $(VMS_EXTRA_PARTS) crtbegin.o crtbeginS.o crtend.o crtendS.o crtinitS.o + +CRTSTUFF_T_CFLAGS = -O0 +CRTSTUFF_T_CFLAGS_S = -O0 + +$(T)crtinitS.o: $(srcdir)/config/ia64/vms-crtinit.asm $(GCC_PASSES) + $(GCC_FOR_TARGET) -I. -c -o $(T)crtinitS.o -x assembler-with-cpp \ + $(srcdir)/config/ia64/vms-crtinit.asm + +LIB2ADDEH += $(srcdir)/config/ia64/fde-vms.c $(srcdir)/gthr-gnat.c + +# Shared library macros +shlib_version:=$(shell echo $(BASEVER_c) | sed -e 's/\./,/' -e 's/\.//g') +SHLIB_EXT = .exe +SHLIB_OBJS = @shlib_objs@ +SHLIB_NAME = @shlib_base_name@.exe +SHLIB_MULTILIB = +SHLIB_INSTALL = $(INSTALL_DATA) $(SHLIB_NAME) $$(DESTDIR)$$(libsubdir)/$(SHLIB_ NAME) +SHLIB_LINK = \ + $(GCC_FOR_TARGET) $(LIBGCC2_CFLAGS) -nodefaultlibs \ + -shared --for-linker=/noinform -o $(SHLIB_NAME) $(SHLIB_OBJS) \ + --for-linker=$(srcdir)/config/ia64/VMS_SYMVEC_@shlib_base_name@.opt \ + --for-linker=gsmatch=equal,$(shlib_version) + diff --git a/gcc/config/ia64/vms-crtinit.asm b/gcc/config/ia64/vms-crtinit.asm new file mode 100644 index 00000000000..322b2927347 --- /dev/null +++ b/gcc/config/ia64/vms-crtinit.asm @@ -0,0 +1,24 @@ +/* Copyright (C) 2009 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. + + Under Section 7 of GPL version 3, you are granted additional + permissions described in the GCC Runtime Library Exception, version + 3.1, as published by the Free Software Foundation. + + You should have received a copy of the GNU General Public License and + a copy of the GCC Runtime Library Exception along with this program; + see the files COPYING3 and COPYING.RUNTIME respectively. If not, see + . */ + + .global LIB$INITIALIZE# diff --git a/gcc/config/ia64/vms-unwind.h b/gcc/config/ia64/vms-unwind.h new file mode 100644 index 00000000000..41c76ae768c --- /dev/null +++ b/gcc/config/ia64/vms-unwind.h @@ -0,0 +1,307 @@ +/* DWARF2 EH unwinding support for IA64 VMS. + Copyright (C) 2005-2009 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. + + Under Section 7 of GPL version 3, you are granted additional + permissions described in the GCC Runtime Library Exception, version + 3.1, as published by the Free Software Foundation. + + You should have received a copy of the GNU General Public License and + a copy of the GCC Runtime Library Exception along with this program; + see the files COPYING3 and COPYING.RUNTIME respectively. If not, see + . */ + +#include +#include +#include + +#define __int64 long long +#include + +#include +#include + +#define DYN$C_SSENTRY 66 +/* ??? would rather get the proper header file. */ + +#define MD_FALLBACK_FRAME_STATE_FOR ia64_vms_fallback_frame_state + +extern INVO_CONTEXT_BLK * LIB$I64_CREATE_INVO_CONTEXT (void); + +extern int LIB$I64_IS_EXC_DISPATCH_FRAME (void *); +extern int LIB$I64_IS_AST_DISPATCH_FRAME (void *); + +extern int LIB$I64_INIT_INVO_CONTEXT (INVO_CONTEXT_BLK *, int, int); +extern int LIB$I64_GET_CURR_INVO_CONTEXT (INVO_CONTEXT_BLK *); +extern int LIB$I64_GET_PREV_INVO_CONTEXT (INVO_CONTEXT_BLK *); + +typedef unsigned long ulong; +typedef unsigned int uint; +typedef unsigned long uw_reg; +typedef uw_reg * uw_loc; + +typedef char fp_reg[16]; + +#define DENOTES_VMS_DISPATCHER_FRAME(icb) \ +(LIB$I64_IS_EXC_DISPATCH_FRAME (&(icb)->libicb$ih_pc)) + +#define DENOTES_BOTTOM_OF_STACK(icb) ((icb)->libicb$v_bottom_of_stack) + +#define FAIL_IF(COND) \ + do { if (COND) { context->rp = 0; return _URC_END_OF_STACK; } } while (0) +/* Clearing context->rp is required to prevent the ia64 gcc unwinder from + attempting to keep on walking the call chain. */ + +static int +ia64_vms_fallback_frame_state (struct _Unwind_Context *context, + _Unwind_FrameState *fs) +{ + int i, status; + + INVO_CONTEXT_BLK local_icb; + INVO_CONTEXT_BLK *icb = &local_icb; + + CHFCTX * chfctx; + CHF$MECH_ARRAY * chfmech; + CHF64$SIGNAL_ARRAY *chfsig64; + INTSTK * intstk; + + static int eh_debug = -1; + int try_bs_copy = 0; + /* Non zero to attempt copy of alternate backing store contents for + dirty partition in interrupted context. ??? Alpha code, only activated + on specific request via specific bit in EH_DEBUG. */ + + if (eh_debug == -1) + { + char * EH_DEBUG = getenv ("EH_DEBUG"); + const uint try_bs_copy_mask = (1 << 16); + + eh_debug = EH_DEBUG ? atoi (EH_DEBUG) : 0; + + /* Fetch and clear the try_bs_copy bit. */ + try_bs_copy = (uint)eh_debug & try_bs_copy_mask; + eh_debug &= ~try_bs_copy_mask; + } + + /* We're called to attempt unwinding through a frame for which no unwind + info is available, typical of an operating system exception dispatcher + frame. The code below knows how to handle this case, and only this one, + returning a failure code if it finds it is not in this situation. + + Note that we're called from deep down in the exception propagation call + chain, possibly below an exception dispatcher but for a frame above it + like some os entry point. */ + + if (eh_debug) + printf ("FALLBACK - ctxt->rp=0x%lx, sp=0x%lx, psp=0x%lx, bsp=0x%lx\n", + context->rp, context->sp, context->psp, context->bsp); + + /* Step 0 : + ------------------------------------------------------------------------- + VMS-unwind up until we reach a VMS dispatcher frame corresponding to the + context we are trying to unwind through. Fail if get past this context or + if we reach the bottom of stack along the way. + ------------------------------------------------------------------------- + */ + + status = LIB$I64_INIT_INVO_CONTEXT (icb, LIBICB$K_INVO_CONTEXT_VERSION, 0); + FAIL_IF (status == 0); + + status = LIB$I64_GET_CURR_INVO_CONTEXT (icb); + + /* Beware: we might be unwinding through nested condition handlers, so the + dispatcher frame we seek might not be the first one on the way up. Loop + thus. */ + do { + + /* Seek the next dispatcher frame up the "current" point. Stop if we + either get past the target context or hit the bottom-of-stack along + the way. */ + status = LIB$I64_GET_PREV_INVO_CONTEXT (icb); + FAIL_IF (status == 0); + FAIL_IF ((uw_reg)icb->libicb$ih_sp > (uw_reg)context->psp + || DENOTES_BOTTOM_OF_STACK (icb)); + + if (eh_debug) + printf ("frame%s sp @ 0x%llx, pc @ 0x%llx bsp=0x%llx\n", + DENOTES_VMS_DISPATCHER_FRAME (icb) ? " (dispatcher)" : "", + icb->libicb$ih_sp, icb->libicb$ih_pc, icb->libicb$ih_bsp); + + /* Continue until the target frame is found. */ + } while ((uw_reg)icb->libicb$ih_bsp != (uw_reg)context->bsp); + + /* If this is not a dispatcher frame, this is certainly a frame for a leaf + subprogram. Use default unwind information. */ + if (! DENOTES_VMS_DISPATCHER_FRAME (icb)) + return _URC_END_OF_STACK; + + /* At this point, we know we are really trying to unwind past an exception + dispatcher frame, and have it described in ICB. Proceed. */ + + /* Step 1 : + ------------------------------------------------------------------------ + We have the VMS dispatcher frame ICB handy and know we are trying to + unwind past it. Fetch pointers to useful datastructures from there, then + unwind one step further up to the interrupted user context from which + some required values will be easily accessible. + ------------------------------------------------------------------------ + */ + + chfctx = icb->libicb$ph_chfctx_addr; + FAIL_IF (chfctx == 0); + + chfmech = (CHF$MECH_ARRAY *)chfctx->chfctx$q_mcharglst; + FAIL_IF (chfmech == 0); + + chfsig64 = (CHF64$SIGNAL_ARRAY *)chfmech->chf$ph_mch_sig64_addr; + FAIL_IF (chfsig64 == 0); + + intstk = (INTSTK *)chfmech->chf$q_mch_esf_addr; + FAIL_IF (intstk == 0 || intstk->intstk$b_subtype == DYN$C_SSENTRY); + + status = LIB$I64_GET_PREV_INVO_CONTEXT (icb); + FAIL_IF (status == 0); + + if (eh_debug) + printf ("User frame, " + "chfmech @ 0x%lx, chfsig64 @ 0x%lx, intstk @ 0x%lx\n", + (ulong)chfmech, (ulong)chfsig64, (ulong)intstk); + + /* Step 2 : + ------------------------------------------------------------------------ + Point the GCC context locations/values required for further unwinding at + their corresponding locations/values in the datastructures at hand. + ------------------------------------------------------------------------ + */ + + /* Static General Register locations, including scratch registers in case + the unwinder needs to refer to a value stored in one of them. */ + { + uw_reg * ctxregs = (uw_reg *)&intstk->intstk$q_regbase; + + for (i = 2; i <= 3; i++) + context->ireg[i - 2].loc = (uw_loc)&ctxregs[i]; + for (i = 8; i <= 11; i++) + context->ireg[i - 2].loc = (uw_loc)&ctxregs[i]; + for (i = 14; i <= 31; i++) + context->ireg[i - 2].loc = (uw_loc)&ctxregs[i]; + } + + /* Static Floating Point Register locations, as available from the + mechargs array, which happens to include all the to be preserved + ones + others. */ + { + fp_reg * ctxregs; + + ctxregs = (fp_reg *)&chfmech->chf$fh_mch_savf2; + for (i = 2; i <= 5 ; i++) + context->fr_loc[i - 2] = (uw_loc)&ctxregs[i - 2]; + + ctxregs = (fp_reg *)&chfmech->chf$fh_mch_savf12; + for (i = 12; i <= 31 ; i++) + context->fr_loc[i - 2] = (uw_loc)&ctxregs[i - 12]; + } + + /* Relevant application register locations. */ + + context->fpsr_loc = (uw_loc)&intstk->intstk$q_fpsr; + context->lc_loc = (uw_loc)&intstk->intstk$q_lc; + context->unat_loc = (uw_loc)&intstk->intstk$q_unat; + + /* Branch register locations. */ + + { + uw_reg * ctxregs = (uw_reg *)&intstk->intstk$q_b0; + + for (i = 0; i < 8; i++) + context->br_loc[i] = (uw_loc)&ctxregs[i]; + } + + /* Necessary register values. */ + + /* ??? Still unclear if we need to account for possible flushes to an + alternate backing store (maybe the unwinding performed above did the + trick already) and how this would be handled. Blind alpha tentative + below for experimentation purposes in malfunctioning cases. */ + { + ulong q_bsp = (ulong) intstk->intstk$q_bsp; + ulong q_bspstore = (ulong) intstk->intstk$q_bspstore; + ulong q_bspbase = (ulong) intstk->intstk$q_bspbase; + ulong ih_bspbase = (ulong) icb->libicb$ih_bspbase; + + if (eh_debug) + printf ("q_bspstore = 0x%lx, q_bsp = 0x%lx, q_bspbase = 0x%lx\n" + "ih_bspbase = 0x%lx\n", + q_bspstore, q_bsp, q_bspbase, ih_bspbase); + + /* We witness many situations where q_bspbase is set while ih_bspbase is + null, and every attempt made with q_bspbase badly failed while doing + nothing resulted in proper behavior. */ + if (q_bspstore < q_bsp && ih_bspbase && try_bs_copy) + { + ulong dirty_size = q_bsp - q_bspstore; + ulong q_rnat = (ulong) intstk->intstk$q_rnat; + + if (eh_debug) + printf ("Attempting an alternate backing store copy ...\n"); + + ia64_copy_rbs + (context, q_bspstore, ih_bspbase, dirty_size, q_rnat); + /* Not clear if these are the proper arguments here. This is what + looked the closest to what is performed in the Linux case. */ + } + + } + + context->bsp = (uw_reg)intstk->intstk$q_bsp; + fs->no_reg_stack_frame = 1; + + context->pr = (uw_reg)intstk->intstk$q_preds; + context->gp = (uw_reg)intstk->intstk$q_gp; + + /* We're directly setting up the "context" for a VMS exception handler. + The "previous SP" for it is the SP upon the handler's entry, that is + the SP at the condition/interruption/exception point. */ + context->psp = (uw_reg)icb->libicb$ih_sp; + + /* Previous Frame State location. What eventually ends up in pfs_loc is + installed with ar.pfs = pfs_loc; br.ret; so setup to target intstk->q_ifs + to have the interrupted context restored and not that of its caller if + we happen to have a handler in the interrupted context itself. */ + fs->curr.reg[UNW_REG_PFS].where = UNW_WHERE_PSPREL; + fs->curr.reg[UNW_REG_PFS].val + = (uw_reg)&intstk->intstk$q_ifs - (uw_reg)context->psp; + fs->curr.reg[UNW_REG_PFS].when = -1; + + /* If we need to unwind further up, past the interrupted context, we need to + hand out the interrupted context's pfs, still. */ + context->signal_pfs_loc = (uw_loc) &intstk->intstk$q_pfs; + + /* Finally, rules for RP . */ + { + uw_reg * post_sigarray + = (uw_reg *)chfsig64 + 1 + chfsig64->chf64$l_sig_args; + + uw_reg * ih_pc_loc = post_sigarray - 2; + + fs->curr.reg[UNW_REG_RP].where = UNW_WHERE_PSPREL; + fs->curr.reg[UNW_REG_RP].val + = (uw_reg)ih_pc_loc - (uw_reg)context->psp; + fs->curr.reg[UNW_REG_RP].when = -1; + } + + return _URC_NO_REASON; +} + diff --git a/gcc/config/ia64/vms.h b/gcc/config/ia64/vms.h new file mode 100644 index 00000000000..da47320999b --- /dev/null +++ b/gcc/config/ia64/vms.h @@ -0,0 +1,231 @@ +/* Definitions of target machine GNU compiler. IA64-VMS version. + Copyright (C) 2003-2009 Free Software Foundation, Inc. + Contributed by Douglas B Rupp (rupp@gnat.com). + +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 +. */ + +#define TARGET_OBJECT_SUFFIX ".obj" +#define TARGET_EXECUTABLE_SUFFIX ".exe" + +#define OBJECT_FORMAT_ELF + +#define TARGET_OS_CPP_BUILTINS() \ + do { \ + builtin_define_std ("vms"); \ + builtin_define_std ("VMS"); \ + builtin_define ("__IA64"); \ + builtin_assert ("system=vms"); \ + builtin_define ("__IEEE_FLOAT"); \ + } while (0) + +/* By default, allow $ to be part of an identifier. */ +#define DOLLARS_IN_IDENTIFIERS 2 + +#undef TARGET_ABI_OPEN_VMS +#define TARGET_ABI_OPEN_VMS 1 + +#undef TARGET_NAME +#define TARGET_NAME "OpenVMS/IA64" +#undef TARGET_VERSION +#define TARGET_VERSION fprintf (stderr, " (%s)", TARGET_NAME); + +/* Need .debug_line info generated from gcc and gas. */ +#undef TARGET_DEFAULT +#define TARGET_DEFAULT (MASK_DWARF2_ASM | MASK_GNU_AS) + +#define VMS_DEBUG_MAIN_POINTER "TRANSFER$BREAK$GO" + +/* "long" is 32 bits, but 64 bits for Ada. */ +#undef LONG_TYPE_SIZE +#define LONG_TYPE_SIZE 32 +#define ADA_LONG_TYPE_SIZE 64 + +/* Pointer is 32 bits but the hardware has 64-bit addresses, sign extended. */ +#undef POINTER_SIZE +#define POINTER_SIZE 32 +#define POINTERS_EXTEND_UNSIGNED 0 + +#undef MAX_OFILE_ALIGNMENT +#define MAX_OFILE_ALIGNMENT 524288 /* 8 x 2^16 by DEC Ada Test CD40VRA */ + +/* Widest floating-point type efficiently supported by hardware and OS. */ +#undef WIDEST_HARDWARE_FP_SIZE +#define WIDEST_HARDWARE_FP_SIZE 64 + +/* HP OpenVMS Calling Standard dated June, 2004, that describes + HP OpenVMS I64 Version 8.2EFT + chapter 4 "OpenVMS I64 Conventions" + section 4.7 "Procedure Linkage" + subsection 4.7.5.2, "Normal Register Parameters" + + "Unsigned integral (except unsigned 32-bit), set, and VAX + floating-point values passed in registers are zero-filled; + signed integral values as well as unsigned 32-bit integral + values are sign-extended to 64 bits. For all other types + passed in the general registers, unused bits are undefined." */ +#define PROMOTE_FUNCTION_MODE(MODE,UNSIGNEDP,TYPE) \ + if (GET_MODE_CLASS (MODE) == MODE_INT \ + && GET_MODE_SIZE (MODE) < UNITS_PER_WORD) \ + { \ + if ((MODE) == SImode) \ + (UNSIGNEDP) = 0; \ + (MODE) = DImode; \ + } + +/* The structure return address arrives as an "argument" on VMS. */ +#undef PCC_STATIC_STRUCT_RETURN + +/* Turn on VMS specific Dwarf2 features. */ +#define VMS_DEBUGGING_INFO 1 + +#define ASM_OUTPUT_DWARF_DELTA_UNITS(FILE,SIZE,LABEL1,LABEL2,UNITS) \ +do { \ + fprintf (FILE, "\tdata4.ua\t ("); \ + assemble_name (FILE, LABEL1); \ + fprintf (FILE, "-"); \ + assemble_name (FILE, LABEL2); \ + fprintf (FILE, ")/16*3"); \ +} while (0) + +#undef STARTFILE_SPEC +#define STARTFILE_SPEC \ +"%{!shared:%{mvms-return-codes:vcrt0.o%s} %{!mvms-return-codes:pcrt0.o%s} \ + crtbegin.o%s} \ + %{!static:%{shared:crtinitS.o%s crtbeginS.o%s}}" + +#undef ENDFILE_SPEC +#define ENDFILE_SPEC \ +"%{!shared:crtend.o%s} %{!static:%{shared:crtendS.o%s}}" + +#define LINK_GCC_C_SEQUENCE_SPEC "%G" + +#undef LINK_SPEC +#define LINK_SPEC "%{g*} %{map} %{save-temps} %{shared} %{v}" + +#undef LIB_SPEC +#define LIB_SPEC "" + +#undef ASM_SPEC +#define ASM_SPEC \ +"%{mno-gnu-as:-N so -N vms_upcase -W DVLoc_off} %{mconstant-gp:-M const_gp} \ + %{mauto-pic:-M no_plabel} %{source-listing:-ahdl=%b.lis}" + +#undef ASM_OUTPUT_EXTERNAL_LIBCALL +#define ASM_OUTPUT_EXTERNAL_LIBCALL(FILE, FUN) \ +do { \ + (*targetm.asm_out.globalize_label) (FILE, XSTR (FUN, 0)); \ + ASM_OUTPUT_TYPE_DIRECTIVE (FILE, XSTR (FUN, 0), "function"); \ +} while (0) + +/* Set the function to change the names of the division and modulus + functions. */ +#undef TARGET_INIT_LIBFUNCS +#define TARGET_INIT_LIBFUNCS ia64_vms_init_libfuncs + +#define NAME__MAIN "__gccmain" +#define SYMBOL__MAIN __gccmain + +#define CTOR_LIST_BEGIN asm (".global\tLIB$INITIALIZE#\n"); \ +STATIC func_ptr __CTOR_LIST__[1] \ + __attribute__ ((__unused__, section(".ctors"), aligned(sizeof(func_ptr)))) \ + = { (func_ptr) (-1) }; + +#undef INIT_SECTION_ASM_OP +#define INIT_SECTION_ASM_OP ".section\tLIB$INITIALIZE#,\"a\",@progbits" + +#define CRT_CALL_STATIC_FUNCTION(SECTION_OP, FUNC) \ + asm (SECTION_OP "\n\tdata4 @fptr(" #FUNC"#)\n"); \ + FORCE_CODE_SECTION_ALIGN \ + asm (TEXT_SECTION_ASM_OP); + +#undef FINI_SECTION_ASM_OP + +/* Maybe same as HPUX? Needs to be checked. */ +#define JMP_BUF_SIZE (8 * 76) + +typedef struct crtl_name_spec +{ + const char *const name; + const char *deccname; + int referenced; +} crtl_name_spec; + +#include "config/vms/vms-crtl.h" + +/* Alias CRTL names to 32/64bit DECCRTL functions. + Fixme: This should do a binary search. */ +#define DO_CRTL_NAMES \ + do \ + { \ + int i; \ + static crtl_name_spec vms_crtl_names[] = CRTL_NAMES; \ + static int malloc64_init = 0; \ + \ + if ((malloc64_init == 0) && TARGET_MALLOC64) \ + { \ + for (i=0; vms_crtl_names [i].name; i++) \ + { \ + if (strcmp ("calloc", vms_crtl_names [i].name) == 0) \ + vms_crtl_names [i].deccname = "decc$_calloc64"; \ + else \ + if (strcmp ("malloc", vms_crtl_names [i].name) == 0) \ + vms_crtl_names [i].deccname = "decc$_malloc64"; \ + else \ + if (strcmp ("realloc", vms_crtl_names [i].name) == 0) \ + vms_crtl_names [i].deccname = "decc$_realloc64"; \ + else \ + if (strcmp ("strdup", vms_crtl_names [i].name) == 0) \ + vms_crtl_names [i].deccname = "decc$_strdup64"; \ + } \ + malloc64_init = 1; \ + } \ + for (i=0; vms_crtl_names [i].name; i++) \ + if (!vms_crtl_names [i].referenced && \ + (strcmp (name, vms_crtl_names [i].name) == 0)) \ + { \ + fprintf (file, "\t.alias %s, \"%s\"\n", \ + name, vms_crtl_names [i].deccname); \ + vms_crtl_names [i].referenced = 1; \ + } \ + } while (0) + +#undef OPTIMIZATION_OPTIONS +#define OPTIMIZATION_OPTIONS(LEVEL,SIZE) \ + do { \ + flag_merge_constants = 0; \ + ia64_optimization_options ((LEVEL), (SIZE)); \ + } while (0) + +/* Define this to be nonzero if static stack checking is supported. */ +#define STACK_CHECK_STATIC_BUILTIN 1 + +#define MD_UNWIND_SUPPORT "config/ia64/vms-unwind.h" + +#define UNW_IVMS_MODE(HEADER) (((HEADER) >> 44) & 0x3L) +#define MD_UNW_COMPATIBLE_PERSONALITY_P(HEADER) (!UNW_IVMS_MODE (HEADER)) + +/* Minimum amount of stack required to recover from an anticipated stack + overflow detection. The default value conveys an estimate of the amount + of stack required to propagate an exception. */ +#define STACK_CHECK_PROTECT (24 * 1024) + +#undef ASM_OUTPUT_ALIGNED_DECL_COMMON +#define ASM_OUTPUT_ALIGNED_DECL_COMMON(FILE, DECL, NAME, SIZE, ALIGN) \ + ia64_vms_output_aligned_decl_common (FILE, DECL, NAME, SIZE, ALIGN) + +#undef TARGET_ASM_NAMED_SECTION +#define TARGET_ASM_NAMED_SECTION ia64_vms_elf_asm_named_section diff --git a/gcc/config/ia64/vms64.h b/gcc/config/ia64/vms64.h new file mode 100644 index 00000000000..ac1d7a50799 --- /dev/null +++ b/gcc/config/ia64/vms64.h @@ -0,0 +1,41 @@ +/* Definitions of target machine GNU compiler. 64bit IA64-VMS version. + Copyright (C) 2004-2009 Free Software Foundation, Inc. + Contributed by Douglas B Rupp (rupp@gnat.com). + +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 +. */ + +#undef TARGET_OS_CPP_BUILTINS +#define TARGET_OS_CPP_BUILTINS() \ + do { \ + builtin_define_std ("vms"); \ + builtin_define_std ("VMS"); \ + builtin_define ("__IA64"); \ + builtin_assert ("system=vms"); \ + builtin_define ("__IEEE_FLOAT"); \ + builtin_define ("__LONG_POINTERS=1"); \ + } while (0) + +#undef LONG_TYPE_SIZE +#define LONG_TYPE_SIZE 64 + +#undef POINTER_SIZE +#define POINTER_SIZE 64 + +#undef TARGET_DEFAULT +#define TARGET_DEFAULT (MASK_DWARF2_ASM | MASK_GNU_AS | MASK_MALLOC64) + +#include "config/vms/vms-crtl-64.h" diff --git a/gcc/config/ia64/vms_symvec_libgcc_s.opt b/gcc/config/ia64/vms_symvec_libgcc_s.opt new file mode 100644 index 00000000000..88b46dfda6c --- /dev/null +++ b/gcc/config/ia64/vms_symvec_libgcc_s.opt @@ -0,0 +1,89 @@ +! Symbol vector listing all the universal symbols to be exported when +! building libgcc_s.exe shareable image on IVMS for Gcc 3.4.5. +! It would be better to auto-generate this file. + +case_sensitive=yes +SYMBOL_VECTOR=(__divdf3=PROCEDURE) +SYMBOL_VECTOR=(__divdi3=PROCEDURE) +SYMBOL_VECTOR=(__divsf3=PROCEDURE) +SYMBOL_VECTOR=(__divsi3=PROCEDURE) +SYMBOL_VECTOR=(__divxf3=PROCEDURE) +SYMBOL_VECTOR=(__moddi3=PROCEDURE) +SYMBOL_VECTOR=(__modsi3=PROCEDURE) +SYMBOL_VECTOR=(__ia64_nonlocal_goto=PROCEDURE) +SYMBOL_VECTOR=(__ia64_restore_stack_nonlocal=PROCEDURE) +SYMBOL_VECTOR=(__ia64_save_stack_nonlocal=PROCEDURE) +SYMBOL_VECTOR=(__ia64_trampoline=PROCEDURE) +SYMBOL_VECTOR=(__udivdi3=PROCEDURE) +SYMBOL_VECTOR=(__udivsi3=PROCEDURE) +SYMBOL_VECTOR=(__umoddi3=PROCEDURE) +SYMBOL_VECTOR=(__umodsi3=PROCEDURE) +SYMBOL_VECTOR=(__absvti2=PROCEDURE) +SYMBOL_VECTOR=(__absvdi2=PROCEDURE) +SYMBOL_VECTOR=(__absvsi2=PROCEDURE) +SYMBOL_VECTOR=(__addvti3=PROCEDURE) +SYMBOL_VECTOR=(__addvdi3=PROCEDURE) +SYMBOL_VECTOR=(__addvsi3=PROCEDURE) +SYMBOL_VECTOR=(__ashlti3=PROCEDURE) +SYMBOL_VECTOR=(__ashrti3=PROCEDURE) +SYMBOL_VECTOR=(__clear_cache=PROCEDURE) +SYMBOL_VECTOR=(__clzti2=PROCEDURE) +SYMBOL_VECTOR=(__clzdi2=PROCEDURE) +SYMBOL_VECTOR=(__cmpti2=PROCEDURE) +SYMBOL_VECTOR=(__ctzti2=PROCEDURE) +SYMBOL_VECTOR=(__ctzdi2=PROCEDURE) +SYMBOL_VECTOR=(__divti3=PROCEDURE) +SYMBOL_VECTOR=(__enable_execute_stack=PROCEDURE) +SYMBOL_VECTOR=(__ffsti2=PROCEDURE) +SYMBOL_VECTOR=(__ffsdi2=PROCEDURE) +SYMBOL_VECTOR=(__fixdfti=PROCEDURE) +SYMBOL_VECTOR=(__fixsfti=PROCEDURE) +SYMBOL_VECTOR=(__fixunsdfti=PROCEDURE) +SYMBOL_VECTOR=(__fixunsdfdi=PROCEDURE) +SYMBOL_VECTOR=(__fixunssfti=PROCEDURE) +SYMBOL_VECTOR=(__fixunssfdi=PROCEDURE) +SYMBOL_VECTOR=(__floattidf=PROCEDURE) +SYMBOL_VECTOR=(__floattisf=PROCEDURE) +SYMBOL_VECTOR=(__lshrti3=PROCEDURE) +SYMBOL_VECTOR=(__modti3=PROCEDURE) +SYMBOL_VECTOR=(__multi3=PROCEDURE) +SYMBOL_VECTOR=(__mulvti3=PROCEDURE) +SYMBOL_VECTOR=(__mulvdi3=PROCEDURE) +SYMBOL_VECTOR=(__mulvsi3=PROCEDURE) +SYMBOL_VECTOR=(__negti2=PROCEDURE) +SYMBOL_VECTOR=(__negvti2=PROCEDURE) +SYMBOL_VECTOR=(__negvdi2=PROCEDURE) +SYMBOL_VECTOR=(__negvsi2=PROCEDURE) +SYMBOL_VECTOR=(__parityti2=PROCEDURE) +SYMBOL_VECTOR=(__paritydi2=PROCEDURE) +SYMBOL_VECTOR=(__popcountti2=PROCEDURE) +SYMBOL_VECTOR=(__popcountdi2=PROCEDURE) +SYMBOL_VECTOR=(__subvti3=PROCEDURE) +SYMBOL_VECTOR=(__subvdi3=PROCEDURE) +SYMBOL_VECTOR=(__subvsi3=PROCEDURE) +SYMBOL_VECTOR=(__ucmpti2=PROCEDURE) +SYMBOL_VECTOR=(__udiv_w_sdiv=PROCEDURE) +SYMBOL_VECTOR=(__udivti3=PROCEDURE) +SYMBOL_VECTOR=(__udivmodti4=PROCEDURE) +SYMBOL_VECTOR=(__umodti3=PROCEDURE) +SYMBOL_VECTOR=(__gthread_active_p=PROCEDURE) +SYMBOL_VECTOR=(__gthread_mutex_lock=PROCEDURE) +SYMBOL_VECTOR=(__gthread_mutex_unlock=PROCEDURE) +SYMBOL_VECTOR=(__gcc_personality_v0=PROCEDURE) +SYMBOL_VECTOR=(_Unwind_GetGR=PROCEDURE) +SYMBOL_VECTOR=(_Unwind_SetGR=PROCEDURE) +SYMBOL_VECTOR=(_Unwind_GetIP=PROCEDURE) +SYMBOL_VECTOR=(_Unwind_GetIPInfo=PROCEDURE) +SYMBOL_VECTOR=(_Unwind_SetIP=PROCEDURE) +SYMBOL_VECTOR=(_Unwind_GetLanguageSpecificData=PROCEDURE) +SYMBOL_VECTOR=(_Unwind_GetRegionStart=PROCEDURE) +SYMBOL_VECTOR=(_Unwind_FindEnclosingFunction=PROCEDURE) +SYMBOL_VECTOR=(_Unwind_GetCFA=PROCEDURE) +SYMBOL_VECTOR=(_Unwind_GetBSP=PROCEDURE) +SYMBOL_VECTOR=(_Unwind_RaiseException=PROCEDURE) +SYMBOL_VECTOR=(_Unwind_ForcedUnwind=PROCEDURE) +SYMBOL_VECTOR=(_Unwind_Resume=PROCEDURE) +SYMBOL_VECTOR=(_Unwind_Resume_or_Rethrow=PROCEDURE) +SYMBOL_VECTOR=(_Unwind_DeleteException=PROCEDURE) +SYMBOL_VECTOR=(_Unwind_Backtrace=PROCEDURE) +case_sensitive=NO -- 2.11.0