From 3d3d428f048cd724b634cb0252dd187f3fabc627 Mon Sep 17 00:00:00 2001 From: Nick Clifton Date: Fri, 29 Jun 2007 14:09:34 +0000 Subject: New port: National Semiconductor's CR16 --- ld/ChangeLog | 12 +++ ld/Makefile.am | 5 ++ ld/Makefile.in | 13 +++- ld/NEWS | 2 + ld/configure.tgt | 1 + ld/emulparams/elf32cr16.sh | 6 ++ ld/emultempl/cr16elf.em | 92 +++++++++++++++++++++++ ld/scripttempl/elf32cr16.sc | 175 ++++++++++++++++++++++++++++++++++++++++++++ 8 files changed, 302 insertions(+), 4 deletions(-) create mode 100644 ld/emulparams/elf32cr16.sh create mode 100644 ld/emultempl/cr16elf.em create mode 100644 ld/scripttempl/elf32cr16.sc (limited to 'ld') diff --git a/ld/ChangeLog b/ld/ChangeLog index 617a55e..d10cd17 100644 --- a/ld/ChangeLog +++ b/ld/ChangeLog @@ -1,3 +1,15 @@ +2006-06-29 M R Swami Reddy + + * scripttemp/elf32cr16.sc: Default linker script. + * emulparams/elf32cr16.sh: Emulation script. + * emultempl/cr16elf.em: Emulation script. + * Makefile.am: Add entry to make cr16 target. + * Makefile.in: Regenerate. + * configure.tgt: Specify default and other emulation parameters + for cr16. + * ChangeLog: Added CR16 target entry. + * NEWS: Announce the support for the CR16 new target. + 2007-06-27 Alan Modra * pe-dll.c: Rename uses of bfd.next to bfd.archive_next throughout. diff --git a/ld/Makefile.am b/ld/Makefile.am index c30bd28..72dd649 100644 --- a/ld/Makefile.am +++ b/ld/Makefile.am @@ -157,6 +157,7 @@ ALL_EMULATIONS = \ eelf32b4300.o \ eelf32bfin.o \ eelf32bfinfd.o \ + eelf32cr16.o \ eelf32cr16c.o \ eelf32bmip.o \ eelf32bmipn32.o \ @@ -746,6 +747,10 @@ eelf32b4300.c: $(srcdir)/emulparams/elf32b4300.sh \ $(srcdir)/emulparams/elf32bmip.sh $(ELF_DEPS) \ $(srcdir)/emultempl/mipself.em $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS} ${GENSCRIPTS} elf32b4300 "$(tdir_elf32b4300)" +eelf32cr16.c: $(srcdir)/emulparams/elf32cr16.sh \ + $(srcdir)/emultempl/elf32.em $(srcdir)/emultempl/cr16elf.em \ + $(srcdir)/scripttempl/elf32cr16.sc ${GEN_DEPENDS} + ${GENSCRIPTS} elf32cr16 "$(tdir_elf32crx)" eelf32cr16c.c: $(srcdir)/emulparams/elf32cr16c.sh \ $(ELF_DEPS) \ $(srcdir)/scripttempl/elf32cr16c.sc ${GEN_DEPENDS} diff --git a/ld/Makefile.in b/ld/Makefile.in index 05fa46b..69b60c1 100644 --- a/ld/Makefile.in +++ b/ld/Makefile.in @@ -404,6 +404,7 @@ ALL_EMULATIONS = \ eelf32b4300.o \ eelf32bfin.o \ eelf32bfinfd.o \ + eelf32cr16.o \ eelf32cr16c.o \ eelf32bmip.o \ eelf32bmipn32.o \ @@ -734,15 +735,15 @@ $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__confi @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ - echo ' cd $(srcdir) && $(AUTOMAKE) --cygnus '; \ - cd $(srcdir) && $(AUTOMAKE) --cygnus \ + echo ' cd $(srcdir) && $(AUTOMAKE) --foreign '; \ + cd $(srcdir) && $(AUTOMAKE) --foreign \ && exit 0; \ exit 1;; \ esac; \ done; \ - echo ' cd $(top_srcdir) && $(AUTOMAKE) --cygnus Makefile'; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign Makefile'; \ cd $(top_srcdir) && \ - $(AUTOMAKE) --cygnus Makefile + $(AUTOMAKE) --foreign Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ @@ -1572,6 +1573,10 @@ eelf32b4300.c: $(srcdir)/emulparams/elf32b4300.sh \ $(srcdir)/emulparams/elf32bmip.sh $(ELF_DEPS) \ $(srcdir)/emultempl/mipself.em $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS} ${GENSCRIPTS} elf32b4300 "$(tdir_elf32b4300)" +eelf32cr16.c: $(srcdir)/emulparams/elf32cr16.sh \ + $(srcdir)/emultempl/elf32.em $(srcdir)/emultempl/cr16elf.em \ + $(srcdir)/scripttempl/elf32cr16.sc ${GEN_DEPENDS} + ${GENSCRIPTS} elf32cr16 "$(tdir_elf32crx)" eelf32cr16c.c: $(srcdir)/emulparams/elf32cr16c.sh \ $(ELF_DEPS) \ $(srcdir)/scripttempl/elf32cr16c.sc ${GEN_DEPENDS} diff --git a/ld/NEWS b/ld/NEWS index cbce99c..010bde7 100644 --- a/ld/NEWS +++ b/ld/NEWS @@ -1,4 +1,6 @@ -*- text -*- +* Added support for National Semicondutor CompactRISC (ie CR16) target. +* * -l:foo now searches the library path for a filename called foo, without converting it to libfoo.a or libfoo.so. diff --git a/ld/configure.tgt b/ld/configure.tgt index 80383cf..46e05d3 100644 --- a/ld/configure.tgt +++ b/ld/configure.tgt @@ -121,6 +121,7 @@ bfin-*-linux-uclibc*) targ_emul=elf32bfin; targ_extra_emuls="elf32bfinfd" targ_extra_libpath=$targ_extra_emuls ;; +cr16-*-elf*) targ_emul=elf32cr16 ;; cr16c-*-elf*) targ_emul=elf32cr16c ;; cris-*-*aout*) targ_emul=crisaout diff --git a/ld/emulparams/elf32cr16.sh b/ld/emulparams/elf32cr16.sh new file mode 100644 index 0000000..756d02b --- /dev/null +++ b/ld/emulparams/elf32cr16.sh @@ -0,0 +1,6 @@ +SCRIPT_NAME=elf32cr16 +TEMPLATE_NAME=elf32 +OUTPUT_FORMAT="elf32-cr16" +ARCH=cr16 +ENTRY=_start +EXTRA_EM_FILE=cr16elf diff --git a/ld/emultempl/cr16elf.em b/ld/emultempl/cr16elf.em new file mode 100644 index 0000000..0881634 --- /dev/null +++ b/ld/emultempl/cr16elf.em @@ -0,0 +1,92 @@ +# This shell script emits a C file. -*- C -*- +# Copyright 2007 Free Software Foundation, Inc. +# Contributed by M R Swami Reddy +# +# This file is part of GLD, the Gnu Linker. +# +# 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 2 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 elf32.em, and defines extra cr16-elf +# specific routines. +# +cat >>e${EMULATION_NAME}.c < rom + + .fini : + { + __FINI_START = .; + KEEP (*(.fini)) + __FINI_END = .; + } > rom + + .jcr : + { + KEEP (*(.jcr)) + } > rom + + .text : + { + __TEXT_START = .; + *(.text) *(.text.*) *(.gnu.linkonce.t.*) + __TEXT_END = .; + } > rom + + .rdata : + { + __RDATA_START = .; + *(.rdata_4) *(.rdata_2) *(.rdata_1) *(.rdata.*) *(.gnu.linkonce.r.*) *(.rodata*) + __RDATA_END = .; + } > rom + + .ctor ALIGN(4) : + { + __CTOR_START = .; + /* The compiler uses crtbegin.o to find the start + of the constructors, so we make sure it is + first. Because this is a wildcard, it + doesn't matter if the user does not + actually link against crtbegin.o; the + linker won't look for a file to match a + wildcard. The wildcard also means that it + doesn't matter which directory crtbegin.o + is in. */ + + KEEP (*crtbegin*.o(.ctors)) + + /* We don't want to include the .ctor section from + the crtend.o file until after the sorted ctors. + The .ctor section from the crtend file contains the + end of ctors marker and it must be last */ + + KEEP (*(EXCLUDE_FILE (*crtend*.o) .ctors)) + KEEP (*(SORT(.ctors.*))) + KEEP (*(.ctors)) + __CTOR_END = .; + } > rom + + .dtor ALIGN(4) : + { + __DTOR_START = .; + KEEP (*crtbegin*.o(.dtors)) + KEEP (*(EXCLUDE_FILE (*crtend*.o) .dtors)) + KEEP (*(SORT(.dtors.*))) + KEEP (*(.dtors)) + __DTOR_END = .; + } > rom + + .data : + { + __DATA_START = .; + *(.data_4) *(.data_2) *(.data_1) *(.data) *(.data.*) *(.gnu.linkonce.d.*) + __DATA_END = .; + } > ram AT > rom + + .bss (NOLOAD) : + { + __BSS_START = .; + *(.bss_4) *(.bss_2) *(.bss_1) *(.bss) *(COMMON) *(.bss.*) *(.gnu.linkonce.b.*) + __BSS_END = .; + } > ram + +/* You may change the sizes of the following sections to fit the actual + size your program requires. + + The heap and stack are aligned to the bus width, as a speed optimization + for accessing data located there. */ + + .heap : + { + . = ALIGN(4); + __HEAP_START = .; + . += 0x2000; __HEAP_MAX = .; + } > ram + + .stack : + { + . = ALIGN(4); + . += 0x6000; + __STACK_START = .; + } > ram + + .istack : + { + . = ALIGN(4); + . += 0x100; + __ISTACK_START = .; + } > ram + + .comment 0 : { *(.comment) } + + /* DWARF debug sections. + Symbols in the DWARF debugging sections are relative to the beginning + of the section so we begin them at 0. */ + + .debug_aranges 0 : { *(.debug_aranges) } + .debug_pubnames 0 : { *(.debug_pubnames) } + .debug_info 0 : { *(.debug_info .gnu.linkonce.wi.*) } + .debug_abbrev 0 : { *(.debug_abbrev) } + .debug_line 0 : { *(.debug_line) } + .debug_frame 0 : { *(.debug_frame) } + .debug_str 0 : { *(.debug_str) } + .debug_loc 0 : { *(.debug_loc) } + .debug_macinfo 0 : { *(.debug_macinfo) } +} + +__DATA_IMAGE_START = LOADADDR(.data); +EOF -- cgit v1.1