This is the mail archive of the
binutils@sourceware.cygnus.com
mailing list for the binutils project.
[PATCH] tic54x ld target
- To: binutils at sourceware dot cygnus dot com
- Subject: [PATCH] tic54x ld target
- From: Timothy Wall <twall at redhat dot com>
- Date: Mon, 19 Jun 2000 17:02:58 -0400
- Organization: Red Hat, Inc.
Remaining patches for tic54x config/target.
Index: ld/ChangeLog
===================================================================
RCS file: /cvs/src/src/ld/ChangeLog,v
retrieving revision 1.197
diff -d -c -p -b -w -r1.197 ChangeLog
*** ChangeLog 2000/06/19 02:36:45 1.197
--- ChangeLog 2000/06/19 20:52:17
***************
*** 1,3 ****
--- 1,14 ----
+ 2000-06-19 Timothy Wall <twall@cygnus.com>
+
+ * scripttempl/tic54xcoff.sc: New.
+ * ldlang.c (wild_doit): Propagate SEC_BLOCK flag.
+ * gen-doc.texi: Add flag for TI COFF.
+ * ld.texinfo: Add documentation for TI COFF handlig switches.
+ * emultempl/ticoff.em: New. TI COFF handling.
+ * configure.tgt: Add tic54x target.
+ * Makefile.am: Add tic54x target.
+ * Makefile.in: Ditto.
+
2000-06-19 Alan Modra <alan@linuxcare.com.au>
* NEWS: Move entries not in 2.10 above "Changes in version 2.10".
Index: ld/Makefile.am
===================================================================
RCS file: /cvs/src/src/ld/Makefile.am,v
retrieving revision 1.32
diff -d -c -p -b -w -r1.32 Makefile.am
*** Makefile.am 2000/06/19 01:22:43 1.32
--- Makefile.am 2000/06/19 20:52:17
*************** ALL_EMULATIONS = \
*** 221,226 ****
--- 221,227 ----
esun4.o \
etic30aout.o \
etic30coff.o \
+ etic54xcoff.o \
etic80coff.o \
evanilla.o \
evax.o \
*************** etic30aout.c: $(srcdir)/emulparams/tic30
*** 705,710 ****
--- 706,714 ----
etic30coff.c: $(srcdir)/emulparams/tic30coff.sh \
$(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/tic30coff.sc ${GEN_DEPENDS}
${GENSCRIPTS} tic30coff "$(tdir_tic30coff)"
+ etic54xcoff.c: $(srcdir)/emulparams/tic54xcoff.sh \
+ $(srcdir)/emultempl/ticoff.em $(srcdir)/scripttempl/tic54xcoff.sc ${GEN_DEPENDS}
+ ${GENSCRIPTS} tic54xcoff "$(tdir_tic54xcoff)"
etic80coff.c: $(srcdir)/emulparams/tic80coff.sh \
$(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/tic80coff.sc ${GEN_DEPENDS}
${GENSCRIPTS} tic80coff "$(tdir_tic80coff)"
Index: ld/Makefile.in
===================================================================
RCS file: /cvs/src/src/ld/Makefile.in,v
retrieving revision 1.34
diff -d -c -p -b -w -r1.34 Makefile.in
*** Makefile.in 2000/06/19 01:22:43 1.34
--- Makefile.in 2000/06/19 20:52:17
*************** ALL_EMULATIONS = \
*** 324,329 ****
--- 324,330 ----
esun4.o \
etic30aout.o \
etic30coff.o \
+ etic54xcoff.o \
etic80coff.o \
evanilla.o \
evax.o \
*************** etic30aout.c: $(srcdir)/emulparams/tic30
*** 1404,1409 ****
--- 1405,1413 ----
etic30coff.c: $(srcdir)/emulparams/tic30coff.sh \
$(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/tic30coff.sc ${GEN_DEPENDS}
${GENSCRIPTS} tic30coff "$(tdir_tic30coff)"
+ etic54xcoff.c: $(srcdir)/emulparams/tic54xcoff.sh \
+ $(srcdir)/emultempl/ticoff.em $(srcdir)/scripttempl/tic54xcoff.sc ${GEN_DEPENDS}
+ ${GENSCRIPTS} tic54xcoff "$(tdir_tic54xcoff)"
etic80coff.c: $(srcdir)/emulparams/tic80coff.sh \
$(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/tic80coff.sc ${GEN_DEPENDS}
${GENSCRIPTS} tic80coff "$(tdir_tic80coff)"
Index: ld/configure.tgt
===================================================================
RCS file: /cvs/src/src/ld/configure.tgt,v
retrieving revision 1.30
diff -d -c -p -b -w -r1.30 configure.tgt
*** configure.tgt 2000/06/19 01:22:43 1.30
--- configure.tgt 2000/06/19 20:52:17
*************** powerpc-*-beos*) targ_emul=aixppc ;;
*** 284,289 ****
--- 284,290 ----
rs6000-*-aix*) targ_emul=aixrs6 ;;
tic30-*-*aout*) targ_emul=tic30aout ;;
tic30-*-*coff*) targ_emul=tic30coff ;;
+ tic54x-*-* | c54x*-*-*) targ_emul=tic54xcoff ;;
tic80-*-*) targ_emul=tic80coff ;;
v850-*-*) targ_emul=v850 ;;
v850e-*-*) targ_emul=v850 ;;
Index: ld/gen-doc.texi
===================================================================
RCS file: /cvs/src/src/ld/gen-doc.texi,v
retrieving revision 1.1.1.1
diff -d -c -p -b -w -r1.1.1.1 gen-doc.texi
*** gen-doc.texi 1999/05/03 07:29:06 1.1.1.1
--- gen-doc.texi 2000/06/19 20:52:17
***************
*** 5,10 ****
--- 5,11 ----
@c 2. Specific target machines
@set H8300
@set I960
+ @set TICOFF
@c 3. Properties of this configuration
@clear SingleFormat
Index: ld/ld.texinfo
===================================================================
RCS file: /cvs/src/src/ld/ld.texinfo,v
retrieving revision 1.16
diff -d -c -p -b -w -r1.16 ld.texinfo
*** ld.texinfo 2000/05/22 21:58:40 1.16
--- ld.texinfo 2000/06/19 20:52:19
*************** This file documents the @sc{gnu} linker
*** 105,110 ****
--- 105,113 ----
@ifset I960
* i960:: ld and the Intel 960 family
@end ifset
+ @ifset TICOFF
+ * TI COFF:: ld and the TI COFF
+ @end ifset
@end ifclear
@ifclear SingleFormat
* BFD:: BFD
*************** functionality are not listed.
*** 3855,3860 ****
--- 3858,3866 ----
* H8/300:: @code{ld} and the H8/300
* i960:: @code{ld} and the Intel 960 family
* ARM:: @code{ld} and the ARM family
+ @ifset TICOFF
+ * TI COFF:: @code{ld} and TI COFF
+ @end ifset
@end menu
@end ifset
*************** The @samp{--thumb-entry} switch is a dup
*** 3994,3999 ****
--- 4000,4017 ----
But it also sets the bottom bit of the address, so that it can be
branched to using a BX instruction, and the program will start
executing in Thumb mode straight away.
+
+ @ifset TICOFF
+ @node TI COFF
+ @section @code{ld}'s support for various TI COFF versions
+ @cindex TI COFF versions
+ @kindex --format=@var{version}
+ The @samp{--format} switch allows selection of one of the various
+ TI COFF versions. The latest of this writing is 2; versions 0 and 1 are
+ also supported. The TI COFF versions also vary in header byte-order
+ format; @code{ld} will read any version or byte order, but the output
+ header format depends on the default specified by the specific target.
+ @end ifset
@ifclear GENERIC
@lowersections
Index: ld/ldgram.y
===================================================================
RCS file: /cvs/src/src/ld/ldgram.y,v
retrieving revision 1.6
diff -d -c -p -b -w -r1.6 ldgram.y
*** ldgram.y 2000/06/05 16:16:31 1.6
--- ldgram.y 2000/06/19 20:52:19
*************** memory_spec: NAME
*** 619,625 ****
attributes_opt ':'
origin_spec opt_comma length_spec
! ; origin_spec:
ORIGIN '=' mustbe_exp
{ region->current =
region->origin =
--- 619,627 ----
attributes_opt ':'
origin_spec opt_comma length_spec
! ;
!
! origin_spec:
ORIGIN '=' mustbe_exp
{ region->current =
region->origin =
Index: ld/ldlang.c
===================================================================
RCS file: /cvs/src/src/ld/ldlang.c,v
retrieving revision 1.26
diff -d -c -p -b -w -r1.26 ldlang.c
*** ldlang.c 2000/05/10 23:12:35 1.26
--- ldlang.c 2000/06/19 20:52:21
*************** wild_doit (ptr, section, output, file)
*** 1196,1201 ****
--- 1196,1208 ----
/* If supplied an aligment, then force it. */
if (output->section_alignment != -1)
output->bfd_section->alignment_power = output->section_alignment;
+
+ if (section->flags & SEC_BLOCK)
+ {
+ section->output_section->flags |= SEC_BLOCK;
+ /* FIXME: This value should really be obtained from the bfd... */
+ output->block_value = 128;
+ }
}
}
Index: ld/emulparams/tic54xcoff.sh
===================================================================
RCS file: tic54xcoff.sh
diff -N tic54xcoff.sh
*** /dev/null Tue May 5 13:32:27 1998
--- tic54xcoff.sh Mon Jun 19 13:52:21 2000
***************
*** 0 ****
--- 1,8 ----
+ SCRIPT_NAME=tic54xcoff
+ OUTPUT_FORMAT="coff1-c54x"
+ ARCH=tic54x
+ ENTRY=_c_int00
+ TEXT_START_ADDR=0x0080
+ TARGET_PAGE_SIZE=0x1000
+ TEMPLATE_NAME=ticoff
+ OUTPUT_FORMAT_TEMPLATE=tic54x
Index: ld/emultempl/ticoff.em
===================================================================
RCS file: ticoff.em
diff -N ticoff.em
*** /dev/null Tue May 5 13:32:27 1998
--- ticoff.em Mon Jun 19 13:52:21 2000
***************
*** 0 ****
--- 1,199 ----
+ # This shell script emits a C file. -*- C -*-
+ # It does some substitutions.
+ (echo;echo;echo;echo)>e${EMULATION_NAME}.c # there, now line numbers match ;-)
+ cat >>e${EMULATION_NAME}.c <<EOF
+ /* This file is part of GLD, the Gnu Linker.
+ Copyright 1999, 2000 Free Software Foundation, Inc.
+
+ 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
+
+ /* For TI COFF */
+ /* Need to determine load and run pages for output sections */
+
+ #define TARGET_IS_${EMULATION_NAME}
+
+ #include "bfd.h"
+ #include "sysdep.h"
+ #include "bfdlink.h"
+
+ #include "ld.h"
+ #include "ldmain.h"
+ #include "ldemul.h"
+ #include "ldfile.h"
+ #include "ldmisc.h"
+
+ #include "getopt.h"
+
+ static int coff_version;
+
+ static void gld_${EMULATION_NAME}_before_parse PARAMS ((void));
+ static char *gld_${EMULATION_NAME}_get_script PARAMS ((int *));
+ static int gld_${EMULATION_NAME}_parse_args PARAMS ((int, char **));
+ static void gld_${EMULATION_NAME}_list_options PARAMS ((FILE *));
+
+ /* TI COFF extra command line options */
+ #define OPTION_COFF_FORMAT (300 + 1)
+
+ static struct option longopts[] =
+ {
+ /* TI COFF options */
+ {"format", required_argument, NULL, OPTION_COFF_FORMAT },
+ {NULL, no_argument, NULL, 0}
+ };
+
+ static void
+ gld_${EMULATION_NAME}_list_options (file)
+ FILE * file;
+ {
+ fprintf (file, _(" --format 0|1|2 Specify which COFF version to use"));
+ }
+
+ static int
+ gld_${EMULATION_NAME}_parse_args(argc, argv)
+ int argc;
+ char **argv;
+ {
+ int longind;
+ int optc;
+ int prevoptind = optind;
+ int prevopterr = opterr;
+ int wanterror;
+ static int lastoptind = -1;
+
+ if (lastoptind != optind)
+ opterr = 0;
+ wanterror = opterr;
+
+ lastoptind = optind;
+
+ optc = getopt_long_only (argc, argv, "-", longopts, &longind);
+ opterr = prevopterr;
+
+ switch (optc)
+ {
+ default:
+ if (wanterror)
+ xexit (1);
+ optind = prevoptind;
+ return 0;
+
+ case OPTION_COFF_FORMAT:
+ if ((*optarg == '0' || *optarg == '1' || *optarg == '2')
+ && optarg[1] == '\0')
+ {
+ extern void lang_add_output_format
+ PARAMS ((const char *, const char *, const char *, int));
+ static char buf[] = "coffX-${OUTPUT_FORMAT_TEMPLATE}";
+ coff_version = *optarg - '0';
+ buf[4] = *optarg;
+ lang_add_output_format (buf, NULL, NULL, 0);
+ }
+ else
+ {
+ einfo (_("%P%F: invalid COFF format version %s\n"), optarg);
+
+ }
+ break;
+ }
+ return 1;
+ }
+
+ static void
+ gld_${EMULATION_NAME}_before_parse()
+ {
+ #ifndef TARGET_ /* I.e., if not generic. */
+ ldfile_set_output_arch ("`echo ${ARCH}`");
+ #endif /* not TARGET_ */
+ }
+
+ static char *
+ gld_${EMULATION_NAME}_get_script (isfile)
+ int *isfile;
+ EOF
+ if test -n "$COMPILE_IN"
+ then
+ # Scripts compiled in.
+
+ # sed commands to quote an ld script as a C string.
+ sc='s/["\\]/\\&/g
+ s/$/\\n\\/
+ 1s/^/"/
+ $s/$/n"/
+ '
+ cat >>e${EMULATION_NAME}.c <<EOF
+ {
+ *isfile = 0;
+ if (link_info.relocateable == true && config.build_constructors == true)
+ return `sed "$sc" ldscripts/${EMULATION_NAME}.xu`;
+ else if (link_info.relocateable == true)
+ return `sed "$sc" ldscripts/${EMULATION_NAME}.xr`;
+ else if (!config.text_read_only)
+ return `sed "$sc" ldscripts/${EMULATION_NAME}.xbn`;
+ else if (!config.magic_demand_paged)
+ return `sed "$sc" ldscripts/${EMULATION_NAME}.xn`;
+ else
+ return `sed "$sc" ldscripts/${EMULATION_NAME}.x`;
+ }
+ EOF
+
+ else
+ # Scripts read from the filesystem.
+
+ cat >>e${EMULATION_NAME}.c <<EOF
+ {
+ *isfile = 1;
+
+ if (link_info.relocateable == true && config.build_constructors == true)
+ return "ldscripts/${EMULATION_NAME}.xu";
+ else if (link_info.relocateable == true)
+ return "ldscripts/${EMULATION_NAME}.xr";
+ else if (!config.text_read_only)
+ return "ldscripts/${EMULATION_NAME}.xbn";
+ else if (!config.magic_demand_paged)
+ return "ldscripts/${EMULATION_NAME}.xn";
+ else
+ return "ldscripts/${EMULATION_NAME}.x";
+ }
+ EOF
+
+ fi
+
+ cat >>e${EMULATION_NAME}.c <<EOF
+ struct ld_emulation_xfer_struct ld_${EMULATION_NAME}_emulation =
+ {
+ gld_${EMULATION_NAME}_before_parse,
+ syslib_default,
+ hll_default,
+ after_parse_default,
+ after_open_default,
+ after_allocation_default,
+ set_output_arch_default,
+ ldemul_default_target,
+ before_allocation_default,
+ gld_${EMULATION_NAME}_get_script,
+ "${EMULATION_NAME}",
+ "${OUTPUT_FORMAT}",
+ NULL, /* finish */
+ NULL, /* create output section statements */
+ NULL, /* open dynamic archive */
+ NULL, /* place orphan */
+ NULL, /* set_symbols */
+ gld_${EMULATION_NAME}_parse_args,
+ NULL, /* unrecognized_file */
+ gld_${EMULATION_NAME}_list_options,
+ NULL, /* recognized file */
+ NULL, /* find_potential_libraries */
+ };
+ EOF
Index: ld/scripttempl/tic54xcoff.sc
===================================================================
RCS file: tic54xcoff.sc
diff -N tic54xcoff.sc
*** /dev/null Tue May 5 13:32:27 1998
--- tic54xcoff.sc Mon Jun 19 13:52:21 2000
***************
*** 0 ****
--- 1,52 ----
+ # default linker script for c54x, TI COFF(1).
+ # patterned after description in TI Aseembler Tools PDF, SPRU102C, 7-53
+ test -z "$ENTRY" && ENTRY=_c_int00
+
+ cat <<EOF
+ OUTPUT_FORMAT("${OUTPUT_FORMAT}")
+ OUTPUT_ARCH("${OUTPUT_ARCH}")
+
+ MEMORY
+ {
+ PAGE 0 : prog (RXI) : ORIGIN = 0x000080, LENGTH = 0xFF00
+ PAGE 1 : data (W) : ORIGIN = 0x000080, LENGTH = 0xFF80
+ }
+
+ ENTRY(${ENTRY})
+
+ SECTIONS
+ {
+ .text :
+ {
+ ___text__ = .;
+ *(.text)
+ etext = .;
+ ___etext__ = .;
+ } > prog
+ .data :
+ {
+ ___data__ = .;
+ __data = .;
+ *(.data)
+ __edata = .;
+ edata = .;
+ ___edata__ = .;
+ } > prog
+ /* all other initialized sections should be allocated here */
+ .cinit :
+ {
+ *(.cinit)
+ } > prog
+ .bss :
+ {
+ ___bss__ = .;
+ __bss = .;
+ *(.bss)
+ *(COMMON)
+ __ebss = .;
+ end = .;
+ ___end__ = .;
+ } > data
+ /* all other uninitialized sections should be allocated here */
+ }
+ EOF
Index: ld/testsuite/ld-checks/asm.s
===================================================================
RCS file: /cvs/src/src/ld/testsuite/ld-checks/asm.s,v
retrieving revision 1.2
diff -d -c -p -b -w -r1.2 asm.s
Index: ld/testsuite/ld-scripts/script.exp
===================================================================
RCS file: /cvs/src/src/ld/testsuite/ld-scripts/script.exp,v
retrieving revision 1.2
diff -d -c -p -b -w -r1.2 script.exp
*** script.exp 1999/09/12 15:59:48 1.2
--- script.exp 2000/06/19 20:52:21
*************** proc check_script { } {
*** 24,34 ****
verbose "bad output from nm"
fail $testname
} else {
if {$nm_output(text_start) != 0x100} {
send_log "text_start == $nm_output(text_start)\n"
verbose "text_start == $nm_output(text_start)"
fail $testname
! } else { if {$nm_output(text_end) < 0x104 \
|| $nm_output(text_end) > 0x110} {
send_log "text_end == $nm_output(text_end)\n"
verbose "text_end == $nm_output(text_end)"
--- 24,40 ----
verbose "bad output from nm"
fail $testname
} else {
+ set text_end 0x104
+ set data_end 0x1004
+ if [istarget *c54x*-*-*] then {
+ set text_end 0x102
+ set data_end 0x1002
+ }
if {$nm_output(text_start) != 0x100} {
send_log "text_start == $nm_output(text_start)\n"
verbose "text_start == $nm_output(text_start)"
fail $testname
! } else { if {$nm_output(text_end) < $text_end \
|| $nm_output(text_end) > 0x110} {
send_log "text_end == $nm_output(text_end)\n"
verbose "text_end == $nm_output(text_end)"
*************** proc check_script { } {
*** 37,43 ****
send_log "data_start == $nm_output(data_start)\n"
verbose "data_start == $nm_output(data_start)"
fail $testname
! } else { if {$nm_output(data_end) < 0x1004 \
|| $nm_output(data_end) > 0x1010} {
send_log "data_end == $nm_output(data_end)\n"
verbose "data_end == $nm_output(data_end)"
--- 43,49 ----
send_log "data_start == $nm_output(data_start)\n"
verbose "data_start == $nm_output(data_start)"
fail $testname
! } else { if {$nm_output(data_end) < $data_end \
|| $nm_output(data_end) > 0x1010} {
send_log "data_end == $nm_output(data_end)\n"
verbose "data_end == $nm_output(data_end)"