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.
NEWS
README
TODO
-a29k.sc-sh
-a29k.sh
-aout.sc-sh
cdtest-foo.cc
cdtest-foo.h
cdtest-func.cc
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
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:
+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.
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
(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.
infodir = $(prefix)/info
includedir = $(prefix)/include
docdir = $(datadir)/doc
+scriptdir = $(datadir)/ld
gcclibdir = $(libdir)/gcc/$(target_alias)
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
#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
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
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}
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
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! */";\
# 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
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
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
.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 \
# per-host:
+. ${srcdir}/../bfd/configure.host
+
host_makefile_frag=
if [ -f ${srcdir}/config/${my_host}.mh ] ; then
echo '***' GNU LD does not support target ${target} 1>&2
exit 1
fi
+
+mkdir emulations 2>/dev/null
--- /dev/null
+# .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:
+
--- /dev/null
+The files in this directory are read by genscripts.sh as shell commands.
+They set parameters for the emulations.
--- /dev/null
+EMULATION_NAME=a29k
+SCRIPT_NAME=a29k
+OUTPUT_FORMAT="coff-a29k-big"
+TEXT_START_ADDR=0x1000000
+PAGE_SIZE=0x1000000
+ARCH=a29k
--- /dev/null
+EMULATION_NAME=ebmon29k
+SCRIPT_NAME=ebmon29k
+OUTPUT_FORMAT="coff-a29k-big"
+TEXT_START_ADDR=0x8000
+PAGE_SIZE=0x1000
+ARCH=a29k
--- /dev/null
+EMULATION_NAME=gld960
+SCRIPT_NAME=i960
+OUTPUT_FORMAT=""
+TEXT_START_ADDR=??
+PAGE_SIZE=??
+ARCH=i960
+TEMPLATE_NAME=gld960
+GLD_STYLE=1
--- /dev/null
+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
+
--- /dev/null
+EMULATION_NAME=h8300
+SCRIPT_NAME=h8300
+OUTPUT_FORMAT="coff-h8300"
+TEXT_START_ADDR=0x8000
+PAGE_SIZE=128
+ARCH=h8300
--- /dev/null
+EMULATION_NAME=h8500
+SCRIPT_NAME=h8500
+OUTPUT_FORMAT="coff-h8500"
+TEXT_START_ADDR=0x8000
+PAGE_SIZE=128
+ARCH=h8500
--- /dev/null
+EMULATION_NAME=hp300bsd
+SCRIPT_NAME=aout
+OUTPUT_FORMAT="a.out-hp300bsd"
+TEXT_START_ADDR=0
+PAGE_SIZE=4096
+ARCH=m68k
--- /dev/null
+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;"
--- /dev/null
+EMULATION_NAME=hppaosf
+SCRIPT_NAME=hppaosf
+OUTPUT_FORMAT="elf-big"
+TEXT_START_ADDR=0x1000
+PAGE_SIZE=4096
+ARCH=hppa
+START="$START$"
+TEMPLATE_NAME=hppaosf
--- /dev/null
+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
--- /dev/null
+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
--- /dev/null
+EMULATION_NAME=i386coff
+SCRIPT_NAME=i386coff
+OUTPUT_FORMAT="coff-i386"
+TEXT_START_ADDR=0x1000000
+PAGE_SIZE=0x1000000
+ARCH=i386
--- /dev/null
+EMULATION_NAME=lnk960
+SCRIPT_NAME=i960
+OUTPUT_FORMAT=""
+TEXT_START_ADDR=??
+PAGE_SIZE=??
+ARCH=i960
+TEMPLATE_NAME=lnk960
--- /dev/null
+EMULATION_NAME=m68kcoff
+SCRIPT_NAME=m68kcoff
+OUTPUT_FORMAT="coff-m68k"
+TEXT_START_ADDR=0x1000000
+PAGE_SIZE=0x1000000
+ARCH=m68k
--- /dev/null
+EMULATION_NAME=mipsbig
+SCRIPT_NAME=mips
+OUTPUT_FORMAT="ecoff-bigmips"
+PAGE_SIZE=0x1000000
+ARCH=mips
--- /dev/null
+EMULATION_NAME=mipsbsd
+SCRIPT_NAME=mipsbsd
+OUTPUT_FORMAT="aout-mips-little"
+TEXT_START_ADDR=0x1020
+PAGE_SIZE=4096
+ARCH=mips
--- /dev/null
+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 = .;"
--- /dev/null
+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 = .;"
--- /dev/null
+EMULATION_NAME=mipslit
+SCRIPT_NAME=mips
+OUTPUT_FORMAT="ecoff-littlemips"
+PAGE_SIZE=0x1000000
+ARCH=mips
--- /dev/null
+EMULATION_NAME=news
+SCRIPT_NAME=aout
+OUTPUT_FORMAT="a.out-newsos3"
+TEXT_START_ADDR=0
+PAGE_SIZE=0x1000
+ARCH=m68k
--- /dev/null
+EMULATION_NAME=sa29200
+SCRIPT_NAME=sa29200
+OUTPUT_FORMAT="coff-a29k-big"
+TEXT_START_ADDR=0x40004000
+PAGE_SIZE=0x1000
+ARCH=a29k
--- /dev/null
+EMULATION_NAME=sh
+SCRIPT_NAME=sh
+OUTPUT_FORMAT="coff-sh"
+TEXT_START_ADDR=0x8000
+PAGE_SIZE=128
+ARCH=sh
--- /dev/null
+EMULATION_NAME=st2000
+SCRIPT_NAME=st2000
+OUTPUT_FORMAT="coff-m68k"
+TEXT_START_ADDR=0x0
+PAGE_SIZE=128
+ARCH=m68k
--- /dev/null
+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
--- /dev/null
+EMULATION_NAME=vanilla
+SCRIPT_NAME=vanilla
+TEXT_START_ADDR=??
+PAGE_SIZE=??
+ARCH=unknown
+TEMPLATE_NAME=vanilla
--- /dev/null
+EMULATION_NAME=vax
+SCRIPT_NAME=aout
+OUTPUT_FORMAT="a.out-vax"
+TEXT_START_ADDR=0
+PAGE_SIZE=1024
+ARCH=vax
--- /dev/null
+EMULATION_NAME=z8ksim
+SCRIPT_NAME=z8ksim
+OUTPUT_FORMAT="coff-z8k"
+TEXT_START_ADDR=0x0
+PAGE_SIZE=128
+ARCH=z8k
--- /dev/null
+# .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:
+
--- /dev/null
+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.
--- /dev/null
+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
--- /dev/null
+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
.RB "[\|" \-o "
.I output\c
\&\|] \c
-.I objfiles\c
+.I objfile\c
\&.\|.\|.
.br
.RB "[\|" \-A\c
.I input-format\c
\&\|]
.RB "[\|" \-g "\|]"
+.RB "[\|" \-G\c
+.I size\c
+\&\|]
.RB "[\|" \-i "\|]"
.RB "[\|" \-l\c
.I ar\c
.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
.RB "[\|" "\-u\ "\c
.I sym\c
\&]
+.RB "[\|" \-V "\|]"
.RB "[\|" \-v "\|]"
.RB "[\|" \-X "\|]"
.RB "[\|" \-x "\|]"
\&.
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.
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
\&
.B \-g
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
.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
\&, and information on global
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 \-r\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
.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
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"
@ifinfo
@format
START-INFO-DIR-ENTRY
-* Ld: (ld). The GNU linker.
+* Ld:: The GNU linker.
END-INFO-DIR-ENTRY
@end format
@end ifinfo
@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
@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.
option that requires them.
@table @code
-@item @var{objfile@dots{}}
+@item @var{objfile}@dots{}
The object files to be linked.
@ifset I960
@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
@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}
@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
@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
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{@}}.
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
@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 )
@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}.
/* 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;
}
}
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;
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;
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;
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;
%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
write_map = true;
config.map_filename = $2;
}
+ | OPTION_m NAME
+ {
+ /* Ignore. */
+ }
+ | OPTION_memul
+ {
+ /* Ignore. */
+ }
| OPTION_M
{
config.map_filename = "-";
{
/* 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();}
``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 '}'
;
| statement
;
+statement_list_opt:
+ /* empty */
+ | statement_list
+ ;
+
length:
LONG
{ $$ = $1; }
{
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();
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;
#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
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);
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);
}
*/
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)
{
}
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);
/*----------------------------------------------------------------------*/
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;
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);
*/
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,
}
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;
}
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)
/* Build enough state so that the parser can build its tree */
void
-DEFUN_VOID (lang_init)
+lang_init ()
{
obstack_begin (&stat_obstack, 1000);
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;
*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;
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;
}
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;
/*ARGSUSED*/
static void
-DEFUN (print_flags, (ignore_flags),
- int *ignore_flags)
+print_flags (ignore_flags)
+ int *ignore_flags;
{
fprintf (config.map_file, "(");
#if 0
}
void
-DEFUN_VOID (lang_map)
+lang_map ()
{
lang_memory_region_type *m;
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();
*
*/
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 =
*/
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)
{
/* 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)
{
}
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;
*/
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;
}
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;
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;
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)
{
}
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)
{
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
script file.
*/
static void
-DEFUN_VOID (lang_place_undefineds)
+lang_place_undefineds ()
{
ldlang_undef_chain_list_type *ptr = ldlang_undef_chain_list_head;
*/
static void
-DEFUN_VOID (lang_create_output_section_statements)
+lang_create_output_section_statements ()
{
lang_statement_union_type *os;
}
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,
/* 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)
{
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;
}
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;
}
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)
{
}
static void
-DEFUN (print_symbol, (q),
- asymbol * q)
+print_symbol (q)
+ asymbol * q;
{
print_section ("");
fprintf (config.map_file, " ");
}
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 ?
}
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 ("");
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 ();
}
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)
}
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)
{
static void
-DEFUN_VOID (print_statements)
+print_statements ()
{
print_statement (statement_list.head,
abs_output_section);
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
/* 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;
/* 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);
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)
/* align against */
- after = ALIGN (os->bfd_section->vma +
+ after = ALIGN_N (os->bfd_section->vma +
os->bfd_section->_raw_size,
os->block_value);
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)
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
static void
-DEFUN_VOID (lang_finish)
+lang_finish ()
{
ldsym_type *lgs;
int warn = config.relocateable_output != true;
/* 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;
*/
static void
-DEFUN_VOID (lang_common)
+lang_common ()
{
ldsym_type *lgs;
size_t power;
/* 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)
*/
static void
-DEFUN_VOID (lang_place_orphans)
+lang_place_orphans ()
{
lang_input_statement_type *file;
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;
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;
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;
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,
}
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);
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;
void
-DEFUN_VOID (lang_final)
+lang_final ()
{
if (had_output_filename == false)
{
/* 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;
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;
}
}
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 **)));
}
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;
/* 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);
}
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);
}
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);
}
void
-DEFUN (lang_add_map, (name),
- CONST char *name)
+lang_add_map (name)
+ CONST char *name;
{
while (*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);
}
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,
}
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);
}
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)
{
}
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);
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))
{
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))
{
}
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;
/* 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;
}
<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; }
<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;
%%
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)
{
}
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;
void
-DEFUN(lex_redirect,( string),
- CONST char *string)
+lex_redirect (string)
+ CONST char *string;
{
YY_BUFFER_STATE tmp;
int *state_stack_p = state_stack;
void
-DEFUN_VOID(ldlex_script)
+ldlex_script ()
{
*(state_stack_p)++ = yy_start;
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);
}
#endif
int
-DEFUN (hash_string, (key),
- CONST char *key)
+hash_string (key)
+ CONST char *key;
{
register CONST char *cp;
register int k;
__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)
/* 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;
/* 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. */
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)
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)
}
void
-DEFUN_VOID (ldsym_init)
+ldsym_init ()
{
obstack_begin (&global_sym_obstack, 20000);
}
void
-DEFUN(add_warning,(sym),
- asymbol *sym)
+add_warning (sym)
+ asymbol *sym;
{
CONST char *name = ((asymbol *)(sym->value))->name;
warning_list_type *new;
/* 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) {
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;
#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);
void
-DEFUN(mri_format,(name),
- CONST char *name)
+mri_format (name)
+ CONST char *name;
{
if (strcmp(name, "S") == 0)
{
{
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;
+}
#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)
{
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 */
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);
--- /dev/null
+# .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:
+
--- /dev/null
+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.
--- /dev/null
+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
--- /dev/null
+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
--- /dev/null
+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
+
+
+
+
--- /dev/null
+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
--- /dev/null
+# 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
--- /dev/null
+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
--- /dev/null
+# 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
--- /dev/null
+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
--- /dev/null
+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
--- /dev/null
+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
+
+
+
+
--- /dev/null
+cat <<EOF
+OUTPUT_FORMAT("${OUTPUT_FORMAT}")
+OUTPUT_ARCH(${ARCH})
+
+
+SECTIONS
+{
+.text :
+ {
+ *(.text)
+ *(.strings)
+ _etext = .;
+ *(.data)
+ _edata = .;
+ *(.bss)
+ *(COMMON)
+ _end = .;
+
+}
+
+}
+EOF
+
+
+
+
--- /dev/null
+# Nothing to do.
--- /dev/null
+cat <<EOF
+OUTPUT_FORMAT("${OUTPUT_FORMAT}")
+OUTPUT_ARCH(${ARCH})
+
+
+SECTIONS
+{
+.text :
+ {
+ *(.text)
+ *(.strings)
+ _etext = .;
+ *(.data)
+ _edata = .;
+ *(.bss)
+ *(COMMON)
+ _end = .;
+
+}
+
+}
+EOF
+
+
+
+