* config/alpha/alpha.c (TARGET_ASM_UNALIGNED_*_OP): Define if on VMS.
* config/alpha/vms.h (OBJECT_FORMAT_ELF): Define.
(ASM_WEAKEN_LABEL): Define.
(CRT_CALL_STATIC_FUNCTION): Define.
(STARTFILE_SPEC): Add crtbegin.o crtbeginS.o.
(ENDFILE_SPEC): Define.
(INIT_SECTION_ASM_OP): Define.
* config/alpha/vms-dwarf2eh.asm (__EH_FRAME_BEGIN__): Remove.
* config/alpha/t-vms (EXTRA_PARTS): Add crtbegin.o crtbeginS.o
crtend.o crtendS.o.
(MULTILIB_OSDIRNAMES): Define.
(shlib_version): Define.
(SHLIB_EXT): Define.
(SHLIB_OBJS): Define.
(SHLIB_NAME): Define.
(SHLIB_MULTILIB): Define.
(SHLIB_INSTALL): Define.
(SHLIB_SYMVEC): Define.
(SHLIB_SYMVECX2): Define.
(SHLIB_LINK): Define.
From-SVN: r150610
2009-08-09 Douglas B Rupp <rupp@gnat.com>
+ * config/alpha/alpha.c (TARGET_ASM_UNALIGNED_*_OP): Define if on VMS.
+ * config/alpha/vms.h (OBJECT_FORMAT_ELF): Define.
+ (ASM_WEAKEN_LABEL): Define.
+ (CRT_CALL_STATIC_FUNCTION): Define.
+ (STARTFILE_SPEC): Add crtbegin.o crtbeginS.o.
+ (ENDFILE_SPEC): Define.
+ (INIT_SECTION_ASM_OP): Define.
+ * config/alpha/vms-dwarf2eh.asm (__EH_FRAME_BEGIN__): Remove.
+ * config/alpha/t-vms (EXTRA_PARTS): Add crtbegin.o crtbeginS.o
+ crtend.o crtendS.o.
+ (MULTILIB_OSDIRNAMES): Define.
+ (shlib_version): Define.
+ (SHLIB_EXT): Define.
+ (SHLIB_OBJS): Define.
+ (SHLIB_NAME): Define.
+ (SHLIB_MULTILIB): Define.
+ (SHLIB_INSTALL): Define.
+ (SHLIB_SYMVEC): Define.
+ (SHLIB_SYMVECX2): Define.
+ (SHLIB_LINK): Define.
+
+2009-08-09 Douglas B Rupp <rupp@gnat.com>
+
* config/alpha/alpha.c (alpha_initialize_trampoline):
Initialize VMS trampoline IAW ABI for bounded procedure calls.
(alpha_start_function): Emit transfer address on nested functions
/* Default unaligned ops are provided for ELF systems. To get unaligned
data for non-ELF systems, we have to turn off auto alignment. */
-#ifndef OBJECT_FORMAT_ELF
+#if !defined (OBJECT_FORMAT_ELF) || TARGET_ABI_OPEN_VMS
#undef TARGET_ASM_UNALIGNED_HI_OP
#define TARGET_ASM_UNALIGNED_HI_OP "\t.align 0\n\t.word\t"
#undef TARGET_ASM_UNALIGNED_SI_OP
# along with GCC; see the file COPYING3. If not see
# <http://www.gnu.org/licenses/>.
-# 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-dwarf2.o vms-dwarf2eh.o $(VMS_EXTRA_PARTS)
+EXTRA_PARTS = vms-dwarf2.o vms-dwarf2eh.o $(VMS_EXTRA_PARTS) \
+ crtbegin.o crtbeginS.o crtend.o crtendS.o
# This object must be linked with in order to make the executable debuggable.
# vms-ld handles it automatically when passed -g.
MULTILIB_OPTIONS = mcpu=ev6
MULTILIB_DIRNAMES = ev6
+MULTILIB_OSDIRNAMES = ev6
LIBGCC = stmp-multilib
INSTALL_LIBGCC = install-multilib
+
+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_SYMVEC = \
+ grep -F -e "\$$BSS\$$" -e "\$$DATA\$$" -e " sdata " -e " data.rel " -e " data.rel.ro " -e " sbss " \
+ -e "\$$LINK\$$" -e "\$$READONLY\$$" | \
+ sed -e "s/.*\$$LINK\$$ \(.*\)/SYMBOL_VECTOR=(\1=PROCEDURE)/" \
+ -e "s/.*\$$DATA\$$ \(.*\)/SYMBOL_VECTOR=(\1=DATA)/" \
+ -e "s/.* sbss \(.*\)/SYMBOL_VECTOR=(\1=DATA)/" \
+ -e "s/.* sdata \(.*\)/SYMBOL_VECTOR=(\1=DATA)/" \
+ -e "s/.* data.rel \(.*\)/SYMBOL_VECTOR=(\1=DATA)/" \
+ -e "s/.* data.rel.ro \(.*\)/SYMBOL_VECTOR=(\1=DATA)/" \
+ -e "s/.*\$$BSS\$$ \(.*\)/SYMBOL_VECTOR=(\1=DATA)/" \
+ -e "s/.*\$$READONLY\$$ \(.*\)/SYMBOL_VECTOR=(\1=DATA)/"
+SHLIB_SYMVECX2 := $(subst $$,$$$$,$(SHLIB_SYMVEC))
+SHLIB_LINK = \
+ echo "case_sensitive=yes" > SYMVEC_$$$$$$$$.opt; \
+ objdump --syms $(SHLIB_OBJS) | \
+ $(SHLIB_SYMVECX2) >> SYMVEC_$$$$$$$$.opt ; \
+ echo "case_sensitive=NO" >> SYMVEC_$$$$$$$$.opt; \
+ $(GCC_FOR_TARGET) $(LIBGCC2_CFLAGS) -nodefaultlibs \
+ -shared --for-linker=/noinform -o $(SHLIB_NAME) $(SHLIB_OBJS) \
+ --for-linker=SYMVEC_$$$$$$$$.opt \
+ --for-linker=gsmatch=equal,$(shlib_version)
.section .eh_frame,NOWRT
.align 0
- .global __EH_FRAME_BEGIN__
-__EH_FRAME_BEGIN__:
#define TARGET_OBJECT_SUFFIX ".obj"
#define TARGET_EXECUTABLE_SUFFIX ".exe"
+/* Alpha/VMS object format is not really Elf, but this makes compiling
+ crtstuff.c and dealing with shared library initialization much easier. */
+#define OBJECT_FORMAT_ELF
+
/* This enables certain macros in alpha.h, which will make an indirect
reference to an external symbol an invalid address. This needs to be
defined before we include alpha.h, since it determines which macros
#undef STACK_CHECK_BUILTIN
#define STACK_CHECK_BUILTIN 0
+#undef ASM_WEAKEN_LABEL
+#define ASM_WEAKEN_LABEL(FILE, NAME) \
+ do { fputs ("\t.weak\t", FILE); assemble_name (FILE, NAME); \
+ fputc ('\n', FILE); } while (0)
+
#define READONLY_DATA_SECTION_ASM_OP "\t.rdata"
#define CTORS_SECTION_ASM_OP "\t.ctors"
#define DTORS_SECTION_ASM_OP "\t.dtors"
+#define SDATA_SECTION_ASM_OP "\t.sdata"
+#define CRT_CALL_STATIC_FUNCTION(SECTION_OP, FUNC) \
+ asm (SECTION_OP "\n\t.long " #FUNC"\n");
#undef ASM_OUTPUT_ADDR_DIFF_ELT
#define ASM_OUTPUT_ADDR_DIFF_ELT(FILE, BODY, VALUE, REL) gcc_unreachable ()
%{g2:-g2 vms-dwarf2.o%s} %{g3:-g3 vms-dwarf2.o%s} %{shared} %{v} %{map}"
#undef STARTFILE_SPEC
-#define STARTFILE_SPEC "%{!shared:%{mvms-return-codes:vcrt0.o%s} \
-%{!mvms-return-codes:pcrt0.o%s}}"
+#define STARTFILE_SPEC \
+"%{!shared:%{mvms-return-codes:vcrt0.o%s} %{!mvms-return-codes:pcrt0.o%s} \
+ crtbegin.o%s} \
+ %{!static:%{shared:crtbeginS.o%s}}"
+
+#define ENDFILE_SPEC \
+"%{!shared:crtend.o%s} %{!static:%{shared:crtendS.o%s}}"
#undef LIB_SPEC
#define LIB_SPEC "-lc"
#define NAME__MAIN "__gccmain"
#define SYMBOL__MAIN __gccmain
+#define INIT_SECTION_ASM_OP "\t.section LIB$INITIALIZE,GBL,NOWRT"
+
#define LONGLONG_STANDALONE 1