diff options
-rw-r--r-- | ld/ChangeLog | 10 | ||||
-rw-r--r-- | ld/Makefile.am | 5 | ||||
-rw-r--r-- | ld/Makefile.in | 6 | ||||
-rw-r--r-- | ld/configure.tgt | 3 | ||||
-rw-r--r-- | ld/emulparams/alphavms.sh | 7 | ||||
-rw-r--r-- | ld/emultempl/vms.em | 123 | ||||
-rw-r--r-- | ld/scripttempl/alphavms.sc | 34 |
7 files changed, 187 insertions, 1 deletions
diff --git a/ld/ChangeLog b/ld/ChangeLog index 7ef05f5..4268690 100644 --- a/ld/ChangeLog +++ b/ld/ChangeLog @@ -1,3 +1,13 @@ +2010-04-14 Tristan Gingold <gingold@adacore.com> + + * emulparams/alphavms.sh: New file. + * emultempl/vms.em: New file. + * scripttempl/alphavms.sc: New file. + * configure.tgt (alpha*-*-*vms*): Added. + * Makefile.am (ALL_EMULATIONS): Add ealphavms.o + (ealphavms.c): New target. + * Makefile.in: Regenerate. + 2010-04-09 Nick Clifton <nickc@redhat.com> * ldlang.c (wild_sort): Remove unused variable section_name. diff --git a/ld/Makefile.am b/ld/Makefile.am index 010fb55..54e9309 100644 --- a/ld/Makefile.am +++ b/ld/Makefile.am @@ -118,6 +118,7 @@ ALL_EMULATIONS = \ eaixppc.o \ eaixrs6.o \ ealpha.o \ + ealphavms.o \ earcelf.o \ earm_epoc_pe.o \ earm_wince_pe.o \ @@ -611,6 +612,10 @@ eaixrs6.c: $(srcdir)/emulparams/aixrs6.sh \ ealpha.c: $(srcdir)/emulparams/alpha.sh \ $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/alpha.sc ${GEN_DEPENDS} ${GENSCRIPTS} alpha "$(tdir_alpha)" +ealphavms.c: $(srcdir)/emulparams/alphavms.sh \ + $(srcdir)/emultempl/vms.em $(srcdir)/scripttempl/alphavms.sc \ + ${GEN_DEPENDS} + ${GENSCRIPTS} alphavms "$(tdir_alphavms)" earcelf.c: $(srcdir)/emulparams/arcelf.sh \ $(ELF_GEN_DEPS) $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS} ${GENSCRIPTS} arcelf "$(tdir_arcelf)" diff --git a/ld/Makefile.in b/ld/Makefile.in index 5bbb899..12c465a 100644 --- a/ld/Makefile.in +++ b/ld/Makefile.in @@ -406,6 +406,7 @@ ALL_EMULATIONS = \ eaixppc.o \ eaixrs6.o \ ealpha.o \ + ealphavms.o \ earcelf.o \ earm_epoc_pe.o \ earm_wince_pe.o \ @@ -924,6 +925,7 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eaixppc.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eaixrs6.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ealpha.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ealphavms.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/earcelf.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/earm_epoc_pe.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/earm_wince_pe.Po@am__quote@ @@ -1962,6 +1964,10 @@ eaixrs6.c: $(srcdir)/emulparams/aixrs6.sh \ ealpha.c: $(srcdir)/emulparams/alpha.sh \ $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/alpha.sc ${GEN_DEPENDS} ${GENSCRIPTS} alpha "$(tdir_alpha)" +ealphavms.c: $(srcdir)/emulparams/alphavms.sh \ + $(srcdir)/emultempl/vms.em $(srcdir)/scripttempl/alphavms.sc \ + ${GEN_DEPENDS} + ${GENSCRIPTS} alphavms "$(tdir_alphavms)" earcelf.c: $(srcdir)/emulparams/arcelf.sh \ $(ELF_GEN_DEPS) $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS} ${GENSCRIPTS} arcelf "$(tdir_arcelf)" diff --git a/ld/configure.tgt b/ld/configure.tgt index c519ba7..def0287 100644 --- a/ld/configure.tgt +++ b/ld/configure.tgt @@ -39,7 +39,8 @@ alpha*-*-osf*) targ_emul=alpha ;; alpha*-*-gnu*) targ_emul=elf64alpha ;; alpha*-*-netware*) targ_emul=alpha ;; alpha*-*-netbsd*) targ_emul=elf64alpha_nbsd ;; -alpha*-*-openbsd*) targ_emul=elf64alpha +alpha*-*-openbsd*) targ_emul=elf64alpha ;; +alpha*-*-*vms*) targ_emul=alphavms ;; arc-*-elf*) targ_emul=arcelf ;; diff --git a/ld/emulparams/alphavms.sh b/ld/emulparams/alphavms.sh new file mode 100644 index 0000000..ac9b3a2 --- /dev/null +++ b/ld/emulparams/alphavms.sh @@ -0,0 +1,7 @@ +SCRIPT_NAME=alphavms + +OUTPUT_FORMAT="vms-alpha" +ARCH=alpha + +COMPILE_IN=yes +EXTRA_EM_FILE=vms
\ No newline at end of file diff --git a/ld/emultempl/vms.em b/ld/emultempl/vms.em new file mode 100644 index 0000000..0b6b059 --- /dev/null +++ b/ld/emultempl/vms.em @@ -0,0 +1,123 @@ +# This shell script emits a C file. -*- C -*- +# Copyright 2010 +# Free Software Foundation, Inc. +# +# This file is part of the GNU Binutils. +# +# This program 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 of the License, or +# (at your option) any later version. +# +# This program 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 this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, +# MA 02110-1301, USA. +# + +# This file is sourced from generic.em. + +fragment <<EOF +static void +gld${EMULATION_NAME}_before_parse (void) +{ + ldfile_set_output_arch ("${ARCH}", bfd_arch_`echo ${ARCH} | sed -e 's/:.*//'`); + config.dynamic_link = TRUE; + config.has_shared = FALSE; /* Not yet. */ +} + +/* This is called before the input files are opened. We add the + standard library. */ + +static void +gld${EMULATION_NAME}_create_output_section_statements (void) +{ + lang_add_input_file ("imagelib", lang_input_file_is_l_enum, NULL); + lang_add_input_file ("starlet", lang_input_file_is_l_enum, NULL); + lang_add_input_file ("sys\$public_vectors", lang_input_file_is_l_enum, NULL); +} + +/* Try to open a dynamic archive. This is where we know that VMS + shared images (dynamic libraries) have an extension of .exe. */ + +static bfd_boolean +gld${EMULATION_NAME}_open_dynamic_archive (const char *arch ATTRIBUTE_UNUSED, + search_dirs_type *search, + lang_input_statement_type *entry) +{ + char *string; + + if (! entry->is_archive) + return FALSE; + + string = (char *) xmalloc (strlen (search->name) + + strlen (entry->filename) + + sizeof "/.exe"); + + sprintf (string, "%s/%s.exe", search->name, entry->filename); + + if (! ldfile_try_open_bfd (string, entry)) + { + free (string); + return FALSE; + } + + entry->filename = string; + + return TRUE; +} + +static int +gld${EMULATION_NAME}_find_potential_libraries + (char *name, lang_input_statement_type *entry) +{ + return ldfile_open_file_search (name, entry, "", ".olb"); +} + +/* Place an orphan section. We use this to put random OVR sections. + Much borrowed from elf32.em. */ + +static lang_output_section_statement_type * +vms_place_orphan (asection *s, + const char *secname ATTRIBUTE_UNUSED, + int constraint ATTRIBUTE_UNUSED) +{ + static struct orphan_save hold_data = + { + "\$DATA\$", + SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_DATA, + 0, 0, 0, 0 + }; + + /* We have nothing to say for anything other than a final link. */ + if (link_info.relocatable + || (s->flags & (SEC_EXCLUDE | SEC_LOAD)) != SEC_LOAD) + return NULL; + + /* Only handle data sections. */ + if ((s->flags & SEC_DATA) == 0) + return NULL; + + if (hold_data.os == NULL) + hold_data.os = lang_output_section_find (hold_data.name); + + if (hold_data.os != NULL) + { + lang_add_section (&hold_data.os->children, s, hold_data.os); + return hold_data.os; + } + else + return NULL; +} +EOF + +LDEMUL_PLACE_ORPHAN=vms_place_orphan +LDEMUL_BEFORE_PARSE=gld"$EMULATION_NAME"_before_parse +LDEMUL_CREATE_OUTPUT_SECTION_STATEMENTS=gld"$EMULATION_NAME"_create_output_section_statements +LDEMUL_FIND_POTENTIAL_LIBRARIES=gld"$EMULATION_NAME"_find_potential_libraries +LDEMUL_OPEN_DYNAMIC_ARCHIVE=gld"$EMULATION_NAME"_open_dynamic_archive diff --git a/ld/scripttempl/alphavms.sc b/ld/scripttempl/alphavms.sc new file mode 100644 index 0000000..ed4ec68 --- /dev/null +++ b/ld/scripttempl/alphavms.sc @@ -0,0 +1,34 @@ +# Linker script for Alpha VMS systems. +# Tristan Gingold <gingold@adacore.com>. + +PAGESIZE=0x10000 + +cat <<EOF +OUTPUT_FORMAT("${OUTPUT_FORMAT}") +${LIB_SEARCH_DIRS} + +SECTIONS +{ + ${RELOCATING+. = ${PAGESIZE};} + + \$DATA\$ ALIGN (${PAGESIZE}) : { + *(\$DATA\$) + *(\$LINK\$) + } + \$BSS\$ ALIGN (${PAGESIZE}) : { + *(\$BSS\$) + } + \$CODE\$ ALIGN (${PAGESIZE}) : { + *(\$CODE\$) + } + \$LITERAL\$ ALIGN (${PAGESIZE}) : { + *(\$LITERAL\$) + *(\$READONLY\$) + *(\$READONLY_ADDR\$) + } + + \$DST\$ 0 : { + *(\$DST\$) + } +} +EOF |