From 0dbcfe49a248a7cf65c27113faa7297fd98882e7 Mon Sep 17 00:00:00 2001 From: rupp Date: Mon, 10 Aug 2009 04:05:54 +0000 Subject: [PATCH] * 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. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@150610 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 23 +++++++++++++++++++++++ gcc/config/alpha/alpha.c | 2 +- gcc/config/alpha/t-vms | 35 +++++++++++++++++++++++++++++++---- gcc/config/alpha/vms-dwarf2eh.asm | 2 -- gcc/config/alpha/vms.h | 23 +++++++++++++++++++++-- 5 files changed, 76 insertions(+), 9 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index d49ba9c81f6..19382f45e08 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,5 +1,28 @@ 2009-08-09 Douglas B Rupp + * 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 + * 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 diff --git a/gcc/config/alpha/alpha.c b/gcc/config/alpha/alpha.c index 7658a02c87f..829160723f1 100644 --- a/gcc/config/alpha/alpha.c +++ b/gcc/config/alpha/alpha.c @@ -10792,7 +10792,7 @@ alpha_init_libfuncs (void) /* 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 diff --git a/gcc/config/alpha/t-vms b/gcc/config/alpha/t-vms index a323a646ff6..e11051278f0 100644 --- a/gcc/config/alpha/t-vms +++ b/gcc/config/alpha/t-vms @@ -17,10 +17,8 @@ # along with GCC; see the file COPYING3. If not see # . -# 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. @@ -32,5 +30,34 @@ $(T)vms-dwarf2eh.o : $(srcdir)/config/alpha/vms-dwarf2eh.asm 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) diff --git a/gcc/config/alpha/vms-dwarf2eh.asm b/gcc/config/alpha/vms-dwarf2eh.asm index 76650ae9048..e0eaf9d3741 100644 --- a/gcc/config/alpha/vms-dwarf2eh.asm +++ b/gcc/config/alpha/vms-dwarf2eh.asm @@ -28,5 +28,3 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see .section .eh_frame,NOWRT .align 0 - .global __EH_FRAME_BEGIN__ -__EH_FRAME_BEGIN__: diff --git a/gcc/config/alpha/vms.h b/gcc/config/alpha/vms.h index 8238fbb2031..ff5e5d238af 100644 --- a/gcc/config/alpha/vms.h +++ b/gcc/config/alpha/vms.h @@ -22,6 +22,10 @@ along with GCC; see the file COPYING3. If not see #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 @@ -202,9 +206,17 @@ typedef struct {int num_args; enum avms_arg_type atypes[6];} avms_arg_info; #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 () @@ -335,8 +347,13 @@ do { \ %{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" @@ -344,4 +361,6 @@ do { \ #define NAME__MAIN "__gccmain" #define SYMBOL__MAIN __gccmain +#define INIT_SECTION_ASM_OP "\t.section LIB$INITIALIZE,GBL,NOWRT" + #define LONGLONG_STANDALONE 1 -- 2.11.0