From 7a362db4f35d5fce6e36b789eac289b3102e5ed1 Mon Sep 17 00:00:00 2001 From: thorpej Date: Sun, 16 Dec 2001 04:06:51 +0000 Subject: [PATCH] After discussing the entry point issue w/ rth@redhat.com, add an elf64alpha_nbsd linker emulation that sets the entry point correctly for NetBSD. --- gnu/dist/toolchain/ld/Makefile.am | 4 ++ gnu/dist/toolchain/ld/Makefile.in | 4 ++ gnu/dist/toolchain/ld/configure.tgt | 2 +- .../toolchain/ld/emulparams/elf64alpha.sh | 2 +- .../ld/emulparams/elf64alpha_nbsd.sh | 66 +++++++++++++++++++ 5 files changed, 76 insertions(+), 2 deletions(-) create mode 100644 gnu/dist/toolchain/ld/emulparams/elf64alpha_nbsd.sh diff --git a/gnu/dist/toolchain/ld/Makefile.am b/gnu/dist/toolchain/ld/Makefile.am index 1f71f57a3b9b..fd769fce82f8 100644 --- a/gnu/dist/toolchain/ld/Makefile.am +++ b/gnu/dist/toolchain/ld/Makefile.am @@ -255,6 +255,7 @@ ALL_64_EMULATIONS = \ eelf_x86_64.o \ eelf64_sparc.o \ eelf64alpha.o \ + eelf64alpha_nbsd.o \ eelf64bmip.o \ eelf64btsmip.o \ eelf64ltsmip.o \ @@ -499,6 +500,9 @@ eelf32i370.c: $(srcdir)/emulparams/elf32i370.sh \ eelf64alpha.c: $(srcdir)/emulparams/elf64alpha.sh \ $(srcdir)/emultempl/elf32.em $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS} ${GENSCRIPTS} elf64alpha "$(tdir_elf64alpha)" +eelf64alpha_nbsd.c: $(srcdir)/emulparams/elf64alpha_nbsd.sh \ + $(srcdir)/emultempl/elf32.em $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS} + ${GENSCRIPTS} elf64alpha_nbsd "$(tdir_elf64alpha_nbsd)" eelf64hppa.c: $(srcdir)/emulparams/elf64hppa.sh \ $(srcdir)/emultempl/elf32.em $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS} ${GENSCRIPTS} elf64hppa "$(tdir_elf64hppa)" diff --git a/gnu/dist/toolchain/ld/Makefile.in b/gnu/dist/toolchain/ld/Makefile.in index e7a8743ea1de..f77eb0211a5d 100644 --- a/gnu/dist/toolchain/ld/Makefile.in +++ b/gnu/dist/toolchain/ld/Makefile.in @@ -364,6 +364,7 @@ ALL_64_EMULATIONS = \ eelf_x86_64.o \ eelf64_sparc.o \ eelf64alpha.o \ + eelf64alpha_nbsd.o \ eelf64bmip.o \ eelf64btsmip.o \ eelf64ltsmip.o \ @@ -1213,6 +1214,9 @@ eelf32i370.c: $(srcdir)/emulparams/elf32i370.sh \ eelf64alpha.c: $(srcdir)/emulparams/elf64alpha.sh \ $(srcdir)/emultempl/elf32.em $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS} ${GENSCRIPTS} elf64alpha "$(tdir_elf64alpha)" +eelf64alpha_nbsd.c: $(srcdir)/emulparams/elf64alpha_nbsd.sh \ + $(srcdir)/emultempl/elf32.em $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS} + ${GENSCRIPTS} elf64alpha_nbsd "$(tdir_elf64alpha_nbsd)" eelf64hppa.c: $(srcdir)/emulparams/elf64hppa.sh \ $(srcdir)/emultempl/elf32.em $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS} ${GENSCRIPTS} elf64hppa "$(tdir_elf64hppa)" diff --git a/gnu/dist/toolchain/ld/configure.tgt b/gnu/dist/toolchain/ld/configure.tgt index df21a9a61f72..652cd7a8215c 100644 --- a/gnu/dist/toolchain/ld/configure.tgt +++ b/gnu/dist/toolchain/ld/configure.tgt @@ -337,7 +337,7 @@ alpha*-*-linux-gnu*) targ_emul=elf64alpha targ_extra_emuls=alpha alpha*-*-osf*) targ_emul=alpha ;; alpha*-*-gnu*) targ_emul=elf64alpha ;; alpha*-*-netware*) targ_emul=alpha ;; -alpha*-*-netbsd*) targ_emul=elf64alpha ;; +alpha*-*-netbsd*) targ_emul=elf64alpha_nbsd ;; z8k-*-coff) targ_emul=z8002; targ_extra_emuls=z8001 ;; ns32k-pc532-mach* | ns32k-pc532-ux*) targ_emul=pc532macha ;; ns32k-*-netbsd* | ns32k-pc532-lites*) targ_emul=ns32knbsd ;; diff --git a/gnu/dist/toolchain/ld/emulparams/elf64alpha.sh b/gnu/dist/toolchain/ld/emulparams/elf64alpha.sh index 47fb3949abc0..5c69816b2b79 100644 --- a/gnu/dist/toolchain/ld/emulparams/elf64alpha.sh +++ b/gnu/dist/toolchain/ld/emulparams/elf64alpha.sh @@ -1,4 +1,4 @@ -ENTRY=__start +ENTRY=_start SCRIPT_NAME=elf ELFSIZE=64 TEMPLATE_NAME=elf32 diff --git a/gnu/dist/toolchain/ld/emulparams/elf64alpha_nbsd.sh b/gnu/dist/toolchain/ld/emulparams/elf64alpha_nbsd.sh new file mode 100644 index 000000000000..47fb3949abc0 --- /dev/null +++ b/gnu/dist/toolchain/ld/emulparams/elf64alpha_nbsd.sh @@ -0,0 +1,66 @@ +ENTRY=__start +SCRIPT_NAME=elf +ELFSIZE=64 +TEMPLATE_NAME=elf32 +OUTPUT_FORMAT="elf64-alpha" +TEXT_START_ADDR="0x120000000" +MAXPAGESIZE=0x10000 +NONPAGED_TEXT_START_ADDR="0x120000000" +ARCH=alpha +MACHINE= +GENERATE_SHLIB_SCRIPT=yes +DATA_PLT= +NOP=0x47ff041f + +OTHER_READONLY_SECTIONS='.reginfo : { *(.reginfo) }' + +# This code gets inserted into the generic elf32.sc linker script +# and allows us to define our own command line switches. +PARSE_AND_LIST_PROLOGUE=' +#define OPTION_TASO 300 +/* Set the start address as in the Tru64 ld */ +#define ALPHA_TEXT_START_32BIT 0x12000000 + +static int elf64alpha_32bit = 0; + +struct ld_emulation_xfer_struct ld_elf64alpha_emulation; +static void gld_elf64alpha_finish (); +' + +PARSE_AND_LIST_LONGOPTS=' + {"taso", no_argument, NULL, OPTION_TASO}, +' + +PARSE_AND_LIST_OPTIONS=' + fprintf (file, _(" -taso\t\t\tLoad executable in the lower 31-bit addressable\n")); + fprintf (file, _("\t\t\t virtual address range\n")); +' + +PARSE_AND_LIST_ARGS_CASES=' + case EOF: + if (elf64alpha_32bit && !link_info.shared && !link_info.relocateable) + { + lang_section_start (".interp", + exp_binop ('\''+'\'', + exp_intop (ALPHA_TEXT_START_32BIT), + exp_nameop (SIZEOF_HEADERS, NULL))); + ld_elf64alpha_emulation.finish = gld_elf64alpha_finish; + } + return 0; + + case OPTION_TASO: + elf64alpha_32bit = 1; + break; +' + +PARSE_AND_LIST_EPILOGUE=' +#include "elf/internal.h" +#include "elf/alpha.h" +#include "elf-bfd.h" + +static void +gld_elf64alpha_finish() +{ + elf_elfheader (output_bfd)->e_flags |= EF_ALPHA_32BIT; +} +'