diff options
author | David MacKenzie <djm@cygnus> | 1993-06-17 20:55:43 +0000 |
---|---|---|
committer | David MacKenzie <djm@cygnus> | 1993-06-17 20:55:43 +0000 |
commit | 8ddef5528d34f05ff9a492e23b15ef5c6c8eb5fb (patch) | |
tree | f921e9cedac5cd479f9954d6b30598061db2e93d | |
parent | 21cc14d8505ad50143ea248c0de12bfa9eecf1e7 (diff) | |
download | gdb-8ddef5528d34f05ff9a492e23b15ef5c6c8eb5fb.zip gdb-8ddef5528d34f05ff9a492e23b15ef5c6c8eb5fb.tar.gz gdb-8ddef5528d34f05ff9a492e23b15ef5c6c8eb5fb.tar.bz2 |
* 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.
63 files changed, 1774 insertions, 743 deletions
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 <<EOF +/* An emulation for HP PA-RISC OSF/1 linkers. + Copyright (C) 1991 Free Software Foundation, Inc. + Written by Steve Chamberlain steve@cygnus.com + +This file is part of GLD, the Gnu Linker. + +This program is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ + +#include "bfd.h" +#include "sysdep.h" + + +#include "ld.h" +#include "config.h" +#include "ldemul.h" +#include "ldfile.h" +#include "ldmisc.h" + +extern boolean lang_float_flag; + + +extern enum bfd_architecture ldfile_output_architecture; +extern unsigned long ldfile_output_machine; +extern char *ldfile_output_machine_name; + +extern bfd *output_bfd; + + +#ifdef HPPAOSF + +static void hppaosf_before_parse() +{ + static char *env_variables[] = { "HPPALIB", "HPPABASE", 0 }; + char **p; + char *env ; + + for ( p = env_variables; *p; p++ ){ + env = (char *) getenv(*p); + if (env) { + ldfile_add_library_path(concat(env,"/lib/libbout","")); + } + } + ldfile_output_architecture = bfd_arch_hppa; +} +#else +static void hppaosf_before_parse() +{ + char *env ; + env = getenv("HPPALIB"); + if (env) { + ldfile_add_library_path(env); + } + env = getenv("HPPABASE"); + if (env) { + ldfile_add_library_path(concat(env,"/lib","")); + } + ldfile_output_architecture = bfd_arch_hppa; +} +#endif /* HPPAOSF */ + +static void +hppaosf_set_output_arch() +{ + /* Set the output architecture and machine if possible */ + unsigned long machine = 0; + bfd_set_arch_mach(output_bfd, ldfile_output_architecture, machine); +} + +static char *script = +"hppaosf.x" +; + + +static char *script_reloc = +"hppaosf.xr" + ; + + +static char *hppaosf_get_script() +{ + extern ld_config_type config; + if (config.relocateable_output) + return script_reloc; + return script; + +} + +struct ld_emulation_xfer_struct ld_hppaosf_emulation = +{ + hppaosf_before_parse, + syslib_default, + hll_default, + after_parse_default, + after_allocation_default, + hppaosf_set_output_arch, + ldemul_default_target, + before_allocation_default, + hppaosf_get_script, + "hppaosf", + "elf-big" +}; +EOF diff --git a/ld/emultempl/vanilla.em b/ld/emultempl/vanilla.em new file mode 100644 index 0000000..a754a9a --- /dev/null +++ b/ld/emultempl/vanilla.em @@ -0,0 +1,74 @@ +cat >em_${EMULATION_NAME}.c <<EOF +/* A vanilla emulation with no defaults + Copyright (C) 1991 Free Software Foundation, Inc. + Written by Steve Chamberlain steve@cygnus.com + +This file is part of GLD, the Gnu Linker. + +This program is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ + +#include "bfd.h" +#include "sysdep.h" + + +#include "ld.h" +#include "config.h" +#include "ldemul.h" +#include "ldfile.h" +#include "ldmisc.h" + +extern boolean lang_float_flag; + + +extern enum bfd_architecture ldfile_output_architecture; +extern unsigned long ldfile_output_machine; +extern char *ldfile_output_machine_name; + +extern bfd *output_bfd; + + + +static void vanilla_before_parse() +{ +} + +static void +vanilla_set_output_arch() +{ + /* Set the output architecture and machine if possible */ + unsigned long machine = 0; + bfd_set_arch_mach(output_bfd, ldfile_output_architecture, machine); +} + +static char *vanilla_get_script() +{ + return "/dev/null"; +} + +struct ld_emulation_xfer_struct ld_vanilla_emulation = +{ + vanilla_before_parse, + syslib_default, + hll_default, + after_parse_default, + after_allocation_default, + vanilla_set_output_arch, + ldemul_default_target, + before_allocation_default, + vanilla_get_script, + "vanilla", + "a.out-sunos-big" +}; +EOF @@ -18,7 +18,7 @@ ld \- the GNU linker .RB "[\|" \-o " .I output\c \&\|] \c -.I objfiles\c +.I objfile\c \&.\|.\|. .br .RB "[\|" \-A\c @@ -50,6 +50,9 @@ ld \- the GNU linker .I input-format\c \&\|] .RB "[\|" \-g "\|]" +.RB "[\|" \-G\c +.I size\c +\&\|] .RB "[\|" \-i "\|]" .RB "[\|" \-l\c .I ar\c @@ -57,7 +60,10 @@ ld \- the GNU linker .RB "[\|" \-L\c .I searchdir\c \&\|] -.RB "[\|" \-M | \-m "\|]" +.RB "[\|" \-M "\|]" +.RB "[\|" \-m\c +.I emulation\c +\&\|] .RB "[\|" \-n | \-N "\|]" .RB "[\|" \-noinhibit-exec "\|]" .RB "[\|" "\-R\ "\c @@ -83,6 +89,7 @@ ld \- the GNU linker .RB "[\|" "\-u\ "\c .I sym\c \&] +.RB "[\|" \-V "\|]" .RB "[\|" \-v "\|]" .RB "[\|" \-X "\|]" .RB "[\|" \-x "\|]" @@ -203,11 +210,11 @@ The exceptions\(em\&which may meaningfully be used more than once\(em\&are \&. The list of object files to be linked together, shown as \c -.I objfiles\c +.I objfile\c \&, may follow, precede, or be mixed in with command-line options; save that an \c -.I objfiles\c +.I objfile\c \& argument may not be placed between an option flag and its argument. @@ -230,12 +237,6 @@ whitespace, or be given as separate arguments immediately following the option that requires them. .TP -.IR "objfiles" .\|.\|. -The object files \c -.I objfiles\c -\& to be linked. - -.TP .BI "-A" "architecture"\c \& In the current release of \c @@ -454,6 +455,13 @@ Synonym for \c Accepted, but ignored; provided for compatibility with other tools. .TP +.BI "\-G " "size"\c +Set the maximum size of objects to be optimized using the GP register +to +.I size +under MIPS ECOFF. Ignored for other object file formats. + +.TP .B \-i Perform an incremental link (same as option \c .B \-r\c @@ -502,8 +510,6 @@ command. .TP .B \-M -.TP -.B \-m Print (to the standard output file) a link map\(em\&diagnostic information about where symbols are mapped by \c .B ld\c @@ -511,6 +517,16 @@ about where symbols are mapped by \c common storage allocation. .TP +.BI "\-m " "emulation"\c +Emulate the +.I emulation +linker. You can list the available emulations with the +.I \-V +option. This option overrides the compiled-in default, which is the +system for which you configured +.BR ld . + +.TP .B \-N specifies readable and writable \c .B text\c @@ -704,10 +720,18 @@ turn serve as input to \c \&. .TP +.B \-V +Display the version number for \c +.B ld +and list the supported emulations. +Print which input files can and can not be opened. + +.TP .B \-v Display the version number for \c .B ld\c \&. +Print which input files can and can not be opened. .TP .B \-X @@ -735,14 +759,11 @@ not just those beginning with `\|\c .SH ENVIRONMENT \c +You can change the behavior of .B ld\c -\& always consults two environment variables: \c +\& with the environment variable \c .B GNUTARGET\c -\& -and \c -.B LDEMULATION\c -\&. Depending on the setting of the latter, other -environment variables may be used as well. +\&. \c .B GNUTARGET\c @@ -770,247 +791,6 @@ unique. However, the configuration procedure for BFD on each system places the conventional format for that system first in the search-list, so ambiguities are resolved in favor of convention. -\c -.B LDEMULATION\c -\& controls some aspects of \c -.B ld\c -\&'s dominant -personality. Although \c -.B ld\c -\& is flexible enough to permit its use -in many contexts regardless of configuration, you can use this variable -to make it act more like one or another older linker by default. - -In particular, the value of \c -.B LDEMULATION\c -\& controls what default -linker script is used (thereby controlling the default input and output -formats; ; what default paths are searched for -archive libraries; and in some cases whether additional linker script -commands are available. - -Here is the current set of emulations available: - -.TP -.B LDEMULATION=gld -Emulate the older GNU linker. When this emulation is selected, the -default library search paths are -.sp -.br -/lib -.br -/usr/lib -.br -/usr/local/lib/lib -.br -.sp - -The default output format is set to \c -.B a.out-generic-big\c -\&, and the -default machine is the system's configured BFD default. - -.TP -.B LDEMULATION=gld68k -A variant of the \c -.B gld\c -\& emulation; only differs in specifically -setting the default BFD machine as \c -.B m68k\c -\&. - -.TP -.B LDEMULATION=gld960 -Emulate the Intel port of the older \c -.B gld\c -\& for the i960 -architectures. The default library search paths are taken from two -other environment variables, \c -.B G960LIB\c -\& and \c -.B G960BASE\c -\&. The -default architecture is \c -.B i960\c -\&. The default output format is set -to \c -.B b.out.big\c -\&, and in fact the default output file name (if -\c -.B \-o\c -\& is not specified) is \c -.B b.out\c -\&, to reflect this variant -format, for this emulation. - -This emulation can behave slightly differently depending on the setting -of the \c -.B ld\c -\& compile-time switch \c -.B GNU960\c -\&. If \c -.B ld\c -\& is -compiled with \c -.B GNU960\c -\& defined, then an additional environment -variable\(em\&\c -.B GNUTARGET\c -\&\(em\&is available; its value, if available, -specifies some other default output format than \c -.B b.out.big\c -\&. - -.TP -.B LDEMULATION=gldm88kbcs -Sets the output format to \c -.B m88kbcs\c -\& and the architecture to -\c -.B m88k\c -\&. Default library search paths are -.sp -.br -/lib -.br -/usr/lib -.br -/usr/local/lib -.br -.sp - -.TP -.B LDEMULATION=lnk960 -Emulate the Intel linker \c -.B lnk960\c -\&. The default output format is -\c -.B coff-Intel-big\c -\&. With this emulation, \c -.B ld\c -\& -supports the additional script commands \c -.B HLL\c -\& and \c -.B SYSLIB\c -\& for -specification of library archives. This is the only emulation with -extensive support for the \c -.B \-A\c -\& (architecture) command-line option. -By default, the architecture \c -.B CORE\c -\& is assumed, but you can choose -additional features from the i960 architecture family by using one of -the following with \c -.B \-A\c -\& (or by using the \c -.B OUTPUT_ARCH\c -\& command -from a script): -.sp -.br -CORE -.br -KB -.br -SB -.br -MC -.br -XA -.br -CA -.br -KA -.br -SA -.br -.sp - -The default libraries are chosen with some attention to the architecture -selected; the core library `\|\c -.B cg\c -\|' is always included, but the library -\c -.B fpg\c -\& is also used if you've specified any of the architectures -\c -.B KA\c -\&, \c -.B SA\c -\&, or \c -.B CA\c -\&. - -Like \c -.B gld960\c -\&, this emulation uses additional environment variables -to set the default library search paths. Also like \c -.B gld960\c -\&, the -behavior of this emulation is slightly different depending on whether -\c -.B ld\c -\& itself was compiled with \c -.B GNU960\c -\& defined. - -If your \c -.B ld\c -\& was compiled with \c -.B GNU960\c -\& defined, the default -paths are taken from all three of \c -.B G960LIB\c -\&, \c -.B G960BASE\c -\&, and -\c -.B I960BASE\c -\&. For the first two, paths you supply are automatically -suffixed with `\|\c -.B /lib/libcoff\c -\|'; for the last, your path is -automatically suffixed with `\|\c -.B /lib\c -\|'. - -If your \c -.B ld\c -\& was \c -.I not\c -\& compiled with \c -.B GNU960\c -\& defined, -the default paths are taken from \c -.B I960BASE\c -\&, and \c -.B G960BASE\c -\& is -only consulted if \c -.B I960BASE\c -\& is undefined. In this case -\c -.B G960LIB\c -\& is not used at all. - -.TP -.B LDEMULATION=vanilla -This is the least specific setting for \c -.B ld\c -\&. You can set -\c -.B LDEMULATION=vanilla\c -\& to disable emulation of other linkers. This -setting makes \c -.B ld\c -\& take the default machine from the BFD -configuration on your system; \c -.B a.out-generic-big\c -\& is the default -target. No other defaults are specified. - .PP .SH "SEE ALSO" diff --git a/ld/ld.texinfo b/ld/ld.texinfo index a918e1a..33317d6 100644 --- a/ld/ld.texinfo +++ b/ld/ld.texinfo @@ -9,7 +9,7 @@ @ifinfo @format START-INFO-DIR-ENTRY -* Ld: (ld). The GNU linker. +* Ld:: The GNU linker. END-INFO-DIR-ENTRY @end format @end ifinfo @@ -163,17 +163,17 @@ line: @c FIXME! -relax only avail h8/300, i960. Conditionals screwed in examples. @smallexample -ld [-o @var{output} ] @var{objfile@dots{}} +ld [-o @var{output} ] @var{objfile}@dots{} [ -A@var{architecture} ] [ -b @var{input-format} ] [ -Bstatic ] [ -c @var{MRI-commandfile} ] [ -d | -dc | -dp ] [ -defsym @var{symbol}=@var{expression} ] [ -e @var{entry} ] [ -F ] [ -F @var{format} ] - [ -format @var{input-format} ] [ -g ] [ -i ] - [ -l@var{ar} ] [ -L@var{searchdir} ] [ -M | -m ] - [ -n | -N ] [ -noinhibit-exec ] [ -R @var{filename} ] + [ -format @var{input-format} ] [ -g ] [ -G @var{size} ] [ -i ] + [ -l@var{ar} ] [ -L@var{searchdir} ] [ -M ] [ -m @var{emulation} ] + [ -N | -n ] [ -noinhibit-exec ] [ -R @var{filename} ] [ -relax ] [ -r | -Ur ] [ -S ] [ -s ] [ -T @var{commandfile} ] [ -Ttext @var{textorg} ] [ -Tdata @var{dataorg} ] [ -Tbss @var{bssorg} ] - [ -t ] [ -u @var{sym}] [-v] [ -X ] [ -x ] [ -y@var{symbol} ] + [ -t ] [ -u @var{sym}] [-V] [-v] [ -X ] [ -x ] [ -y@var{symbol} ] [ @{ @var{script} @} ] @end smallexample @@ -210,7 +210,7 @@ The exceptions---which may meaningfully be used more than once---are @end ifset @cindex object files -The list of object files to be linked together, shown as @var{objfile@dots{}}, +The list of object files to be linked together, shown as @var{objfile}@dots{}, may follow, precede, or be mixed in with command-line options, except that an @var{objfile} argument may not be placed between an option and its argument. @@ -226,7 +226,7 @@ whitespace, or be given as separate arguments immediately following the option that requires them. @table @code -@item @var{objfile@dots{}} +@item @var{objfile}@dots{} The object files to be linked. @ifset I960 @@ -286,6 +286,8 @@ files written in an alternate, restricted command language, described in @ref{MRI,,MRI Compatible Script Files}. Introduce MRI script files with the option @samp{-c}; use the @samp{-T} option to run linker scripts written in the general-purpose @code{ld} scripting language. +If @var{MRI-cmdfile} does not exist, @code{ld} looks for it in the directories +specified by any @samp{-L} options. @cindex common allocation @kindex -d @@ -346,12 +348,18 @@ Synonym for @samp{-b @var{input-format}}. @item -g Ignored. Provided for compatibility with other tools. +@kindex -G +@cindex object size +@item -G@var{value} +@itemx -G @var{value} +Set the maximum size of objects to be optimized using the GP register to +@var{size} under MIPS ECOFF. Ignored for other object file formats. + @kindex -i @cindex incremental link @item -i Perform an incremental link (same as option @samp{-r}). - @cindex archive files, from cmd line @kindex -l@var{ar} @item -l@var{ar} @@ -364,7 +372,8 @@ specified. @kindex -L@var{dir} @item -L@var{searchdir} Add path @var{searchdir} to the list of paths that @code{ld} will search -for archive libraries. You may use this option any number of times. +for archive libraries and @code{ld} control scripts. You may use this +option any number of times. @ifset UsesEnvVars The default set of paths searched (without being specified with @@ -378,12 +387,18 @@ The paths can also be specified in a link script with the @cindex link map @kindex -M @item -M -@kindex -m -@itemx -m Print (to the standard output) a link map---diagnostic information about where symbols are mapped by @code{ld}, and information on global common storage allocation. +@cindex emulation +@kindex -m @var{emulation} +@item -m@var{emulation} +@itemx -m @var{emulation} +Emulate the @var{emulation} linker. You can list the available +emulations with the @samp{-V} option. The +default is the system for which you configured @code{ld}. + @kindex -N @cindex read/write from cmd line @kindex OMAGIC @@ -499,6 +514,8 @@ Read link commands from the file default link format (rather than adding to it); @var{commandfile} must specify everything necessary to describe the target format. @xref{Commands}. +If @var{commandfile} does not exist, @code{ld} looks for it in the directories +specified by any @samp{-L} options. You may also include a script of link commands directly in the command line by bracketing it between @samp{@{} and @samp{@}}. @@ -527,10 +544,17 @@ For anything other than C++ programs, this option is equivalent to turn serve as input to @code{ld}. When linking C++ programs, @samp{-Ur} @emph{will} resolve references to constructors, unlike @samp{-r}. +@item -V +@kindex -V +@cindex version +Display the version number for @code{ld} and list the supported emulations. +Print which input files can and can not be opened. + @item -v @kindex -v @cindex version Display the version number for @code{ld}. +Print which input files can and can not be opened. @item -X @kindex -X @@ -1316,7 +1340,7 @@ file have not yet been defined. @kindex [ @var{sections} ] This is an alternate notation to specify named sections from all unallocated input files; its effect is exactly the same as that of -@samp{* (@var{section@dots{}})} +@samp{* (@var{section}@dots{})} @item @var{filename}@code{( COMMON )} @itemx ( COMMON ) @@ -2194,7 +2218,7 @@ COFF (the @samp{coff-m68k} variant in BFD), if @var{output-format} is @samp{COFF} @end enumerate -@item LIST @var{@dots{}} +@item LIST @var{anything}@dots{} @cindex @code{LIST} (MRI) Print (to the standard output file) a link map, as produced by the @code{ld} command-line option @samp{-M}. diff --git a/ld/lderror.c b/ld/lderror.c index 38e2a70..b43282d 100644 --- a/ld/lderror.c +++ b/ld/lderror.c @@ -14,9 +14,9 @@ extern bfd_error_vector_type bfd_error_vector; /* BFD has failed to link something, give a better error message */ static void -DEFUN(ld_undefined_symbol,(relent, seclet), - CONST arelent *relent AND - CONST bfd_seclet_type *seclet) +ld_undefined_symbol (relent, seclet) + CONST arelent *relent; + CONST bfd_seclet_type *seclet; { asymbol *s = *(relent->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 <integer> 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 <name> 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; } @@ -119,6 +119,8 @@ NOCFILENAMECHAR [_a-zA-Z0-9\/\.\-\_\+\$\:\[\]\\\~] <COMMAND>"-d" { return OPTION_d; } <COMMAND>"-v" { return OPTION_v; } <COMMAND>"-V" { return OPTION_V; } +<COMMAND>"-m" { return OPTION_m; } +<COMMAND>"-m"{FILENAME} { return OPTION_memul; } <COMMAND>"-M" { return OPTION_M; } <COMMAND>"-Map" { return OPTION_Map;} <COMMAND>"-t" { return OPTION_t; } @@ -184,12 +186,19 @@ NOCFILENAMECHAR [_a-zA-Z0-9\/\.\-\_\+\$\:\[\]\\\~] <COMMAND>"-retain-symbols-file" { return OPTION_RETAIN_SYMBOLS_FILE; } -<COMMAND>"-EB" { - return OPTION_EB; - } -<COMMAND>"-EL" { - return OPTION_EL; - } +<COMMAND>"-EB" { + return OPTION_EB; + } +<COMMAND>"-EL" { + return OPTION_EL; + } +<COMMAND>"-G" { + return OPTION_G; + } +<COMMAND>"-G"([0-9])+ { + yylval.integer = atoi (yytext + 2); + return OPTION_Gval; + } <MRI,EXPRESSION>"$"([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); } @@ -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; @@ -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 <name> 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; +} @@ -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 <<EOF +OUTPUT_FORMAT("${OUTPUT_FORMAT}") +INPUT(/lab3/u3/sym1/tools/usr/lib/segments.o) /* Has .rstack/.mstack */ +${LIB_SEARCH_DIRS} + +MEMORY { + text : ORIGIN = 0x1000000, LENGTH = 0x1000000 + talias : ORIGIN = 0x2000000, LENGTH = 0x1000000 + data : ORIGIN = 0x3000000, LENGTH = 0x1000000 + mstack : ORIGIN = 0x4000000, LENGTH = 0x1000000 + rstack : ORIGIN = 0x5000000, LENGTH = 0x1000000 +} +SECTIONS +{ + .text : { + *(.text) + ${RELOCATING+ __etext = .}; + *(.lit) + *(.shdata) + } ${RELOCATING+ > 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 <<EOF +OUTPUT_FORMAT("${OUTPUT_FORMAT}") +ENTRY(start) + +SECTIONS { + .text ${RELOCATING+${TEXT_START_ADDR}} : + { + *(.text); + ${RELOCATING+_etext = .}; + } + data ${RELOCATING+0x80002000} : + { + *(.data); + *(.mstack); + *(.shbss); + *(.rstack); + *(.mstack); + ${CONSTRUCTING+CONSTRUCTORS} + } + .bss . : + { + *(COMMON) + *(.bss); + ${RELOCATING+_end = .}; + } +} +EOF diff --git a/ld/scripttempl/h8500.sc b/ld/scripttempl/h8500.sc new file mode 100644 index 0000000..ed2d44f --- /dev/null +++ b/ld/scripttempl/h8500.sc @@ -0,0 +1,43 @@ +cat <<EOF +OUTPUT_FORMAT("${OUTPUT_FORMAT}") +OUTPUT_ARCH(${ARCH}) + +MEMORY { + rom : o = 0x0000, l = 0x7fe0 + duart : o = 0x7fe0, l = 16 + ram : o = 0x8000, l = 28k + topram : o = 0x8000+28k, l = 1k + hmsram : o = 0xfb80, l = 512 + } + +SECTIONS +{ +.text : + { + *(.text) + *(.strings) + ${RELOCATING+ _etext = . ; } + } ${RELOCATING+ > 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 <<EOF +OUTPUT_FORMAT("${OUTPUT_FORMAT}") +OUTPUT_ARCH(${ARCH}) +ENTRY("\$START\$") +${RELOCATING+${LIB_SEARCH_DIRS}} +SECTIONS +{ + .text ${RELOCATING+${TEXT_START_ADDR}}: + { + ${RELOCATING+__text_start = .}; + CREATE_OBJECT_SYMBOLS + *(.text) + } + .data ${RELOCATING+ 0x40000000 } : + { + ${RELOCATING+__data_start = .}; + ${RELOCATING+ . = . + 0x1000 }; + *(.data) + ${CONSTRUCTING+CONSTRUCTORS} + } + .bss ${RELOCATING+SIZEOF(.data) + ADDR(.data)} : + { + *(.bss) + *(COMMON) + ${RELOCATING+_end = . }; + ${RELOCATING+__end = . }; + } +} +EOF diff --git a/ld/scripttempl/i386coff.sc b/ld/scripttempl/i386coff.sc new file mode 100644 index 0000000..d18fd24 --- /dev/null +++ b/ld/scripttempl/i386coff.sc @@ -0,0 +1,29 @@ +# Linker script for 386 COFF. This works on SVR3.2 and SCO Unix 3.2.2. +# .data2 handles SCO, which uses two data sections. +# Ian Taylor <ian@cygnus.com>. +cat <<EOF +OUTPUT_FORMAT("${OUTPUT_FORMAT}") +${LIB_SEARCH_DIRS} + +ENTRY(_start) + +SECTIONS +{ + .text ${RELOCATING+ SIZEOF_HEADERS} : { + *(.init) + *(.text) + *(.fini) + ${RELOCATING+ etext = .}; + } + .data ${RELOCATING+ 0x400000 + (. & 0xffc00fff)} : { + *(.data .data2) + ${RELOCATING+ edata = .}; + } + .bss ${RELOCATING+ SIZEOF(.data) + ADDR(.data)} : + { + *(.bss) + *(COMMON) + ${RELOCATING+ end = .}; + } +} +EOF diff --git a/ld/scripttempl/i960.sc b/ld/scripttempl/i960.sc new file mode 100644 index 0000000..ed8ba8b --- /dev/null +++ b/ld/scripttempl/i960.sc @@ -0,0 +1,23 @@ +cat <<EOF +SECTIONS +{ + .text : + { + ${GLD_STYLE+ CREATE_OBJECT_SYMBOLS} + *(.text) + ${RELOCATING+ _etext = .}; + } + .data SIZEOF(.text) + ADDR(.text): + { + *(.data) + ${RELOCATING+ _edata = .}; + } + .bss SIZEOF(.data) + ADDR(.data): + { + ${RELOCATING+ _bss_start = .}; + *(.bss) + *(COMMON) + ${RELOCATING+ _end = .}; + } +} +EOF diff --git a/ld/scripttempl/mips.sc b/ld/scripttempl/mips.sc new file mode 100644 index 0000000..0926db5 --- /dev/null +++ b/ld/scripttempl/mips.sc @@ -0,0 +1,56 @@ +# Linker script for MIPS systems. +# Ian Lance Taylor <ian@cygnus.com>. +# 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 <<EOF +OUTPUT_FORMAT("${OUTPUT_FORMAT}") +${LIB_SEARCH_DIRS} + +ENTRY(${ENTRY}) + +SECTIONS +{ + .text ${RELOCATING+ ${TEXT_START_ADDR}} : { + *(.init) + ${RELOCATING+ eprol = .}; + *(.text) + *(.fini) + ${RELOCATING+ etext = .}; + ${RELOCATING+ _etext = .}; + } + .rdata ${RELOCATING+ ${DATA_ADDR}} : { + *(.rdata) + } + .data ${RELOCATING+ .} : { + *(.data) + ${CONSTRUCTING+CONSTRUCTORS} + } + ${RELOCATING+ _gp = . + 0x8000;} + .lit8 ${RELOCATING+ .} : { + *(.lit8) + } + .lit4 ${RELOCATING+ .} : { + *(.lit4) + } + .sdata ${RELOCATING+ .} : { + *(.sdata) + } + ${RELOCATING+ edata = .;} + ${RELOCATING+ _edata = .;} + ${RELOCATING+ ${BSS_VAR}} + .sbss ${RELOCATING+ .} : { + *(.sbss) + *(.scommon) + } + .bss ${RELOCATING+ .} : { + *(.bss) + *(COMMON) + } + ${RELOCATING+ end = .;} + ${RELOCATING+ _end = .;} +} +EOF diff --git a/ld/scripttempl/mipsbsd.sc b/ld/scripttempl/mipsbsd.sc new file mode 100644 index 0000000..6875794 --- /dev/null +++ b/ld/scripttempl/mipsbsd.sc @@ -0,0 +1,28 @@ +cat <<EOF +OUTPUT_FORMAT("${OUTPUT_FORMAT}") +OUTPUT_ARCH(${ARCH}) + +${RELOCATING+${LIB_SEARCH_DIRS}} +${RELOCATING+__DYNAMIC = 0;} +SECTIONS +{ + .text ${RELOCATING+${TEXT_START_ADDR}}: + { + CREATE_OBJECT_SYMBOLS + *(.text) + ${RELOCATING+etext = ${DATA_ALIGNMENT};} + } + .data ${RELOCATING+${DATA_ALIGNMENT}} : + { + *(.data) + ${CONSTRUCTING+CONSTRUCTORS} + ${RELOCATING+edata = .;} + } + .bss ${RELOCATING+SIZEOF(.data) + ADDR(.data)} : + { + *(.bss) + *(COMMON) + ${RELOCATING+end = . }; + } +} +EOF diff --git a/ld/scripttempl/sa29200.sc b/ld/scripttempl/sa29200.sc new file mode 100644 index 0000000..6526614 --- /dev/null +++ b/ld/scripttempl/sa29200.sc @@ -0,0 +1,44 @@ +cat <<EOF +OUTPUT_FORMAT("${OUTPUT_FORMAT}") +ENTRY(start) + +SECTIONS { + .text ${RELOCATING+${TEXT_START_ADDR}} : + { + *(.text); + *(.text1); + *(.text2); + ${RELOCATING+_etext = .}; + } + .lit . : + { + *(.lit); + ${RELOCATING+_elit = .}; + } + .data . : + { + *(.data); + *(.data1); + *(.data2); + ${RELOCATING+_edata = .}; + ${CONSTRUCTING+CONSTRUCTORS} + ${CONSTRUCTING+ ___CTOR_LIST__ = .;} + ${CONSTRUCTING+ LONG((___CTOR_END__ - ___CTOR_LIST__) / 4 - 2)} + *(.ctors) + ${CONSTRUCTING+ LONG(0)} + ${CONSTRUCTING+ ___CTOR_END__ = .;} + ${CONSTRUCTING+ ___DTOR_LIST__ = .;} + ${CONSTRUCTING+ LONG((___DTOR_END__ - ___DTOR_LIST__) / 4 - 2)} + *(.dtors) + ${CONSTRUCTING+ LONG(0)} + ${CONSTRUCTING+ ___DTOR_END__ = .;} + } + + .bss . : + { + *(COMMON) + *(.bss) + ${RELOCATING+_end = .}; + } +} +EOF diff --git a/ld/scripttempl/sh.sc b/ld/scripttempl/sh.sc new file mode 100644 index 0000000..b941359 --- /dev/null +++ b/ld/scripttempl/sh.sc @@ -0,0 +1,39 @@ +cat <<EOF +OUTPUT_FORMAT("${OUTPUT_FORMAT}") +OUTPUT_ARCH(${ARCH}) + +MEMORY { + ram : o = 0x1000, l = 512k + } + +SECTIONS +{ +.text : + { + *(.text) + *(.strings) + ${RELOCATING+ _etext = . ; } + } ${RELOCATING+ > 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 <<EOF +OUTPUT_FORMAT("${OUTPUT_FORMAT}") +OUTPUT_ARCH(${ARCH}) + + +SECTIONS +{ +.text : + { + *(.text) + *(.strings) + _etext = .; + *(.data) + _edata = .; + *(.bss) + *(COMMON) + _end = .; + +} + +} +EOF + + + + diff --git a/ld/scripttempl/vanilla.sc b/ld/scripttempl/vanilla.sc new file mode 100644 index 0000000..1798480 --- /dev/null +++ b/ld/scripttempl/vanilla.sc @@ -0,0 +1 @@ +# Nothing to do. diff --git a/ld/scripttempl/z8ksim.sc b/ld/scripttempl/z8ksim.sc new file mode 100644 index 0000000..7ee132a --- /dev/null +++ b/ld/scripttempl/z8ksim.sc @@ -0,0 +1,26 @@ +cat <<EOF +OUTPUT_FORMAT("${OUTPUT_FORMAT}") +OUTPUT_ARCH(${ARCH}) + + +SECTIONS +{ +.text : + { + *(.text) + *(.strings) + _etext = .; + *(.data) + _edata = .; + *(.bss) + *(COMMON) + _end = .; + +} + +} +EOF + + + + |