From 22a78f0d961fdab4eadf6694a636a6b57d3013ad Mon Sep 17 00:00:00 2001 From: Steve Chamberlain Date: Fri, 25 Sep 1992 18:11:04 +0000 Subject: [PATCH] Fri Sep 25 11:08:01 1992 Steve Chamberlain (sac@thepub.cygnus.com) Added initial support for the z8k * z8ksim.em, z8ksim.sc-sh, z8ksim.sh: new files * configure.in, Makefile.in: modified to reflect above * ldlang.c (lang_check): when linking conflicting architectures, make the output file reflect at least one of the bad inputs. --- ld/.Sanitize | 15 ++++++++- ld/ChangeLog | 9 ++++++ ld/Makefile.in | 6 +++- ld/ldlang.c | 54 ++++++++++++++++++------------- ld/z8ksim.em | 86 +++++++++++++++++++++++++++++++++++++++++++++++++ ld/z8ksim.sc-sh | 26 +++++++++++++++ ld/z8ksim.sh | 8 +++++ 7 files changed, 180 insertions(+), 24 deletions(-) create mode 100644 ld/z8ksim.em create mode 100755 ld/z8ksim.sc-sh create mode 100755 ld/z8ksim.sh diff --git a/ld/.Sanitize b/ld/.Sanitize index b91e519c448..e22cec0e013 100644 --- a/ld/.Sanitize +++ b/ld/.Sanitize @@ -119,6 +119,9 @@ sun4.sh vanilla.em vanilla.sc-sh vanilla.sh +z8ksim.em +z8ksim.sc-sh +z8ksim.sh Do-last: @@ -127,7 +130,17 @@ echo Done in `pwd`. # # # $Log$ -# Revision 1.46 1992/09/11 20:43:30 sac +# Revision 1.47 1992/09/25 18:10:41 sac +# Fri Sep 25 11:08:01 1992 Steve Chamberlain (sac@thepub.cygnus.com) +# +# Added initial support for the z8k +# * z8ksim.em, z8ksim.sc-sh, z8ksim.sh: new files +# * configure.in, Makefile.in: modified to reflect above +# +# * ldlang.c (lang_check): when linking conflicting architectures, +# make the output file reflect at least one of the bad inputs. +# +# Revision 1.46 1992/09/11 20:43:30 sac # Sanitize slip # # Revision 1.45 1992/09/11 17:47:22 sac diff --git a/ld/ChangeLog b/ld/ChangeLog index ed5ad59e063..c9cc7f447af 100644 --- a/ld/ChangeLog +++ b/ld/ChangeLog @@ -1,3 +1,12 @@ +Fri Sep 25 11:08:01 1992 Steve Chamberlain (sac@thepub.cygnus.com) + + Added initial support for the z8k + * z8ksim.em, z8ksim.sc-sh, z8ksim.sh: new files + * configure.in, Makefile.in: modified to reflect above + + * ldlang.c (lang_check): when linking conflicting architectures, + make the output file reflect at least one of the bad inputs. + Tue Sep 15 15:35:38 1992 Ian Lance Taylor (ian@cygnus.com) * Makefile.in (install): if $(tooldir) exists, install ld in diff --git a/ld/Makefile.in b/ld/Makefile.in index 194c9015469..926766b6c1a 100644 --- a/ld/Makefile.in +++ b/ld/Makefile.in @@ -119,7 +119,7 @@ ALL_EMULATIONS=em_lnk960.o em_sun3.o em_i386aout.o em_go32.o \ em_m88kbcs.o em_a29k.o em_news.o em_hp300bsd.o \ em_h8300hms.o em_ebmon29k.o em_sun4.o em_gld960.o \ em_m68kcoff.o em_h8300xray.o em_st2000.o em_sa29200.o \ - em_vanilla.o em_i386coff.o + em_vanilla.o em_i386coff.o em_z8ksim.o EMULATION_OFILES=${ALL_EMULATIONS} #EMULATION_OFILES=em_${EMUL}.o ${OTHER_EMULATIONS} @@ -228,6 +228,9 @@ em_h8300xray.c: $(srcdir)/h8300xray.sh \ em_st2000.c: $(srcdir)/st2000.sh \ $(srcdir)/st2000.em $(srcdir)/st2000.sc-sh ${GEN_DEPENDS} ${GENSCRIPTS} st2000.sh +em_z8ksim.c: $(srcdir)/z8ksim.sh \ + $(srcdir)/z8ksim.em $(srcdir)/z8ksim.sc-sh ${GEN_DEPENDS} + ${GENSCRIPTS} z8ksim.sh em_vanilla.c: $(srcdir)/vanilla.sh \ $(srcdir)/vanilla.em $(srcdir)/vanilla.sc-sh ${GEN_DEPENDS} ${GENSCRIPTS} vanilla.sh @@ -381,6 +384,7 @@ ldgram.c:ldgram.y h8300hms.o:h8300hms.c h8300xray.o:h8300xray.c st2000.o:st2000.c +z8ksim.o:z8ksim.c stage1: force -mkdir stage1 diff --git a/ld/ldlang.c b/ld/ldlang.c index cb6ad585423..447f2b84529 100644 --- a/ld/ldlang.c +++ b/ld/ldlang.c @@ -1846,34 +1846,44 @@ static void DEFUN_VOID (lang_finish) { ldsym_type *lgs; - + int warn = 1; if (entry_symbol == (char *) NULL) - { - /* No entry has been specified, look for start */ - entry_symbol = "start"; - } + { + /* No entry has been specified, look for start, but don't warn */ + entry_symbol = "start"; + warn =0; + } lgs = ldsym_get_soft (entry_symbol); if (lgs && lgs->sdefs_chain) - { - asymbol *sy = *(lgs->sdefs_chain); + { + asymbol *sy = *(lgs->sdefs_chain); - /* We can set the entry address*/ - bfd_set_start_address (output_bfd, - outside_symbol_address (sy)); + /* We can set the entry address*/ + bfd_set_start_address (output_bfd, + outside_symbol_address (sy)); - } + } else + { + /* Can't find anything reasonable, + use the first address in the text section + */ + asection *ts = bfd_get_section_by_name (output_bfd, ".text"); + if (ts) { - /* Can't find anything reasonable, - use the first address in the text section - */ - asection *ts = bfd_get_section_by_name (output_bfd, ".text"); + if (warn) + einfo ("%P: Warning, can't find entry symbol %s, defaulting to %V\n", + entry_symbol, ts->vma); - if (ts) - { - bfd_set_start_address (output_bfd, ts->vma); - } + bfd_set_start_address (output_bfd, ts->vma); } + else + { + if (warn) + einfo ("%P: Warning, can't find entry symbol %s, not setting start address\n", + entry_symbol); + } + } } /* By now we know the target architecture, and we may have an */ @@ -1905,7 +1915,7 @@ DEFUN_VOID (lang_check) compatible = bfd_arch_get_compatible (input_bfd, output_bfd); - + if (compatible) { ldfile_output_machine = compatible->mach; @@ -1919,8 +1929,8 @@ DEFUN_VOID (lang_check) bfd_printable_name (output_bfd)); bfd_set_arch_mach (output_bfd, - ldfile_new_output_architecture, - ldfile_new_output_machine); + input_architecture, + input_machine); } } diff --git a/ld/z8ksim.em b/ld/z8ksim.em new file mode 100644 index 00000000000..f97ab827191 --- /dev/null +++ b/ld/z8ksim.em @@ -0,0 +1,86 @@ +cat >em_${EMULATION_NAME}.c <