From 0da35f8be8ebac5eb49ab2d7bc30022361d3d107 Mon Sep 17 00:00:00 2001 From: Svein Seldal Date: Mon, 20 Jan 2003 22:34:39 +0000 Subject: [PATCH] Updates for fixing tic4x arch tagging of its object files. * bfd/coffcode.h (coff_set_flags): Added get/set arch hooks. * include/coff/tic4x.h (TICOFF_TARGET_MACHINE_GET): Fixed define bug * include/coff/ti.h (TICOFF_TARGET_MACHINE_GET): Added macros * ld/Makefile.am: Added etic3xcoff.o and etic4xcoff_onchip.o * ld/Makefile.in: Regenerate * ld/configure.tgt: Added extra target emulations * ld/emulparams/tic3xcoff.sh: Remove old settings * ld/emulparams/tic4xcoff.sh: Ditto * ld/emulparams/tic3xcoff-onchip.sh: Added new * ld/scripttempl/tic4xcoff.sc: Revise and combine both c3x and c4x * ld/scripttempl/tic3xcoff.sc: Remove --- bfd/ChangeLog | 4 + bfd/coffcode.h | 3 + include/ChangeLog | 5 + include/coff/ti.h | 8 ++ include/coff/tic4x.h | 6 +- ld/ChangeLog | 11 ++ ld/Makefile.am | 8 ++ ld/Makefile.in | 18 +++- ld/configure.tgt | 2 +- ld/emulparams/tic3xcoff-onchip.sh | 8 ++ ld/emulparams/tic3xcoff.sh | 3 - ld/emulparams/tic4xcoff.sh | 3 - ld/scripttempl/tic3xcoff.sc | 92 ---------------- ld/scripttempl/tic4xcoff.sc | 173 ++++++++++++++++++++---------- 14 files changed, 180 insertions(+), 164 deletions(-) create mode 100644 ld/emulparams/tic3xcoff-onchip.sh delete mode 100644 ld/scripttempl/tic3xcoff.sc diff --git a/bfd/ChangeLog b/bfd/ChangeLog index eb037e24f1..c50cee7e67 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,3 +1,7 @@ +2003-01-20 Svein E. Seldal + + * coffcode.h (coff_set_flags): Added get/set arch hooks. + 2003-01-20 Fabio Alemagna * elf32-sh.c: Treat elfNN_bed like other macros defined in diff --git a/bfd/coffcode.h b/bfd/coffcode.h index 36ae1a9807..7ce60db76c 100644 --- a/bfd/coffcode.h +++ b/bfd/coffcode.h @@ -2128,6 +2128,7 @@ coff_set_arch_mach_hook (abfd, filehdr) /* this TI COFF section should be used by all new TI COFF v0 targets */ case TICOFF0MAGIC: arch = TICOFF_TARGET_ARCH; + machine = TICOFF_TARGET_MACHINE_GET (internal_f->f_flags); break; #endif #endif @@ -2142,6 +2143,7 @@ coff_set_arch_mach_hook (abfd, filehdr) #ifdef TI_TARGET_ID case TI_TARGET_ID: arch = TICOFF_TARGET_ARCH; + machine = TICOFF_TARGET_MACHINE_GET (internal_f->f_flags); break; #endif default: @@ -2612,6 +2614,7 @@ coff_set_flags (abfd, magicp, flagsp) return FALSE; } } + TICOFF_TARGET_MACHINE_SET (flagsp, bfd_get_mach (abfd)); return TRUE; #endif diff --git a/include/ChangeLog b/include/ChangeLog index 771808c64e..79cf42d1fc 100644 --- a/include/ChangeLog +++ b/include/ChangeLog @@ -1,3 +1,8 @@ +2003-01-20 Svein E. Seldal + + * coff/tic4x.h (TICOFF_TARGET_MACHINE_GET): Fixed define bug + * coff/ti.h (TICOFF_TARGET_MACHINE_GET): Added macros + 2002-07-17 Geoffrey Keating * splay-tree.h (GTY): Define if undefined. diff --git a/include/coff/ti.h b/include/coff/ti.h index 0a59b226a3..8df15223c8 100644 --- a/include/coff/ti.h +++ b/include/coff/ti.h @@ -57,6 +57,14 @@ struct external_filehdr #error "TICOFF_TARGET_ARCH needs to be defined for your CPU" #endif +#ifndef TICOFF_TARGET_MACHINE_GET +#define TICOFF_TARGET_MACHINE_GET(FLAGS) 0 +#endif + +#ifndef TICOFF_TARGET_MACHINE_SET +#define TICOFF_TARGET_MACHINE_SET(FLAGSP, MACHINE) +#endif + /* Default to COFF2 for file output */ #ifndef TICOFF_DEFAULT_MAGIC #define TICOFF_DEFAULT_MAGIC TICOFF2MAGIC diff --git a/include/coff/tic4x.h b/include/coff/tic4x.h index 03215fb531..083cc3b10d 100644 --- a/include/coff/tic4x.h +++ b/include/coff/tic4x.h @@ -30,14 +30,14 @@ /* We use COFF2. */ #define TICOFF_DEFAULT_MAGIC TICOFF2MAGIC -#define TICOFF_TARGET_MACHINE_GET (FLAGS) \ +#define TICOFF_TARGET_MACHINE_GET(FLAGS) \ (((FLAGS) & F_VERS) ? bfd_mach_c4x : bfd_mach_c3x) -#define TICOFF_TARGET_MACHINE_SET (FLAGSP, MACHINE) \ +#define TICOFF_TARGET_MACHINE_SET(FLAGSP, MACHINE) \ do \ { \ if ((MACHINE) == bfd_mach_c4x) \ - *(FLAGSP) = F_VERS; \ + *(FLAGSP) |= F_VERS; \ } \ while (0) diff --git a/ld/ChangeLog b/ld/ChangeLog index 660f205475..7952d672f2 100644 --- a/ld/ChangeLog +++ b/ld/ChangeLog @@ -1,3 +1,14 @@ +2003-01-19 Svein E. Seldal + + * Makefile.am: Added etic3xcoff.o and etic4xcoff_onchip.o + * Makefile.in: Regenerate + * configure.tgt: Added extra target emulations + * emulparams/tic3xcoff.sh: Remove old settings + * emulparams/tic4xcoff.sh: Ditto + * emulparams/tic3xcoff-onchip.sh: Added new + * scripttempl/tic4xcoff.sc: Revise and combine both c3x and c4x + * scripttempl/tic3xcoff.sc: Remove + 2003-01-17 Andreas Jaeger * emultempl/elf32.em (gld${EMULATION_NAME}_add_sysroot): Do not diff --git a/ld/Makefile.am b/ld/Makefile.am index 01f44f296c..57f7d5be35 100644 --- a/ld/Makefile.am +++ b/ld/Makefile.am @@ -324,6 +324,8 @@ ALL_EMULATIONS = \ esun4.o \ etic30aout.o \ etic30coff.o \ + etic3xcoff.o \ + etic3xcoff_onchip.o \ etic4xcoff.o \ etic54xcoff.o \ etic80coff.o \ @@ -1299,6 +1301,12 @@ etic30aout.c: $(srcdir)/emulparams/tic30aout.sh \ etic30coff.c: $(srcdir)/emulparams/tic30coff.sh \ $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/tic30coff.sc ${GEN_DEPENDS} ${GENSCRIPTS} tic30coff "$(tdir_tic30coff)" +etic3xcoff.c: $(srcdir)/emulparams/tic3xcoff.sh \ + $(srcdir)/emultempl/ticoff.em $(srcdir)/scripttempl/tic4xcoff.sc ${GEN_DEPENDS} + ${GENSCRIPTS} tic3xcoff "$(tdir_tic4xcoff)" +etic3xcoff_onchip.c: $(srcdir)/emulparams/tic3xcoff_onchip.sh \ + $(srcdir)/emultempl/ticoff.em $(srcdir)/scripttempl/tic4xcoff.sc ${GEN_DEPENDS} + ${GENSCRIPTS} tic3xcoff "$(tdir_tic4xcoff)" etic4xcoff.c: $(srcdir)/emulparams/tic4xcoff.sh \ $(srcdir)/emultempl/ticoff.em $(srcdir)/scripttempl/tic4xcoff.sc ${GEN_DEPENDS} ${GENSCRIPTS} tic4xcoff "$(tdir_tic4xcoff)" diff --git a/ld/Makefile.in b/ld/Makefile.in index 9d7cc19bed..c8ba478b64 100644 --- a/ld/Makefile.in +++ b/ld/Makefile.in @@ -1,6 +1,6 @@ -# Makefile.in generated automatically by automake 1.4-p6 from Makefile.am +# Makefile.in generated automatically by automake 1.4 from Makefile.am -# Copyright (C) 1994, 1995-8, 1999, 2001 Free Software Foundation, Inc. +# Copyright (C) 1994, 1995-8, 1999 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. @@ -438,6 +438,8 @@ ALL_EMULATIONS = \ esun4.o \ etic30aout.o \ etic30coff.o \ + etic3xcoff.o \ + etic3xcoff_onchip.o \ etic4xcoff.o \ etic54xcoff.o \ etic80coff.o \ @@ -769,7 +771,7 @@ uninstall-info: else ii=; fi; \ list='$(INFO_DEPS)'; \ for file in $$list; do \ - test -z "$$ii" \ + test -z "$ii" \ || install-info --info-dir=$(DESTDIR)$(infodir) --remove $$file; \ done @$(NORMAL_UNINSTALL) @@ -882,7 +884,7 @@ maintainer-clean-recursive: dot_seen=no; \ rev=''; list='$(SUBDIRS)'; for subdir in $$list; do \ rev="$$subdir $$rev"; \ - test "$$subdir" != "." || dot_seen=yes; \ + test "$$subdir" = "." && dot_seen=yes; \ done; \ test "$$dot_seen" = "no" && rev=". $$rev"; \ target=`echo $@ | sed s/-recursive//`; \ @@ -1063,7 +1065,7 @@ distclean-generic: -test -z "$(DISTCLEANFILES)" || rm -f $(DISTCLEANFILES) maintainer-clean-generic: - -test -z "ldlex.cdeffilep.hdeffilep.cldgram.hldgram.c$(MAINTAINERCLEANFILES)" || rm -f ldlex.c deffilep.h deffilep.c ldgram.h ldgram.c $(MAINTAINERCLEANFILES) + -test -z "ldlexldeffilephdeffilepcldgramhldgramc$(MAINTAINERCLEANFILES)" || rm -f ldlexl deffileph deffilepc ldgramh ldgramc $(MAINTAINERCLEANFILES) mostlyclean-am: mostlyclean-hdr mostlyclean-noinstPROGRAMS \ mostlyclean-compile mostlyclean-libtool \ mostlyclean-aminfo mostlyclean-tags mostlyclean-generic \ @@ -2025,6 +2027,12 @@ etic30aout.c: $(srcdir)/emulparams/tic30aout.sh \ etic30coff.c: $(srcdir)/emulparams/tic30coff.sh \ $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/tic30coff.sc ${GEN_DEPENDS} ${GENSCRIPTS} tic30coff "$(tdir_tic30coff)" +etic3xcoff.c: $(srcdir)/emulparams/tic3xcoff.sh \ + $(srcdir)/emultempl/ticoff.em $(srcdir)/scripttempl/tic4xcoff.sc ${GEN_DEPENDS} + ${GENSCRIPTS} tic3xcoff "$(tdir_tic4xcoff)" +etic3xcoff_onchip.c: $(srcdir)/emulparams/tic3xcoff_onchip.sh \ + $(srcdir)/emultempl/ticoff.em $(srcdir)/scripttempl/tic4xcoff.sc ${GEN_DEPENDS} + ${GENSCRIPTS} tic3xcoff "$(tdir_tic4xcoff)" etic4xcoff.c: $(srcdir)/emulparams/tic4xcoff.sh \ $(srcdir)/emultempl/ticoff.em $(srcdir)/scripttempl/tic4xcoff.sc ${GEN_DEPENDS} ${GENSCRIPTS} tic4xcoff "$(tdir_tic4xcoff)" diff --git a/ld/configure.tgt b/ld/configure.tgt index 9c4ba57249..8ebdafc003 100644 --- a/ld/configure.tgt +++ b/ld/configure.tgt @@ -509,7 +509,7 @@ powerpc-*-windiss*) targ_emul=elf32ppcwindiss ;; rs6000-*-aix5*) targ_emul=aix5rs6 ;; rs6000-*-aix*) targ_emul=aixrs6 ;; tic30-*-*aout*) targ_emul=tic30aout ;; -tic30-*-*coff*) targ_emul=tic30coff ;; +tic30-*-*coff*) targ_emul=tic30coff ; targ_extra_emuls="tic3xcoff tic3xcoff_onchip" ;; tic4x-*-* | c4x-*-*) targ_emul=tic4xcoff ;; tic54x-*-* | c54x*-*-*) targ_emul=tic54xcoff ;; tic80-*-*) targ_emul=tic80coff ;; diff --git a/ld/emulparams/tic3xcoff-onchip.sh b/ld/emulparams/tic3xcoff-onchip.sh new file mode 100644 index 0000000000..fdf55e21a9 --- /dev/null +++ b/ld/emulparams/tic3xcoff-onchip.sh @@ -0,0 +1,8 @@ +SCRIPT_NAME=tic4xcoff +OUTPUT_FORMAT="coff2-c4x" +OUTPUT_ARCH="c3x" +ARCH=c3x +TEMPLATE_NAME=ticoff +OUTPUT_FORMAT_TEMPLATE=tic4x +ONCHIP=yes + diff --git a/ld/emulparams/tic3xcoff.sh b/ld/emulparams/tic3xcoff.sh index 3d4fbf9978..ebbc3e4663 100644 --- a/ld/emulparams/tic3xcoff.sh +++ b/ld/emulparams/tic3xcoff.sh @@ -2,8 +2,5 @@ SCRIPT_NAME=tic4xcoff OUTPUT_FORMAT="coff2-c4x" OUTPUT_ARCH="c3x" ARCH=c3x -#ENTRY=_c_int00 -TEXT_START_ADDR=0x0080 -TARGET_PAGE_SIZE=0x1000 TEMPLATE_NAME=ticoff OUTPUT_FORMAT_TEMPLATE=tic4x diff --git a/ld/emulparams/tic4xcoff.sh b/ld/emulparams/tic4xcoff.sh index d6b9dc6248..9fa1e64139 100644 --- a/ld/emulparams/tic4xcoff.sh +++ b/ld/emulparams/tic4xcoff.sh @@ -2,8 +2,5 @@ SCRIPT_NAME=tic4xcoff OUTPUT_FORMAT="coff2-c4x" OUTPUT_ARCH="c4x" ARCH=c4x -#ENTRY=_c_int00 -TEXT_START_ADDR=0x0080 -TARGET_PAGE_SIZE=0x1000 TEMPLATE_NAME=ticoff OUTPUT_FORMAT_TEMPLATE=tic4x diff --git a/ld/scripttempl/tic3xcoff.sc b/ld/scripttempl/tic3xcoff.sc deleted file mode 100644 index 29dc400d65..0000000000 --- a/ld/scripttempl/tic3xcoff.sc +++ /dev/null @@ -1,92 +0,0 @@ -# 32 interrupt vectors + 32 trap vectors each of 4 bytes -# The .bss and .data sections need to be contiguous for direct addressing -# The data page pointer gets loaded with the start of .bss -# TI C compiler uses .cinit to initialise variables in .bss - -test -z "$ENTRY" && ENTRY=_start -# These are substituted in as variables in order to get '}' in a shell -# conditional expansion. -INIT='.init : { *(.init) }' -FINI='.fini : { *(.fini) }' -cat < ${TEXT_MEMORY}} + /* Constants. */ + .const : { *(.const) - } - .cinit ${RELOCATING+ SIZEOF(.const) + ADDR(.const)} : - { - ${RELOCATING+ cinit = .;} - *(.cinit) - LONG(0); - } - .text ${RELOCATING+ SIZEOF(.cinit) + ADDR(.cinit)} : { - ${RELOCATING+ .text = .;} + } ${RELOCATING+ > ${TEXT_MEMORY}} + /* Program code. */ + .text : { + ${RELOCATING+ __text = .;} ${RELOCATING+ *(.init)} *(.text) ${CONSTRUCTING+ ___CTOR_LIST__ = .;} @@ -60,33 +110,42 @@ SECTIONS ${CONSTRUCTING+ LONG(0)} ${CONSTRUCTING+ ___DTOR_END__ = .;} ${RELOCATING+ *(.fini)} - ${RELOCATING+ etext = .;} - ${RELOCATING+ _etext = etext;} - } - .stack ${RELOCATING+ SIZEOF(.text) + ADDR(.text)} : + ${RELOCATING+ __etext = .;} + } ${RELOCATING+ > ${TEXT_MEMORY}} + /* Global initialised variables. */ + .data : + { + ${RELOCATING+ __data = .;} + *(.data) + ${RELOCATING+ __edata = .;} + } ${RELOCATING+ > ${DATA_MEMORY}} + /* Global uninitialised variables. */ + .bss : { + ${RELOCATING+ __bss = .;} + *(.bss) + *(COMMON) + ${RELOCATING+ __end = .;} + } ${RELOCATING+ > ${DATA_MEMORY}} + /* Heap. */ + .heap : { + ${RELOCATING+ __heap = .;} + ${RELOCATING+ . += __HEAP_SIZE}; + } ${RELOCATING+ > ${DATA_MEMORY}} + /* Stack (grows upward). */ + .stack : + { + ${RELOCATING+ __stack = .;} *(.stack) ${RELOCATING+ . = . + __STACK_SIZE}; - } - .sysmem ${RELOCATING+ SIZEOF(.stack) + ADDR(.stack)} : - { - *(.sysmem) - } - .heap ${RELOCATING+ SIZEOF(.sysmem) + ADDR(.sysmem)} : - { - ${RELOCATING+ . += __SYSMEM_SIZE - SIZEOF(.sysmem)}; - } - ${RELOCATING- ${INIT}} - ${RELOCATING- ${FINI}} - .stab 0 ${RELOCATING+(NOLOAD)} : + } ${RELOCATING+ > ${DATA_MEMORY}} + .stab 0 ${RELOCATING+(NOLOAD)} : { [ .stab ] } - .stabstr 0 ${RELOCATING+(NOLOAD)} : + .stabstr 0 ${RELOCATING+(NOLOAD)} : { [ .stabstr ] } -/* The TI tools sets cinit to -1 if the ram model is used. */ - ${RELOCATING+ cinit = SIZEOF(.cinit) == 1 ? cinit : -1;} } EOF -- 2.34.1