From 8ddef5528d34f05ff9a492e23b15ef5c6c8eb5fb Mon Sep 17 00:00:00 2001 From: David MacKenzie Date: Thu, 17 Jun 1993 20:55:43 +0000 Subject: * ldfile.c (ldfile_open_command): Don't try .ld extension. It wasn't documented (or likely used) and wastes time. (try_open): If EXTEN is empty, don't try it. * ldctor.c, lderror.c, ldexp.c, ldfile.c, ldindr.c, ldlang.c, ldlex.l, ldmain.c, ldmisc.c, ldsym.c, ldver.c, ldwarn.c, ldwrite.c, lexsup.c, mri.c, relax.c: Replace DEFUN macro calls with normal function declarations. * Move *.em to emultempl/*.em. Move *.sh to emulparams/*.sh. Move *.sc-sh to scripttempl/*.sc. * {emultempl,emulparams,scripttempl}/README: New files. * sh.em, st2000.em, z8ksim.em, h8300hms.em, h8500hms.em: Files removed, replaced with generic.em. * h8300.sh, h8500.sh, h8300.sc, h8500.sc: Renamed from h8[35]00hms.s[ch]. Change their contents to omit the "hms". * *.em (*_get_script): Return script name instead of script contents. * ldlang.c (lang_process): Change caller. * ldlex.l, ldgram.y: Recognize -m option. Check for input files after *all* options in grammar. * ldmain.c (main): Check for -m options. Add default directory for -m. * mkscript.c: File removed. * genscripts.sh: Take two more parameters, tooldirlib and libdir, to add to the default LIB_PATH. Look for input files in the new subdirectories. Create the scripts in emulations subdirectory and don't filter them through mkscript. * configure.in: Make the emulations subdirectory. * Makefile.in: Account for all of the above changes. Remove unused .SUFFIXES. Get libgcc.a path with gcc -print-libgcc-file-name instead of $(libdir)/libgcc.a. Put CFLAGS last in the compilation rules. Add -I../bfd to INCLUDES so sysdep.h is found. * ldfile.c (try_open): If opening without the extension fails, try with the extension even if -v or -V was given. had_script is imported (from ldgram.y), not exported. --- ld/.Sanitize | 59 ------- ld/ChangeLog | 48 +++++ ld/Makefile.in | 184 ++++++++++--------- ld/configure.in | 4 + ld/emulparams/.Sanitize | 65 +++++++ ld/emulparams/README | 2 + ld/emulparams/a29k.sh | 6 + ld/emulparams/ebmon29k.sh | 6 + ld/emulparams/gld960.sh | 8 + ld/emulparams/go32.sh | 9 + ld/emulparams/h8300.sh | 6 + ld/emulparams/h8500.sh | 6 + ld/emulparams/hp300bsd.sh | 6 + ld/emulparams/hp3hpux.sh | 9 + ld/emulparams/hppaosf.sh | 8 + ld/emulparams/i386aout.sh | 7 + ld/emulparams/i386bsd.sh | 7 + ld/emulparams/i386coff.sh | 6 + ld/emulparams/lnk960.sh | 7 + ld/emulparams/m68kcoff.sh | 6 + ld/emulparams/mipsbig.sh | 5 + ld/emulparams/mipsbsd.sh | 6 + ld/emulparams/mipsidt.sh | 9 + ld/emulparams/mipsidtl.sh | 9 + ld/emulparams/mipslit.sh | 5 + ld/emulparams/news.sh | 6 + ld/emulparams/sa29200.sh | 6 + ld/emulparams/sh.sh | 6 + ld/emulparams/st2000.sh | 6 + ld/emulparams/sun3.sh | 8 + ld/emulparams/vanilla.sh | 6 + ld/emulparams/vax.sh | 6 + ld/emulparams/z8ksim.sh | 6 + ld/emultempl/.Sanitize | 41 +++++ ld/emultempl/README | 3 + ld/emultempl/hppaosf.em | 115 ++++++++++++ ld/emultempl/vanilla.em | 74 ++++++++ ld/ld.1 | 298 +++++-------------------------- ld/ld.texinfo | 52 ++++-- ld/lderror.c | 14 +- ld/ldgram.y | 39 ++++- ld/ldindr.c | 24 +-- ld/ldlang.c | 429 +++++++++++++++++++++++---------------------- ld/ldlex.l | 51 +++--- ld/ldsym.c | 28 +-- ld/ldwarn.c | 14 +- ld/mri.c | 310 +++++++++++++++++++++++++++++--- ld/relax.c | 16 +- ld/scripttempl/.Sanitize | 53 ++++++ ld/scripttempl/README | 4 + ld/scripttempl/a29k.sc | 38 ++++ ld/scripttempl/ebmon29k.sc | 27 +++ ld/scripttempl/h8500.sc | 43 +++++ ld/scripttempl/hppaosf.sc | 29 +++ ld/scripttempl/i386coff.sc | 29 +++ ld/scripttempl/i960.sc | 23 +++ ld/scripttempl/mips.sc | 56 ++++++ ld/scripttempl/mipsbsd.sc | 28 +++ ld/scripttempl/sa29200.sc | 44 +++++ ld/scripttempl/sh.sc | 39 +++++ ld/scripttempl/st2000.sc | 26 +++ ld/scripttempl/vanilla.sc | 1 + ld/scripttempl/z8ksim.sc | 26 +++ 63 files changed, 1774 insertions(+), 743 deletions(-) create mode 100644 ld/emulparams/.Sanitize create mode 100644 ld/emulparams/README create mode 100644 ld/emulparams/a29k.sh create mode 100644 ld/emulparams/ebmon29k.sh create mode 100644 ld/emulparams/gld960.sh create mode 100644 ld/emulparams/go32.sh create mode 100644 ld/emulparams/h8300.sh create mode 100644 ld/emulparams/h8500.sh create mode 100644 ld/emulparams/hp300bsd.sh create mode 100644 ld/emulparams/hp3hpux.sh create mode 100644 ld/emulparams/hppaosf.sh create mode 100644 ld/emulparams/i386aout.sh create mode 100644 ld/emulparams/i386bsd.sh create mode 100644 ld/emulparams/i386coff.sh create mode 100644 ld/emulparams/lnk960.sh create mode 100644 ld/emulparams/m68kcoff.sh create mode 100644 ld/emulparams/mipsbig.sh create mode 100644 ld/emulparams/mipsbsd.sh create mode 100644 ld/emulparams/mipsidt.sh create mode 100644 ld/emulparams/mipsidtl.sh create mode 100644 ld/emulparams/mipslit.sh create mode 100644 ld/emulparams/news.sh create mode 100644 ld/emulparams/sa29200.sh create mode 100644 ld/emulparams/sh.sh create mode 100644 ld/emulparams/st2000.sh create mode 100644 ld/emulparams/sun3.sh create mode 100644 ld/emulparams/vanilla.sh create mode 100644 ld/emulparams/vax.sh create mode 100644 ld/emulparams/z8ksim.sh create mode 100644 ld/emultempl/.Sanitize create mode 100644 ld/emultempl/README create mode 100644 ld/emultempl/hppaosf.em create mode 100644 ld/emultempl/vanilla.em create mode 100644 ld/scripttempl/.Sanitize create mode 100644 ld/scripttempl/README create mode 100644 ld/scripttempl/a29k.sc create mode 100644 ld/scripttempl/ebmon29k.sc create mode 100644 ld/scripttempl/h8500.sc create mode 100644 ld/scripttempl/hppaosf.sc create mode 100644 ld/scripttempl/i386coff.sc create mode 100644 ld/scripttempl/i960.sc create mode 100644 ld/scripttempl/mips.sc create mode 100644 ld/scripttempl/mipsbsd.sc create mode 100644 ld/scripttempl/sa29200.sc create mode 100644 ld/scripttempl/sh.sc create mode 100644 ld/scripttempl/st2000.sc create mode 100644 ld/scripttempl/vanilla.sc create mode 100644 ld/scripttempl/z8ksim.sc (limited to 'ld') diff --git a/ld/.Sanitize b/ld/.Sanitize index a55b1f1..5afb85f 100644 --- a/ld/.Sanitize +++ b/ld/.Sanitize @@ -34,9 +34,6 @@ Makefile.in NEWS README TODO -a29k.sc-sh -a29k.sh -aout.sc-sh cdtest-foo.cc cdtest-foo.h cdtest-func.cc @@ -46,32 +43,10 @@ config config.h configure.bat configure.in -ebmon29k.sc-sh -ebmon29k.sh -generic.em genscripts.sh h8-doc.texi ld.1 gen-doc.texi -gld960.em -gld960.sh -go32.sh -hp300bsd.sh -hp3hpux.sh -hppaosf.em -hppaosf.sc-sh -hppaosf.sh -h8300hms.em -h8300hms.sc-sh -h8300hms.sh -h8500hms.em -h8500hms.sc-sh -h8500hms.sh -i386aout.sh -i386bsd.sh -i386coff.sc-sh -i386coff.sh -i960.sc-sh ld.h ld.texinfo ldctor.c @@ -105,44 +80,10 @@ ldwarn.h ldwrite.c ldwrite.h lexsup.c -lnk960.em -lnk960.sh -m68kcoff.sc-sh -m68kcoff.sh -m88kbcs.sc-sh -m88kbcs.sh -mips.sc-sh -mipsbig.sh -mipsbsd.sc-sh -mipsbsd.sh -mipsidt.sh -mipsidtl.sh -mipslit.sh mri.c mri.h -go32.sh -mkscript.c -news.sh relax.c relax.h -sh.em -sh.sc-sh -sh.sh -st2000.em -st2000.sc-sh -st2000.sh -sa29200.sc-sh -sa29200.sh -scripts -sun3.sh -sun4.sh -vanilla.em -vanilla.sc-sh -vanilla.sh -vax.sh -z8ksim.em -z8ksim.sc-sh -z8ksim.sh Things-to-lose: diff --git a/ld/ChangeLog b/ld/ChangeLog index 307852b..1273444 100644 --- a/ld/ChangeLog +++ b/ld/ChangeLog @@ -1,3 +1,44 @@ +Wed Jun 16 11:45:32 1993 David J. Mackenzie (djm@thepub.cygnus.com) + + * ldfile.c (ldfile_open_command): Don't try .ld extension. + It wasn't documented (or likely used) and wastes time. + (try_open): If EXTEN is empty, don't try it. + + * ldctor.c, lderror.c, ldexp.c, ldfile.c, ldindr.c, ldlang.c, + ldlex.l, ldmain.c, ldmisc.c, ldsym.c, ldver.c, ldwarn.c, + ldwrite.c, lexsup.c, mri.c, relax.c: Replace DEFUN macro calls + with normal function declarations. + + * Move *.em to emultempl/*.em. Move *.sh to emulparams/*.sh. + Move *.sc-sh to scripttempl/*.sc. + * {emultempl,emulparams,scripttempl}/README: New files. + * sh.em, st2000.em, z8ksim.em, h8300hms.em, h8500hms.em: Files + removed, replaced with generic.em. + * h8300.sh, h8500.sh, h8300.sc, h8500.sc: Renamed from + h8[35]00hms.s[ch]. Change their contents to omit the "hms". + + * *.em (*_get_script): Return script name instead of script contents. + * ldlang.c (lang_process): Change caller. + + * ldlex.l, ldgram.y: Recognize -m option. + Check for input files after *all* options in grammar. + * ldmain.c (main): Check for -m options. Add default directory + for -m. + + * mkscript.c: File removed. + * genscripts.sh: Take two more parameters, tooldirlib and libdir, + to add to the default LIB_PATH. + Look for input files in the new subdirectories. + Create the scripts in emulations subdirectory and don't filter + them through mkscript. + * configure.in: Make the emulations subdirectory. + + * Makefile.in: Account for all of the above changes. + Remove unused .SUFFIXES. Get libgcc.a path with gcc + -print-libgcc-file-name instead of $(libdir)/libgcc.a. + Put CFLAGS last in the compilation rules. + Add -I../bfd to INCLUDES so sysdep.h is found. + Tue Jun 15 23:04:46 1993 Ken Raeburn (raeburn@cambridge.cygnus.com) * Makefile.in (INCLUDES): Look in ../include, not ../bfd. @@ -6,6 +47,12 @@ Tue Jun 15 23:04:46 1993 Ken Raeburn (raeburn@cambridge.cygnus.com) dependent on RELOCATING, not RELOCATION. * hp3hpux.sh (SHLIB_PATH): Define it. +Mon Jun 14 19:06:15 1993 David J. Mackenzie (djm@thepub.cygnus.com) + + * ldfile.c (try_open): If opening without the extension fails, + try with the extension even if -v or -V was given. + had_script is imported (from ldgram.y), not exported. + Mon Jun 14 16:26:10 1993 david d `zoo' zuhn (zoo at rtl.cygnus.com) * Makefile.in: remove parentdir support, use INSTALL_XFORM @@ -362,6 +409,7 @@ Wed Dec 9 08:38:05 1992 Steve Chamberlain (sac@thepub.cygnus.com) (lang_ini_script_file): initialize more parts of the command line bfd. * ldlex.l: fix DEFINED start states. + Mon Dec 7 08:43:41 1992 Steve Chamberlain (sac@thepub.cygnus.com) -y support * ld.texinfo: new doc. diff --git a/ld/Makefile.in b/ld/Makefile.in index ca65f0c..0151f45 100644 --- a/ld/Makefile.in +++ b/ld/Makefile.in @@ -41,6 +41,7 @@ man9dir = $(mandir)/man9 infodir = $(prefix)/info includedir = $(prefix)/include docdir = $(datadir)/doc +scriptdir = $(datadir)/ld gcclibdir = $(libdir)/gcc/$(target_alias) @@ -75,7 +76,7 @@ LIB_PATH = BASEDIR = ../.. INCLUDE = $(srcdir)/../include -INCLUDES = -I. -I$(srcdir) -I../include -I$(srcdir)/../bfd -I$(INCLUDE) +INCLUDES = -I. -I$(srcdir) -I../include -I$(srcdir)/../bfd -I../bfd -I$(INCLUDE) # What version of the manual to build DOCVER = gen @@ -95,8 +96,8 @@ ROFF = groff #stuff for self hosting (can be overridden in config file). HOSTING_CRT0=/lib/crt0.o -HOSTING_LIBS=`if [ -f ../gcc/libgcc.a ] ; then echo ../gcc/libgcc.a ; else echo $(libdir)/libgcc.a; fi` -lc -HOSTING_EMU=LDEMULATION=$(EMUL); export LDEMULATION +HOSTING_LIBS=`if [ -f ../gcc/libgcc.a ] ; then echo ../gcc/libgcc.a ; else gcc -print-libgcc-file-name; fi` -lc +HOSTING_EMU=-m $(EMUL) C++ = g++ -fgnu-linker @@ -105,13 +106,8 @@ C++ = g++ -fgnu-linker LINTFLAGS = $(INCLUDES) $(EXTRA_DEF) -.SUFFIXES: .y .x .xr .xu .xn .xbn .sc .scu .scr .scn $(SUFFIXES) .cc - .c.o: - $(CC) -c $(CFLAGS) $(INCLUDES) $(HDEFINES) $(TDEFINES) $(CDEFINES) $< - -.cc.o: - $(C++) -c $(CFLAGS) -I$(srcdir) $< + $(CC) -c $(INCLUDES) $(HDEFINES) $(TDEFINES) $(CDEFINES) $(CFLAGS) $< # go directly to ld.new in case this ld isn't capable of # linking native object on this host. It can be renamed on @@ -124,10 +120,10 @@ LIBIBERTY=./../libiberty/libiberty.a 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_hp3hpux.o \ - em_h8300hms.o em_ebmon29k.o em_sun4.o em_gld960.o \ + em_h8300.o em_ebmon29k.o em_sun4.o em_gld960.o \ em_m68kcoff.o em_st2000.o em_sa29200.o \ em_vanilla.o em_i386coff.o em_z8ksim.o em_mipslit.o em_i386bsd.o \ - em_mipsbig.o em_mipsbsd.o em_mipsidt.o em_vax.o em_h8500hms.o \ + em_mipsbig.o em_mipsbsd.o em_mipsidt.o em_vax.o em_h8500.o \ em_hppaosf.o em_mipsidtl.o em_sh.o EMULATION_OFILES=${ALL_EMULATIONS} @@ -157,12 +153,10 @@ BFDSOURCES=../../bfd/common/*.c SOURCES= $(LDSOURCES) $(BFDSOURCES) LINTSOURCES= $(LDCSOURCES) $(BFDSOURCES) $(GENERATED_SOURCES) -STAGESTUFF = *.x *.x[runN] *.sc[runN] $(GENERATED_SOURCES) $(GENERATED_HEADERS) $(OFILES) mkscript +STAGESTUFF = emulations/* $(GENERATED_SOURCES) $(GENERATED_HEADERS) $(OFILES) all: $(LD_PROG) -check: bootstrap check-cdtest -installcheck: info: ld.info ldgram.h ldgram.c: ldgram.y @@ -179,7 +173,7 @@ DEF_EMUL = ` if [ -z "$(EMUL)" ] ; then \ fi` ldmain.o: ldmain.c - $(CC) $(CFLAGS) $(INCLUDES) $(HDEFINES) $(TDEFINES) $(CDEFINES) $(DEF_EMUL) -c $< + $(CC) -c $(INCLUDES) $(HDEFINES) $(TDEFINES) $(CDEFINES) $(DEF_EMUL) -DSCRIPTDIR='"$(scriptdir)"' $(CFLAGS) $< ldemul-list.h: (echo "/* This file is automatically generated. DO NOT EDIT! */";\ @@ -203,121 +197,129 @@ ldlex.c: ldlex.l ldgram.h # These all start with em_ so 'make clean' can find them. -GENSCRIPTS=sh $(srcdir)/genscripts.sh ${srcdir} ${host_alias} ${target_alias} -GEN_DEPENDS=mkscript $(srcdir)/genscripts.sh +GENSCRIPTS=sh $(srcdir)/genscripts.sh ${srcdir} ${tooldir}/lib ${libdir} ${host_alias} ${target_alias} +GEN_DEPENDS=$(srcdir)/genscripts.sh -em_sun4.c: $(srcdir)/sun4.sh \ - $(srcdir)/generic.em $(srcdir)/aout.sc-sh ${GEN_DEPENDS} +em_sun4.c: $(srcdir)/emulparams/sun4.sh \ + $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/aout.sc ${GEN_DEPENDS} ${GENSCRIPTS} sun4.sh -em_sun3.c: $(srcdir)/sun3.sh \ - $(srcdir)/generic.em $(srcdir)/aout.sc-sh ${GEN_DEPENDS} +em_sun3.c: $(srcdir)/emulparams/sun3.sh \ + $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/aout.sc ${GEN_DEPENDS} ${GENSCRIPTS} sun3.sh -em_go32.c: $(srcdir)/go32.sh \ - $(srcdir)/generic.em $(srcdir)/aout.sc-sh ${GEN_DEPENDS} +em_go32.c: $(srcdir)/emulparams/go32.sh \ + $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/aout.sc ${GEN_DEPENDS} ${GENSCRIPTS} go32.sh -em_news.c: $(srcdir)/news.sh \ - $(srcdir)/generic.em $(srcdir)/aout.sc-sh ${GEN_DEPENDS} +em_news.c: $(srcdir)/emulparams/news.sh \ + $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/aout.sc ${GEN_DEPENDS} ${GENSCRIPTS} news.sh -em_vax.c: $(srcdir)/vax.sh \ - $(srcdir)/generic.em $(srcdir)/aout.sc-sh ${GEN_DEPENDS} +em_vax.c: $(srcdir)/emulparams/vax.sh \ + $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/aout.sc ${GEN_DEPENDS} ${GENSCRIPTS} vax.sh -em_hp300bsd.c: $(srcdir)/hp300bsd.sh \ - $(srcdir)/generic.em $(srcdir)/aout.sc-sh ${GEN_DEPENDS} +em_hp300bsd.c: $(srcdir)/emulparams/hp300bsd.sh \ + $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/aout.sc ${GEN_DEPENDS} ${GENSCRIPTS} hp300bsd.sh -em_hp3hpux.c: $(srcdir)/hp3hpux.sh \ - $(srcdir)/generic.em $(srcdir)/aout.sc-sh ${GEN_DEPENDS} +em_hp3hpux.c: $(srcdir)/emulparams/hp3hpux.sh \ + $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/aout.sc ${GEN_DEPENDS} ${GENSCRIPTS} hp3hpux.sh -em_hppaosf.c: $(srcdir)/hppaosf.sh \ - $(srcdir)/hppaosf.em $(srcdir)/hppaosf.sc-sh ${GEN_DEPENDS} +em_hppaosf.c: $(srcdir)/emulparams/hppaosf.sh \ + $(srcdir)/emultempl/hppaosf.em $(srcdir)/scripttempl/hppaosf.sc ${GEN_DEPENDS} ${GENSCRIPTS} hppaosf.sh -em_i386aout.c: $(srcdir)/i386aout.sh \ - $(srcdir)/generic.em $(srcdir)/aout.sc-sh ${GEN_DEPENDS} +em_i386aout.c: $(srcdir)/emulparams/i386aout.sh \ + $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/aout.sc ${GEN_DEPENDS} ${GENSCRIPTS} i386aout.sh -em_ebmon29k.c: $(srcdir)/ebmon29k.sh \ - $(srcdir)/generic.em $(srcdir)/ebmon29k.sc-sh ${GEN_DEPENDS} +em_ebmon29k.c: $(srcdir)/emulparams/ebmon29k.sh \ + $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/ebmon29k.sc ${GEN_DEPENDS} ${GENSCRIPTS} ebmon29k.sh -em_sa29200.c: $(srcdir)/sa29200.sh \ - $(srcdir)/generic.em $(srcdir)/sa29200.sc-sh ${GEN_DEPENDS} +em_sa29200.c: $(srcdir)/emulparams/sa29200.sh \ + $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/sa29200.sc ${GEN_DEPENDS} ${GENSCRIPTS} sa29200.sh -em_a29k.c: $(srcdir)/a29k.sh \ - $(srcdir)/generic.em $(srcdir)/a29k.sc-sh ${GEN_DEPENDS} +em_a29k.c: $(srcdir)/emulparams/a29k.sh \ + $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/a29k.sc ${GEN_DEPENDS} ${GENSCRIPTS} a29k.sh -em_m88kbcs.c: $(srcdir)/m88kbcs.sh \ - $(srcdir)/generic.em $(srcdir)/h8300hms.sc-sh ${GEN_DEPENDS} +em_m88kbcs.c: $(srcdir)/emulparams/m88kbcs.sh \ + $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/h8300.sc ${GEN_DEPENDS} ${GENSCRIPTS} m88kbcs.sh -em_h8300hms.c: $(srcdir)/h8300hms.sh \ - $(srcdir)/h8300hms.em $(srcdir)/h8300hms.sc-sh ${GEN_DEPENDS} - ${GENSCRIPTS} h8300hms.sh -em_h8500hms.c: $(srcdir)/h8500hms.sh \ - $(srcdir)/h8500hms.em $(srcdir)/h8500hms.sc-sh ${GEN_DEPENDS} - ${GENSCRIPTS} h8500hms.sh -em_sh.c: $(srcdir)/sh.sh \ - $(srcdir)/sh.em $(srcdir)/sh.sc-sh ${GEN_DEPENDS} +em_h8300.c: $(srcdir)/emulparams/h8300.sh \ + $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/h8300.sc ${GEN_DEPENDS} + ${GENSCRIPTS} h8300.sh +em_h8500.c: $(srcdir)/emulparams/h8500.sh \ + $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/h8500.sc ${GEN_DEPENDS} + ${GENSCRIPTS} h8500.sh +em_sh.c: $(srcdir)/emulparams/sh.sh \ + $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/sh.sc ${GEN_DEPENDS} ${GENSCRIPTS} sh.sh -em_st2000.c: $(srcdir)/st2000.sh \ - $(srcdir)/st2000.em $(srcdir)/st2000.sc-sh ${GEN_DEPENDS} +em_st2000.c: $(srcdir)/emulparams/st2000.sh \ + $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/st2000.sc ${GEN_DEPENDS} ${GENSCRIPTS} st2000.sh -em_z8ksim.c: $(srcdir)/z8ksim.sh \ - $(srcdir)/z8ksim.em $(srcdir)/z8ksim.sc-sh ${GEN_DEPENDS} +em_z8ksim.c: $(srcdir)/emulparams/z8ksim.sh \ + $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/z8ksim.sc ${GEN_DEPENDS} ${GENSCRIPTS} z8ksim.sh -em_vanilla.c: $(srcdir)/vanilla.sh \ - $(srcdir)/vanilla.em $(srcdir)/vanilla.sc-sh ${GEN_DEPENDS} +em_vanilla.c: $(srcdir)/emulparams/vanilla.sh \ + $(srcdir)/emultempl/vanilla.em $(srcdir)/scripttempl/vanilla.sc ${GEN_DEPENDS} ${GENSCRIPTS} vanilla.sh -em_lnk960.c: $(srcdir)/lnk960.sh \ - $(srcdir)/lnk960.em $(srcdir)/i960.sc-sh ${GEN_DEPENDS} +em_lnk960.c: $(srcdir)/emulparams/lnk960.sh \ + $(srcdir)/emultempl/lnk960.em $(srcdir)/scripttempl/i960.sc ${GEN_DEPENDS} ${GENSCRIPTS} lnk960.sh -em_gld960.c: $(srcdir)/gld960.sh \ - $(srcdir)/gld960.em $(srcdir)/i960.sc-sh ${GEN_DEPENDS} +em_gld960.c: $(srcdir)/emulparams/gld960.sh \ + $(srcdir)/emultempl/gld960.em $(srcdir)/scripttempl/i960.sc ${GEN_DEPENDS} ${GENSCRIPTS} gld960.sh -em_m68kcoff.c: $(srcdir)/m68kcoff.sh \ - $(srcdir)/generic.em $(srcdir)/m68kcoff.sc-sh ${GEN_DEPENDS} +em_m68kcoff.c: $(srcdir)/emulparams/m68kcoff.sh \ + $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/m68kcoff.sc ${GEN_DEPENDS} ${GENSCRIPTS} m68kcoff.sh -em_i386coff.c: $(srcdir)/i386coff.sh \ - $(srcdir)/generic.em $(srcdir)/i386coff.sc-sh ${GEN_DEPENDS} +em_i386coff.c: $(srcdir)/emulparams/i386coff.sh \ + $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/i386coff.sc ${GEN_DEPENDS} ${GENSCRIPTS} i386coff.sh -em_mipslit.c: $(srcdir)/mipslit.sh \ - $(srcdir)/generic.em $(srcdir)/mips.sc-sh ${GEN_DEPENDS} +em_mipslit.c: $(srcdir)/emulparams/mipslit.sh \ + $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/mips.sc ${GEN_DEPENDS} ${GENSCRIPTS} mipslit.sh -em_i386bsd.c: $(srcdir)/i386bsd.sh \ - $(srcdir)/generic.em $(srcdir)/aout.sc-sh ${GEN_DEPENDS} +em_i386bsd.c: $(srcdir)/emulparams/i386bsd.sh \ + $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/aout.sc ${GEN_DEPENDS} ${GENSCRIPTS} i386bsd.sh -em_mipsbig.c: $(srcdir)/mipsbig.sh \ - $(srcdir)/generic.em $(srcdir)/mips.sc-sh ${GEN_DEPENDS} +em_mipsbig.c: $(srcdir)/emulparams/mipsbig.sh \ + $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/mips.sc ${GEN_DEPENDS} ${GENSCRIPTS} mipsbig.sh -em_mipsbsd.c: $(srcdir)/mipsbsd.sh \ - $(srcdir)/generic.em $(srcdir)/aout.sc-sh ${GEN_DEPENDS} +em_mipsbsd.c: $(srcdir)/emulparams/mipsbsd.sh \ + $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/aout.sc ${GEN_DEPENDS} ${GENSCRIPTS} mipsbsd.sh -em_mipsidt.c: $(srcdir)/mipsidt.sh \ - $(srcdir)/generic.em $(srcdir)/mips.sc-sh ${GEN_DEPENDS} +em_mipsidt.c: $(srcdir)/emulparams/mipsidt.sh \ + $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/mips.sc ${GEN_DEPENDS} ${GENSCRIPTS} mipsidt.sh -em_mipsidtl.c: $(srcdir)/mipsidtl.sh \ - $(srcdir)/generic.em $(srcdir)/mips.sc-sh ${GEN_DEPENDS} +em_mipsidtl.c: $(srcdir)/emulparams/mipsidtl.sh \ + $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/mips.sc ${GEN_DEPENDS} ${GENSCRIPTS} mipsidtl.sh $(LD_PROG): $(OFILES) $(BFDLIB) $(LIBIBERTY) - $(CC) $(CFLAGS) $(INCLUDES) $(HDEFINES) $(TDEFINES) $(CDEFINES) $(LDFLAGS) -o $(LD_PROG) $(OFILES) $(BFDLIB) $(LIBIBERTY) $(LOADLIBES) + $(CC) $(INCLUDES) $(HDEFINES) $(TDEFINES) $(CDEFINES) $(LDFLAGS) -o $(LD_PROG) $(OFILES) $(BFDLIB) $(LIBIBERTY) $(LOADLIBES) $(CFLAGS) + + +# CHECK TARGETS + +check: bootstrap check-cdtest +installcheck: # Rules for testing by relinking ld itself. ld-partial.o: ld.new - $(HOSTING_EMU); ./ld.new -o ld-partial.o -r $(OFILES) + ./ld.new -Lemulations $(HOSTING_EMU) -o ld-partial.o -r $(OFILES) ld1: ld-partial.o - $(HOSTING_EMU); ./ld.new -o ld1 $(HOSTING_CRT0) ld-partial.o $(BFDLIB) $(LIBIBERTY) $(HOSTING_LIBS) + ./ld.new -Lemulations $(HOSTING_EMU) -o ld1 $(HOSTING_CRT0) ld-partial.o $(BFDLIB) $(LIBIBERTY) $(HOSTING_LIBS) ld1-full: ld.new - $(HOSTING_EMU); ./ld.new -o ld1-full $(HOSTING_CRT0) $(OFILES) $(BFDLIB) $(LIBIBERTY) $(HOSTING_LIBS) + ./ld.new -Lemulations $(HOSTING_EMU) -o ld1-full $(HOSTING_CRT0) $(OFILES) $(BFDLIB) $(LIBIBERTY) $(HOSTING_LIBS) ld2: ld1 - $(HOSTING_EMU); ./ld1 -o ld2 $(HOSTING_CRT0) $(OFILES) $(BFDLIB) $(LIBIBERTY) $(HOSTING_LIBS) + ./ld1 -Lemulations $(HOSTING_EMU) -o ld2 $(HOSTING_CRT0) $(OFILES) $(BFDLIB) $(LIBIBERTY) $(HOSTING_LIBS) ld3: ld2 - $(HOSTING_EMU); ./ld2 -o ld3 $(HOSTING_CRT0) $(OFILES) $(BFDLIB) $(LIBIBERTY) $(HOSTING_LIBS) + ./ld2 -Lemulations $(HOSTING_EMU) -o ld3 $(HOSTING_CRT0) $(OFILES) $(BFDLIB) $(LIBIBERTY) $(HOSTING_LIBS) bootstrap: ld3 cmp ld2 ld3 +# A test program for C++ constructors and destructors. + cdtest: cdtest-main.o cdtest-func.o cdtest-foo.o ld.new - $(HOSTING_EMU); ./ld.new -o cdtest $(HOSTING_CRT0) \ + ./ld.new -Lemulations $(HOSTING_EMU) -o cdtest $(HOSTING_CRT0) \ cdtest-main.o cdtest-func.o cdtest-foo.o $(HOSTING_LIBS) check-cdtest: cdtest $(srcdir)/cdtest.exp @@ -423,12 +425,6 @@ ld-index.me: ld.me texi2index >ld-index.me -mkscript.o: $(srcdir)/mkscript.c - $(CC_FOR_BUILD) -c $(srcdir)/mkscript.c - -mkscript: mkscript.o - $(CC_FOR_BUILD) -o mkscript mkscript.o - ldlex.o: ldlex.c ldgram.h ldgram.o: ldgram.c ldgram.c:ldgram.y @@ -441,7 +437,7 @@ lexsup.o: lexsup.c ldgram.h mri.o: mri.c ldgram.h relax.o: relax.c ldgram.h -h8300hms.o:h8300hms.c +h8300.o:h8300.c h8300xray.o:h8300xray.c st2000.o:st2000.c z8ksim.o:z8ksim.c @@ -515,9 +511,9 @@ objdump:objdump.c .PHONY: install install: - $(INSTALL_XFORM) ld.new $(bindir)/ld; \ - $(INSTALL_XFORM1) $(srcdir)/ld.1 $(man1dir)/ld.1; \ - + $(INSTALL_XFORM) ld.new $(bindir)/ld + $(INSTALL_XFORM1) $(srcdir)/ld.1 $(man1dir)/ld.1 + cd emulations; for f in *; do $(INSTALL_DATA) $$f $(scriptdir)/$$f; done -n=`t='$(program_transform_name)'; echo ld | sed -e "" $$t`; \ rm -f $(tooldir)/bin/ld; \ ln $(bindir)/$$n $(tooldir)/bin/ld \ diff --git a/ld/configure.in b/ld/configure.in index f0ee0b0..f9e0a7d 100644 --- a/ld/configure.in +++ b/ld/configure.in @@ -9,6 +9,8 @@ target_dependent=true # per-host: +. ${srcdir}/../bfd/configure.host + host_makefile_frag= if [ -f ${srcdir}/config/${my_host}.mh ] ; then @@ -122,3 +124,5 @@ if [ ! -r ${srcdir}/${target_makefile_frag} ]; then echo '***' GNU LD does not support target ${target} 1>&2 exit 1 fi + +mkdir emulations 2>/dev/null diff --git a/ld/emulparams/.Sanitize b/ld/emulparams/.Sanitize new file mode 100644 index 0000000..c2010dc --- /dev/null +++ b/ld/emulparams/.Sanitize @@ -0,0 +1,65 @@ +# .Sanitize for devo/ld/config + +# Each directory to survive its way into a release will need a file +# like this one called "./.Sanitize". All keyword lines must exist, +# and must exist in the order specified by this file. Each directory +# in the tree will be processed, top down, in the following order. + +# Hash started lines like this one are comments and will be deleted +# before anything else is done. Blank lines will also be squashed +# out. + +# The lines between the "Do-first:" line and the "Things-to-keep:" +# line are executed as a /bin/sh shell script before anything else is +# done in this directory. + +Do-first: + + +# All files listed between the "Things-to-keep:" line and the +# "Do-last:" line will be kept. All other files will be removed. +# Directories listed in this section will have their own Sanitize +# called. Directories not listed will be removed in their entirety +# with rm -rf. + +Things-to-keep: + +README +a29k.sh +ebmon29k.sh +gld960.sh +go32.sh +h8300.sh +h8500.sh +hp300bsd.sh +hp3hpux.sh +hppaosf.sh +i386aout.sh +i386bsd.sh +i386coff.sh +lnk960.sh +m68kcoff.sh +m88kbcs.sh +mipsbig.sh +mipsbsd.sh +mipsidt.sh +mipsidtl.sh +mipslit.sh +news.sh +sa29200.sh +sh.sh +st2000.sh +sun3.sh +sun4.sh +vanilla.sh +vax.sh +z8ksim.sh + +Things-to-lose: + +# The lines between the "Do-last:" line and the end of the file +# are executed as a /bin/sh shell script after everything else is +# done. + +Do-last: + diff --git a/ld/emulparams/README b/ld/emulparams/README new file mode 100644 index 0000000..b3d6d26 --- /dev/null +++ b/ld/emulparams/README @@ -0,0 +1,2 @@ +The files in this directory are read by genscripts.sh as shell commands. +They set parameters for the emulations. diff --git a/ld/emulparams/a29k.sh b/ld/emulparams/a29k.sh new file mode 100644 index 0000000..f1b7dea --- /dev/null +++ b/ld/emulparams/a29k.sh @@ -0,0 +1,6 @@ +EMULATION_NAME=a29k +SCRIPT_NAME=a29k +OUTPUT_FORMAT="coff-a29k-big" +TEXT_START_ADDR=0x1000000 +PAGE_SIZE=0x1000000 +ARCH=a29k diff --git a/ld/emulparams/ebmon29k.sh b/ld/emulparams/ebmon29k.sh new file mode 100644 index 0000000..a7c3634 --- /dev/null +++ b/ld/emulparams/ebmon29k.sh @@ -0,0 +1,6 @@ +EMULATION_NAME=ebmon29k +SCRIPT_NAME=ebmon29k +OUTPUT_FORMAT="coff-a29k-big" +TEXT_START_ADDR=0x8000 +PAGE_SIZE=0x1000 +ARCH=a29k diff --git a/ld/emulparams/gld960.sh b/ld/emulparams/gld960.sh new file mode 100644 index 0000000..d4fea7a --- /dev/null +++ b/ld/emulparams/gld960.sh @@ -0,0 +1,8 @@ +EMULATION_NAME=gld960 +SCRIPT_NAME=i960 +OUTPUT_FORMAT="" +TEXT_START_ADDR=?? +PAGE_SIZE=?? +ARCH=i960 +TEMPLATE_NAME=gld960 +GLD_STYLE=1 diff --git a/ld/emulparams/go32.sh b/ld/emulparams/go32.sh new file mode 100644 index 0000000..cd548d8 --- /dev/null +++ b/ld/emulparams/go32.sh @@ -0,0 +1,9 @@ +EMULATION_NAME=go32 +SCRIPT_NAME=aout +OUTPUT_FORMAT="a.out-i386" +TEXT_START_ADDR=0x1020 +PAGE_SIZE=0x1000 +SEGMENT_SIZE=0x400000 +NONPAGED_TEXT_START_ADDR=0x0 +ARCH=i386 + diff --git a/ld/emulparams/h8300.sh b/ld/emulparams/h8300.sh new file mode 100644 index 0000000..6013005 --- /dev/null +++ b/ld/emulparams/h8300.sh @@ -0,0 +1,6 @@ +EMULATION_NAME=h8300 +SCRIPT_NAME=h8300 +OUTPUT_FORMAT="coff-h8300" +TEXT_START_ADDR=0x8000 +PAGE_SIZE=128 +ARCH=h8300 diff --git a/ld/emulparams/h8500.sh b/ld/emulparams/h8500.sh new file mode 100644 index 0000000..f57fbc9 --- /dev/null +++ b/ld/emulparams/h8500.sh @@ -0,0 +1,6 @@ +EMULATION_NAME=h8500 +SCRIPT_NAME=h8500 +OUTPUT_FORMAT="coff-h8500" +TEXT_START_ADDR=0x8000 +PAGE_SIZE=128 +ARCH=h8500 diff --git a/ld/emulparams/hp300bsd.sh b/ld/emulparams/hp300bsd.sh new file mode 100644 index 0000000..abdd5eb --- /dev/null +++ b/ld/emulparams/hp300bsd.sh @@ -0,0 +1,6 @@ +EMULATION_NAME=hp300bsd +SCRIPT_NAME=aout +OUTPUT_FORMAT="a.out-hp300bsd" +TEXT_START_ADDR=0 +PAGE_SIZE=4096 +ARCH=m68k diff --git a/ld/emulparams/hp3hpux.sh b/ld/emulparams/hp3hpux.sh new file mode 100644 index 0000000..bd066c3 --- /dev/null +++ b/ld/emulparams/hp3hpux.sh @@ -0,0 +1,9 @@ +EMULATION_NAME=hp3hpux +SCRIPT_NAME=aout +OUTPUT_FORMAT="a.out-hp300hpux" +TEXT_START_ADDR=0 +PAGE_SIZE=4096 +ARCH=m68k +STACKZERO="___stack_zero = 0x2000;" +# This is needed for HPUX 9.0; it is unnecessary but harmless for 8.0. +SHLIB_PATH="___dld_shlib_path = 0;" diff --git a/ld/emulparams/hppaosf.sh b/ld/emulparams/hppaosf.sh new file mode 100644 index 0000000..ba34bf4 --- /dev/null +++ b/ld/emulparams/hppaosf.sh @@ -0,0 +1,8 @@ +EMULATION_NAME=hppaosf +SCRIPT_NAME=hppaosf +OUTPUT_FORMAT="elf-big" +TEXT_START_ADDR=0x1000 +PAGE_SIZE=4096 +ARCH=hppa +START="$START$" +TEMPLATE_NAME=hppaosf diff --git a/ld/emulparams/i386aout.sh b/ld/emulparams/i386aout.sh new file mode 100644 index 0000000..fa7d265 --- /dev/null +++ b/ld/emulparams/i386aout.sh @@ -0,0 +1,7 @@ +EMULATION_NAME=i386aout +SCRIPT_NAME=aout +OUTPUT_FORMAT="a.out-i386" +PAGE_SIZE=0x1000 +TEXT_START_ADDR=0 +NONPAGED_TEXT_START_ADDR=0x1000 +ARCH=i386 diff --git a/ld/emulparams/i386bsd.sh b/ld/emulparams/i386bsd.sh new file mode 100644 index 0000000..a6d55a9 --- /dev/null +++ b/ld/emulparams/i386bsd.sh @@ -0,0 +1,7 @@ +EMULATION_NAME=i386bsd +SCRIPT_NAME=aout +OUTPUT_FORMAT="a.out-i386-bsd" +PAGE_SIZE=0x1000 +TEXT_START_ADDR=0 +NONPAGED_TEXT_START_ADDR=0x1000 +ARCH=i386 diff --git a/ld/emulparams/i386coff.sh b/ld/emulparams/i386coff.sh new file mode 100644 index 0000000..bbe13bf --- /dev/null +++ b/ld/emulparams/i386coff.sh @@ -0,0 +1,6 @@ +EMULATION_NAME=i386coff +SCRIPT_NAME=i386coff +OUTPUT_FORMAT="coff-i386" +TEXT_START_ADDR=0x1000000 +PAGE_SIZE=0x1000000 +ARCH=i386 diff --git a/ld/emulparams/lnk960.sh b/ld/emulparams/lnk960.sh new file mode 100644 index 0000000..9dff062 --- /dev/null +++ b/ld/emulparams/lnk960.sh @@ -0,0 +1,7 @@ +EMULATION_NAME=lnk960 +SCRIPT_NAME=i960 +OUTPUT_FORMAT="" +TEXT_START_ADDR=?? +PAGE_SIZE=?? +ARCH=i960 +TEMPLATE_NAME=lnk960 diff --git a/ld/emulparams/m68kcoff.sh b/ld/emulparams/m68kcoff.sh new file mode 100644 index 0000000..14c6652 --- /dev/null +++ b/ld/emulparams/m68kcoff.sh @@ -0,0 +1,6 @@ +EMULATION_NAME=m68kcoff +SCRIPT_NAME=m68kcoff +OUTPUT_FORMAT="coff-m68k" +TEXT_START_ADDR=0x1000000 +PAGE_SIZE=0x1000000 +ARCH=m68k diff --git a/ld/emulparams/mipsbig.sh b/ld/emulparams/mipsbig.sh new file mode 100644 index 0000000..9e8f963 --- /dev/null +++ b/ld/emulparams/mipsbig.sh @@ -0,0 +1,5 @@ +EMULATION_NAME=mipsbig +SCRIPT_NAME=mips +OUTPUT_FORMAT="ecoff-bigmips" +PAGE_SIZE=0x1000000 +ARCH=mips diff --git a/ld/emulparams/mipsbsd.sh b/ld/emulparams/mipsbsd.sh new file mode 100644 index 0000000..a38b5b6 --- /dev/null +++ b/ld/emulparams/mipsbsd.sh @@ -0,0 +1,6 @@ +EMULATION_NAME=mipsbsd +SCRIPT_NAME=mipsbsd +OUTPUT_FORMAT="aout-mips-little" +TEXT_START_ADDR=0x1020 +PAGE_SIZE=4096 +ARCH=mips diff --git a/ld/emulparams/mipsidt.sh b/ld/emulparams/mipsidt.sh new file mode 100644 index 0000000..6d55bdf --- /dev/null +++ b/ld/emulparams/mipsidt.sh @@ -0,0 +1,9 @@ +EMULATION_NAME=mipsidt +SCRIPT_NAME=mips +OUTPUT_FORMAT="ecoff-bigmips" +PAGE_SIZE=0x1000000 +ARCH=mips +ENTRY=start +TEXT_START_ADDR=0xa0012000 +DATA_ADDR=. +BSS_VAR="_fbss = .;" diff --git a/ld/emulparams/mipsidtl.sh b/ld/emulparams/mipsidtl.sh new file mode 100644 index 0000000..dfa9246 --- /dev/null +++ b/ld/emulparams/mipsidtl.sh @@ -0,0 +1,9 @@ +EMULATION_NAME=mipsidtl +SCRIPT_NAME=mips +OUTPUT_FORMAT="ecoff-littlemips" +PAGE_SIZE=0x1000000 +ARCH=mips +ENTRY=start +TEXT_START_ADDR=0xa0012000 +DATA_ADDR=. +BSS_VAR="_fbss = .;" diff --git a/ld/emulparams/mipslit.sh b/ld/emulparams/mipslit.sh new file mode 100644 index 0000000..50365b8 --- /dev/null +++ b/ld/emulparams/mipslit.sh @@ -0,0 +1,5 @@ +EMULATION_NAME=mipslit +SCRIPT_NAME=mips +OUTPUT_FORMAT="ecoff-littlemips" +PAGE_SIZE=0x1000000 +ARCH=mips diff --git a/ld/emulparams/news.sh b/ld/emulparams/news.sh new file mode 100644 index 0000000..a918544 --- /dev/null +++ b/ld/emulparams/news.sh @@ -0,0 +1,6 @@ +EMULATION_NAME=news +SCRIPT_NAME=aout +OUTPUT_FORMAT="a.out-newsos3" +TEXT_START_ADDR=0 +PAGE_SIZE=0x1000 +ARCH=m68k diff --git a/ld/emulparams/sa29200.sh b/ld/emulparams/sa29200.sh new file mode 100644 index 0000000..96b2846 --- /dev/null +++ b/ld/emulparams/sa29200.sh @@ -0,0 +1,6 @@ +EMULATION_NAME=sa29200 +SCRIPT_NAME=sa29200 +OUTPUT_FORMAT="coff-a29k-big" +TEXT_START_ADDR=0x40004000 +PAGE_SIZE=0x1000 +ARCH=a29k diff --git a/ld/emulparams/sh.sh b/ld/emulparams/sh.sh new file mode 100644 index 0000000..51f1f99 --- /dev/null +++ b/ld/emulparams/sh.sh @@ -0,0 +1,6 @@ +EMULATION_NAME=sh +SCRIPT_NAME=sh +OUTPUT_FORMAT="coff-sh" +TEXT_START_ADDR=0x8000 +PAGE_SIZE=128 +ARCH=sh diff --git a/ld/emulparams/st2000.sh b/ld/emulparams/st2000.sh new file mode 100644 index 0000000..96308dc --- /dev/null +++ b/ld/emulparams/st2000.sh @@ -0,0 +1,6 @@ +EMULATION_NAME=st2000 +SCRIPT_NAME=st2000 +OUTPUT_FORMAT="coff-m68k" +TEXT_START_ADDR=0x0 +PAGE_SIZE=128 +ARCH=m68k diff --git a/ld/emulparams/sun3.sh b/ld/emulparams/sun3.sh new file mode 100644 index 0000000..b47e0dc --- /dev/null +++ b/ld/emulparams/sun3.sh @@ -0,0 +1,8 @@ +EMULATION_NAME=sun3 +SCRIPT_NAME=aout +OUTPUT_FORMAT="a.out-sunos-big" +TEXT_START_ADDR=0x2020 +PAGE_SIZE=0x2000 +SEGMENT_SIZE=0x20000 +NONPAGED_TEXT_START_ADDR=0x2000 +ARCH=m68k diff --git a/ld/emulparams/vanilla.sh b/ld/emulparams/vanilla.sh new file mode 100644 index 0000000..7762581 --- /dev/null +++ b/ld/emulparams/vanilla.sh @@ -0,0 +1,6 @@ +EMULATION_NAME=vanilla +SCRIPT_NAME=vanilla +TEXT_START_ADDR=?? +PAGE_SIZE=?? +ARCH=unknown +TEMPLATE_NAME=vanilla diff --git a/ld/emulparams/vax.sh b/ld/emulparams/vax.sh new file mode 100644 index 0000000..18a9857 --- /dev/null +++ b/ld/emulparams/vax.sh @@ -0,0 +1,6 @@ +EMULATION_NAME=vax +SCRIPT_NAME=aout +OUTPUT_FORMAT="a.out-vax" +TEXT_START_ADDR=0 +PAGE_SIZE=1024 +ARCH=vax diff --git a/ld/emulparams/z8ksim.sh b/ld/emulparams/z8ksim.sh new file mode 100644 index 0000000..1fa1eb3 --- /dev/null +++ b/ld/emulparams/z8ksim.sh @@ -0,0 +1,6 @@ +EMULATION_NAME=z8ksim +SCRIPT_NAME=z8ksim +OUTPUT_FORMAT="coff-z8k" +TEXT_START_ADDR=0x0 +PAGE_SIZE=128 +ARCH=z8k diff --git a/ld/emultempl/.Sanitize b/ld/emultempl/.Sanitize new file mode 100644 index 0000000..32d8d10 --- /dev/null +++ b/ld/emultempl/.Sanitize @@ -0,0 +1,41 @@ +# .Sanitize for devo/ld/config + +# Each directory to survive its way into a release will need a file +# like this one called "./.Sanitize". All keyword lines must exist, +# and must exist in the order specified by this file. Each directory +# in the tree will be processed, top down, in the following order. + +# Hash started lines like this one are comments and will be deleted +# before anything else is done. Blank lines will also be squashed +# out. + +# The lines between the "Do-first:" line and the "Things-to-keep:" +# line are executed as a /bin/sh shell script before anything else is +# done in this directory. + +Do-first: + + +# All files listed between the "Things-to-keep:" line and the +# "Do-last:" line will be kept. All other files will be removed. +# Directories listed in this section will have their own Sanitize +# called. Directories not listed will be removed in their entirety +# with rm -rf. + +Things-to-keep: + +README +generic.em +gld960.em +hppaosf.em +lnk960.em +vanilla.em + +Things-to-lose: + +# The lines between the "Do-last:" line and the end of the file +# are executed as a /bin/sh shell script after everything else is +# done. + +Do-last: + diff --git a/ld/emultempl/README b/ld/emultempl/README new file mode 100644 index 0000000..30ec0ab --- /dev/null +++ b/ld/emultempl/README @@ -0,0 +1,3 @@ +The files in this directory are sourced by genscripts.sh, after +setting some variables to substitute in, to produce +C source files that contain jump tables for each emulation. diff --git a/ld/emultempl/hppaosf.em b/ld/emultempl/hppaosf.em new file mode 100644 index 0000000..b066f6b --- /dev/null +++ b/ld/emultempl/hppaosf.em @@ -0,0 +1,115 @@ +cat >em_${EMULATION_NAME}.c <em_${EMULATION_NAME}.c <sym_ptr_ptr); static asymbol *error_symbol; @@ -60,9 +60,9 @@ DEFUN(ld_undefined_symbol,(relent, seclet), } } static void -DEFUN(ld_reloc_truncated,(relent, seclet), - CONST arelent *relent AND - bfd_seclet_type *seclet) +ld_reloc_truncated (relent, seclet) + CONST arelent *relent; + bfd_seclet_type *seclet; { asymbol *s = *(relent->sym_ptr_ptr); asection *section = seclet->u.indirect.section; @@ -75,7 +75,7 @@ DEFUN(ld_reloc_truncated,(relent, seclet), void -DEFUN_VOID(init_bfd_error_vector) +init_bfd_error_vector () { bfd_error_vector.undefined_symbol = ld_undefined_symbol; bfd_error_vector.reloc_value_truncated = ld_reloc_truncated; diff --git a/ld/ldgram.y b/ld/ldgram.y index e106b5f..5921c47 100644 --- a/ld/ldgram.y +++ b/ld/ldgram.y @@ -43,6 +43,7 @@ extern unsigned int lineno; extern boolean trace_files; extern boolean write_map; extern boolean option_longmap; +extern int g_switch_value; boolean hex_mode; static int typebits; strip_symbols_type strip_symbols=STRIP_NONE; @@ -90,7 +91,7 @@ static int error_index; char *name; int token; union etree_union *etree; -struct sec *section; + struct sec *section; struct lang_output_section_statement_struct *output_section_statement; union lang_statement_union **statement_ptr; int lineno; @@ -138,11 +139,11 @@ struct sec *section; %token NOLOAD DSECT COPY INFO OVERLAY %token NAME DEFINED TARGET_K SEARCH_DIR MAP ENTRY %token OPTION_e OPTION_c OPTION_noinhibit_exec OPTION_s OPTION_S OPTION_sort_common -%token OPTION_EB OPTION_EL +%token OPTION_EB OPTION_EL OPTION_G OPTION_Gval %token OPTION_format OPTION_F OPTION_u OPTION_Bstatic OPTION_N %token SIZEOF NEXT ADDR %token OPTION_d OPTION_dc OPTION_dp OPTION_x OPTION_X OPTION_defsym -%token OPTION_v OPTION_V OPTION_M OPTION_t STARTUP HLL SYSLIB FLOAT NOFLOAT +%token OPTION_v OPTION_V OPTION_m OPTION_memul OPTION_M OPTION_t STARTUP HLL SYSLIB FLOAT NOFLOAT %token OPTION_Map %token OPTION_n OPTION_r OPTION_o OPTION_b OPTION_R OPTION_relax %token OPTION_l OPTION_L OPTION_T OPTION_Aarch OPTION_Tfile OPTION_Texp @@ -197,6 +198,14 @@ command_line_option: write_map = true; config.map_filename = $2; } + | OPTION_m NAME + { + /* Ignore. */ + } + | OPTION_memul + { + /* Ignore. */ + } | OPTION_M { config.map_filename = "-"; @@ -303,9 +312,6 @@ command_line_option: { /* Ignore */ } - | NAME - { lang_add_input_file($1,lang_input_file_is_file_enum, - (char *)NULL); } | OPTION_c filename { ldfile_open_command_file($2); } mri_script_file END { ldlex_command();} @@ -348,9 +354,19 @@ command_line_option: ``produce a little-endian object file''. It could be used to select an output format. */ } + | OPTION_G NAME + { + g_switch_value = atoi ($2); + } + | OPTION_Gval + { + g_switch_value = yylval.integer; + } | '-' NAME - { info("%P%F Unrecognized option -%s\n", $2); } - + { einfo("%P%F illegal option -- %s\n", $2); } + | NAME + { lang_add_input_file($1,lang_input_file_is_file_enum, + (char *)NULL); } | '{' script_file '}' ; @@ -573,6 +589,11 @@ statement_list: | statement ; +statement_list_opt: + /* empty */ + | statement_list + ; + length: LONG { $$ = $1; } @@ -801,7 +822,7 @@ section: NAME { ldlex_expression(); } { lang_enter_output_section_statement($1,$3,typebits,0,0,0,$4); } - statement_list + statement_list_opt '}' {ldlex_expression();} fill_opt memspec_opt { ldlex_popstate(); diff --git a/ld/ldindr.c b/ld/ldindr.c index 8fe4b07..e48a8ed 100644 --- a/ld/ldindr.c +++ b/ld/ldindr.c @@ -48,9 +48,9 @@ static asymbol ** -DEFUN(move_it,(a_list, b_list), -asymbol **a_list AND -asymbol **b_list) +move_it (a_list, b_list) + asymbol **a_list; + asymbol **b_list; { asymbol **head = a_list; asymbol **cursor = head; @@ -71,15 +71,15 @@ asymbol **b_list) #if 0 void -DEFUN(copy_over,(ldsym, bfdsym), - ldsym_type *ldsym AND - asymbol **bfdsym) +copy_over (ldsym, bfdsym) + ldsym_type *ldsym; + asymbol **bfdsym; { while (list && *list) - { - refize(Q_enter_global_ref(list, name); - list = (asymbol **)((*list)->udata); - } + { + refize(Q_enter_global_ref(list, name)); + list = (asymbol **)((*list)->udata); + } } #endif @@ -87,8 +87,8 @@ DEFUN(copy_over,(ldsym, bfdsym), refs to the symbol are patched to know the alias - but we still have to fix all the old ones */ void -DEFUN(add_indirect,(ptr), -asymbol **ptr) +add_indirect (ptr) + asymbol **ptr; { asymbol **p; ldsym_type *lgs = ldsym_get((*ptr)->name); diff --git a/ld/ldlang.c b/ld/ldlang.c index 3f286f0..6b78478 100644 --- a/ld/ldlang.c +++ b/ld/ldlang.c @@ -115,34 +115,34 @@ etree_type *base; /* Relocation base - or null */ void lang_add_data PARAMS ((int type, union etree_union * exp)); PTR -DEFUN (stat_alloc, (size), - size_t size) +stat_alloc (size) + size_t size; { return obstack_alloc (&stat_obstack, size); } static void -DEFUN (print_size, (value), - size_t value) +print_size (value) + size_t value; { fprintf (config.map_file, "%5x", (unsigned) value); } static void -DEFUN (print_alignment, (value), - unsigned int value) +print_alignment (value) + unsigned int value; { fprintf (config.map_file, "2**%1u", value); } static void DEFUN (print_fill, (value), - fill_type value) + fill_type value) { fprintf (config.map_file, "%04x", (unsigned) value); } static void -DEFUN (print_section, (name), - CONST char *CONST name) +print_section (name) + CONST char *CONST name; { fprintf (config.map_file, "%*s", -longest_section_name, name); } @@ -153,9 +153,9 @@ DEFUN (print_section, (name), */ static void -DEFUN (lang_for_each_statement_worker, (func, s), - void (*func) ()AND - lang_statement_union_type * s) +lang_for_each_statement_worker (func, s) + void (*func) (); + lang_statement_union_type *s; { for (; s != (lang_statement_union_type *) NULL; s = s->next) { @@ -194,8 +194,8 @@ DEFUN (lang_for_each_statement_worker, (func, s), } void -DEFUN (lang_for_each_statement, (func), - void (*func) ()) +lang_for_each_statement (func) + void (*func) (); { lang_for_each_statement_worker (func, statement_list.head); @@ -203,8 +203,8 @@ DEFUN (lang_for_each_statement, (func), /*----------------------------------------------------------------------*/ void -DEFUN (lang_list_init, (list), - lang_statement_list_type * list) +lang_list_init (list) + lang_statement_list_type *list; { list->head = (lang_statement_union_type *) NULL; list->tail = &list->head; @@ -218,10 +218,10 @@ DEFUN (lang_list_init, (list), static lang_statement_union_type * -DEFUN (new_statement, (type, size, list), - enum statement_enum type AND - bfd_size_type size AND - lang_statement_list_type * list) +new_statement (type, size, list) + enum statement_enum type; + bfd_size_type size; + lang_statement_list_type * list; { lang_statement_union_type *new = (lang_statement_union_type *) stat_alloc (size); @@ -244,10 +244,10 @@ DEFUN (new_statement, (type, size, list), */ static lang_input_statement_type * -DEFUN (new_afile, (name, file_type, target), - CONST char *CONST name AND - CONST lang_input_file_enum_type file_type AND - CONST char *CONST target) +new_afile (name, file_type, target) + CONST char *CONST name; + CONST lang_input_file_enum_type file_type; + CONST char *CONST target; { lang_input_statement_type *p = new_stat (lang_input_statement, @@ -315,10 +315,10 @@ DEFUN (new_afile, (name, file_type, target), } lang_input_statement_type * -DEFUN (lang_add_input_file, (name, file_type, target), - CONST char *name AND - lang_input_file_enum_type file_type AND - CONST char *target) +lang_add_input_file (name, file_type, target) + CONST char *name; + lang_input_file_enum_type file_type; + CONST char *target; { /* Look it up or build a new one */ lang_has_input_file = true; @@ -342,8 +342,8 @@ DEFUN (lang_add_input_file, (name, file_type, target), } void -DEFUN (lang_add_keepsyms_file, (filename), - CONST char *filename) +lang_add_keepsyms_file (filename) + CONST char *filename; { extern strip_symbols_type strip_symbols; if (keepsyms_file != 0) @@ -356,7 +356,7 @@ DEFUN (lang_add_keepsyms_file, (filename), /* Build enough state so that the parser can build its tree */ void -DEFUN_VOID (lang_init) +lang_init () { obstack_begin (&stat_obstack, 1000); @@ -391,8 +391,8 @@ static lang_memory_region_type *lang_memory_region_list; static lang_memory_region_type **lang_memory_region_list_tail = &lang_memory_region_list; lang_memory_region_type * -DEFUN (lang_memory_region_lookup, (name), - CONST char *CONST name) +lang_memory_region_lookup (name) + CONST char *CONST name; { lang_memory_region_type *p = lang_memory_region_list; @@ -424,7 +424,7 @@ DEFUN (lang_memory_region_lookup, (name), *lang_memory_region_list_tail = new; lang_memory_region_list_tail = &new->next; new->origin = 0; - new->length = ~0; + new->length = ~(bfd_size_type)0; new->current = 0; new->had_full_message = false; @@ -434,8 +434,8 @@ DEFUN (lang_memory_region_lookup, (name), lang_output_section_statement_type * -DEFUN (lang_output_section_find, (name), - CONST char *CONST name) +lang_output_section_find (name) + CONST char *CONST name; { lang_statement_union_type *u; lang_output_section_statement_type *lookup; @@ -454,8 +454,8 @@ DEFUN (lang_output_section_find, (name), } lang_output_section_statement_type * -DEFUN (lang_output_section_statement_lookup, (name), - CONST char *CONST name) +lang_output_section_statement_lookup (name) + CONST char *CONST name; { lang_output_section_statement_type *lookup; @@ -492,8 +492,8 @@ DEFUN (lang_output_section_statement_lookup, (name), /*ARGSUSED*/ static void -DEFUN (print_flags, (ignore_flags), - int *ignore_flags) +print_flags (ignore_flags) + int *ignore_flags; { fprintf (config.map_file, "("); #if 0 @@ -510,7 +510,7 @@ DEFUN (print_flags, (ignore_flags), } void -DEFUN_VOID (lang_map) +lang_map () { lang_memory_region_type *m; @@ -529,9 +529,9 @@ DEFUN_VOID (lang_map) fprintf (config.map_file, "%-16s", m->name); print_address (m->origin); print_space (); - print_address (m->length); + print_address ((bfd_vma)m->length); print_space (); - print_address (m->old_length); + print_address ((bfd_vma)m->old_length); print_space(); print_address (m->current - m->origin); print_space(); @@ -552,8 +552,8 @@ DEFUN_VOID (lang_map) * */ static void -DEFUN (init_os, (s), - lang_output_section_statement_type * s) +init_os (s) + lang_output_section_statement_type * s; { /* asection *section = bfd_get_section_by_name(output_bfd, s->name);*/ section_userdata_type *new = @@ -593,11 +593,11 @@ DEFUN (init_os, (s), */ static void -DEFUN (wild_doit, (ptr, section, output, file), - lang_statement_list_type * ptr AND - asection * section AND - lang_output_section_statement_type * output AND - lang_input_statement_type * file) +wild_doit (ptr, section, output, file) + lang_statement_list_type * ptr; + asection * section; + lang_output_section_statement_type * output; + lang_input_statement_type * file; { if (output->bfd_section == (asection *) NULL) { @@ -626,7 +626,10 @@ DEFUN (wild_doit, (ptr, section, output, file), /* Be selective about what the output section inherits from the input section */ - section->output_section->flags |= section->flags & ~SEC_NEVER_LOAD; + if ((section->flags & SEC_SHARED_LIBRARY) != 0) + section->output_section->flags |= section->flags; + else + section->output_section->flags |= section->flags & ~SEC_NEVER_LOAD; if (!output->loadable) { @@ -647,19 +650,19 @@ DEFUN (wild_doit, (ptr, section, output, file), } static asection * -DEFUN (our_bfd_get_section_by_name, (abfd, section), - bfd * abfd AND - CONST char *section) +our_bfd_get_section_by_name (abfd, section) + bfd * abfd; + CONST char *section; { return bfd_get_section_by_name (abfd, section); } static void -DEFUN (wild_section, (ptr, section, file, output), - lang_wild_statement_type * ptr AND - CONST char *section AND - lang_input_statement_type * file AND - lang_output_section_statement_type * output) +wild_section (ptr, section, file, output) + lang_wild_statement_type * ptr; + CONST char *section; + lang_input_statement_type * file; + lang_output_section_statement_type * output; { asection *s; @@ -697,8 +700,8 @@ DEFUN (wild_section, (ptr, section, file, output), */ static lang_input_statement_type * -DEFUN (lookup_name, (name), - CONST char *CONST name) +lookup_name (name) + CONST char *CONST name; { lang_input_statement_type *search; @@ -731,12 +734,12 @@ DEFUN (lookup_name, (name), } static void -DEFUN (wild, (s, section, file, target, output), - lang_wild_statement_type * s AND - CONST char *CONST section AND - CONST char *CONST file AND - CONST char *CONST target AND - lang_output_section_statement_type * output) +wild (s, section, file, target, output) + lang_wild_statement_type * s; + CONST char *CONST section; + CONST char *CONST file; + CONST char *CONST target; + lang_output_section_statement_type * output; { lang_input_statement_type *f; @@ -771,8 +774,8 @@ DEFUN (wild, (s, section, file, target, output), read in all the files */ static bfd * -DEFUN (open_output, (name), - CONST char *CONST name) +open_output (name) + CONST char *CONST name; { extern unsigned long ldfile_output_machine; extern enum bfd_architecture ldfile_output_architecture; @@ -813,8 +816,8 @@ DEFUN (open_output, (name), static void -DEFUN (ldlang_open_output, (statement), - lang_statement_union_type * statement) +ldlang_open_output (statement) + lang_statement_union_type * statement; { switch (statement->header.type) { @@ -840,8 +843,8 @@ DEFUN (ldlang_open_output, (statement), } static void -DEFUN (open_input_bfds, (statement), - lang_statement_union_type * statement) +open_input_bfds (statement) + lang_statement_union_type * statement; { switch (statement->header.type) { @@ -910,8 +913,8 @@ typedef struct ldlang_undef_chain_list static ldlang_undef_chain_list_type *ldlang_undef_chain_list_head; void -DEFUN (ldlang_add_undef, (name), - CONST char *CONST name) +ldlang_add_undef (name) + CONST char *CONST name; { ldlang_undef_chain_list_type *new = (ldlang_undef_chain_list_type @@ -928,7 +931,7 @@ DEFUN (ldlang_add_undef, (name), script file. */ static void -DEFUN_VOID (lang_place_undefineds) +lang_place_undefineds () { ldlang_undef_chain_list_type *ptr = ldlang_undef_chain_list_head; @@ -951,7 +954,7 @@ DEFUN_VOID (lang_place_undefineds) */ static void -DEFUN_VOID (lang_create_output_section_statements) +lang_create_output_section_statements () { lang_statement_union_type *os; @@ -968,7 +971,7 @@ DEFUN_VOID (lang_create_output_section_statements) } static void -DEFUN_VOID (lang_init_script_file) +lang_init_script_file () { script_file = lang_add_input_file ("command line", lang_input_file_is_fake_enum, @@ -991,10 +994,10 @@ DEFUN_VOID (lang_init_script_file) /* Open input files and attatch to output sections */ static void -DEFUN (map_input_to_output_sections, (s, target, output_section_statement), - lang_statement_union_type * s AND - CONST char *target AND - lang_output_section_statement_type * output_section_statement) +map_input_to_output_sections (s, target, output_section_statement) + lang_statement_union_type * s; + CONST char *target; + lang_output_section_statement_type * output_section_statement; { for (; s != (lang_statement_union_type *) NULL; s = s->next) { @@ -1061,8 +1064,8 @@ DEFUN (map_input_to_output_sections, (s, target, output_section_statement), static void -DEFUN (print_output_section_statement, (output_section_statement), - lang_output_section_statement_type * output_section_statement) +print_output_section_statement (output_section_statement) + lang_output_section_statement_type * output_section_statement; { asection *section = output_section_statement->bfd_section; @@ -1130,9 +1133,9 @@ DEFUN (print_output_section_statement, (output_section_statement), } static void -DEFUN (print_assignment, (assignment, output_section), - lang_assignment_statement_type * assignment AND - lang_output_section_statement_type * output_section) +print_assignment (assignment, output_section) + lang_assignment_statement_type * assignment; + lang_output_section_statement_type * output_section; { etree_value_type result; @@ -1163,8 +1166,8 @@ DEFUN (print_assignment, (assignment, output_section), } static void -DEFUN (print_input_statement, (statm), - lang_input_statement_type * statm) +print_input_statement (statm) + lang_input_statement_type * statm; { if (statm->filename != (char *) NULL) { @@ -1173,8 +1176,8 @@ DEFUN (print_input_statement, (statm), } static void -DEFUN (print_symbol, (q), - asymbol * q) +print_symbol (q) + asymbol * q; { print_section (""); fprintf (config.map_file, " "); @@ -1186,8 +1189,8 @@ DEFUN (print_symbol, (q), } static void -DEFUN (print_input_section, (in), - lang_input_section_type * in) +print_input_section (in) + lang_input_section_type * in; { asection *i = in->section; int size = i->reloc_done ? @@ -1266,16 +1269,16 @@ DEFUN (print_input_section, (in), } static void -DEFUN (print_fill_statement, (fill), - lang_fill_statement_type * fill) +print_fill_statement (fill) + lang_fill_statement_type * fill; { fprintf (config.map_file, "FILL mask "); print_fill (fill->fill); } static void -DEFUN (print_data_statement, (data), - lang_data_statement_type * data) +print_data_statement (data) + lang_data_statement_type * data; { /* bfd_vma value; */ print_section (""); @@ -1311,8 +1314,8 @@ DEFUN (print_data_statement, (data), static void -DEFUN (print_padding_statement, (s), - lang_padding_statement_type * s) +print_padding_statement (s) + lang_padding_statement_type * s; { print_section (""); print_space (); @@ -1330,9 +1333,9 @@ DEFUN (print_padding_statement, (s), } static void -DEFUN (print_wild_statement, (w, os), - lang_wild_statement_type * w AND - lang_output_section_statement_type * os) +print_wild_statement (w, os) + lang_wild_statement_type * w; + lang_output_section_statement_type * os; { fprintf (config.map_file, " from "); if (w->filename != (char *) NULL) @@ -1356,9 +1359,9 @@ DEFUN (print_wild_statement, (w, os), } static void -DEFUN (print_statement, (s, os), - lang_statement_union_type * s AND - lang_output_section_statement_type * os) +print_statement (s, os) + lang_statement_union_type * s; + lang_output_section_statement_type * os; { while (s) { @@ -1421,7 +1424,7 @@ DEFUN (print_statement, (s, os), static void -DEFUN_VOID (print_statements) +print_statements () { print_statement (statement_list.head, abs_output_section); @@ -1430,11 +1433,11 @@ DEFUN_VOID (print_statements) static bfd_vma DEFUN (insert_pad, (this_ptr, fill, power, output_section_statement, dot), - lang_statement_union_type ** this_ptr AND - fill_type fill AND - unsigned int power AND - asection * output_section_statement AND - bfd_vma dot) + lang_statement_union_type ** this_ptr AND + fill_type fill AND + unsigned int power AND + asection * output_section_statement AND + bfd_vma dot) { /* Align this section first to the input sections requirement, then @@ -1476,13 +1479,12 @@ DEFUN (insert_pad, (this_ptr, fill, power, output_section_statement, dot), /* Work out how much this section will move the dot point */ static bfd_vma -DEFUN (size_input_section, (this_ptr, output_section_statement, fill, - dot, relax), - lang_statement_union_type ** this_ptr AND - lang_output_section_statement_type * output_section_statement AND - unsigned short fill AND - bfd_vma dot AND - boolean relax) +DEFUN (size_input_section, (this_ptr, output_section_statement, fill, dot, relax), + lang_statement_union_type ** this_ptr AND + lang_output_section_statement_type * output_section_statement AND + unsigned short fill AND + bfd_vma dot AND + boolean relax) { lang_input_section_type *is = &((*this_ptr)->input_section); asection *i = is->section; @@ -1499,8 +1501,7 @@ DEFUN (size_input_section, (this_ptr, output_section_statement, fill, /* remember the largest size so we can malloc the largest area needed for the output stage. Only remember the size of sections which we will actually allocate */ - if (((i->flags & - (SEC_HAS_CONTENTS | SEC_ALLOC)) == (SEC_HAS_CONTENTS | SEC_ALLOC)) + if ((i->flags & SEC_HAS_CONTENTS) != 0 && (bfd_get_section_size_before_reloc (i) > largest_section)) { largest_section = bfd_get_section_size_before_reloc (i); @@ -1537,14 +1538,13 @@ DEFUN (size_input_section, (this_ptr, output_section_statement, fill, static boolean had_relax; static bfd_vma -DEFUN (lang_size_sections, (s, output_section_statement, prev, fill, - dot, relax), - lang_statement_union_type * s AND - lang_output_section_statement_type * output_section_statement AND - lang_statement_union_type ** prev AND - unsigned short fill AND - bfd_vma dot AND - boolean relax) +DEFUN (lang_size_sections, (s, output_section_statement, prev, fill, dot, relax), + lang_statement_union_type * s AND + lang_output_section_statement_type * output_section_statement AND + lang_statement_union_type ** prev AND + unsigned short fill AND + bfd_vma dot AND + boolean relax) { /* Size up the sections from their constituent parts */ for (; s != (lang_statement_union_type *) NULL; s = s->next) @@ -1617,7 +1617,7 @@ DEFUN (lang_size_sections, (s, output_section_statement, prev, fill, /* align against */ - after = ALIGN (os->bfd_section->vma + + after = ALIGN_N (os->bfd_section->vma + os->bfd_section->_raw_size, os->block_value); @@ -1776,10 +1776,10 @@ DEFUN (lang_size_sections, (s, output_section_statement, prev, fill, static bfd_vma DEFUN (lang_do_assignments, (s, output_section_statement, fill, dot), - lang_statement_union_type * s AND - lang_output_section_statement_type * output_section_statement AND - unsigned short fill AND - bfd_vma dot) + lang_statement_union_type * s AND + lang_output_section_statement_type * output_section_statement AND + unsigned short fill AND + bfd_vma dot) { for (; s != (lang_statement_union_type *) NULL; s = s->next) @@ -1882,9 +1882,8 @@ DEFUN (lang_do_assignments, (s, output_section_statement, fill, dot), static void -DEFUN_VOID (lang_relocate_globals) +lang_relocate_globals () { - /* Each ldsym_type maintains a chain of pointers to asymbols which references the definition. Replace each pointer to the referenence @@ -1939,7 +1938,7 @@ DEFUN_VOID (lang_relocate_globals) static void -DEFUN_VOID (lang_finish) +lang_finish () { ldsym_type *lgs; int warn = config.relocateable_output != true; @@ -1985,7 +1984,7 @@ DEFUN_VOID (lang_finish) /* By now we know the target architecture, and we may have an */ /* ldfile_output_machine_name */ static void -DEFUN_VOID (lang_check) +lang_check () { lang_statement_union_type *file; bfd *input_bfd; @@ -2038,7 +2037,7 @@ DEFUN_VOID (lang_check) */ static void -DEFUN_VOID (lang_common) +lang_common () { ldsym_type *lgs; size_t power; @@ -2123,7 +2122,7 @@ DEFUN_VOID (lang_common) /* Fix the size of the common section */ com->section->_raw_size = - ALIGN (com->section->_raw_size, align); + ALIGN_N (com->section->_raw_size, align); /* Remember if this is the biggest alignment ever seen */ if (power_of_two > com->section->alignment_power) @@ -2166,7 +2165,7 @@ into the statement tree. */ static void -DEFUN_VOID (lang_place_orphans) +lang_place_orphans () { lang_input_statement_type *file; @@ -2220,9 +2219,9 @@ DEFUN_VOID (lang_place_orphans) void -DEFUN (lang_set_flags, (ptr, flags), - int *ptr AND - CONST char *flags) +lang_set_flags (ptr, flags) + int *ptr; + CONST char *flags; { boolean state = false; @@ -2262,8 +2261,8 @@ DEFUN (lang_set_flags, (ptr, flags), void -DEFUN (lang_for_each_file, (func), - void (*func) PARAMS ((lang_input_statement_type *))) +lang_for_each_file (func) + void (*func) PARAMS ((lang_input_statement_type *)); { lang_input_statement_type *f; @@ -2277,8 +2276,8 @@ DEFUN (lang_for_each_file, (func), void -DEFUN (lang_for_each_input_section, (func), - void (*func) PARAMS ((bfd * ab, asection * as))) +lang_for_each_input_section (func) + void (*func) PARAMS ((bfd * ab, asection * as)); { lang_input_statement_type *f; @@ -2300,8 +2299,8 @@ DEFUN (lang_for_each_input_section, (func), void -DEFUN (ldlang_add_file, (entry), - lang_input_statement_type * entry) +ldlang_add_file (entry) + lang_input_statement_type * entry; { lang_statement_append (&file_chain, @@ -2310,8 +2309,8 @@ DEFUN (ldlang_add_file, (entry), } void -DEFUN (lang_add_output, (name), - CONST char *name) +lang_add_output (name) + CONST char *name; { lang_output_statement_type *new = new_stat (lang_output_statement, stat_ptr); @@ -2337,19 +2336,16 @@ static int topower(x) return 0; } void -DEFUN (lang_enter_output_section_statement, - (output_section_statement_name, - address_exp, - flags, - block_value, - align, subalign, base), - char *output_section_statement_name AND - etree_type * address_exp AND - int flags AND - bfd_vma block_value AND - etree_type *align AND - etree_type *subalign AND - etree_type *base) +lang_enter_output_section_statement (output_section_statement_name, + address_exp, flags, block_value, + align, subalign, base) + char *output_section_statement_name; + etree_type * address_exp; + int flags; + bfd_vma block_value; + etree_type *align; + etree_type *subalign; + etree_type *base; { lang_output_section_statement_type *os; @@ -2391,7 +2387,7 @@ DEFUN (lang_enter_output_section_statement, void -DEFUN_VOID (lang_final) +lang_final () { if (had_output_filename == false) { @@ -2403,7 +2399,7 @@ DEFUN_VOID (lang_final) /* Reset the current counters in the regions */ static void -DEFUN_VOID (reset_memory_regions) +reset_memory_regions () { lang_memory_region_type *p = lang_memory_region_list; @@ -2411,7 +2407,7 @@ DEFUN_VOID (reset_memory_regions) p != (lang_memory_region_type *) NULL; p = p->next) { - p->old_length = p->current - p->origin; + p->old_length = (bfd_size_type) (p->current - p->origin); p->current = p->origin; } } @@ -2420,9 +2416,9 @@ DEFUN_VOID (reset_memory_regions) asymbol * DEFUN (create_symbol, (name, flags, section), - CONST char *name AND - flagword flags AND - asection * section) + CONST char *name AND + flagword flags AND + asection * section) { extern lang_input_statement_type *script_file; asymbol **def_ptr = (asymbol **) stat_alloc ((bfd_size_type) (sizeof (asymbol **))); @@ -2439,13 +2435,20 @@ DEFUN (create_symbol, (name, flags, section), } void -DEFUN_VOID (lang_process) +lang_process () { - if (had_script == false) { - parse_line (ldemul_get_script (), 1); + /* Read the emulation's appropriate default script. */ + char *scriptname = ldemul_get_script (); + size_t size = strlen (scriptname) + 3; + char *buf = (char *) ldmalloc(size); + + sprintf (buf, "-T%s", scriptname); + parse_line (buf, 0); + free (buf); } + lang_reasonable_defaults (); current_target = default_target; @@ -2570,9 +2573,9 @@ DEFUN_VOID (lang_process) /* EXPORTED TO YACC */ void -DEFUN (lang_add_wild, (section_name, filename), - CONST char *CONST section_name AND - CONST char *CONST filename) +lang_add_wild (section_name, filename) + CONST char *CONST section_name; + CONST char *CONST filename; { lang_wild_statement_type *new = new_stat (lang_wild_statement, stat_ptr); @@ -2591,9 +2594,9 @@ DEFUN (lang_add_wild, (section_name, filename), } void -DEFUN (lang_section_start, (name, address), - CONST char *name AND - etree_type * address) +lang_section_start (name, address) + CONST char *name; + etree_type * address; { lang_address_statement_type *ad = new_stat (lang_address_statement, stat_ptr); @@ -2602,15 +2605,15 @@ DEFUN (lang_section_start, (name, address), } void -DEFUN (lang_add_entry, (name), - CONST char *name) +lang_add_entry (name) + CONST char *name; { entry_symbol = name; } void -DEFUN (lang_add_target, (name), - CONST char *name) +lang_add_target (name) + CONST char *name; { lang_target_statement_type *new = new_stat (lang_target_statement, stat_ptr); @@ -2620,8 +2623,8 @@ DEFUN (lang_add_target, (name), } void -DEFUN (lang_add_map, (name), - CONST char *name) +lang_add_map (name) + CONST char *name; { while (*name) { @@ -2636,8 +2639,8 @@ DEFUN (lang_add_map, (name), } void -DEFUN (lang_add_fill, (exp), - int exp) +lang_add_fill (exp) + int exp; { lang_fill_statement_type *new = new_stat (lang_fill_statement, stat_ptr); @@ -2646,9 +2649,9 @@ DEFUN (lang_add_fill, (exp), } void -DEFUN (lang_add_data, (type, exp), - int type AND - union etree_union *exp) +lang_add_data (type, exp) + int type; + union etree_union *exp; { lang_data_statement_type *new = new_stat (lang_data_statement, @@ -2660,8 +2663,8 @@ DEFUN (lang_add_data, (type, exp), } void -DEFUN (lang_add_assignment, (exp), - etree_type * exp) +lang_add_assignment (exp) + etree_type * exp; { lang_assignment_statement_type *new = new_stat (lang_assignment_statement, stat_ptr); @@ -2670,15 +2673,15 @@ DEFUN (lang_add_assignment, (exp), } void -DEFUN (lang_add_attribute, (attribute), - enum statement_enum attribute) +lang_add_attribute (attribute) + enum statement_enum attribute; { new_statement (attribute, sizeof (lang_statement_union_type), stat_ptr); } void -DEFUN (lang_startup, (name), - CONST char *name) +lang_startup (name) + CONST char *name; { if (startup_file != (char *) NULL) { @@ -2691,16 +2694,16 @@ DEFUN (lang_startup, (name), } void -DEFUN (lang_float, (maybe), - boolean maybe) +lang_float (maybe) + boolean maybe; { lang_float_flag = maybe; } void -DEFUN (lang_leave_output_section_statement, (fill, memspec), - bfd_vma fill AND - CONST char *memspec) +lang_leave_output_section_statement (fill, memspec) + bfd_vma fill; + CONST char *memspec; { current_section->fill = fill; current_section->region = lang_memory_region_lookup (memspec); @@ -2722,9 +2725,9 @@ DEFUN (lang_leave_output_section_statement, (fill, memspec), If the symbol already exists, then do nothing. */ void -DEFUN (lang_abs_symbol_at_beginning_of, (section, name), - CONST char *section AND - CONST char *name) +lang_abs_symbol_at_beginning_of (section, name) + CONST char *section; + CONST char *name; { if (ldsym_undefined (name)) { @@ -2751,9 +2754,9 @@ DEFUN (lang_abs_symbol_at_beginning_of, (section, name), If the symbol already exists, then do nothing. */ void -DEFUN (lang_abs_symbol_at_end_of, (section, name), - CONST char *section AND - CONST char *name) +lang_abs_symbol_at_end_of (section, name) + CONST char *section; + CONST char *name; { if (ldsym_undefined (name)) { @@ -2776,10 +2779,10 @@ DEFUN (lang_abs_symbol_at_end_of, (section, name), } void -DEFUN (lang_statement_append, (list, element, field), - lang_statement_list_type * list AND - lang_statement_union_type * element AND - lang_statement_union_type ** field) +lang_statement_append (list, element, field) + lang_statement_list_type * list; + lang_statement_union_type * element; + lang_statement_union_type ** field; { *(list->tail) = element; list->tail = field; @@ -2787,8 +2790,8 @@ DEFUN (lang_statement_append, (list, element, field), /* Set the output format type */ void -DEFUN (lang_add_output_format, (format), - CONST char *format) +lang_add_output_format (format) + CONST char *format; { output_target = format; } diff --git a/ld/ldlex.l b/ld/ldlex.l index 98ea160..606f65a 100644 --- a/ld/ldlex.l +++ b/ld/ldlex.l @@ -119,6 +119,8 @@ NOCFILENAMECHAR [_a-zA-Z0-9\/\.\-\_\+\$\:\[\]\\\~] "-d" { return OPTION_d; } "-v" { return OPTION_v; } "-V" { return OPTION_V; } +"-m" { return OPTION_m; } +"-m"{FILENAME} { return OPTION_memul; } "-M" { return OPTION_M; } "-Map" { return OPTION_Map;} "-t" { return OPTION_t; } @@ -184,12 +186,19 @@ NOCFILENAMECHAR [_a-zA-Z0-9\/\.\-\_\+\$\:\[\]\\\~] "-retain-symbols-file" { return OPTION_RETAIN_SYMBOLS_FILE; } -"-EB" { - return OPTION_EB; - } -"-EL" { - return OPTION_EL; - } +"-EB" { + return OPTION_EB; + } +"-EL" { + return OPTION_EL; + } +"-G" { + return OPTION_G; + } +"-G"([0-9])+ { + yylval.integer = atoi (yytext + 2); + return OPTION_Gval; + } "$"([0-9A-Fa-f])+ { yylval.integer = strtoul(yytext+1, 0,16); return INT; @@ -400,9 +409,9 @@ NOCFILENAMECHAR [_a-zA-Z0-9\/\.\-\_\+\$\:\[\]\\\~] %% void -DEFUN(lex_push_file,(file,name), - FILE *file AND - char *name) +lex_push_file (file, name) + FILE *file; + char *name; { if (include_stack_ptr >= MAX_INCLUDE_DEPTH) { @@ -419,9 +428,9 @@ DEFUN(lex_push_file,(file,name), } YY_BUFFER_STATE -DEFUN(yy_create_string_buffer,(string, size), - CONST char *string AND - int size ) +yy_create_string_buffer (string, size) + CONST char *string; + int size; { YY_BUFFER_STATE b; @@ -457,8 +466,8 @@ DEFUN(yy_create_string_buffer,(string, size), void -DEFUN(lex_redirect,( string), - CONST char *string) +lex_redirect (string) + CONST char *string; { YY_BUFFER_STATE tmp; @@ -482,7 +491,7 @@ int state_stack[20]; int *state_stack_p = state_stack; void -DEFUN_VOID(ldlex_script) +ldlex_script () { *(state_stack_p)++ = yy_start; @@ -491,41 +500,41 @@ DEFUN_VOID(ldlex_script) void -DEFUN_VOID(ldlex_mri_script) +ldlex_mri_script () { *(state_stack_p)++ = yy_start; BEGIN(MRI); } void -DEFUN_VOID(ldlex_defsym) +ldlex_defsym () { *(state_stack_p)++ = yy_start; BEGIN(DEFSYMEXP); } void -DEFUN_VOID(ldlex_expression) +ldlex_expression () { *(state_stack_p)++ = yy_start; BEGIN(EXPRESSION); } void -DEFUN_VOID(ldlex_both) +ldlex_both () { *(state_stack_p)++ = yy_start; BEGIN(BOTH); } void -DEFUN_VOID(ldlex_command) +ldlex_command () { *(state_stack_p)++ = yy_start; BEGIN(COMMAND); } void -DEFUN_VOID(ldlex_popstate) +ldlex_popstate () { yy_start = *(--state_stack_p); } diff --git a/ld/ldsym.c b/ld/ldsym.c index ea373d1..79089ee 100644 --- a/ld/ldsym.c +++ b/ld/ldsym.c @@ -95,8 +95,8 @@ static #endif int -DEFUN (hash_string, (key), - CONST char *key) +hash_string (key) + CONST char *key; { register CONST char *cp; register int k; @@ -116,9 +116,9 @@ static __inline #endif ldsym_type * -DEFUN (search, (key, hashval), - CONST char *key AND - int hashval) +search (key, hashval) + CONST char *key; + int hashval; { ldsym_type *bp; for (bp = global_symbol_hash_table[hashval]; bp; bp = bp->link) @@ -138,8 +138,8 @@ DEFUN (search, (key, hashval), /* Get the symbol table entry for the global symbol named KEY. Create one if there is none. */ ldsym_type * -DEFUN (ldsym_get, (key), - CONST char *key) +ldsym_get (key) + CONST char *key; { register int hashval; register ldsym_type *bp; @@ -180,8 +180,8 @@ DEFUN (ldsym_get, (key), /* Like `ldsym_get' but return 0 if the symbol is not already known. */ ldsym_type * -DEFUN (ldsym_get_soft, (key), - CONST char *key) +ldsym_get_soft (key) + CONST char *key; { register int hashval; /* Determine which bucket. */ @@ -313,8 +313,8 @@ list_file_locals (entry) static void -DEFUN (print_file_stuff, (f), - lang_input_statement_type * f) +print_file_stuff (f) + lang_input_statement_type * f; { fprintf (config.map_file, " %s\n", f->filename); if (f->just_syms_flag) @@ -659,8 +659,8 @@ return true if the supplied symbol name is not in the linker symbol table */ boolean -DEFUN (ldsym_undefined, (sym), - CONST char *sym) +ldsym_undefined (sym) + CONST char *sym; { ldsym_type *from_table = ldsym_get_soft (sym); if (from_table != (ldsym_type *) NULL) @@ -672,7 +672,7 @@ DEFUN (ldsym_undefined, (sym), } void -DEFUN_VOID (ldsym_init) +ldsym_init () { obstack_begin (&global_sym_obstack, 20000); } diff --git a/ld/ldwarn.c b/ld/ldwarn.c index 37470cb..0aa1cd6 100644 --- a/ld/ldwarn.c +++ b/ld/ldwarn.c @@ -45,8 +45,8 @@ static warning_list_type *warning_list; void -DEFUN(add_warning,(sym), - asymbol *sym) +add_warning (sym) + asymbol *sym; { CONST char *name = ((asymbol *)(sym->value))->name; warning_list_type *new; @@ -64,8 +64,8 @@ DEFUN(add_warning,(sym), /* run through the list we kept, and find the warning associated with this symbol */ CONST char * -DEFUN(fetch_warning,(sym), -asymbol *sym) +fetch_warning (sym) + asymbol *sym; { warning_list_type *ptr = warning_list; while (ptr != (warning_list_type *)NULL) { @@ -79,9 +79,9 @@ asymbol *sym) void -DEFUN(produce_warnings,(lgs,it), - ldsym_type *lgs AND - asymbol *it) +produce_warnings (lgs, it) + ldsym_type *lgs; + asymbol *it; { asymbol **ptr; ptr = lgs->srefs_chain; diff --git a/ld/mri.c b/ld/mri.c index 04ee9d2..03ef260 100644 --- a/ld/mri.c +++ b/ld/mri.c @@ -27,63 +27,284 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */ #include "bfd.h" #include "sysdep.h" +#include "ld.h" #include "ldlang.h" #include "mri.h" +#include "ldgram.h" #include "ldexp.h" -void -DEFUN(mri_output_section, (name, vma), - CONST char *name AND - etree_type *vma) -{ - lang_output_section_statement_type *os; +struct section_name_struct { + struct section_name_struct *next; + CONST char *name; + CONST char *alias; + etree_type *vma; + etree_type *align; + etree_type *subalign; + int ok_to_load; +} ; + +int symbol_truncate = 10000; +struct section_name_struct *order; +struct section_name_struct *only_load; +struct section_name_struct *address; +struct section_name_struct *alias; - os = lang_output_section_statement_lookup(name); +struct section_name_struct *alignment; +struct section_name_struct *subalignment; - if (os->addr_tree == (etree_type *)NULL) { - os->addr_tree = vma; +extern char *strdup(); + +static struct section_name_struct ** +lookup (name, list) + CONST char *name; + struct section_name_struct **list; +{ + + struct section_name_struct **ptr = list; + while (*ptr) + { + if (strcmp(name, (*ptr)->name) == 0) { + /* If this is a match, delete it, we only keep the last instance + of any name */ + *ptr = (*ptr)->next; + } + else { + ptr = &((*ptr)->next); + } } - os->flags = 0; - os->block_value = 0; + *ptr = (struct section_name_struct *)ldmalloc(sizeof(struct section_name_struct)); + return ptr; +} + +static void +mri_add_to_list (list, name, vma, alias, align, subalign) + struct section_name_struct **list; + CONST char *name; + etree_type *vma; + CONST char *alias; + etree_type *align; + etree_type *subalign; +{ + struct section_name_struct **ptr = lookup(name,list); + (*ptr)->name = name; + (*ptr)->vma = vma; + (*ptr)->next = (struct section_name_struct *)NULL; + (*ptr)->ok_to_load = 0; + (*ptr)->alias = alias; +(*ptr)->align = align; +(*ptr)->subalign = subalign; +} + + +void +mri_output_section (name, vma) + CONST char *name; + etree_type *vma; +{ + mri_add_to_list(&address, name, vma, 0,0,0); } /* if any ABSOLUTE are in the script, only load those files marked thus */ -void DEFUN(mri_only_load,(name), CONST char *name) +void +mri_only_load (name) + CONST char *name; { - lang_output_section_statement_type *os; + mri_add_to_list(&only_load, name, 0, 0,0,0); +} - os = lang_output_section_statement_lookup(name); - os->flags = 0; - os->block_value = 0; +etree_type *base; +void +mri_base (exp) + etree_type *exp; +{ + base = exp; } +static int done_tree = 0; +static void +mri_draw_tree () +{ + if (done_tree) return; + + /* Create the regions */ + { + lang_memory_region_type *r; + r = lang_memory_region_lookup("long"); + r->current = r->origin = exp_get_vma(base, (bfd_vma)0, "origin", + lang_first_phase_enum); + r->length = (bfd_size_type) exp_get_vma(0, (bfd_vma) ~((bfd_size_type)0), + "length", lang_first_phase_enum); + } + + + /* Now build the statements for the ldlang machine */ + + + /* Attatch the addresses of any which have addresses, and add the + ones not mentioned */ + if (address != (struct section_name_struct *)NULL) { + struct section_name_struct *alist; + struct section_name_struct *olist; + if (order == (struct section_name_struct *)NULL) { + order = address; + } + + for (alist = address; + alist != (struct section_name_struct*)NULL; + alist = alist->next) + { + int done = 0; + for (olist = order; + done == 0 && + olist != (struct section_name_struct *)NULL; + olist = olist->next) + { + if (strcmp(alist->name, olist->name) == 0) + { + olist->vma = alist->vma; + done = 1; + } + } + if (!done) { + /* add this onto end of order list */ + mri_add_to_list(&order, alist->name, alist->vma, 0,0,0); + } + + } + + } + + /* If we're only supposed to load a subset of them in, then prune + the list. */ + + if (only_load != (struct section_name_struct *)NULL) + { + struct section_name_struct *ptr1; + struct section_name_struct *ptr2; + if (order == (struct section_name_struct*)NULL) + order = only_load; + + /* See if this name is in the list, if it is then we can load it + */ + for (ptr1 = only_load; ptr1; ptr1 = ptr1->next) + { + for (ptr2= order; ptr2; ptr2=ptr2->next) + { + if (strcmp(ptr2->name, ptr1->name)==0) { + ptr2->ok_to_load = 1; + } + } + } + } + else + { + /* No only load list, so everything is ok to load */ + struct section_name_struct *ptr; + for (ptr = order; ptr; ptr=ptr->next) { + ptr->ok_to_load = 1; + } + } + + + /* Create the order of sections to load */ + if (order != (struct section_name_struct *)NULL) + { + /* Been told to output the sections in a certain order */ + struct section_name_struct *p = order; + while (p) + { + struct section_name_struct *aptr; + etree_type *align = 0; + etree_type *subalign = 0; + /* See if an alignment has been specified */ + + for (aptr = alignment; aptr; aptr= aptr->next) + { + if (strcmp(aptr->name, p->name)==0) { + align = aptr->align; + } + } + + for (aptr = subalignment; aptr; aptr= aptr->next) + { + if (strcmp(aptr->name, p->name)==0) { + subalign = aptr->subalign; + } + } + + if (base == 0) { + base = p->vma ? p->vma :exp_nameop(NAME, "."); + } + lang_enter_output_section_statement(p->name, base, + p->ok_to_load ? 0 : + SEC_NEVER_LOAD, 1, + align, subalign); + base = 0; + lang_add_wild(p->name, (char *)NULL); + /* If there is an alias for this section, add it too */ + for (aptr = alias; aptr; aptr = aptr->next) { + + if (strcmp(aptr->alias, p->name)== 0) { + lang_add_wild(aptr->name, (char *)NULL); + } + } + + lang_leave_output_section_statement(0, "long"); + p = p->next; + } + } + + + done_tree = 1; + +} void -DEFUN(mri_load,(name), - CONST char *name) +mri_load (name) + CONST char *name; { + mri_draw_tree(); - lang_add_input_file(name, lang_input_file_is_file_enum, (char *)NULL); + base = 0; + lang_add_input_file(name, + lang_input_file_is_file_enum, (char *)NULL); + /* lang_leave_output_section_statement(0,"*default*");*/ } void -DEFUN(mri_order,(name), - CONST char *name) +mri_order (name) + CONST char *name; { -einfo("Ignoring ORDER %s for the moment\n", name); + mri_add_to_list(&order, name, 0, 0,0,0); +} + +void +mri_alias (want, is, isn) + CONST char *want; + CONST char *is; + int isn; +{ + if (!is) { + /* Some sections are digits - */ + char buf[20]; + sprintf(buf, "%d", isn); + is =strdup(buf); + } + mri_add_to_list(&alias, is, 0, want,0,0); } + void -DEFUN(mri_name,(name), - CONST char *name) +mri_name (name) + CONST char *name; { lang_add_output(name); @@ -91,8 +312,8 @@ DEFUN(mri_name,(name), void -DEFUN(mri_format,(name), - CONST char *name) +mri_format (name) + CONST char *name; { if (strcmp(name, "S") == 0) { @@ -102,7 +323,44 @@ DEFUN(mri_format,(name), { lang_add_output_format("ieee"); } + else if (strcmp(name, "COFF") == 0) + { + lang_add_output_format("coff-m68k"); + } else { einfo("%P%F: unknown format type %s\n", name); } } + + +void +mri_public (name, exp) + CONST char *name; + etree_type *exp; +{ + lang_add_assignment(exp_assop('=', name, exp)); +} + +void +mri_align (name, exp) + CONST char *name; + etree_type *exp; +{ + mri_add_to_list(&alignment, name,0,0,exp,0); +} + +void +mri_alignmod (name, exp) + CONST char *name; + etree_type *exp; +{ + mri_add_to_list(&subalignment, name,0,0,0,exp); +} + + +void +mri_truncate (exp) + int exp; +{ + symbol_truncate = exp; +} diff --git a/ld/relax.c b/ld/relax.c index ca73188..af96f8a 100644 --- a/ld/relax.c +++ b/ld/relax.c @@ -39,8 +39,8 @@ Tie together all the interseting blocks #include "ldgram.h" #include "relax.h" static void -DEFUN (build_it, (statement), - lang_statement_union_type * statement) +build_it (statement) + lang_statement_union_type * statement; { switch (statement->header.type) { @@ -179,10 +179,10 @@ DEFUN (build_it, (statement), void -DEFUN (write_relax, (output_bfd, data, relocateable), - bfd * output_bfd AND - PTR data AND - boolean relocateable) +write_relax (output_bfd, data, relocateable) + bfd * output_bfd; + PTR data; + boolean relocateable; { /* Tie up all the statements to generate an output bfd structure which bfd can mull over */ @@ -203,8 +203,8 @@ DEFUN (write_relax, (output_bfd, data, relocateable), symbols in it, and shift around the data too. */ boolean -DEFUN (relax_section, (this_ptr), - lang_statement_union_type ** this_ptr) +relax_section (this_ptr) + lang_statement_union_type ** this_ptr; { extern lang_input_statement_type *script_file; lang_input_section_type *is = &((*this_ptr)->input_section); diff --git a/ld/scripttempl/.Sanitize b/ld/scripttempl/.Sanitize new file mode 100644 index 0000000..01a4fd7 --- /dev/null +++ b/ld/scripttempl/.Sanitize @@ -0,0 +1,53 @@ +# .Sanitize for devo/ld/config + +# Each directory to survive its way into a release will need a file +# like this one called "./.Sanitize". All keyword lines must exist, +# and must exist in the order specified by this file. Each directory +# in the tree will be processed, top down, in the following order. + +# Hash started lines like this one are comments and will be deleted +# before anything else is done. Blank lines will also be squashed +# out. + +# The lines between the "Do-first:" line and the "Things-to-keep:" +# line are executed as a /bin/sh shell script before anything else is +# done in this directory. + +Do-first: + + +# All files listed between the "Things-to-keep:" line and the +# "Do-last:" line will be kept. All other files will be removed. +# Directories listed in this section will have their own Sanitize +# called. Directories not listed will be removed in their entirety +# with rm -rf. + +Things-to-keep: + +README +a29k.sc +aout.sc +ebmon29k.sc +h8300.sc +h8500.sc +hppaosf.sc +i386coff.sc +i960.sc +m68kcoff.sc +m88kbcs.sc +mips.sc +mipsbsd.sc +sa29200.sc +sh.sc +st2000.sc +vanilla.sc +z8ksim.sc + +Things-to-lose: + +# The lines between the "Do-last:" line and the end of the file +# are executed as a /bin/sh shell script after everything else is +# done. + +Do-last: + diff --git a/ld/scripttempl/README b/ld/scripttempl/README new file mode 100644 index 0000000..26ad2e9 --- /dev/null +++ b/ld/scripttempl/README @@ -0,0 +1,4 @@ +The files in this directory are linker script templates. +genscripts.sh sets some shell variables, then sources +EMULATION.sc, to generate EMULATION.{x,xr,xu,xn,xbn} -- the script +files for default, -r, -Ur, -n, -N. diff --git a/ld/scripttempl/a29k.sc b/ld/scripttempl/a29k.sc new file mode 100644 index 0000000..a43a5eb --- /dev/null +++ b/ld/scripttempl/a29k.sc @@ -0,0 +1,38 @@ +cat < text} + .shbss SIZEOF(.text) + ADDR(.text) : { + *(.shbss) + } + .talias : { } ${RELOCATING+ > talias} + .data : { + *(.data) + ${RELOCATING+ __edata = .}; + } ${RELOCATING+ > data} + .bss SIZEOF(.data) + ADDR(.data) : + { + *(.bss) + *(COMMON) + ${RELOCATING+ __end = ALIGN(0x8)}; + } + .mstack : { } ${RELOCATING+ > mstack} + .rstack : { } ${RELOCATING+ > rstack} +} +EOF diff --git a/ld/scripttempl/ebmon29k.sc b/ld/scripttempl/ebmon29k.sc new file mode 100644 index 0000000..62050ee --- /dev/null +++ b/ld/scripttempl/ebmon29k.sc @@ -0,0 +1,27 @@ +cat < ram} +.data : + { + *(.data) + ${RELOCATING+ _edata = . ; } + } ${RELOCATING+ > ram} +.bss : + { + ${RELOCATING+ _bss_start = . ;} + *(.bss) + *(COMMON) + ${RELOCATING+ _end = . ; } + } ${RELOCATING+ >ram} +.stack : + { + ${RELOCATING+ _stack = . ; } + *(.stack) + } ${RELOCATING+ > topram} +} +EOF + + + + diff --git a/ld/scripttempl/hppaosf.sc b/ld/scripttempl/hppaosf.sc new file mode 100644 index 0000000..30e3c6e --- /dev/null +++ b/ld/scripttempl/hppaosf.sc @@ -0,0 +1,29 @@ +cat <. +cat <. +# These variables may be overridden by the emulation file. The +# defaults are appropriate for a DECstation running Ultrix. +test -z "$ENTRY" && ENTRY=__start +test -z "$TEXT_START_ADDR" && TEXT_START_ADDR="0x400000 + SIZEOF_HEADERS" +test -z "$DATA_ADDR" && DATA_ADDR=0x10000000 +test -z "$BSS_VAR" && BSS_VAR= +cat < ram} +.data : + { + *(.data) + ${RELOCATING+ _edata = . ; } + } ${RELOCATING+ > ram} +.bss : + { + ${RELOCATING+ _bss_start = . ;} + *(.bss) + *(COMMON) + ${RELOCATING+ _end = . ; } + } ${RELOCATING+ >ram} +.stack : + { + ${RELOCATING+ _stack = . ; } + *(.stack) + } ${RELOCATING+ > ram} +} +EOF + + + + diff --git a/ld/scripttempl/st2000.sc b/ld/scripttempl/st2000.sc new file mode 100644 index 0000000..7ee132a --- /dev/null +++ b/ld/scripttempl/st2000.sc @@ -0,0 +1,26 @@ +cat <