From 0f9c63ed390b3dc0d8450c338426b861eeeacecb Mon Sep 17 00:00:00 2001 From: thorpej Date: Mon, 16 Sep 2002 18:41:54 +0000 Subject: [PATCH] Remove binutils 2.9. --- gnu/dist/ld/Makefile.am | 794 ----- gnu/dist/ld/Makefile.in | 1290 -------- gnu/dist/ld/NEWS | 169 - gnu/dist/ld/README | 64 - gnu/dist/ld/TODO | 9 - gnu/dist/ld/acconfig.h | 22 - gnu/dist/ld/acinclude.m4 | 1 - gnu/dist/ld/aclocal.m4 | 460 --- gnu/dist/ld/config.in | 52 - gnu/dist/ld/configdoc.texi | 13 - gnu/dist/ld/configure | 2757 ----------------- gnu/dist/ld/configure.host | 166 - gnu/dist/ld/configure.in | 133 - gnu/dist/ld/configure.tgt | 216 -- gnu/dist/ld/dep-in.sed | 16 - gnu/dist/ld/emulparams/README | 2 - gnu/dist/ld/emulparams/a29k.sh | 5 - gnu/dist/ld/emulparams/aixppc.sh | 4 - gnu/dist/ld/emulparams/aixrs6.sh | 4 - gnu/dist/ld/emulparams/alpha.sh | 3 - gnu/dist/ld/emulparams/arcelf.sh | 11 - gnu/dist/ld/emulparams/armaoutb.sh | 7 - gnu/dist/ld/emulparams/armaoutl.sh | 7 - gnu/dist/ld/emulparams/armcoff.sh | 6 - gnu/dist/ld/emulparams/armnbsd.sh | 7 - gnu/dist/ld/emulparams/armpe.sh | 6 - gnu/dist/ld/emulparams/coff_sparc.sh | 7 - gnu/dist/ld/emulparams/d10velf.sh | 8 - gnu/dist/ld/emulparams/delta68.sh | 5 - gnu/dist/ld/emulparams/ebmon29k.sh | 5 - gnu/dist/ld/emulparams/elf32_sparc.sh | 11 - gnu/dist/ld/emulparams/elf32b4300.sh | 29 - gnu/dist/ld/emulparams/elf32bmip.sh | 30 - gnu/dist/ld/emulparams/elf32bsmip.sh | 31 - gnu/dist/ld/emulparams/elf32ebmip.sh | 29 - gnu/dist/ld/emulparams/elf32elmip.sh | 29 - gnu/dist/ld/emulparams/elf32l4300.sh | 29 - gnu/dist/ld/emulparams/elf32lmip.sh | 30 - gnu/dist/ld/emulparams/elf32lppc.sh | 8 - gnu/dist/ld/emulparams/elf32lsmip.sh | 31 - gnu/dist/ld/emulparams/elf32ppc.sh | 8 - gnu/dist/ld/emulparams/elf32shlunx.sh | 15 - gnu/dist/ld/emulparams/elf32shunx.sh | 15 - gnu/dist/ld/emulparams/elf64_sparc.sh | 12 - gnu/dist/ld/emulparams/elf64alpha.sh | 15 - gnu/dist/ld/emulparams/elf_i386.sh | 11 - gnu/dist/ld/emulparams/gld960.sh | 7 - gnu/dist/ld/emulparams/gld960coff.sh | 19 - gnu/dist/ld/emulparams/go32.sh | 7 - gnu/dist/ld/emulparams/h8300.sh | 5 - gnu/dist/ld/emulparams/h8300h.sh | 5 - gnu/dist/ld/emulparams/h8300s.sh | 5 - gnu/dist/ld/emulparams/h8500.sh | 5 - gnu/dist/ld/emulparams/h8500b.sh | 5 - gnu/dist/ld/emulparams/h8500c.sh | 5 - gnu/dist/ld/emulparams/h8500m.sh | 5 - gnu/dist/ld/emulparams/h8500s.sh | 5 - gnu/dist/ld/emulparams/hp300bsd.sh | 5 - gnu/dist/ld/emulparams/hp3hpux.sh | 8 - gnu/dist/ld/emulparams/hppaelf.sh | 7 - gnu/dist/ld/emulparams/i386aout.sh | 6 - gnu/dist/ld/emulparams/i386bsd.sh | 6 - gnu/dist/ld/emulparams/i386coff.sh | 5 - gnu/dist/ld/emulparams/i386go32.sh | 8 - gnu/dist/ld/emulparams/i386linux.sh | 7 - gnu/dist/ld/emulparams/i386lynx.sh | 9 - gnu/dist/ld/emulparams/i386mach.sh | 7 - gnu/dist/ld/emulparams/i386moss.sh | 10 - gnu/dist/ld/emulparams/i386msdos.sh | 7 - gnu/dist/ld/emulparams/i386nbsd.sh | 6 - gnu/dist/ld/emulparams/i386nw.sh | 9 - gnu/dist/ld/emulparams/i386pe.sh | 5 - gnu/dist/ld/emulparams/lnk960.sh | 6 - gnu/dist/ld/emulparams/m32relf.sh | 12 - gnu/dist/ld/emulparams/m68k4knbsd.sh | 7 - gnu/dist/ld/emulparams/m68kaout.sh | 7 - gnu/dist/ld/emulparams/m68kaux.sh | 8 - gnu/dist/ld/emulparams/m68kcoff.sh | 5 - gnu/dist/ld/emulparams/m68kelf.sh | 11 - gnu/dist/ld/emulparams/m68kelfnbsd.sh | 12 - gnu/dist/ld/emulparams/m68klinux.sh | 7 - gnu/dist/ld/emulparams/m68klynx.sh | 8 - gnu/dist/ld/emulparams/m68knbsd.sh | 7 - gnu/dist/ld/emulparams/m68kpsos.sh | 6 - gnu/dist/ld/emulparams/m88kbcs.sh | 5 - gnu/dist/ld/emulparams/mipsbig.sh | 6 - gnu/dist/ld/emulparams/mipsbsd.sh | 7 - gnu/dist/ld/emulparams/mipsidt.sh | 11 - gnu/dist/ld/emulparams/mipsidtl.sh | 11 - gnu/dist/ld/emulparams/mipslit.sh | 6 - gnu/dist/ld/emulparams/mipslnews.sh | 9 - gnu/dist/ld/emulparams/mn10200.sh | 20 - gnu/dist/ld/emulparams/mn10300.sh | 20 - gnu/dist/ld/emulparams/news.sh | 5 - gnu/dist/ld/emulparams/ns32knbsd.sh | 5 - gnu/dist/ld/emulparams/pc532macha.sh | 6 - gnu/dist/ld/emulparams/ppcmacos.sh | 4 - gnu/dist/ld/emulparams/ppcnw.sh | 7 - gnu/dist/ld/emulparams/ppcpe.sh | 4 - gnu/dist/ld/emulparams/riscix.sh | 5 - gnu/dist/ld/emulparams/sa29200.sh | 5 - gnu/dist/ld/emulparams/sh.sh | 5 - gnu/dist/ld/emulparams/shelf.sh | 15 - gnu/dist/ld/emulparams/shl.sh | 5 - gnu/dist/ld/emulparams/shlelf.sh | 17 - gnu/dist/ld/emulparams/shlunx.sh | 5 - gnu/dist/ld/emulparams/shunx.sh | 5 - gnu/dist/ld/emulparams/sparcaout.sh | 8 - gnu/dist/ld/emulparams/sparclinux.sh | 7 - gnu/dist/ld/emulparams/sparclynx.sh | 9 - gnu/dist/ld/emulparams/sparcnbsd.sh | 5 - gnu/dist/ld/emulparams/st2000.sh | 5 - gnu/dist/ld/emulparams/sun3.sh | 8 - gnu/dist/ld/emulparams/sun4.sh | 7 - gnu/dist/ld/emulparams/tic30aout.sh | 7 - gnu/dist/ld/emulparams/tic30coff.sh | 7 - gnu/dist/ld/emulparams/v850.sh | 14 - gnu/dist/ld/emulparams/vanilla.sh | 5 - gnu/dist/ld/emulparams/vax.sh | 5 - gnu/dist/ld/emulparams/vsta.sh | 8 - gnu/dist/ld/emulparams/w65.sh | 5 - gnu/dist/ld/emulparams/z8001.sh | 7 - gnu/dist/ld/emulparams/z8002.sh | 6 - gnu/dist/ld/emultempl/README | 3 - gnu/dist/ld/emultempl/aix.em | 1053 ------- gnu/dist/ld/emultempl/armcoff.em | 146 - gnu/dist/ld/emultempl/elf32.em | 1187 ------- gnu/dist/ld/emultempl/generic.em | 118 - gnu/dist/ld/emultempl/gld960.em | 176 -- gnu/dist/ld/emultempl/gld960c.em | 192 -- gnu/dist/ld/emultempl/hppaelf.em | 283 -- gnu/dist/ld/emultempl/linux.em | 207 -- gnu/dist/ld/emultempl/lnk960.em | 327 -- gnu/dist/ld/emultempl/mipsecoff.em | 229 -- gnu/dist/ld/emultempl/netbsdaout.em | 974 ------ gnu/dist/ld/emultempl/pe.em | 784 ----- gnu/dist/ld/emultempl/stringify.sed | 4 - gnu/dist/ld/emultempl/sunos.em | 1022 ------ gnu/dist/ld/emultempl/vanilla.em | 69 - gnu/dist/ld/gen-doc.texi | 13 - gnu/dist/ld/genscripts.sh | 127 - gnu/dist/ld/h8-doc.texi | 14 - gnu/dist/ld/ld.1 | 1096 ------- gnu/dist/ld/ld.h | 177 -- gnu/dist/ld/ld.texinfo | 3700 ---------------------- gnu/dist/ld/ldcref.c | 547 ---- gnu/dist/ld/ldctor.c | 256 -- gnu/dist/ld/ldctor.h | 54 - gnu/dist/ld/ldemul.c | 262 -- gnu/dist/ld/ldemul.h | 138 - gnu/dist/ld/ldexp.c | 950 ------ gnu/dist/ld/ldexp.h | 109 - gnu/dist/ld/ldfile.c | 410 --- gnu/dist/ld/ldfile.h | 53 - gnu/dist/ld/ldgram.y | 1022 ------ gnu/dist/ld/ldint.texinfo | 412 --- gnu/dist/ld/ldlang.c | 4123 ------------------------- gnu/dist/ld/ldlang.h | 485 --- gnu/dist/ld/ldlex.h | 62 - gnu/dist/ld/ldlex.l | 647 ---- gnu/dist/ld/ldmain.c | 1273 -------- gnu/dist/ld/ldmain.h | 38 - gnu/dist/ld/ldmisc.c | 535 ---- gnu/dist/ld/ldmisc.h | 56 - gnu/dist/ld/ldver.c | 49 - gnu/dist/ld/ldver.h | 22 - gnu/dist/ld/ldwrite.c | 530 ---- gnu/dist/ld/ldwrite.h | 20 - gnu/dist/ld/lexsup.c | 990 ------ gnu/dist/ld/mac-ld.r | 42 - gnu/dist/ld/mri.c | 377 --- gnu/dist/ld/mri.h | 39 - gnu/dist/ld/scripttempl/README | 4 - gnu/dist/ld/scripttempl/a29k.sc | 37 - gnu/dist/ld/scripttempl/aix.sc | 55 - gnu/dist/ld/scripttempl/alpha.sc | 74 - gnu/dist/ld/scripttempl/aout.sc | 55 - gnu/dist/ld/scripttempl/armaout.sc | 35 - gnu/dist/ld/scripttempl/armcoff.sc | 62 - gnu/dist/ld/scripttempl/delta68.sc | 49 - gnu/dist/ld/scripttempl/ebmon29k.sc | 27 - gnu/dist/ld/scripttempl/elf.sc | 218 -- gnu/dist/ld/scripttempl/elfd10v.sc | 196 -- gnu/dist/ld/scripttempl/elfppc.sc | 216 -- gnu/dist/ld/scripttempl/go32coff.sc | 33 - gnu/dist/ld/scripttempl/h8300.sc | 69 - gnu/dist/ld/scripttempl/h8300h.sc | 76 - gnu/dist/ld/scripttempl/h8300s.sc | 76 - gnu/dist/ld/scripttempl/h8500.sc | 62 - gnu/dist/ld/scripttempl/h8500b.sc | 62 - gnu/dist/ld/scripttempl/h8500c.sc | 59 - gnu/dist/ld/scripttempl/h8500m.sc | 61 - gnu/dist/ld/scripttempl/h8500s.sc | 60 - gnu/dist/ld/scripttempl/hppaelf.sc | 38 - gnu/dist/ld/scripttempl/i386coff.sc | 43 - gnu/dist/ld/scripttempl/i386go32.sc | 40 - gnu/dist/ld/scripttempl/i386lynx.sc | 46 - gnu/dist/ld/scripttempl/i386msdos.sc | 38 - gnu/dist/ld/scripttempl/i960.sc | 25 - gnu/dist/ld/scripttempl/m68kaux.sc | 46 - gnu/dist/ld/scripttempl/m68kcoff.sc | 42 - gnu/dist/ld/scripttempl/m68klynx.sc | 46 - gnu/dist/ld/scripttempl/m88kbcs.sc | 49 - gnu/dist/ld/scripttempl/mips.sc | 72 - gnu/dist/ld/scripttempl/mipsbsd.sc | 30 - gnu/dist/ld/scripttempl/nw.sc | 131 - gnu/dist/ld/scripttempl/pe.sc | 145 - gnu/dist/ld/scripttempl/ppcpe.sc | 198 -- gnu/dist/ld/scripttempl/psos.sc | 61 - gnu/dist/ld/scripttempl/riscix.sc | 35 - gnu/dist/ld/scripttempl/sa29200.sc | 44 - gnu/dist/ld/scripttempl/sh.sc | 56 - gnu/dist/ld/scripttempl/shunx.sc | 53 - gnu/dist/ld/scripttempl/sparccoff.sc | 48 - gnu/dist/ld/scripttempl/sparclynx.sc | 47 - gnu/dist/ld/scripttempl/st2000.sc | 26 - gnu/dist/ld/scripttempl/tic30aout.sc | 34 - gnu/dist/ld/scripttempl/tic30coff.sc | 58 - gnu/dist/ld/scripttempl/v850.sc | 183 -- gnu/dist/ld/scripttempl/vanilla.sc | 1 - gnu/dist/ld/scripttempl/w65.sc | 58 - gnu/dist/ld/scripttempl/z8000.sc | 54 - gnu/dist/ld/stamp-h.in | 1 - gnu/dist/ld/sysdep.h | 69 - 224 files changed, 35962 deletions(-) delete mode 100644 gnu/dist/ld/Makefile.am delete mode 100644 gnu/dist/ld/Makefile.in delete mode 100644 gnu/dist/ld/NEWS delete mode 100644 gnu/dist/ld/README delete mode 100644 gnu/dist/ld/TODO delete mode 100644 gnu/dist/ld/acconfig.h delete mode 100644 gnu/dist/ld/acinclude.m4 delete mode 100644 gnu/dist/ld/aclocal.m4 delete mode 100644 gnu/dist/ld/config.in delete mode 100644 gnu/dist/ld/configdoc.texi delete mode 100644 gnu/dist/ld/configure delete mode 100644 gnu/dist/ld/configure.host delete mode 100644 gnu/dist/ld/configure.in delete mode 100644 gnu/dist/ld/configure.tgt delete mode 100644 gnu/dist/ld/dep-in.sed delete mode 100644 gnu/dist/ld/emulparams/README delete mode 100644 gnu/dist/ld/emulparams/a29k.sh delete mode 100644 gnu/dist/ld/emulparams/aixppc.sh delete mode 100644 gnu/dist/ld/emulparams/aixrs6.sh delete mode 100644 gnu/dist/ld/emulparams/alpha.sh delete mode 100644 gnu/dist/ld/emulparams/arcelf.sh delete mode 100644 gnu/dist/ld/emulparams/armaoutb.sh delete mode 100644 gnu/dist/ld/emulparams/armaoutl.sh delete mode 100644 gnu/dist/ld/emulparams/armcoff.sh delete mode 100644 gnu/dist/ld/emulparams/armnbsd.sh delete mode 100644 gnu/dist/ld/emulparams/armpe.sh delete mode 100644 gnu/dist/ld/emulparams/coff_sparc.sh delete mode 100644 gnu/dist/ld/emulparams/d10velf.sh delete mode 100644 gnu/dist/ld/emulparams/delta68.sh delete mode 100644 gnu/dist/ld/emulparams/ebmon29k.sh delete mode 100644 gnu/dist/ld/emulparams/elf32_sparc.sh delete mode 100644 gnu/dist/ld/emulparams/elf32b4300.sh delete mode 100644 gnu/dist/ld/emulparams/elf32bmip.sh delete mode 100644 gnu/dist/ld/emulparams/elf32bsmip.sh delete mode 100644 gnu/dist/ld/emulparams/elf32ebmip.sh delete mode 100644 gnu/dist/ld/emulparams/elf32elmip.sh delete mode 100644 gnu/dist/ld/emulparams/elf32l4300.sh delete mode 100644 gnu/dist/ld/emulparams/elf32lmip.sh delete mode 100644 gnu/dist/ld/emulparams/elf32lppc.sh delete mode 100644 gnu/dist/ld/emulparams/elf32lsmip.sh delete mode 100644 gnu/dist/ld/emulparams/elf32ppc.sh delete mode 100644 gnu/dist/ld/emulparams/elf32shlunx.sh delete mode 100644 gnu/dist/ld/emulparams/elf32shunx.sh delete mode 100644 gnu/dist/ld/emulparams/elf64_sparc.sh delete mode 100644 gnu/dist/ld/emulparams/elf64alpha.sh delete mode 100644 gnu/dist/ld/emulparams/elf_i386.sh delete mode 100644 gnu/dist/ld/emulparams/gld960.sh delete mode 100644 gnu/dist/ld/emulparams/gld960coff.sh delete mode 100644 gnu/dist/ld/emulparams/go32.sh delete mode 100644 gnu/dist/ld/emulparams/h8300.sh delete mode 100644 gnu/dist/ld/emulparams/h8300h.sh delete mode 100644 gnu/dist/ld/emulparams/h8300s.sh delete mode 100644 gnu/dist/ld/emulparams/h8500.sh delete mode 100644 gnu/dist/ld/emulparams/h8500b.sh delete mode 100644 gnu/dist/ld/emulparams/h8500c.sh delete mode 100644 gnu/dist/ld/emulparams/h8500m.sh delete mode 100644 gnu/dist/ld/emulparams/h8500s.sh delete mode 100644 gnu/dist/ld/emulparams/hp300bsd.sh delete mode 100644 gnu/dist/ld/emulparams/hp3hpux.sh delete mode 100644 gnu/dist/ld/emulparams/hppaelf.sh delete mode 100644 gnu/dist/ld/emulparams/i386aout.sh delete mode 100644 gnu/dist/ld/emulparams/i386bsd.sh delete mode 100644 gnu/dist/ld/emulparams/i386coff.sh delete mode 100644 gnu/dist/ld/emulparams/i386go32.sh delete mode 100644 gnu/dist/ld/emulparams/i386linux.sh delete mode 100644 gnu/dist/ld/emulparams/i386lynx.sh delete mode 100644 gnu/dist/ld/emulparams/i386mach.sh delete mode 100644 gnu/dist/ld/emulparams/i386moss.sh delete mode 100644 gnu/dist/ld/emulparams/i386msdos.sh delete mode 100644 gnu/dist/ld/emulparams/i386nbsd.sh delete mode 100644 gnu/dist/ld/emulparams/i386nw.sh delete mode 100644 gnu/dist/ld/emulparams/i386pe.sh delete mode 100644 gnu/dist/ld/emulparams/lnk960.sh delete mode 100644 gnu/dist/ld/emulparams/m32relf.sh delete mode 100644 gnu/dist/ld/emulparams/m68k4knbsd.sh delete mode 100644 gnu/dist/ld/emulparams/m68kaout.sh delete mode 100644 gnu/dist/ld/emulparams/m68kaux.sh delete mode 100644 gnu/dist/ld/emulparams/m68kcoff.sh delete mode 100644 gnu/dist/ld/emulparams/m68kelf.sh delete mode 100644 gnu/dist/ld/emulparams/m68kelfnbsd.sh delete mode 100644 gnu/dist/ld/emulparams/m68klinux.sh delete mode 100644 gnu/dist/ld/emulparams/m68klynx.sh delete mode 100644 gnu/dist/ld/emulparams/m68knbsd.sh delete mode 100644 gnu/dist/ld/emulparams/m68kpsos.sh delete mode 100644 gnu/dist/ld/emulparams/m88kbcs.sh delete mode 100644 gnu/dist/ld/emulparams/mipsbig.sh delete mode 100644 gnu/dist/ld/emulparams/mipsbsd.sh delete mode 100644 gnu/dist/ld/emulparams/mipsidt.sh delete mode 100644 gnu/dist/ld/emulparams/mipsidtl.sh delete mode 100644 gnu/dist/ld/emulparams/mipslit.sh delete mode 100644 gnu/dist/ld/emulparams/mipslnews.sh delete mode 100644 gnu/dist/ld/emulparams/mn10200.sh delete mode 100644 gnu/dist/ld/emulparams/mn10300.sh delete mode 100644 gnu/dist/ld/emulparams/news.sh delete mode 100644 gnu/dist/ld/emulparams/ns32knbsd.sh delete mode 100644 gnu/dist/ld/emulparams/pc532macha.sh delete mode 100644 gnu/dist/ld/emulparams/ppcmacos.sh delete mode 100644 gnu/dist/ld/emulparams/ppcnw.sh delete mode 100644 gnu/dist/ld/emulparams/ppcpe.sh delete mode 100644 gnu/dist/ld/emulparams/riscix.sh delete mode 100644 gnu/dist/ld/emulparams/sa29200.sh delete mode 100644 gnu/dist/ld/emulparams/sh.sh delete mode 100644 gnu/dist/ld/emulparams/shelf.sh delete mode 100644 gnu/dist/ld/emulparams/shl.sh delete mode 100644 gnu/dist/ld/emulparams/shlelf.sh delete mode 100644 gnu/dist/ld/emulparams/shlunx.sh delete mode 100644 gnu/dist/ld/emulparams/shunx.sh delete mode 100644 gnu/dist/ld/emulparams/sparcaout.sh delete mode 100644 gnu/dist/ld/emulparams/sparclinux.sh delete mode 100644 gnu/dist/ld/emulparams/sparclynx.sh delete mode 100644 gnu/dist/ld/emulparams/sparcnbsd.sh delete mode 100644 gnu/dist/ld/emulparams/st2000.sh delete mode 100644 gnu/dist/ld/emulparams/sun3.sh delete mode 100644 gnu/dist/ld/emulparams/sun4.sh delete mode 100644 gnu/dist/ld/emulparams/tic30aout.sh delete mode 100644 gnu/dist/ld/emulparams/tic30coff.sh delete mode 100644 gnu/dist/ld/emulparams/v850.sh delete mode 100644 gnu/dist/ld/emulparams/vanilla.sh delete mode 100644 gnu/dist/ld/emulparams/vax.sh delete mode 100644 gnu/dist/ld/emulparams/vsta.sh delete mode 100644 gnu/dist/ld/emulparams/w65.sh delete mode 100644 gnu/dist/ld/emulparams/z8001.sh delete mode 100644 gnu/dist/ld/emulparams/z8002.sh delete mode 100644 gnu/dist/ld/emultempl/README delete mode 100644 gnu/dist/ld/emultempl/aix.em delete mode 100644 gnu/dist/ld/emultempl/armcoff.em delete mode 100644 gnu/dist/ld/emultempl/elf32.em delete mode 100644 gnu/dist/ld/emultempl/generic.em delete mode 100644 gnu/dist/ld/emultempl/gld960.em delete mode 100644 gnu/dist/ld/emultempl/gld960c.em delete mode 100644 gnu/dist/ld/emultempl/hppaelf.em delete mode 100644 gnu/dist/ld/emultempl/linux.em delete mode 100644 gnu/dist/ld/emultempl/lnk960.em delete mode 100644 gnu/dist/ld/emultempl/mipsecoff.em delete mode 100644 gnu/dist/ld/emultempl/netbsdaout.em delete mode 100644 gnu/dist/ld/emultempl/pe.em delete mode 100644 gnu/dist/ld/emultempl/stringify.sed delete mode 100644 gnu/dist/ld/emultempl/sunos.em delete mode 100644 gnu/dist/ld/emultempl/vanilla.em delete mode 100644 gnu/dist/ld/gen-doc.texi delete mode 100644 gnu/dist/ld/genscripts.sh delete mode 100644 gnu/dist/ld/h8-doc.texi delete mode 100644 gnu/dist/ld/ld.1 delete mode 100644 gnu/dist/ld/ld.h delete mode 100644 gnu/dist/ld/ld.texinfo delete mode 100644 gnu/dist/ld/ldcref.c delete mode 100644 gnu/dist/ld/ldctor.c delete mode 100644 gnu/dist/ld/ldctor.h delete mode 100644 gnu/dist/ld/ldemul.c delete mode 100644 gnu/dist/ld/ldemul.h delete mode 100644 gnu/dist/ld/ldexp.c delete mode 100644 gnu/dist/ld/ldexp.h delete mode 100644 gnu/dist/ld/ldfile.c delete mode 100644 gnu/dist/ld/ldfile.h delete mode 100644 gnu/dist/ld/ldgram.y delete mode 100644 gnu/dist/ld/ldint.texinfo delete mode 100644 gnu/dist/ld/ldlang.c delete mode 100644 gnu/dist/ld/ldlang.h delete mode 100644 gnu/dist/ld/ldlex.h delete mode 100644 gnu/dist/ld/ldlex.l delete mode 100644 gnu/dist/ld/ldmain.c delete mode 100644 gnu/dist/ld/ldmain.h delete mode 100644 gnu/dist/ld/ldmisc.c delete mode 100644 gnu/dist/ld/ldmisc.h delete mode 100644 gnu/dist/ld/ldver.c delete mode 100644 gnu/dist/ld/ldver.h delete mode 100644 gnu/dist/ld/ldwrite.c delete mode 100644 gnu/dist/ld/ldwrite.h delete mode 100644 gnu/dist/ld/lexsup.c delete mode 100644 gnu/dist/ld/mac-ld.r delete mode 100644 gnu/dist/ld/mri.c delete mode 100644 gnu/dist/ld/mri.h delete mode 100644 gnu/dist/ld/scripttempl/README delete mode 100644 gnu/dist/ld/scripttempl/a29k.sc delete mode 100644 gnu/dist/ld/scripttempl/aix.sc delete mode 100644 gnu/dist/ld/scripttempl/alpha.sc delete mode 100644 gnu/dist/ld/scripttempl/aout.sc delete mode 100644 gnu/dist/ld/scripttempl/armaout.sc delete mode 100644 gnu/dist/ld/scripttempl/armcoff.sc delete mode 100644 gnu/dist/ld/scripttempl/delta68.sc delete mode 100644 gnu/dist/ld/scripttempl/ebmon29k.sc delete mode 100644 gnu/dist/ld/scripttempl/elf.sc delete mode 100644 gnu/dist/ld/scripttempl/elfd10v.sc delete mode 100644 gnu/dist/ld/scripttempl/elfppc.sc delete mode 100644 gnu/dist/ld/scripttempl/go32coff.sc delete mode 100644 gnu/dist/ld/scripttempl/h8300.sc delete mode 100644 gnu/dist/ld/scripttempl/h8300h.sc delete mode 100644 gnu/dist/ld/scripttempl/h8300s.sc delete mode 100644 gnu/dist/ld/scripttempl/h8500.sc delete mode 100644 gnu/dist/ld/scripttempl/h8500b.sc delete mode 100644 gnu/dist/ld/scripttempl/h8500c.sc delete mode 100644 gnu/dist/ld/scripttempl/h8500m.sc delete mode 100644 gnu/dist/ld/scripttempl/h8500s.sc delete mode 100644 gnu/dist/ld/scripttempl/hppaelf.sc delete mode 100644 gnu/dist/ld/scripttempl/i386coff.sc delete mode 100644 gnu/dist/ld/scripttempl/i386go32.sc delete mode 100644 gnu/dist/ld/scripttempl/i386lynx.sc delete mode 100644 gnu/dist/ld/scripttempl/i386msdos.sc delete mode 100644 gnu/dist/ld/scripttempl/i960.sc delete mode 100644 gnu/dist/ld/scripttempl/m68kaux.sc delete mode 100644 gnu/dist/ld/scripttempl/m68kcoff.sc delete mode 100644 gnu/dist/ld/scripttempl/m68klynx.sc delete mode 100644 gnu/dist/ld/scripttempl/m88kbcs.sc delete mode 100644 gnu/dist/ld/scripttempl/mips.sc delete mode 100644 gnu/dist/ld/scripttempl/mipsbsd.sc delete mode 100644 gnu/dist/ld/scripttempl/nw.sc delete mode 100644 gnu/dist/ld/scripttempl/pe.sc delete mode 100644 gnu/dist/ld/scripttempl/ppcpe.sc delete mode 100644 gnu/dist/ld/scripttempl/psos.sc delete mode 100644 gnu/dist/ld/scripttempl/riscix.sc delete mode 100644 gnu/dist/ld/scripttempl/sa29200.sc delete mode 100644 gnu/dist/ld/scripttempl/sh.sc delete mode 100644 gnu/dist/ld/scripttempl/shunx.sc delete mode 100644 gnu/dist/ld/scripttempl/sparccoff.sc delete mode 100644 gnu/dist/ld/scripttempl/sparclynx.sc delete mode 100644 gnu/dist/ld/scripttempl/st2000.sc delete mode 100644 gnu/dist/ld/scripttempl/tic30aout.sc delete mode 100644 gnu/dist/ld/scripttempl/tic30coff.sc delete mode 100644 gnu/dist/ld/scripttempl/v850.sc delete mode 100644 gnu/dist/ld/scripttempl/vanilla.sc delete mode 100644 gnu/dist/ld/scripttempl/w65.sc delete mode 100644 gnu/dist/ld/scripttempl/z8000.sc delete mode 100644 gnu/dist/ld/stamp-h.in delete mode 100644 gnu/dist/ld/sysdep.h diff --git a/gnu/dist/ld/Makefile.am b/gnu/dist/ld/Makefile.am deleted file mode 100644 index be5666d9bbca..000000000000 --- a/gnu/dist/ld/Makefile.am +++ /dev/null @@ -1,794 +0,0 @@ -## Process this file with automake to generate Makefile.in - -AUTOMAKE_OPTIONS = cygnus dejagnu - -tooldir = $(exec_prefix)/$(target_alias) - -YACC = `if [ -f ../bison/bison ] ; then echo ../bison/bison -y -L../bison/bison ; else echo bison -y ; fi` -YFLAGS = -d -LEX = `if [ -f ../flex/flex ] ; then echo ../flex/flex ; else echo flex ; fi` - -# We put the scripts in the directory $(scriptdir)/ldscripts. -# We can't put the scripts in $(datadir) because the SEARCH_DIR -# directives need to be different for native and cross linkers. -scriptdir = $(tooldir)/lib - -EMUL = @EMUL@ -EMULATION_OFILES = @EMULATION_OFILES@ - -# Search path to override the default search path for -lfoo libraries. -# If LIB_PATH is empty, the ones in the script (if any) are left alone. -# (The default is usually /lib:/usr/lib:/usr/local/lib, unless building -# a cross-linker, in which case the default is empty. See genscripts.sh.) -# Otherwise, they are replaced with the ones given in LIB_PATH, -# which may have the form: LIB_PATH=/lib:/usr/local/lib -LIB_PATH = - -BASEDIR = $(srcdir)/.. -BFDDIR = $(BASEDIR)/bfd -INCDIR = $(BASEDIR)/include -DEP = mkdep - -# What version of the manual to build -DOCVER = gen - -#stuff for self hosting (can be overridden in config file). -HOSTING_CRT0 = @HOSTING_CRT0@ -HOSTING_LIBS = @HOSTING_LIBS@ -HOSTING_EMU = -m $(EMUL) - -# Setup the testing framework, if you have one -EXPECT = `if [ -f $$r/../expect/expect ] ; \ - then echo $$r/../expect/expect ; \ - else echo expect ; fi` - -RUNTEST = `if [ -f $${srcroot}/../dejagnu/runtest ] ; \ - then echo $${srcroot}/../dejagnu/runtest ; \ - else echo runtest ; fi` - -RUNTESTFLAGS = - -CC_FOR_TARGET = ` \ - if [ -f $$r/../gcc/xgcc ] ; then \ - if [ -f $$r/../newlib/Makefile ] ; then \ - echo $$r/../gcc/xgcc -B$$r/../gcc/ -idirafter $$r/../newlib/targ-include -idirafter $${srcroot}/../newlib/libc/include -nostdinc; \ - else \ - echo $$r/../gcc/xgcc -B$$r/../gcc/; \ - fi; \ - else \ - if [ "@host@" = "@target@" ] ; then \ - echo $(CC); \ - else \ - echo gcc | sed '$(transform)'; \ - fi; \ - fi` - -CXX = gcc -CXX_FOR_TARGET = ` \ - if [ -f $$r/../gcc/xgcc ] ; then \ - if [ -f $$r/../newlib/Makefile ] ; then \ - echo $$r/../gcc/xgcc -B$$r/../gcc/ -idirafter $$r/../newlib/targ-include -idirafter $${srcroot}/../newlib/libc/include -nostdinc; \ - else \ - echo $$r/../gcc/xgcc -B$$r/../gcc/; \ - fi; \ - else \ - if [ "@host@" = "@target@" ] ; then \ - echo $(CXX); \ - else \ - echo gcc | sed '$(transform)'; \ - fi; \ - fi` - -noinst_PROGRAMS = ld-new -info_TEXINFOS = ld.texinfo -noinst_TEXINFOS = ldint.texinfo -man_MANS = ld.1 - -INCLUDES = -D_GNU_SOURCE -I. -I$(srcdir) -I../bfd -I$(BFDDIR) -I$(INCDIR) $(HDEFINES) $(CFLAGS) - -BFDLIB = ../bfd/libbfd.la -LIBIBERTY = ../libiberty/libiberty.a - -ALL_EMULATIONS = \ - ea29k.o \ - eaixppc.o \ - eaixrs6.o \ - ealpha.o \ - earcelf.o \ - earmaoutb.o \ - earmaoutl.o \ - earmcoff.o \ - earmnbsd.o \ - earmpe.o \ - ecoff_sparc.o \ - ed10velf.o \ - edelta68.o \ - eebmon29k.o \ - eelf32_sparc.o \ - eelf32b4300.o \ - eelf32bmip.o \ - eelf32ebmip.o \ - eelf32elmip.o \ - eelf32l4300.o \ - eelf32lmip.o \ - eelf32lppc.o \ - eelf32ppc.o \ - eelf_i386.o \ - egld960.o \ - egld960coff.o \ - ego32.o \ - eh8300.o \ - eh8300h.o \ - eh8300s.o \ - eh8500.o \ - eh8500b.o \ - eh8500c.o \ - eh8500m.o \ - eh8500s.o \ - ehp300bsd.o \ - ehp3hpux.o \ - ehppaelf.o \ - ei386aout.o \ - ei386bsd.o \ - ei386coff.o \ - ei386go32.o \ - ei386linux.o \ - ei386lynx.o \ - ei386mach.o \ - ei386moss.o \ - ei386msdos.o \ - ei386nbsd.o \ - ei386nw.o \ - ei386pe.o \ - elnk960.o \ - em68k4knbsd.o \ - em68kaout.o \ - em68kaux.o \ - em68kcoff.o \ - em68kelf.o \ - em68klinux.o \ - em68klynx.o \ - em68knbsd.o \ - em68kpsos.o \ - em88kbcs.o \ - emipsbig.o \ - emipsbsd.o \ - emipsidt.o \ - emipsidtl.o \ - emipslit.o \ - emipslnews.o \ - enews.o \ - ens32knbsd.o \ - epc532macha.o \ - eppcmacos.o \ - eppcnw.o \ - eppcpe.o \ - eriscix.o \ - esa29200.o \ - esh.o \ - eshelf.o \ - eshlelf.o \ - eshl.o \ - esparcaout.o \ - esparclinux.o \ - esparclynx.o \ - esparcnbsd.o \ - est2000.o \ - esun3.o \ - esun4.o \ - etic30aout.o \ - etic30coff.o \ - evanilla.o \ - evax.o \ - evsta.o \ - ew65.o \ - ez8001.o \ - ez8002.o - -ALL_64_EMULATIONS = \ - eelf64_sparc.o \ - eelf64alpha.o - -CFILES = ldctor.c ldemul.c ldexp.c ldfile.c ldlang.c \ - ldmain.c ldmisc.c ldver.c ldwrite.c lexsup.c \ - mri.c ldcref.c - -HFILES = config.h ld.h ldctor.h ldemul.h ldexp.h ldfile.h \ - ldlang.h ldlex.h ldmain.h ldmisc.h ldver.h \ - ldwrite.h mri.h - -GENERATED_CFILES = ldgram.c ldlex.c -GENERATED_HFILES = ldgram.h ldemul-list.h - -OFILES = ldgram.o ldlex.o lexsup.o ldlang.o mri.o ldctor.o ldmain.o \ - ldwrite.o ldexp.o ldemul.o ldver.o ldmisc.o \ - ldfile.o ldcref.o ${EMULATION_OFILES} - -STAGESTUFF = *.o ldscripts/* e*.c - -ldmain.o: ldmain.c config.status - $(COMPILE) -c -DDEFAULT_EMULATION='"$(EMUL)"' -DSCRIPTDIR='"$(scriptdir)"' -DTARGET='"@target@"' $(srcdir)/ldmain.c - -ldemul-list.h: Makefile - (echo "/* This file is automatically generated. DO NOT EDIT! */";\ - for f in `echo " " ${EMULATION_OFILES} "" \ - | sed -e 's/ e/ ld/g' -e 's/ ld/ /g' -e 's/[.]o//g'`; do \ - echo "extern ld_emulation_xfer_type ld_$${f}_emulation;"; \ - done;\ - echo "";\ - echo "#define EMULATION_LIST \\";\ - for f in `echo " " ${EMULATION_OFILES} "" \ - | sed -e 's/ e/ ld/g' -e 's/ ld/ /g' -e 's/[.]o//g'`; do \ - echo " &ld_$${f}_emulation, \\"; \ - done;\ - echo " 0") >ldemul-tmp.h - mv ldemul-tmp.h ldemul-list.h - -# These all start with e so 'make clean' can find them. - -GENSCRIPTS = $(SHELL) $(srcdir)/genscripts.sh ${srcdir} ${libdir} @host@ @target@ @target_alias@ ${EMUL} "@NATIVE_LIB_DIRS@" -GEN_DEPENDS = $(srcdir)/genscripts.sh $(srcdir)/emultempl/stringify.sed -@TDIRS@ - -ea29k.c: $(srcdir)/emulparams/a29k.sh \ - $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/a29k.sc ${GEN_DEPENDS} - ${GENSCRIPTS} a29k "$(tdir_a29k)" -eaixppc.c: $(srcdir)/emulparams/aixppc.sh \ - $(srcdir)/emultempl/aix.em $(srcdir)/scripttempl/aix.sc ${GEN_DEPENDS} - ${GENSCRIPTS} aixppc "$(tdir_aixppc)" -eaixrs6.c: $(srcdir)/emulparams/aixrs6.sh \ - $(srcdir)/emultempl/aix.em $(srcdir)/scripttempl/aix.sc ${GEN_DEPENDS} - ${GENSCRIPTS} aixrs6 "$(tdir_aixrs6)" -ealpha.c: $(srcdir)/emulparams/alpha.sh \ - $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/alpha.sc ${GEN_DEPENDS} - ${GENSCRIPTS} alpha "$(tdir_alpha)" -earcelf.c: $(srcdir)/emulparams/arcelf.sh \ - $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS} - ${GENSCRIPTS} arcelf "$(tdir_arcelf)" -earmaoutb.c: $(srcdir)/emulparams/armaoutb.sh \ - $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/armaout.sc ${GEN_DEPENDS} - ${GENSCRIPTS} armaoutb "$(tdir_armaoutb)" -earmaoutl.c: $(srcdir)/emulparams/armaoutl.sh \ - $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/armaout.sc ${GEN_DEPENDS} - ${GENSCRIPTS} armaoutl "$(tdir_armaoutl)" -earmcoff.c: $(srcdir)/emulparams/armcoff.sh \ - $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/armcoff.sc ${GEN_DEPENDS} - ${GENSCRIPTS} armcoff "$(tdir_armcoff)" -earmnbsd.c: $(srcdir)/emulparams/armnbsd.sh \ - $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/armaout.sc ${GEN_DEPENDS} - ${GENSCRIPTS} armnbsd "$(tdir_armnbsd)" -earmpe.c: $(srcdir)/emulparams/armpe.sh \ - $(srcdir)/emultempl/pe.em $(srcdir)/scripttempl/pe.sc ${GEN_DEPENDS} - ${GENSCRIPTS} armpe "$(tdir_armpe)" -ecoff_sparc.c: $(srcdir)/emulparams/coff_sparc.sh \ - $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/sparccoff.sc ${GEN_DEPENDS} - ${GENSCRIPTS} coff_sparc "$(tdir_coff_sparc)" -ed10velf.c: $(srcdir)/emulparams/d10velf.sh \ - $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/elfd10v.sc ${GEN_DEPENDS} - ${GENSCRIPTS} d10velf "$(tdir_d10v)" -edelta68.c: $(srcdir)/emulparams/delta68.sh \ - $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/delta68.sc ${GEN_DEPENDS} - ${GENSCRIPTS} delta68 "$(tdir_delta68)" -eebmon29k.c: $(srcdir)/emulparams/ebmon29k.sh \ - $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/ebmon29k.sc ${GEN_DEPENDS} - ${GENSCRIPTS} ebmon29k "$(tdir_ebmon29k)" -em32relf.c: $(srcdir)/emulparams/m32relf.sh \ - $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS} - ${GENSCRIPTS} m32relf "$(tdir_m32r)" -eelf32_sparc.c: $(srcdir)/emulparams/elf32_sparc.sh \ - $(srcdir)/emultempl/elf32.em $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS} - ${GENSCRIPTS} elf32_sparc "$(tdir_elf32_sparc)" -eelf32b4300.c: $(srcdir)/emulparams/elf32b4300.sh \ - $(srcdir)/emultempl/elf32.em $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS} - ${GENSCRIPTS} elf32b4300 "$(tdir_elf32b4300)" -eelf32bmip.c: $(srcdir)/emulparams/elf32bmip.sh \ - $(srcdir)/emultempl/elf32.em $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS} - ${GENSCRIPTS} elf32bmip "$(tdir_elf32bmip)" -eelf32bsmip.c: $(srcdir)/emulparams/elf32bsmip.sh \ - $(srcdir)/emultempl/elf32.em $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS} - ${GENSCRIPTS} elf32bsmip "$(tdir_elf32bsmip)" -eelf32ebmip.c: $(srcdir)/emulparams/elf32ebmip.sh \ - $(srcdir)/emultempl/elf32.em $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS} - ${GENSCRIPTS} elf32ebmip "$(tdir_elf32ebmip)" -eelf32elmip.c: $(srcdir)/emulparams/elf32elmip.sh \ - $(srcdir)/emultempl/elf32.em $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS} - ${GENSCRIPTS} elf32elmip "$(tdir_elf32elmip)" -eelf32l4300.c: $(srcdir)/emulparams/elf32l4300.sh \ - $(srcdir)/emultempl/elf32.em $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS} - ${GENSCRIPTS} elf32l4300 "$(tdir_elf32l4300)" -eelf32lmip.c: $(srcdir)/emulparams/elf32lmip.sh \ - $(srcdir)/emultempl/elf32.em $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS} - ${GENSCRIPTS} elf32lmip "$(tdir_elf32lmip)" -eelf32lppc.c: $(srcdir)/emulparams/elf32lppc.sh \ - $(srcdir)/emultempl/elf32.em $(srcdir)/scripttempl/elfppc.sc ${GEN_DEPENDS} - ${GENSCRIPTS} elf32lppc "$(tdir_elf32lppc)" -eelf32lsmip.c: $(srcdir)/emulparams/elf32lsmip.sh \ - $(srcdir)/emultempl/elf32.em $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS} - ${GENSCRIPTS} elf32lsmip "$(tdir_elf32lsmip)" -eelf32ppc.c: $(srcdir)/emulparams/elf32ppc.sh \ - $(srcdir)/emultempl/elf32.em $(srcdir)/scripttempl/elfppc.sc ${GEN_DEPENDS} - ${GENSCRIPTS} elf32ppc "$(tdir_elf32ppc)" -eelf64alpha.c: $(srcdir)/emulparams/elf64alpha.sh \ - $(srcdir)/emultempl/elf32.em $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS} - ${GENSCRIPTS} elf64alpha "$(tdir_elf64alpha)" -eelf64_sparc.c: $(srcdir)/emulparams/elf64_sparc.sh \ - $(srcdir)/emultempl/elf32.em $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS} - ${GENSCRIPTS} elf64_sparc "$(tdir_elf64_sparc)" -eelf_i386.c: $(srcdir)/emulparams/elf_i386.sh \ - $(srcdir)/emultempl/elf32.em $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS} - ${GENSCRIPTS} elf_i386 "$(tdir_elf_i386)" -egld960.c: $(srcdir)/emulparams/gld960.sh \ - $(srcdir)/emultempl/gld960.em $(srcdir)/scripttempl/i960.sc ${GEN_DEPENDS} - ${GENSCRIPTS} gld960 "$(tdir_gld960)" -egld960coff.c: $(srcdir)/emulparams/gld960coff.sh \ - $(srcdir)/emultempl/gld960c.em $(srcdir)/scripttempl/i960.sc ${GEN_DEPENDS} - ${GENSCRIPTS} gld960coff "$(tdir_gld960coff)" -ego32.c: $(srcdir)/emulparams/go32.sh \ - $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/aout.sc ${GEN_DEPENDS} - ${GENSCRIPTS} go32 "$(tdir_go32)" -eh8300.c: $(srcdir)/emulparams/h8300.sh \ - $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/h8300.sc ${GEN_DEPENDS} - ${GENSCRIPTS} h8300 "$(tdir_h8300)" -eh8300h.c: $(srcdir)/emulparams/h8300h.sh \ - $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/h8300h.sc ${GEN_DEPENDS} - ${GENSCRIPTS} h8300h "$(tdir_h8300h)" -eh8300s.c: $(srcdir)/emulparams/h8300s.sh \ - $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/h8300s.sc ${GEN_DEPENDS} - ${GENSCRIPTS} h8300s "$(tdir_h8300s)" -eh8500.c: $(srcdir)/emulparams/h8500.sh \ - $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/h8500.sc ${GEN_DEPENDS} - ${GENSCRIPTS} h8500 "$(tdir_h8500)" -eh8500b.c: $(srcdir)/emulparams/h8500b.sh \ - $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/h8500b.sc ${GEN_DEPENDS} - ${GENSCRIPTS} h8500b "$(tdir_h8500b)" -eh8500c.c: $(srcdir)/emulparams/h8500c.sh \ - $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/h8500c.sc ${GEN_DEPENDS} - ${GENSCRIPTS} h8500c "$(tdir_h8500c)" -eh8500m.c: $(srcdir)/emulparams/h8500m.sh \ - $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/h8500m.sc ${GEN_DEPENDS} - ${GENSCRIPTS} h8500m "$(tdir_h8500m)" -eh8500s.c: $(srcdir)/emulparams/h8500s.sh \ - $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/h8500s.sc ${GEN_DEPENDS} - ${GENSCRIPTS} h8500s "$(tdir_h8500s)" -ehp300bsd.c: $(srcdir)/emulparams/hp300bsd.sh \ - $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/aout.sc ${GEN_DEPENDS} - ${GENSCRIPTS} hp300bsd "$(tdir_hp300bsd)" -ehp3hpux.c: $(srcdir)/emulparams/hp3hpux.sh \ - $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/aout.sc ${GEN_DEPENDS} - ${GENSCRIPTS} hp3hpux "$(tdir_hp3hpux)" -ehppaelf.c: $(srcdir)/emulparams/hppaelf.sh \ - $(srcdir)/emultempl/hppaelf.em $(srcdir)/scripttempl/hppaelf.sc ${GEN_DEPENDS} - ${GENSCRIPTS} hppaelf "$(tdir_hppaelf)" -ei386aout.c: $(srcdir)/emulparams/i386aout.sh \ - $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/aout.sc ${GEN_DEPENDS} - ${GENSCRIPTS} i386aout "$(tdir_i386aout)" -ei386bsd.c: $(srcdir)/emulparams/i386bsd.sh \ - $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/aout.sc ${GEN_DEPENDS} - ${GENSCRIPTS} i386bsd "$(tdir_i386bsd)" -ei386coff.c: $(srcdir)/emulparams/i386coff.sh \ - $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/i386coff.sc ${GEN_DEPENDS} - ${GENSCRIPTS} i386coff "$(tdir_i386coff)" -ei386go32.c: $(srcdir)/emulparams/i386go32.sh \ - $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/i386go32.sc ${GEN_DEPENDS} - ${GENSCRIPTS} i386go32 "$(tdir_i386go32)" -ei386linux.c: $(srcdir)/emulparams/i386linux.sh \ - $(srcdir)/emultempl/linux.em $(srcdir)/scripttempl/aout.sc ${GEN_DEPENDS} - ${GENSCRIPTS} i386linux "$(tdir_i386linux)" -ei386lynx.c: $(srcdir)/emulparams/i386lynx.sh \ - $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/i386lynx.sc ${GEN_DEPENDS} - ${GENSCRIPTS} i386lynx "$(tdir_i386lynx)" -ei386mach.c: $(srcdir)/emulparams/i386mach.sh \ - $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/aout.sc ${GEN_DEPENDS} - ${GENSCRIPTS} i386mach "$(tdir_i386mach)" -ei386moss.c: $(srcdir)/emulparams/i386moss.sh \ - $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS} - ${GENSCRIPTS} i386moss "$(tdir_i386moss)" -ei386msdos.c: $(srcdir)/emulparams/i386msdos.sh \ - $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/i386msdos.sc ${GEN_DEPENDS} - ${GENSCRIPTS} i386msdos "$(tdir_i386msdos)" -ei386nbsd.c: $(srcdir)/emulparams/i386nbsd.sh \ - $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/aout.sc ${GEN_DEPENDS} - ${GENSCRIPTS} i386nbsd "$(tdir_i386nbsd)" -ei386nw.c: $(srcdir)/emulparams/i386nw.sh \ - $(srcdir)/emultempl/elf32.em $(srcdir)/scripttempl/nw.sc ${GEN_DEPENDS} - ${GENSCRIPTS} i386nw "$(tdir_i386nw)" -ei386pe.c: $(srcdir)/emulparams/i386pe.sh \ - $(srcdir)/emultempl/pe.em $(srcdir)/scripttempl/pe.sc ${GEN_DEPENDS} - ${GENSCRIPTS} i386pe "$(tdir_i386pe)" -elnk960.c: $(srcdir)/emulparams/lnk960.sh \ - $(srcdir)/emultempl/lnk960.em $(srcdir)/scripttempl/i960.sc ${GEN_DEPENDS} - ${GENSCRIPTS} lnk960 "$(tdir_lnk960)" -em68k4knbsd.c: $(srcdir)/emulparams/m68k4knbsd.sh \ - $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/aout.sc ${GEN_DEPENDS} - ${GENSCRIPTS} m68k4knbsd "$(tdir_m68k4knbsd)" -em68kaout.c: $(srcdir)/emulparams/m68kaout.sh \ - $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/aout.sc ${GEN_DEPENDS} - ${GENSCRIPTS} m68kaout "$(tdir_m68kaout)" -em68kaux.c: $(srcdir)/emulparams/m68kaux.sh \ - $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/m68kaux.sc ${GEN_DEPENDS} - ${GENSCRIPTS} m68kaux "$(tdir_m68kaux)" -em68kcoff.c: $(srcdir)/emulparams/m68kcoff.sh \ - $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/m68kcoff.sc ${GEN_DEPENDS} - ${GENSCRIPTS} m68kcoff "$(tdir_m68kcoff)" -em68kelf.c: $(srcdir)/emulparams/m68kelf.sh \ - $(srcdir)/emultempl/elf32.em $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS} - ${GENSCRIPTS} m68kelf "$(tdir_m68kelf)" -em68klinux.c: $(srcdir)/emulparams/m68klinux.sh \ - $(srcdir)/emultempl/linux.em $(srcdir)/scripttempl/aout.sc ${GEN_DEPENDS} - ${GENSCRIPTS} m68klinux "$(tdir_m68klinux)" -em68klynx.c: $(srcdir)/emulparams/m68klynx.sh \ - $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/m68klynx.sc ${GEN_DEPENDS} - ${GENSCRIPTS} m68klynx "$(tdir_m68klynx)" -em68knbsd.c: $(srcdir)/emulparams/m68knbsd.sh \ - $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/aout.sc ${GEN_DEPENDS} - ${GENSCRIPTS} m68knbsd "$(tdir_m68knbsd)" -em68kpsos.c: $(srcdir)/emulparams/m68kpsos.sh \ - $(srcdir)/emultempl/elf32.em $(srcdir)/scripttempl/psos.sc ${GEN_DEPENDS} - ${GENSCRIPTS} m68kpsos "$(tdir_m68kpsos)" -em88kbcs.c: $(srcdir)/emulparams/m88kbcs.sh \ - $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/m88kbcs.sc ${GEN_DEPENDS} - ${GENSCRIPTS} m88kbcs "$(tdir_m88kbcs)" -emipsbig.c: $(srcdir)/emulparams/mipsbig.sh \ - $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/mips.sc ${GEN_DEPENDS} - ${GENSCRIPTS} mipsbig -emipsbsd.c: $(srcdir)/emulparams/mipsbsd.sh \ - $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/mipsbsd.sc ${GEN_DEPENDS} - ${GENSCRIPTS} mipsbsd -emipsidt.c: $(srcdir)/emulparams/mipsidt.sh \ - $(srcdir)/emultempl/mipsecoff.em $(srcdir)/scripttempl/mips.sc ${GEN_DEPENDS} - ${GENSCRIPTS} mipsidt "$(tdir_mipsidt)" -emipsidtl.c: $(srcdir)/emulparams/mipsidtl.sh \ - $(srcdir)/emultempl/mipsecoff.em $(srcdir)/scripttempl/mips.sc ${GEN_DEPENDS} - ${GENSCRIPTS} mipsidtl "$(tdir_mipsidtl)" -emipslit.c: $(srcdir)/emulparams/mipslit.sh \ - $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/mips.sc ${GEN_DEPENDS} - ${GENSCRIPTS} mipslit "$(tdir_mipslit)" -emipslnews.c: $(srcdir)/emulparams/mipslnews.sh \ - $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/mips.sc ${GEN_DEPENDS} - ${GENSCRIPTS} mipslnews -emn10300.c: $(srcdir)/emulparams/mn10300.sh \ - $(srcdir)/emultempl/elf32.em $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS} - ${GENSCRIPTS} mn10300 "$(tdir_mn10300)" -emn10200.c: $(srcdir)/emulparams/mn10200.sh \ - $(srcdir)/emultempl/elf32.em $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS} - ${GENSCRIPTS} mn10200 "$(tdir_mn10200)" -enews.c: $(srcdir)/emulparams/news.sh \ - $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/aout.sc ${GEN_DEPENDS} - ${GENSCRIPTS} news "$(tdir_news)" -ens32knbsd.c: $(srcdir)/emulparams/ns32knbsd.sh \ - $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/aout.sc ${GEN_DEPENDS} - ${GENSCRIPTS} ns32knbsd "$(tdir_ns32knbsd)" -epc532macha.c: $(srcdir)/emulparams/pc532macha.sh \ - $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/aout.sc ${GEN_DEPENDS} - ${GENSCRIPTS} pc532macha "$(tdir_pc532macha)" -eppcmacos.c: $(srcdir)/emulparams/ppcmacos.sh \ - $(srcdir)/emultempl/aix.em $(srcdir)/scripttempl/aix.sc ${GEN_DEPENDS} - ${GENSCRIPTS} ppcmacos "$(tdir_ppcmacos)" -eppcnw.c: $(srcdir)/emulparams/ppcnw.sh \ - $(srcdir)/emultempl/elf32.em $(srcdir)/scripttempl/nw.sc ${GEN_DEPENDS} - ${GENSCRIPTS} ppcnw "$(tdir_ppcnw)" -eppcpe.c: $(srcdir)/emulparams/ppcpe.sh \ - $(srcdir)/emultempl/pe.em $(srcdir)/scripttempl/ppcpe.sc ${GEN_DEPENDS} - ${GENSCRIPTS} ppcpe "$(tdir_ppcpe)" -eriscix.c: $(srcdir)/emulparams/riscix.sh \ - $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/aout.sc ${GEN_DEPENDS} - ${GENSCRIPTS} riscix "$(tdir_riscix)" -esa29200.c: $(srcdir)/emulparams/sa29200.sh \ - $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/sa29200.sc ${GEN_DEPENDS} - ${GENSCRIPTS} sa29200 "$(tdir_sa29200)" -esh.c: $(srcdir)/emulparams/sh.sh \ - $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/sh.sc ${GEN_DEPENDS} - ${GENSCRIPTS} sh "$(tdir_sh)" -eshelf.c: $(srcdir)/emulparams/shelf.sh \ - $(srcdir)/emultempl/elf32.em $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS} - ${GENSCRIPTS} shelf "$(tdir_shelf)" -eshlelf.c: $(srcdir)/emulparams/shlelf.sh \ - $(srcdir)/emultempl/elf32.em $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS} - ${GENSCRIPTS} shlelf "$(tdir_shlelf)" -eshl.c: $(srcdir)/emulparams/shl.sh \ - $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/sh.sc ${GEN_DEPENDS} - ${GENSCRIPTS} shl "$(tdir_shl)" -eshunx.c: $(srcdir)/emulparams/shunx.sh \ - $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/sh.sc ${GEN_DEPENDS} - ${GENSCRIPTS} shunx "$(tdir_shunx)" -eshlunx.c: $(srcdir)/emulparams/shlunx.sh \ - $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/shunx.sc ${GEN_DEPENDS} - ${GENSCRIPTS} shlunx "$(tdir_shlunx)" -eelf32shunx.c: $(srcdir)/emulparams/elf32shunx.sh \ - $(srcdir)/emultempl/elf32.em $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS} - ${GENSCRIPTS} elf32shunx "$(tdir_elf32shunx)" -eelf32shlunx.c: $(srcdir)/emulparams/elf32shlunx.sh \ - $(srcdir)/emultempl/elf32.em $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS} - ${GENSCRIPTS} elf32shlunx "$(tdir_elf32shlunx)" -esparcaout.c: $(srcdir)/emulparams/sparcaout.sh \ - $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/aout.sc ${GEN_DEPENDS} - ${GENSCRIPTS} sparcaout "$(tdir_sparcaout)" -esparclinux.c: $(srcdir)/emulparams/sparclinux.sh \ - $(srcdir)/emultempl/linux.em $(srcdir)/scripttempl/aout.sc ${GEN_DEPENDS} - ${GENSCRIPTS} sparclinux "$(tdir_sparclinux)" -esparclynx.c: $(srcdir)/emulparams/sparclynx.sh \ - $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/sparclynx.sc ${GEN_DEPENDS} - ${GENSCRIPTS} sparclynx "$(tdir_sparclynx)" -esparcnbsd.c: $(srcdir)/emulparams/sparcnbsd.sh \ - $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/aout.sc ${GEN_DEPENDS} - ${GENSCRIPTS} sparcnbsd "$(tdir_sparcnbsd)" -est2000.c: $(srcdir)/emulparams/st2000.sh \ - $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/st2000.sc ${GEN_DEPENDS} - ${GENSCRIPTS} st2000 "$(tdir_st2000)" -esun3.c: $(srcdir)/emulparams/sun3.sh \ - $(srcdir)/emultempl/sunos.em $(srcdir)/scripttempl/aout.sc ${GEN_DEPENDS} - ${GENSCRIPTS} sun3 "$(tdir_sun3)" -esun4.c: $(srcdir)/emulparams/sun4.sh \ - $(srcdir)/emultempl/sunos.em $(srcdir)/scripttempl/aout.sc ${GEN_DEPENDS} - ${GENSCRIPTS} sun4 "$(tdir_sun4)" -etic30aout.c: $(srcdir)/emulparams/tic30aout.sh \ - $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/tic30aout.sc ${GEN_DEPENDS} - ${GENSCRIPTS} tic30aout "$(tdir_tic30aout)" -etic30coff.c: $(srcdir)/emulparams/tic30coff.sh \ - $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/tic30coff.sc ${GEN_DEPENDS} - ${GENSCRIPTS} tic30coff "$(tdir_tic30coff)" -evanilla.c: $(srcdir)/emulparams/vanilla.sh \ - $(srcdir)/emultempl/vanilla.em $(srcdir)/scripttempl/vanilla.sc ${GEN_DEPENDS} - ${GENSCRIPTS} vanilla "$(tdir_vanilla)" -evax.c: $(srcdir)/emulparams/vax.sh \ - $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/aout.sc ${GEN_DEPENDS} - ${GENSCRIPTS} vax "$(tdir_vax)" -evsta.c: $(srcdir)/emulparams/vsta.sh \ - $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/aout.sc ${GEN_DEPENDS} - ${GENSCRIPTS} vsta "$(tdir_vsta)" -ev850.c: $(srcdir)/emulparams/v850.sh \ - $(srcdir)/emultempl/elf32.em $(srcdir)/scripttempl/v850.sc ${GEN_DEPENDS} - ${GENSCRIPTS} v850 "$(tdir_v850)" -ew65.c: $(srcdir)/emulparams/w65.sh \ - $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/w65.sc ${GEN_DEPENDS} - ${GENSCRIPTS} w65 "$(tdir_w65)" -ez8001.c: $(srcdir)/emulparams/z8001.sh \ - $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/z8000.sc ${GEN_DEPENDS} - ${GENSCRIPTS} z8001 "$(tdir_z8001)" -ez8002.c: $(srcdir)/emulparams/z8002.sh \ - $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/z8000.sc ${GEN_DEPENDS} - ${GENSCRIPTS} z8002 "$(tdir_z8002)" - -ld_new_SOURCES = ldgram.y ldlex.l lexsup.c ldlang.c mri.c ldctor.c ldmain.c \ - ldwrite.c ldexp.c ldemul.c ldver.c ldmisc.c ldfile.c ldcref.c -ld_new_DEPENDENCIES = $(EMULATION_OFILES) $(BFDLIB) $(LIBIBERTY) -ld_new_LDADD = $(EMULATION_OFILES) $(BFDLIB) $(LIBIBERTY) - -# The generated emulation files mostly have the same dependencies. -$(EMULATION_OFILES): ../bfd/bfd.h sysdep.h config.h $(INCDIR)/bfdlink.h \ - ld.h ldmain.h ldemul.h ldfile.h ldmisc.h ldexp.h ldlang.h \ - ldctor.h ldexp.h ldlang.h ldgram.h - -# This is the real libbfd.a created by libtool. -TESTBFDLIB = @TESTBFDLIB@ - -check-DEJAGNU: site.exp - srcroot=`cd $(srcdir) && pwd`; export srcroot; \ - r=`pwd`; export r; \ - EXPECT=$(EXPECT); export EXPECT; \ - if [ -f $(top_builddir)/../expect/expect ]; then \ - TCL_LIBRARY=`cd $(top_srcdir)/../tcl/library && pwd`; \ - export TCL_LIBRARY; \ - fi; \ - runtest=$(RUNTEST); \ - if $(SHELL) -c "$$runtest --version" > /dev/null 2>&1; then \ - $$runtest --tool $(DEJATOOL) --srcdir $${srcroot}/testsuite \ - CC="$(CC_FOR_TARGET)" CFLAGS="$(CFLAGS)" \ - CXX="$(CXX_FOR_TARGET)" CXXFLAGS="$(CXXFLAGS)" \ - CC_FOR_HOST="$(CC)" CFLAGS_FOR_HOST="$(CFLAGS)" \ - OFILES="$(OFILES)" BFDLIB="$(TESTBFDLIB)" \ - LIBIBERTY="$(LIBIBERTY)" HOSTING_EMU="$(HOSTING_EMU)" \ - HOSTING_CRT0="$(HOSTING_CRT0)" HOSTING_LIBS="$(HOSTING_LIBS)" \ - $(RUNTESTFLAGS); \ - else echo "WARNING: could not find \`runtest'" 1>&2; :;\ - fi - -# Rules for testing by relinking ld itself. -# A similar test is in the testsuite. This target is for ease of use -# when porting ld. - -ld-partial.o: ld-new$(EXEEXT) - ./ld-new$(EXEEXT) $(HOSTING_EMU) -o ld-partial.o -r $(OFILES) -ld1$(EXEEXT): ld-partial.o - ./ld-new$(EXEEXT) $(HOSTING_EMU) -o ld1$(EXEEXT) $(HOSTING_CRT0) ld-partial.o $(TESTBFDLIB) $(LIBIBERTY) $(HOSTING_LIBS) - -ld1-full$(EXEEXT): ld-new - ./ld-new$(EXEEXT) $(HOSTING_EMU) -o ld1-full$(EXEEXT) $(HOSTING_CRT0) $(OFILES) $(TESTBFDLIB) $(LIBIBERTY) $(HOSTING_LIBS) - -ld2$(EXEEXT): ld1$(EXEEXT) - ./ld1$(EXEEXT) $(HOSTING_EMU) -o ld2$(EXEEXT) $(HOSTING_CRT0) $(OFILES) $(TESTBFDLIB) $(LIBIBERTY) $(HOSTING_LIBS) - -ld3$(EXEEXT): ld2$(EXEEXT) - ./ld2$(EXEEXT) $(HOSTING_EMU) -o ld3$(EXEEXT) $(HOSTING_CRT0) $(OFILES) $(TESTBFDLIB) $(LIBIBERTY) $(HOSTING_LIBS) - -bootstrap: ld3$(EXEEXT) - cmp ld2$(EXEEXT) ld3$(EXEEXT) - -.PHONY: bootstrap - -# A test program for C++ constructors and destructors. -# This test is now in the testsuite. -# -#cdtest: cdtest-main.o cdtest-bar.o cdtest-foo.o ld.new -# ./ld.new $(HOSTING_EMU) -o cdtest $(HOSTING_CRT0) \ -# cdtest-main.o cdtest-bar.o cdtest-foo.o $(HOSTING_LIBS) -# -#cdtest.out: cdtest -# ./cdtest > cdtest.tmp -# mv cdtest.tmp cdtest.out -# -#cdtest-ur.o: cdtest-main.o cdtest-bar.o cdtest-foo.o ld.new -# ./ld.new $(HOSTING_EMU) -o cdtest-ur.o -Ur cdtest-main.o \ -# cdtest-bar.o cdtest-foo.o -# -#cdtest-ur: cdtest-ur.o -# ./ld.new $(HOSTING_EMU) -o cdtest-ur $(HOSTING_CRT0) cdtest-ur.o \ -# $(HOSTING_LIBS) -# -#cdtest-ur.out: cdtest-ur -# ./cdtest-ur > cdtest-ur.tmp -# mv cdtest-ur.tmp cdtest-ur.out -# -#check-cdtest: cdtest.out cdtest-ur.out $(srcdir)/cdtest.exp -# diff $(srcdir)/cdtest.exp cdtest.out -# diff $(srcdir)/cdtest.exp cdtest-ur.out -# -#.PHONY: check-cdtest - -# END OF CHECK TARGETS - -# DOCUMENTATION TARGETS -# Manual configuration file; not usually attached to normal configuration, -# because almost all configs use "gen" version of manual. -# Set DOCVER above to change. -configdoc.texi: ${DOCVER}-doc.texi - ln -s ${srcdir}/${DOCVER}-doc.texi ./configdoc.texi >/dev/null 2>&1 \ - || ln ${srcdir}/${DOCVER}-doc.texi ./configdoc.texi >/dev/null 2>&1 \ - || cp ${srcdir}/${DOCVER}-doc.texi ./configdoc.texi - -ld.info: $(srcdir)/ld.texinfo configdoc.texi - @rm -f $@ $@-[0-9] $@-[0-9][0-9] - $(MAKEINFO) -I $(srcdir) -I $(BFDDIR)/doc $(srcdir)/ld.texinfo - -ld.dvi: $(srcdir)/ld.texinfo configdoc.texi - TEXINPUTS=$(top_srcdir)/../texinfo:$$TEXINPUTS \ - MAKEINFO='$(MAKEINFO) -I $(srcdir) -I $(BFDDIR)/doc' $(TEXI2DVI) $(srcdir)/ld.texinfo - -# We want to reconfigure if configure.host or configure.tgt changes. -Makefile: configure.host configure.tgt - -MOSTLYCLEANFILES = $(STAGESTUFF) ld1$(EXEEXT) ld2$(EXEEXT) ld3$(EXEEXT) \ - ldemul-list.h crtbegin.o crtend.o ld.log ld.sum -mostlyclean-local: - -rm -rf tmpdir -CLEANFILES = dep.sed .dep .dep1 - -.PHONY: install-exec-local install-data-local - -install-exec-local: ld-new$(EXEEXT) - $(mkinstalldirs) $(bindir) $(tooldir)/bin - @list='$(noinst_PROGRAMS)'; for p in $$list; do \ - if test -f $$p; then \ - echo " $(LIBTOOL) --mode=install $(INSTALL_PROGRAM) $$p $(bindir)/`echo $$p|sed -e 's/-new//'|sed '$(transform)'`"; \ - $(LIBTOOL) --mode=install $(INSTALL_PROGRAM) $$p $(bindir)/`echo $$p|sed -e 's/-new//'|sed '$(transform)'`; \ - else :; fi; \ - done - rm -f $(tooldir)/bin/ld$(EXEEXT) - n=`echo ld | sed '$(transform)'`; \ - if [ "$(bindir)/$$n$(EXEEXT)" != "$(tooldir)/bin/ld$(EXEEXT)" ]; then \ - ln $(bindir)/$$n$(EXEEXT) $(tooldir)/bin/ld$(EXEEXT) >/dev/null 2>/dev/null \ - || $(LIBTOOL) --mode=install $(INSTALL_PROGRAM) ld-new$(EXEEXT) $(tooldir)/bin/ld$(EXEEXT); \ - fi - -install-data-local: - $(mkinstalldirs) $(scriptdir) - for f in ldscripts/*; do \ - $(INSTALL_DATA) $$f $(scriptdir)/$$f ; \ - done - -# Stuff that should be included in a distribution. The diststuff -# target is run by the taz target in ../Makefile.in. -LDDISTSTUFF = ldgram.c ldgram.h ldlex.c -diststuff: $(LDDISTSTUFF) info - -DISTCLEANFILES = site.exp site.bak - -distclean-local: - rm -rf ldscripts - -# Targets to rebuild dependencies in this Makefile. -# Have to get rid of .dep1 here so that "$?" later includes all of $(CFILES). -.dep: dep.sed $(CFILES) $(HFILES) $(GENERATED_CFILES) $(GENERATED_HFILES) config.h - rm -f .dep1 - $(MAKE) DEP=$(DEP) .dep1 - sed -f dep.sed <.dep1 >.dep - -# This rule really wants a mkdep that runs "gcc -MM". -.dep1: $(CFILES) $(GENERATED_CFILES) - rm -f .dep2 - echo '# DO NOT DELETE THIS LINE -- mkdep uses it.' > .dep2 - $(DEP) -f .dep2 $(INCLUDES) $? - $(srcdir)/../move-if-change .dep2 .dep1 - -dep.sed: dep-in.sed config.status - sed <$(srcdir)/dep-in.sed >dep.sed \ - -e 's!@INCDIR@!$(INCDIR)!' \ - -e 's!@SRCDIR@!$(srcdir)!' - -dep: .dep - sed -e '/^..DO NOT DELETE THIS LINE/,$$d' < Makefile > tmp-Makefile - cat .dep >> tmp-Makefile - $(srcdir)/../move-if-change tmp-Makefile Makefile - -dep-in: .dep - sed -e '/^..DO NOT DELETE THIS LINE/,$$d' < $(srcdir)/Makefile.in > tmp-Makefile.in - cat .dep >> tmp-Makefile.in - $(srcdir)/../move-if-change tmp-Makefile.in $(srcdir)/Makefile.in - -dep-am: .dep - sed -e '/^..DO NOT DELETE THIS LINE/,$$d' < $(srcdir)/Makefile.am > tmp-Makefile.am - cat .dep >> tmp-Makefile.am - $(srcdir)/../move-if-change tmp-Makefile.am $(srcdir)/Makefile.am - -.PHONY: dep dep-in dep-am - -# What appears below is generated by a hacked mkdep using gcc -MM. - -# DO NOT DELETE THIS LINE -- mkdep uses it. -# DO NOT PUT ANYTHING AFTER THIS LINE, IT WILL GO AWAY. - -ldctor.o: ldctor.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \ - sysdep.h config.h $(INCDIR)/fopen-same.h $(INCDIR)/bfdlink.h \ - ld.h ldexp.h ldlang.h ldmisc.h ldgram.h ldmain.h ldctor.h -ldemul.o: ldemul.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \ - sysdep.h config.h $(INCDIR)/fopen-same.h ld.h ldemul.h \ - ldmisc.h ldexp.h ldlang.h ldfile.h ldmain.h ldemul-list.h -ldexp.o: ldexp.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \ - sysdep.h config.h $(INCDIR)/fopen-same.h $(INCDIR)/bfdlink.h \ - ld.h ldmain.h ldmisc.h ldexp.h ldgram.h ldlang.h -ldfile.o: ldfile.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \ - sysdep.h config.h $(INCDIR)/fopen-same.h $(INCDIR)/bfdlink.h \ - ld.h ldmisc.h ldexp.h ldlang.h ldfile.h ldmain.h ldgram.h \ - ldlex.h ldemul.h -ldlang.o: ldlang.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \ - sysdep.h config.h $(INCDIR)/fopen-same.h $(INCDIR)/libiberty.h \ - $(INCDIR)/obstack.h $(INCDIR)/bfdlink.h ld.h ldmain.h \ - ldgram.h ldexp.h ldlang.h ldemul.h ldlex.h ldmisc.h \ - ldctor.h ldfile.h $(INCDIR)/fnmatch.h -ldmain.o: ldmain.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \ - sysdep.h config.h $(INCDIR)/fopen-same.h $(INCDIR)/libiberty.h \ - $(INCDIR)/progress.h $(INCDIR)/bfdlink.h ld.h ldmain.h \ - ldmisc.h ldwrite.h ldgram.h ldexp.h ldlang.h ldemul.h \ - ldlex.h ldfile.h ldctor.h -ldmisc.o: ldmisc.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \ - sysdep.h config.h $(INCDIR)/fopen-same.h $(INCDIR)/libiberty.h \ - $(INCDIR)/demangle.h ld.h ldmisc.h ldexp.h ldlang.h \ - ldgram.h ldlex.h ldmain.h ldfile.h -ldver.o: ldver.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \ - sysdep.h config.h $(INCDIR)/fopen-same.h ld.h ldver.h \ - ldemul.h ldmain.h -ldwrite.o: ldwrite.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \ - sysdep.h config.h $(INCDIR)/fopen-same.h $(INCDIR)/bfdlink.h \ - $(INCDIR)/libiberty.h ld.h ldexp.h ldlang.h ldwrite.h \ - ldmisc.h ldgram.h ldmain.h -lexsup.o: lexsup.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \ - sysdep.h config.h $(INCDIR)/fopen-same.h $(INCDIR)/libiberty.h \ - $(INCDIR)/getopt.h $(INCDIR)/bfdlink.h ld.h ldmain.h \ - ldmisc.h ldexp.h ldlang.h ldgram.h ldlex.h ldfile.h \ - ldver.h ldemul.h -mri.o: mri.c ../bfd/bfd.h $(INCDIR)/ansidecl.h sysdep.h \ - config.h $(INCDIR)/fopen-same.h ld.h ldexp.h ldlang.h \ - ldmisc.h mri.h ldgram.h $(INCDIR)/libiberty.h -ldcref.o: ldcref.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \ - sysdep.h config.h $(INCDIR)/fopen-same.h $(INCDIR)/bfdlink.h \ - $(INCDIR)/libiberty.h ld.h ldmain.h ldmisc.h ldexp.h \ - ldlang.h -ldgram.o: ldgram.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \ - sysdep.h config.h $(INCDIR)/fopen-same.h $(INCDIR)/bfdlink.h \ - ld.h ldexp.h ldver.h ldlang.h ldemul.h ldfile.h ldmisc.h \ - ldmain.h mri.h ldlex.h -ldlex.o: ldlex.c ../bfd/bfd.h sysdep.h config.h $(INCDIR)/fopen-same.h \ - ld.h ldgram.h ldmisc.h ldexp.h ldlang.h ldfile.h ldlex.h \ - ldmain.h - -# IF YOU PUT ANYTHING HERE IT WILL GO AWAY diff --git a/gnu/dist/ld/Makefile.in b/gnu/dist/ld/Makefile.in deleted file mode 100644 index 68e0ad4df171..000000000000 --- a/gnu/dist/ld/Makefile.in +++ /dev/null @@ -1,1290 +0,0 @@ -# Makefile.in generated automatically by automake 1.2e from Makefile.am - -# Copyright (C) 1994, 1995, 1996, 1997, 1998 Free Software Foundation, Inc. -# This Makefile.in is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY, to the extent permitted by law; without -# even the implied warranty of MERCHANTABILITY or FITNESS FOR A -# PARTICULAR PURPOSE. - - -SHELL = @SHELL@ - -srcdir = @srcdir@ -top_srcdir = @top_srcdir@ -VPATH = @srcdir@ -prefix = @prefix@ -exec_prefix = @exec_prefix@ - -bindir = @bindir@ -sbindir = @sbindir@ -libexecdir = @libexecdir@ -datadir = @datadir@ -sysconfdir = @sysconfdir@ -sharedstatedir = @sharedstatedir@ -localstatedir = @localstatedir@ -libdir = @libdir@ -infodir = @infodir@ -mandir = @mandir@ -includedir = @includedir@ -oldincludedir = /usr/include - -pkgdatadir = $(datadir)/@PACKAGE@ -pkglibdir = $(libdir)/@PACKAGE@ -pkgincludedir = $(includedir)/@PACKAGE@ - -top_builddir = . - -ACLOCAL = @ACLOCAL@ -AUTOCONF = @AUTOCONF@ -AUTOMAKE = @AUTOMAKE@ -AUTOHEADER = @AUTOHEADER@ - -INSTALL = @INSTALL@ -INSTALL_PROGRAM = @INSTALL_PROGRAM@ -INSTALL_DATA = @INSTALL_DATA@ -INSTALL_SCRIPT = @INSTALL_SCRIPT@ -transform = @program_transform_name@ - -NORMAL_INSTALL = : -PRE_INSTALL = : -POST_INSTALL = : -NORMAL_UNINSTALL = : -PRE_UNINSTALL = : -POST_UNINSTALL = : -build_alias = @build_alias@ -build_triplet = @build@ -host_alias = @host_alias@ -host_triplet = @host@ -target_alias = @target_alias@ -target_triplet = @target@ -CC = @CC@ -EXEEXT = @EXEEXT@ -HDEFINES = @HDEFINES@ -LD = @LD@ -LIBTOOL = @LIBTOOL@ -LN_S = @LN_S@ -MAINT = @MAINT@ -MAKEINFO = @MAKEINFO@ -NATIVE_LIB_DIRS = @NATIVE_LIB_DIRS@ -NM = @NM@ -PACKAGE = @PACKAGE@ -RANLIB = @RANLIB@ -TDIRS = @TDIRS@ -VERSION = @VERSION@ - -AUTOMAKE_OPTIONS = cygnus dejagnu - -tooldir = $(exec_prefix)/$(target_alias) - -YACC = `if [ -f ../bison/bison ] ; then echo ../bison/bison -y -L../bison/bison ; else echo bison -y ; fi` -YFLAGS = -d -LEX = `if [ -f ../flex/flex ] ; then echo ../flex/flex ; else echo flex ; fi` - -# We put the scripts in the directory $(scriptdir)/ldscripts. -# We can't put the scripts in $(datadir) because the SEARCH_DIR -# directives need to be different for native and cross linkers. -scriptdir = $(tooldir)/lib - -EMUL = @EMUL@ -EMULATION_OFILES = @EMULATION_OFILES@ - -# Search path to override the default search path for -lfoo libraries. -# If LIB_PATH is empty, the ones in the script (if any) are left alone. -# (The default is usually /lib:/usr/lib:/usr/local/lib, unless building -# a cross-linker, in which case the default is empty. See genscripts.sh.) -# Otherwise, they are replaced with the ones given in LIB_PATH, -# which may have the form: LIB_PATH=/lib:/usr/local/lib -LIB_PATH = - -BASEDIR = $(srcdir)/.. -BFDDIR = $(BASEDIR)/bfd -INCDIR = $(BASEDIR)/include -DEP = mkdep - -# What version of the manual to build -DOCVER = gen - -#stuff for self hosting (can be overridden in config file). -HOSTING_CRT0 = @HOSTING_CRT0@ -HOSTING_LIBS = @HOSTING_LIBS@ -HOSTING_EMU = -m $(EMUL) - -# Setup the testing framework, if you have one -EXPECT = `if [ -f $$r/../expect/expect ] ; \ - then echo $$r/../expect/expect ; \ - else echo expect ; fi` - -RUNTEST = `if [ -f $${srcroot}/../dejagnu/runtest ] ; \ - then echo $${srcroot}/../dejagnu/runtest ; \ - else echo runtest ; fi` - -RUNTESTFLAGS = - -CC_FOR_TARGET = ` \ - if [ -f $$r/../gcc/xgcc ] ; then \ - if [ -f $$r/../newlib/Makefile ] ; then \ - echo $$r/../gcc/xgcc -B$$r/../gcc/ -idirafter $$r/../newlib/targ-include -idirafter $${srcroot}/../newlib/libc/include -nostdinc; \ - else \ - echo $$r/../gcc/xgcc -B$$r/../gcc/; \ - fi; \ - else \ - if [ "@host@" = "@target@" ] ; then \ - echo $(CC); \ - else \ - echo gcc | sed '$(transform)'; \ - fi; \ - fi` - -CXX = gcc -CXX_FOR_TARGET = ` \ - if [ -f $$r/../gcc/xgcc ] ; then \ - if [ -f $$r/../newlib/Makefile ] ; then \ - echo $$r/../gcc/xgcc -B$$r/../gcc/ -idirafter $$r/../newlib/targ-include -idirafter $${srcroot}/../newlib/libc/include -nostdinc; \ - else \ - echo $$r/../gcc/xgcc -B$$r/../gcc/; \ - fi; \ - else \ - if [ "@host@" = "@target@" ] ; then \ - echo $(CXX); \ - else \ - echo gcc | sed '$(transform)'; \ - fi; \ - fi` - -noinst_PROGRAMS = ld-new -info_TEXINFOS = ld.texinfo -noinst_TEXINFOS = ldint.texinfo -man_MANS = ld.1 - -INCLUDES = -D_GNU_SOURCE -I. -I$(srcdir) -I../bfd -I$(BFDDIR) -I$(INCDIR) $(HDEFINES) $(CFLAGS) - -BFDLIB = ../bfd/libbfd.la -LIBIBERTY = ../libiberty/libiberty.a - -ALL_EMULATIONS = \ - ea29k.o \ - eaixppc.o \ - eaixrs6.o \ - ealpha.o \ - earcelf.o \ - earmaoutb.o \ - earmaoutl.o \ - earmcoff.o \ - earmnbsd.o \ - earmpe.o \ - ecoff_sparc.o \ - ed10velf.o \ - edelta68.o \ - eebmon29k.o \ - eelf32_sparc.o \ - eelf32b4300.o \ - eelf32bmip.o \ - eelf32ebmip.o \ - eelf32elmip.o \ - eelf32l4300.o \ - eelf32lmip.o \ - eelf32lppc.o \ - eelf32ppc.o \ - eelf_i386.o \ - egld960.o \ - egld960coff.o \ - ego32.o \ - eh8300.o \ - eh8300h.o \ - eh8300s.o \ - eh8500.o \ - eh8500b.o \ - eh8500c.o \ - eh8500m.o \ - eh8500s.o \ - ehp300bsd.o \ - ehp3hpux.o \ - ehppaelf.o \ - ei386aout.o \ - ei386bsd.o \ - ei386coff.o \ - ei386go32.o \ - ei386linux.o \ - ei386lynx.o \ - ei386mach.o \ - ei386moss.o \ - ei386msdos.o \ - ei386nbsd.o \ - ei386nw.o \ - ei386pe.o \ - elnk960.o \ - em68k4knbsd.o \ - em68kaout.o \ - em68kaux.o \ - em68kcoff.o \ - em68kelf.o \ - em68klinux.o \ - em68klynx.o \ - em68knbsd.o \ - em68kpsos.o \ - em88kbcs.o \ - emipsbig.o \ - emipsbsd.o \ - emipsidt.o \ - emipsidtl.o \ - emipslit.o \ - emipslnews.o \ - enews.o \ - ens32knbsd.o \ - epc532macha.o \ - eppcmacos.o \ - eppcnw.o \ - eppcpe.o \ - eriscix.o \ - esa29200.o \ - esh.o \ - eshelf.o \ - eshlelf.o \ - eshl.o \ - esparcaout.o \ - esparclinux.o \ - esparclynx.o \ - esparcnbsd.o \ - est2000.o \ - esun3.o \ - esun4.o \ - etic30aout.o \ - etic30coff.o \ - evanilla.o \ - evax.o \ - evsta.o \ - ew65.o \ - ez8001.o \ - ez8002.o - -ALL_64_EMULATIONS = \ - eelf64_sparc.o \ - eelf64alpha.o - -CFILES = ldctor.c ldemul.c ldexp.c ldfile.c ldlang.c \ - ldmain.c ldmisc.c ldver.c ldwrite.c lexsup.c \ - mri.c ldcref.c - -HFILES = config.h ld.h ldctor.h ldemul.h ldexp.h ldfile.h \ - ldlang.h ldlex.h ldmain.h ldmisc.h ldver.h \ - ldwrite.h mri.h - -GENERATED_CFILES = ldgram.c ldlex.c -GENERATED_HFILES = ldgram.h ldemul-list.h - -OFILES = ldgram.o ldlex.o lexsup.o ldlang.o mri.o ldctor.o ldmain.o \ - ldwrite.o ldexp.o ldemul.o ldver.o ldmisc.o \ - ldfile.o ldcref.o ${EMULATION_OFILES} - -STAGESTUFF = *.o ldscripts/* e*.c - -# These all start with e so 'make clean' can find them. - -GENSCRIPTS = $(SHELL) $(srcdir)/genscripts.sh ${srcdir} ${libdir} @host@ @target@ @target_alias@ ${EMUL} "@NATIVE_LIB_DIRS@" -GEN_DEPENDS = $(srcdir)/genscripts.sh $(srcdir)/emultempl/stringify.sed - -ld_new_SOURCES = ldgram.y ldlex.l lexsup.c ldlang.c mri.c ldctor.c ldmain.c \ - ldwrite.c ldexp.c ldemul.c ldver.c ldmisc.c ldfile.c ldcref.c -ld_new_DEPENDENCIES = $(EMULATION_OFILES) $(BFDLIB) $(LIBIBERTY) -ld_new_LDADD = $(EMULATION_OFILES) $(BFDLIB) $(LIBIBERTY) - -# This is the real libbfd.a created by libtool. -TESTBFDLIB = @TESTBFDLIB@ - -MOSTLYCLEANFILES = $(STAGESTUFF) ld1$(EXEEXT) ld2$(EXEEXT) ld3$(EXEEXT) \ - ldemul-list.h crtbegin.o crtend.o ld.log ld.sum -CLEANFILES = dep.sed .dep .dep1 - -# Stuff that should be included in a distribution. The diststuff -# target is run by the taz target in ../Makefile.in. -LDDISTSTUFF = ldgram.c ldgram.h ldlex.c - -DISTCLEANFILES = site.exp site.bak -ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -mkinstalldirs = $(SHELL) $(top_srcdir)/../mkinstalldirs -CONFIG_HEADER = config.h -CONFIG_CLEAN_FILES = -noinst_PROGRAMS = ld-new$(EXEEXT) -PROGRAMS = $(noinst_PROGRAMS) - - -DEFS = @DEFS@ -I. -I$(srcdir) -I. -CPPFLAGS = @CPPFLAGS@ -LDFLAGS = @LDFLAGS@ -LIBS = @LIBS@ -ld_new_OBJECTS = ldgram.o ldlex.o lexsup.o ldlang.o mri.o ldctor.o \ -ldmain.o ldwrite.o ldexp.o ldemul.o ldver.o ldmisc.o ldfile.o ldcref.o -ld_new_LDFLAGS = -LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@ -LEXLIB = @LEXLIB@ -CFLAGS = @CFLAGS@ -COMPILE = $(CC) $(DEFS) $(INCLUDES) $(CPPFLAGS) $(CFLAGS) -LTCOMPILE = $(LIBTOOL) --mode=compile $(CC) $(DEFS) $(INCLUDES) $(CPPFLAGS) $(CFLAGS) -LINK = $(LIBTOOL) --mode=link $(CC) $(CFLAGS) $(LDFLAGS) -o $@ -TEXI2DVI = `if test -f $(top_srcdir)/../texinfo/util/texi2dvi; then echo $(top_srcdir)/../texinfo/util/texi2dvi; else echo texi2dvi; fi` -TEXINFO_TEX = $(top_srcdir)/../texinfo/texinfo.tex -INFO_DEPS = ld.info -DVIS = ld.dvi -TEXINFOS = ld.texinfo -MANS = ld.1 - -NROFF = nroff -DIST_COMMON = README ChangeLog Makefile.am Makefile.in NEWS TODO \ -acconfig.h acinclude.m4 aclocal.m4 config.in configure configure.in \ -ldgram.c ldlex.c stamp-h.in - - -DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST) - -TAR = tar -GZIP = --best -SOURCES = $(ld_new_SOURCES) -OBJECTS = $(ld_new_OBJECTS) - -default: all - -.SUFFIXES: -.SUFFIXES: .S .c .dvi .info .l .lo .o .ps .s .texi .texinfo .y -$(srcdir)/Makefile.in: @MAINT@ Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) - cd $(top_srcdir) && $(AUTOMAKE) --cygnus Makefile - -Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status - cd $(top_builddir) \ - && CONFIG_FILES=$@ CONFIG_HEADERS= $(SHELL) ./config.status - -$(ACLOCAL_M4): @MAINT@ configure.in acinclude.m4 - cd $(srcdir) && $(ACLOCAL) - -config.status: $(srcdir)/configure - $(SHELL) ./config.status --recheck -$(srcdir)/configure: @MAINT@$(srcdir)/configure.in $(ACLOCAL_M4) $(CONFIGURE_DEPENDENCIES) - cd $(srcdir) && $(AUTOCONF) - -config.h: stamp-h - @: -stamp-h: $(srcdir)/config.in $(top_builddir)/config.status - cd $(top_builddir) \ - && CONFIG_FILES= CONFIG_HEADERS=config.h:config.in \ - $(SHELL) ./config.status - @echo timestamp > stamp-h -$(srcdir)/config.in: @MAINT@$(srcdir)/stamp-h.in -$(srcdir)/stamp-h.in: $(top_srcdir)/configure.in $(ACLOCAL_M4) acconfig.h - cd $(top_srcdir) && $(AUTOHEADER) - @echo timestamp > $(srcdir)/stamp-h.in - -mostlyclean-hdr: - -clean-hdr: - -distclean-hdr: - -rm -f config.h - -maintainer-clean-hdr: - -mostlyclean-noinstPROGRAMS: - -clean-noinstPROGRAMS: - -test -z "$(noinst_PROGRAMS)" || rm -f $(noinst_PROGRAMS) - -distclean-noinstPROGRAMS: - -maintainer-clean-noinstPROGRAMS: - -.c.o: - $(COMPILE) -c $< - -.s.o: - $(COMPILE) -c $< - -.S.o: - $(COMPILE) -c $< - -mostlyclean-compile: - -rm -f *.o core *.core - -clean-compile: - -distclean-compile: - -rm -f *.tab.c - -maintainer-clean-compile: - -.c.lo: - $(LIBTOOL) --mode=compile $(COMPILE) -c $< - -.s.lo: - $(LIBTOOL) --mode=compile $(COMPILE) -c $< - -.S.lo: - $(LIBTOOL) --mode=compile $(COMPILE) -c $< - -mostlyclean-libtool: - -rm -f *.lo - -clean-libtool: - -rm -rf .libs _libs - -distclean-libtool: - -maintainer-clean-libtool: - -ld-new$(EXEEXT): $(ld_new_OBJECTS) $(ld_new_DEPENDENCIES) - @rm -f ld-new$(EXEEXT) - $(LINK) $(ld_new_LDFLAGS) $(ld_new_OBJECTS) $(ld_new_LDADD) $(LIBS) -.y.c: - $(YACC) $(YFLAGS) $< && mv y.tab.c $*.c - if test -f y.tab.h; then \ - if cmp -s y.tab.h $*.h; then rm -f y.tab.h; else mv y.tab.h $*.h; fi; \ - else :; fi -ldgram.h: ldgram.c - -.l.c: - $(LEX) $(LFLAGS) $< && mv $(LEX_OUTPUT_ROOT).c $@ - -ld.info: ld.texinfo -ld.dvi: ld.texinfo - - -DVIPS = dvips - -.texi.info: - @rm -f $@ $@-[0-9] $@-[0-9][0-9] - $(MAKEINFO) -I $(srcdir) $< - -.texi.dvi: - TEXINPUTS=$(top_srcdir)/../texinfo:$$TEXINPUTS \ - MAKEINFO='$(MAKEINFO) -I $(srcdir)' $(TEXI2DVI) $< - -.texi: - @rm -f $@ $@-[0-9] $@-[0-9][0-9] - $(MAKEINFO) -I $(srcdir) $< - -.texinfo.info: - @rm -f $@ $@-[0-9] $@-[0-9][0-9] - $(MAKEINFO) -I $(srcdir) $< - -.texinfo: - @rm -f $@ $@-[0-9] $@-[0-9][0-9] - $(MAKEINFO) -I $(srcdir) $< - -.texinfo.dvi: - TEXINPUTS=$(top_srcdir)/../texinfo:$$TEXINPUTS \ - MAKEINFO='$(MAKEINFO) -I $(srcdir)' $(TEXI2DVI) $< -.dvi.ps: - $(DVIPS) $< -o $@ - -install-info-am: $(INFO_DEPS) - @$(NORMAL_INSTALL) - $(mkinstalldirs) $(infodir) - @for file in $(INFO_DEPS); do \ - if test -f $$file; then d=.; else d=$(srcdir); fi; \ - for ifile in `cd $$d && echo $$file $$file-[0-9] $$file-[0-9][0-9]`; do \ - if test -f $$d/$$ifile; then \ - echo " $(INSTALL_DATA) $$d/$$ifile $(infodir)/$$ifile"; \ - $(INSTALL_DATA) $$d/$$ifile $(infodir)/$$ifile; \ - else : ; fi; \ - done; \ - done - @$(POST_INSTALL) - @if $(SHELL) -c 'install-info --version | sed 1q | fgrep -s -v -i debian' >/dev/null 2>&1; then \ - for file in $(INFO_DEPS); do \ - echo " install-info --info-dir=$(infodir) $(infodir)/$$file";\ - install-info --info-dir=$(infodir) $(infodir)/$$file || :;\ - done; \ - else : ; fi - -uninstall-info: - $(PRE_UNINSTALL) - @if $(SHELL) -c 'install-info --version | sed 1q | fgrep -s -v -i debian' >/dev/null 2>&1; then \ - ii=yes; \ - else ii=; fi; \ - for file in $(INFO_DEPS); do \ - test -z "$ii" \ - || install-info --info-dir=$(infodir) --remove $$file; \ - done - $(NORMAL_UNINSTALL) - for file in $(INFO_DEPS); do \ - (cd $(infodir) && rm -f $$file $$file-[0-9] $$file-[0-9][0-9]); \ - done - -dist-info: $(INFO_DEPS) - for base in $(INFO_DEPS); do \ - if test -f $$base; then d=.; else d=$(srcdir); fi; \ - for file in `cd $$d && eval echo $$base*`; do \ - test -f $(distdir)/$$file \ - || ln $$d/$$file $(distdir)/$$file 2> /dev/null \ - || cp -p $$d/$$file $(distdir)/$$file; \ - done; \ - done - -mostlyclean-aminfo: - -rm -f ld.aux ld.cp ld.cps ld.dvi ld.fn ld.fns ld.ky ld.kys ld.ps \ - ld.log ld.pg ld.toc ld.tp ld.tps ld.vr ld.vrs ld.op ld.tr \ - ld.cv ld.cn - -clean-aminfo: - -distclean-aminfo: - -maintainer-clean-aminfo: - for i in $(INFO_DEPS); do \ - rm -f $$i; \ - if test "`echo $$i-[0-9]*`" != "$$i-[0-9]*"; then \ - rm -f $$i-[0-9]*; \ - fi; \ - done -clean-info: mostlyclean-aminfo -install-man: $(MANS) - $(NORMAL_INSTALL) - $(mkinstalldirs) $(mandir)/man1 - @sect=1; \ - inst=`echo "ld" | sed '$(transform)'`.1; \ - if test -f $(srcdir)/ld.1; then file=$(srcdir)/ld.1; \ - else file=ld.1; fi; \ - echo " $(INSTALL_DATA) $$file $(mandir)/man$$sect/$$inst"; \ - $(INSTALL_DATA) $$file $(mandir)/man$$sect/$$inst - -uninstall-man: - $(NORMAL_UNINSTALL) - -inst=`echo "ld" | sed '$(transform)'`.1; \ - rm -f $(mandir)/man1/$$inst - - -tags: TAGS - -ID: $(HEADERS) $(SOURCES) $(LISP) - here=`pwd` && cd $(srcdir) \ - && mkid -f$$here/ID $(SOURCES) $(HEADERS) $(LISP) - -TAGS: $(HEADERS) $(SOURCES) config.in $(TAGS_DEPENDENCIES) $(LISP) - tags=; \ - here=`pwd`; \ - list='$(SOURCES) $(HEADERS)'; \ - unique=`for i in $$list; do echo $$i; done | \ - awk ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - test -z "$(ETAGS_ARGS)config.in$$unique$(LISP)$$tags" \ - || (cd $(srcdir) && etags $(ETAGS_ARGS) $$tags config.in $$unique $(LISP) -o $$here/TAGS) - -mostlyclean-tags: - -clean-tags: - -distclean-tags: - -rm -f TAGS ID - -maintainer-clean-tags: - -distdir = $(PACKAGE)-$(VERSION) -top_distdir = $(distdir) - -# This target untars the dist file and tries a VPATH configuration. Then -# it guarantees that the distribution is self-contained by making another -# tarfile. -distcheck: dist - -rm -rf $(distdir) - GZIP=$(GZIP) $(TAR) zxf $(distdir).tar.gz - mkdir $(distdir)/=build - mkdir $(distdir)/=inst - dc_install_base=`cd $(distdir)/=inst && pwd`; \ - cd $(distdir)/=build \ - && ../configure --srcdir=.. --prefix=$$dc_install_base \ - && $(MAKE) \ - && $(MAKE) dvi \ - && $(MAKE) check \ - && $(MAKE) install \ - && $(MAKE) installcheck \ - && $(MAKE) dist - -rm -rf $(distdir) - @echo "========================"; \ - echo "$(distdir).tar.gz is ready for distribution"; \ - echo "========================" -dist: distdir - -chmod -R a+r $(distdir) - GZIP=$(GZIP) $(TAR) chozf $(distdir).tar.gz $(distdir) - -rm -rf $(distdir) -dist-all: distdir - -chmod -R a+r $(distdir) - GZIP=$(GZIP) $(TAR) chozf $(distdir).tar.gz $(distdir) - -rm -rf $(distdir) -distdir: $(DISTFILES) - -rm -rf $(distdir) - mkdir $(distdir) - -chmod 777 $(distdir) - @for file in $(DISTFILES); do \ - if test -f $$file; then d=.; else d=$(srcdir); fi; \ - test -f $(distdir)/$$file \ - || ln $$d/$$file $(distdir)/$$file 2> /dev/null \ - || cp -p $$d/$$file $(distdir)/$$file; \ - done - $(MAKE) top_distdir="$(top_distdir)" distdir="$(distdir)" dist-info - -DEJATOOL = $(PACKAGE) - -RUNTESTDEFAULTFLAGS = --tool $(DEJATOOL) --srcdir $$srcdir -site.exp: Makefile - @echo 'Making a new site.exp file...' - -@rm -f site.bak - @echo '## these variables are automatically generated by make ##' > $@-t - @echo '# Do not edit here. If you wish to override these values' >> $@-t - @echo '# edit the last section' >> $@-t - @echo 'set tool $(DEJATOOL)' >> $@-t - @echo 'set srcdir $(srcdir)' >> $@-t - @echo 'set objdir' `pwd` >> $@-t - @echo 'set host_alias $(host_alias)' >> $@-t - @echo 'set host_triplet $(host_triplet)' >> $@-t - @echo 'set target_alias $(target_alias)' >> $@-t - @echo 'set target_triplet $(target_triplet)' >> $@-t - @echo 'set build_alias $(build_alias)' >> $@-t - @echo 'set build_triplet $(build_triplet)' >> $@-t - @echo '## All variables above are generated by configure. Do Not Edit ##' >> $@-t - -@sed '1,/^## All variables above are.*##/ d' site.bak >> $@-t - -@mv site.exp site.bak - @mv $@-t site.exp -info: $(INFO_DEPS) -dvi: $(DVIS) -check: - $(MAKE) check-DEJAGNU -installcheck: -install-info: install-info-am -install-exec: install-exec-local - @$(NORMAL_INSTALL) - -install-data: install-man install-data-local - @$(NORMAL_INSTALL) - -install: install-exec install-data all - @: - -uninstall: uninstall-man - -all: Makefile $(PROGRAMS) $(MANS) config.h - -install-strip: - $(MAKE) INSTALL_PROGRAM='$(INSTALL_PROGRAM) -s' INSTALL_SCRIPT='$(INSTALL_PROGRAM)' install -installdirs: - $(mkinstalldirs) $(mandir)/man1 - - -mostlyclean-generic: - -test -z "$(MOSTLYCLEANFILES)" || rm -f $(MOSTLYCLEANFILES) - -clean-generic: - -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) - -distclean-generic: - -rm -f Makefile $(DISTCLEANFILES) - -rm -f config.cache config.log stamp-h stamp-h[0-9]* - -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) - -maintainer-clean-generic: - -test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES) - -test -z "$(BUILT_SOURCES)" || rm -f $(BUILT_SOURCES) -mostlyclean: mostlyclean-hdr mostlyclean-noinstPROGRAMS \ - mostlyclean-compile mostlyclean-libtool \ - mostlyclean-aminfo mostlyclean-tags mostlyclean-generic \ - mostlyclean-local - -clean: clean-hdr clean-noinstPROGRAMS clean-compile clean-libtool \ - clean-aminfo clean-tags clean-generic mostlyclean - -distclean: distclean-hdr distclean-noinstPROGRAMS distclean-compile \ - distclean-libtool distclean-aminfo distclean-tags \ - distclean-generic clean distclean-local - -rm -f config.status - -rm -f libtool - -maintainer-clean: maintainer-clean-hdr maintainer-clean-noinstPROGRAMS \ - maintainer-clean-compile maintainer-clean-libtool \ - maintainer-clean-aminfo maintainer-clean-tags \ - maintainer-clean-generic distclean - @echo "This command is intended for maintainers to use;" - @echo "it deletes files that may require special tools to rebuild." - -rm -f config.status - -.PHONY: default mostlyclean-hdr distclean-hdr clean-hdr \ -maintainer-clean-hdr mostlyclean-noinstPROGRAMS \ -distclean-noinstPROGRAMS clean-noinstPROGRAMS \ -maintainer-clean-noinstPROGRAMS mostlyclean-compile distclean-compile \ -clean-compile maintainer-clean-compile mostlyclean-libtool \ -distclean-libtool clean-libtool maintainer-clean-libtool \ -install-info-am uninstall-info mostlyclean-aminfo distclean-aminfo \ -clean-aminfo maintainer-clean-aminfo install-man uninstall-man tags \ -mostlyclean-tags distclean-tags clean-tags maintainer-clean-tags \ -distdir check-DEJAGNU info dvi installcheck install-info install-exec \ -install-data install uninstall all installdirs mostlyclean-generic \ -distclean-generic clean-generic maintainer-clean-generic clean \ -mostlyclean distclean maintainer-clean - - -ldmain.o: ldmain.c config.status - $(COMPILE) -c -DDEFAULT_EMULATION='"$(EMUL)"' -DSCRIPTDIR='"$(scriptdir)"' -DTARGET='"@target@"' $(srcdir)/ldmain.c - -ldemul-list.h: Makefile - (echo "/* This file is automatically generated. DO NOT EDIT! */";\ - for f in `echo " " ${EMULATION_OFILES} "" \ - | sed -e 's/ e/ ld/g' -e 's/ ld/ /g' -e 's/[.]o//g'`; do \ - echo "extern ld_emulation_xfer_type ld_$${f}_emulation;"; \ - done;\ - echo "";\ - echo "#define EMULATION_LIST \\";\ - for f in `echo " " ${EMULATION_OFILES} "" \ - | sed -e 's/ e/ ld/g' -e 's/ ld/ /g' -e 's/[.]o//g'`; do \ - echo " &ld_$${f}_emulation, \\"; \ - done;\ - echo " 0") >ldemul-tmp.h - mv ldemul-tmp.h ldemul-list.h -@TDIRS@ - -ea29k.c: $(srcdir)/emulparams/a29k.sh \ - $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/a29k.sc ${GEN_DEPENDS} - ${GENSCRIPTS} a29k "$(tdir_a29k)" -eaixppc.c: $(srcdir)/emulparams/aixppc.sh \ - $(srcdir)/emultempl/aix.em $(srcdir)/scripttempl/aix.sc ${GEN_DEPENDS} - ${GENSCRIPTS} aixppc "$(tdir_aixppc)" -eaixrs6.c: $(srcdir)/emulparams/aixrs6.sh \ - $(srcdir)/emultempl/aix.em $(srcdir)/scripttempl/aix.sc ${GEN_DEPENDS} - ${GENSCRIPTS} aixrs6 "$(tdir_aixrs6)" -ealpha.c: $(srcdir)/emulparams/alpha.sh \ - $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/alpha.sc ${GEN_DEPENDS} - ${GENSCRIPTS} alpha "$(tdir_alpha)" -earcelf.c: $(srcdir)/emulparams/arcelf.sh \ - $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS} - ${GENSCRIPTS} arcelf "$(tdir_arcelf)" -earmaoutb.c: $(srcdir)/emulparams/armaoutb.sh \ - $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/armaout.sc ${GEN_DEPENDS} - ${GENSCRIPTS} armaoutb "$(tdir_armaoutb)" -earmaoutl.c: $(srcdir)/emulparams/armaoutl.sh \ - $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/armaout.sc ${GEN_DEPENDS} - ${GENSCRIPTS} armaoutl "$(tdir_armaoutl)" -earmcoff.c: $(srcdir)/emulparams/armcoff.sh \ - $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/armcoff.sc ${GEN_DEPENDS} - ${GENSCRIPTS} armcoff "$(tdir_armcoff)" -earmnbsd.c: $(srcdir)/emulparams/armnbsd.sh \ - $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/armaout.sc ${GEN_DEPENDS} - ${GENSCRIPTS} armnbsd "$(tdir_armnbsd)" -earmpe.c: $(srcdir)/emulparams/armpe.sh \ - $(srcdir)/emultempl/pe.em $(srcdir)/scripttempl/pe.sc ${GEN_DEPENDS} - ${GENSCRIPTS} armpe "$(tdir_armpe)" -ecoff_sparc.c: $(srcdir)/emulparams/coff_sparc.sh \ - $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/sparccoff.sc ${GEN_DEPENDS} - ${GENSCRIPTS} coff_sparc "$(tdir_coff_sparc)" -ed10velf.c: $(srcdir)/emulparams/d10velf.sh \ - $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/elfd10v.sc ${GEN_DEPENDS} - ${GENSCRIPTS} d10velf "$(tdir_d10v)" -edelta68.c: $(srcdir)/emulparams/delta68.sh \ - $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/delta68.sc ${GEN_DEPENDS} - ${GENSCRIPTS} delta68 "$(tdir_delta68)" -eebmon29k.c: $(srcdir)/emulparams/ebmon29k.sh \ - $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/ebmon29k.sc ${GEN_DEPENDS} - ${GENSCRIPTS} ebmon29k "$(tdir_ebmon29k)" -em32relf.c: $(srcdir)/emulparams/m32relf.sh \ - $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS} - ${GENSCRIPTS} m32relf "$(tdir_m32r)" -eelf32_sparc.c: $(srcdir)/emulparams/elf32_sparc.sh \ - $(srcdir)/emultempl/elf32.em $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS} - ${GENSCRIPTS} elf32_sparc "$(tdir_elf32_sparc)" -eelf32b4300.c: $(srcdir)/emulparams/elf32b4300.sh \ - $(srcdir)/emultempl/elf32.em $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS} - ${GENSCRIPTS} elf32b4300 "$(tdir_elf32b4300)" -eelf32bmip.c: $(srcdir)/emulparams/elf32bmip.sh \ - $(srcdir)/emultempl/elf32.em $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS} - ${GENSCRIPTS} elf32bmip "$(tdir_elf32bmip)" -eelf32bsmip.c: $(srcdir)/emulparams/elf32bsmip.sh \ - $(srcdir)/emultempl/elf32.em $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS} - ${GENSCRIPTS} elf32bsmip "$(tdir_elf32bsmip)" -eelf32ebmip.c: $(srcdir)/emulparams/elf32ebmip.sh \ - $(srcdir)/emultempl/elf32.em $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS} - ${GENSCRIPTS} elf32ebmip "$(tdir_elf32ebmip)" -eelf32elmip.c: $(srcdir)/emulparams/elf32elmip.sh \ - $(srcdir)/emultempl/elf32.em $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS} - ${GENSCRIPTS} elf32elmip "$(tdir_elf32elmip)" -eelf32l4300.c: $(srcdir)/emulparams/elf32l4300.sh \ - $(srcdir)/emultempl/elf32.em $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS} - ${GENSCRIPTS} elf32l4300 "$(tdir_elf32l4300)" -eelf32lmip.c: $(srcdir)/emulparams/elf32lmip.sh \ - $(srcdir)/emultempl/elf32.em $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS} - ${GENSCRIPTS} elf32lmip "$(tdir_elf32lmip)" -eelf32lppc.c: $(srcdir)/emulparams/elf32lppc.sh \ - $(srcdir)/emultempl/elf32.em $(srcdir)/scripttempl/elfppc.sc ${GEN_DEPENDS} - ${GENSCRIPTS} elf32lppc "$(tdir_elf32lppc)" -eelf32lsmip.c: $(srcdir)/emulparams/elf32lsmip.sh \ - $(srcdir)/emultempl/elf32.em $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS} - ${GENSCRIPTS} elf32lsmip "$(tdir_elf32lsmip)" -eelf32ppc.c: $(srcdir)/emulparams/elf32ppc.sh \ - $(srcdir)/emultempl/elf32.em $(srcdir)/scripttempl/elfppc.sc ${GEN_DEPENDS} - ${GENSCRIPTS} elf32ppc "$(tdir_elf32ppc)" -eelf64alpha.c: $(srcdir)/emulparams/elf64alpha.sh \ - $(srcdir)/emultempl/elf32.em $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS} - ${GENSCRIPTS} elf64alpha "$(tdir_elf64alpha)" -eelf64_sparc.c: $(srcdir)/emulparams/elf64_sparc.sh \ - $(srcdir)/emultempl/elf32.em $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS} - ${GENSCRIPTS} elf64_sparc "$(tdir_elf64_sparc)" -eelf_i386.c: $(srcdir)/emulparams/elf_i386.sh \ - $(srcdir)/emultempl/elf32.em $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS} - ${GENSCRIPTS} elf_i386 "$(tdir_elf_i386)" -egld960.c: $(srcdir)/emulparams/gld960.sh \ - $(srcdir)/emultempl/gld960.em $(srcdir)/scripttempl/i960.sc ${GEN_DEPENDS} - ${GENSCRIPTS} gld960 "$(tdir_gld960)" -egld960coff.c: $(srcdir)/emulparams/gld960coff.sh \ - $(srcdir)/emultempl/gld960c.em $(srcdir)/scripttempl/i960.sc ${GEN_DEPENDS} - ${GENSCRIPTS} gld960coff "$(tdir_gld960coff)" -ego32.c: $(srcdir)/emulparams/go32.sh \ - $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/aout.sc ${GEN_DEPENDS} - ${GENSCRIPTS} go32 "$(tdir_go32)" -eh8300.c: $(srcdir)/emulparams/h8300.sh \ - $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/h8300.sc ${GEN_DEPENDS} - ${GENSCRIPTS} h8300 "$(tdir_h8300)" -eh8300h.c: $(srcdir)/emulparams/h8300h.sh \ - $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/h8300h.sc ${GEN_DEPENDS} - ${GENSCRIPTS} h8300h "$(tdir_h8300h)" -eh8300s.c: $(srcdir)/emulparams/h8300s.sh \ - $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/h8300s.sc ${GEN_DEPENDS} - ${GENSCRIPTS} h8300s "$(tdir_h8300s)" -eh8500.c: $(srcdir)/emulparams/h8500.sh \ - $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/h8500.sc ${GEN_DEPENDS} - ${GENSCRIPTS} h8500 "$(tdir_h8500)" -eh8500b.c: $(srcdir)/emulparams/h8500b.sh \ - $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/h8500b.sc ${GEN_DEPENDS} - ${GENSCRIPTS} h8500b "$(tdir_h8500b)" -eh8500c.c: $(srcdir)/emulparams/h8500c.sh \ - $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/h8500c.sc ${GEN_DEPENDS} - ${GENSCRIPTS} h8500c "$(tdir_h8500c)" -eh8500m.c: $(srcdir)/emulparams/h8500m.sh \ - $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/h8500m.sc ${GEN_DEPENDS} - ${GENSCRIPTS} h8500m "$(tdir_h8500m)" -eh8500s.c: $(srcdir)/emulparams/h8500s.sh \ - $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/h8500s.sc ${GEN_DEPENDS} - ${GENSCRIPTS} h8500s "$(tdir_h8500s)" -ehp300bsd.c: $(srcdir)/emulparams/hp300bsd.sh \ - $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/aout.sc ${GEN_DEPENDS} - ${GENSCRIPTS} hp300bsd "$(tdir_hp300bsd)" -ehp3hpux.c: $(srcdir)/emulparams/hp3hpux.sh \ - $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/aout.sc ${GEN_DEPENDS} - ${GENSCRIPTS} hp3hpux "$(tdir_hp3hpux)" -ehppaelf.c: $(srcdir)/emulparams/hppaelf.sh \ - $(srcdir)/emultempl/hppaelf.em $(srcdir)/scripttempl/hppaelf.sc ${GEN_DEPENDS} - ${GENSCRIPTS} hppaelf "$(tdir_hppaelf)" -ei386aout.c: $(srcdir)/emulparams/i386aout.sh \ - $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/aout.sc ${GEN_DEPENDS} - ${GENSCRIPTS} i386aout "$(tdir_i386aout)" -ei386bsd.c: $(srcdir)/emulparams/i386bsd.sh \ - $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/aout.sc ${GEN_DEPENDS} - ${GENSCRIPTS} i386bsd "$(tdir_i386bsd)" -ei386coff.c: $(srcdir)/emulparams/i386coff.sh \ - $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/i386coff.sc ${GEN_DEPENDS} - ${GENSCRIPTS} i386coff "$(tdir_i386coff)" -ei386go32.c: $(srcdir)/emulparams/i386go32.sh \ - $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/i386go32.sc ${GEN_DEPENDS} - ${GENSCRIPTS} i386go32 "$(tdir_i386go32)" -ei386linux.c: $(srcdir)/emulparams/i386linux.sh \ - $(srcdir)/emultempl/linux.em $(srcdir)/scripttempl/aout.sc ${GEN_DEPENDS} - ${GENSCRIPTS} i386linux "$(tdir_i386linux)" -ei386lynx.c: $(srcdir)/emulparams/i386lynx.sh \ - $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/i386lynx.sc ${GEN_DEPENDS} - ${GENSCRIPTS} i386lynx "$(tdir_i386lynx)" -ei386mach.c: $(srcdir)/emulparams/i386mach.sh \ - $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/aout.sc ${GEN_DEPENDS} - ${GENSCRIPTS} i386mach "$(tdir_i386mach)" -ei386moss.c: $(srcdir)/emulparams/i386moss.sh \ - $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS} - ${GENSCRIPTS} i386moss "$(tdir_i386moss)" -ei386msdos.c: $(srcdir)/emulparams/i386msdos.sh \ - $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/i386msdos.sc ${GEN_DEPENDS} - ${GENSCRIPTS} i386msdos "$(tdir_i386msdos)" -ei386nbsd.c: $(srcdir)/emulparams/i386nbsd.sh \ - $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/aout.sc ${GEN_DEPENDS} - ${GENSCRIPTS} i386nbsd "$(tdir_i386nbsd)" -ei386nw.c: $(srcdir)/emulparams/i386nw.sh \ - $(srcdir)/emultempl/elf32.em $(srcdir)/scripttempl/nw.sc ${GEN_DEPENDS} - ${GENSCRIPTS} i386nw "$(tdir_i386nw)" -ei386pe.c: $(srcdir)/emulparams/i386pe.sh \ - $(srcdir)/emultempl/pe.em $(srcdir)/scripttempl/pe.sc ${GEN_DEPENDS} - ${GENSCRIPTS} i386pe "$(tdir_i386pe)" -elnk960.c: $(srcdir)/emulparams/lnk960.sh \ - $(srcdir)/emultempl/lnk960.em $(srcdir)/scripttempl/i960.sc ${GEN_DEPENDS} - ${GENSCRIPTS} lnk960 "$(tdir_lnk960)" -em68k4knbsd.c: $(srcdir)/emulparams/m68k4knbsd.sh \ - $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/aout.sc ${GEN_DEPENDS} - ${GENSCRIPTS} m68k4knbsd "$(tdir_m68k4knbsd)" -em68kaout.c: $(srcdir)/emulparams/m68kaout.sh \ - $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/aout.sc ${GEN_DEPENDS} - ${GENSCRIPTS} m68kaout "$(tdir_m68kaout)" -em68kaux.c: $(srcdir)/emulparams/m68kaux.sh \ - $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/m68kaux.sc ${GEN_DEPENDS} - ${GENSCRIPTS} m68kaux "$(tdir_m68kaux)" -em68kcoff.c: $(srcdir)/emulparams/m68kcoff.sh \ - $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/m68kcoff.sc ${GEN_DEPENDS} - ${GENSCRIPTS} m68kcoff "$(tdir_m68kcoff)" -em68kelf.c: $(srcdir)/emulparams/m68kelf.sh \ - $(srcdir)/emultempl/elf32.em $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS} - ${GENSCRIPTS} m68kelf "$(tdir_m68kelf)" -em68klinux.c: $(srcdir)/emulparams/m68klinux.sh \ - $(srcdir)/emultempl/linux.em $(srcdir)/scripttempl/aout.sc ${GEN_DEPENDS} - ${GENSCRIPTS} m68klinux "$(tdir_m68klinux)" -em68klynx.c: $(srcdir)/emulparams/m68klynx.sh \ - $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/m68klynx.sc ${GEN_DEPENDS} - ${GENSCRIPTS} m68klynx "$(tdir_m68klynx)" -em68knbsd.c: $(srcdir)/emulparams/m68knbsd.sh \ - $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/aout.sc ${GEN_DEPENDS} - ${GENSCRIPTS} m68knbsd "$(tdir_m68knbsd)" -em68kpsos.c: $(srcdir)/emulparams/m68kpsos.sh \ - $(srcdir)/emultempl/elf32.em $(srcdir)/scripttempl/psos.sc ${GEN_DEPENDS} - ${GENSCRIPTS} m68kpsos "$(tdir_m68kpsos)" -em88kbcs.c: $(srcdir)/emulparams/m88kbcs.sh \ - $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/m88kbcs.sc ${GEN_DEPENDS} - ${GENSCRIPTS} m88kbcs "$(tdir_m88kbcs)" -emipsbig.c: $(srcdir)/emulparams/mipsbig.sh \ - $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/mips.sc ${GEN_DEPENDS} - ${GENSCRIPTS} mipsbig -emipsbsd.c: $(srcdir)/emulparams/mipsbsd.sh \ - $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/mipsbsd.sc ${GEN_DEPENDS} - ${GENSCRIPTS} mipsbsd -emipsidt.c: $(srcdir)/emulparams/mipsidt.sh \ - $(srcdir)/emultempl/mipsecoff.em $(srcdir)/scripttempl/mips.sc ${GEN_DEPENDS} - ${GENSCRIPTS} mipsidt "$(tdir_mipsidt)" -emipsidtl.c: $(srcdir)/emulparams/mipsidtl.sh \ - $(srcdir)/emultempl/mipsecoff.em $(srcdir)/scripttempl/mips.sc ${GEN_DEPENDS} - ${GENSCRIPTS} mipsidtl "$(tdir_mipsidtl)" -emipslit.c: $(srcdir)/emulparams/mipslit.sh \ - $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/mips.sc ${GEN_DEPENDS} - ${GENSCRIPTS} mipslit "$(tdir_mipslit)" -emipslnews.c: $(srcdir)/emulparams/mipslnews.sh \ - $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/mips.sc ${GEN_DEPENDS} - ${GENSCRIPTS} mipslnews -emn10300.c: $(srcdir)/emulparams/mn10300.sh \ - $(srcdir)/emultempl/elf32.em $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS} - ${GENSCRIPTS} mn10300 "$(tdir_mn10300)" -emn10200.c: $(srcdir)/emulparams/mn10200.sh \ - $(srcdir)/emultempl/elf32.em $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS} - ${GENSCRIPTS} mn10200 "$(tdir_mn10200)" -enews.c: $(srcdir)/emulparams/news.sh \ - $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/aout.sc ${GEN_DEPENDS} - ${GENSCRIPTS} news "$(tdir_news)" -ens32knbsd.c: $(srcdir)/emulparams/ns32knbsd.sh \ - $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/aout.sc ${GEN_DEPENDS} - ${GENSCRIPTS} ns32knbsd "$(tdir_ns32knbsd)" -epc532macha.c: $(srcdir)/emulparams/pc532macha.sh \ - $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/aout.sc ${GEN_DEPENDS} - ${GENSCRIPTS} pc532macha "$(tdir_pc532macha)" -eppcmacos.c: $(srcdir)/emulparams/ppcmacos.sh \ - $(srcdir)/emultempl/aix.em $(srcdir)/scripttempl/aix.sc ${GEN_DEPENDS} - ${GENSCRIPTS} ppcmacos "$(tdir_ppcmacos)" -eppcnw.c: $(srcdir)/emulparams/ppcnw.sh \ - $(srcdir)/emultempl/elf32.em $(srcdir)/scripttempl/nw.sc ${GEN_DEPENDS} - ${GENSCRIPTS} ppcnw "$(tdir_ppcnw)" -eppcpe.c: $(srcdir)/emulparams/ppcpe.sh \ - $(srcdir)/emultempl/pe.em $(srcdir)/scripttempl/ppcpe.sc ${GEN_DEPENDS} - ${GENSCRIPTS} ppcpe "$(tdir_ppcpe)" -eriscix.c: $(srcdir)/emulparams/riscix.sh \ - $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/aout.sc ${GEN_DEPENDS} - ${GENSCRIPTS} riscix "$(tdir_riscix)" -esa29200.c: $(srcdir)/emulparams/sa29200.sh \ - $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/sa29200.sc ${GEN_DEPENDS} - ${GENSCRIPTS} sa29200 "$(tdir_sa29200)" -esh.c: $(srcdir)/emulparams/sh.sh \ - $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/sh.sc ${GEN_DEPENDS} - ${GENSCRIPTS} sh "$(tdir_sh)" -eshelf.c: $(srcdir)/emulparams/shelf.sh \ - $(srcdir)/emultempl/elf32.em $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS} - ${GENSCRIPTS} shelf "$(tdir_shelf)" -eshlelf.c: $(srcdir)/emulparams/shlelf.sh \ - $(srcdir)/emultempl/elf32.em $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS} - ${GENSCRIPTS} shlelf "$(tdir_shlelf)" -eshl.c: $(srcdir)/emulparams/shl.sh \ - $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/sh.sc ${GEN_DEPENDS} - ${GENSCRIPTS} shl "$(tdir_shl)" -eshunx.c: $(srcdir)/emulparams/shunx.sh \ - $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/sh.sc ${GEN_DEPENDS} - ${GENSCRIPTS} shunx "$(tdir_shunx)" -eshlunx.c: $(srcdir)/emulparams/shlunx.sh \ - $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/shunx.sc ${GEN_DEPENDS} - ${GENSCRIPTS} shlunx "$(tdir_shlunx)" -eelf32shunx.c: $(srcdir)/emulparams/elf32shunx.sh \ - $(srcdir)/emultempl/elf32.em $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS} - ${GENSCRIPTS} elf32shunx "$(tdir_elf32shunx)" -eelf32shlunx.c: $(srcdir)/emulparams/elf32shlunx.sh \ - $(srcdir)/emultempl/elf32.em $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS} - ${GENSCRIPTS} elf32shlunx "$(tdir_elf32shlunx)" -esparcaout.c: $(srcdir)/emulparams/sparcaout.sh \ - $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/aout.sc ${GEN_DEPENDS} - ${GENSCRIPTS} sparcaout "$(tdir_sparcaout)" -esparclinux.c: $(srcdir)/emulparams/sparclinux.sh \ - $(srcdir)/emultempl/linux.em $(srcdir)/scripttempl/aout.sc ${GEN_DEPENDS} - ${GENSCRIPTS} sparclinux "$(tdir_sparclinux)" -esparclynx.c: $(srcdir)/emulparams/sparclynx.sh \ - $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/sparclynx.sc ${GEN_DEPENDS} - ${GENSCRIPTS} sparclynx "$(tdir_sparclynx)" -esparcnbsd.c: $(srcdir)/emulparams/sparcnbsd.sh \ - $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/aout.sc ${GEN_DEPENDS} - ${GENSCRIPTS} sparcnbsd "$(tdir_sparcnbsd)" -est2000.c: $(srcdir)/emulparams/st2000.sh \ - $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/st2000.sc ${GEN_DEPENDS} - ${GENSCRIPTS} st2000 "$(tdir_st2000)" -esun3.c: $(srcdir)/emulparams/sun3.sh \ - $(srcdir)/emultempl/sunos.em $(srcdir)/scripttempl/aout.sc ${GEN_DEPENDS} - ${GENSCRIPTS} sun3 "$(tdir_sun3)" -esun4.c: $(srcdir)/emulparams/sun4.sh \ - $(srcdir)/emultempl/sunos.em $(srcdir)/scripttempl/aout.sc ${GEN_DEPENDS} - ${GENSCRIPTS} sun4 "$(tdir_sun4)" -etic30aout.c: $(srcdir)/emulparams/tic30aout.sh \ - $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/tic30aout.sc ${GEN_DEPENDS} - ${GENSCRIPTS} tic30aout "$(tdir_tic30aout)" -etic30coff.c: $(srcdir)/emulparams/tic30coff.sh \ - $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/tic30coff.sc ${GEN_DEPENDS} - ${GENSCRIPTS} tic30coff "$(tdir_tic30coff)" -evanilla.c: $(srcdir)/emulparams/vanilla.sh \ - $(srcdir)/emultempl/vanilla.em $(srcdir)/scripttempl/vanilla.sc ${GEN_DEPENDS} - ${GENSCRIPTS} vanilla "$(tdir_vanilla)" -evax.c: $(srcdir)/emulparams/vax.sh \ - $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/aout.sc ${GEN_DEPENDS} - ${GENSCRIPTS} vax "$(tdir_vax)" -evsta.c: $(srcdir)/emulparams/vsta.sh \ - $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/aout.sc ${GEN_DEPENDS} - ${GENSCRIPTS} vsta "$(tdir_vsta)" -ev850.c: $(srcdir)/emulparams/v850.sh \ - $(srcdir)/emultempl/elf32.em $(srcdir)/scripttempl/v850.sc ${GEN_DEPENDS} - ${GENSCRIPTS} v850 "$(tdir_v850)" -ew65.c: $(srcdir)/emulparams/w65.sh \ - $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/w65.sc ${GEN_DEPENDS} - ${GENSCRIPTS} w65 "$(tdir_w65)" -ez8001.c: $(srcdir)/emulparams/z8001.sh \ - $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/z8000.sc ${GEN_DEPENDS} - ${GENSCRIPTS} z8001 "$(tdir_z8001)" -ez8002.c: $(srcdir)/emulparams/z8002.sh \ - $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/z8000.sc ${GEN_DEPENDS} - ${GENSCRIPTS} z8002 "$(tdir_z8002)" - -# The generated emulation files mostly have the same dependencies. -$(EMULATION_OFILES): ../bfd/bfd.h sysdep.h config.h $(INCDIR)/bfdlink.h \ - ld.h ldmain.h ldemul.h ldfile.h ldmisc.h ldexp.h ldlang.h \ - ldctor.h ldexp.h ldlang.h ldgram.h - -check-DEJAGNU: site.exp - srcroot=`cd $(srcdir) && pwd`; export srcroot; \ - r=`pwd`; export r; \ - EXPECT=$(EXPECT); export EXPECT; \ - if [ -f $(top_builddir)/../expect/expect ]; then \ - TCL_LIBRARY=`cd $(top_srcdir)/../tcl/library && pwd`; \ - export TCL_LIBRARY; \ - fi; \ - runtest=$(RUNTEST); \ - if $(SHELL) -c "$$runtest --version" > /dev/null 2>&1; then \ - $$runtest --tool $(DEJATOOL) --srcdir $${srcroot}/testsuite \ - CC="$(CC_FOR_TARGET)" CFLAGS="$(CFLAGS)" \ - CXX="$(CXX_FOR_TARGET)" CXXFLAGS="$(CXXFLAGS)" \ - CC_FOR_HOST="$(CC)" CFLAGS_FOR_HOST="$(CFLAGS)" \ - OFILES="$(OFILES)" BFDLIB="$(TESTBFDLIB)" \ - LIBIBERTY="$(LIBIBERTY)" HOSTING_EMU="$(HOSTING_EMU)" \ - HOSTING_CRT0="$(HOSTING_CRT0)" HOSTING_LIBS="$(HOSTING_LIBS)" \ - $(RUNTESTFLAGS); \ - else echo "WARNING: could not find \`runtest'" 1>&2; :;\ - fi - -# Rules for testing by relinking ld itself. -# A similar test is in the testsuite. This target is for ease of use -# when porting ld. - -ld-partial.o: ld-new$(EXEEXT) - ./ld-new$(EXEEXT) $(HOSTING_EMU) -o ld-partial.o -r $(OFILES) -ld1$(EXEEXT): ld-partial.o - ./ld-new$(EXEEXT) $(HOSTING_EMU) -o ld1$(EXEEXT) $(HOSTING_CRT0) ld-partial.o $(TESTBFDLIB) $(LIBIBERTY) $(HOSTING_LIBS) - -ld1-full$(EXEEXT): ld-new - ./ld-new$(EXEEXT) $(HOSTING_EMU) -o ld1-full$(EXEEXT) $(HOSTING_CRT0) $(OFILES) $(TESTBFDLIB) $(LIBIBERTY) $(HOSTING_LIBS) - -ld2$(EXEEXT): ld1$(EXEEXT) - ./ld1$(EXEEXT) $(HOSTING_EMU) -o ld2$(EXEEXT) $(HOSTING_CRT0) $(OFILES) $(TESTBFDLIB) $(LIBIBERTY) $(HOSTING_LIBS) - -ld3$(EXEEXT): ld2$(EXEEXT) - ./ld2$(EXEEXT) $(HOSTING_EMU) -o ld3$(EXEEXT) $(HOSTING_CRT0) $(OFILES) $(TESTBFDLIB) $(LIBIBERTY) $(HOSTING_LIBS) - -bootstrap: ld3$(EXEEXT) - cmp ld2$(EXEEXT) ld3$(EXEEXT) - -.PHONY: bootstrap - -# A test program for C++ constructors and destructors. -# This test is now in the testsuite. -# -#cdtest: cdtest-main.o cdtest-bar.o cdtest-foo.o ld.new -# ./ld.new $(HOSTING_EMU) -o cdtest $(HOSTING_CRT0) \ -# cdtest-main.o cdtest-bar.o cdtest-foo.o $(HOSTING_LIBS) -# -#cdtest.out: cdtest -# ./cdtest > cdtest.tmp -# mv cdtest.tmp cdtest.out -# -#cdtest-ur.o: cdtest-main.o cdtest-bar.o cdtest-foo.o ld.new -# ./ld.new $(HOSTING_EMU) -o cdtest-ur.o -Ur cdtest-main.o \ -# cdtest-bar.o cdtest-foo.o -# -#cdtest-ur: cdtest-ur.o -# ./ld.new $(HOSTING_EMU) -o cdtest-ur $(HOSTING_CRT0) cdtest-ur.o \ -# $(HOSTING_LIBS) -# -#cdtest-ur.out: cdtest-ur -# ./cdtest-ur > cdtest-ur.tmp -# mv cdtest-ur.tmp cdtest-ur.out -# -#check-cdtest: cdtest.out cdtest-ur.out $(srcdir)/cdtest.exp -# diff $(srcdir)/cdtest.exp cdtest.out -# diff $(srcdir)/cdtest.exp cdtest-ur.out -# -#.PHONY: check-cdtest - -# END OF CHECK TARGETS - -# DOCUMENTATION TARGETS -# Manual configuration file; not usually attached to normal configuration, -# because almost all configs use "gen" version of manual. -# Set DOCVER above to change. -configdoc.texi: ${DOCVER}-doc.texi - ln -s ${srcdir}/${DOCVER}-doc.texi ./configdoc.texi >/dev/null 2>&1 \ - || ln ${srcdir}/${DOCVER}-doc.texi ./configdoc.texi >/dev/null 2>&1 \ - || cp ${srcdir}/${DOCVER}-doc.texi ./configdoc.texi - -ld.info: $(srcdir)/ld.texinfo configdoc.texi - @rm -f $@ $@-[0-9] $@-[0-9][0-9] - $(MAKEINFO) -I $(srcdir) -I $(BFDDIR)/doc $(srcdir)/ld.texinfo - -ld.dvi: $(srcdir)/ld.texinfo configdoc.texi - TEXINPUTS=$(top_srcdir)/../texinfo:$$TEXINPUTS \ - MAKEINFO='$(MAKEINFO) -I $(srcdir) -I $(BFDDIR)/doc' $(TEXI2DVI) $(srcdir)/ld.texinfo - -# We want to reconfigure if configure.host or configure.tgt changes. -Makefile: configure.host configure.tgt -mostlyclean-local: - -rm -rf tmpdir - -.PHONY: install-exec-local install-data-local - -install-exec-local: ld-new$(EXEEXT) - $(mkinstalldirs) $(bindir) $(tooldir)/bin - @list='$(noinst_PROGRAMS)'; for p in $$list; do \ - if test -f $$p; then \ - echo " $(LIBTOOL) --mode=install $(INSTALL_PROGRAM) $$p $(bindir)/`echo $$p|sed -e 's/-new//'|sed '$(transform)'`"; \ - $(LIBTOOL) --mode=install $(INSTALL_PROGRAM) $$p $(bindir)/`echo $$p|sed -e 's/-new//'|sed '$(transform)'`; \ - else :; fi; \ - done - rm -f $(tooldir)/bin/ld$(EXEEXT) - n=`echo ld | sed '$(transform)'`; \ - if [ "$(bindir)/$$n$(EXEEXT)" != "$(tooldir)/bin/ld$(EXEEXT)" ]; then \ - ln $(bindir)/$$n$(EXEEXT) $(tooldir)/bin/ld$(EXEEXT) >/dev/null 2>/dev/null \ - || $(LIBTOOL) --mode=install $(INSTALL_PROGRAM) ld-new$(EXEEXT) $(tooldir)/bin/ld$(EXEEXT); \ - fi - -install-data-local: - $(mkinstalldirs) $(scriptdir) - for f in ldscripts/*; do \ - $(INSTALL_DATA) $$f $(scriptdir)/$$f ; \ - done -diststuff: $(LDDISTSTUFF) info - -distclean-local: - rm -rf ldscripts - -# Targets to rebuild dependencies in this Makefile. -# Have to get rid of .dep1 here so that "$?" later includes all of $(CFILES). -.dep: dep.sed $(CFILES) $(HFILES) $(GENERATED_CFILES) $(GENERATED_HFILES) config.h - rm -f .dep1 - $(MAKE) DEP=$(DEP) .dep1 - sed -f dep.sed <.dep1 >.dep - -# This rule really wants a mkdep that runs "gcc -MM". -.dep1: $(CFILES) $(GENERATED_CFILES) - rm -f .dep2 - echo '# DO NOT DELETE THIS LINE -- mkdep uses it.' > .dep2 - $(DEP) -f .dep2 $(INCLUDES) $? - $(srcdir)/../move-if-change .dep2 .dep1 - -dep.sed: dep-in.sed config.status - sed <$(srcdir)/dep-in.sed >dep.sed \ - -e 's!@INCDIR@!$(INCDIR)!' \ - -e 's!@SRCDIR@!$(srcdir)!' - -dep: .dep - sed -e '/^..DO NOT DELETE THIS LINE/,$$d' < Makefile > tmp-Makefile - cat .dep >> tmp-Makefile - $(srcdir)/../move-if-change tmp-Makefile Makefile - -dep-in: .dep - sed -e '/^..DO NOT DELETE THIS LINE/,$$d' < $(srcdir)/Makefile.in > tmp-Makefile.in - cat .dep >> tmp-Makefile.in - $(srcdir)/../move-if-change tmp-Makefile.in $(srcdir)/Makefile.in - -dep-am: .dep - sed -e '/^..DO NOT DELETE THIS LINE/,$$d' < $(srcdir)/Makefile.am > tmp-Makefile.am - cat .dep >> tmp-Makefile.am - $(srcdir)/../move-if-change tmp-Makefile.am $(srcdir)/Makefile.am - -.PHONY: dep dep-in dep-am - -# What appears below is generated by a hacked mkdep using gcc -MM. - -# DO NOT DELETE THIS LINE -- mkdep uses it. -# DO NOT PUT ANYTHING AFTER THIS LINE, IT WILL GO AWAY. - -ldctor.o: ldctor.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \ - sysdep.h config.h $(INCDIR)/fopen-same.h $(INCDIR)/bfdlink.h \ - ld.h ldexp.h ldlang.h ldmisc.h ldgram.h ldmain.h ldctor.h -ldemul.o: ldemul.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \ - sysdep.h config.h $(INCDIR)/fopen-same.h ld.h ldemul.h \ - ldmisc.h ldexp.h ldlang.h ldfile.h ldmain.h ldemul-list.h -ldexp.o: ldexp.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \ - sysdep.h config.h $(INCDIR)/fopen-same.h $(INCDIR)/bfdlink.h \ - ld.h ldmain.h ldmisc.h ldexp.h ldgram.h ldlang.h -ldfile.o: ldfile.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \ - sysdep.h config.h $(INCDIR)/fopen-same.h $(INCDIR)/bfdlink.h \ - ld.h ldmisc.h ldexp.h ldlang.h ldfile.h ldmain.h ldgram.h \ - ldlex.h ldemul.h -ldlang.o: ldlang.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \ - sysdep.h config.h $(INCDIR)/fopen-same.h $(INCDIR)/libiberty.h \ - $(INCDIR)/obstack.h $(INCDIR)/bfdlink.h ld.h ldmain.h \ - ldgram.h ldexp.h ldlang.h ldemul.h ldlex.h ldmisc.h \ - ldctor.h ldfile.h $(INCDIR)/fnmatch.h -ldmain.o: ldmain.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \ - sysdep.h config.h $(INCDIR)/fopen-same.h $(INCDIR)/libiberty.h \ - $(INCDIR)/progress.h $(INCDIR)/bfdlink.h ld.h ldmain.h \ - ldmisc.h ldwrite.h ldgram.h ldexp.h ldlang.h ldemul.h \ - ldlex.h ldfile.h ldctor.h -ldmisc.o: ldmisc.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \ - sysdep.h config.h $(INCDIR)/fopen-same.h $(INCDIR)/libiberty.h \ - $(INCDIR)/demangle.h ld.h ldmisc.h ldexp.h ldlang.h \ - ldgram.h ldlex.h ldmain.h ldfile.h -ldver.o: ldver.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \ - sysdep.h config.h $(INCDIR)/fopen-same.h ld.h ldver.h \ - ldemul.h ldmain.h -ldwrite.o: ldwrite.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \ - sysdep.h config.h $(INCDIR)/fopen-same.h $(INCDIR)/bfdlink.h \ - $(INCDIR)/libiberty.h ld.h ldexp.h ldlang.h ldwrite.h \ - ldmisc.h ldgram.h ldmain.h -lexsup.o: lexsup.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \ - sysdep.h config.h $(INCDIR)/fopen-same.h $(INCDIR)/libiberty.h \ - $(INCDIR)/getopt.h $(INCDIR)/bfdlink.h ld.h ldmain.h \ - ldmisc.h ldexp.h ldlang.h ldgram.h ldlex.h ldfile.h \ - ldver.h ldemul.h -mri.o: mri.c ../bfd/bfd.h $(INCDIR)/ansidecl.h sysdep.h \ - config.h $(INCDIR)/fopen-same.h ld.h ldexp.h ldlang.h \ - ldmisc.h mri.h ldgram.h $(INCDIR)/libiberty.h -ldcref.o: ldcref.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \ - sysdep.h config.h $(INCDIR)/fopen-same.h $(INCDIR)/bfdlink.h \ - $(INCDIR)/libiberty.h ld.h ldmain.h ldmisc.h ldexp.h \ - ldlang.h -ldgram.o: ldgram.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \ - sysdep.h config.h $(INCDIR)/fopen-same.h $(INCDIR)/bfdlink.h \ - ld.h ldexp.h ldver.h ldlang.h ldemul.h ldfile.h ldmisc.h \ - ldmain.h mri.h ldlex.h -ldlex.o: ldlex.c ../bfd/bfd.h sysdep.h config.h $(INCDIR)/fopen-same.h \ - ld.h ldgram.h ldmisc.h ldexp.h ldlang.h ldfile.h ldlex.h \ - ldmain.h - -# IF YOU PUT ANYTHING HERE IT WILL GO AWAY - -# Tell versions [3.59,3.63) of GNU make to not export all variables. -# Otherwise a system limit (for SysV at least) may be exceeded. -.NOEXPORT: diff --git a/gnu/dist/ld/NEWS b/gnu/dist/ld/NEWS deleted file mode 100644 index ba325964139f..000000000000 --- a/gnu/dist/ld/NEWS +++ /dev/null @@ -1,169 +0,0 @@ --*- text -*- - -Changes in version 2.9: - -* Added SQUAD to the linker script language. - -* New option --no-warn-mismatch. - -* The MEMORY command now parses the attributes to determine where sections that -are not placed in a specific memory region are placed. - -Changes in version 2.8: - -* Linker scripts may now contain shell wildcard characters for file and section - names. - -* The linker now supports symbol versions in ELF. - -* The NOCROSSREFS command was added to the linker script language. - -* The LOADADDR expression was added to the linker script language. - -* MAX and MIN functions were added to the linker script language. - -* The OVERLAY construct was added to the linker script language. - -* New option --warn-section-align to warn when the address of an output section - changes due to alignment of an input section. - -* New options --filter/-F and --auxiliary/-f. - -Changes in version 2.7: - -* New option --cref to print out a cross reference table. - -* New option --wrap SYMBOL. - -* New option --no-whole-archive, to turn off the effect of --whole-archive. - -* Input sections assigned to the output section /DISCARD/ in the linker script - are not included in the output file. - -* The SunOS and ELF linkers now merge stabs debugging information which uses - the N_BINCL and N_EINCL stab types. This reduces the amount of debugging - information generated. - -Changes in version 2.6: - -* When an ELF section name is representable as a C identifier (this is not true -of most ELF section names), the linker will automatically define symbols -__start_SECNAME and __stop_SECNAME, where SECNAME is the section name, at the -beginning and the end of the section. This is used by glibc. - -* When an ELF section named .gnu.warning is encountered in an input file, the -contents of the section are displayed as an error message, and the section is -not copied into the output file. This is used by glibc. - -* When an ELF section named .gnu.warning.SYMBOL is encountered in an input -file, and the symbol SYMBOL is referenced by some object file, the contents of -the section are displayed as an error message. The section is not copied into -the output file, unless doing a relocateable or shared link. This is used by -glibc. - -* New options -split-by-reloc and -split-by-file. - -* The linker now supports linking PIC compiled code on SPARC SunOS. It can -also create SPARC SunOS shared libraries, and, like the native SunOS linker, -will do so whenever there is an undefined symbol in the link and neither the -e -nor the -r option was used. - -* The -rpath option may be used on SunOS to set the list of directories to be -searched at run time. This overrides the default of building the list from the --L options. - -* The COFF linker now combines debugging information for structs, unions, and -enums, so that even if the same type is defined in multiple input files it will -only be defined once in the output file. The --traditional-format switch will -prevent this optimization. - -Changes in version 2.5: - -* The linker now supports linking against SunOS shared libraries. It still can -not link SunOS PIC (Position Independent Code) files, so it can not be used to -generate shared libaries. - -* The linker now supports linking against ELF shared libraries for the i386 -(UnixWare) and SPARC (Solaris). It can also link ELF PIC files, and can be -used to generate shared libraries. Shared library generation is not well -tested; please report any problems encountered. The linker is now enabled for -Solaris again. - -* Eric Youngdale has contributed Linux support code, including linking against -Linux a.out shared libraries. The linker produces Linux QMAGIC binaries. - -* The ELF backend has been converted to the new linker code. To use the new -ELF linker, each particular target requires a relocation function. So far, -this function has been written for i386 (UnixWare), SPARC (Solaris) MIPS (Irix -5), and HPPA ELF targets. - -* The -( (--start-group) and -) (--end-group) options have been added to -support searching a group of archives as though they were a single archive. -This can also be used in a linker script, as GROUP ( files ). - -* When a file is named on the command line, and the linker does not recognize -it as an object file, the linker will now treat the file as a linker script -file. A linker script named in this way augments, but does not replace, the -default linker script. - -* The -warn-once option was added. It causes the linker to only warn once per -undefined symbol, rather than once per reference. - -* The COFF backend has been converted to the new linker code. As with ELF, to -use the new linker, each particular target requires a relocation function. So -far, this function has been written for the i386, m68k, a29k and SH targets. - -* The -V flag was made a synonym for -v, for SVR4 compatibility. The old -V -behaviour is available via --verbose. - -Changes in version 2.4: - -* New linker code, by Steve Chamberlain and Ian Taylor. For a.out and ecoff - formats (so far), this should result in considerable savings in time - and memory used while linking; slightly poorer performance than - before for formats not converted yet. - -* Command-line parsing is no longer done with flex. This means - oddball characters in filenames won't get treated as argument - separators. - -* HP-PA ELF support, by Jeff Law. (No SOM support yet.) - -* Mach i386 support, by David Mackenzie. - -* Irix 4 shared libraries are now supported (Irix 5 uses ELF, and ELF shared - libraries are not yet supported). - -* COFF shared libraries (as on SCO) should work as well. - -* The linker is disabled for Solaris. (Actually, it was in 2.3 also, I just - forgot to note it.) Some of their C library routines don't work when - statically linked, and the GNU linker doesn't support dynamic linking yet. - -Changes in version 2.3: - -* Weak symbols are now supported. - -* ELF support has been added. The linker has been bootstrapped on - UnixWare and Solaris. - -* Alpha OSF/1 support has been added (non dynamic linking only). - -Changes in version 2.2: - -* The `bfd' library has been updated to reduce a.out-format string - table size. The effect of this is that files linked from many input - files with duplicate symbols (`-g' debugging records, or identical - static symbols) should be much smaller. - -Changes in version 2.1: - -* The ld -ySYMBOL flag (to trace references to SYMBOL) is now implemented. - -* There is now support for writing ECOFF files, so ld and the - other utilities should work on Risc/Ultrix and Irix. - - -Local variables: -fill-column: 79 -End: diff --git a/gnu/dist/ld/README b/gnu/dist/ld/README deleted file mode 100644 index 8947d04156bf..000000000000 --- a/gnu/dist/ld/README +++ /dev/null @@ -1,64 +0,0 @@ -This is the GNU linker. It is distributed with other "binary -utilities" which should be in ../binutils. See ../binutils/README for -more general notes, including where to send bug reports. - -There are many features of the linker: - -* The linker uses a Binary File Descriptor library (../bfd) - that it uses to read and write object files. This helps - insulate the linker itself from the format of object files. - -* The linker supports a number of different object file - formats. It can even handle multiple formats at once: - Read two input formats and write a third. - -* The linker can be configured for cross-linking. - -* The linker supports a control language. - -* There is a user manual (ld.texinfo), as well as the - beginnings of an internals manual (ldint.texinfo). - -Installation -============ - -See ../binutils/README. - -If you want to make a cross-linker, you may want to specify -a different search path of -lfoo libraries than the default. -You can do this by setting the LIB_PATH variable in ./Makefile. - -To build just the linker, make the target all-ld from the top level -directory (one directory above this one). - -Porting to a new target -======================= - -See the ldint.texinfo manual. - -Reporting bugs etc -=========================== - -See ../binutils/README. - -Known problems -============== - -The Solaris linker normally exports all dynamic symbols from an -executable. The GNU linker does not do this by default. This is -because the GNU linker tries to present the same interface for all -similar targets (in this case, all native ELF targets). This does not -matter for normal programs, but it can make a difference for programs -which try to dlopen an executable, such as PERL or Tcl. You can make -the GNU linker export all dynamic symbols with the -E or ---export-dynamic command line option. - -HP/UX 9.01 has a shell bug that causes the linker scripts to be -generated incorrectly. The symptom of this appears to be "fatal error -- scanner input buffer overflow" error messages. There are various -workarounds to this: - * Build and install bash, and build with "make SHELL=bash". - * Update to a version of HP/UX with a working shell (e.g., 9.05). - * Replace "(. ${srcdir}/scripttempl/${SCRIPT_NAME}.sc)" in - genscripts.sh with "sh ${srcdir}..." (no parens) and make sure the - emulparams script used exports any shell variables it sets. diff --git a/gnu/dist/ld/TODO b/gnu/dist/ld/TODO deleted file mode 100644 index 31cd98ba236f..000000000000 --- a/gnu/dist/ld/TODO +++ /dev/null @@ -1,9 +0,0 @@ -Volunteers to tackle some of the following would be welcome: - -Support the "traditional" BSD -A flag (incremental loading). -(There is a -A flag in ld now, but it is used to specify the -architecture. That should probably be changed.) - -Support for dynamic loading (a la dld, but bfd-based) would be nice. - -Avoid re-open (and re-seeking) output bfd and archives. diff --git a/gnu/dist/ld/acconfig.h b/gnu/dist/ld/acconfig.h deleted file mode 100644 index c627d7faa97a..000000000000 --- a/gnu/dist/ld/acconfig.h +++ /dev/null @@ -1,22 +0,0 @@ - -/* Name of package. */ -#undef PACKAGE - -/* Version of package. */ -#undef VERSION - -/* Whether strstr must be declared even if is included. */ -#undef NEED_DECLARATION_STRSTR - -/* Whether free must be declared even if is included. */ -#undef NEED_DECLARATION_FREE - -/* Whether sbrk must be declared even if is included. */ -#undef NEED_DECLARATION_SBRK - -/* Whether getenv must be declared even if is included. */ -#undef NEED_DECLARATION_GETENV -@TOP@ - -/* Do we need to use the b modifier when opening binary files? */ -#undef USE_BINARY_FOPEN diff --git a/gnu/dist/ld/acinclude.m4 b/gnu/dist/ld/acinclude.m4 deleted file mode 100644 index 71b09b9f6ac7..000000000000 --- a/gnu/dist/ld/acinclude.m4 +++ /dev/null @@ -1 +0,0 @@ -sinclude(../bfd/acinclude.m4) diff --git a/gnu/dist/ld/aclocal.m4 b/gnu/dist/ld/aclocal.m4 deleted file mode 100644 index cbf8bd1799f2..000000000000 --- a/gnu/dist/ld/aclocal.m4 +++ /dev/null @@ -1,460 +0,0 @@ -dnl aclocal.m4 generated automatically by aclocal 1.2e - -dnl Copyright (C) 1994, 1995, 1996, 1997, 1998 Free Software Foundation, Inc. -dnl This Makefile.in is free software; the Free Software Foundation -dnl gives unlimited permission to copy and/or distribute it, -dnl with or without modifications, as long as this notice is preserved. - -dnl This program is distributed in the hope that it will be useful, -dnl but WITHOUT ANY WARRANTY, to the extent permitted by law; without -dnl even the implied warranty of MERCHANTABILITY or FITNESS FOR A -dnl PARTICULAR PURPOSE. - -sinclude(../bfd/acinclude.m4) - -# Do all the work for Automake. This macro actually does too much -- -# some checks are only needed if your package does certain things. -# But this isn't really a big deal. - -# serial 1 - -dnl Usage: -dnl AM_INIT_AUTOMAKE(package,version, [no-define]) - -AC_DEFUN(AM_INIT_AUTOMAKE, -[AC_REQUIRE([AM_PROG_INSTALL]) -PACKAGE=[$1] -AC_SUBST(PACKAGE) -VERSION=[$2] -AC_SUBST(VERSION) -dnl test to see if srcdir already configured -if test "`cd $srcdir && pwd`" != "`pwd`" && test -f $srcdir/config.status; then - AC_MSG_ERROR([source directory already configured; run "make distclean" there first]) -fi -ifelse([$3],, -AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE") -AC_DEFINE_UNQUOTED(VERSION, "$VERSION")) -AC_REQUIRE([AM_SANITY_CHECK]) -AC_REQUIRE([AC_ARG_PROGRAM]) -dnl FIXME This is truly gross. -missing_dir=`cd $ac_aux_dir && pwd` -AM_MISSING_PROG(ACLOCAL, aclocal, $missing_dir) -AM_MISSING_PROG(AUTOCONF, autoconf, $missing_dir) -AM_MISSING_PROG(AUTOMAKE, automake, $missing_dir) -AM_MISSING_PROG(AUTOHEADER, autoheader, $missing_dir) -AM_MISSING_PROG(MAKEINFO, makeinfo, $missing_dir) -AC_REQUIRE([AC_PROG_MAKE_SET])]) - - -# serial 1 - -AC_DEFUN(AM_PROG_INSTALL, -[AC_REQUIRE([AC_PROG_INSTALL]) -test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL_PROGRAM}' -AC_SUBST(INSTALL_SCRIPT)dnl -]) - -# -# Check to make sure that the build environment is sane. -# - -AC_DEFUN(AM_SANITY_CHECK, -[AC_MSG_CHECKING([whether build environment is sane]) -# Just in case -sleep 1 -echo timestamp > conftestfile -# Do `set' in a subshell so we don't clobber the current shell's -# arguments. Must try -L first in case configure is actually a -# symlink; some systems play weird games with the mod time of symlinks -# (eg FreeBSD returns the mod time of the symlink's containing -# directory). -if ( - set X `ls -Lt $srcdir/configure conftestfile 2> /dev/null` - if test "[$]*" = "X"; then - # -L didn't work. - set X `ls -t $srcdir/configure conftestfile` - fi - if test "[$]*" != "X $srcdir/configure conftestfile" \ - && test "[$]*" != "X conftestfile $srcdir/configure"; then - - # If neither matched, then we have a broken ls. This can happen - # if, for instance, CONFIG_SHELL is bash and it inherits a - # broken ls alias from the environment. This has actually - # happened. Such a system could not be considered "sane". - AC_MSG_ERROR([ls -t appears to fail. Make sure there is not a broken -alias in your environment]) - fi - - test "[$]2" = conftestfile - ) -then - # Ok. - : -else - AC_MSG_ERROR([newly created file is older than distributed files! -Check your system clock]) -fi -rm -f conftest* -AC_MSG_RESULT(yes)]) - -dnl AM_MISSING_PROG(NAME, PROGRAM, DIRECTORY) -dnl The program must properly implement --version. -AC_DEFUN(AM_MISSING_PROG, -[AC_MSG_CHECKING(for working $2) -# Run test in a subshell; some versions of sh will print an error if -# an executable is not found, even if stderr is redirected. -# Redirect stdin to placate older versions of autoconf. Sigh. -if ($2 --version) < /dev/null > /dev/null 2>&1; then - $1=$2 - AC_MSG_RESULT(found) -else - $1="$3/missing $2" - AC_MSG_RESULT(missing) -fi -AC_SUBST($1)]) - - -# serial 24 AM_PROG_LIBTOOL -AC_DEFUN(AM_PROG_LIBTOOL, -[AC_REQUIRE([AM_ENABLE_SHARED])dnl -AC_REQUIRE([AM_ENABLE_STATIC])dnl -AC_REQUIRE([AC_CANONICAL_HOST])dnl -AC_REQUIRE([AC_PROG_RANLIB])dnl -AC_REQUIRE([AC_PROG_CC])dnl -AC_REQUIRE([AM_PROG_LD])dnl -AC_REQUIRE([AM_PROG_NM])dnl -AC_REQUIRE([AC_PROG_LN_S])dnl -dnl -# Always use our own libtool. -LIBTOOL='$(SHELL) $(top_builddir)/libtool' -AC_SUBST(LIBTOOL)dnl - -# Check for any special flags to pass to ltconfig. -libtool_flags= -test "$enable_shared" = no && libtool_flags="$libtool_flags --disable-shared" -test "$enable_static" = no && libtool_flags="$libtool_flags --disable-static" -test "$silent" = yes && libtool_flags="$libtool_flags --silent" -test "$ac_cv_prog_gcc" = yes && libtool_flags="$libtool_flags --with-gcc" -test "$ac_cv_prog_gnu_ld" = yes && libtool_flags="$libtool_flags --with-gnu-ld" - -# Some flags need to be propagated to the compiler or linker for good -# libtool support. -case "$host" in -*-*-irix6*) - # Find out which ABI we are using. - echo '[#]line __oline__ "configure"' > conftest.$ac_ext - if AC_TRY_EVAL(ac_compile); then - case "`/usr/bin/file conftest.o`" in - *32-bit*) - LD="${LD-ld} -32" - ;; - *N32*) - LD="${LD-ld} -n32" - ;; - *64-bit*) - LD="${LD-ld} -64" - ;; - esac - fi - rm -rf conftest* - ;; - -*-*-sco3.2v5*) - # On SCO OpenServer 5, we need -belf to get full-featured binaries. - CFLAGS="$CFLAGS -belf" - ;; -esac - -# Actually configure libtool. ac_aux_dir is where install-sh is found. -CC="$CC" CFLAGS="$CFLAGS" CPPFLAGS="$CPPFLAGS" \ -LD="$LD" NM="$NM" RANLIB="$RANLIB" LN_S="$LN_S" \ -${CONFIG_SHELL-/bin/sh} $ac_aux_dir/ltconfig \ -$libtool_flags --no-verify $ac_aux_dir/ltmain.sh $host \ -|| AC_MSG_ERROR([libtool configure failed]) -]) - -# AM_ENABLE_SHARED - implement the --enable-shared flag -# Usage: AM_ENABLE_SHARED[(DEFAULT)] -# Where DEFAULT is either `yes' or `no'. If omitted, it defaults to -# `yes'. -AC_DEFUN(AM_ENABLE_SHARED, -[define([AM_ENABLE_SHARED_DEFAULT], ifelse($1, no, no, yes))dnl -AC_ARG_ENABLE(shared, -changequote(<<, >>)dnl -<< --enable-shared build shared libraries [default=>>AM_ENABLE_SHARED_DEFAULT] -changequote([, ])dnl -[ --enable-shared=PKGS only build shared libraries if the current package - appears as an element in the PKGS list], -[p=${PACKAGE-default} -case "$enableval" in -yes) enable_shared=yes ;; -no) enable_shared=no ;; -*) - enable_shared=no - # Look at the argument we got. We use all the common list separators. - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:," - for pkg in $enableval; do - if test "X$pkg" = "X$p"; then - enable_shared=yes - fi - done - IFS="$ac_save_ifs" - ;; -esac], -enable_shared=AM_ENABLE_SHARED_DEFAULT)dnl -]) - -# AM_DISABLE_SHARED - set the default shared flag to --disable-shared -AC_DEFUN(AM_DISABLE_SHARED, -[AM_ENABLE_SHARED(no)]) - -# AM_DISABLE_STATIC - set the default static flag to --disable-static -AC_DEFUN(AM_DISABLE_STATIC, -[AM_ENABLE_STATIC(no)]) - -# AM_ENABLE_STATIC - implement the --enable-static flag -# Usage: AM_ENABLE_STATIC[(DEFAULT)] -# Where DEFAULT is either `yes' or `no'. If omitted, it defaults to -# `yes'. -AC_DEFUN(AM_ENABLE_STATIC, -[define([AM_ENABLE_STATIC_DEFAULT], ifelse($1, no, no, yes))dnl -AC_ARG_ENABLE(static, -changequote(<<, >>)dnl -<< --enable-static build static libraries [default=>>AM_ENABLE_STATIC_DEFAULT] -changequote([, ])dnl -[ --enable-static=PKGS only build shared libraries if the current package - appears as an element in the PKGS list], -[p=${PACKAGE-default} -case "$enableval" in -yes) enable_static=yes ;; -no) enable_static=no ;; -*) - enable_static=no - # Look at the argument we got. We use all the common list separators. - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:," - for pkg in $enableval; do - if test "X$pkg" = "X$p"; then - enable_static=yes - fi - done - IFS="$ac_save_ifs" - ;; -esac], -enable_static=AM_ENABLE_STATIC_DEFAULT)dnl -]) - - -# AM_PROG_LD - find the path to the GNU or non-GNU linker -AC_DEFUN(AM_PROG_LD, -[AC_ARG_WITH(gnu-ld, -[ --with-gnu-ld assume the C compiler uses GNU ld [default=no]], -test "$withval" = no || with_gnu_ld=yes, with_gnu_ld=no) -AC_REQUIRE([AC_PROG_CC]) -ac_prog=ld -if test "$ac_cv_prog_gcc" = yes; then - # Check if gcc -print-prog-name=ld gives a path. - AC_MSG_CHECKING([for ld used by GCC]) - ac_prog=`($CC -print-prog-name=ld) 2>&5` - case "$ac_prog" in - # Accept absolute paths. -changequote(,)dnl - /* | [A-Za-z]:\\*) -changequote([,])dnl - test -z "$LD" && LD="$ac_prog" - ;; - "") - # If it fails, then pretend we aren't using GCC. - ac_prog=ld - ;; - *) - # If it is relative, then search for the first ld in PATH. - with_gnu_ld=unknown - ;; - esac -elif test "$with_gnu_ld" = yes; then - AC_MSG_CHECKING([for GNU ld]) -else - AC_MSG_CHECKING([for non-GNU ld]) -fi -AC_CACHE_VAL(ac_cv_path_LD, -[if test -z "$LD"; then - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:" - for ac_dir in $PATH; do - test -z "$ac_dir" && ac_dir=. - if test -f "$ac_dir/$ac_prog"; then - ac_cv_path_LD="$ac_dir/$ac_prog" - # Check to see if the program is GNU ld. I'd rather use --version, - # but apparently some GNU ld's only accept -v. - # Break only if it was the GNU/non-GNU ld that we prefer. - if "$ac_cv_path_LD" -v 2>&1 < /dev/null | egrep '(GNU|with BFD)' > /dev/null; then - test "$with_gnu_ld" != no && break - else - test "$with_gnu_ld" != yes && break - fi - fi - done - IFS="$ac_save_ifs" -else - ac_cv_path_LD="$LD" # Let the user override the test with a path. -fi]) -LD="$ac_cv_path_LD" -if test -n "$LD"; then - AC_MSG_RESULT($LD) -else - AC_MSG_RESULT(no) -fi -test -z "$LD" && AC_MSG_ERROR([no acceptable ld found in \$PATH]) -AC_SUBST(LD) -AM_PROG_LD_GNU -]) - -AC_DEFUN(AM_PROG_LD_GNU, -[AC_CACHE_CHECK([if the linker ($LD) is GNU ld], ac_cv_prog_gnu_ld, -[# I'd rather use --version here, but apparently some GNU ld's only accept -v. -if $LD -v 2>&1 &5; then - ac_cv_prog_gnu_ld=yes -else - ac_cv_prog_gnu_ld=no -fi]) -]) - -# AM_PROG_NM - find the path to a BSD-compatible name lister -AC_DEFUN(AM_PROG_NM, -[AC_MSG_CHECKING([for BSD-compatible nm]) -AC_CACHE_VAL(ac_cv_path_NM, -[case "$NM" in -changequote(,)dnl -/* | [A-Za-z]:\\*) -changequote([,])dnl - ac_cv_path_NM="$NM" # Let the user override the test with a path. - ;; -*) - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:" - for ac_dir in /usr/ucb /usr/ccs/bin $PATH /bin; do - test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/nm; then - # Check to see if the nm accepts a BSD-compat flag. - # Adding the `sed 1q' prevents false positives on HP-UX, which says: - # nm: unknown option "B" ignored - if ($ac_dir/nm -B /dev/null 2>&1 | sed '1q'; exit 0) | egrep /dev/null >/dev/null; then - ac_cv_path_NM="$ac_dir/nm -B" - elif ($ac_dir/nm -p /dev/null 2>&1 | sed '1q'; exit 0) | egrep /dev/null >/dev/null; then - ac_cv_path_NM="$ac_dir/nm -p" - else - ac_cv_path_NM="$ac_dir/nm" - fi - break - fi - done - IFS="$ac_save_ifs" - test -z "$ac_cv_path_NM" && ac_cv_path_NM=nm - ;; -esac]) -NM="$ac_cv_path_NM" -AC_MSG_RESULT([$NM]) -AC_SUBST(NM) -]) - -# Like AC_CONFIG_HEADER, but automatically create stamp file. - -AC_DEFUN(AM_CONFIG_HEADER, -[AC_PREREQ([2.12]) -AC_CONFIG_HEADER([$1]) -dnl When config.status generates a header, we must update the stamp-h file. -dnl This file resides in the same directory as the config header -dnl that is generated. We must strip everything past the first ":", -dnl and everything past the last "/". -AC_OUTPUT_COMMANDS(changequote(<<,>>)dnl -ifelse(patsubst(<<$1>>, <<[^ ]>>, <<>>), <<>>, -<>CONFIG_HEADERS" || echo timestamp > patsubst(<<$1>>, <<^\([^:]*/\)?.*>>, <<\1>>)stamp-h<<>>dnl>>, -<>; do - case " <<$>>CONFIG_HEADERS " in - *" <<$>>am_file "*<<)>> - echo timestamp > `echo <<$>>am_file | sed -e 's%:.*%%' -e 's%[^/]*$%%'`stamp-h$am_indx - ;; - esac - am_indx=`expr "<<$>>am_indx" + 1` -done<<>>dnl>>) -changequote([,]))]) - -# Check to see if we're running under Cygwin32, without using -# AC_CANONICAL_*. If so, set output variable CYGWIN32 to "yes". -# Otherwise set it to "no". - -dnl AM_CYGWIN32() -AC_DEFUN(AM_CYGWIN32, -[AC_CACHE_CHECK(for Cygwin32 environment, am_cv_cygwin32, -[AC_TRY_COMPILE(,[return __CYGWIN32__;], -am_cv_cygwin32=yes, am_cv_cygwin32=no) -rm -f conftest*]) -CYGWIN32= -test "$am_cv_cygwin32" = yes && CYGWIN32=yes]) - -# Check to see if we're running under Win32, without using -# AC_CANONICAL_*. If so, set output variable EXEEXT to ".exe". -# Otherwise set it to "". - -dnl AM_EXEEXT() -dnl This knows we add .exe if we're building in the Cygwin32 -dnl environment. But if we're not, then it compiles a test program -dnl to see if there is a suffix for executables. -AC_DEFUN(AM_EXEEXT, -[AC_REQUIRE([AM_CYGWIN32]) -AC_REQUIRE([AM_MINGW32]) -AC_MSG_CHECKING([for executable suffix]) -AC_CACHE_VAL(am_cv_exeext, -[if test "$CYGWIN32" = yes || test "$MINGW32" = yes; then -am_cv_exeext=.exe -else -cat > am_c_test.c << 'EOF' -int main() { -/* Nothing needed here */ -} -EOF -${CC-cc} -o am_c_test $CFLAGS $CPPFLAGS $LDFLAGS am_c_test.c $LIBS 1>&5 -am_cv_exeext=`echo am_c_test.* | grep -v am_c_test.c | sed -e s/am_c_test//` -rm -f am_c_test*]) -test x"${am_cv_exeext}" = x && am_cv_exeext=no -fi -EXEEXT="" -test x"${am_cv_exeext}" != xno && EXEEXT=${am_cv_exeext} -AC_MSG_RESULT(${am_cv_exeext}) -AC_SUBST(EXEEXT)]) - -# Check to see if we're running under Mingw, without using -# AC_CANONICAL_*. If so, set output variable MINGW32 to "yes". -# Otherwise set it to "no". - -dnl AM_MINGW32() -AC_DEFUN(AM_MINGW32, -[AC_CACHE_CHECK(for Mingw32 environment, am_cv_mingw32, -[AC_TRY_COMPILE(,[return __MINGW32__;], -am_cv_mingw32=yes, am_cv_mingw32=no) -rm -f conftest*]) -MINGW32= -test "$am_cv_mingw32" = yes && MINGW32=yes]) - -# Add --enable-maintainer-mode option to configure. -# From Jim Meyering - -# serial 1 - -AC_DEFUN(AM_MAINTAINER_MODE, -[AC_MSG_CHECKING([whether to enable maintainer-specific portions of Makefiles]) - dnl maintainer-mode is disabled by default - AC_ARG_ENABLE(maintainer-mode, -[ --enable-maintainer-mode enable make rules and dependencies not useful - (and sometimes confusing) to the casual installer], - USE_MAINTAINER_MODE=$enableval, - USE_MAINTAINER_MODE=no) - AC_MSG_RESULT($USE_MAINTAINER_MODE) - if test $USE_MAINTAINER_MODE = yes; then - MAINT= - else - MAINT='#M#' - fi - AC_SUBST(MAINT)dnl -] -) - diff --git a/gnu/dist/ld/config.in b/gnu/dist/ld/config.in deleted file mode 100644 index a9de5b8c82a1..000000000000 --- a/gnu/dist/ld/config.in +++ /dev/null @@ -1,52 +0,0 @@ -/* config.in. Generated automatically from configure.in by autoheader. */ - -/* Name of package. */ -#undef PACKAGE - -/* Version of package. */ -#undef VERSION - -/* Whether strstr must be declared even if is included. */ -#undef NEED_DECLARATION_STRSTR - -/* Whether free must be declared even if is included. */ -#undef NEED_DECLARATION_FREE - -/* Whether sbrk must be declared even if is included. */ -#undef NEED_DECLARATION_SBRK - -/* Whether getenv must be declared even if is included. */ -#undef NEED_DECLARATION_GETENV - -/* Define if lex declares yytext as a char * by default, not a char[]. */ -#undef YYTEXT_POINTER - -/* Do we need to use the b modifier when opening binary files? */ -#undef USE_BINARY_FOPEN - -/* Define if you have the sbrk function. */ -#undef HAVE_SBRK - -/* Define if you have the header file. */ -#undef HAVE_DIRENT_H - -/* Define if you have the header file. */ -#undef HAVE_NDIR_H - -/* Define if you have the header file. */ -#undef HAVE_STDLIB_H - -/* Define if you have the header file. */ -#undef HAVE_STRING_H - -/* Define if you have the header file. */ -#undef HAVE_STRINGS_H - -/* Define if you have the header file. */ -#undef HAVE_SYS_DIR_H - -/* Define if you have the header file. */ -#undef HAVE_SYS_NDIR_H - -/* Define if you have the header file. */ -#undef HAVE_UNISTD_H diff --git a/gnu/dist/ld/configdoc.texi b/gnu/dist/ld/configdoc.texi deleted file mode 100644 index 3a367277e501..000000000000 --- a/gnu/dist/ld/configdoc.texi +++ /dev/null @@ -1,13 +0,0 @@ -@c ------------------------------ CONFIGURATION VARS: -@c 1. Inclusiveness of this manual -@set GENERIC - -@c 2. Specific target machines -@set H8300 -@set I960 - -@c 3. Properties of this configuration -@clear SingleFormat -@set UsesEnvVars -@c ------------------------------ end CONFIGURATION VARS - diff --git a/gnu/dist/ld/configure b/gnu/dist/ld/configure deleted file mode 100644 index d15e3d260b14..000000000000 --- a/gnu/dist/ld/configure +++ /dev/null @@ -1,2757 +0,0 @@ -#! /bin/sh - -# Guess values for system-dependent variables and create Makefiles. -# Generated automatically using autoconf version 2.12.1 -# Copyright (C) 1992, 93, 94, 95, 96 Free Software Foundation, Inc. -# -# This configure script is free software; the Free Software Foundation -# gives unlimited permission to copy, distribute and modify it. - -# Defaults: -ac_help= -ac_default_prefix=/usr/local -# Any additions from configure.in: -ac_help="$ac_help - --enable-shared build shared libraries [default=yes] - --enable-shared=PKGS only build shared libraries if the current package - appears as an element in the PKGS list" -ac_help="$ac_help - --enable-static build static libraries [default=yes] - --enable-static=PKGS only build shared libraries if the current package - appears as an element in the PKGS list" -ac_help="$ac_help - --with-gnu-ld assume the C compiler uses GNU ld [default=no]" -ac_help="$ac_help - --enable-targets alternative target configurations" -ac_help="$ac_help - --enable-64-bit-bfd 64-bit support (on hosts with narrower word sizes)" -ac_help="$ac_help - --enable-maintainer-mode enable make rules and dependencies not useful - (and sometimes confusing) to the casual installer" - -# Initialize some variables set by options. -# The variables have the same names as the options, with -# dashes changed to underlines. -build=NONE -cache_file=./config.cache -exec_prefix=NONE -host=NONE -no_create= -nonopt=NONE -no_recursion= -prefix=NONE -program_prefix=NONE -program_suffix=NONE -program_transform_name=s,x,x, -silent= -site= -srcdir= -target=NONE -verbose= -x_includes=NONE -x_libraries=NONE -bindir='${exec_prefix}/bin' -sbindir='${exec_prefix}/sbin' -libexecdir='${exec_prefix}/libexec' -datadir='${prefix}/share' -sysconfdir='${prefix}/etc' -sharedstatedir='${prefix}/com' -localstatedir='${prefix}/var' -libdir='${exec_prefix}/lib' -includedir='${prefix}/include' -oldincludedir='/usr/include' -infodir='${prefix}/info' -mandir='${prefix}/man' - -# Initialize some other variables. -subdirs= -MFLAGS= MAKEFLAGS= -SHELL=${CONFIG_SHELL-/bin/sh} -# Maximum number of lines to put in a shell here document. -ac_max_here_lines=12 - -ac_prev= -for ac_option -do - - # If the previous option needs an argument, assign it. - if test -n "$ac_prev"; then - eval "$ac_prev=\$ac_option" - ac_prev= - continue - fi - - case "$ac_option" in - -*=*) ac_optarg=`echo "$ac_option" | sed 's/[-_a-zA-Z0-9]*=//'` ;; - *) ac_optarg= ;; - esac - - # Accept the important Cygnus configure options, so we can diagnose typos. - - case "$ac_option" in - - -bindir | --bindir | --bindi | --bind | --bin | --bi) - ac_prev=bindir ;; - -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*) - bindir="$ac_optarg" ;; - - -build | --build | --buil | --bui | --bu) - ac_prev=build ;; - -build=* | --build=* | --buil=* | --bui=* | --bu=*) - build="$ac_optarg" ;; - - -cache-file | --cache-file | --cache-fil | --cache-fi \ - | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c) - ac_prev=cache_file ;; - -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \ - | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*) - cache_file="$ac_optarg" ;; - - -datadir | --datadir | --datadi | --datad | --data | --dat | --da) - ac_prev=datadir ;; - -datadir=* | --datadir=* | --datadi=* | --datad=* | --data=* | --dat=* \ - | --da=*) - datadir="$ac_optarg" ;; - - -disable-* | --disable-*) - ac_feature=`echo $ac_option|sed -e 's/-*disable-//'` - # Reject names that are not valid shell variable names. - if test -n "`echo $ac_feature| sed 's/[-a-zA-Z0-9_]//g'`"; then - { echo "configure: error: $ac_feature: invalid feature name" 1>&2; exit 1; } - fi - ac_feature=`echo $ac_feature| sed 's/-/_/g'` - eval "enable_${ac_feature}=no" ;; - - -enable-* | --enable-*) - ac_feature=`echo $ac_option|sed -e 's/-*enable-//' -e 's/=.*//'` - # Reject names that are not valid shell variable names. - if test -n "`echo $ac_feature| sed 's/[-_a-zA-Z0-9]//g'`"; then - { echo "configure: error: $ac_feature: invalid feature name" 1>&2; exit 1; } - fi - ac_feature=`echo $ac_feature| sed 's/-/_/g'` - case "$ac_option" in - *=*) ;; - *) ac_optarg=yes ;; - esac - eval "enable_${ac_feature}='$ac_optarg'" ;; - - -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \ - | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \ - | --exec | --exe | --ex) - ac_prev=exec_prefix ;; - -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \ - | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \ - | --exec=* | --exe=* | --ex=*) - exec_prefix="$ac_optarg" ;; - - -gas | --gas | --ga | --g) - # Obsolete; use --with-gas. - with_gas=yes ;; - - -help | --help | --hel | --he) - # Omit some internal or obsolete options to make the list less imposing. - # This message is too long to be a string in the A/UX 3.1 sh. - cat << EOF -Usage: configure [options] [host] -Options: [defaults in brackets after descriptions] -Configuration: - --cache-file=FILE cache test results in FILE - --help print this message - --no-create do not create output files - --quiet, --silent do not print \`checking...' messages - --version print the version of autoconf that created configure -Directory and file names: - --prefix=PREFIX install architecture-independent files in PREFIX - [$ac_default_prefix] - --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX - [same as prefix] - --bindir=DIR user executables in DIR [EPREFIX/bin] - --sbindir=DIR system admin executables in DIR [EPREFIX/sbin] - --libexecdir=DIR program executables in DIR [EPREFIX/libexec] - --datadir=DIR read-only architecture-independent data in DIR - [PREFIX/share] - --sysconfdir=DIR read-only single-machine data in DIR [PREFIX/etc] - --sharedstatedir=DIR modifiable architecture-independent data in DIR - [PREFIX/com] - --localstatedir=DIR modifiable single-machine data in DIR [PREFIX/var] - --libdir=DIR object code libraries in DIR [EPREFIX/lib] - --includedir=DIR C header files in DIR [PREFIX/include] - --oldincludedir=DIR C header files for non-gcc in DIR [/usr/include] - --infodir=DIR info documentation in DIR [PREFIX/info] - --mandir=DIR man documentation in DIR [PREFIX/man] - --srcdir=DIR find the sources in DIR [configure dir or ..] - --program-prefix=PREFIX prepend PREFIX to installed program names - --program-suffix=SUFFIX append SUFFIX to installed program names - --program-transform-name=PROGRAM - run sed PROGRAM on installed program names -EOF - cat << EOF -Host type: - --build=BUILD configure for building on BUILD [BUILD=HOST] - --host=HOST configure for HOST [guessed] - --target=TARGET configure for TARGET [TARGET=HOST] -Features and packages: - --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) - --enable-FEATURE[=ARG] include FEATURE [ARG=yes] - --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] - --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) - --x-includes=DIR X include files are in DIR - --x-libraries=DIR X library files are in DIR -EOF - if test -n "$ac_help"; then - echo "--enable and --with options recognized:$ac_help" - fi - exit 0 ;; - - -host | --host | --hos | --ho) - ac_prev=host ;; - -host=* | --host=* | --hos=* | --ho=*) - host="$ac_optarg" ;; - - -includedir | --includedir | --includedi | --included | --include \ - | --includ | --inclu | --incl | --inc) - ac_prev=includedir ;; - -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \ - | --includ=* | --inclu=* | --incl=* | --inc=*) - includedir="$ac_optarg" ;; - - -infodir | --infodir | --infodi | --infod | --info | --inf) - ac_prev=infodir ;; - -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*) - infodir="$ac_optarg" ;; - - -libdir | --libdir | --libdi | --libd) - ac_prev=libdir ;; - -libdir=* | --libdir=* | --libdi=* | --libd=*) - libdir="$ac_optarg" ;; - - -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \ - | --libexe | --libex | --libe) - ac_prev=libexecdir ;; - -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \ - | --libexe=* | --libex=* | --libe=*) - libexecdir="$ac_optarg" ;; - - -localstatedir | --localstatedir | --localstatedi | --localstated \ - | --localstate | --localstat | --localsta | --localst \ - | --locals | --local | --loca | --loc | --lo) - ac_prev=localstatedir ;; - -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ - | --localstate=* | --localstat=* | --localsta=* | --localst=* \ - | --locals=* | --local=* | --loca=* | --loc=* | --lo=*) - localstatedir="$ac_optarg" ;; - - -mandir | --mandir | --mandi | --mand | --man | --ma | --m) - ac_prev=mandir ;; - -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*) - mandir="$ac_optarg" ;; - - -nfp | --nfp | --nf) - # Obsolete; use --without-fp. - with_fp=no ;; - - -no-create | --no-create | --no-creat | --no-crea | --no-cre \ - | --no-cr | --no-c) - no_create=yes ;; - - -no-recursion | --no-recursion | --no-recursio | --no-recursi \ - | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) - no_recursion=yes ;; - - -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \ - | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \ - | --oldin | --oldi | --old | --ol | --o) - ac_prev=oldincludedir ;; - -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \ - | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \ - | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*) - oldincludedir="$ac_optarg" ;; - - -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) - ac_prev=prefix ;; - -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) - prefix="$ac_optarg" ;; - - -program-prefix | --program-prefix | --program-prefi | --program-pref \ - | --program-pre | --program-pr | --program-p) - ac_prev=program_prefix ;; - -program-prefix=* | --program-prefix=* | --program-prefi=* \ - | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*) - program_prefix="$ac_optarg" ;; - - -program-suffix | --program-suffix | --program-suffi | --program-suff \ - | --program-suf | --program-su | --program-s) - ac_prev=program_suffix ;; - -program-suffix=* | --program-suffix=* | --program-suffi=* \ - | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*) - program_suffix="$ac_optarg" ;; - - -program-transform-name | --program-transform-name \ - | --program-transform-nam | --program-transform-na \ - | --program-transform-n | --program-transform- \ - | --program-transform | --program-transfor \ - | --program-transfo | --program-transf \ - | --program-trans | --program-tran \ - | --progr-tra | --program-tr | --program-t) - ac_prev=program_transform_name ;; - -program-transform-name=* | --program-transform-name=* \ - | --program-transform-nam=* | --program-transform-na=* \ - | --program-transform-n=* | --program-transform-=* \ - | --program-transform=* | --program-transfor=* \ - | --program-transfo=* | --program-transf=* \ - | --program-trans=* | --program-tran=* \ - | --progr-tra=* | --program-tr=* | --program-t=*) - program_transform_name="$ac_optarg" ;; - - -q | -quiet | --quiet | --quie | --qui | --qu | --q \ - | -silent | --silent | --silen | --sile | --sil) - silent=yes ;; - - -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) - ac_prev=sbindir ;; - -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ - | --sbi=* | --sb=*) - sbindir="$ac_optarg" ;; - - -sharedstatedir | --sharedstatedir | --sharedstatedi \ - | --sharedstated | --sharedstate | --sharedstat | --sharedsta \ - | --sharedst | --shareds | --shared | --share | --shar \ - | --sha | --sh) - ac_prev=sharedstatedir ;; - -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \ - | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \ - | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \ - | --sha=* | --sh=*) - sharedstatedir="$ac_optarg" ;; - - -site | --site | --sit) - ac_prev=site ;; - -site=* | --site=* | --sit=*) - site="$ac_optarg" ;; - - -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) - ac_prev=srcdir ;; - -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) - srcdir="$ac_optarg" ;; - - -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \ - | --syscon | --sysco | --sysc | --sys | --sy) - ac_prev=sysconfdir ;; - -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \ - | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*) - sysconfdir="$ac_optarg" ;; - - -target | --target | --targe | --targ | --tar | --ta | --t) - ac_prev=target ;; - -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*) - target="$ac_optarg" ;; - - -v | -verbose | --verbose | --verbos | --verbo | --verb) - verbose=yes ;; - - -version | --version | --versio | --versi | --vers) - echo "configure generated by autoconf version 2.12.1" - exit 0 ;; - - -with-* | --with-*) - ac_package=`echo $ac_option|sed -e 's/-*with-//' -e 's/=.*//'` - # Reject names that are not valid shell variable names. - if test -n "`echo $ac_package| sed 's/[-_a-zA-Z0-9]//g'`"; then - { echo "configure: error: $ac_package: invalid package name" 1>&2; exit 1; } - fi - ac_package=`echo $ac_package| sed 's/-/_/g'` - case "$ac_option" in - *=*) ;; - *) ac_optarg=yes ;; - esac - eval "with_${ac_package}='$ac_optarg'" ;; - - -without-* | --without-*) - ac_package=`echo $ac_option|sed -e 's/-*without-//'` - # Reject names that are not valid shell variable names. - if test -n "`echo $ac_package| sed 's/[-a-zA-Z0-9_]//g'`"; then - { echo "configure: error: $ac_package: invalid package name" 1>&2; exit 1; } - fi - ac_package=`echo $ac_package| sed 's/-/_/g'` - eval "with_${ac_package}=no" ;; - - --x) - # Obsolete; use --with-x. - with_x=yes ;; - - -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \ - | --x-incl | --x-inc | --x-in | --x-i) - ac_prev=x_includes ;; - -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \ - | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*) - x_includes="$ac_optarg" ;; - - -x-libraries | --x-libraries | --x-librarie | --x-librari \ - | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l) - ac_prev=x_libraries ;; - -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \ - | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*) - x_libraries="$ac_optarg" ;; - - -*) { echo "configure: error: $ac_option: invalid option; use --help to show usage" 1>&2; exit 1; } - ;; - - *) - if test -n "`echo $ac_option| sed 's/[-a-z0-9.]//g'`"; then - echo "configure: warning: $ac_option: invalid host type" 1>&2 - fi - if test "x$nonopt" != xNONE; then - { echo "configure: error: can only configure for one host and one target at a time" 1>&2; exit 1; } - fi - nonopt="$ac_option" - ;; - - esac -done - -if test -n "$ac_prev"; then - { echo "configure: error: missing argument to --`echo $ac_prev | sed 's/_/-/g'`" 1>&2; exit 1; } -fi - -trap 'rm -fr conftest* confdefs* core core.* *.core $ac_clean_files; exit 1' 1 2 15 - -# File descriptor usage: -# 0 standard input -# 1 file creation -# 2 errors and warnings -# 3 some systems may open it to /dev/tty -# 4 used on the Kubota Titan -# 6 checking for... messages and results -# 5 compiler messages saved in config.log -if test "$silent" = yes; then - exec 6>/dev/null -else - exec 6>&1 -fi -exec 5>./config.log - -echo "\ -This file contains any messages produced by compilers while -running configure, to aid debugging if configure makes a mistake. -" 1>&5 - -# Strip out --no-create and --no-recursion so they do not pile up. -# Also quote any args containing shell metacharacters. -ac_configure_args= -for ac_arg -do - case "$ac_arg" in - -no-create | --no-create | --no-creat | --no-crea | --no-cre \ - | --no-cr | --no-c) ;; - -no-recursion | --no-recursion | --no-recursio | --no-recursi \ - | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) ;; - *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?]*) - ac_configure_args="$ac_configure_args '$ac_arg'" ;; - *) ac_configure_args="$ac_configure_args $ac_arg" ;; - esac -done - -# NLS nuisances. -# Only set these to C if already set. These must not be set unconditionally -# because not all systems understand e.g. LANG=C (notably SCO). -# Fixing LC_MESSAGES prevents Solaris sh from translating var values in `set'! -# Non-C LC_CTYPE values break the ctype check. -if test "${LANG+set}" = set; then LANG=C; export LANG; fi -if test "${LC_ALL+set}" = set; then LC_ALL=C; export LC_ALL; fi -if test "${LC_MESSAGES+set}" = set; then LC_MESSAGES=C; export LC_MESSAGES; fi -if test "${LC_CTYPE+set}" = set; then LC_CTYPE=C; export LC_CTYPE; fi - -# confdefs.h avoids OS command line length limits that DEFS can exceed. -rm -rf conftest* confdefs.h -# AIX cpp loses on an empty file, so make sure it contains at least a newline. -echo > confdefs.h - -# A filename unique to this package, relative to the directory that -# configure is in, which we can look for to find out if srcdir is correct. -ac_unique_file=ldmain.c - -# Find the source files, if location was not specified. -if test -z "$srcdir"; then - ac_srcdir_defaulted=yes - # Try the directory containing this script, then its parent. - ac_prog=$0 - ac_confdir=`echo $ac_prog|sed 's%/[^/][^/]*$%%'` - test "x$ac_confdir" = "x$ac_prog" && ac_confdir=. - srcdir=$ac_confdir - if test ! -r $srcdir/$ac_unique_file; then - srcdir=.. - fi -else - ac_srcdir_defaulted=no -fi -if test ! -r $srcdir/$ac_unique_file; then - if test "$ac_srcdir_defaulted" = yes; then - { echo "configure: error: can not find sources in $ac_confdir or .." 1>&2; exit 1; } - else - { echo "configure: error: can not find sources in $srcdir" 1>&2; exit 1; } - fi -fi -srcdir=`echo "${srcdir}" | sed 's%\([^/]\)/*$%\1%'` - -# Prefer explicitly selected file to automatically selected ones. -if test -z "$CONFIG_SITE"; then - if test "x$prefix" != xNONE; then - CONFIG_SITE="$prefix/share/config.site $prefix/etc/config.site" - else - CONFIG_SITE="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site" - fi -fi -for ac_site_file in $CONFIG_SITE; do - if test -r "$ac_site_file"; then - echo "loading site script $ac_site_file" - . "$ac_site_file" - fi -done - -if test -r "$cache_file"; then - echo "loading cache $cache_file" - . $cache_file -else - echo "creating cache $cache_file" - > $cache_file -fi - -ac_ext=c -# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. -ac_cpp='$CPP $CPPFLAGS' -ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' -ac_link='${CC-cc} -o conftest $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' -cross_compiling=$ac_cv_prog_cc_cross - -if (echo "testing\c"; echo 1,2,3) | grep c >/dev/null; then - # Stardent Vistra SVR4 grep lacks -e, says ghazi@caip.rutgers.edu. - if (echo -n testing; echo 1,2,3) | sed s/-n/xn/ | grep xn >/dev/null; then - ac_n= ac_c=' -' ac_t=' ' - else - ac_n=-n ac_c= ac_t= - fi -else - ac_n= ac_c='\c' ac_t= -fi - - - -ac_aux_dir= -for ac_dir in $srcdir $srcdir/.. $srcdir/../..; do - if test -f $ac_dir/install-sh; then - ac_aux_dir=$ac_dir - ac_install_sh="$ac_aux_dir/install-sh -c" - break - elif test -f $ac_dir/install.sh; then - ac_aux_dir=$ac_dir - ac_install_sh="$ac_aux_dir/install.sh -c" - break - fi -done -if test -z "$ac_aux_dir"; then - { echo "configure: error: can not find install-sh or install.sh in $srcdir $srcdir/.. $srcdir/../.." 1>&2; exit 1; } -fi -ac_config_guess=$ac_aux_dir/config.guess -ac_config_sub=$ac_aux_dir/config.sub -ac_configure=$ac_aux_dir/configure # This should be Cygnus configure. - - -# Do some error checking and defaulting for the host and target type. -# The inputs are: -# configure --host=HOST --target=TARGET --build=BUILD NONOPT -# -# The rules are: -# 1. You are not allowed to specify --host, --target, and nonopt at the -# same time. -# 2. Host defaults to nonopt. -# 3. If nonopt is not specified, then host defaults to the current host, -# as determined by config.guess. -# 4. Target and build default to nonopt. -# 5. If nonopt is not specified, then target and build default to host. - -# The aliases save the names the user supplied, while $host etc. -# will get canonicalized. -case $host---$target---$nonopt in -NONE---*---* | *---NONE---* | *---*---NONE) ;; -*) { echo "configure: error: can only configure for one host and one target at a time" 1>&2; exit 1; } ;; -esac - - -# Make sure we can run config.sub. -if ${CONFIG_SHELL-/bin/sh} $ac_config_sub sun4 >/dev/null 2>&1; then : -else { echo "configure: error: can not run $ac_config_sub" 1>&2; exit 1; } -fi - -echo $ac_n "checking host system type""... $ac_c" 1>&6 -echo "configure:588: checking host system type" >&5 - -host_alias=$host -case "$host_alias" in -NONE) - case $nonopt in - NONE) - if host_alias=`${CONFIG_SHELL-/bin/sh} $ac_config_guess`; then : - else { echo "configure: error: can not guess host type; you must specify one" 1>&2; exit 1; } - fi ;; - *) host_alias=$nonopt ;; - esac ;; -esac - -host=`${CONFIG_SHELL-/bin/sh} $ac_config_sub $host_alias` -host_cpu=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` -host_vendor=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'` -host_os=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` -echo "$ac_t""$host" 1>&6 - -echo $ac_n "checking target system type""... $ac_c" 1>&6 -echo "configure:609: checking target system type" >&5 - -target_alias=$target -case "$target_alias" in -NONE) - case $nonopt in - NONE) target_alias=$host_alias ;; - *) target_alias=$nonopt ;; - esac ;; -esac - -target=`${CONFIG_SHELL-/bin/sh} $ac_config_sub $target_alias` -target_cpu=`echo $target | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` -target_vendor=`echo $target | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'` -target_os=`echo $target | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` -echo "$ac_t""$target" 1>&6 - -echo $ac_n "checking build system type""... $ac_c" 1>&6 -echo "configure:627: checking build system type" >&5 - -build_alias=$build -case "$build_alias" in -NONE) - case $nonopt in - NONE) build_alias=$host_alias ;; - *) build_alias=$nonopt ;; - esac ;; -esac - -build=`${CONFIG_SHELL-/bin/sh} $ac_config_sub $build_alias` -build_cpu=`echo $build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` -build_vendor=`echo $build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'` -build_os=`echo $build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` -echo "$ac_t""$build" 1>&6 - -test "$host_alias" != "$target_alias" && - test "$program_prefix$program_suffix$program_transform_name" = \ - NONENONEs,x,x, && - program_prefix=${target_alias}- - - -# Find a good install program. We prefer a C program (faster), -# so one script is as good as another. But avoid the broken or -# incompatible versions: -# SysV /etc/install, /usr/sbin/install -# SunOS /usr/etc/install -# IRIX /sbin/install -# AIX /bin/install -# AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag -# AFS /usr/afsws/bin/install, which mishandles nonexistent args -# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" -# ./install, which can be erroneously created by make from ./install.sh. -echo $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6 -echo "configure:662: checking for a BSD compatible install" >&5 -if test -z "$INSTALL"; then -if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - IFS="${IFS= }"; ac_save_IFS="$IFS"; IFS="${IFS}:" - for ac_dir in $PATH; do - # Account for people who put trailing slashes in PATH elements. - case "$ac_dir/" in - /|./|.//|/etc/*|/usr/sbin/*|/usr/etc/*|/sbin/*|/usr/afsws/bin/*|/usr/ucb/*) ;; - *) - # OSF1 and SCO ODT 3.0 have their own names for install. - # Don't use installbsd from OSF since it installs stuff as root - # by default. - for ac_prog in ginstall scoinst install; do - if test -f $ac_dir/$ac_prog; then - if test $ac_prog = install && - grep dspmsg $ac_dir/$ac_prog >/dev/null 2>&1; then - # AIX install. It has an incompatible calling convention. - : - else - ac_cv_path_install="$ac_dir/$ac_prog -c" - break 2 - fi - fi - done - ;; - esac - done - IFS="$ac_save_IFS" - -fi - if test "${ac_cv_path_install+set}" = set; then - INSTALL="$ac_cv_path_install" - else - # As a last resort, use the slow shell script. We don't cache a - # path for INSTALL within a source directory, because that will - # break other packages using the cache if that directory is - # removed, or if the path is relative. - INSTALL="$ac_install_sh" - fi -fi -echo "$ac_t""$INSTALL" 1>&6 - -# Use test -z because SunOS4 sh mishandles braces in ${var-val}. -# It thinks the first close brace ends the variable substitution. -test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}' - -test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' - - -test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL_PROGRAM}' - -echo $ac_n "checking whether build environment is sane""... $ac_c" 1>&6 -echo "configure:716: checking whether build environment is sane" >&5 -# Just in case -sleep 1 -echo timestamp > conftestfile -# Do `set' in a subshell so we don't clobber the current shell's -# arguments. Must try -L first in case configure is actually a -# symlink; some systems play weird games with the mod time of symlinks -# (eg FreeBSD returns the mod time of the symlink's containing -# directory). -if ( - set X `ls -Lt $srcdir/configure conftestfile 2> /dev/null` - if test "$*" = "X"; then - # -L didn't work. - set X `ls -t $srcdir/configure conftestfile` - fi - if test "$*" != "X $srcdir/configure conftestfile" \ - && test "$*" != "X conftestfile $srcdir/configure"; then - - # If neither matched, then we have a broken ls. This can happen - # if, for instance, CONFIG_SHELL is bash and it inherits a - # broken ls alias from the environment. This has actually - # happened. Such a system could not be considered "sane". - { echo "configure: error: ls -t appears to fail. Make sure there is not a broken -alias in your environment" 1>&2; exit 1; } - fi - - test "$2" = conftestfile - ) -then - # Ok. - : -else - { echo "configure: error: newly created file is older than distributed files! -Check your system clock" 1>&2; exit 1; } -fi -rm -f conftest* -echo "$ac_t""yes" 1>&6 -if test "$program_transform_name" = s,x,x,; then - program_transform_name= -else - # Double any \ or $. echo might interpret backslashes. - cat <<\EOF_SED > conftestsed -s,\\,\\\\,g; s,\$,$$,g -EOF_SED - program_transform_name="`echo $program_transform_name|sed -f conftestsed`" - rm -f conftestsed -fi -test "$program_prefix" != NONE && - program_transform_name="s,^,${program_prefix},; $program_transform_name" -# Use a double $ so make ignores it. -test "$program_suffix" != NONE && - program_transform_name="s,\$\$,${program_suffix},; $program_transform_name" - -# sed with no file args requires a program. -test "$program_transform_name" = "" && program_transform_name="s,x,x," - -echo $ac_n "checking whether ${MAKE-make} sets \${MAKE}""... $ac_c" 1>&6 -echo "configure:773: checking whether ${MAKE-make} sets \${MAKE}" >&5 -set dummy ${MAKE-make}; ac_make=`echo "$2" | sed 'y%./+-%__p_%'` -if eval "test \"`echo '$''{'ac_cv_prog_make_${ac_make}_set'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - cat > conftestmake <<\EOF -all: - @echo 'ac_maketemp="${MAKE}"' -EOF -# GNU make sometimes prints "make[1]: Entering...", which would confuse us. -eval `${MAKE-make} -f conftestmake 2>/dev/null | grep temp=` -if test -n "$ac_maketemp"; then - eval ac_cv_prog_make_${ac_make}_set=yes -else - eval ac_cv_prog_make_${ac_make}_set=no -fi -rm -f conftestmake -fi -if eval "test \"`echo '$ac_cv_prog_make_'${ac_make}_set`\" = yes"; then - echo "$ac_t""yes" 1>&6 - SET_MAKE= -else - echo "$ac_t""no" 1>&6 - SET_MAKE="MAKE=${MAKE-make}" -fi - - -PACKAGE=ld - -VERSION=2.9.1 - -if test "`cd $srcdir && pwd`" != "`pwd`" && test -f $srcdir/config.status; then - { echo "configure: error: source directory already configured; run "make distclean" there first" 1>&2; exit 1; } -fi -cat >> confdefs.h <> confdefs.h <&6 -echo "configure:819: checking for working aclocal" >&5 -# Run test in a subshell; some versions of sh will print an error if -# an executable is not found, even if stderr is redirected. -# Redirect stdin to placate older versions of autoconf. Sigh. -if (aclocal --version) < /dev/null > /dev/null 2>&1; then - ACLOCAL=aclocal - echo "$ac_t""found" 1>&6 -else - ACLOCAL="$missing_dir/missing aclocal" - echo "$ac_t""missing" 1>&6 -fi - -echo $ac_n "checking for working autoconf""... $ac_c" 1>&6 -echo "configure:832: checking for working autoconf" >&5 -# Run test in a subshell; some versions of sh will print an error if -# an executable is not found, even if stderr is redirected. -# Redirect stdin to placate older versions of autoconf. Sigh. -if (autoconf --version) < /dev/null > /dev/null 2>&1; then - AUTOCONF=autoconf - echo "$ac_t""found" 1>&6 -else - AUTOCONF="$missing_dir/missing autoconf" - echo "$ac_t""missing" 1>&6 -fi - -echo $ac_n "checking for working automake""... $ac_c" 1>&6 -echo "configure:845: checking for working automake" >&5 -# Run test in a subshell; some versions of sh will print an error if -# an executable is not found, even if stderr is redirected. -# Redirect stdin to placate older versions of autoconf. Sigh. -if (automake --version) < /dev/null > /dev/null 2>&1; then - AUTOMAKE=automake - echo "$ac_t""found" 1>&6 -else - AUTOMAKE="$missing_dir/missing automake" - echo "$ac_t""missing" 1>&6 -fi - -echo $ac_n "checking for working autoheader""... $ac_c" 1>&6 -echo "configure:858: checking for working autoheader" >&5 -# Run test in a subshell; some versions of sh will print an error if -# an executable is not found, even if stderr is redirected. -# Redirect stdin to placate older versions of autoconf. Sigh. -if (autoheader --version) < /dev/null > /dev/null 2>&1; then - AUTOHEADER=autoheader - echo "$ac_t""found" 1>&6 -else - AUTOHEADER="$missing_dir/missing autoheader" - echo "$ac_t""missing" 1>&6 -fi - -echo $ac_n "checking for working makeinfo""... $ac_c" 1>&6 -echo "configure:871: checking for working makeinfo" >&5 -# Run test in a subshell; some versions of sh will print an error if -# an executable is not found, even if stderr is redirected. -# Redirect stdin to placate older versions of autoconf. Sigh. -if (makeinfo --version) < /dev/null > /dev/null 2>&1; then - MAKEINFO=makeinfo - echo "$ac_t""found" 1>&6 -else - MAKEINFO="$missing_dir/missing makeinfo" - echo "$ac_t""missing" 1>&6 -fi - - - -# Check whether --enable-shared or --disable-shared was given. -if test "${enable_shared+set}" = set; then - enableval="$enable_shared" - p=${PACKAGE-default} -case "$enableval" in -yes) enable_shared=yes ;; -no) enable_shared=no ;; -*) - enable_shared=no - # Look at the argument we got. We use all the common list separators. - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:," - for pkg in $enableval; do - if test "X$pkg" = "X$p"; then - enable_shared=yes - fi - done - IFS="$ac_save_ifs" - ;; -esac -else - enable_shared=yes -fi - -# Check whether --enable-static or --disable-static was given. -if test "${enable_static+set}" = set; then - enableval="$enable_static" - p=${PACKAGE-default} -case "$enableval" in -yes) enable_static=yes ;; -no) enable_static=no ;; -*) - enable_static=no - # Look at the argument we got. We use all the common list separators. - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:," - for pkg in $enableval; do - if test "X$pkg" = "X$p"; then - enable_static=yes - fi - done - IFS="$ac_save_ifs" - ;; -esac -else - enable_static=yes -fi - -# Extract the first word of "ranlib", so it can be a program name with args. -set dummy ranlib; ac_word=$2 -echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:934: checking for $ac_word" >&5 -if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - if test -n "$RANLIB"; then - ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test. -else - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:" - for ac_dir in $PATH; do - test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/$ac_word; then - ac_cv_prog_RANLIB="ranlib" - break - fi - done - IFS="$ac_save_ifs" - test -z "$ac_cv_prog_RANLIB" && ac_cv_prog_RANLIB=":" -fi -fi -RANLIB="$ac_cv_prog_RANLIB" -if test -n "$RANLIB"; then - echo "$ac_t""$RANLIB" 1>&6 -else - echo "$ac_t""no" 1>&6 -fi - -# Extract the first word of "gcc", so it can be a program name with args. -set dummy gcc; ac_word=$2 -echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:963: checking for $ac_word" >&5 -if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - if test -n "$CC"; then - ac_cv_prog_CC="$CC" # Let the user override the test. -else - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:" - for ac_dir in $PATH; do - test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/$ac_word; then - ac_cv_prog_CC="gcc" - break - fi - done - IFS="$ac_save_ifs" -fi -fi -CC="$ac_cv_prog_CC" -if test -n "$CC"; then - echo "$ac_t""$CC" 1>&6 -else - echo "$ac_t""no" 1>&6 -fi - -if test -z "$CC"; then - # Extract the first word of "cc", so it can be a program name with args. -set dummy cc; ac_word=$2 -echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:992: checking for $ac_word" >&5 -if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - if test -n "$CC"; then - ac_cv_prog_CC="$CC" # Let the user override the test. -else - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:" - ac_prog_rejected=no - for ac_dir in $PATH; do - test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/$ac_word; then - if test "$ac_dir/$ac_word" = "/usr/ucb/cc"; then - ac_prog_rejected=yes - continue - fi - ac_cv_prog_CC="cc" - break - fi - done - IFS="$ac_save_ifs" -if test $ac_prog_rejected = yes; then - # We found a bogon in the path, so make sure we never use it. - set dummy $ac_cv_prog_CC - shift - if test $# -gt 0; then - # We chose a different compiler from the bogus one. - # However, it has the same basename, so the bogon will be chosen - # first if we set CC to just the basename; use the full file name. - shift - set dummy "$ac_dir/$ac_word" "$@" - shift - ac_cv_prog_CC="$@" - fi -fi -fi -fi -CC="$ac_cv_prog_CC" -if test -n "$CC"; then - echo "$ac_t""$CC" 1>&6 -else - echo "$ac_t""no" 1>&6 -fi - - test -z "$CC" && { echo "configure: error: no acceptable cc found in \$PATH" 1>&2; exit 1; } -fi - -echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6 -echo "configure:1040: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5 - -ac_ext=c -# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. -ac_cpp='$CPP $CPPFLAGS' -ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' -ac_link='${CC-cc} -o conftest $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' -cross_compiling=$ac_cv_prog_cc_cross - -cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then - ac_cv_prog_cc_works=yes - # If we can't run a trivial program, we are probably using a cross compiler. - if (./conftest; exit) 2>/dev/null; then - ac_cv_prog_cc_cross=no - else - ac_cv_prog_cc_cross=yes - fi -else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - ac_cv_prog_cc_works=no -fi -rm -fr conftest* - -echo "$ac_t""$ac_cv_prog_cc_works" 1>&6 -if test $ac_cv_prog_cc_works = no; then - { echo "configure: error: installation or configuration problem: C compiler cannot create executables." 1>&2; exit 1; } -fi -echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6 -echo "configure:1074: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5 -echo "$ac_t""$ac_cv_prog_cc_cross" 1>&6 -cross_compiling=$ac_cv_prog_cc_cross - -echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6 -echo "configure:1079: checking whether we are using GNU C" >&5 -if eval "test \"`echo '$''{'ac_cv_prog_gcc'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - cat > conftest.c <&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then - ac_cv_prog_gcc=yes -else - ac_cv_prog_gcc=no -fi -fi - -echo "$ac_t""$ac_cv_prog_gcc" 1>&6 - -if test $ac_cv_prog_gcc = yes; then - GCC=yes - ac_test_CFLAGS="${CFLAGS+set}" - ac_save_CFLAGS="$CFLAGS" - CFLAGS= - echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6 -echo "configure:1103: checking whether ${CC-cc} accepts -g" >&5 -if eval "test \"`echo '$''{'ac_cv_prog_cc_g'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - echo 'void f(){}' > conftest.c -if test -z "`${CC-cc} -g -c conftest.c 2>&1`"; then - ac_cv_prog_cc_g=yes -else - ac_cv_prog_cc_g=no -fi -rm -f conftest* - -fi - -echo "$ac_t""$ac_cv_prog_cc_g" 1>&6 - if test "$ac_test_CFLAGS" = set; then - CFLAGS="$ac_save_CFLAGS" - elif test $ac_cv_prog_cc_g = yes; then - CFLAGS="-g -O2" - else - CFLAGS="-O2" - fi -else - GCC= - test "${CFLAGS+set}" = set || CFLAGS="-g" -fi - -# Check whether --with-gnu-ld or --without-gnu-ld was given. -if test "${with_gnu_ld+set}" = set; then - withval="$with_gnu_ld" - test "$withval" = no || with_gnu_ld=yes -else - with_gnu_ld=no -fi - - -ac_prog=ld -if test "$ac_cv_prog_gcc" = yes; then - # Check if gcc -print-prog-name=ld gives a path. - echo $ac_n "checking for ld used by GCC""... $ac_c" 1>&6 -echo "configure:1143: checking for ld used by GCC" >&5 - ac_prog=`($CC -print-prog-name=ld) 2>&5` - case "$ac_prog" in - # Accept absolute paths. - /* | [A-Za-z]:\\*) - test -z "$LD" && LD="$ac_prog" - ;; - "") - # If it fails, then pretend we aren't using GCC. - ac_prog=ld - ;; - *) - # If it is relative, then search for the first ld in PATH. - with_gnu_ld=unknown - ;; - esac -elif test "$with_gnu_ld" = yes; then - echo $ac_n "checking for GNU ld""... $ac_c" 1>&6 -echo "configure:1161: checking for GNU ld" >&5 -else - echo $ac_n "checking for non-GNU ld""... $ac_c" 1>&6 -echo "configure:1164: checking for non-GNU ld" >&5 -fi -if eval "test \"`echo '$''{'ac_cv_path_LD'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - if test -z "$LD"; then - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:" - for ac_dir in $PATH; do - test -z "$ac_dir" && ac_dir=. - if test -f "$ac_dir/$ac_prog"; then - ac_cv_path_LD="$ac_dir/$ac_prog" - # Check to see if the program is GNU ld. I'd rather use --version, - # but apparently some GNU ld's only accept -v. - # Break only if it was the GNU/non-GNU ld that we prefer. - if "$ac_cv_path_LD" -v 2>&1 < /dev/null | egrep '(GNU|with BFD)' > /dev/null; then - test "$with_gnu_ld" != no && break - else - test "$with_gnu_ld" != yes && break - fi - fi - done - IFS="$ac_save_ifs" -else - ac_cv_path_LD="$LD" # Let the user override the test with a path. -fi -fi - -LD="$ac_cv_path_LD" -if test -n "$LD"; then - echo "$ac_t""$LD" 1>&6 -else - echo "$ac_t""no" 1>&6 -fi -test -z "$LD" && { echo "configure: error: no acceptable ld found in \$PATH" 1>&2; exit 1; } - -echo $ac_n "checking if the linker ($LD) is GNU ld""... $ac_c" 1>&6 -echo "configure:1200: checking if the linker ($LD) is GNU ld" >&5 -if eval "test \"`echo '$''{'ac_cv_prog_gnu_ld'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - # I'd rather use --version here, but apparently some GNU ld's only accept -v. -if $LD -v 2>&1 &5; then - ac_cv_prog_gnu_ld=yes -else - ac_cv_prog_gnu_ld=no -fi -fi - -echo "$ac_t""$ac_cv_prog_gnu_ld" 1>&6 - - -echo $ac_n "checking for BSD-compatible nm""... $ac_c" 1>&6 -echo "configure:1216: checking for BSD-compatible nm" >&5 -if eval "test \"`echo '$''{'ac_cv_path_NM'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - case "$NM" in -/* | [A-Za-z]:\\*) - ac_cv_path_NM="$NM" # Let the user override the test with a path. - ;; -*) - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:" - for ac_dir in /usr/ucb /usr/ccs/bin $PATH /bin; do - test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/nm; then - # Check to see if the nm accepts a BSD-compat flag. - # Adding the `sed 1q' prevents false positives on HP-UX, which says: - # nm: unknown option "B" ignored - if ($ac_dir/nm -B /dev/null 2>&1 | sed '1q'; exit 0) | egrep /dev/null >/dev/null; then - ac_cv_path_NM="$ac_dir/nm -B" - elif ($ac_dir/nm -p /dev/null 2>&1 | sed '1q'; exit 0) | egrep /dev/null >/dev/null; then - ac_cv_path_NM="$ac_dir/nm -p" - else - ac_cv_path_NM="$ac_dir/nm" - fi - break - fi - done - IFS="$ac_save_ifs" - test -z "$ac_cv_path_NM" && ac_cv_path_NM=nm - ;; -esac -fi - -NM="$ac_cv_path_NM" -echo "$ac_t""$NM" 1>&6 - - -echo $ac_n "checking whether ln -s works""... $ac_c" 1>&6 -echo "configure:1253: checking whether ln -s works" >&5 -if eval "test \"`echo '$''{'ac_cv_prog_LN_S'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - rm -f conftestdata -if ln -s X conftestdata 2>/dev/null -then - rm -f conftestdata - ac_cv_prog_LN_S="ln -s" -else - ac_cv_prog_LN_S=ln -fi -fi -LN_S="$ac_cv_prog_LN_S" -if test "$ac_cv_prog_LN_S" = "ln -s"; then - echo "$ac_t""yes" 1>&6 -else - echo "$ac_t""no" 1>&6 -fi - -# Always use our own libtool. -LIBTOOL='$(SHELL) $(top_builddir)/libtool' - -# Check for any special flags to pass to ltconfig. -libtool_flags= -test "$enable_shared" = no && libtool_flags="$libtool_flags --disable-shared" -test "$enable_static" = no && libtool_flags="$libtool_flags --disable-static" -test "$silent" = yes && libtool_flags="$libtool_flags --silent" -test "$ac_cv_prog_gcc" = yes && libtool_flags="$libtool_flags --with-gcc" -test "$ac_cv_prog_gnu_ld" = yes && libtool_flags="$libtool_flags --with-gnu-ld" - -# Some flags need to be propagated to the compiler or linker for good -# libtool support. -case "$host" in -*-*-irix6*) - # Find out which ABI we are using. - echo '#line 1289 "configure"' > conftest.$ac_ext - if { (eval echo configure:1290: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then - case "`/usr/bin/file conftest.o`" in - *32-bit*) - LD="${LD-ld} -32" - ;; - *N32*) - LD="${LD-ld} -n32" - ;; - *64-bit*) - LD="${LD-ld} -64" - ;; - esac - fi - rm -rf conftest* - ;; - -*-*-sco3.2v5*) - # On SCO OpenServer 5, we need -belf to get full-featured binaries. - CFLAGS="$CFLAGS -belf" - ;; -esac - -# Actually configure libtool. ac_aux_dir is where install-sh is found. -CC="$CC" CFLAGS="$CFLAGS" CPPFLAGS="$CPPFLAGS" \ -LD="$LD" NM="$NM" RANLIB="$RANLIB" LN_S="$LN_S" \ -${CONFIG_SHELL-/bin/sh} $ac_aux_dir/ltconfig \ -$libtool_flags --no-verify $ac_aux_dir/ltmain.sh $host \ -|| { echo "configure: error: libtool configure failed" 1>&2; exit 1; } - - -# Check whether --enable-targets or --disable-targets was given. -if test "${enable_targets+set}" = set; then - enableval="$enable_targets" - case "${enableval}" in - yes | "") { echo "configure: error: enable-targets option must specify target names or 'all'" 1>&2; exit 1; } - ;; - no) enable_targets= ;; - *) enable_targets=$enableval ;; -esac -fi -# Check whether --enable-64-bit-bfd or --disable-64-bit-bfd was given. -if test "${enable_64_bit_bfd+set}" = set; then - enableval="$enable_64_bit_bfd" - case "${enableval}" in - yes) want64=true ;; - no) want64=false ;; - *) { echo "configure: error: bad value ${enableval} for 64-bit-bfd option" 1>&2; exit 1; } ;; -esac -else - want64=false -fi - - - - - -if test -z "$target" ; then - { echo "configure: error: Unrecognized target system type; please check config.sub." 1>&2; exit 1; } -fi -if test -z "$host" ; then - { echo "configure: error: Unrecognized host system type; please check config.sub." 1>&2; exit 1; } -fi - -# host-specific stuff: - -# Extract the first word of "gcc", so it can be a program name with args. -set dummy gcc; ac_word=$2 -echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1358: checking for $ac_word" >&5 -if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - if test -n "$CC"; then - ac_cv_prog_CC="$CC" # Let the user override the test. -else - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:" - for ac_dir in $PATH; do - test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/$ac_word; then - ac_cv_prog_CC="gcc" - break - fi - done - IFS="$ac_save_ifs" -fi -fi -CC="$ac_cv_prog_CC" -if test -n "$CC"; then - echo "$ac_t""$CC" 1>&6 -else - echo "$ac_t""no" 1>&6 -fi - -if test -z "$CC"; then - # Extract the first word of "cc", so it can be a program name with args. -set dummy cc; ac_word=$2 -echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1387: checking for $ac_word" >&5 -if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - if test -n "$CC"; then - ac_cv_prog_CC="$CC" # Let the user override the test. -else - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:" - ac_prog_rejected=no - for ac_dir in $PATH; do - test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/$ac_word; then - if test "$ac_dir/$ac_word" = "/usr/ucb/cc"; then - ac_prog_rejected=yes - continue - fi - ac_cv_prog_CC="cc" - break - fi - done - IFS="$ac_save_ifs" -if test $ac_prog_rejected = yes; then - # We found a bogon in the path, so make sure we never use it. - set dummy $ac_cv_prog_CC - shift - if test $# -gt 0; then - # We chose a different compiler from the bogus one. - # However, it has the same basename, so the bogon will be chosen - # first if we set CC to just the basename; use the full file name. - shift - set dummy "$ac_dir/$ac_word" "$@" - shift - ac_cv_prog_CC="$@" - fi -fi -fi -fi -CC="$ac_cv_prog_CC" -if test -n "$CC"; then - echo "$ac_t""$CC" 1>&6 -else - echo "$ac_t""no" 1>&6 -fi - - test -z "$CC" && { echo "configure: error: no acceptable cc found in \$PATH" 1>&2; exit 1; } -fi - -echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6 -echo "configure:1435: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5 - -ac_ext=c -# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. -ac_cpp='$CPP $CPPFLAGS' -ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' -ac_link='${CC-cc} -o conftest $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' -cross_compiling=$ac_cv_prog_cc_cross - -cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then - ac_cv_prog_cc_works=yes - # If we can't run a trivial program, we are probably using a cross compiler. - if (./conftest; exit) 2>/dev/null; then - ac_cv_prog_cc_cross=no - else - ac_cv_prog_cc_cross=yes - fi -else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - ac_cv_prog_cc_works=no -fi -rm -fr conftest* - -echo "$ac_t""$ac_cv_prog_cc_works" 1>&6 -if test $ac_cv_prog_cc_works = no; then - { echo "configure: error: installation or configuration problem: C compiler cannot create executables." 1>&2; exit 1; } -fi -echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6 -echo "configure:1469: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5 -echo "$ac_t""$ac_cv_prog_cc_cross" 1>&6 -cross_compiling=$ac_cv_prog_cc_cross - -echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6 -echo "configure:1474: checking whether we are using GNU C" >&5 -if eval "test \"`echo '$''{'ac_cv_prog_gcc'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - cat > conftest.c <&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then - ac_cv_prog_gcc=yes -else - ac_cv_prog_gcc=no -fi -fi - -echo "$ac_t""$ac_cv_prog_gcc" 1>&6 - -if test $ac_cv_prog_gcc = yes; then - GCC=yes - ac_test_CFLAGS="${CFLAGS+set}" - ac_save_CFLAGS="$CFLAGS" - CFLAGS= - echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6 -echo "configure:1498: checking whether ${CC-cc} accepts -g" >&5 -if eval "test \"`echo '$''{'ac_cv_prog_cc_g'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - echo 'void f(){}' > conftest.c -if test -z "`${CC-cc} -g -c conftest.c 2>&1`"; then - ac_cv_prog_cc_g=yes -else - ac_cv_prog_cc_g=no -fi -rm -f conftest* - -fi - -echo "$ac_t""$ac_cv_prog_cc_g" 1>&6 - if test "$ac_test_CFLAGS" = set; then - CFLAGS="$ac_save_CFLAGS" - elif test $ac_cv_prog_cc_g = yes; then - CFLAGS="-g -O2" - else - CFLAGS="-O2" - fi -else - GCC= - test "${CFLAGS+set}" = set || CFLAGS="-g" -fi - - -test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL_PROGRAM}' - -echo $ac_n "checking for Cygwin32 environment""... $ac_c" 1>&6 -echo "configure:1529: checking for Cygwin32 environment" >&5 -if eval "test \"`echo '$''{'am_cv_cygwin32'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - cat > conftest.$ac_ext <&5; (eval $ac_compile) 2>&5; }; then - rm -rf conftest* - am_cv_cygwin32=yes -else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - am_cv_cygwin32=no -fi -rm -f conftest* -rm -f conftest* -fi - -echo "$ac_t""$am_cv_cygwin32" 1>&6 -CYGWIN32= -test "$am_cv_cygwin32" = yes && CYGWIN32=yes -echo $ac_n "checking for Mingw32 environment""... $ac_c" 1>&6 -echo "configure:1558: checking for Mingw32 environment" >&5 -if eval "test \"`echo '$''{'am_cv_mingw32'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - cat > conftest.$ac_ext <&5; (eval $ac_compile) 2>&5; }; then - rm -rf conftest* - am_cv_mingw32=yes -else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - am_cv_mingw32=no -fi -rm -f conftest* -rm -f conftest* -fi - -echo "$ac_t""$am_cv_mingw32" 1>&6 -MINGW32= -test "$am_cv_mingw32" = yes && MINGW32=yes - - -echo $ac_n "checking for executable suffix""... $ac_c" 1>&6 -echo "configure:1589: checking for executable suffix" >&5 -if eval "test \"`echo '$''{'am_cv_exeext'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - if test "$CYGWIN32" = yes || test "$MINGW32" = yes; then -am_cv_exeext=.exe -else -cat > am_c_test.c << 'EOF' -int main() { -/* Nothing needed here */ -} -EOF -${CC-cc} -o am_c_test $CFLAGS $CPPFLAGS $LDFLAGS am_c_test.c $LIBS 1>&5 -am_cv_exeext=`echo am_c_test.* | grep -v am_c_test.c | sed -e s/am_c_test//` -rm -f am_c_test* -fi - -test x"${am_cv_exeext}" = x && am_cv_exeext=no -fi -EXEEXT="" -test x"${am_cv_exeext}" != xno && EXEEXT=${am_cv_exeext} -echo "$ac_t""${am_cv_exeext}" 1>&6 - - -for ac_prog in 'bison -y' byacc -do -# Extract the first word of "$ac_prog", so it can be a program name with args. -set dummy $ac_prog; ac_word=$2 -echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1618: checking for $ac_word" >&5 -if eval "test \"`echo '$''{'ac_cv_prog_YACC'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - if test -n "$YACC"; then - ac_cv_prog_YACC="$YACC" # Let the user override the test. -else - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:" - for ac_dir in $PATH; do - test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/$ac_word; then - ac_cv_prog_YACC="$ac_prog" - break - fi - done - IFS="$ac_save_ifs" -fi -fi -YACC="$ac_cv_prog_YACC" -if test -n "$YACC"; then - echo "$ac_t""$YACC" 1>&6 -else - echo "$ac_t""no" 1>&6 -fi - -test -n "$YACC" && break -done -test -n "$YACC" || YACC="yacc" - -# Extract the first word of "flex", so it can be a program name with args. -set dummy flex; ac_word=$2 -echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1650: checking for $ac_word" >&5 -if eval "test \"`echo '$''{'ac_cv_prog_LEX'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - if test -n "$LEX"; then - ac_cv_prog_LEX="$LEX" # Let the user override the test. -else - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:" - for ac_dir in $PATH; do - test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/$ac_word; then - ac_cv_prog_LEX="flex" - break - fi - done - IFS="$ac_save_ifs" - test -z "$ac_cv_prog_LEX" && ac_cv_prog_LEX="lex" -fi -fi -LEX="$ac_cv_prog_LEX" -if test -n "$LEX"; then - echo "$ac_t""$LEX" 1>&6 -else - echo "$ac_t""no" 1>&6 -fi - -if test -z "$LEXLIB" -then - case "$LEX" in - flex*) ac_lib=fl ;; - *) ac_lib=l ;; - esac - echo $ac_n "checking for yywrap in -l$ac_lib""... $ac_c" 1>&6 -echo "configure:1683: checking for yywrap in -l$ac_lib" >&5 -ac_lib_var=`echo $ac_lib'_'yywrap | sed 'y%./+-%__p_%'` -if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - ac_save_LIBS="$LIBS" -LIBS="-l$ac_lib $LIBS" -cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then - rm -rf conftest* - eval "ac_cv_lib_$ac_lib_var=yes" -else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - eval "ac_cv_lib_$ac_lib_var=no" -fi -rm -f conftest* -LIBS="$ac_save_LIBS" - -fi -if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then - echo "$ac_t""yes" 1>&6 - LEXLIB="-l$ac_lib" -else - echo "$ac_t""no" 1>&6 -fi - -fi - -echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6 -echo "configure:1725: checking how to run the C preprocessor" >&5 -# On Suns, sometimes $CPP names a directory. -if test -n "$CPP" && test -d "$CPP"; then - CPP= -fi -if test -z "$CPP"; then -if eval "test \"`echo '$''{'ac_cv_prog_CPP'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - # This must be in double quotes, not single quotes, because CPP may get - # substituted into the Makefile and "${CC-cc}" will confuse make. - CPP="${CC-cc} -E" - # On the NeXT, cc -E runs the code through the compiler's parser, - # not just through cpp. - cat > conftest.$ac_ext < -Syntax Error -EOF -ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1746: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } -ac_err=`grep -v '^ *+' conftest.out` -if test -z "$ac_err"; then - : -else - echo "$ac_err" >&5 - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - CPP="${CC-cc} -E -traditional-cpp" - cat > conftest.$ac_ext < -Syntax Error -EOF -ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1763: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } -ac_err=`grep -v '^ *+' conftest.out` -if test -z "$ac_err"; then - : -else - echo "$ac_err" >&5 - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - CPP=/lib/cpp -fi -rm -f conftest* -fi -rm -f conftest* - ac_cv_prog_CPP="$CPP" -fi - CPP="$ac_cv_prog_CPP" -else - ac_cv_prog_CPP="$CPP" -fi -echo "$ac_t""$CPP" 1>&6 - -echo $ac_n "checking lex output file root""... $ac_c" 1>&6 -echo "configure:1786: checking lex output file root" >&5 -if eval "test \"`echo '$''{'ac_cv_prog_lex_root'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - # The minimal lex program is just a single line: %%. But some broken lexes -# (Solaris, I think it was) want two %% lines, so accommodate them. -echo '%% -%%' | $LEX -if test -f lex.yy.c; then - ac_cv_prog_lex_root=lex.yy -elif test -f lexyy.c; then - ac_cv_prog_lex_root=lexyy -else - { echo "configure: error: cannot find output from $LEX; giving up" 1>&2; exit 1; } -fi -fi - -echo "$ac_t""$ac_cv_prog_lex_root" 1>&6 -LEX_OUTPUT_ROOT=$ac_cv_prog_lex_root - -echo $ac_n "checking whether yytext is a pointer""... $ac_c" 1>&6 -echo "configure:1807: checking whether yytext is a pointer" >&5 -if eval "test \"`echo '$''{'ac_cv_prog_lex_yytext_pointer'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - # POSIX says lex can declare yytext either as a pointer or an array; the -# default is implementation-dependent. Figure out which it is, since -# not all implementations provide the %pointer and %array declarations. -ac_cv_prog_lex_yytext_pointer=no -echo 'extern char *yytext;' >>$LEX_OUTPUT_ROOT.c -ac_save_LIBS="$LIBS" -LIBS="$LIBS $LEXLIB" -cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then - rm -rf conftest* - ac_cv_prog_lex_yytext_pointer=yes -else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 -fi -rm -f conftest* -LIBS="$ac_save_LIBS" -rm -f "${LEX_OUTPUT_ROOT}.c" - -fi - -echo "$ac_t""$ac_cv_prog_lex_yytext_pointer" 1>&6 -if test $ac_cv_prog_lex_yytext_pointer = yes; then - cat >> confdefs.h <<\EOF -#define YYTEXT_POINTER 1 -EOF - -fi - - -echo $ac_n "checking whether to enable maintainer-specific portions of Makefiles""... $ac_c" 1>&6 -echo "configure:1849: checking whether to enable maintainer-specific portions of Makefiles" >&5 - # Check whether --enable-maintainer-mode or --disable-maintainer-mode was given. -if test "${enable_maintainer_mode+set}" = set; then - enableval="$enable_maintainer_mode" - USE_MAINTAINER_MODE=$enableval -else - USE_MAINTAINER_MODE=no -fi - - echo "$ac_t""$USE_MAINTAINER_MODE" 1>&6 - if test $USE_MAINTAINER_MODE = yes; then - MAINT= - else - MAINT='#M#' - fi - - - -. ${srcdir}/configure.host - - - - - - -for ac_hdr in string.h strings.h stdlib.h unistd.h -do -ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` -echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:1878: checking for $ac_hdr" >&5 -if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - cat > conftest.$ac_ext < -EOF -ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1888: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } -ac_err=`grep -v '^ *+' conftest.out` -if test -z "$ac_err"; then - rm -rf conftest* - eval "ac_cv_header_$ac_safe=yes" -else - echo "$ac_err" >&5 - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - eval "ac_cv_header_$ac_safe=no" -fi -rm -f conftest* -fi -if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then - echo "$ac_t""yes" 1>&6 - ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'` - cat >> confdefs.h <&6 -fi -done - -for ac_func in sbrk -do -echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:1917: checking for $ac_func" >&5 -if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - cat > conftest.$ac_ext < -/* Override any gcc2 internal prototype to avoid an error. */ -/* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ -char $ac_func(); - -int main() { - -/* The GNU C library defines this for functions which it implements - to always fail with ENOSYS. Some functions are actually named - something starting with __ and the normal name is an alias. */ -#if defined (__stub_$ac_func) || defined (__stub___$ac_func) -choke me -#else -$ac_func(); -#endif - -; return 0; } -EOF -if { (eval echo configure:1945: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then - rm -rf conftest* - eval "ac_cv_func_$ac_func=yes" -else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - eval "ac_cv_func_$ac_func=no" -fi -rm -f conftest* -fi - -if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then - echo "$ac_t""yes" 1>&6 - ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'` - cat >> confdefs.h <&6 -fi -done - -ac_header_dirent=no -for ac_hdr in dirent.h sys/ndir.h sys/dir.h ndir.h -do -ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` -echo $ac_n "checking for $ac_hdr that defines DIR""... $ac_c" 1>&6 -echo "configure:1974: checking for $ac_hdr that defines DIR" >&5 -if eval "test \"`echo '$''{'ac_cv_header_dirent_$ac_safe'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - cat > conftest.$ac_ext < -#include <$ac_hdr> -int main() { -DIR *dirp = 0; -; return 0; } -EOF -if { (eval echo configure:1987: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then - rm -rf conftest* - eval "ac_cv_header_dirent_$ac_safe=yes" -else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - eval "ac_cv_header_dirent_$ac_safe=no" -fi -rm -f conftest* -fi -if eval "test \"`echo '$ac_cv_header_dirent_'$ac_safe`\" = yes"; then - echo "$ac_t""yes" 1>&6 - ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'` - cat >> confdefs.h <&6 -fi -done -# Two versions of opendir et al. are in -ldir and -lx on SCO Xenix. -if test $ac_header_dirent = dirent.h; then -echo $ac_n "checking for opendir in -ldir""... $ac_c" 1>&6 -echo "configure:2012: checking for opendir in -ldir" >&5 -ac_lib_var=`echo dir'_'opendir | sed 'y%./+-%__p_%'` -if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - ac_save_LIBS="$LIBS" -LIBS="-ldir $LIBS" -cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then - rm -rf conftest* - eval "ac_cv_lib_$ac_lib_var=yes" -else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - eval "ac_cv_lib_$ac_lib_var=no" -fi -rm -f conftest* -LIBS="$ac_save_LIBS" - -fi -if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then - echo "$ac_t""yes" 1>&6 - LIBS="$LIBS -ldir" -else - echo "$ac_t""no" 1>&6 -fi - -else -echo $ac_n "checking for opendir in -lx""... $ac_c" 1>&6 -echo "configure:2053: checking for opendir in -lx" >&5 -ac_lib_var=`echo x'_'opendir | sed 'y%./+-%__p_%'` -if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - ac_save_LIBS="$LIBS" -LIBS="-lx $LIBS" -cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then - rm -rf conftest* - eval "ac_cv_lib_$ac_lib_var=yes" -else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - eval "ac_cv_lib_$ac_lib_var=no" -fi -rm -f conftest* -LIBS="$ac_save_LIBS" - -fi -if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then - echo "$ac_t""yes" 1>&6 - LIBS="$LIBS -lx" -else - echo "$ac_t""no" 1>&6 -fi - -fi - - - -case "${host}" in -i[345]86-*-msdos* | i[345]86-*-go32* | i[345]86-*-mingw32* | *-*-cygwin32* | *-*-windows) - cat >> confdefs.h <<\EOF -#define USE_BINARY_FOPEN 1 -EOF - ;; -esac - -echo $ac_n "checking whether strstr must be declared""... $ac_c" 1>&6 -echo "configure:2105: checking whether strstr must be declared" >&5 -if eval "test \"`echo '$''{'bfd_cv_decl_needed_strstr'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - cat > conftest.$ac_ext < -#ifdef HAVE_STRING_H -#include -#else -#ifdef HAVE_STRINGS_H -#include -#endif -#endif -#ifdef HAVE_STDLIB_H -#include -#endif -#ifdef HAVE_UNISTD_H -#include -#endif -int main() { -char *(*pfn) = (char *(*)) strstr -; return 0; } -EOF -if { (eval echo configure:2131: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then - rm -rf conftest* - bfd_cv_decl_needed_strstr=no -else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - bfd_cv_decl_needed_strstr=yes -fi -rm -f conftest* -fi - -echo "$ac_t""$bfd_cv_decl_needed_strstr" 1>&6 -if test $bfd_cv_decl_needed_strstr = yes; then - bfd_tr_decl=NEED_DECLARATION_`echo strstr | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'` - cat >> confdefs.h <&6 -echo "configure:2153: checking whether free must be declared" >&5 -if eval "test \"`echo '$''{'bfd_cv_decl_needed_free'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - cat > conftest.$ac_ext < -#ifdef HAVE_STRING_H -#include -#else -#ifdef HAVE_STRINGS_H -#include -#endif -#endif -#ifdef HAVE_STDLIB_H -#include -#endif -#ifdef HAVE_UNISTD_H -#include -#endif -int main() { -char *(*pfn) = (char *(*)) free -; return 0; } -EOF -if { (eval echo configure:2179: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then - rm -rf conftest* - bfd_cv_decl_needed_free=no -else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - bfd_cv_decl_needed_free=yes -fi -rm -f conftest* -fi - -echo "$ac_t""$bfd_cv_decl_needed_free" 1>&6 -if test $bfd_cv_decl_needed_free = yes; then - bfd_tr_decl=NEED_DECLARATION_`echo free | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'` - cat >> confdefs.h <&6 -echo "configure:2201: checking whether sbrk must be declared" >&5 -if eval "test \"`echo '$''{'bfd_cv_decl_needed_sbrk'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - cat > conftest.$ac_ext < -#ifdef HAVE_STRING_H -#include -#else -#ifdef HAVE_STRINGS_H -#include -#endif -#endif -#ifdef HAVE_STDLIB_H -#include -#endif -#ifdef HAVE_UNISTD_H -#include -#endif -int main() { -char *(*pfn) = (char *(*)) sbrk -; return 0; } -EOF -if { (eval echo configure:2227: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then - rm -rf conftest* - bfd_cv_decl_needed_sbrk=no -else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - bfd_cv_decl_needed_sbrk=yes -fi -rm -f conftest* -fi - -echo "$ac_t""$bfd_cv_decl_needed_sbrk" 1>&6 -if test $bfd_cv_decl_needed_sbrk = yes; then - bfd_tr_decl=NEED_DECLARATION_`echo sbrk | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'` - cat >> confdefs.h <&6 -echo "configure:2249: checking whether getenv must be declared" >&5 -if eval "test \"`echo '$''{'bfd_cv_decl_needed_getenv'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - cat > conftest.$ac_ext < -#ifdef HAVE_STRING_H -#include -#else -#ifdef HAVE_STRINGS_H -#include -#endif -#endif -#ifdef HAVE_STDLIB_H -#include -#endif -#ifdef HAVE_UNISTD_H -#include -#endif -int main() { -char *(*pfn) = (char *(*)) getenv -; return 0; } -EOF -if { (eval echo configure:2275: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then - rm -rf conftest* - bfd_cv_decl_needed_getenv=no -else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - bfd_cv_decl_needed_getenv=yes -fi -rm -f conftest* -fi - -echo "$ac_t""$bfd_cv_decl_needed_getenv" 1>&6 -if test $bfd_cv_decl_needed_getenv = yes; then - bfd_tr_decl=NEED_DECLARATION_`echo getenv | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'` - cat >> confdefs.h </dev/null` - if test -n "$result"; then - targ=$result - else - targ=$targ_alias - fi - - . ${srcdir}/configure.tgt - - if test "$targ" = "$target"; then - EMUL=$targ_emul - fi - - for i in $targ_emul $targ_extra_emuls; do - case " $all_emuls " in - *" e${i}.o "*) ;; - *) - all_emuls="$all_emuls e${i}.o" - eval result=\$tdir_$i - test -z "$result" && result=$targ_alias - TDIRS="$TDIRS\\ -tdir_$i=$result" - ;; - esac - done - fi -done - - - - -if test x${all_targets} = xtrue; then - if test x${want64} = xtrue; then - EMULATION_OFILES='$(ALL_EMULATIONS) $(ALL_64_EMULATIONS)' - else - EMULATION_OFILES='$(ALL_EMULATIONS)' - fi -else - EMULATION_OFILES=$all_emuls -fi - - -if test x${enable_static} = xno; then - TESTBFDLIB="--rpath ../bfd/.libs ../bfd/.libs/libbfd.so" -else - TESTBFDLIB="../bfd/.libs/libbfd.a" -fi - - -trap '' 1 2 15 -cat > confcache <<\EOF -# This file is a shell script that caches the results of configure -# tests run on this system so they can be shared between configure -# scripts and configure runs. It is not useful on other systems. -# If it contains results you don't want to keep, you may remove or edit it. -# -# By default, configure uses ./config.cache as the cache file, -# creating it if it does not exist already. You can give configure -# the --cache-file=FILE option to use a different cache file; that is -# what configure does when it calls configure scripts in -# subdirectories, so they share the cache. -# Giving --cache-file=/dev/null disables caching, for debugging configure. -# config.status only pays attention to the cache file if you give it the -# --recheck option to rerun configure. -# -EOF -# The following way of writing the cache mishandles newlines in values, -# but we know of no workaround that is simple, portable, and efficient. -# So, don't put newlines in cache variables' values. -# Ultrix sh set writes to stderr and can't be redirected directly, -# and sets the high bit in the cache file unless we assign to the vars. -(set) 2>&1 | - case `(ac_space=' '; set) 2>&1 | grep ac_space` in - *ac_space=\ *) - # `set' does not quote correctly, so add quotes (double-quote substitution - # turns \\\\ into \\, and sed turns \\ into \). - sed -n \ - -e "s/'/'\\\\''/g" \ - -e "s/^\\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\\)=\\(.*\\)/\\1=\${\\1='\\2'}/p" - ;; - *) - # `set' quotes correctly as required by POSIX, so do not add quotes. - sed -n -e 's/^\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\)=\(.*\)/\1=${\1=\2}/p' - ;; - esac >> confcache -if cmp -s $cache_file confcache; then - : -else - if test -w $cache_file; then - echo "updating cache $cache_file" - cat confcache > $cache_file - else - echo "not updating unwritable cache $cache_file" - fi -fi -rm -f confcache - -trap 'rm -fr conftest* confdefs* core core.* *.core $ac_clean_files; exit 1' 1 2 15 - -test "x$prefix" = xNONE && prefix=$ac_default_prefix -# Let make expand exec_prefix. -test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' - -# Any assignment to VPATH causes Sun make to only execute -# the first set of double-colon rules, so remove it if not needed. -# If there is a colon in the path, we need to keep it. -if test "x$srcdir" = x.; then - ac_vpsub='/^[ ]*VPATH[ ]*=[^:]*$/d' -fi - -trap 'rm -f $CONFIG_STATUS conftest*; exit 1' 1 2 15 - -DEFS=-DHAVE_CONFIG_H - -# Without the "./", some shells look in PATH for config.status. -: ${CONFIG_STATUS=./config.status} - -echo creating $CONFIG_STATUS -rm -f $CONFIG_STATUS -cat > $CONFIG_STATUS </dev/null | sed 1q`: -# -# $0 $ac_configure_args -# -# Compiler output produced by configure, useful for debugging -# configure, is in ./config.log if it exists. - -ac_cs_usage="Usage: $CONFIG_STATUS [--recheck] [--version] [--help]" -for ac_option -do - case "\$ac_option" in - -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) - echo "running \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion" - exec \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion ;; - -version | --version | --versio | --versi | --vers | --ver | --ve | --v) - echo "$CONFIG_STATUS generated by autoconf version 2.12.1" - exit 0 ;; - -help | --help | --hel | --he | --h) - echo "\$ac_cs_usage"; exit 0 ;; - *) echo "\$ac_cs_usage"; exit 1 ;; - esac -done - -ac_given_srcdir=$srcdir -ac_given_INSTALL="$INSTALL" - -trap 'rm -fr `echo "Makefile config.h:config.in" | sed "s/:[^ ]*//g"` conftest*; exit 1' 1 2 15 -EOF -cat >> $CONFIG_STATUS < conftest.subs <<\\CEOF -$ac_vpsub -$extrasub -s%@SHELL@%$SHELL%g -s%@CFLAGS@%$CFLAGS%g -s%@CPPFLAGS@%$CPPFLAGS%g -s%@CXXFLAGS@%$CXXFLAGS%g -s%@DEFS@%$DEFS%g -s%@LDFLAGS@%$LDFLAGS%g -s%@LIBS@%$LIBS%g -s%@exec_prefix@%$exec_prefix%g -s%@prefix@%$prefix%g -s%@program_transform_name@%$program_transform_name%g -s%@bindir@%$bindir%g -s%@sbindir@%$sbindir%g -s%@libexecdir@%$libexecdir%g -s%@datadir@%$datadir%g -s%@sysconfdir@%$sysconfdir%g -s%@sharedstatedir@%$sharedstatedir%g -s%@localstatedir@%$localstatedir%g -s%@libdir@%$libdir%g -s%@includedir@%$includedir%g -s%@oldincludedir@%$oldincludedir%g -s%@infodir@%$infodir%g -s%@mandir@%$mandir%g -s%@host@%$host%g -s%@host_alias@%$host_alias%g -s%@host_cpu@%$host_cpu%g -s%@host_vendor@%$host_vendor%g -s%@host_os@%$host_os%g -s%@target@%$target%g -s%@target_alias@%$target_alias%g -s%@target_cpu@%$target_cpu%g -s%@target_vendor@%$target_vendor%g -s%@target_os@%$target_os%g -s%@build@%$build%g -s%@build_alias@%$build_alias%g -s%@build_cpu@%$build_cpu%g -s%@build_vendor@%$build_vendor%g -s%@build_os@%$build_os%g -s%@INSTALL_PROGRAM@%$INSTALL_PROGRAM%g -s%@INSTALL_DATA@%$INSTALL_DATA%g -s%@INSTALL_SCRIPT@%$INSTALL_SCRIPT%g -s%@PACKAGE@%$PACKAGE%g -s%@VERSION@%$VERSION%g -s%@ACLOCAL@%$ACLOCAL%g -s%@AUTOCONF@%$AUTOCONF%g -s%@AUTOMAKE@%$AUTOMAKE%g -s%@AUTOHEADER@%$AUTOHEADER%g -s%@MAKEINFO@%$MAKEINFO%g -s%@SET_MAKE@%$SET_MAKE%g -s%@RANLIB@%$RANLIB%g -s%@CC@%$CC%g -s%@LD@%$LD%g -s%@NM@%$NM%g -s%@LN_S@%$LN_S%g -s%@LIBTOOL@%$LIBTOOL%g -s%@EXEEXT@%$EXEEXT%g -s%@YACC@%$YACC%g -s%@LEX@%$LEX%g -s%@LEXLIB@%$LEXLIB%g -s%@CPP@%$CPP%g -s%@LEX_OUTPUT_ROOT@%$LEX_OUTPUT_ROOT%g -s%@MAINT@%$MAINT%g -s%@HDEFINES@%$HDEFINES%g -s%@HOSTING_CRT0@%$HOSTING_CRT0%g -s%@HOSTING_LIBS@%$HOSTING_LIBS%g -s%@NATIVE_LIB_DIRS@%$NATIVE_LIB_DIRS%g -s%@EMUL@%$EMUL%g -s%@TDIRS@%$TDIRS%g -s%@EMULATION_OFILES@%$EMULATION_OFILES%g -s%@TESTBFDLIB@%$TESTBFDLIB%g - -CEOF -EOF - -cat >> $CONFIG_STATUS <<\EOF - -# Split the substitutions into bite-sized pieces for seds with -# small command number limits, like on Digital OSF/1 and HP-UX. -ac_max_sed_cmds=90 # Maximum number of lines to put in a sed script. -ac_file=1 # Number of current file. -ac_beg=1 # First line for current file. -ac_end=$ac_max_sed_cmds # Line after last line for current file. -ac_more_lines=: -ac_sed_cmds="" -while $ac_more_lines; do - if test $ac_beg -gt 1; then - sed "1,${ac_beg}d; ${ac_end}q" conftest.subs > conftest.s$ac_file - else - sed "${ac_end}q" conftest.subs > conftest.s$ac_file - fi - if test ! -s conftest.s$ac_file; then - ac_more_lines=false - rm -f conftest.s$ac_file - else - if test -z "$ac_sed_cmds"; then - ac_sed_cmds="sed -f conftest.s$ac_file" - else - ac_sed_cmds="$ac_sed_cmds | sed -f conftest.s$ac_file" - fi - ac_file=`expr $ac_file + 1` - ac_beg=$ac_end - ac_end=`expr $ac_end + $ac_max_sed_cmds` - fi -done -if test -z "$ac_sed_cmds"; then - ac_sed_cmds=cat -fi -EOF - -cat >> $CONFIG_STATUS <> $CONFIG_STATUS <<\EOF -for ac_file in .. $CONFIG_FILES; do if test "x$ac_file" != x..; then - # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in". - case "$ac_file" in - *:*) ac_file_in=`echo "$ac_file"|sed 's%[^:]*:%%'` - ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;; - *) ac_file_in="${ac_file}.in" ;; - esac - - # Adjust a relative srcdir, top_srcdir, and INSTALL for subdirectories. - - # Remove last slash and all that follows it. Not all systems have dirname. - ac_dir=`echo $ac_file|sed 's%/[^/][^/]*$%%'` - if test "$ac_dir" != "$ac_file" && test "$ac_dir" != .; then - # The file is in a subdirectory. - test ! -d "$ac_dir" && mkdir "$ac_dir" - ac_dir_suffix="/`echo $ac_dir|sed 's%^\./%%'`" - # A "../" for each directory in $ac_dir_suffix. - ac_dots=`echo $ac_dir_suffix|sed 's%/[^/]*%../%g'` - else - ac_dir_suffix= ac_dots= - fi - - case "$ac_given_srcdir" in - .) srcdir=. - if test -z "$ac_dots"; then top_srcdir=. - else top_srcdir=`echo $ac_dots|sed 's%/$%%'`; fi ;; - /*) srcdir="$ac_given_srcdir$ac_dir_suffix"; top_srcdir="$ac_given_srcdir" ;; - *) # Relative path. - srcdir="$ac_dots$ac_given_srcdir$ac_dir_suffix" - top_srcdir="$ac_dots$ac_given_srcdir" ;; - esac - - case "$ac_given_INSTALL" in - [/$]*) INSTALL="$ac_given_INSTALL" ;; - *) INSTALL="$ac_dots$ac_given_INSTALL" ;; - esac - - echo creating "$ac_file" - rm -f "$ac_file" - configure_input="Generated automatically from `echo $ac_file_in|sed 's%.*/%%'` by configure." - case "$ac_file" in - *Makefile*) ac_comsub="1i\\ -# $configure_input" ;; - *) ac_comsub= ;; - esac - - ac_file_inputs=`echo $ac_file_in|sed -e "s%^%$ac_given_srcdir/%" -e "s%:% $ac_given_srcdir/%g"` - sed -e "$ac_comsub -s%@configure_input@%$configure_input%g -s%@srcdir@%$srcdir%g -s%@top_srcdir@%$top_srcdir%g -s%@INSTALL@%$INSTALL%g -" $ac_file_inputs | (eval "$ac_sed_cmds") > $ac_file -fi; done -rm -f conftest.s* - -# These sed commands are passed to sed as "A NAME B NAME C VALUE D", where -# NAME is the cpp macro being defined and VALUE is the value it is being given. -# -# ac_d sets the value in "#define NAME VALUE" lines. -ac_dA='s%^\([ ]*\)#\([ ]*define[ ][ ]*\)' -ac_dB='\([ ][ ]*\)[^ ]*%\1#\2' -ac_dC='\3' -ac_dD='%g' -# ac_u turns "#undef NAME" with trailing blanks into "#define NAME VALUE". -ac_uA='s%^\([ ]*\)#\([ ]*\)undef\([ ][ ]*\)' -ac_uB='\([ ]\)%\1#\2define\3' -ac_uC=' ' -ac_uD='\4%g' -# ac_e turns "#undef NAME" without trailing blanks into "#define NAME VALUE". -ac_eA='s%^\([ ]*\)#\([ ]*\)undef\([ ][ ]*\)' -ac_eB='$%\1#\2define\3' -ac_eC=' ' -ac_eD='%g' - -if test "${CONFIG_HEADERS+set}" != set; then -EOF -cat >> $CONFIG_STATUS <> $CONFIG_STATUS <<\EOF -fi -for ac_file in .. $CONFIG_HEADERS; do if test "x$ac_file" != x..; then - # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in". - case "$ac_file" in - *:*) ac_file_in=`echo "$ac_file"|sed 's%[^:]*:%%'` - ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;; - *) ac_file_in="${ac_file}.in" ;; - esac - - echo creating $ac_file - - rm -f conftest.frag conftest.in conftest.out - ac_file_inputs=`echo $ac_file_in|sed -e "s%^%$ac_given_srcdir/%" -e "s%:% $ac_given_srcdir/%g"` - cat $ac_file_inputs > conftest.in - -EOF - -# Transform confdefs.h into a sed script conftest.vals that substitutes -# the proper values into config.h.in to produce config.h. And first: -# Protect against being on the right side of a sed subst in config.status. -# Protect against being in an unquoted here document in config.status. -rm -f conftest.vals -cat > conftest.hdr <<\EOF -s/[\\&%]/\\&/g -s%[\\$`]%\\&%g -s%#define \([A-Za-z_][A-Za-z0-9_]*\) *\(.*\)%${ac_dA}\1${ac_dB}\1${ac_dC}\2${ac_dD}%gp -s%ac_d%ac_u%gp -s%ac_u%ac_e%gp -EOF -sed -n -f conftest.hdr confdefs.h > conftest.vals -rm -f conftest.hdr - -# This sed command replaces #undef with comments. This is necessary, for -# example, in the case of _POSIX_SOURCE, which is predefined and required -# on some systems where configure will not decide to define it. -cat >> conftest.vals <<\EOF -s%^[ ]*#[ ]*undef[ ][ ]*[a-zA-Z_][a-zA-Z_0-9]*%/* & */% -EOF - -# Break up conftest.vals because some shells have a limit on -# the size of here documents, and old seds have small limits too. - -rm -f conftest.tail -while : -do - ac_lines=`grep -c . conftest.vals` - # grep -c gives empty output for an empty file on some AIX systems. - if test -z "$ac_lines" || test "$ac_lines" -eq 0; then break; fi - # Write a limited-size here document to conftest.frag. - echo ' cat > conftest.frag <> $CONFIG_STATUS - sed ${ac_max_here_lines}q conftest.vals >> $CONFIG_STATUS - echo 'CEOF - sed -f conftest.frag conftest.in > conftest.out - rm -f conftest.in - mv conftest.out conftest.in -' >> $CONFIG_STATUS - sed 1,${ac_max_here_lines}d conftest.vals > conftest.tail - rm -f conftest.vals - mv conftest.tail conftest.vals -done -rm -f conftest.vals - -cat >> $CONFIG_STATUS <<\EOF - rm -f conftest.frag conftest.h - echo "/* $ac_file. Generated automatically by configure. */" > conftest.h - cat conftest.in >> conftest.h - rm -f conftest.in - if cmp -s $ac_file conftest.h 2>/dev/null; then - echo "$ac_file is unchanged" - rm -f conftest.h - else - # Remove last slash and all that follows it. Not all systems have dirname. - ac_dir=`echo $ac_file|sed 's%/[^/][^/]*$%%'` - if test "$ac_dir" != "$ac_file" && test "$ac_dir" != .; then - # The file is in a subdirectory. - test ! -d "$ac_dir" && mkdir "$ac_dir" - fi - rm -f $ac_file - mv conftest.h $ac_file - fi -fi; done - -EOF -cat >> $CONFIG_STATUS <> $CONFIG_STATUS <<\EOF -test -z "$CONFIG_HEADERS" || echo timestamp > stamp-h - -exit 0 -EOF -chmod +x $CONFIG_STATUS -rm -fr confdefs* $ac_clean_files -test "$no_create" = yes || ${CONFIG_SHELL-/bin/sh} $CONFIG_STATUS || exit 1 - diff --git a/gnu/dist/ld/configure.host b/gnu/dist/ld/configure.host deleted file mode 100644 index 0a6b2c48792a..000000000000 --- a/gnu/dist/ld/configure.host +++ /dev/null @@ -1,166 +0,0 @@ -# This is the linker host specific file. This is invoked by the -# autoconf generated configure script. Putting it in a separate shell -# file lets us skip running autoconf when modifying host specific -# information. - -# This file sets the following shell variables: -# HDEFINES host specific compiler flags -# HOSTING_CRT0 crt0.o file used for bootstrapping -# HOSTING_LIBS libraries used for bootstrapping -# NATIVE_LIB_DIRS library directories to search on this host - -HDEFINES= -HOSTING_CRT0=/lib/crt0.o -HOSTING_LIBS='`if [ -f ../gcc/libgcc.a ] ; then echo ../gcc/libgcc.a ; else gcc -print-libgcc-file-name; fi` -lc' -NATIVE_LIB_DIRS= - -case "${host}" in - -*-*-netbsd*) - # The new BSD `make' has a bug: it doesn't pass empty arguments in - # shell commands. So we need to make this value non-empty in order - # for the genscripts.sh call to work. There's nothing magic about - # the value `/lib'; it's just a dummy. - NATIVE_LIB_DIRS=/lib - HOSTING_CRT0=/usr/lib/crt0.o - ;; - -alpha*-*-linux-gnu*) - HOSTING_CRT0='-dynamic-linker `egrep "ld[^ ]*\.so" \`gcc --print-file-name=specs\` | sed -e "s,.*-dynamic-linker[ ][ ]*\(.*/ld[^ ]*.so..\).*,\1,"` `gcc --print-file-name=crt1.o` `gcc --print-file-name=crti.o` `if [ -f ../gcc/crtbegin.o ]; then echo ../gcc/crtbegin.o; else gcc --print-file-name=crtbegin.o; fi`' - HOSTING_LIBS='`if [ -f ../gcc/libgcc.a ] ; then echo ../gcc/libgcc.a ; else gcc -print-libgcc-file-name; fi` -L`dirname \`gcc --print-file-name=libc.so\`` -lc `if [ -f ../gcc/libgcc.a ] ; then echo ../gcc/libgcc.a ; else gcc -print-libgcc-file-name; fi` `if [ -f ../gcc/crtend.o ]; then echo ../gcc/crtend.o; else gcc --print-file-name=crtend.o; fi` `gcc --print-file-name=crtn.o`' - ;; - -alpha*-*-*) - HOSTING_CRT0=/usr/ccs/lib/crt0.o - NATIVE_LIB_DIRS=/usr/ccs/lib - ;; - -i[3456]86-*-bsd* | i[3456]86-*-freebsd*) - # The new BSD `make' has a bug: it doesn't pass empty arguments in - # shell commands. So we need to make this value non-empty in order - # for the genscripts.sh call to work. There's nothing magic about - # the value `/lib'; it's just a dummy. - NATIVE_LIB_DIRS=/lib - HOSTING_CRT0=/usr/lib/crt0.o - ;; - -i[3456]86-*-sysv4*) - HOSTING_CRT0='/usr/ccs/lib/crt1.o /usr/ccs/lib/crti.o /usr/ccs/lib/values-Xa.o `if [ -f ../gcc/crtbegin.o ]; then echo ../gcc/crtbegin.o; else gcc -print-file-name=crtbegin.o; fi`' - HOSTING_LIBS='`if [ -f ../gcc/libgcc.a ] ; then echo ../gcc/libgcc.a ; else gcc -print-libgcc-file-name; fi` -lc `if [ -f ../gcc/crtend.o ]; then echo ../gcc/crtend.o; else gcc -print-file-name=crtend.o; fi` /usr/ccs/lib/crtn.o' - NATIVE_LIB_DIRS=/usr/ccs/lib - ;; - -i[3456]86-sequent-ptx* | i[3456]86-sequent-sysv*) - HOSTING_CRT0='/lib/crt0.o `if [ -f ../gcc/crtbegin.o ]; then echo ../gcc/crtbegin.o; else gcc -print-file-name=crtbegin.o; fi`' - HOSTING_LIBS='`if [ -f ../gcc/libgcc.a ] ; then echo ../gcc/libgcc.a ; else gcc -print-libgcc-file-name; fi` -lc `if [ -f ../gcc/crtend.o ]; then echo ../gcc/crtend.o; else gcc -print-file-name=crtend.o; fi`' - ;; - -i[3456]86-*-sysv*) - HOSTING_CRT0='/lib/crt1.o `if [ -f ../gcc/crtbegin.o ]; then echo ../gcc/crtbegin.o; fi`' - HOSTING_LIBS='`if [ -f ../gcc/libgcc.a ] ; then echo ../gcc/libgcc.a ; else gcc -print-libgcc-file-name; fi` -lc `if [ -f ../gcc/crtend.o ]; then echo ../gcc/crtend.o; fi` /lib/crtn.o' - ;; - -i[3456]86-*-solaris*) - HOSTING_CRT0='`if [ -f ../gcc/crt1.o ]; then echo ../gcc/crt1.o; else gcc -print-file-name=crt1.o; fi` `if [ -f ../gcc/crti.o ]; then echo ../gcc/crti.o; else gcc -print-file-name=crti.o; fi` /usr/ccs/lib/values-Xa.o `if [ -f ../gcc/crtbegin.o ]; then echo ../gcc/crtbegin.o; else gcc -print-file-name=crtbegin.o; fi`' - HOSTING_LIBS='`if [ -f ../gcc/libgcc.a ] ; then echo ../gcc/libgcc.a ; else gcc -print-libgcc-file-name; fi` -lc `if [ -f ../gcc/crtend.o ]; then echo ../gcc/crtend.o; else gcc -print-file-name=crtend.o; fi` `if [ -f ../gcc/crtn.o ]; then echo ../gcc/crtn.o; else gcc -print-file-name=crtn.o; fi`' - NATIVE_LIB_DIRS=/usr/ccs/lib - ;; - -i[3456]86-*-sco* | i[3456]86-*-isc*) - # In some configurations gcc does not use crtbegin.o and crtend.o. - # In that case gcc -print-file-name=crtbegin.o will simply print - # crtbegin.o. We create dummy crtbegin.o and crtend.o files to - # handle this. - echo "int dummy_crtbegin () { return 0; }" > crtbegin.c - ${CC} -c crtbegin.c -o crtbegin.o - rm -f crtbegin.c - echo "int dummy_crteng () { return 0; }" > crtend.c - ${CC} -c crtend.c -o crtend.o - rm -f crtend.c - HOSTING_CRT0='/lib/crt1.o `if [ -f ../gcc/crtbegin.o ]; then echo ../gcc/crtbegin.o; else gcc -print-file-name=crtbegin.o; fi`' - HOSTING_LIBS='`if [ -f ../gcc/libgcc.a ] ; then echo ../gcc/libgcc.a ; else gcc -print-libgcc-file-name; fi` -lc `if [ -f ../gcc/crtend.o ]; then echo ../gcc/crtend.o; else gcc -print-file-name=crtend.o; fi` /lib/crtn.o' - ;; - -i[3456]86-*-linux*aout* | i[3456]86-*-linuxoldld) - HOSTING_CRT0=/usr/lib/crt0.o - ;; - -i[3456]86-*-linux*libc1*) - HOSTING_CRT0='-dynamic-linker /lib/ld-linux.so.1 /usr/lib/crt1.o /usr/lib/crti.o `if [ -f ../gcc/crtbegin.o ]; then echo ../gcc/crtbegin.o; elif [ -f /usr/lib/crtbegin.o ]; then echo /usr/lib/crtbegin.o; else gcc --print-file-name=crtbegin.o; fi`' - HOSTING_LIBS='`if [ -f ../gcc/libgcc.a ] ; then echo ../gcc/libgcc.a ; else gcc -print-libgcc-file-name; fi` -lc `if [ -f ../gcc/libgcc.a ] ; then echo ../gcc/libgcc.a ; else gcc -print-libgcc-file-name; fi` `if [ -f ../gcc/crtend.o ]; then echo ../gcc/crtend.o; elif [ -f /usr/lib/crtend.o ]; then echo /usr/lib/crtend.o; else gcc --print-file-name=crtend.o; fi` /usr/lib/crtn.o' - ;; - -i[3456]86-*-linux-gnu*) - HOSTING_CRT0='-dynamic-linker `fgrep ld-linux.so \`gcc --print-file-name=specs\` | sed -e "s,.*-dynamic-linker[ ][ ]*\(.*/ld-linux.so..\).*,\1,"` `gcc --print-file-name=crt1.o` `gcc --print-file-name=crti.o` `if [ -f ../gcc/crtbegin.o ]; then echo ../gcc/crtbegin.o; else gcc --print-file-name=crtbegin.o; fi`' - HOSTING_LIBS='`if [ -f ../gcc/libgcc.a ] ; then echo ../gcc/libgcc.a ; else gcc -print-libgcc-file-name; fi` -L`dirname \`gcc --print-file-name=libc.so\`` -lc `if [ -f ../gcc/libgcc.a ] ; then echo ../gcc/libgcc.a ; else gcc -print-libgcc-file-name; fi` `if [ -f ../gcc/crtend.o ]; then echo ../gcc/crtend.o; else gcc --print-file-name=crtend.o; fi` `gcc --print-file-name=crtn.o`' - ;; - -i[3456]86-*-lynxos*) - HOSTING_CRT0=/lib/init1.o - HOSTING_LIBS='`if [ -f ../gcc/libgcc.a ] ; then echo ../gcc/libgcc.a ; else gcc -print-libgcc-file-name; fi` -lc -lm /lib/initn.o' - ;; - -mips*-dec-bsd*) - HOSTING_CRT0=/usr/lib/crt0.o - ;; - -mips*-sgi-irix4*) - HOSTING_CRT0=/usr/lib/crt1.o - HOSTING_LIBS='`if [ -f ../gcc/libgcc.a ] ; then echo ../gcc/libgcc.a ; else gcc -print-libgcc-file-name; fi` -lc /usr/lib/crtn.o' - ;; - -mips*-sgi-irix[56]*) - HOSTING_CRT0=/usr/lib/crt1.o - HOSTING_LIBS='`if [ -f ../gcc/libgcc.a ] ; then echo ../gcc/libgcc.a ; else gcc -print-libgcc-file-name; fi` -lc /usr/lib/crtn.o' - ;; - -m68*-*-linux*aout*) - HOSTING_CRT0=/usr/lib/crt0.o - ;; - -m68*-*-linux*libc1*) - HOSTING_CRT0='-dynamic-linker /lib/ld-linux.so.1 /usr/lib/crt1.o /usr/lib/crti.o `if [ -f ../gcc/crtbegin.o ]; then echo ../gcc/crtbegin.o; elif [ -f /usr/lib/crtbegin.o ]; then echo /usr/lib/crtbegin.o; else gcc --print-file-name=crtbegin.o; fi`' - HOSTING_LIBS='`if [ -f ../gcc/libgcc.a ] ; then echo ../gcc/libgcc.a ; else gcc -print-libgcc-file-name; fi` -lc `if [ -f ../gcc/libgcc.a ] ; then echo ../gcc/libgcc.a ; else gcc -print-libgcc-file-name; fi` `if [ -f ../gcc/crtend.o ]; then echo ../gcc/crtend.o; elif [ -f /usr/lib/crtend.o ]; then echo /usr/lib/crtend.o; else gcc --print-file-name=crtend.o; fi` /usr/lib/crtn.o' - ;; - -m68*-*-linux-gnu*) - HOSTING_CRT0='-dynamic-linker /lib/ld.so.1 /usr/lib/crt1.o /usr/lib/crti.o `if [ -f ../gcc/crtbegin.o ]; then echo ../gcc/crtbegin.o; else gcc --print-file-name=crtbegin.o; fi`' - HOSTING_LIBS='`if [ -f ../gcc/libgcc.a ] ; then echo ../gcc/libgcc.a ; else gcc -print-libgcc-file-name; fi` -lc `if [ -f ../gcc/libgcc.a ] ; then echo ../gcc/libgcc.a ; else gcc -print-libgcc-file-name; fi` `if [ -f ../gcc/crtend.o ]; then echo ../gcc/crtend.o; else gcc --print-file-name=crtend.o; fi` /usr/lib/crtn.o' - ;; - -m68*-*-lynxos*) - HOSTING_CRT0=/lib/init1.o - HOSTING_LIBS='`if [ -f ../gcc/libgcc.a ] ; then echo ../gcc/libgcc.a ; else gcc -print-libgcc-file-name; fi` -lc -lm /lib/initn.o' - ;; - -m68*-motorola-sysv) - HOSTING_CRT0='`if [ -f ../gcc/crt0.o ]; then echo ../gcc/crt0.o; elif [ -f \`gcc -print-file-name=\`crt0.o ]; then echo \`gcc -print-file-name=\`crt0.o; else echo /lib/crt0.o; fi`' - HOSTING_LIBS='`if [ -f ../gcc/libgcc.a ] ; then echo ../gcc/libgcc.a ; else gcc -print-libgcc-file-name; fi` -lc881 `if [ -f ../gcc/libgcc.a ] ; then echo ../gcc/libgcc.a ; else gcc -print-libgcc-file-name; fi`' - ;; - -m68*-sun-*) - HOSTING_CRT0='/usr/lib/crt0.o /usr/lib/Fcrt1.o -L/usr/lib/fsoft.o' - ;; - -m88*-*-dgux*) - HDEFINES=-D__using_DGUX - HOSTING_CRT0='/lib/crt0.o -X' - HOSTING_LIBS=/usr/sde/m88kbcs/lib/libc.a - ;; - -m88*-motorola-sysv3) - HOSTING_CRT0='/lib/crt0.o `if [ -f ../gcc/crtbegin.o ]; then echo ../gcc/crtbegin.o; else gcc -print-file-name=crtbegin.o; fi`' - HOSTING_LIBS='`if [ -f ../gcc/libgcc.a ] ; then echo ../gcc/libgcc.a ; else gcc -print-libgcc-file-name; fi` -lc `if [ -f ../gcc/crtend.o ]; then echo ../gcc/crtend.o; else gcc -print-file-name=crtend.o; fi` `if [ -f ../gcc/libgcc.a ] ; then echo ../gcc/libgcc.a ; else gcc -print-libgcc-file-name; fi`' - ;; - -romp-*-*) - HDEFINES=-DNO_VARARGS - ;; - -sparc*-*-solaris2*) - HOSTING_CRT0='`if [ -f ../gcc/crt1.o ]; then echo ../gcc/crt1.o; else gcc -print-file-name=crt1.o; fi` `if [ -f ../gcc/crti.o ]; then echo ../gcc/crti.o; else gcc -print-file-name=crti.o; fi` /usr/ccs/lib/values-Xa.o `if [ -f ../gcc/crtbegin.o ]; then echo ../gcc/crtbegin.o; else gcc -print-file-name=crtbegin.o; fi`' - HOSTING_LIBS='`if [ -f ../gcc/libgcc.a ] ; then echo ../gcc/libgcc.a ; else gcc -print-libgcc-file-name; fi` -lc `if [ -f ../gcc/crtend.o ]; then echo ../gcc/crtend.o; else gcc -print-file-name=crtend.o; fi` `if [ -f ../gcc/crtn.o ]; then echo ../gcc/crtn.o; else gcc -print-file-name=crtn.o; fi`' - NATIVE_LIB_DIRS=/usr/ccs/lib - ;; - -esac diff --git a/gnu/dist/ld/configure.in b/gnu/dist/ld/configure.in deleted file mode 100644 index dbadbe0601a8..000000000000 --- a/gnu/dist/ld/configure.in +++ /dev/null @@ -1,133 +0,0 @@ -dnl Process this file with autoconf to produce a configure script -dnl -AC_PREREG(2.5) -AC_INIT(ldmain.c) - -AC_CANONICAL_SYSTEM - -AM_INIT_AUTOMAKE(ld, 2.9.1) - -AM_PROG_LIBTOOL - -AC_ARG_ENABLE(targets, -[ --enable-targets alternative target configurations], -[case "${enableval}" in - yes | "") AC_ERROR(enable-targets option must specify target names or 'all') - ;; - no) enable_targets= ;; - *) enable_targets=$enableval ;; -esac])dnl -AC_ARG_ENABLE(64-bit-bfd, -[ --enable-64-bit-bfd 64-bit support (on hosts with narrower word sizes)], -[case "${enableval}" in - yes) want64=true ;; - no) want64=false ;; - *) AC_MSG_ERROR(bad value ${enableval} for 64-bit-bfd option) ;; -esac],[want64=false])dnl - -AM_CONFIG_HEADER(config.h:config.in) - -if test -z "$target" ; then - AC_MSG_ERROR(Unrecognized target system type; please check config.sub.) -fi -if test -z "$host" ; then - AC_MSG_ERROR(Unrecognized host system type; please check config.sub.) -fi - -# host-specific stuff: - -AC_PROG_CC -AM_PROG_INSTALL -AM_CYGWIN32 -AM_EXEEXT - -AC_PROG_YACC -AC_PROG_LEX -AC_DECL_YYTEXT - -AM_MAINTAINER_MODE - -. ${srcdir}/configure.host - -AC_SUBST(HDEFINES) -AC_SUBST(HOSTING_CRT0) -AC_SUBST(HOSTING_LIBS) -AC_SUBST(NATIVE_LIB_DIRS) - -AC_CHECK_HEADERS(string.h strings.h stdlib.h unistd.h) -AC_CHECK_FUNCS(sbrk) -AC_HEADER_DIRENT - -BFD_BINARY_FOPEN - -BFD_NEED_DECLARATION(strstr) -BFD_NEED_DECLARATION(free) -BFD_NEED_DECLARATION(sbrk) -BFD_NEED_DECLARATION(getenv) - -# target-specific stuff: - -all_targets= -EMUL= -all_emuls= -TDIRS= - -for targ_alias in `echo $target_alias $enable_targets | sed 's/,/ /g'` -do - if test "$targ_alias" = "all"; then - all_targets=true - else - # Canonicalize the secondary target names. - result=`${CONFIG_SHELL-/bin/sh} $ac_config_sub $targ_alias 2>/dev/null` - if test -n "$result"; then - targ=$result - else - targ=$targ_alias - fi - - . ${srcdir}/configure.tgt - - if test "$targ" = "$target"; then - EMUL=$targ_emul - fi - - for i in $targ_emul $targ_extra_emuls; do - case " $all_emuls " in - *" e${i}.o "*) ;; - *) - all_emuls="$all_emuls e${i}.o" - eval result=\$tdir_$i - test -z "$result" && result=$targ_alias - TDIRS="$TDIRS\\ -tdir_$i=$result" - ;; - esac - done - fi -done - -AC_SUBST(EMUL) -AC_SUBST(TDIRS) - -dnl FIXME: We will build a 64 bit BFD for a 64 bit host or a 64 bit -dnl target, and in those cases we should also build the 64 bit -dnl emulations. -if test x${all_targets} = xtrue; then - if test x${want64} = xtrue; then - EMULATION_OFILES='$(ALL_EMULATIONS) $(ALL_64_EMULATIONS)' - else - EMULATION_OFILES='$(ALL_EMULATIONS)' - fi -else - EMULATION_OFILES=$all_emuls -fi -AC_SUBST(EMULATION_OFILES) - -if test x${enable_static} = xno; then - TESTBFDLIB="--rpath ../bfd/.libs ../bfd/.libs/libbfd.so" -else - TESTBFDLIB="../bfd/.libs/libbfd.a" -fi -AC_SUBST(TESTBFDLIB) - -AC_OUTPUT(Makefile) diff --git a/gnu/dist/ld/configure.tgt b/gnu/dist/ld/configure.tgt deleted file mode 100644 index f8e8b2b51f16..000000000000 --- a/gnu/dist/ld/configure.tgt +++ /dev/null @@ -1,216 +0,0 @@ -# This is the linker target specific file. This is invoked by the -# autoconf generated configure script. Putting it in a separate shell -# file lets us skip running autoconf when modifying target specific -# information. - -# This file switches on the shell variable ${targ}, and sets the -# following shell variables: -# targ_emul name of linker emulation to use -# targ_extra_emuls additional linker emulations to provide - -targ_extra_emuls= - -case "${targ}" in -arm-*-pe) targ_emul=armpe ;; -arc-*-elf*) targ_emul=arcelf ;; -d10v-*-*) targ_emul=d10velf ;; -sparc64-*-aout*) targ_emul=sparcaout ;; -sparc64-*-elf*) targ_emul=elf64_sparc ;; -sparc-sun-sunos4*) targ_emul=sun4 ;; -sparclite*-*-elf) targ_emul=elf32_sparc ;; -sparclite*-*-coff) targ_emul=coff_sparc ;; -sparclite*-fujitsu-*) targ_emul=sparcaout ;; -sparc*-*-aout) targ_emul=sparcaout ;; -sparc*-*-coff) targ_emul=coff_sparc ;; -sparc*-*-elf) targ_emul=elf32_sparc ;; -sparc*-*-sysv4*) targ_emul=elf32_sparc ;; -sparc*-*-linux*aout*) targ_emul=sparclinux - targ_extra_emuls="elf32_sparc sun4" - tdir_elf32_sparc=`echo ${targ_alias} | sed -e 's/aout//'` - tdir_sun4=sparc-sun-sunos4 - ;; -sparc64-*-linux-gnu*) targ_emul=elf64_sparc - targ_extra_emuls="elf32_sparc sparclinux sun4" - tdir_elf32_sparc=`echo ${targ_alias} | sed -e 's/64//'` - tdir_sparclinux=${tdir_elf32_sparc}aout - tdir_sun4=sparc-sun-sunos4 - ;; -sparc*-*-linux-gnu*) targ_emul=elf32_sparc - targ_extra_emuls="sparclinux sun4" - tdir_sparclinux=${targ_alias}aout - tdir_sun4=sparc-sun-sunos4 - ;; -sparc*-*-lynxos*) targ_emul=sparclynx ;; -sparc64-*-netbsd*) targ_emul=elf64_sparc ;; -sparc*-*-netbsd*elf*) targ_emul=elf32_sparc ;; -sparc*-*-netbsd*) targ_emul=sparcnbsd ;; -sparc*-*-solaris2*) targ_emul=elf32_sparc ;; -sparc*-wrs-vxworks*) targ_emul=sparcaout ;; -sparc*-*-rtems*) targ_emul=sparcaout ;; -i960-wrs-vxworks5.0*) targ_emul=gld960 ;; -i960-wrs-vxworks5*) targ_emul=gld960coff ;; -i960-wrs-vxworks*) targ_emul=gld960 ;; -i960-*-coff) targ_emul=gld960coff ;; -i960-intel-nindy) targ_emul=gld960 ;; -i960-*-rtems*) targ_emul=gld960coff ;; -m32r-*-*) targ_emul=m32relf ;; -m68*-sun-sunos[34]*) targ_emul=sun3 ;; -m68*-wrs-vxworks*) targ_emul=sun3 ;; -m68*-ericsson-ose) targ_emul=sun3 ;; -m68*-apple-aux*) targ_emul=m68kaux ;; -*-tandem-none) targ_emul=st2000 ;; -i[3456]86-*-vsta) targ_emul=vsta ;; -i[3456]86-go32-rtems*) targ_emul=i386go32 ;; -i[3456]86-*-go32) targ_emul=i386go32 ;; -i[3456]86-*-msdosdjgpp*) targ_emul=i386go32 ;; -i[3456]86-*-aix*) targ_emul=i386coff ;; -i[3456]86-*-sco*) targ_emul=i386coff ;; -i[3456]86-*-isc*) targ_emul=i386coff ;; -i[3456]86-*-lynxos*) targ_emul=i386lynx ;; -i[3456]86-*-coff) targ_emul=i386coff ;; -i[3456]86-*-rtems*) targ_emul=i386coff ;; -i[3456]86-*-bsd) targ_emul=i386bsd ;; -i[3456]86-*-bsd386) targ_emul=i386bsd ;; -i[3456]86-*-bsdi*) targ_emul=i386bsd ;; -i[3456]86-*-aout) targ_emul=i386aout ;; -i[3456]86-*-linux*aout*) targ_emul=i386linux - targ_extra_emuls=elf_i386 - tdir_elf_i386=`echo ${targ_alias} | sed -e 's/aout//'` - ;; -i[3456]86-*-linuxoldld) targ_emul=i386linux; targ_extra_emuls=elf_i386 ;; -i[3456]86-*-linux-gnu*) targ_emul=elf_i386 - targ_extra_emuls=i386linux - tdir_i386linux=${targ_alias}aout - ;; -i[3456]86-*-sysv4*) targ_emul=elf_i386 ;; -i[3456]86-*-unixware) targ_emul=elf_i386 ;; -i[3456]86-*-netbsdelf*) targ_emul=elf_i386 ;; -i[3456]86-*-netbsd*) targ_emul=i386nbsd ;; -i[3456]86-*-netware) targ_emul=i386nw ;; -i[3456]86-*-elf*) targ_emul=elf_i386 ;; -i[3456]86-*-freebsdelf*) targ_emul=elf_i386 ;; -i[3456]86-*-freebsd*) targ_emul=i386bsd ;; -i[3456]86-*-sysv*) targ_emul=i386coff ;; -i[3456]86-*-ptx*) targ_emul=i386coff ;; -i[3456]86-*-mach*) targ_emul=i386mach ;; -i[3456]86-*-gnu*) targ_emul=elf_i386 ;; -i[3456]86-*-msdos*) targ_emul=i386msdos; targ_extra_emuls=i386aout ;; -i[3456]86-*-moss*) targ_emul=i386moss; targ_extra_emuls=i386msdos ;; -i[3456]86-*-winnt*) targ_emul=i386pe ;; -i[3456]86-*-pe) targ_emul=i386pe ;; -i[3456]86-*-cygwin32*) targ_emul=i386pe ;; -i[3456]86-*-mingw32*) targ_emul=i386pe ;; -m8*-*-*) targ_emul=m88kbcs ;; -a29k-*-udi) targ_emul=sa29200 ;; -a29k-*-ebmon) targ_emul=ebmon29k ;; -a29k-*-*) targ_emul=a29k ;; -# arm-*-riscix*) targ_emul=riscix ;; -arm-*-aout | armel-*-aout) targ_emul=armaoutl ;; -armeb-*-aout) targ_emul=armaoutb ;; -arm-*-coff) targ_emul=armcoff ;; -arm-*-netbsd*) targ_emul=armnbsd ;; -thumb-*-coff) targ_emul=armcoff ;; -thumb-*-pe) targ_emul=armpe ;; -h8300-*-hms) targ_emul=h8300; targ_extra_emuls="h8300h h8300s" - ;; -h8500-*-hms) targ_emul=h8500 - targ_extra_emuls="h8500s h8500b h8500m h8500c" - ;; -sh-*-elf*) targ_emul=shelf - targ_extra_emuls="shlelf sh shl" - ;; -sh-*-*|sh-*-rtems*) targ_emul=sh; targ_extra_emuls=shl ;; -m68k-sony-*) targ_emul=news ;; -m68k-hp-bsd*) targ_emul=hp300bsd ;; -m68*-motorola-sysv*) targ_emul=delta68 ;; -m68*-*-aout) targ_emul=m68kaout ;; -m68*-*-coff) targ_emul=m68kcoff ;; -m68*-*-elf) targ_emul=m68kelf ;; -m68*-*-hpux*) targ_emul=hp3hpux ;; -m68k-*-linux*aout*) targ_emul=m68klinux - targ_extra_emuls=m68kelf - tdir_m68kelf=`echo ${targ_alias} | sed -e 's/aout//'` - ;; -m68k-*-linux-gnu*) targ_emul=m68kelf - targ_extra_emuls=m68klinux - tdir_m68klinux=`echo ${targ_alias} | sed -e 's/linux/linuxaout/'` - ;; -m68*-*-lynxos*) targ_emul=m68klynx ;; -m68*-hp*-netbsd*) targ_emul=m68k4knbsd ;; -m68*-*-netbsdelf*) targ_emul=m68kelf ;; -m68*-*-netbsd*) targ_emul=m68knbsd ;; -m68*-*-psos*) targ_emul=m68kpsos ;; -m68*-*-rtems*) targ_emul=m68kcoff ;; -hppa*-*-*elf*) targ_emul=hppaelf ;; -hppa*-*-lites*) targ_emul=hppaelf ;; -hppa*-*-rtems*) targ_emul=hppaelf ;; -vax-dec-ultrix* | vax-dec-bsd*) targ_emul=vax ;; -mips*-dec-ultrix*) targ_emul=mipslit ;; -mips*-dec-osf*) targ_emul=mipslit ;; -mips*-sgi-irix[56]*) targ_emul=elf32bsmip ;; -mips*-sgi-irix*) targ_emul=mipsbig ;; -mips*el-*-ecoff*) targ_emul=mipsidtl ;; -mips*-*-ecoff*) targ_emul=mipsidt ;; -mips*-dec-bsd*) targ_emul=mipsbsd ;; -mips*el*-*-netbsd* | mips-dec-netbsd*) targ_emul=elf32lmip ;; -mips*-*-netbsd*) targ_emul=elf32bmip ;; -mips*-*-bsd*) targ_emul=mipsbig ;; -mips*vr4300el-*-elf*) targ_emul=elf32l4300 ;; -mips*vr4300-*-elf*) targ_emul=elf32b4300 ;; -mips*vr4100el-*-elf*) targ_emul=elf32l4300 ;; -mips*vr4100-*-elf*) targ_emul=elf32b4300 ;; -mips*vr5000el-*-elf*) targ_emul=elf32l4300 ;; -mips*vr5000-*-elf*) targ_emul=elf32b4300 ;; -mips*el-*-elf*) targ_emul=elf32elmip ;; -mips*-*-elf*) targ_emul=elf32ebmip ;; -mips*-*-rtems*) targ_emul=elf32ebmip ;; -mips*el-*-linux-gnu*) targ_emul=elf32lsmip - targ_extra_emuls="elf32bsmip mipslit mipsbig" - ;; -mips*-*-linux-gnu*) targ_emul=elf32bsmip - targ_extra_emuls="elf32lsmip mipsbig mipslit" - ;; -mips*-*-lnews*) targ_emul=mipslnews ;; -mn10200-*-*) targ_emul=mn10200 ;; -mn10300-*-*) targ_emul=mn10300 ;; -alpha*-*-linuxecoff*) targ_emul=alpha targ_extra_emuls=elf64alpha - tdir_elf64alpha=`echo ${targ_alias} | sed -e 's/ecoff//'` - ;; -alpha*-*-linux-gnu*) targ_emul=elf64alpha targ_extra_emuls=alpha - tdir_alpha=`echo ${targ_alias} | sed -e 's/linux/linuxecoff/'` - ;; -alpha*-*-osf*) targ_emul=alpha ;; -alpha*-*-gnu*) targ_emul=elf64alpha ;; -alpha*-*-netware*) targ_emul=alpha ;; -alpha*-*-netbsd*) targ_emul=elf64alpha ;; -z8k-*-coff) targ_emul=z8002; targ_extra_emuls=z8001 ;; -ns32k-pc532-mach* | ns32k-pc532-ux*) targ_emul=pc532macha ;; -ns32k-pc532-netbsd* | ns32k-pc532-lites*) targ_emul=ns32knbsd ;; -powerpc-*-elf* | powerpc-*-eabi* | powerpc-*-linux-gnu* | powerpc-*-sysv* \ - | powerpc-*-netbsd*) - targ_emul=elf32ppc ;; -powerpcle-*-elf* | powerpcle-*-eabi* | powerpcle-*-solaris* | powerpcle-*-sysv*) targ_emul=elf32lppc ;; -powerpc-*-rtems*) targ_emul=elf32ppc ;; -powerpc-*-macos*) targ_emul=ppcmacos ;; -powerpc-*-netware*) targ_emul=ppcnw ;; -powerpcle-*-pe) targ_emul=ppcpe ;; -powerpcle-*-winnt*) targ_emul=ppcpe ;; -powerpcle-*-cygwin32) targ_emul=ppcpe ;; -powerpc-*-aix*) targ_emul=aixppc ;; -powerpc-*-beos*) targ_emul=aixppc ;; -rs6000-*-aix*) targ_emul=aixrs6 ;; -tic30-*-*aout*) targ_emul=tic30aout ;; -tic30-*-*coff*) targ_emul=tic30coff ;; -v850-*-*) targ_emul=v850 ;; -w65-*-*) targ_emul=w65 ;; -*-*-aout) targ_emul=${target_cpu}-${target_vendor} ;; -*-*-coff) targ_emul=${target_cpu}-${target_vendor} ;; -*-*-netware) targ_emul=${target_cpu}-nw ;; -*-*-ieee*) targ_emul=vanilla ;; - -*) - echo 2>&1 "*** ld does not support target ${targ}" - echo 2>&1 "*** see ld/configure.tgt for supported targets" - exit 1 - -esac diff --git a/gnu/dist/ld/dep-in.sed b/gnu/dist/ld/dep-in.sed deleted file mode 100644 index 8c80eb06a202..000000000000 --- a/gnu/dist/ld/dep-in.sed +++ /dev/null @@ -1,16 +0,0 @@ -:loop -/\\$/N -/\\$/b loop - -s!@INCDIR@!$(INCDIR)!g -s!@SRCDIR@/!!g -s!\.\./bfd/hosts/[^ ]*\.h ! !g - -s/\\\n */ /g - -s/ *$// -s/ */ /g -/:$/d - -s/\(.\{50\}[^ ]*\) /\1 \\\ - /g diff --git a/gnu/dist/ld/emulparams/README b/gnu/dist/ld/emulparams/README deleted file mode 100644 index b3d6d26c4e0e..000000000000 --- a/gnu/dist/ld/emulparams/README +++ /dev/null @@ -1,2 +0,0 @@ -The files in this directory are read by genscripts.sh as shell commands. -They set parameters for the emulations. diff --git a/gnu/dist/ld/emulparams/a29k.sh b/gnu/dist/ld/emulparams/a29k.sh deleted file mode 100644 index 89c8e85c1c82..000000000000 --- a/gnu/dist/ld/emulparams/a29k.sh +++ /dev/null @@ -1,5 +0,0 @@ -SCRIPT_NAME=a29k -OUTPUT_FORMAT="coff-a29k-big" -TEXT_START_ADDR=0x1000000 -TARGET_PAGE_SIZE=0x1000000 -ARCH=a29k diff --git a/gnu/dist/ld/emulparams/aixppc.sh b/gnu/dist/ld/emulparams/aixppc.sh deleted file mode 100644 index f92e686dd6d9..000000000000 --- a/gnu/dist/ld/emulparams/aixppc.sh +++ /dev/null @@ -1,4 +0,0 @@ -TEMPLATE_NAME=aix -SCRIPT_NAME=aix -OUTPUT_FORMAT="aixcoff-rs6000" -ARCH=powerpc diff --git a/gnu/dist/ld/emulparams/aixrs6.sh b/gnu/dist/ld/emulparams/aixrs6.sh deleted file mode 100644 index 733c3f7ab0ff..000000000000 --- a/gnu/dist/ld/emulparams/aixrs6.sh +++ /dev/null @@ -1,4 +0,0 @@ -TEMPLATE_NAME=aix -SCRIPT_NAME=aix -OUTPUT_FORMAT="aixcoff-rs6000" -ARCH=rs6000 diff --git a/gnu/dist/ld/emulparams/alpha.sh b/gnu/dist/ld/emulparams/alpha.sh deleted file mode 100644 index 141923f71708..000000000000 --- a/gnu/dist/ld/emulparams/alpha.sh +++ /dev/null @@ -1,3 +0,0 @@ -SCRIPT_NAME=alpha -OUTPUT_FORMAT="ecoff-littlealpha" -ARCH=alpha diff --git a/gnu/dist/ld/emulparams/arcelf.sh b/gnu/dist/ld/emulparams/arcelf.sh deleted file mode 100644 index b1c9c1760cee..000000000000 --- a/gnu/dist/ld/emulparams/arcelf.sh +++ /dev/null @@ -1,11 +0,0 @@ -SCRIPT_NAME=elf -OUTPUT_FORMAT="elf32-littlearc" -LITTLE_OUTPUT_FORMAT="elf32-littlearc" -BIG_OUTPUT_FORMAT="elf32-bigarc" -TEXT_START_ADDR=0x0 -MAXPAGESIZE=0x1000 -NONPAGED_TEXT_START_ADDR=0x0 -ARCH=arc -MACHINE= -ENTRY=start -#TEMPLATE_NAME=elf32 diff --git a/gnu/dist/ld/emulparams/armaoutb.sh b/gnu/dist/ld/emulparams/armaoutb.sh deleted file mode 100644 index 59ab6f14f607..000000000000 --- a/gnu/dist/ld/emulparams/armaoutb.sh +++ /dev/null @@ -1,7 +0,0 @@ -SCRIPT_NAME=armaout -OUTPUT_FORMAT="a.out-arm-big" -HEADER_START_ADDR=0x8000 -TEXT_START_ADDR=0x8000 -NONPAGED_TEXT_START_ADDRESS=0x8000 -TARGET_PAGE_SIZE=32768 -ARCH=arm diff --git a/gnu/dist/ld/emulparams/armaoutl.sh b/gnu/dist/ld/emulparams/armaoutl.sh deleted file mode 100644 index 9501f33ec2a2..000000000000 --- a/gnu/dist/ld/emulparams/armaoutl.sh +++ /dev/null @@ -1,7 +0,0 @@ -SCRIPT_NAME=armaout -OUTPUT_FORMAT="a.out-arm-little" -HEADER_START_ADDR=0x8000 -TEXT_START_ADDR=0x8000 -NONPAGED_TEXT_START_ADDRESS=0x8000 -TARGET_PAGE_SIZE=32768 -ARCH=arm diff --git a/gnu/dist/ld/emulparams/armcoff.sh b/gnu/dist/ld/emulparams/armcoff.sh deleted file mode 100644 index 91df7d3c41d4..000000000000 --- a/gnu/dist/ld/emulparams/armcoff.sh +++ /dev/null @@ -1,6 +0,0 @@ -ARCH=arm -SCRIPT_NAME=armcoff -OUTPUT_FORMAT="coff-arm-little" -LITTLE_OUTPUT_FORMAT="coff-arm-little" -BIG_OUTPUT_FORMAT="coff-arm-big" -TEMPLATE_NAME=armcoff diff --git a/gnu/dist/ld/emulparams/armnbsd.sh b/gnu/dist/ld/emulparams/armnbsd.sh deleted file mode 100644 index fc2779164a0e..000000000000 --- a/gnu/dist/ld/emulparams/armnbsd.sh +++ /dev/null @@ -1,7 +0,0 @@ -SCRIPT_NAME=aout -TEXT_START_ADDR=0x1020 -OUTPUT_FORMAT="a.out-arm-netbsd" -TARGET_PAGE_SIZE=0x1000 -ARCH=arm -EXECUTABLE_SYMBOLS='__DYNAMIC = 0;' -NONPAGED_TEXT_START_ADDR=0x1000 diff --git a/gnu/dist/ld/emulparams/armpe.sh b/gnu/dist/ld/emulparams/armpe.sh deleted file mode 100644 index 22468050e542..000000000000 --- a/gnu/dist/ld/emulparams/armpe.sh +++ /dev/null @@ -1,6 +0,0 @@ -ARCH=arm -SCRIPT_NAME=pe -OUTPUT_FORMAT="pei-arm-little" -LITTLE_OUTPUT_FORMAT="pei-arm-little" -BIG_OUTPUT_FORMAT="pei-arm-big" -TEMPLATE_NAME=pe diff --git a/gnu/dist/ld/emulparams/coff_sparc.sh b/gnu/dist/ld/emulparams/coff_sparc.sh deleted file mode 100644 index 0cf852a7b215..000000000000 --- a/gnu/dist/ld/emulparams/coff_sparc.sh +++ /dev/null @@ -1,7 +0,0 @@ -SCRIPT_NAME=sparccoff -OUTPUT_FORMAT="coff-sparc" -# following are dubious (borrowed from sparc lynx) -TARGET_PAGE_SIZE=0x1000 -TEXT_START_ADDR=0 -NONPAGED_TEXT_START_ADDR=0x1000 -ARCH=sparc diff --git a/gnu/dist/ld/emulparams/d10velf.sh b/gnu/dist/ld/emulparams/d10velf.sh deleted file mode 100644 index f77cd4648c0f..000000000000 --- a/gnu/dist/ld/emulparams/d10velf.sh +++ /dev/null @@ -1,8 +0,0 @@ -MACHINE= -SCRIPT_NAME=elfd10v -OUTPUT_FORMAT="elf32-d10v" -TEXT_START_ADDR=0x01000000 -READONLY_START_ADDR=0x00000004 -ARCH=d10v -MAXPAGESIZE=32 -EMBEDDED=t diff --git a/gnu/dist/ld/emulparams/delta68.sh b/gnu/dist/ld/emulparams/delta68.sh deleted file mode 100644 index e3c590991990..000000000000 --- a/gnu/dist/ld/emulparams/delta68.sh +++ /dev/null @@ -1,5 +0,0 @@ -SCRIPT_NAME=delta68 -OUTPUT_FORMAT="coff-m68k-sysv" -TEXT_START_ADDR=0x2000 -PAGE_SIZE=0x1000000 -ARCH=m68k diff --git a/gnu/dist/ld/emulparams/ebmon29k.sh b/gnu/dist/ld/emulparams/ebmon29k.sh deleted file mode 100644 index fbc2bd1e464c..000000000000 --- a/gnu/dist/ld/emulparams/ebmon29k.sh +++ /dev/null @@ -1,5 +0,0 @@ -SCRIPT_NAME=ebmon29k -OUTPUT_FORMAT="coff-a29k-big" -TEXT_START_ADDR=0x8000 -TARGET_PAGE_SIZE=0x1000 -ARCH=a29k diff --git a/gnu/dist/ld/emulparams/elf32_sparc.sh b/gnu/dist/ld/emulparams/elf32_sparc.sh deleted file mode 100644 index e5a666bbbf8f..000000000000 --- a/gnu/dist/ld/emulparams/elf32_sparc.sh +++ /dev/null @@ -1,11 +0,0 @@ -SCRIPT_NAME=elf -OUTPUT_FORMAT="elf32-sparc" -TEXT_START_ADDR=0x10000 -MAXPAGESIZE=0x10000 -NONPAGED_TEXT_START_ADDR=0x10000 -ARCH=sparc -MACHINE= -TEMPLATE_NAME=elf32 -DATA_PLT= -GENERATE_SHLIB_SCRIPT=yes -ELFSIZE=32 diff --git a/gnu/dist/ld/emulparams/elf32b4300.sh b/gnu/dist/ld/emulparams/elf32b4300.sh deleted file mode 100644 index 24f8d98eab0c..000000000000 --- a/gnu/dist/ld/emulparams/elf32b4300.sh +++ /dev/null @@ -1,29 +0,0 @@ -SCRIPT_NAME=elf -OUTPUT_FORMAT="elf32-bigmips" -BIG_OUTPUT_FORMAT="elf32-bigmips" -LITTLE_OUTPUT_FORMAT="elf32-littlemips" -TEXT_START_ADDR=0xa0020000 -MAXPAGESIZE=0x40000 -INITIAL_READONLY_SECTIONS='.reginfo : { *(.reginfo) }' -OTHER_TEXT_SECTIONS='*(.mips16.fn.*) *(.mips16.call.*)' -OTHER_GOT_SYMBOLS=' - _gp = ALIGN(16) + 0x7ff0; -' -OTHER_GOT_SECTIONS=' - .lit8 : { *(.lit8) } - .lit4 : { *(.lit4) } -' -TEXT_START_SYMBOLS='_ftext = . ;' -DATA_START_SYMBOLS='_fdata = . ;' -OTHER_BSS_SYMBOLS='_fbss = .;' -EXECUTABLE_SYMBOLS='_DYNAMIC_LINK = 0;' -OTHER_SECTIONS=' - .gptab.sdata : { *(.gptab.data) *(.gptab.sdata) } - .gptab.sbss : { *(.gptab.bss) *(.gptab.sbss) } -' -ARCH=mips -MACHINE= -TEMPLATE_NAME=elf32 -GENERATE_SHLIB_SCRIPT=yes -DYNAMIC_LINK=false -EMBEDDED=yes diff --git a/gnu/dist/ld/emulparams/elf32bmip.sh b/gnu/dist/ld/emulparams/elf32bmip.sh deleted file mode 100644 index 473c41169e00..000000000000 --- a/gnu/dist/ld/emulparams/elf32bmip.sh +++ /dev/null @@ -1,30 +0,0 @@ -SCRIPT_NAME=elf -OUTPUT_FORMAT="elf32-bigmips" -BIG_OUTPUT_FORMAT="elf32-bigmips" -LITTLE_OUTPUT_FORMAT="elf32-littlemips" -TEXT_START_ADDR=0x0400000 -DATA_ADDR=0x10000000 -MAXPAGESIZE=0x40000 -NONPAGED_TEXT_START_ADDR=0x0400000 -SHLIB_TEXT_START_ADDR=0x5ffe0000 -TEXT_DYNAMIC= -INITIAL_READONLY_SECTIONS='.reginfo : { *(.reginfo) }' -OTHER_TEXT_SECTIONS='*(.mips16.fn.*) *(.mips16.call.*)' -OTHER_GOT_SYMBOLS=' - _gp = ALIGN(16) + 0x7ff0; -' -OTHER_GOT_SECTIONS=' - .lit8 : { *(.lit8) } - .lit4 : { *(.lit4) } -' -TEXT_START_SYMBOLS='_ftext = . ;' -DATA_START_SYMBOLS='_fdata = . ;' -OTHER_BSS_SYMBOLS='_fbss = .;' -OTHER_SECTIONS=' - .gptab.sdata : { *(.gptab.data) *(.gptab.sdata) } - .gptab.sbss : { *(.gptab.bss) *(.gptab.sbss) } -' -ARCH=mips -MACHINE= -TEMPLATE_NAME=elf32 -GENERATE_SHLIB_SCRIPT=yes diff --git a/gnu/dist/ld/emulparams/elf32bsmip.sh b/gnu/dist/ld/emulparams/elf32bsmip.sh deleted file mode 100644 index 09f130764370..000000000000 --- a/gnu/dist/ld/emulparams/elf32bsmip.sh +++ /dev/null @@ -1,31 +0,0 @@ -SCRIPT_NAME=elf -OUTPUT_FORMAT="elf32-bigmips" -BIG_OUTPUT_FORMAT="elf32-bigmips" -LITTLE_OUTPUT_FORMAT="elf32-littlemips" -TEXT_START_ADDR=0x0400000 -DATA_ADDR=0x10000000 -MAXPAGESIZE=0x40000 -NONPAGED_TEXT_START_ADDR=0x0400000 -SHLIB_TEXT_START_ADDR=0x5ffe0000 -TEXT_DYNAMIC= -INITIAL_READONLY_SECTIONS='.reginfo : { *(.reginfo) }' -OTHER_TEXT_SECTIONS='*(.mips16.fn.*) *(.mips16.call.*)' -OTHER_GOT_SYMBOLS=' - _gp = ALIGN(16) + 0x7ff0; -' -OTHER_GOT_SECTIONS=' - .lit8 : { *(.lit8) } - .lit4 : { *(.lit4) } -' -TEXT_START_SYMBOLS='_ftext = . ;' -DATA_START_SYMBOLS='_fdata = . ;' -OTHER_BSS_SYMBOLS='_fbss = .;' -OTHER_SECTIONS=' - .gptab.sdata : { *(.gptab.data) *(.gptab.sdata) } - .gptab.sbss : { *(.gptab.bss) *(.gptab.sbss) } -' -ARCH=mips -MACHINE= -TEMPLATE_NAME=elf32 -GENERATE_SHLIB_SCRIPT=yes -ENTRY=__start diff --git a/gnu/dist/ld/emulparams/elf32ebmip.sh b/gnu/dist/ld/emulparams/elf32ebmip.sh deleted file mode 100644 index a6b80a9dd90f..000000000000 --- a/gnu/dist/ld/emulparams/elf32ebmip.sh +++ /dev/null @@ -1,29 +0,0 @@ -SCRIPT_NAME=elf -OUTPUT_FORMAT="elf32-bigmips" -BIG_OUTPUT_FORMAT="elf32-bigmips" -LITTLE_OUTPUT_FORMAT="elf32-littlemips" -TEXT_START_ADDR=0x0400000 -MAXPAGESIZE=0x40000 -NONPAGED_TEXT_START_ADDR=0x0400000 -SHLIB_TEXT_START_ADDR=0x5ffe0000 -INITIAL_READONLY_SECTIONS='.reginfo : { *(.reginfo) }' -OTHER_TEXT_SECTIONS='*(.mips16.fn.*) *(.mips16.call.*)' -OTHER_GOT_SYMBOLS=' - _gp = ALIGN(16) + 0x7ff0; -' -OTHER_GOT_SECTIONS=' - .lit8 : { *(.lit8) } - .lit4 : { *(.lit4) } -' -TEXT_START_SYMBOLS='_ftext = . ;' -DATA_START_SYMBOLS='_fdata = . ;' -OTHER_BSS_SYMBOLS='_fbss = .;' -OTHER_SECTIONS=' - .gptab.sdata : { *(.gptab.data) *(.gptab.sdata) } - .gptab.sbss : { *(.gptab.bss) *(.gptab.sbss) } -' -ARCH=mips -MACHINE= -TEMPLATE_NAME=elf32 -GENERATE_SHLIB_SCRIPT=yes -EMBEDDED=yes diff --git a/gnu/dist/ld/emulparams/elf32elmip.sh b/gnu/dist/ld/emulparams/elf32elmip.sh deleted file mode 100644 index 313d74a88a3d..000000000000 --- a/gnu/dist/ld/emulparams/elf32elmip.sh +++ /dev/null @@ -1,29 +0,0 @@ -SCRIPT_NAME=elf -OUTPUT_FORMAT="elf32-littlemips" -BIG_OUTPUT_FORMAT="elf32-bigmips" -LITTLE_OUTPUT_FORMAT="elf32-littlemips" -TEXT_START_ADDR=0x0400000 -MAXPAGESIZE=0x40000 -NONPAGED_TEXT_START_ADDR=0x0400000 -SHLIB_TEXT_START_ADDR=0x5ffe0000 -INITIAL_READONLY_SECTIONS='.reginfo : { *(.reginfo) }' -OTHER_TEXT_SECTIONS='*(.mips16.fn.*) *(.mips16.call.*)' -OTHER_GOT_SYMBOLS=' - _gp = ALIGN(16) + 0x7ff0; -' -OTHER_GOT_SECTIONS=' - .lit8 : { *(.lit8) } - .lit4 : { *(.lit4) } -' -TEXT_START_SYMBOLS='_ftext = . ;' -DATA_START_SYMBOLS='_fdata = . ;' -OTHER_BSS_SYMBOLS='_fbss = .;' -OTHER_SECTIONS=' - .gptab.sdata : { *(.gptab.data) *(.gptab.sdata) } - .gptab.sbss : { *(.gptab.bss) *(.gptab.sbss) } -' -ARCH=mips -MACHINE= -TEMPLATE_NAME=elf32 -GENERATE_SHLIB_SCRIPT=yes -EMBEDDED=yes diff --git a/gnu/dist/ld/emulparams/elf32l4300.sh b/gnu/dist/ld/emulparams/elf32l4300.sh deleted file mode 100644 index 690de88b3aaf..000000000000 --- a/gnu/dist/ld/emulparams/elf32l4300.sh +++ /dev/null @@ -1,29 +0,0 @@ -SCRIPT_NAME=elf -OUTPUT_FORMAT="elf32-littlemips" -BIG_OUTPUT_FORMAT="elf32-bigmips" -LITTLE_OUTPUT_FORMAT="elf32-littlemips" -TEXT_START_ADDR=0xa0020000 -MAXPAGESIZE=0x40000 -INITIAL_READONLY_SECTIONS='.reginfo : { *(.reginfo) }' -OTHER_TEXT_SECTIONS='*(.mips16.fn.*) *(.mips16.call.*)' -OTHER_GOT_SYMBOLS=' - _gp = ALIGN(16) + 0x7ff0; -' -OTHER_GOT_SECTIONS=' - .lit8 : { *(.lit8) } - .lit4 : { *(.lit4) } -' -TEXT_START_SYMBOLS='_ftext = . ;' -DATA_START_SYMBOLS='_fdata = . ;' -OTHER_BSS_SYMBOLS='_fbss = .;' -EXECUTABLE_SYMBOLS='_DYNAMIC_LINK = 0;' -OTHER_SECTIONS=' - .gptab.sdata : { *(.gptab.data) *(.gptab.sdata) } - .gptab.sbss : { *(.gptab.bss) *(.gptab.sbss) } -' -ARCH=mips -MACHINE= -TEMPLATE_NAME=elf32 -GENERATE_SHLIB_SCRIPT=yes -DYNAMIC_LINK=false -EMBEDDED=yes diff --git a/gnu/dist/ld/emulparams/elf32lmip.sh b/gnu/dist/ld/emulparams/elf32lmip.sh deleted file mode 100644 index 23312f44acae..000000000000 --- a/gnu/dist/ld/emulparams/elf32lmip.sh +++ /dev/null @@ -1,30 +0,0 @@ -SCRIPT_NAME=elf -OUTPUT_FORMAT="elf32-littlemips" -BIG_OUTPUT_FORMAT="elf32-bigmips" -LITTLE_OUTPUT_FORMAT="elf32-littlemips" -TEXT_START_ADDR=0x0400000 -DATA_ADDR=0x10000000 -MAXPAGESIZE=0x40000 -NONPAGED_TEXT_START_ADDR=0x0400000 -SHLIB_TEXT_START_ADDR=0x5ffe0000 -TEXT_DYNAMIC= -INITIAL_READONLY_SECTIONS='.reginfo : { *(.reginfo) }' -OTHER_TEXT_SECTIONS='*(.mips16.fn.*) *(.mips16.call.*)' -OTHER_GOT_SYMBOLS=' - _gp = ALIGN(16) + 0x7ff0; -' -OTHER_GOT_SECTIONS=' - .lit8 : { *(.lit8) } - .lit4 : { *(.lit4) } -' -TEXT_START_SYMBOLS='_ftext = . ;' -DATA_START_SYMBOLS='_fdata = . ;' -OTHER_BSS_SYMBOLS='_fbss = .;' -OTHER_SECTIONS=' - .gptab.sdata : { *(.gptab.data) *(.gptab.sdata) } - .gptab.sbss : { *(.gptab.bss) *(.gptab.sbss) } -' -ARCH=mips -MACHINE= -TEMPLATE_NAME=elf32 -GENERATE_SHLIB_SCRIPT=yes diff --git a/gnu/dist/ld/emulparams/elf32lppc.sh b/gnu/dist/ld/emulparams/elf32lppc.sh deleted file mode 100644 index edffc610d490..000000000000 --- a/gnu/dist/ld/emulparams/elf32lppc.sh +++ /dev/null @@ -1,8 +0,0 @@ -TEMPLATE_NAME=elf32 -GENERATE_SHLIB_SCRIPT=yes -SCRIPT_NAME=elfppc -OUTPUT_FORMAT="elf32-powerpcle" -TEXT_START_ADDR=0x40000 -MAXPAGESIZE=0x40000 -ARCH=powerpc -MACHINE= diff --git a/gnu/dist/ld/emulparams/elf32lsmip.sh b/gnu/dist/ld/emulparams/elf32lsmip.sh deleted file mode 100644 index 4bdc8a10e698..000000000000 --- a/gnu/dist/ld/emulparams/elf32lsmip.sh +++ /dev/null @@ -1,31 +0,0 @@ -SCRIPT_NAME=elf -OUTPUT_FORMAT="elf32-littlemips" -BIG_OUTPUT_FORMAT="elf32-bigmips" -LITTLE_OUTPUT_FORMAT="elf32-littlemips" -TEXT_START_ADDR=0x0400000 -DATA_ADDR=0x10000000 -MAXPAGESIZE=0x40000 -NONPAGED_TEXT_START_ADDR=0x0400000 -SHLIB_TEXT_START_ADDR=0x5ffe0000 -TEXT_DYNAMIC= -INITIAL_READONLY_SECTIONS='.reginfo : { *(.reginfo) }' -OTHER_TEXT_SECTIONS='*(.mips16.fn.*) *(.mips16.call.*)' -OTHER_GOT_SYMBOLS=' - _gp = ALIGN(16) + 0x7ff0; -' -OTHER_GOT_SECTIONS=' - .lit8 : { *(.lit8) } - .lit4 : { *(.lit4) } -' -TEXT_START_SYMBOLS='_ftext = . ;' -DATA_START_SYMBOLS='_fdata = . ;' -OTHER_BSS_SYMBOLS='_fbss = .;' -OTHER_SECTIONS=' - .gptab.sdata : { *(.gptab.data) *(.gptab.sdata) } - .gptab.sbss : { *(.gptab.bss) *(.gptab.sbss) } -' -ARCH=mips -MACHINE= -TEMPLATE_NAME=elf32 -GENERATE_SHLIB_SCRIPT=yes -ENTRY=__start diff --git a/gnu/dist/ld/emulparams/elf32ppc.sh b/gnu/dist/ld/emulparams/elf32ppc.sh deleted file mode 100644 index 8af42f1ddfdb..000000000000 --- a/gnu/dist/ld/emulparams/elf32ppc.sh +++ /dev/null @@ -1,8 +0,0 @@ -TEMPLATE_NAME=elf32 -GENERATE_SHLIB_SCRIPT=yes -SCRIPT_NAME=elfppc -OUTPUT_FORMAT="elf32-powerpc" -TEXT_START_ADDR=0x01800000 -MAXPAGESIZE=0x40000 -ARCH=powerpc -MACHINE= diff --git a/gnu/dist/ld/emulparams/elf32shlunx.sh b/gnu/dist/ld/emulparams/elf32shlunx.sh deleted file mode 100644 index 611fa1b5bae3..000000000000 --- a/gnu/dist/ld/emulparams/elf32shlunx.sh +++ /dev/null @@ -1,15 +0,0 @@ -SCRIPT_NAME=elf -OUTPUT_FORMAT="elf32-shl-unx" -TEXT_START_ADDR=0x1000 -MAXPAGESIZE=0x1000 -ARCH=sh -MACHINE= -TEMPLATE_NAME=elf32 -GENERATE_SHLIB_SCRIPT=yes - -# These are for compatibility with the COFF toolchain. -ENTRY=start -CTOR_START='___ctors = .;' -CTOR_END='___ctors_end = .;' -DTOR_START='___dtors = .;' -DTOR_END='___dtors_end = .;' diff --git a/gnu/dist/ld/emulparams/elf32shunx.sh b/gnu/dist/ld/emulparams/elf32shunx.sh deleted file mode 100644 index 7ac622326b92..000000000000 --- a/gnu/dist/ld/emulparams/elf32shunx.sh +++ /dev/null @@ -1,15 +0,0 @@ -SCRIPT_NAME=elf -OUTPUT_FORMAT="elf32-sh-unx" -TEXT_START_ADDR=0x1000 -MAXPAGESIZE=0x1000 -ARCH=sh -MACHINE= -TEMPLATE_NAME=elf32 -GENERATE_SHLIB_SCRIPT=yes - -# These are for compatibility with the COFF toolchain. -ENTRY=start -CTOR_START='___ctors = .;' -CTOR_END='___ctors_end = .;' -DTOR_START='___dtors = .;' -DTOR_END='___dtors_end = .;' diff --git a/gnu/dist/ld/emulparams/elf64_sparc.sh b/gnu/dist/ld/emulparams/elf64_sparc.sh deleted file mode 100644 index d0fbdfda3ce3..000000000000 --- a/gnu/dist/ld/emulparams/elf64_sparc.sh +++ /dev/null @@ -1,12 +0,0 @@ -SCRIPT_NAME=elf -ELFSIZE=64 -TEMPLATE_NAME=elf32 -OUTPUT_FORMAT="elf64-sparc" -TEXT_START_ADDR=0x100000 -MAXPAGESIZE=0x100000 -NONPAGED_TEXT_START_ADDR=0x100000 -ARCH="sparc:v9" -MACHINE= -DATA_PLT= -GENERATE_SHLIB_SCRIPT=yes -NOP=0x01000000 diff --git a/gnu/dist/ld/emulparams/elf64alpha.sh b/gnu/dist/ld/emulparams/elf64alpha.sh deleted file mode 100644 index afa21f227176..000000000000 --- a/gnu/dist/ld/emulparams/elf64alpha.sh +++ /dev/null @@ -1,15 +0,0 @@ -ENTRY=__start -SCRIPT_NAME=elf -ELFSIZE=64 -TEMPLATE_NAME=elf32 -OUTPUT_FORMAT="elf64-alpha" -TEXT_START_ADDR="0x120000000" -MAXPAGESIZE=0x100000 -NONPAGED_TEXT_START_ADDR="0x120000000" -ARCH=alpha -MACHINE= -GENERATE_SHLIB_SCRIPT=yes -DATA_PLT= -NOP=0x47ff041f - -OTHER_READONLY_SECTIONS='.reginfo : { *(.reginfo) }' diff --git a/gnu/dist/ld/emulparams/elf_i386.sh b/gnu/dist/ld/emulparams/elf_i386.sh deleted file mode 100644 index 6bea8b6d11eb..000000000000 --- a/gnu/dist/ld/emulparams/elf_i386.sh +++ /dev/null @@ -1,11 +0,0 @@ -SCRIPT_NAME=elf -OUTPUT_FORMAT="elf32-i386" -TEXT_START_ADDR=0x08048000 -MAXPAGESIZE=0x1000 -NONPAGED_TEXT_START_ADDR=0x08048000 -ARCH=i386 -MACHINE= -NOP=0x9090 -TEMPLATE_NAME=elf32 -GENERATE_SHLIB_SCRIPT=yes -ELFSIZE=32 diff --git a/gnu/dist/ld/emulparams/gld960.sh b/gnu/dist/ld/emulparams/gld960.sh deleted file mode 100644 index ef81a78a10e5..000000000000 --- a/gnu/dist/ld/emulparams/gld960.sh +++ /dev/null @@ -1,7 +0,0 @@ -SCRIPT_NAME=i960 -OUTPUT_FORMAT="" -TEXT_START_ADDR=?? -TARGET_PAGE_SIZE=?? -ARCH=i960 -TEMPLATE_NAME=gld960 -GLD_STYLE=1 diff --git a/gnu/dist/ld/emulparams/gld960coff.sh b/gnu/dist/ld/emulparams/gld960coff.sh deleted file mode 100644 index 78202208b4fe..000000000000 --- a/gnu/dist/ld/emulparams/gld960coff.sh +++ /dev/null @@ -1,19 +0,0 @@ -SCRIPT_NAME=i960 -OUTPUT_FORMAT="" -TEXT_START_ADDR=?? -TARGET_PAGE_SIZE=?? -ARCH=i960 -TEMPLATE_NAME=gld960c -GLD_STYLE=1 -COFF_CTORS=' - ___CTOR_LIST__ = .; - LONG((___CTOR_END__ - ___CTOR_LIST__) / 4 - 2) - *(.ctors) - LONG(0) - ___CTOR_END__ = .; - ___DTOR_LIST__ = .; - LONG((___DTOR_END__ - ___DTOR_LIST__) / 4 - 2) - *(.dtors) - LONG(0) - ___DTOR_END__ = .; -' diff --git a/gnu/dist/ld/emulparams/go32.sh b/gnu/dist/ld/emulparams/go32.sh deleted file mode 100644 index d13357fda7ae..000000000000 --- a/gnu/dist/ld/emulparams/go32.sh +++ /dev/null @@ -1,7 +0,0 @@ -SCRIPT_NAME=go32coff -OUTPUT_FORMAT="coff-go32" -TEXT_START_ADDR=0x10a8 -TARGET_PAGE_SIZE=0x1000 -SEGMENT_SIZE=0x1000 -NONPAGED_TEXT_START_ADDR=0x0 -ARCH=i386 diff --git a/gnu/dist/ld/emulparams/h8300.sh b/gnu/dist/ld/emulparams/h8300.sh deleted file mode 100644 index 49eb3c453db4..000000000000 --- a/gnu/dist/ld/emulparams/h8300.sh +++ /dev/null @@ -1,5 +0,0 @@ -SCRIPT_NAME=h8300 -OUTPUT_FORMAT="coff-h8300" -TEXT_START_ADDR=0x8000 -TARGET_PAGE_SIZE=128 -ARCH=h8300 diff --git a/gnu/dist/ld/emulparams/h8300h.sh b/gnu/dist/ld/emulparams/h8300h.sh deleted file mode 100644 index 3ab794e1107e..000000000000 --- a/gnu/dist/ld/emulparams/h8300h.sh +++ /dev/null @@ -1,5 +0,0 @@ -SCRIPT_NAME=h8300h -OUTPUT_FORMAT="coff-h8300" -TEXT_START_ADDR=0x8000 -TARGET_PAGE_SIZE=128 -ARCH=h8300 diff --git a/gnu/dist/ld/emulparams/h8300s.sh b/gnu/dist/ld/emulparams/h8300s.sh deleted file mode 100644 index e27b4f523f16..000000000000 --- a/gnu/dist/ld/emulparams/h8300s.sh +++ /dev/null @@ -1,5 +0,0 @@ -SCRIPT_NAME=h8300s -OUTPUT_FORMAT="coff-h8300" -TEXT_START_ADDR=0x8000 -TARGET_PAGE_SIZE=128 -ARCH=h8300 diff --git a/gnu/dist/ld/emulparams/h8500.sh b/gnu/dist/ld/emulparams/h8500.sh deleted file mode 100644 index 6f4ca8028626..000000000000 --- a/gnu/dist/ld/emulparams/h8500.sh +++ /dev/null @@ -1,5 +0,0 @@ -SCRIPT_NAME=h8500 -OUTPUT_FORMAT="coff-h8500" -TEXT_START_ADDR=0x8000 -TARGET_PAGE_SIZE=128 -ARCH=h8500 diff --git a/gnu/dist/ld/emulparams/h8500b.sh b/gnu/dist/ld/emulparams/h8500b.sh deleted file mode 100644 index d2d3fee2171f..000000000000 --- a/gnu/dist/ld/emulparams/h8500b.sh +++ /dev/null @@ -1,5 +0,0 @@ -SCRIPT_NAME=h8500b -OUTPUT_FORMAT="coff-h8500" -TEXT_START_ADDR=0x8000 -TARGET_PAGE_SIZE=128 -ARCH=h8500 diff --git a/gnu/dist/ld/emulparams/h8500c.sh b/gnu/dist/ld/emulparams/h8500c.sh deleted file mode 100644 index 240a06579ea6..000000000000 --- a/gnu/dist/ld/emulparams/h8500c.sh +++ /dev/null @@ -1,5 +0,0 @@ -SCRIPT_NAME=h8500c -OUTPUT_FORMAT="coff-h8500" -TEXT_START_ADDR=0x8000 -TARGET_PAGE_SIZE=128 -ARCH=h8500 diff --git a/gnu/dist/ld/emulparams/h8500m.sh b/gnu/dist/ld/emulparams/h8500m.sh deleted file mode 100644 index cd9f7b66cf53..000000000000 --- a/gnu/dist/ld/emulparams/h8500m.sh +++ /dev/null @@ -1,5 +0,0 @@ -SCRIPT_NAME=h8500m -OUTPUT_FORMAT="coff-h8500" -TEXT_START_ADDR=0x8000 -TARGET_PAGE_SIZE=128 -ARCH=h8500 diff --git a/gnu/dist/ld/emulparams/h8500s.sh b/gnu/dist/ld/emulparams/h8500s.sh deleted file mode 100644 index b9e294aac0d0..000000000000 --- a/gnu/dist/ld/emulparams/h8500s.sh +++ /dev/null @@ -1,5 +0,0 @@ -SCRIPT_NAME=h8500s -OUTPUT_FORMAT="coff-h8500" -TEXT_START_ADDR=0x8000 -TARGET_PAGE_SIZE=128 -ARCH=h8500 diff --git a/gnu/dist/ld/emulparams/hp300bsd.sh b/gnu/dist/ld/emulparams/hp300bsd.sh deleted file mode 100644 index 8f5c50b3ee57..000000000000 --- a/gnu/dist/ld/emulparams/hp300bsd.sh +++ /dev/null @@ -1,5 +0,0 @@ -SCRIPT_NAME=aout -OUTPUT_FORMAT="a.out-hp300bsd" -TEXT_START_ADDR=0 -TARGET_PAGE_SIZE=4096 -ARCH=m68k diff --git a/gnu/dist/ld/emulparams/hp3hpux.sh b/gnu/dist/ld/emulparams/hp3hpux.sh deleted file mode 100644 index b7badd8b8069..000000000000 --- a/gnu/dist/ld/emulparams/hp3hpux.sh +++ /dev/null @@ -1,8 +0,0 @@ -SCRIPT_NAME=aout -OUTPUT_FORMAT="a.out-hp300hpux" -TEXT_START_ADDR=0 -TARGET_PAGE_SIZE=4096 -ARCH=m68k -STACKZERO="___stack_zero = 0x2000; __DYNAMIC = 0;" -# This is needed for HPUX 9.0; it is unnecessary but harmless for 8.0. -SHLIB_PATH="___dld_shlib_path = 0;" diff --git a/gnu/dist/ld/emulparams/hppaelf.sh b/gnu/dist/ld/emulparams/hppaelf.sh deleted file mode 100644 index 47b89ea92aa4..000000000000 --- a/gnu/dist/ld/emulparams/hppaelf.sh +++ /dev/null @@ -1,7 +0,0 @@ -SCRIPT_NAME=hppaelf -OUTPUT_FORMAT="elf32-hppa" -TEXT_START_ADDR=0x1000 -TARGET_PAGE_SIZE=4096 -ARCH=hppa -START="$START$" -TEMPLATE_NAME=hppaelf diff --git a/gnu/dist/ld/emulparams/i386aout.sh b/gnu/dist/ld/emulparams/i386aout.sh deleted file mode 100644 index dc9e5546145a..000000000000 --- a/gnu/dist/ld/emulparams/i386aout.sh +++ /dev/null @@ -1,6 +0,0 @@ -SCRIPT_NAME=aout -OUTPUT_FORMAT="a.out-i386" -TARGET_PAGE_SIZE=0x1000 -TEXT_START_ADDR=0 -NONPAGED_TEXT_START_ADDR=0x1000 -ARCH=i386 diff --git a/gnu/dist/ld/emulparams/i386bsd.sh b/gnu/dist/ld/emulparams/i386bsd.sh deleted file mode 100644 index e0c0e2fab6cc..000000000000 --- a/gnu/dist/ld/emulparams/i386bsd.sh +++ /dev/null @@ -1,6 +0,0 @@ -SCRIPT_NAME=aout -OUTPUT_FORMAT="a.out-i386-bsd" -TARGET_PAGE_SIZE=0x1000 -TEXT_START_ADDR=0 -NONPAGED_TEXT_START_ADDR=0x1000 -ARCH=i386 diff --git a/gnu/dist/ld/emulparams/i386coff.sh b/gnu/dist/ld/emulparams/i386coff.sh deleted file mode 100644 index 3417b7d3e992..000000000000 --- a/gnu/dist/ld/emulparams/i386coff.sh +++ /dev/null @@ -1,5 +0,0 @@ -SCRIPT_NAME=i386coff -OUTPUT_FORMAT="coff-i386" -TEXT_START_ADDR=0x1000000 -TARGET_PAGE_SIZE=0x1000000 -ARCH=i386 diff --git a/gnu/dist/ld/emulparams/i386go32.sh b/gnu/dist/ld/emulparams/i386go32.sh deleted file mode 100644 index 0ef16c4d37cc..000000000000 --- a/gnu/dist/ld/emulparams/i386go32.sh +++ /dev/null @@ -1,8 +0,0 @@ -SCRIPT_NAME=i386go32 -OUTPUT_FORMAT="coff-go32" -TEXT_START_ADDR=0x10a8 -TARGET_PAGE_SIZE=0x1000 -SEGMENT_SIZE=0x200 -NONPAGED_TEXT_START_ADDR=0x0 -ARCH=i386 - diff --git a/gnu/dist/ld/emulparams/i386linux.sh b/gnu/dist/ld/emulparams/i386linux.sh deleted file mode 100644 index a416422d92f0..000000000000 --- a/gnu/dist/ld/emulparams/i386linux.sh +++ /dev/null @@ -1,7 +0,0 @@ -SCRIPT_NAME=aout -OUTPUT_FORMAT="a.out-i386-linux" -TARGET_PAGE_SIZE=0x1000 -TEXT_START_ADDR=0x1020 -NONPAGED_TEXT_START_ADDR=0 -ARCH=i386 -TEMPLATE_NAME=linux diff --git a/gnu/dist/ld/emulparams/i386lynx.sh b/gnu/dist/ld/emulparams/i386lynx.sh deleted file mode 100644 index 988c1751b082..000000000000 --- a/gnu/dist/ld/emulparams/i386lynx.sh +++ /dev/null @@ -1,9 +0,0 @@ -SCRIPT_NAME=i386lynx -OUTPUT_FORMAT="coff-i386-lynx" -# This is what LynxOS /lib/init1.o wants. -ENTRY=_main -# following are dubious -TARGET_PAGE_SIZE=0x1000 -TEXT_START_ADDR=0 -NONPAGED_TEXT_START_ADDR=0x1000 -ARCH=i386 diff --git a/gnu/dist/ld/emulparams/i386mach.sh b/gnu/dist/ld/emulparams/i386mach.sh deleted file mode 100644 index b7cb2764f594..000000000000 --- a/gnu/dist/ld/emulparams/i386mach.sh +++ /dev/null @@ -1,7 +0,0 @@ -SCRIPT_NAME=aout -OUTPUT_FORMAT="a.out-mach3" -TEXT_START_ADDR=0x10020 -NONPAGED_TEXT_START_ADDR=0x10000 -SEGMENT_SIZE=0x1000 -PAD_TEXT=t -ARCH=i386 diff --git a/gnu/dist/ld/emulparams/i386moss.sh b/gnu/dist/ld/emulparams/i386moss.sh deleted file mode 100644 index a5e0e05eb220..000000000000 --- a/gnu/dist/ld/emulparams/i386moss.sh +++ /dev/null @@ -1,10 +0,0 @@ -SCRIPT_NAME=elf -OUTPUT_FORMAT="elf32-i386" -TEXT_START_ADDR=0x00002000 -MAXPAGESIZE=0x1000 -NONPAGED_TEXT_START_ADDR=0x00002000 -ARCH=i386 -MACHINE= -NOP=0x9090 -TEMPLATE_NAME=elf32 -GENERATE_SHLIB_SCRIPT=yes diff --git a/gnu/dist/ld/emulparams/i386msdos.sh b/gnu/dist/ld/emulparams/i386msdos.sh deleted file mode 100644 index 9311fa1fe5af..000000000000 --- a/gnu/dist/ld/emulparams/i386msdos.sh +++ /dev/null @@ -1,7 +0,0 @@ -SCRIPT_NAME=i386msdos -OUTPUT_FORMAT="msdos" -TEXT_START_ADDR=0x0 -NONPAGED_TEXT_START_ADDR=0x0 -SEGMENT_SIZE=0x10 -PAD_TEXT=t -ARCH=i386 diff --git a/gnu/dist/ld/emulparams/i386nbsd.sh b/gnu/dist/ld/emulparams/i386nbsd.sh deleted file mode 100644 index 5291162c02e7..000000000000 --- a/gnu/dist/ld/emulparams/i386nbsd.sh +++ /dev/null @@ -1,6 +0,0 @@ -SCRIPT_NAME=aout -TEXT_START_ADDR=0x1020 -OUTPUT_FORMAT="a.out-i386-netbsd" -TARGET_PAGE_SIZE=0x1000 -ARCH=i386 -TEMPLATE_NAME=netbsdaout diff --git a/gnu/dist/ld/emulparams/i386nw.sh b/gnu/dist/ld/emulparams/i386nw.sh deleted file mode 100644 index e70ed678f3e2..000000000000 --- a/gnu/dist/ld/emulparams/i386nw.sh +++ /dev/null @@ -1,9 +0,0 @@ -SCRIPT_NAME=nw -OUTPUT_FORMAT="elf32-i386" -TEXT_START_ADDR=0x08000000 -MAXPAGESIZE=0x1000 -NONPAGED_TEXT_START_ADDR=0x08000000 -ARCH=i386 -NOP=0x9090 -TEMPLATE_NAME=elf32 -GENERATE_SHLIB_SCRIPT=yes diff --git a/gnu/dist/ld/emulparams/i386pe.sh b/gnu/dist/ld/emulparams/i386pe.sh deleted file mode 100644 index 188a8addf0f3..000000000000 --- a/gnu/dist/ld/emulparams/i386pe.sh +++ /dev/null @@ -1,5 +0,0 @@ -ARCH=i386 -SCRIPT_NAME=pe -OUTPUT_FORMAT="pei-i386" -RELOCATEABLE_OUTPUT_FORMAT="pe-i386" -TEMPLATE_NAME=pe diff --git a/gnu/dist/ld/emulparams/lnk960.sh b/gnu/dist/ld/emulparams/lnk960.sh deleted file mode 100644 index 3cf3fc497694..000000000000 --- a/gnu/dist/ld/emulparams/lnk960.sh +++ /dev/null @@ -1,6 +0,0 @@ -SCRIPT_NAME=i960 -OUTPUT_FORMAT="" -TEXT_START_ADDR=?? -TARGET_PAGE_SIZE=?? -ARCH=i960 -TEMPLATE_NAME=lnk960 diff --git a/gnu/dist/ld/emulparams/m32relf.sh b/gnu/dist/ld/emulparams/m32relf.sh deleted file mode 100644 index eed56091d439..000000000000 --- a/gnu/dist/ld/emulparams/m32relf.sh +++ /dev/null @@ -1,12 +0,0 @@ -MACHINE= -SCRIPT_NAME=elf -OUTPUT_FORMAT="elf32-m32r" -TEXT_START_ADDR=0x100 -ARCH=m32r -MACHINE= -MAXPAGESIZE=32 -EMBEDDED=yes - -# Hmmm, there's got to be a better way. This sets the stack to the -# top of the simulator memory (currently 1M). -OTHER_RELOCATING_SECTIONS='PROVIDE (_stack = 0x100000);' diff --git a/gnu/dist/ld/emulparams/m68k4knbsd.sh b/gnu/dist/ld/emulparams/m68k4knbsd.sh deleted file mode 100644 index 1bc24c0e9b9c..000000000000 --- a/gnu/dist/ld/emulparams/m68k4knbsd.sh +++ /dev/null @@ -1,7 +0,0 @@ -SCRIPT_NAME=aout -TEXT_START_ADDR=0x1020 -NONPAGED_TEXT_START_ADDR=0x1000 -OUTPUT_FORMAT="a.out-m68k4k-netbsd" -TARGET_PAGE_SIZE=0x1000 -ARCH=m68k -EXECUTABLE_SYMBOLS='__DYNAMIC = 0;' diff --git a/gnu/dist/ld/emulparams/m68kaout.sh b/gnu/dist/ld/emulparams/m68kaout.sh deleted file mode 100644 index 9bfaaf719a31..000000000000 --- a/gnu/dist/ld/emulparams/m68kaout.sh +++ /dev/null @@ -1,7 +0,0 @@ -SCRIPT_NAME=aout -OUTPUT_FORMAT="a.out-zero-big" -TEXT_START_ADDR=0x2020 -TARGET_PAGE_SIZE=0x2000 -SEGMENT_SIZE=0x20000 -NONPAGED_TEXT_START_ADDR=0x2000 -ARCH=m68k diff --git a/gnu/dist/ld/emulparams/m68kaux.sh b/gnu/dist/ld/emulparams/m68kaux.sh deleted file mode 100644 index 19e86cc6cd1c..000000000000 --- a/gnu/dist/ld/emulparams/m68kaux.sh +++ /dev/null @@ -1,8 +0,0 @@ -SCRIPT_NAME=m68kaux -OUTPUT_FORMAT="coff-m68k-aux" -SEGMENT_SIZE=0x40000 -TARGET_PAGE_SIZE=0x1000 -TEXT_START_ADDR="$SEGMENT_SIZE + SIZEOF_HEADERS" -NON_PAGED_TEXT_START_ADDR=SIZEOF_HEADERS -DATA_ALIGNMENT_="(. & (-$SEGMENT_SIZE | $TARGET_PAGE_SIZE-1)) + $SEGMENT_SIZE" -ARCH=m68k diff --git a/gnu/dist/ld/emulparams/m68kcoff.sh b/gnu/dist/ld/emulparams/m68kcoff.sh deleted file mode 100644 index b417c0da45c1..000000000000 --- a/gnu/dist/ld/emulparams/m68kcoff.sh +++ /dev/null @@ -1,5 +0,0 @@ -SCRIPT_NAME=m68kcoff -OUTPUT_FORMAT="coff-m68k" -TEXT_START_ADDR=0x1000000 -TARGET_PAGE_SIZE=0x1000000 -ARCH=m68k diff --git a/gnu/dist/ld/emulparams/m68kelf.sh b/gnu/dist/ld/emulparams/m68kelf.sh deleted file mode 100644 index 6dbcde47b7f4..000000000000 --- a/gnu/dist/ld/emulparams/m68kelf.sh +++ /dev/null @@ -1,11 +0,0 @@ -SCRIPT_NAME=elf -OUTPUT_FORMAT="elf32-m68k" -TEXT_START_ADDR=0x80000000 -MAXPAGESIZE=0x2000 -NONPAGED_TEXT_START_ADDR=${TEXT_START_ADDR} -ARCH=m68k -MACHINE= -NOP=0x4e75 -TEMPLATE_NAME=elf32 -GENERATE_SHLIB_SCRIPT=yes -ELFSIZE=32 diff --git a/gnu/dist/ld/emulparams/m68kelfnbsd.sh b/gnu/dist/ld/emulparams/m68kelfnbsd.sh deleted file mode 100644 index 247cbd8f1a83..000000000000 --- a/gnu/dist/ld/emulparams/m68kelfnbsd.sh +++ /dev/null @@ -1,12 +0,0 @@ -SCRIPT_NAME=elf -OUTPUT_FORMAT="elf32-m68k" -TEXT_START_ADDR=0x2000 -TARGET_PAGE_SIZE=0x2000 -MAXPAGESIZE=0x2000 -NONPAGED_TEXT_START_ADDR=${TEXT_START_ADDR} -ARCH=m68k -MACHINE= -NOP=0x4e75 -TEMPLATE_NAME=elf32 -GENERATE_SHLIB_SCRIPT=yes -ELFSIZE=32 diff --git a/gnu/dist/ld/emulparams/m68klinux.sh b/gnu/dist/ld/emulparams/m68klinux.sh deleted file mode 100644 index 56c3dad9bfca..000000000000 --- a/gnu/dist/ld/emulparams/m68klinux.sh +++ /dev/null @@ -1,7 +0,0 @@ -SCRIPT_NAME=aout -OUTPUT_FORMAT="a.out-m68k-linux" -TARGET_PAGE_SIZE=0x1000 -TEXT_START_ADDR=0x1020 -NONPAGED_TEXT_START_ADDR=0 -ARCH=m68k -TEMPLATE_NAME=linux diff --git a/gnu/dist/ld/emulparams/m68klynx.sh b/gnu/dist/ld/emulparams/m68klynx.sh deleted file mode 100644 index b020febaaaa1..000000000000 --- a/gnu/dist/ld/emulparams/m68klynx.sh +++ /dev/null @@ -1,8 +0,0 @@ -SCRIPT_NAME=m68klynx -OUTPUT_FORMAT="coff-m68k-lynx" -# This is what LynxOS /lib/init1.o wants. -ENTRY=__main -# following are dubious -TEXT_START_ADDR=0 -TARGET_PAGE_SIZE=0x1000 -ARCH=m68k diff --git a/gnu/dist/ld/emulparams/m68knbsd.sh b/gnu/dist/ld/emulparams/m68knbsd.sh deleted file mode 100644 index a742807ddd94..000000000000 --- a/gnu/dist/ld/emulparams/m68knbsd.sh +++ /dev/null @@ -1,7 +0,0 @@ -SCRIPT_NAME=aout -TEXT_START_ADDR=0x2020 -NONPAGED_TEXT_START_ADDR=0x2000 -OUTPUT_FORMAT="a.out-m68k-netbsd" -TARGET_PAGE_SIZE=0x2000 -ARCH=m68k -EXECUTABLE_SYMBOLS='__DYNAMIC = 0;' diff --git a/gnu/dist/ld/emulparams/m68kpsos.sh b/gnu/dist/ld/emulparams/m68kpsos.sh deleted file mode 100644 index 34eb8ca549ce..000000000000 --- a/gnu/dist/ld/emulparams/m68kpsos.sh +++ /dev/null @@ -1,6 +0,0 @@ -SCRIPT_NAME=psos -OUTPUT_FORMAT="elf32-m68k" -TEXT_START_ADDR=0x20000 -MAXPAGESIZE=0x1000 -ARCH=m68k -TEMPLATE_NAME=elf32 diff --git a/gnu/dist/ld/emulparams/m88kbcs.sh b/gnu/dist/ld/emulparams/m88kbcs.sh deleted file mode 100644 index 6c6737c3329d..000000000000 --- a/gnu/dist/ld/emulparams/m88kbcs.sh +++ /dev/null @@ -1,5 +0,0 @@ -SCRIPT_NAME=m88kbcs -OUTPUT_FORMAT="coff-m88kbcs" -TEXT_START_ADDR=?? -TARGET_PAGE_SIZE=?? -ARCH=m88k diff --git a/gnu/dist/ld/emulparams/mipsbig.sh b/gnu/dist/ld/emulparams/mipsbig.sh deleted file mode 100644 index 9fe29538f452..000000000000 --- a/gnu/dist/ld/emulparams/mipsbig.sh +++ /dev/null @@ -1,6 +0,0 @@ -SCRIPT_NAME=mips -OUTPUT_FORMAT="ecoff-bigmips" -BIG_OUTPUT_FORMAT="ecoff-bigmips" -LITTLE_OUTPUT_FORMAT="ecoff-littlemips" -TARGET_PAGE_SIZE=0x1000000 -ARCH=mips diff --git a/gnu/dist/ld/emulparams/mipsbsd.sh b/gnu/dist/ld/emulparams/mipsbsd.sh deleted file mode 100644 index e8fb35beca68..000000000000 --- a/gnu/dist/ld/emulparams/mipsbsd.sh +++ /dev/null @@ -1,7 +0,0 @@ -SCRIPT_NAME=mipsbsd -OUTPUT_FORMAT="a.out-mips-little" -BIG_OUTPUT_FORMAT="a.out-mips-big" -LITTLE_OUTPUT_FORMAT="a.out-mips-little" -TEXT_START_ADDR=0x1020 -TARGET_PAGE_SIZE=4096 -ARCH=mips diff --git a/gnu/dist/ld/emulparams/mipsidt.sh b/gnu/dist/ld/emulparams/mipsidt.sh deleted file mode 100644 index 63176f5fdeae..000000000000 --- a/gnu/dist/ld/emulparams/mipsidt.sh +++ /dev/null @@ -1,11 +0,0 @@ -SCRIPT_NAME=mips -OUTPUT_FORMAT="ecoff-bigmips" -BIG_OUTPUT_FORMAT="ecoff-bigmips" -LITTLE_OUTPUT_FORMAT="ecoff-littlemips" -TARGET_PAGE_SIZE=0x1000000 -ARCH=mips -ENTRY=start -TEXT_START_ADDR=0xa0012000 -DATA_ADDR=. -TEMPLATE_NAME=mipsecoff -EMBEDDED=yes diff --git a/gnu/dist/ld/emulparams/mipsidtl.sh b/gnu/dist/ld/emulparams/mipsidtl.sh deleted file mode 100644 index 02279ded6359..000000000000 --- a/gnu/dist/ld/emulparams/mipsidtl.sh +++ /dev/null @@ -1,11 +0,0 @@ -SCRIPT_NAME=mips -OUTPUT_FORMAT="ecoff-littlemips" -BIG_OUTPUT_FORMAT="ecoff-bigmips" -LITTLE_OUTPUT_FORMAT="ecoff-littlemips" -TARGET_PAGE_SIZE=0x1000000 -ARCH=mips -ENTRY=start -TEXT_START_ADDR=0xa0012000 -DATA_ADDR=. -TEMPLATE_NAME=mipsecoff -EMBEDDED=yes diff --git a/gnu/dist/ld/emulparams/mipslit.sh b/gnu/dist/ld/emulparams/mipslit.sh deleted file mode 100644 index acb234464be4..000000000000 --- a/gnu/dist/ld/emulparams/mipslit.sh +++ /dev/null @@ -1,6 +0,0 @@ -SCRIPT_NAME=mips -OUTPUT_FORMAT="ecoff-littlemips" -BIG_OUTPUT_FORMAT="ecoff-bigmips" -LITTLE_OUTPUT_FORMAT="ecoff-littlemips" -TARGET_PAGE_SIZE=0x1000000 -ARCH=mips diff --git a/gnu/dist/ld/emulparams/mipslnews.sh b/gnu/dist/ld/emulparams/mipslnews.sh deleted file mode 100644 index d0bb91c1dc2e..000000000000 --- a/gnu/dist/ld/emulparams/mipslnews.sh +++ /dev/null @@ -1,9 +0,0 @@ -SCRIPT_NAME=mips -OUTPUT_FORMAT="ecoff-littlemips" -BIG_OUTPUT_FORMAT="ecoff-bigmips" -LITTLE_OUTPUT_FORMAT="ecoff-littlemips" -TARGET_PAGE_SIZE=0x1000000 -ARCH=mips -TEXT_START_ADDR=0x80080000 -DATA_ADDR=. -EMBEDDED=yes diff --git a/gnu/dist/ld/emulparams/mn10200.sh b/gnu/dist/ld/emulparams/mn10200.sh deleted file mode 100644 index afa46e2aa30c..000000000000 --- a/gnu/dist/ld/emulparams/mn10200.sh +++ /dev/null @@ -1,20 +0,0 @@ -MACHINE= -SCRIPT_NAME=elf -OUTPUT_FORMAT="elf32-mn10200" -TEXT_START_ADDR=0x0 -ARCH=mn10200 -MACHINE= -MAXPAGESIZE=256 -ENTRY=_start -EMBEDDED=yes - -# Hmmm, there's got to be a better way. This sets the stack to the -# top of the simulator memory (2^19 bytes). -OTHER_RELOCATING_SECTIONS='.stack 0x80000 : { _stack = .; *(.stack) }' - -# These are for compatibility with the COFF toolchain. -# XXX These should definitely disappear. -CTOR_START='___ctors = .;' -CTOR_END='___ctors_end = .;' -DTOR_START='___dtors = .;' -DTOR_END='___dtors_end = .;' diff --git a/gnu/dist/ld/emulparams/mn10300.sh b/gnu/dist/ld/emulparams/mn10300.sh deleted file mode 100644 index b5ae3b7ee878..000000000000 --- a/gnu/dist/ld/emulparams/mn10300.sh +++ /dev/null @@ -1,20 +0,0 @@ -MACHINE= -SCRIPT_NAME=elf -OUTPUT_FORMAT="elf32-mn10300" -TEXT_START_ADDR=0x0 -ARCH=mn10300 -MACHINE= -MAXPAGESIZE=256 -ENTRY=_start -EMBEDDED=yes - -# Hmmm, there's got to be a better way. This sets the stack to the -# top of the simulator memory (2^19 bytes). -OTHER_RELOCATING_SECTIONS='.stack 0x80000 : { _stack = .; *(.stack) }' - -# These are for compatibility with the COFF toolchain. -# XXX These should definitely disappear. -CTOR_START='___ctors = .;' -CTOR_END='___ctors_end = .;' -DTOR_START='___dtors = .;' -DTOR_END='___dtors_end = .;' diff --git a/gnu/dist/ld/emulparams/news.sh b/gnu/dist/ld/emulparams/news.sh deleted file mode 100644 index 310ddf9212e9..000000000000 --- a/gnu/dist/ld/emulparams/news.sh +++ /dev/null @@ -1,5 +0,0 @@ -SCRIPT_NAME=aout -OUTPUT_FORMAT="a.out-newsos3" -TEXT_START_ADDR=0 -TARGET_PAGE_SIZE=0x1000 -ARCH=m68k diff --git a/gnu/dist/ld/emulparams/ns32knbsd.sh b/gnu/dist/ld/emulparams/ns32knbsd.sh deleted file mode 100644 index 1c4fdf3449c3..000000000000 --- a/gnu/dist/ld/emulparams/ns32knbsd.sh +++ /dev/null @@ -1,5 +0,0 @@ -SCRIPT_NAME=aout -TEXT_START_ADDR=0x1020 -OUTPUT_FORMAT="a.out-ns32k-netbsd" -TARGET_PAGE_SIZE=0x1000 -ARCH=ns32k diff --git a/gnu/dist/ld/emulparams/pc532macha.sh b/gnu/dist/ld/emulparams/pc532macha.sh deleted file mode 100644 index 9c1d0791c8d3..000000000000 --- a/gnu/dist/ld/emulparams/pc532macha.sh +++ /dev/null @@ -1,6 +0,0 @@ -SCRIPT_NAME=aout -OUTPUT_FORMAT="a.out-pc532-mach" -TARGET_PAGE_SIZE=0x1000 -TEXT_START_ADDR="0x10020" -NONPAGED_TEXT_START_ADDR=0x10000 -ARCH=ns32k diff --git a/gnu/dist/ld/emulparams/ppcmacos.sh b/gnu/dist/ld/emulparams/ppcmacos.sh deleted file mode 100644 index b6b800c2c6c8..000000000000 --- a/gnu/dist/ld/emulparams/ppcmacos.sh +++ /dev/null @@ -1,4 +0,0 @@ -TEMPLATE_NAME=aix -SCRIPT_NAME=aix -OUTPUT_FORMAT="xcoff-powermac" -ARCH=powerpc diff --git a/gnu/dist/ld/emulparams/ppcnw.sh b/gnu/dist/ld/emulparams/ppcnw.sh deleted file mode 100644 index c3ead43675b8..000000000000 --- a/gnu/dist/ld/emulparams/ppcnw.sh +++ /dev/null @@ -1,7 +0,0 @@ -SCRIPT_NAME=nw -OUTPUT_FORMAT="elf32-powerpc" -TEXT_START_ADDR=0x0400000 -DATA_ADDR=0x10000000 -MAXPAGESIZE=0x40000 -NONPAGED_TEXT_START_ADDR=0x0400000 -ARCH=powerpc diff --git a/gnu/dist/ld/emulparams/ppcpe.sh b/gnu/dist/ld/emulparams/ppcpe.sh deleted file mode 100644 index 655282d3fc3c..000000000000 --- a/gnu/dist/ld/emulparams/ppcpe.sh +++ /dev/null @@ -1,4 +0,0 @@ -ARCH=powerpc -SCRIPT_NAME=ppcpe -OUTPUT_FORMAT="pei-powerpcle" -TEMPLATE_NAME=pe diff --git a/gnu/dist/ld/emulparams/riscix.sh b/gnu/dist/ld/emulparams/riscix.sh deleted file mode 100644 index e7f6d92f304f..000000000000 --- a/gnu/dist/ld/emulparams/riscix.sh +++ /dev/null @@ -1,5 +0,0 @@ -SCRIPT_NAME=riscix -OUTPUT_FORMAT="a.out-riscix" -TEXT_START_ADDR=0x8000 -TARGET_PAGE_SIZE=0x8000 -ARCH=arm diff --git a/gnu/dist/ld/emulparams/sa29200.sh b/gnu/dist/ld/emulparams/sa29200.sh deleted file mode 100644 index 8b52f92968dd..000000000000 --- a/gnu/dist/ld/emulparams/sa29200.sh +++ /dev/null @@ -1,5 +0,0 @@ -SCRIPT_NAME=sa29200 -OUTPUT_FORMAT="coff-a29k-big" -TEXT_START_ADDR=0x40004000 -TARGET_PAGE_SIZE=0x1000 -ARCH=a29k diff --git a/gnu/dist/ld/emulparams/sh.sh b/gnu/dist/ld/emulparams/sh.sh deleted file mode 100644 index dd98b77526a4..000000000000 --- a/gnu/dist/ld/emulparams/sh.sh +++ /dev/null @@ -1,5 +0,0 @@ -SCRIPT_NAME=sh -OUTPUT_FORMAT="coff-sh" -TEXT_START_ADDR=0x1000 -TARGET_PAGE_SIZE=0x1000 -ARCH=sh diff --git a/gnu/dist/ld/emulparams/shelf.sh b/gnu/dist/ld/emulparams/shelf.sh deleted file mode 100644 index 2c0f529a0182..000000000000 --- a/gnu/dist/ld/emulparams/shelf.sh +++ /dev/null @@ -1,15 +0,0 @@ -SCRIPT_NAME=elf -OUTPUT_FORMAT="elf32-sh" -TEXT_START_ADDR=0x1000 -MAXPAGESIZE=0x1000 -ARCH=sh -MACHINE= -TEMPLATE_NAME=elf32 -GENERATE_SHLIB_SCRIPT=yes - -# These are for compatibility with the COFF toolchain. -ENTRY=start -CTOR_START='___ctors = .;' -CTOR_END='___ctors_end = .;' -DTOR_START='___dtors = .;' -DTOR_END='___dtors_end = .;' diff --git a/gnu/dist/ld/emulparams/shl.sh b/gnu/dist/ld/emulparams/shl.sh deleted file mode 100644 index 360aac8905c1..000000000000 --- a/gnu/dist/ld/emulparams/shl.sh +++ /dev/null @@ -1,5 +0,0 @@ -SCRIPT_NAME=sh -OUTPUT_FORMAT="coff-shl" -TEXT_START_ADDR=0x8000 -TARGET_PAGE_SIZE=128 -ARCH=sh diff --git a/gnu/dist/ld/emulparams/shlelf.sh b/gnu/dist/ld/emulparams/shlelf.sh deleted file mode 100644 index bb27f86af6cc..000000000000 --- a/gnu/dist/ld/emulparams/shlelf.sh +++ /dev/null @@ -1,17 +0,0 @@ -SCRIPT_NAME=elf -OUTPUT_FORMAT="elf32-shl" -TEXT_START_ADDR=0x1000 -MAXPAGESIZE=128 -ARCH=sh -MACHINE= -TEMPLATE_NAME=elf32 -GENERATE_SHLIB_SCRIPT=yes -EMBEDDED=yes - -# These are for compatibility with the COFF toolchain. -ENTRY=start -CTOR_START='___ctors = .;' -CTOR_END='___ctors_end = .;' -DTOR_START='___dtors = .;' -DTOR_END='___dtors_end = .;' -OTHER_RELOCATING_SECTIONS='.stack 0x30000 : { _stack = .; *(.stack) }' diff --git a/gnu/dist/ld/emulparams/shlunx.sh b/gnu/dist/ld/emulparams/shlunx.sh deleted file mode 100644 index e6a48edbc1c2..000000000000 --- a/gnu/dist/ld/emulparams/shlunx.sh +++ /dev/null @@ -1,5 +0,0 @@ -SCRIPT_NAME=shunx -OUTPUT_FORMAT="coff-shl" -TEXT_START_ADDR=0x1000 -TARGET_PAGE_SIZE=0x1000 -ARCH=sh diff --git a/gnu/dist/ld/emulparams/shunx.sh b/gnu/dist/ld/emulparams/shunx.sh deleted file mode 100644 index 980fbeff5be8..000000000000 --- a/gnu/dist/ld/emulparams/shunx.sh +++ /dev/null @@ -1,5 +0,0 @@ -SCRIPT_NAME=shunx -OUTPUT_FORMAT="coff-sh" -TEXT_START_ADDR=0x1000 -TARGET_PAGE_SIZE=0x1000 -ARCH=sh diff --git a/gnu/dist/ld/emulparams/sparcaout.sh b/gnu/dist/ld/emulparams/sparcaout.sh deleted file mode 100644 index 429b925c18c6..000000000000 --- a/gnu/dist/ld/emulparams/sparcaout.sh +++ /dev/null @@ -1,8 +0,0 @@ -SCRIPT_NAME=aout -OUTPUT_FORMAT="a.out-sunos-big" -BIG_OUTPUT_FORMAT="a.out-sunos-big" -LITTLE_OUTPUT_FORMAT="a.out-sparc-little" -TEXT_START_ADDR=0x2020 -TARGET_PAGE_SIZE=0x2000 -NONPAGED_TEXT_START_ADDR=0x2000 -ARCH=sparc diff --git a/gnu/dist/ld/emulparams/sparclinux.sh b/gnu/dist/ld/emulparams/sparclinux.sh deleted file mode 100644 index 7ccb0bec90c7..000000000000 --- a/gnu/dist/ld/emulparams/sparclinux.sh +++ /dev/null @@ -1,7 +0,0 @@ -SCRIPT_NAME=aout -OUTPUT_FORMAT="a.out-sparc-linux" -TARGET_PAGE_SIZE=0x1000 -TEXT_START_ADDR=0x1020 -NONPAGED_TEXT_START_ADDR=0 -ARCH=sparc -TEMPLATE_NAME=linux diff --git a/gnu/dist/ld/emulparams/sparclynx.sh b/gnu/dist/ld/emulparams/sparclynx.sh deleted file mode 100644 index 9aeb30b13340..000000000000 --- a/gnu/dist/ld/emulparams/sparclynx.sh +++ /dev/null @@ -1,9 +0,0 @@ -SCRIPT_NAME=sparclynx -OUTPUT_FORMAT="coff-sparc-lynx" -# This is what LynxOS /lib/init1.o wants. -ENTRY=__main -# following are dubious -TARGET_PAGE_SIZE=0x1000 -TEXT_START_ADDR=0 -NONPAGED_TEXT_START_ADDR=0x1000 -ARCH=sparc diff --git a/gnu/dist/ld/emulparams/sparcnbsd.sh b/gnu/dist/ld/emulparams/sparcnbsd.sh deleted file mode 100644 index 16e193a6b906..000000000000 --- a/gnu/dist/ld/emulparams/sparcnbsd.sh +++ /dev/null @@ -1,5 +0,0 @@ -SCRIPT_NAME=aout -TEXT_START_ADDR=0x2020 -OUTPUT_FORMAT="a.out-sparc-netbsd" -TARGET_PAGE_SIZE=0x2000 -ARCH=sparc diff --git a/gnu/dist/ld/emulparams/st2000.sh b/gnu/dist/ld/emulparams/st2000.sh deleted file mode 100644 index 0498832823e2..000000000000 --- a/gnu/dist/ld/emulparams/st2000.sh +++ /dev/null @@ -1,5 +0,0 @@ -SCRIPT_NAME=st2000 -OUTPUT_FORMAT="coff-m68k" -TEXT_START_ADDR=0x0 -TARGET_PAGE_SIZE=128 -ARCH=m68k diff --git a/gnu/dist/ld/emulparams/sun3.sh b/gnu/dist/ld/emulparams/sun3.sh deleted file mode 100644 index db0f71f3abdd..000000000000 --- a/gnu/dist/ld/emulparams/sun3.sh +++ /dev/null @@ -1,8 +0,0 @@ -SCRIPT_NAME=aout -OUTPUT_FORMAT="a.out-sunos-big" -TEXT_START_ADDR=0x2020 -TARGET_PAGE_SIZE=0x2000 -SEGMENT_SIZE=0x20000 -NONPAGED_TEXT_START_ADDR=0x2000 -ARCH=m68k -TEMPLATE_NAME=sunos diff --git a/gnu/dist/ld/emulparams/sun4.sh b/gnu/dist/ld/emulparams/sun4.sh deleted file mode 100644 index e2b152601788..000000000000 --- a/gnu/dist/ld/emulparams/sun4.sh +++ /dev/null @@ -1,7 +0,0 @@ -SCRIPT_NAME=aout -OUTPUT_FORMAT="a.out-sunos-big" -TEXT_START_ADDR=0x2020 -TARGET_PAGE_SIZE=0x2000 -NONPAGED_TEXT_START_ADDR=0x2000 -ARCH=sparc -TEMPLATE_NAME=sunos diff --git a/gnu/dist/ld/emulparams/tic30aout.sh b/gnu/dist/ld/emulparams/tic30aout.sh deleted file mode 100644 index 2a4c13f598f7..000000000000 --- a/gnu/dist/ld/emulparams/tic30aout.sh +++ /dev/null @@ -1,7 +0,0 @@ -SCRIPT_NAME=tic30aout -OUTPUT_FORMAT="a.out-tic30" -OUTPUT_ARCH="tms320c30" -TEXT_START_ADDR=0x0 -TARGET_PAGE_SIZE=128 -ARCH=tms320c30 -BIG=1 diff --git a/gnu/dist/ld/emulparams/tic30coff.sh b/gnu/dist/ld/emulparams/tic30coff.sh deleted file mode 100644 index df7794373373..000000000000 --- a/gnu/dist/ld/emulparams/tic30coff.sh +++ /dev/null @@ -1,7 +0,0 @@ -SCRIPT_NAME=tic30coff -OUTPUT_FORMAT="coff-tic30" -OUTPUT_ARCH="tms320c30" -TEXT_START_ADDR=0x0 -TARGET_PAGE_SIZE=128 -ARCH=tms320c30 -BIG=1 diff --git a/gnu/dist/ld/emulparams/v850.sh b/gnu/dist/ld/emulparams/v850.sh deleted file mode 100644 index 78bfbd3882df..000000000000 --- a/gnu/dist/ld/emulparams/v850.sh +++ /dev/null @@ -1,14 +0,0 @@ -MACHINE= -SCRIPT_NAME=v850 -OUTPUT_FORMAT="elf32-v850" -TEXT_START_ADDR=0x100000 -ZDATA_START_ADDR=0x160 -ROZDATA_START_ADDR="ALIGN (4)" -SDATA_START_ADDR="ALIGN (4)" -ROSDATA_START_ADDR="ALIGN (4)" -TDATA_START_ADDR="ALIGN (4)" -CALL_TABLE_START_ADDR="ALIGN (4)" -ARCH=v850 -MAXPAGESIZE=256 -ENTRY=_start -EMBEDDED=yes diff --git a/gnu/dist/ld/emulparams/vanilla.sh b/gnu/dist/ld/emulparams/vanilla.sh deleted file mode 100644 index d8a3b72dbf9b..000000000000 --- a/gnu/dist/ld/emulparams/vanilla.sh +++ /dev/null @@ -1,5 +0,0 @@ -SCRIPT_NAME=vanilla -TEXT_START_ADDR=?? -TARGET_PAGE_SIZE=?? -ARCH=unknown -TEMPLATE_NAME=vanilla diff --git a/gnu/dist/ld/emulparams/vax.sh b/gnu/dist/ld/emulparams/vax.sh deleted file mode 100644 index 978548310414..000000000000 --- a/gnu/dist/ld/emulparams/vax.sh +++ /dev/null @@ -1,5 +0,0 @@ -SCRIPT_NAME=aout -OUTPUT_FORMAT="a.out" -TEXT_START_ADDR=0 -TARGET_PAGE_SIZE=1024 -ARCH=vax diff --git a/gnu/dist/ld/emulparams/vsta.sh b/gnu/dist/ld/emulparams/vsta.sh deleted file mode 100644 index cc6249bea438..000000000000 --- a/gnu/dist/ld/emulparams/vsta.sh +++ /dev/null @@ -1,8 +0,0 @@ -SCRIPT_NAME=aout -OUTPUT_FORMAT="a.out-i386" -TEXT_START_ADDR=0x1020 -TARGET_PAGE_SIZE=0x1000 -SEGMENT_SIZE=0x400000 -NONPAGED_TEXT_START_ADDR=0x0 -ARCH=i386 - diff --git a/gnu/dist/ld/emulparams/w65.sh b/gnu/dist/ld/emulparams/w65.sh deleted file mode 100644 index 6f02b2326f59..000000000000 --- a/gnu/dist/ld/emulparams/w65.sh +++ /dev/null @@ -1,5 +0,0 @@ -SCRIPT_NAME=w65 -OUTPUT_FORMAT="coff-w65" -TEXT_START_ADDR=0x1000 -TARGET_PAGE_SIZE=64 -ARCH=w65 diff --git a/gnu/dist/ld/emulparams/z8001.sh b/gnu/dist/ld/emulparams/z8001.sh deleted file mode 100644 index 63645c342c23..000000000000 --- a/gnu/dist/ld/emulparams/z8001.sh +++ /dev/null @@ -1,7 +0,0 @@ -SCRIPT_NAME=z8000 -OUTPUT_FORMAT="coff-z8k" -OUTPUT_ARCH="z8001" -TEXT_START_ADDR=0x0 -TARGET_PAGE_SIZE=128 -ARCH=z8k -BIG=1 diff --git a/gnu/dist/ld/emulparams/z8002.sh b/gnu/dist/ld/emulparams/z8002.sh deleted file mode 100644 index 299b5f5a45d8..000000000000 --- a/gnu/dist/ld/emulparams/z8002.sh +++ /dev/null @@ -1,6 +0,0 @@ -SCRIPT_NAME=z8000 -OUTPUT_FORMAT="coff-z8k" -OUTPUT_ARCH="z8002" -TEXT_START_ADDR=0x0 -TARGET_PAGE_SIZE=128 -ARCH=z8002 diff --git a/gnu/dist/ld/emultempl/README b/gnu/dist/ld/emultempl/README deleted file mode 100644 index 30ec0abf379d..000000000000 --- a/gnu/dist/ld/emultempl/README +++ /dev/null @@ -1,3 +0,0 @@ -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/gnu/dist/ld/emultempl/aix.em b/gnu/dist/ld/emultempl/aix.em deleted file mode 100644 index 40e906d08f02..000000000000 --- a/gnu/dist/ld/emultempl/aix.em +++ /dev/null @@ -1,1053 +0,0 @@ -# This shell script emits a C file. -*- C -*- -# It does some substitutions. -cat >e${EMULATION_NAME}.c < - AIX support by Ian Lance Taylor - -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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ - -#define TARGET_IS_${EMULATION_NAME} - -#include "bfd.h" -#include "sysdep.h" -#include "libiberty.h" -#include "getopt.h" -#include "obstack.h" -#include "bfdlink.h" - -#include - -#include "ld.h" -#include "ldmain.h" -#include "ldemul.h" -#include "ldfile.h" -#include "ldmisc.h" -#include "ldexp.h" -#include "ldlang.h" -#include "ldctor.h" -#include "ldgram.h" - -static void gld${EMULATION_NAME}_before_parse PARAMS ((void)); -static int gld${EMULATION_NAME}_parse_args PARAMS ((int, char **)); -static void gld${EMULATION_NAME}_after_open PARAMS ((void)); -static void gld${EMULATION_NAME}_before_allocation PARAMS ((void)); -static void gld${EMULATION_NAME}_read_file PARAMS ((const char *, boolean)); -static void gld${EMULATION_NAME}_free PARAMS ((PTR)); -static void gld${EMULATION_NAME}_find_relocs - PARAMS ((lang_statement_union_type *)); -static void gld${EMULATION_NAME}_find_exp_assignment PARAMS ((etree_type *)); -static char *gld${EMULATION_NAME}_get_script PARAMS ((int *isfile)); - -/* The file alignment required for each section. */ -static unsigned long file_align; - -/* The maximum size the stack is permitted to grow. This is stored in - the a.out header. */ -static unsigned long maxstack; - -/* The maximum data size. This is stored in the a.out header. */ -static unsigned long maxdata; - -/* Whether to perform garbage collection. */ -static int gc = 1; - -/* The module type to use. */ -static unsigned short modtype = ('1' << 8) | 'L'; - -/* Whether the .text section must be read-only (i.e., no relocs - permitted). */ -static int textro; - -/* Whether to implement Unix like linker semantics. */ -static int unix_ld; - -/* Structure used to hold import file list. */ - -struct filelist -{ - struct filelist *next; - const char *name; -}; - -/* List of import files. */ -static struct filelist *import_files; - -/* List of export symbols read from the export files. */ - -struct export_symbol_list -{ - struct export_symbol_list *next; - const char *name; - boolean syscall; -}; - -static struct export_symbol_list *export_symbols; - -/* This routine is called before anything else is done. */ - -static void -gld${EMULATION_NAME}_before_parse() -{ -#ifndef TARGET_ /* I.e., if not generic. */ - ldfile_output_architecture = bfd_arch_${ARCH}; -#endif /* not TARGET_ */ -} - -/* Handle AIX specific options. */ - -static int -gld${EMULATION_NAME}_parse_args (argc, argv) - int argc; - char **argv; -{ - int prevoptind = optind; - int prevopterr = opterr; - int indx; - int longind; - int optc; - long val; - char *end; - -#define OPTION_IGNORE (300) -#define OPTION_AUTOIMP (OPTION_IGNORE + 1) -#define OPTION_ERNOTOK (OPTION_AUTOIMP + 1) -#define OPTION_EROK (OPTION_ERNOTOK + 1) -#define OPTION_EXPORT (OPTION_EROK + 1) -#define OPTION_IMPORT (OPTION_EXPORT + 1) -#define OPTION_LOADMAP (OPTION_IMPORT + 1) -#define OPTION_MAXDATA (OPTION_LOADMAP + 1) -#define OPTION_MAXSTACK (OPTION_MAXDATA + 1) -#define OPTION_MODTYPE (OPTION_MAXSTACK + 1) -#define OPTION_NOAUTOIMP (OPTION_MODTYPE + 1) -#define OPTION_NOSTRCMPCT (OPTION_NOAUTOIMP + 1) -#define OPTION_PD (OPTION_NOSTRCMPCT + 1) -#define OPTION_PT (OPTION_PD + 1) -#define OPTION_STRCMPCT (OPTION_PT + 1) -#define OPTION_UNIX (OPTION_STRCMPCT + 1) - - static struct option longopts[] = { - {"basis", no_argument, NULL, OPTION_IGNORE}, - {"bautoimp", no_argument, NULL, OPTION_AUTOIMP}, - {"bcomprld", no_argument, NULL, OPTION_IGNORE}, - {"bcrld", no_argument, NULL, OPTION_IGNORE}, - {"bcror31", no_argument, NULL, OPTION_IGNORE}, - {"bD", required_argument, NULL, OPTION_MAXDATA}, - {"bE", required_argument, NULL, OPTION_EXPORT}, - {"bernotok", no_argument, NULL, OPTION_ERNOTOK}, - {"berok", no_argument, NULL, OPTION_EROK}, - {"berrmsg", no_argument, NULL, OPTION_IGNORE}, - {"bexport", required_argument, NULL, OPTION_EXPORT}, - {"bf", no_argument, NULL, OPTION_ERNOTOK}, - {"bgc", no_argument, &gc, 1}, - {"bh", required_argument, NULL, OPTION_IGNORE}, - {"bhalt", required_argument, NULL, OPTION_IGNORE}, - {"bI", required_argument, NULL, OPTION_IMPORT}, - {"bimport", required_argument, NULL, OPTION_IMPORT}, - {"bl", required_argument, NULL, OPTION_LOADMAP}, - {"bloadmap", required_argument, NULL, OPTION_LOADMAP}, - {"bmaxdata", required_argument, NULL, OPTION_MAXDATA}, - {"bmaxstack", required_argument, NULL, OPTION_MAXSTACK}, - {"bM", required_argument, NULL, OPTION_MODTYPE}, - {"bmodtype", required_argument, NULL, OPTION_MODTYPE}, - {"bnoautoimp", no_argument, NULL, OPTION_NOAUTOIMP}, - {"bnodelcsect", no_argument, NULL, OPTION_IGNORE}, - {"bnoentry", no_argument, NULL, OPTION_IGNORE}, - {"bnogc", no_argument, &gc, 0}, - {"bnso", no_argument, NULL, OPTION_NOAUTOIMP}, - {"bnostrcmpct", no_argument, NULL, OPTION_NOSTRCMPCT}, - {"bnotextro", no_argument, &textro, 0}, - {"bnro", no_argument, &textro, 0}, - {"bpD", required_argument, NULL, OPTION_PD}, - {"bpT", required_argument, NULL, OPTION_PT}, - {"bro", no_argument, &textro, 1}, - {"bS", required_argument, NULL, OPTION_MAXSTACK}, - {"bso", no_argument, NULL, OPTION_AUTOIMP}, - {"bstrcmpct", no_argument, NULL, OPTION_STRCMPCT}, - {"btextro", no_argument, &textro, 1}, - {"static", no_argument, NULL, OPTION_NOAUTOIMP}, - {"unix", no_argument, NULL, OPTION_UNIX}, - {NULL, no_argument, NULL, 0} - }; - - /* Options supported by the AIX linker which we do not support: -f, - -S, -v, -Z, -bbindcmds, -bbinder, -bbindopts, -bcalls, -bcaps, - -bcror15, -bdebugopt, -bdbg, -bdelcsect, -bex?, -bfilelist, -bfl, - -bgcbypass, -bglink, -binsert, -bi, -bloadmap, -bl, -bmap, -bnl, - -bnobind, -bnocomprld, -bnocrld, -bnoerrmsg, -bnoglink, - -bnoloadmap, -bnl, -bnoobjreorder, -bnoquiet, -bnoreorder, - -bnotypchk, -bnox, -bquiet, -bR, -brename, -breorder, -btypchk, - -bx, -bX, -bxref. */ - - /* If the current option starts with -b, change the first : to an =. - The AIX linker uses : to separate the option from the argument; - changing it to = lets us treat it as a getopt option. */ - indx = optind; - if (indx == 0) - indx = 1; - if (indx < argc && strncmp (argv[indx], "-b", 2) == 0) - { - char *s; - - for (s = argv[indx]; *s != '\0'; s++) - { - if (*s == ':') - { - *s = '='; - break; - } - } - } - - /* We add s and u so to the short options list so that -s and -u on - the command line do not match -static and -unix. */ - - opterr = 0; - optc = getopt_long_only (argc, argv, "-D:H:KT:zsu", longopts, &longind); - opterr = prevopterr; - - switch (optc) - { - case 's': - case 'u': - default: - optind = prevoptind; - return 0; - - case 0: - /* Long option which just sets a flag. */ - break; - - case 'D': - val = strtol (optarg, &end, 0); - if (*end != '\0') - einfo ("%P: warning: ignoring invalid -D number %s\n", optarg); - else if (val != -1) - lang_section_start (".data", exp_intop (val)); - break; - - case 'H': - val = strtoul (optarg, &end, 0); - if (*end != '\0' - || (val & (val - 1)) != 0) - einfo ("%P: warning: ignoring invalid -H number %s\n", optarg); - else - file_align = val; - break; - - case 'K': - case 'z': - /* FIXME: This should use the page size for the target system. */ - file_align = 4096; - break; - - case 'T': - /* On AIX this is the same as GNU ld -Ttext. When we see -T - number, we assume the AIX option is intended. Otherwise, we - assume the usual GNU ld -T option is intended. We can't just - ignore the AIX option, because gcc passes it to the linker. */ - val = strtoul (optarg, &end, 0); - if (*end != '\0') - { - optind = prevoptind; - return 0; - } - lang_section_start (".text", exp_intop (val)); - break; - - case OPTION_IGNORE: - break; - - case OPTION_AUTOIMP: - link_info.static_link = false; - break; - - case OPTION_ERNOTOK: - force_make_executable = false; - break; - - case OPTION_EROK: - force_make_executable = true; - break; - - case OPTION_EXPORT: - gld${EMULATION_NAME}_read_file (optarg, false); - break; - - case OPTION_IMPORT: - { - struct filelist *n; - struct filelist **flpp; - - n = (struct filelist *) xmalloc (sizeof (struct filelist)); - n->next = NULL; - n->name = optarg; - flpp = &import_files; - while (*flpp != NULL) - flpp = &(*flpp)->next; - *flpp = n; - } - break; - - case OPTION_LOADMAP: - config.map_filename = optarg; - break; - - case OPTION_MAXDATA: - val = strtoul (optarg, &end, 0); - if (*end != '\0') - einfo ("%P: warning: ignoring invalid -bmaxdata number %s\n", - optarg); - else - maxdata = val; - break; - - case OPTION_MAXSTACK: - val = strtoul (optarg, &end, 0); - if (*end != '\0') - einfo ("%P: warning: ignoring invalid -bmaxstack number %s\n", - optarg); - else - maxstack = val; - break; - - case OPTION_MODTYPE: - if (*optarg == 'S') - { - link_info.shared = true; - ++optarg; - } - if (*optarg == '\0' || optarg[1] == '\0') - einfo ("%P: warning: ignoring invalid module type %s\n", optarg); - else - modtype = (*optarg << 8) | optarg[1]; - break; - - case OPTION_NOAUTOIMP: - link_info.static_link = true; - break; - - case OPTION_NOSTRCMPCT: - link_info.traditional_format = true; - break; - - case OPTION_PD: - /* This sets the page that the .data section is supposed to - start on. The offset within the page should still be the - offset within the file, so we need to build an appropriate - expression. */ - val = strtoul (optarg, &end, 0); - if (*end != '\0') - einfo ("%P: warning: ignoring invalid -pD number %s\n", optarg); - else - { - etree_type *t; - - t = exp_binop ('+', - exp_intop (val), - exp_binop ('&', - exp_nameop (NAME, "."), - exp_intop (0xfff))); - t = exp_binop ('&', - exp_binop ('+', t, exp_intop (31)), - exp_intop (~ (bfd_vma) 31)); - lang_section_start (".data", t); - } - break; - - case OPTION_PT: - /* This set the page that the .text section is supposed to start - on. The offset within the page should still be the offset - within the file. */ - val = strtoul (optarg, &end, 0); - if (*end != '\0') - einfo ("%P: warning: ignoring invalid -pT number %s\n", optarg); - else - { - etree_type *t; - - t = exp_binop ('+', - exp_intop (val), - exp_nameop (SIZEOF_HEADERS, NULL)); - t = exp_binop ('&', - exp_binop ('+', t, exp_intop (31)), - exp_intop (~ (bfd_vma) 31)); - lang_section_start (".text", t); - } - break; - - case OPTION_STRCMPCT: - link_info.traditional_format = false; - break; - - case OPTION_UNIX: - unix_ld = true; - break; - } - - return 1; -} - -/* This is called when an input file can not be recognized as a BFD - object or an archive. If the file starts with #!, we must treat it - as an import file. This is for AIX compatibility. */ - -static boolean -gld${EMULATION_NAME}_unrecognized_file (entry) - lang_input_statement_type *entry; -{ - FILE *e; - boolean ret; - - e = fopen (entry->filename, FOPEN_RT); - if (e == NULL) - return false; - - ret = false; - - if (getc (e) == '#' && getc (e) == '!') - { - struct filelist *n; - struct filelist **flpp; - - n = (struct filelist *) xmalloc (sizeof (struct filelist)); - n->next = NULL; - n->name = entry->filename; - flpp = &import_files; - while (*flpp != NULL) - flpp = &(*flpp)->next; - *flpp = n; - - ret = true; - entry->loaded = true; - } - - fclose (e); - - return ret; -} - -/* This is called after the input files have been opened. */ - -static void -gld${EMULATION_NAME}_after_open () -{ - boolean r; - struct set_info *p; - - /* Call ldctor_build_sets, after pretending that this is a - relocateable link. We do this because AIX requires relocation - entries for all references to symbols, even in a final - executable. Of course, we only want to do this if we are - producing an XCOFF output file. */ - r = link_info.relocateable; - if (strstr (bfd_get_target (output_bfd), "xcoff") != NULL) - link_info.relocateable = true; - ldctor_build_sets (); - link_info.relocateable = r; - - /* For each set, record the size, so that the XCOFF backend can - output the correct csect length. */ - for (p = sets; p != (struct set_info *) NULL; p = p->next) - { - bfd_size_type size; - - /* If the symbol is defined, we may have been invoked from - collect, and the sets may already have been built, so we do - not do anything. */ - if (p->h->type == bfd_link_hash_defined - || p->h->type == bfd_link_hash_defweak) - continue; - - if (p->reloc != BFD_RELOC_CTOR) - { - /* Handle this if we need to. */ - abort (); - } - - size = (p->count + 2) * 4; - if (! bfd_xcoff_link_record_set (output_bfd, &link_info, p->h, size)) - einfo ("%F%P: bfd_xcoff_link_record_set failed: %E\n"); - } -} - -/* This is called after the sections have been attached to output - sections, but before any sizes or addresses have been set. */ - -static void -gld${EMULATION_NAME}_before_allocation () -{ - struct filelist *fl; - struct export_symbol_list *el; - char *libpath; - asection *special_sections[6]; - int i; - - /* Handle the import and export files, if any. */ - for (fl = import_files; fl != NULL; fl = fl->next) - gld${EMULATION_NAME}_read_file (fl->name, true); - for (el = export_symbols; el != NULL; el = el->next) - { - struct bfd_link_hash_entry *h; - - h = bfd_link_hash_lookup (link_info.hash, el->name, false, false, false); - if (h == NULL) - einfo ("%P%F: bfd_link_hash_lookup of export symbol failed: %E\n"); - if (! bfd_xcoff_export_symbol (output_bfd, &link_info, h, el->syscall)) - einfo ("%P%F: bfd_xcoff_export_symbol failed: %E\n"); - } - - /* Track down all relocations called for by the linker script (these - are typically constructor/destructor entries created by - CONSTRUCTORS) and let the backend know it will need to create - .loader relocs for them. */ - lang_for_each_statement (gld${EMULATION_NAME}_find_relocs); - - /* We need to build LIBPATH from the -L arguments. If any -rpath - arguments were used, though, we use -rpath instead, as a GNU - extension. */ - if (command_line.rpath != NULL) - libpath = command_line.rpath; - else if (search_head == NULL) - libpath = (char *) ""; - else - { - size_t len; - search_dirs_type *search; - - len = strlen (search_head->name); - libpath = xmalloc (len + 1); - strcpy (libpath, search_head->name); - for (search = search_head->next; search != NULL; search = search->next) - { - size_t nlen; - - nlen = strlen (search->name); - libpath = xrealloc (libpath, len + nlen + 2); - libpath[len] = ':'; - strcpy (libpath + len + 1, search->name); - len += nlen + 1; - } - } - - /* Let the XCOFF backend set up the .loader section. */ - if (! bfd_xcoff_size_dynamic_sections (output_bfd, &link_info, libpath, - entry_symbol, file_align, - maxstack, maxdata, - gc && ! unix_ld ? true : false, - modtype, - textro ? true : false, - unix_ld, - special_sections)) - einfo ("%P%F: failed to set dynamic section sizes: %E\n"); - - /* Look through the special sections, and put them in the right - place in the link ordering. This is especially magic. */ - for (i = 0; i < 6; i++) - { - asection *sec; - lang_output_section_statement_type *os; - lang_statement_union_type **pls; - lang_input_section_type *is; - const char *oname; - boolean start; - - sec = special_sections[i]; - if (sec == NULL) - continue; - - /* Remove this section from the list of the output section. - This assumes we know what the script looks like. */ - is = NULL; - os = lang_output_section_find (sec->output_section->name); - if (os == NULL) - einfo ("%P%F: can't find output section %s\n", - sec->output_section->name); - for (pls = &os->children.head; *pls != NULL; pls = &(*pls)->next) - { - if ((*pls)->header.type == lang_input_section_enum - && (*pls)->input_section.section == sec) - { - is = (lang_input_section_type *) *pls; - *pls = (*pls)->next; - break; - } - if ((*pls)->header.type == lang_wild_statement_enum) - { - lang_statement_union_type **pwls; - - for (pwls = &(*pls)->wild_statement.children.head; - *pwls != NULL; - pwls = &(*pwls)->next) - { - if ((*pwls)->header.type == lang_input_section_enum - && (*pwls)->input_section.section == sec) - { - is = (lang_input_section_type *) *pwls; - *pwls = (*pwls)->next; - break; - } - } - if (is != NULL) - break; - } - } - - if (is == NULL) - einfo ("%P%F: can't find %s in output section\n", - bfd_get_section_name (sec->owner, sec)); - - /* Now figure out where the section should go. */ - switch (i) - { - default: /* to avoid warnings */ - case 0: - /* _text */ - oname = ".text"; - start = true; - break; - case 1: - /* _etext */ - oname = ".text"; - start = false; - break; - case 2: - /* _data */ - oname = ".data"; - start = true; - break; - case 3: - /* _edata */ - oname = ".data"; - start = false; - break; - case 4: - case 5: - /* _end and end */ - oname = ".bss"; - start = false; - break; - } - - os = lang_output_section_find (oname); - - if (start) - { - is->header.next = os->children.head; - os->children.head = (lang_statement_union_type *) is; - } - else - { - is->header.next = NULL; - lang_statement_append (&os->children, - (lang_statement_union_type *) is, - &is->header.next); - } - } -} - -/* Read an import or export file. For an import file, this is called - by the before_allocation emulation routine. For an export file, - this is called by the parse_args emulation routine. */ - -static void -gld${EMULATION_NAME}_read_file (filename, import) - const char *filename; - boolean import; -{ - struct obstack *o; - FILE *f; - int lineno; - int c; - boolean keep; - const char *imppath; - const char *impfile; - const char *impmember; - - o = (struct obstack *) xmalloc (sizeof (struct obstack)); - obstack_specify_allocation (o, 0, 0, xmalloc, gld${EMULATION_NAME}_free); - - f = fopen (filename, FOPEN_RT); - if (f == NULL) - { - bfd_set_error (bfd_error_system_call); - einfo ("%F%s: %E\n", filename); - } - - keep = false; - - imppath = NULL; - impfile = NULL; - impmember = NULL; - - lineno = 0; - while ((c = getc (f)) != EOF) - { - char *s; - char *symname; - boolean syscall; - bfd_vma address; - struct bfd_link_hash_entry *h; - - if (c != '\n') - { - obstack_1grow (o, c); - continue; - } - - obstack_1grow (o, '\0'); - ++lineno; - - s = (char *) obstack_base (o); - while (isspace ((unsigned char) *s)) - ++s; - if (*s == '\0' - || *s == '*' - || (*s == '#' && s[1] == ' ') - || (! import && *s == '#' && s[1] == '!')) - { - obstack_free (o, obstack_base (o)); - continue; - } - - if (*s == '#' && s[1] == '!') - { - s += 2; - while (isspace ((unsigned char) *s)) - ++s; - if (*s == '\0') - { - imppath = NULL; - impfile = NULL; - impmember = NULL; - obstack_free (o, obstack_base (o)); - } - else if (*s == '(') - einfo ("%F%s%d: #! ([member]) is not supported in import files\n", - filename, lineno); - else - { - char cs; - char *file; - - (void) obstack_finish (o); - keep = true; - imppath = s; - file = NULL; - while (! isspace ((unsigned char) *s) && *s != '(' && *s != '\0') - { - if (*s == '/') - file = s + 1; - ++s; - } - if (file != NULL) - { - file[-1] = '\0'; - impfile = file; - if (imppath == file - 1) - imppath = "/"; - } - else - { - impfile = imppath; - imppath = ""; - } - cs = *s; - *s = '\0'; - while (isspace ((unsigned char) cs)) - { - ++s; - cs = *s; - } - if (cs != '(') - { - impmember = ""; - if (cs != '\0') - einfo ("%s:%d: warning: syntax error in import file\n", - filename, lineno); - } - else - { - ++s; - impmember = s; - while (*s != ')' && *s != '\0') - ++s; - if (*s == ')') - *s = '\0'; - else - einfo ("%s:%d: warning: syntax error in import file\n", - filename, lineno); - } - } - - continue; - } - - /* This is a symbol to be imported or exported. */ - symname = s; - syscall = false; - address = (bfd_vma) -1; - - while (! isspace ((unsigned char) *s) && *s != '\0') - ++s; - if (*s != '\0') - { - char *se; - - *s++ = '\0'; - - while (isspace ((unsigned char) *s)) - ++s; - - se = s; - while (! isspace ((unsigned char) *se) && *se != '\0') - ++se; - if (*se != '\0') - { - *se++ = '\0'; - while (isspace ((unsigned char) *se)) - ++se; - if (*se != '\0') - einfo ("%s%d: warning: syntax error in import/export file\n", - filename, lineno); - } - - if (s == se) - { - /* There was no address after all. */ - } - else if (strcasecmp (s, "svc") == 0 - || strcasecmp (s, "syscall") == 0) - syscall = true; - else - { - char *end; - - address = strtoul (s, &end, 0); - if (*end != '\0') - einfo ("%s:%d: warning: syntax error in import/export file\n", - filename, lineno); - } - } - - if (! import) - { - struct export_symbol_list *n; - - ldlang_add_undef (symname); - n = ((struct export_symbol_list *) - xmalloc (sizeof (struct export_symbol_list))); - n->next = export_symbols; - n->name = buystring (symname); - n->syscall = syscall; - export_symbols = n; - } - else - { - h = bfd_link_hash_lookup (link_info.hash, symname, false, false, - true); - if (h == NULL || h->type == bfd_link_hash_new) - { - /* We can just ignore attempts to import an unreferenced - symbol. */ - } - else - { - if (! bfd_xcoff_import_symbol (output_bfd, &link_info, h, - address, imppath, impfile, - impmember)) - einfo ("%X%s:%d: failed to import symbol %s: %E\n", - filename, lineno, symname); - } - } - - obstack_free (o, obstack_base (o)); - } - - if (obstack_object_size (o) > 0) - { - einfo ("%s:%d: warning: ignoring unterminated last line\n", - filename, lineno); - obstack_free (o, obstack_base (o)); - } - - if (! keep) - { - obstack_free (o, NULL); - free (o); - } -} - -/* This routine saves us from worrying about declaring free. */ - -static void -gld${EMULATION_NAME}_free (p) - PTR p; -{ - free (p); -} - -/* This is called by the before_allocation routine via - lang_for_each_statement. It looks for relocations and assignments - to symbols. */ - -static void -gld${EMULATION_NAME}_find_relocs (s) - lang_statement_union_type *s; -{ - if (s->header.type == lang_reloc_statement_enum) - { - lang_reloc_statement_type *rs; - - rs = &s->reloc_statement; - if (rs->name == NULL) - einfo ("%F%P: only relocations against symbols are permitted\n"); - if (! bfd_xcoff_link_count_reloc (output_bfd, &link_info, rs->name)) - einfo ("%F%P: bfd_xcoff_link_count_reloc failed: %E\n"); - } - - if (s->header.type == lang_assignment_statement_enum) - gld${EMULATION_NAME}_find_exp_assignment (s->assignment_statement.exp); -} - -/* Look through an expression for an assignment statement. */ - -static void -gld${EMULATION_NAME}_find_exp_assignment (exp) - etree_type *exp; -{ - struct bfd_link_hash_entry *h; - - switch (exp->type.node_class) - { - case etree_provide: - h = bfd_link_hash_lookup (link_info.hash, exp->assign.dst, - false, false, false); - if (h == NULL) - break; - /* Fall through. */ - case etree_assign: - if (strcmp (exp->assign.dst, ".") != 0) - { - if (! bfd_xcoff_record_link_assignment (output_bfd, &link_info, - exp->assign.dst)) - einfo ("%P%F: failed to record assignment to %s: %E\n", - exp->assign.dst); - } - gld${EMULATION_NAME}_find_exp_assignment (exp->assign.src); - break; - - case etree_binary: - gld${EMULATION_NAME}_find_exp_assignment (exp->binary.lhs); - gld${EMULATION_NAME}_find_exp_assignment (exp->binary.rhs); - break; - - case etree_trinary: - gld${EMULATION_NAME}_find_exp_assignment (exp->trinary.cond); - gld${EMULATION_NAME}_find_exp_assignment (exp->trinary.lhs); - gld${EMULATION_NAME}_find_exp_assignment (exp->trinary.rhs); - break; - - case etree_unary: - gld${EMULATION_NAME}_find_exp_assignment (exp->unary.child); - break; - - default: - break; - } -} - -static char * -gld${EMULATION_NAME}_get_script(isfile) - int *isfile; -EOF - -if test -n "$COMPILE_IN" -then -# Scripts compiled in. - -# sed commands to quote an ld script as a C string. -sc="-f ${srcdir}/emultempl/stringify.sed" - -cat >>e${EMULATION_NAME}.c <> e${EMULATION_NAME}.c -echo ' ; else if (link_info.relocateable == true) return' >> e${EMULATION_NAME}.c -sed $sc ldscripts/${EMULATION_NAME}.xr >> e${EMULATION_NAME}.c -echo ' ; else if (!config.text_read_only) return' >> e${EMULATION_NAME}.c -sed $sc ldscripts/${EMULATION_NAME}.xbn >> e${EMULATION_NAME}.c -echo ' ; else if (!config.magic_demand_paged) return' >> e${EMULATION_NAME}.c -sed $sc ldscripts/${EMULATION_NAME}.xn >> e${EMULATION_NAME}.c -echo ' ; else return' >> e${EMULATION_NAME}.c -sed $sc ldscripts/${EMULATION_NAME}.x >> e${EMULATION_NAME}.c -echo '; }' >> e${EMULATION_NAME}.c - -else -# Scripts read from the filesystem. - -cat >>e${EMULATION_NAME}.c <>e${EMULATION_NAME}.c <e${EMULATION_NAME}.c <the_bfd, &link_info)) - { - einfo("Errors encountered processing file %s", is->filename); - } - } - } - - /* We have seen it all. Allocate it, and carry on */ - arm_allocate_interworking_sections (&link_info); -} - -static char * -gld${EMULATION_NAME}_get_script(isfile) - int *isfile; -EOF - -if test -n "$COMPILE_IN" -then -# Scripts compiled in. - -# sed commands to quote an ld script as a C string. -sc="-f ${srcdir}/emultempl/stringify.sed" - -cat >>e${EMULATION_NAME}.c <> e${EMULATION_NAME}.c -echo ' ; else if (link_info.relocateable == true) return' >> e${EMULATION_NAME}.c -sed $sc ldscripts/${EMULATION_NAME}.xr >> e${EMULATION_NAME}.c -echo ' ; else if (!config.text_read_only) return' >> e${EMULATION_NAME}.c -sed $sc ldscripts/${EMULATION_NAME}.xbn >> e${EMULATION_NAME}.c -echo ' ; else if (!config.magic_demand_paged) return' >> e${EMULATION_NAME}.c -sed $sc ldscripts/${EMULATION_NAME}.xn >> e${EMULATION_NAME}.c -echo ' ; else return' >> e${EMULATION_NAME}.c -sed $sc ldscripts/${EMULATION_NAME}.x >> e${EMULATION_NAME}.c -echo '; }' >> e${EMULATION_NAME}.c - -else -# Scripts read from the filesystem. - -cat >>e${EMULATION_NAME}.c <>e${EMULATION_NAME}.c <e${EMULATION_NAME}.c < - ELF support by Ian Lance Taylor - -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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ - -#define TARGET_IS_${EMULATION_NAME} - -#include "bfd.h" -#include "sysdep.h" - -#include - -#include "bfdlink.h" - -#include "ld.h" -#include "ldmain.h" -#include "ldemul.h" -#include "ldfile.h" -#include "ldmisc.h" -#include "ldexp.h" -#include "ldlang.h" -#include "ldgram.h" - -static void gld${EMULATION_NAME}_before_parse PARAMS ((void)); -static boolean gld${EMULATION_NAME}_open_dynamic_archive - PARAMS ((const char *, search_dirs_type *, lang_input_statement_type *)); -static void gld${EMULATION_NAME}_after_open PARAMS ((void)); -static void gld${EMULATION_NAME}_check_needed - PARAMS ((lang_input_statement_type *)); -static void gld${EMULATION_NAME}_stat_needed - PARAMS ((lang_input_statement_type *)); -static boolean gld${EMULATION_NAME}_search_needed - PARAMS ((const char *, const char *, int)); -static boolean gld${EMULATION_NAME}_try_needed PARAMS ((const char *, int)); -static void gld${EMULATION_NAME}_vercheck - PARAMS ((lang_input_statement_type *)); -static void gld${EMULATION_NAME}_before_allocation PARAMS ((void)); -static void gld${EMULATION_NAME}_find_statement_assignment - PARAMS ((lang_statement_union_type *)); -static void gld${EMULATION_NAME}_find_exp_assignment PARAMS ((etree_type *)); -static boolean gld${EMULATION_NAME}_place_orphan - PARAMS ((lang_input_statement_type *, asection *)); -static void gld${EMULATION_NAME}_place_section - PARAMS ((lang_statement_union_type *)); -static char *gld${EMULATION_NAME}_get_script PARAMS ((int *isfile)); - -static void -gld${EMULATION_NAME}_before_parse() -{ - ldfile_output_architecture = bfd_arch_`echo ${ARCH} | sed -e 's/:.*//'`; - config.dynamic_link = ${DYNAMIC_LINK-true}; -} - -/* Try to open a dynamic archive. This is where we know that ELF - dynamic libraries have an extension of .so. */ - -static boolean -gld${EMULATION_NAME}_open_dynamic_archive (arch, search, entry) - const char *arch; - search_dirs_type *search; - lang_input_statement_type *entry; -{ - const char *filename; - char *string; - - if (! entry->is_archive) - return false; - - filename = entry->filename; - - string = (char *) xmalloc (strlen (search->name) - + strlen (filename) - + strlen (arch) - + sizeof "/lib.so"); - - sprintf (string, "%s/lib%s%s.so", search->name, filename, arch); - - if (! ldfile_try_open_bfd (string, entry)) - { - free (string); - return false; - } - - entry->filename = string; - - /* We have found a dynamic object to include in the link. The ELF - backend linker will create a DT_NEEDED entry in the .dynamic - section naming this file. If this file includes a DT_SONAME - entry, it will be used. Otherwise, the ELF linker will just use - the name of the file. For an archive found by searching, like - this one, the DT_NEEDED entry should consist of just the name of - the file, without the path information used to find it. Note - that we only need to do this if we have a dynamic object; an - archive will never be referenced by a DT_NEEDED entry. - - FIXME: This approach--using bfd_elf_set_dt_needed_name--is not - very pretty. I haven't been able to think of anything that is - pretty, though. */ - if (bfd_check_format (entry->the_bfd, bfd_object) - && (entry->the_bfd->flags & DYNAMIC) != 0) - { - char *needed_name; - - ASSERT (entry->is_archive && entry->search_dirs_flag); - needed_name = (char *) xmalloc (strlen (filename) - + strlen (arch) - + sizeof "lib.so"); - sprintf (needed_name, "lib%s%s.so", filename, arch); - bfd_elf_set_dt_needed_name (entry->the_bfd, needed_name); - } - - return true; -} - -EOF -if [ "x${host}" = "x${target}" ] ; then - if [ "x${DEFAULT_EMULATION}" = "x${EMULATION_NAME}" ] ; then -cat >>e${EMULATION_NAME}.c <= alloc) - { - alloc *= 2; - b = (char *) xrealloc (b, alloc); - } - if (c != ':' - && c != ' ' - && c != '\t' - && c != '\n' - && c != ',') - { - b[len] = c; - ++len; - } - else - { - if (len > 0 && b[len - 1] != ':') - { - b[len] = ':'; - ++len; - } - } - } - - if (len > 0 && b[len - 1] == ':') - --len; - - if (len > 0) - b[len] = '\0'; - else - { - free (b); - b = NULL; - } - - fclose (f); - - ld_so_conf = b; - } - - initialized = true; - } - - if (ld_so_conf == NULL) - return false; - - return gld${EMULATION_NAME}_search_needed (ld_so_conf, name, force); -} - -EOF - fi -fi -cat >>e${EMULATION_NAME}.c <next) - { - struct bfd_link_needed_list *ll; - int force; - - /* If we've already seen this file, skip it. */ - for (ll = needed; ll != l; ll = ll->next) - if (strcmp (ll->name, l->name) == 0) - break; - if (ll != l) - continue; - - /* See if this file was included in the link explicitly. */ - global_needed = l; - global_found = false; - lang_for_each_input_file (gld${EMULATION_NAME}_check_needed); - if (global_found) - continue; - - /* We need to find this file and include the symbol table. We - want to search for the file in the same way that the dynamic - linker will search. That means that we want to use - rpath_link, rpath, then the environment variable - LD_LIBRARY_PATH (native only), then the linker script - LIB_SEARCH_DIRS. We do not search using the -L arguments. - - We search twice. The first time, we skip objects which may - introduce version mismatches. The second time, we force - their use. See gld${EMULATION_NAME}_vercheck comment. */ - for (force = 0; force < 2; force++) - { - const char *lib_path; - size_t len; - search_dirs_type *search; - -EOF -if [ "x${host}" = "x${target}" ] ; then - if [ "x${DEFAULT_EMULATION}" = "x${EMULATION_NAME}" ] ; then -cat >>e${EMULATION_NAME}.c <>e${EMULATION_NAME}.c <name, force)) - break; - if (gld${EMULATION_NAME}_search_needed (command_line.rpath, - l->name, force)) - break; - if (command_line.rpath_link == NULL - && command_line.rpath == NULL) - { - lib_path = (const char *) getenv ("LD_RUN_PATH"); - if (gld${EMULATION_NAME}_search_needed (lib_path, l->name, - force)) - break; - } -EOF -if [ "x${host}" = "x${target}" ] ; then - if [ "x${DEFAULT_EMULATION}" = "x${EMULATION_NAME}" ] ; then -cat >>e${EMULATION_NAME}.c <name, force)) - break; - - found = 0; - rp = bfd_elf_get_runpath_list (output_bfd, &link_info); - for (; !found && rp != NULL; rp = rp->next) - { - found = (rp->by == l->by - && gld${EMULATION_NAME}_search_needed (rp->name, - l->name, - force)); - } - if (found) - break; - -EOF - fi -fi -cat >>e${EMULATION_NAME}.c <name); - for (search = search_head; search != NULL; search = search->next) - { - char *filename; - - if (search->cmdline) - continue; - filename = (char *) xmalloc (strlen (search->name) + len + 2); - sprintf (filename, "%s/%s", search->name, l->name); - if (gld${EMULATION_NAME}_try_needed (filename, force)) - break; - free (filename); - } - if (search != NULL) - break; -EOF -if [ "x${host}" = "x${target}" ] ; then - if [ "x${DEFAULT_EMULATION}" = "x${EMULATION_NAME}" ] ; then -cat >>e${EMULATION_NAME}.c <name, force)) - break; -EOF - fi -fi -cat >>e${EMULATION_NAME}.c <name, l->by); - } -} - -/* Search for a needed file in a path. */ - -static boolean -gld${EMULATION_NAME}_search_needed (path, name, force) - const char *path; - const char *name; - int force; -{ - const char *s; - size_t len; - - if (path == NULL || *path == '\0') - return false; - len = strlen (name); - while (1) - { - char *filename, *sset; - - s = strchr (path, ':'); - if (s == NULL) - s = path + strlen (path); - - filename = (char *) xmalloc (s - path + len + 2); - if (s == path) - sset = filename; - else - { - memcpy (filename, path, s - path); - filename[s - path] = '/'; - sset = filename + (s - path) + 1; - } - strcpy (sset, name); - - if (gld${EMULATION_NAME}_try_needed (filename, force)) - return true; - - free (filename); - - if (*s == '\0') - break; - path = s + 1; - } - - return false; -} - -/* This function is called for each possible name for a dynamic object - named by a DT_NEEDED entry. The FORCE parameter indicates whether - to skip the check for a conflicting version. */ - -static boolean -gld${EMULATION_NAME}_try_needed (name, force) - const char *name; - int force; -{ - bfd *abfd; - - abfd = bfd_openr (name, bfd_get_target (output_bfd)); - if (abfd == NULL) - return false; - if (! bfd_check_format (abfd, bfd_object)) - { - (void) bfd_close (abfd); - return false; - } - if ((bfd_get_file_flags (abfd) & DYNAMIC) == 0) - { - (void) bfd_close (abfd); - return false; - } - - /* Check whether this object would include any conflicting library - versions. If FORCE is set, then we skip this check; we use this - the second time around, if we couldn't find any compatible - instance of the shared library. */ - - if (! force) - { - struct bfd_link_needed_list *needed; - - if (! bfd_elf_get_bfd_needed_list (abfd, &needed)) - einfo ("%F%P:%B: bfd_elf_get_bfd_needed_list failed: %E\n", abfd); - - if (needed != NULL) - { - global_vercheck_needed = needed; - global_vercheck_failed = false; - lang_for_each_input_file (gld${EMULATION_NAME}_vercheck); - if (global_vercheck_failed) - { - (void) bfd_close (abfd); - /* Return false to force the caller to move on to try - another file on the search path. */ - return false; - } - - /* But wait! It gets much worse. On Linux, if a shared - library does not use libc at all, we are supposed to skip - it the first time around in case we encounter a shared - library later on with the same name which does use the - version of libc that we want. This is much too horrible - to use on any system other than Linux. */ - -EOF -case ${target} in - *-*-linux-gnu*) - cat >>e${EMULATION_NAME}.c <next) - if (strncmp (l->name, "libc.so", 7) == 0) - break; - if (l == NULL) - { - (void) bfd_close (abfd); - return false; - } - } - -EOF - ;; -esac -cat >>e${EMULATION_NAME}.c <filename != NULL - && strcmp (s->filename, global_needed->name) == 0) - { - global_found = true; - return; - } - - if (s->the_bfd != NULL) - { - const char *soname; - - soname = bfd_elf_get_dt_soname (s->the_bfd); - if (soname != NULL - && strcmp (soname, global_needed->name) == 0) - { - global_found = true; - return; - } - } - - if (s->search_dirs_flag - && s->filename != NULL - && strchr (global_needed->name, '/') == NULL) - { - const char *f; - - f = strrchr (s->filename, '/'); - if (f != NULL - && strcmp (f + 1, global_needed->name) == 0) - { - global_found = true; - return; - } - } -} - -/* See if an input file matches a DT_NEEDED entry by running stat on - the file. */ - -static void -gld${EMULATION_NAME}_stat_needed (s) - lang_input_statement_type *s; -{ - struct stat st; - const char *suffix; - const char *soname; - const char *f; - - if (global_found) - return; - if (s->the_bfd == NULL) - return; - - if (bfd_stat (s->the_bfd, &st) != 0) - { - einfo ("%P:%B: bfd_stat failed: %E\n", s->the_bfd); - return; - } - - if (st.st_dev == global_stat.st_dev - && st.st_ino == global_stat.st_ino) - { - global_found = true; - return; - } - - /* We issue a warning if it looks like we are including two - different versions of the same shared library. For example, - there may be a problem if -lc picks up libc.so.6 but some other - shared library has a DT_NEEDED entry of libc.so.5. This is a - hueristic test, and it will only work if the name looks like - NAME.so.VERSION. FIXME: Depending on file names is error-prone. - If we really want to issue warnings about mixing version numbers - of shared libraries, we need to find a better way. */ - - if (strchr (global_needed->name, '/') != NULL) - return; - suffix = strstr (global_needed->name, ".so."); - if (suffix == NULL) - return; - suffix += sizeof ".so." - 1; - - soname = bfd_elf_get_dt_soname (s->the_bfd); - if (soname == NULL) - soname = s->filename; - - f = strrchr (soname, '/'); - if (f != NULL) - ++f; - else - f = soname; - - if (strncmp (f, global_needed->name, suffix - global_needed->name) == 0) - einfo ("%P: warning: %s, needed by %B, may conflict with %s\n", - global_needed->name, global_needed->by, f); -} - -/* On Linux, it's possible to have different versions of the same - shared library linked against different versions of libc. The - dynamic linker somehow tags which libc version to use in - /etc/ld.so.cache, and, based on the libc that it sees in the - executable, chooses which version of the shared library to use. - - We try to do a similar check here by checking whether this shared - library needs any other shared libraries which may conflict with - libraries we have already included in the link. If it does, we - skip it, and try to find another shared library farther on down the - link path. - - This is called via lang_for_each_input_file. - GLOBAL_VERCHECK_NEEDED is the list of objects needed by the object - which we ar checking. This sets GLOBAL_VERCHECK_FAILED if we find - a conflicting version. */ - -static void -gld${EMULATION_NAME}_vercheck (s) - lang_input_statement_type *s; -{ - const char *soname, *f; - struct bfd_link_needed_list *l; - - if (global_vercheck_failed) - return; - if (s->the_bfd == NULL - || (bfd_get_file_flags (s->the_bfd) & DYNAMIC) == 0) - return; - - soname = bfd_elf_get_dt_soname (s->the_bfd); - if (soname == NULL) - soname = bfd_get_filename (s->the_bfd); - - f = strrchr (soname, '/'); - if (f != NULL) - ++f; - else - f = soname; - - for (l = global_vercheck_needed; l != NULL; l = l->next) - { - const char *suffix; - - if (strcmp (f, l->name) == 0) - { - /* Probably can't happen, but it's an easy check. */ - continue; - } - - if (strchr (l->name, '/') != NULL) - continue; - - suffix = strstr (l->name, ".so."); - if (suffix == NULL) - continue; - - suffix += sizeof ".so." - 1; - - if (strncmp (f, l->name, suffix - l->name) == 0) - { - /* Here we know that S is a dynamic object FOO.SO.VER1, and - the object we are considering needs a dynamic object - FOO.SO.VER2, and VER1 and VER2 are different. This - appears to be a version mismatch, so we tell the caller - to try a different version of this library. */ - global_vercheck_failed = true; - return; - } - } -} - -/* This is called after the sections have been attached to output - sections, but before any sizes or addresses have been set. */ - -static void -gld${EMULATION_NAME}_before_allocation () -{ - const char *rpath; - asection *sinterp; - - /* If we are going to make any variable assignments, we need to let - the ELF backend know about them in case the variables are - referred to by dynamic objects. */ - lang_for_each_statement (gld${EMULATION_NAME}_find_statement_assignment); - - /* Let the ELF backend work out the sizes of any sections required - by dynamic linking. */ - rpath = command_line.rpath; - if (rpath == NULL) - rpath = (const char *) getenv ("LD_RUN_PATH"); - if (! (bfd_elf${ELFSIZE}_size_dynamic_sections - (output_bfd, command_line.soname, rpath, - command_line.export_dynamic, command_line.filter_shlib, - (const char * const *) command_line.auxiliary_filters, - &link_info, &sinterp, lang_elf_version_info))) - einfo ("%P%F: failed to set dynamic section sizes: %E\n"); - - /* Let the user override the dynamic linker we are using. */ - if (command_line.interpreter != NULL - && sinterp != NULL) - { - sinterp->contents = (bfd_byte *) command_line.interpreter; - sinterp->_raw_size = strlen (command_line.interpreter) + 1; - } - - /* Look for any sections named .gnu.warning. As a GNU extensions, - we treat such sections as containing warning messages. We print - out the warning message, and then zero out the section size so - that it does not get copied into the output file. */ - - { - LANG_FOR_EACH_INPUT_STATEMENT (is) - { - asection *s; - bfd_size_type sz; - char *msg; - boolean ret; - - if (is->just_syms_flag) - continue; - - s = bfd_get_section_by_name (is->the_bfd, ".gnu.warning"); - if (s == NULL) - continue; - - sz = bfd_section_size (is->the_bfd, s); - msg = xmalloc ((size_t) sz + 1); - if (! bfd_get_section_contents (is->the_bfd, s, msg, (file_ptr) 0, sz)) - einfo ("%F%B: Can't read contents of section .gnu.warning: %E\n", - is->the_bfd); - msg[sz] = '\0'; - ret = link_info.callbacks->warning (&link_info, msg, - (const char *) NULL, - is->the_bfd, (asection *) NULL, - (bfd_vma) 0); - ASSERT (ret); - free (msg); - - /* Clobber the section size, so that we don't waste copying the - warning into the output file. */ - s->_raw_size = 0; - } - } - -#if defined (TARGET_IS_elf32bmip) || defined (TARGET_IS_elf32lmip) - /* For MIPS ELF the .reginfo section requires special handling. - Each input section is 24 bytes, and the final output section must - also be 24 bytes. We handle this by clobbering all but the first - input section size to 0. The .reginfo section is handled - specially by the backend code anyhow. */ - { - boolean found = false; - LANG_FOR_EACH_INPUT_STATEMENT (is) - { - asection *s; - - if (is->just_syms_flag) - continue; - - s = bfd_get_section_by_name (is->the_bfd, ".reginfo"); - if (s == NULL) - continue; - - if (! found) - { - found = true; - continue; - } - - s->_raw_size = 0; - s->_cooked_size = 0; - } - } -#endif -} - -/* This is called by the before_allocation routine via - lang_for_each_statement. It locates any assignment statements, and - tells the ELF backend about them, in case they are assignments to - symbols which are referred to by dynamic objects. */ - -static void -gld${EMULATION_NAME}_find_statement_assignment (s) - lang_statement_union_type *s; -{ - if (s->header.type == lang_assignment_statement_enum) - gld${EMULATION_NAME}_find_exp_assignment (s->assignment_statement.exp); -} - -/* Look through an expression for an assignment statement. */ - -static void -gld${EMULATION_NAME}_find_exp_assignment (exp) - etree_type *exp; -{ - struct bfd_link_hash_entry *h; - - switch (exp->type.node_class) - { - case etree_provide: - h = bfd_link_hash_lookup (link_info.hash, exp->assign.dst, - false, false, false); - if (h == NULL) - break; - - /* We call record_link_assignment even if the symbol is defined. - This is because if it is defined by a dynamic object, we - actually want to use the value defined by the linker script, - not the value from the dynamic object (because we are setting - symbols like etext). If the symbol is defined by a regular - object, then, as it happens, calling record_link_assignment - will do no harm. */ - - /* Fall through. */ - case etree_assign: - if (strcmp (exp->assign.dst, ".") != 0) - { - if (! (bfd_elf${ELFSIZE}_record_link_assignment - (output_bfd, &link_info, exp->assign.dst, - exp->type.node_class == etree_provide ? true : false))) - einfo ("%P%F: failed to record assignment to %s: %E\n", - exp->assign.dst); - } - gld${EMULATION_NAME}_find_exp_assignment (exp->assign.src); - break; - - case etree_binary: - gld${EMULATION_NAME}_find_exp_assignment (exp->binary.lhs); - gld${EMULATION_NAME}_find_exp_assignment (exp->binary.rhs); - break; - - case etree_trinary: - gld${EMULATION_NAME}_find_exp_assignment (exp->trinary.cond); - gld${EMULATION_NAME}_find_exp_assignment (exp->trinary.lhs); - gld${EMULATION_NAME}_find_exp_assignment (exp->trinary.rhs); - break; - - case etree_unary: - gld${EMULATION_NAME}_find_exp_assignment (exp->unary.child); - break; - - default: - break; - } -} - -/* Place an orphan section. We use this to put random SHF_ALLOC - sections in the right segment. */ - -static asection *hold_section; -static lang_output_section_statement_type *hold_use; -static lang_output_section_statement_type *hold_text; -static lang_output_section_statement_type *hold_rodata; -static lang_output_section_statement_type *hold_data; -static lang_output_section_statement_type *hold_bss; -static lang_output_section_statement_type *hold_rel; -static lang_output_section_statement_type *hold_interp; - -/*ARGSUSED*/ -static boolean -gld${EMULATION_NAME}_place_orphan (file, s) - lang_input_statement_type *file; - asection *s; -{ - lang_output_section_statement_type *place; - asection *snew, **pps; - lang_statement_list_type *old; - lang_statement_list_type add; - etree_type *address; - const char *secname, *ps; - const char *outsecname; - lang_output_section_statement_type *os; - - if ((s->flags & SEC_ALLOC) == 0) - return false; - - /* Look through the script to see where to place this section. */ - hold_section = s; - hold_use = NULL; - lang_for_each_statement (gld${EMULATION_NAME}_place_section); - - if (hold_use != NULL) - { - /* We have already placed a section with this name. */ - wild_doit (&hold_use->children, s, hold_use, file); - return true; - } - - secname = bfd_get_section_name (s->owner, s); - - /* If this is a final link, then always put .gnu.warning.SYMBOL - sections into the .text section to get them out of the way. */ - if (! link_info.shared - && ! link_info.relocateable - && strncmp (secname, ".gnu.warning.", sizeof ".gnu.warning." - 1) == 0 - && hold_text != NULL) - { - wild_doit (&hold_text->children, s, hold_text, file); - return true; - } - - /* Decide which segment the section should go in based on the - section name and section flags. We put loadable .note sections - right after the .interp section, so that the PT_NOTE segment is - stored right after the program headers where the OS can read it - in the first page. */ - place = NULL; - if ((s->flags & SEC_LOAD) != 0 - && strncmp (secname, ".note", 4) == 0 - && hold_interp != NULL) - place = hold_interp; - else if ((s->flags & SEC_HAS_CONTENTS) == 0 - && hold_bss != NULL) - place = hold_bss; - else if ((s->flags & SEC_READONLY) == 0 - && hold_data != NULL) - place = hold_data; - else if (strncmp (secname, ".rel", 4) == 0 - && hold_rel != NULL) - place = hold_rel; - else if ((s->flags & SEC_CODE) == 0 - && (s->flags & SEC_READONLY) != 0 - && hold_rodata != NULL) - place = hold_rodata; - else if ((s->flags & SEC_READONLY) != 0 - && hold_text != NULL) - place = hold_text; - if (place == NULL) - return false; - - /* Choose a unique name for the section. This will be needed if the - same section name appears in the input file with different - loadable or allocateable characteristics. */ - outsecname = secname; - if (bfd_get_section_by_name (output_bfd, outsecname) != NULL) - { - unsigned int len; - char *newname; - unsigned int i; - - len = strlen (outsecname); - newname = xmalloc (len + 5); - strcpy (newname, outsecname); - i = 0; - do - { - sprintf (newname + len, "%d", i); - ++i; - } - while (bfd_get_section_by_name (output_bfd, newname) != NULL); - - outsecname = newname; - } - - /* Create the section in the output file, and put it in the right - place. This shuffling is to make the output file look neater. */ - snew = bfd_make_section (output_bfd, outsecname); - if (snew == NULL) - einfo ("%P%F: output format %s cannot represent section called %s\n", - output_bfd->xvec->name, outsecname); - if (place->bfd_section != NULL) - { - for (pps = &output_bfd->sections; *pps != snew; pps = &(*pps)->next) - ; - *pps = snew->next; - snew->next = place->bfd_section->next; - place->bfd_section->next = snew; - } - - /* Start building a list of statements for this section. */ - old = stat_ptr; - stat_ptr = &add; - lang_list_init (stat_ptr); - - /* If the name of the section is representable in C, then create - symbols to mark the start and the end of the section. */ - for (ps = outsecname; *ps != '\0'; ps++) - if (! isalnum ((unsigned char) *ps) && *ps != '_') - break; - if (*ps == '\0' && config.build_constructors) - { - char *symname; - - symname = (char *) xmalloc (ps - outsecname + sizeof "__start_"); - sprintf (symname, "__start_%s", outsecname); - lang_add_assignment (exp_assop ('=', symname, - exp_unop (ALIGN_K, - exp_intop ((bfd_vma) 1 - << s->alignment_power)))); - } - - if (! link_info.relocateable) - address = NULL; - else - address = exp_intop ((bfd_vma) 0); - - lang_enter_output_section_statement (outsecname, address, 0, - (bfd_vma) 0, - (etree_type *) NULL, - (etree_type *) NULL, - (etree_type *) NULL); - - os = lang_output_section_statement_lookup (outsecname); - wild_doit (&os->children, s, os, file); - - lang_leave_output_section_statement - ((bfd_vma) 0, "*default*", (struct lang_output_section_phdr_list *) NULL); - stat_ptr = &add; - - if (*ps == '\0' && config.build_constructors) - { - char *symname; - - symname = (char *) xmalloc (ps - outsecname + sizeof "__stop_"); - sprintf (symname, "__stop_%s", outsecname); - lang_add_assignment (exp_assop ('=', symname, - exp_nameop (NAME, "."))); - } - - /* Now stick the new statement list right after PLACE. */ - *add.tail = place->header.next; - place->header.next = add.head; - - stat_ptr = old; - - return true; -} - -static void -gld${EMULATION_NAME}_place_section (s) - lang_statement_union_type *s; -{ - lang_output_section_statement_type *os; - - if (s->header.type != lang_output_section_statement_enum) - return; - - os = &s->output_section_statement; - - if (strcmp (os->name, hold_section->name) == 0 - && os->bfd_section != NULL - && ((hold_section->flags & (SEC_LOAD | SEC_ALLOC)) - == (os->bfd_section->flags & (SEC_LOAD | SEC_ALLOC)))) - hold_use = os; - - if (strcmp (os->name, ".text") == 0) - hold_text = os; - else if (strcmp (os->name, ".rodata") == 0) - hold_rodata = os; - else if (strcmp (os->name, ".data") == 0) - hold_data = os; - else if (strcmp (os->name, ".bss") == 0) - hold_bss = os; - else if (hold_rel == NULL - && os->bfd_section != NULL - && (os->bfd_section->flags & SEC_ALLOC) != 0 - && strncmp (os->name, ".rel", 4) == 0) - hold_rel = os; - else if (strcmp (os->name, ".interp") == 0) - hold_interp = os; -} - -static char * -gld${EMULATION_NAME}_get_script(isfile) - int *isfile; -EOF - -if test -n "$COMPILE_IN" -then -# Scripts compiled in. - -# sed commands to quote an ld script as a C string. -sc='s/["\\]/\\&/g -s/$/\\n\\/ -1s/^/"/ -$s/$/n"/ -' - -cat >>e${EMULATION_NAME}.c <>e${EMULATION_NAME}.c <>e${EMULATION_NAME}.c <e${EMULATION_NAME}.c <>e${EMULATION_NAME}.c <> e${EMULATION_NAME}.c -echo ' ; else if (link_info.relocateable == true) return' >> e${EMULATION_NAME}.c -sed $sc ldscripts/${EMULATION_NAME}.xr >> e${EMULATION_NAME}.c -echo ' ; else if (!config.text_read_only) return' >> e${EMULATION_NAME}.c -sed $sc ldscripts/${EMULATION_NAME}.xbn >> e${EMULATION_NAME}.c -echo ' ; else if (!config.magic_demand_paged) return' >> e${EMULATION_NAME}.c -sed $sc ldscripts/${EMULATION_NAME}.xn >> e${EMULATION_NAME}.c -echo ' ; else return' >> e${EMULATION_NAME}.c -sed $sc ldscripts/${EMULATION_NAME}.x >> e${EMULATION_NAME}.c -echo '; }' >> e${EMULATION_NAME}.c - -else -# Scripts read from the filesystem. - -cat >>e${EMULATION_NAME}.c <>e${EMULATION_NAME}.c <e${EMULATION_NAME}.c <>e${EMULATION_NAME}.c <>e${EMULATION_NAME}.c <>e${EMULATION_NAME}.c <e${EMULATION_NAME}.c < -#include "bfd.h" -#include "sysdep.h" -#include "libiberty.h" -#include "bfdlink.h" - -#include "ld.h" -#include "ldemul.h" -#include "ldfile.h" -#include "ldmisc.h" -#include "ldmain.h" - -#ifdef GNU960 - -static void -gld960_before_parse() -{ - static char *env_variables[] = { "G960LIB", "G960BASE", 0 }; - char **p; - char *env ; - - for ( p = env_variables; *p; p++ ){ - env = (char *) getenv(*p); - if (env) { - ldfile_add_library_path (concat (env, - "/lib/libcoff", - (const char *) NULL), - false); - } - } - ldfile_output_architecture = bfd_arch_i960; -} - -#else /* not GNU960 */ - -static void gld960_before_parse() -{ - char *env ; - env = getenv("G960LIB"); - if (env) { - ldfile_add_library_path(env, false); - } - env = getenv("G960BASE"); - if (env) - ldfile_add_library_path (concat (env, "/lib", (const char *) NULL), - false); - ldfile_output_architecture = bfd_arch_i960; -} - -#endif /* GNU960 */ - - -static void -gld960_set_output_arch() -{ - if (ldfile_output_machine_name != NULL - && *ldfile_output_machine_name != '\0') - { - char *s, *s1; - - s = concat ("i960:", ldfile_output_machine_name, (char *) NULL); - for (s1 = s; *s1 != '\0'; s1++) - if (isupper ((unsigned char) *s1)) - *s1 = tolower ((unsigned char) *s1); - ldfile_set_output_arch (s); - free (s); - } - - set_output_arch_default (); -} - -static char * -gld960_choose_target() -{ -#ifdef GNU960 - - output_filename = "b.out"; - return bfd_make_targ_name(BFD_BOUT_FORMAT, 0); - -#else - - char *from_outside = getenv(TARGET_ENVIRON); - output_filename = "b.out"; - - if (from_outside != (char *)NULL) - return from_outside; - - return "coff-Intel-little"; - -#endif -} - -static char * -gld960_get_script(isfile) - int *isfile; -EOF - -if test -n "$COMPILE_IN" -then -# Scripts compiled in. - -# sed commands to quote an ld script as a C string. -sc='s/["\\]/\\&/g -s/$/\\n\\/ -1s/^/"/ -$s/$/n"/ -' - -cat >>e${EMULATION_NAME}.c <>e${EMULATION_NAME}.c <>e${EMULATION_NAME}.c <e${EMULATION_NAME}.c <the_bfd = bfd_create ("linker stubs", output_bfd); - if (stub_file->the_bfd == NULL - || ! bfd_set_arch_mach (stub_file->the_bfd, - bfd_get_arch (output_bfd), - bfd_get_mach (output_bfd))) - { - einfo ("%X%P: can not create BFD %E\n"); - return; - } - - stub_sec = bfd_make_section_old_way (stub_file->the_bfd, ".text"); - /* Don't set SEC_RELOC until we actually have relocations in this - section. */ - if (stub_sec == NULL - || ! bfd_set_section_flags (stub_file->the_bfd, stub_sec, - (SEC_HAS_CONTENTS - | SEC_ALLOC - | SEC_LOAD - | SEC_CODE - | SEC_IN_MEMORY))) - { - einfo ("%X%P: can not create stub section: %E\n"); - return; - } - - ldlang_add_file (stub_file); -} - -/* Walk all the lang statements splicing out any padding statements from - the list. */ - -static void -hppaelf_delete_padding_statements (s, prev) - lang_statement_union_type *s; - lang_statement_union_type **prev; -{ - lang_statement_union_type *sprev = NULL; - for (; s != NULL; s = s->next) - { - switch (s->header.type) - { - - /* We want recursively walk these sections. */ - case lang_constructors_statement_enum: - hppaelf_delete_padding_statements (constructor_list.head, - &constructor_list.head); - break; - - case lang_output_section_statement_enum: - hppaelf_delete_padding_statements (s->output_section_statement. - children.head, - &s->output_section_statement. - children.head); - break; - - /* Huh? What is a lang_wild_statement? */ - case lang_wild_statement_enum: - hppaelf_delete_padding_statements (s->wild_statement. - children.head, - &s->wild_statement. - children.head); - break; - - /* Here's what we are really looking for. Splice these out of - the list. */ - case lang_padding_statement_enum: - if (sprev) - sprev->header.next = s->header.next; - else - **prev = *s; - break; - - /* We don't care about these cases. */ - case lang_data_statement_enum: - case lang_object_symbols_statement_enum: - case lang_output_statement_enum: - case lang_target_statement_enum: - case lang_input_section_enum: - case lang_input_statement_enum: - case lang_assignment_statement_enum: - case lang_address_statement_enum: - break; - - default: - abort (); - break; - } - sprev = s; - } -} - -/* Final emulation specific call. For the PA we use this opportunity - to build linker stubs. */ - -static void -hppaelf_finish () -{ - /* Call into the BFD backend to do the real work. */ - if (elf32_hppa_size_stubs (stub_file->the_bfd, output_bfd, &link_info) - == false) - { - einfo ("%X%P: can not size stub section: %E\n"); - return; - } - - /* If the size of the stub section is nonzero, then we need - to resize the sections, recompute the assignments, and finally - build the stubs. */ - if (bfd_section_size (stub_file->the_bfd, stub_file->the_bfd->sections) != 0) - { - /* Delete all the padding statements, they're no longer valid. */ - hppaelf_delete_padding_statements (stat_ptr->head, &stat_ptr->head); - - /* Resize the sections. */ - lang_size_sections (stat_ptr->head, abs_output_section, - &stat_ptr->head, 0, (bfd_vma) 0, false); - - /* Redo special stuff. */ - ldemul_after_allocation (); - - /* Do the assignments again. */ - lang_do_assignments (stat_ptr->head, - abs_output_section, - (fill_type) 0, (bfd_vma) 0); - - /* Now build the linker stubs. */ - if (elf32_hppa_build_stubs (stub_file->the_bfd, &link_info) == false) - { - einfo ("%X%P: can not build stubs: %E\n"); - return; - } - } -} - -/* The script itself gets inserted here. */ - -static char * -hppaelf_get_script(isfile) - int *isfile; -EOF - -if test -n "$COMPILE_IN" -then -# Scripts compiled in. - -# sed commands to quote an ld script as a C string. -sc='s/["\\]/\\&/g -s/$/\\n\\/ -1s/^/"/ -$s/$/n"/ -' - -cat >>e${EMULATION_NAME}.c <>e${EMULATION_NAME}.c <>e${EMULATION_NAME}.c <e${EMULATION_NAME}.c < - Linux support by Eric Youngdale - -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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ - -#define TARGET_IS_${EMULATION_NAME} - -#include "bfd.h" -#include "sysdep.h" -#include "bfdlink.h" - -#include "ld.h" -#include "ldmain.h" -#include "ldemul.h" -#include "ldfile.h" -#include "ldmisc.h" -#include "ldexp.h" -#include "ldlang.h" - -static void gld${EMULATION_NAME}_before_parse PARAMS ((void)); -static boolean gld${EMULATION_NAME}_open_dynamic_archive - PARAMS ((const char *, search_dirs_type *, lang_input_statement_type *)); -static void gld${EMULATION_NAME}_find_address_statement - PARAMS ((lang_statement_union_type *)); -static void gld${EMULATION_NAME}_create_output_section_statements - PARAMS ((void)); -static void gld${EMULATION_NAME}_before_allocation PARAMS ((void)); -static char *gld${EMULATION_NAME}_get_script PARAMS ((int *isfile)); - -static void -gld${EMULATION_NAME}_before_parse() -{ - ldfile_output_architecture = bfd_arch_${ARCH}; - config.dynamic_link = true; -} - -/* Try to open a dynamic archive. This is where we know that Linux - dynamic libraries have an extension of .sa. */ - -static boolean -gld${EMULATION_NAME}_open_dynamic_archive (arch, search, entry) - const char *arch; - search_dirs_type *search; - lang_input_statement_type *entry; -{ - char *string; - - if (! entry->is_archive) - return false; - - string = (char *) xmalloc (strlen (search->name) - + strlen (entry->filename) - + strlen (arch) - + sizeof "/lib.sa"); - - sprintf (string, "%s/lib%s%s.sa", search->name, entry->filename, arch); - - if (! ldfile_try_open_bfd (string, entry)) - { - free (string); - return false; - } - - entry->filename = string; - - return true; -} - -/* This is called by the create_output_section_statements routine via - lang_for_each_statement. It locates any address assignment to - .text, and modifies it to include the size of the headers. This - causes -Ttext to mean the starting address of the header, rather - than the starting address of .text, which is compatible with other - Linux tools. */ - -static void -gld${EMULATION_NAME}_find_address_statement (s) - lang_statement_union_type *s; -{ - if (s->header.type == lang_address_statement_enum - && strcmp (s->address_statement.section_name, ".text") == 0) - { - ASSERT (s->address_statement.address->type.node_class == etree_value); - s->address_statement.address->value.value += 0x20; - } -} - -/* This is called before opening the input BFD's. */ - -static void -gld${EMULATION_NAME}_create_output_section_statements () -{ - lang_for_each_statement (gld${EMULATION_NAME}_find_address_statement); -} - -/* This is called after the sections have been attached to output - sections, but before any sizes or addresses have been set. */ - -static void -gld${EMULATION_NAME}_before_allocation () -{ - if (link_info.relocateable) - return; - - /* Let the backend work out the sizes of any sections required by - dynamic linking. */ - if (! bfd_${EMULATION_NAME}_size_dynamic_sections (output_bfd, &link_info)) - einfo ("%P%F: failed to set dynamic section sizes: %E\n"); -} - -static char * -gld${EMULATION_NAME}_get_script(isfile) - int *isfile; -EOF - -if test -n "$COMPILE_IN" -then -# Scripts compiled in. - -# sed commands to quote an ld script as a C string. -sc='s/["\\]/\\&/g -s/$/\\n\\/ -1s/^/"/ -$s/$/n"/ -' - -cat >>e${EMULATION_NAME}.c <>e${EMULATION_NAME}.c <>e${EMULATION_NAME}.c <e${EMULATION_NAME}.c <name = name; - element->next = (lib_list_type *)NULL; - **list = element; - *list = &element->next; - -} - -static boolean had_hll = false; -static boolean had_hll_name = false; - -static void -lnk960_hll(name) - char *name; -{ - had_hll = true; - if (name != (char *)NULL) { - had_hll_name = true; - append(&hll_list_tail, name); - } -} - -static void -lnk960_syslib(name) - char *name; -{ - append(&syslib_list_tail,name); -} - - -#ifdef GNU960 - -static void -lnk960_before_parse() -{ - static char *env_variables[] = { "G960LIB", "G960BASE", 0 }; - char **p; - char *env ; - - for ( p = env_variables; *p; p++ ){ - env = (char *) getenv(*p); - if (env) { - ldfile_add_library_path(concat(env,"/lib/libcoff",""), false); - } - } - - env= (char *) getenv("I960BASE"); - if ( env ) { - ldfile_add_library_path(concat(env,"/lib",""), false); - } - - ldfile_output_architecture = bfd_arch_i960; - ldfile_output_machine = bfd_mach_i960_core; -} - -#else /* not GNU960 */ - -static void -lnk960_before_parse() -{ - char *name = getenv("I960BASE"); - - if (name == (char *)NULL) { - name = getenv("G960BASE"); - if (name == (char *)NULL) { - einfo("%P%F I960BASE and G960BASE not set\n"); - } - } - - - ldfile_add_library_path(concat(name,"/lib",""), false); - ldfile_output_architecture = bfd_arch_i960; - ldfile_output_machine = bfd_mach_i960_core; -} - -#endif /* GNU960 */ - - -static void -add_on(list, search) - lib_list_type *list; - lang_input_file_enum_type search; -{ - while (list) { - lang_add_input_file(list->name, - search, - (char *)NULL); - list = list->next; - } -} -static void -lnk960_after_parse() -{ - /* If there has been no arch, default to -KB */ - if (ldfile_output_machine_name[0] ==0) { - ldfile_add_arch("KB"); - } - - /* if there has been no hll list then add our own */ - - if(had_hll && !had_hll_name) { - append(&hll_list_tail,"cg"); - if (ldfile_output_machine == bfd_mach_i960_ka_sa || - ldfile_output_machine == bfd_mach_i960_ca) { - { - append(&hll_list_tail,"fpg"); - } - } - } - - add_on(hll_list, lang_input_file_is_l_enum); - add_on(syslib_list, lang_input_file_is_search_file_enum); -} - -static void -lnk960_before_allocation() -{ -} - -static void -lnk960_after_allocation() -{ - if (link_info.relocateable == false) { - lang_abs_symbol_at_end_of(".text","_etext"); - lang_abs_symbol_at_end_of(".data","_edata"); - lang_abs_symbol_at_beginning_of(".bss","_bss_start"); - lang_abs_symbol_at_end_of(".bss","_end"); - } -} - - -static struct - { - unsigned long number; - char *name; - } -machine_table[] = -{ - { bfd_mach_i960_core ,"CORE" }, - { bfd_mach_i960_kb_sb ,"KB" }, - { bfd_mach_i960_kb_sb ,"SB" }, - { bfd_mach_i960_mc ,"MC" }, - { bfd_mach_i960_xa ,"XA" }, - { bfd_mach_i960_ca ,"CA" }, - { bfd_mach_i960_ka_sa ,"KA" }, - { bfd_mach_i960_ka_sa ,"SA" }, - { bfd_mach_i960_jx ,"JX" }, - { bfd_mach_i960_hx ,"HX" }, - - { bfd_mach_i960_core ,"core" }, - { bfd_mach_i960_kb_sb ,"kb" }, - { bfd_mach_i960_kb_sb ,"sb" }, - { bfd_mach_i960_mc ,"mc" }, - { bfd_mach_i960_xa ,"xa" }, - { bfd_mach_i960_ca ,"ca" }, - { bfd_mach_i960_ka_sa ,"ka" }, - { bfd_mach_i960_ka_sa ,"sa" }, - { bfd_mach_i960_jx ,"jx" }, - { bfd_mach_i960_hx ,"hx" }, - - { 0, (char *) NULL } -}; - -static void -lnk960_set_output_arch() -{ - /* Set the output architecture and machine if possible */ - unsigned int i; - ldfile_output_machine = bfd_mach_i960_core; - for (i= 0; machine_table[i].name != (char*)NULL; i++) { - if (strcmp(ldfile_output_machine_name,machine_table[i].name)==0) { - ldfile_output_machine = machine_table[i].number; - break; - } - } - bfd_set_arch_mach(output_bfd, ldfile_output_architecture, ldfile_output_machine); -} - -static char * -lnk960_choose_target() -{ -#ifdef GNU960 - - return bfd_make_targ_name(BFD_COFF_FORMAT, 0); - -#else - - char *from_outside = getenv(TARGET_ENVIRON); - if (from_outside != (char *)NULL) - return from_outside; -#ifdef LNK960_LITTLE - return "coff-Intel-little"; -#else - return "coff-Intel-big"; -#endif -#endif - -} - -static char * -lnk960_get_script(isfile) - int *isfile; -EOF - -if test -n "$COMPILE_IN" -then -# Scripts compiled in. - -# sed commands to quote an ld script as a C string. -sc='s/["\\]/\\&/g -s/$/\\n\\/ -1s/^/"/ -$s/$/n"/ -' - -cat >>e${EMULATION_NAME}.c <>e${EMULATION_NAME}.c <>e${EMULATION_NAME}.c <e${EMULATION_NAME}.c < based on generic.em. - -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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ - -#define TARGET_IS_${EMULATION_NAME} - -#include "bfd.h" -#include "sysdep.h" -#include "bfdlink.h" - -#include "ld.h" -#include "ldmain.h" -#include "ldemul.h" -#include "ldfile.h" -#include "ldmisc.h" - -static void gld${EMULATION_NAME}_before_parse PARAMS ((void)); -static void gld${EMULATION_NAME}_after_open PARAMS ((void)); -static void check_sections PARAMS ((bfd *, asection *, PTR)); -static void gld${EMULATION_NAME}_after_allocation PARAMS ((void)); -static char *gld${EMULATION_NAME}_get_script PARAMS ((int *isfile)); - -static void -gld${EMULATION_NAME}_before_parse() -{ -#ifndef TARGET_ /* I.e., if not generic. */ - ldfile_output_architecture = bfd_arch_${ARCH}; -#endif /* not TARGET_ */ -} - -/* This function is run after all the input files have been opened. - We create a .rel.sdata section for each input file with a non zero - .sdata section. The BFD backend will fill in these sections with - magic numbers which can be used to relocate the data section at run - time. This will only do the right thing if all the input files - have been compiled using -membedded-pic. */ - -static void -gld${EMULATION_NAME}_after_open () -{ - bfd *abfd; - - if (! command_line.embedded_relocs - || link_info.relocateable) - return; - - for (abfd = link_info.input_bfds; abfd != NULL; abfd = abfd->link_next) - { - asection *datasec; - - datasec = bfd_get_section_by_name (abfd, ".sdata"); - - /* Note that we assume that the reloc_count field has already - been set up. We could call bfd_get_reloc_upper_bound, but - that returns the size of a memory buffer rather than a reloc - count. We do not want to call bfd_canonicalize_reloc, - because although it would always work it would force us to - read in the relocs into BFD canonical form, which would waste - a significant amount of time and memory. */ - if (datasec != NULL && datasec->reloc_count > 0) - { - asection *relsec; - - relsec = bfd_make_section (abfd, ".rel.sdata"); - if (relsec == NULL - || ! bfd_set_section_flags (abfd, relsec, - (SEC_ALLOC - | SEC_LOAD - | SEC_HAS_CONTENTS - | SEC_IN_MEMORY)) - || ! bfd_set_section_alignment (abfd, relsec, 2) - || ! bfd_set_section_size (abfd, relsec, - datasec->reloc_count * 4)) - einfo ("%F%B: can not create .rel.sdata section: %E\n"); - } - - /* Double check that all other data sections are empty, as is - required for embedded PIC code. */ - bfd_map_over_sections (abfd, check_sections, (PTR) datasec); - } -} - -/* Check that of the data sections, only the .sdata section has - relocs. This is called via bfd_map_over_sections. */ - -static void -check_sections (abfd, sec, sdatasec) - bfd *abfd; - asection *sec; - PTR sdatasec; -{ - if ((bfd_get_section_flags (abfd, sec) & SEC_CODE) == 0 - && sec != (asection *) sdatasec - && sec->reloc_count != 0) - einfo ("%P%X: section %s has relocs; can not use --embedded-relocs\n", - abfd, bfd_get_section_name (abfd, sec)); -} - -/* This function is called after the section sizes and offsets have - been set. If we are generating embedded relocs, it calls a special - BFD backend routine to do the work. */ - -static void -gld${EMULATION_NAME}_after_allocation () -{ - bfd *abfd; - - if (! command_line.embedded_relocs - || link_info.relocateable) - return; - - for (abfd = link_info.input_bfds; abfd != NULL; abfd = abfd->link_next) - { - asection *datasec, *relsec; - char *errmsg; - - datasec = bfd_get_section_by_name (abfd, ".sdata"); - - if (datasec == NULL || datasec->reloc_count == 0) - continue; - - relsec = bfd_get_section_by_name (abfd, ".rel.sdata"); - ASSERT (relsec != NULL); - - if (! bfd_mips_ecoff_create_embedded_relocs (abfd, &link_info, - datasec, relsec, - &errmsg)) - { - if (errmsg == NULL) - einfo ("%B%X: can not create runtime reloc information: %E\n", - abfd); - else - einfo ("%X%B: can not create runtime reloc information: %s\n", - abfd, errmsg); - } - } -} - -static char * -gld${EMULATION_NAME}_get_script(isfile) - int *isfile; -EOF - -if test -n "$COMPILE_IN" -then -# Scripts compiled in. - -# sed commands to quote an ld script as a C string. -sc="-f ${srcdir}/emultempl/stringify.sed" - -cat >>e${EMULATION_NAME}.c <> e${EMULATION_NAME}.c -echo ' ; else if (link_info.relocateable == true) return' >> e${EMULATION_NAME}.c -sed $sc ldscripts/${EMULATION_NAME}.xr >> e${EMULATION_NAME}.c -echo ' ; else if (!config.text_read_only) return' >> e${EMULATION_NAME}.c -sed $sc ldscripts/${EMULATION_NAME}.xbn >> e${EMULATION_NAME}.c -echo ' ; else if (!config.magic_demand_paged) return' >> e${EMULATION_NAME}.c -sed $sc ldscripts/${EMULATION_NAME}.xn >> e${EMULATION_NAME}.c -echo ' ; else return' >> e${EMULATION_NAME}.c -sed $sc ldscripts/${EMULATION_NAME}.x >> e${EMULATION_NAME}.c -echo '; }' >> e${EMULATION_NAME}.c - -else -# Scripts read from the filesystem. - -cat >>e${EMULATION_NAME}.c <>e${EMULATION_NAME}.c <e${EMULATION_NAME}.c < - SunOS shared library support by Ian Lance Taylor - NetBSD changes by Krister Walfridsson - -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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ - -#define TARGET_IS_${EMULATION_NAME} - -#include -#include -#include - -#include "bfd.h" -#include "sysdep.h" -#include "bfdlink.h" -#include "libiberty.h" - -#include "ld.h" -#include "ldmain.h" -#include "ldemul.h" -#include "ldfile.h" -#include "ldmisc.h" -#include "ldexp.h" -#include "ldlang.h" - -#ifdef HAVE_DIRENT_H -# include -#else -# define dirent direct -# ifdef HAVE_SYS_NDIR_H -# include -# endif -# ifdef HAVE_SYS_DIR_H -# include -# endif -# ifdef HAVE_NDIR_H -# include -# endif -#endif - -static void gld${EMULATION_NAME}_before_parse PARAMS ((void)); -static void gld${EMULATION_NAME}_set_symbols PARAMS ((void)); -static void gld${EMULATION_NAME}_create_output_section_statements - PARAMS ((void)); -static void gld${EMULATION_NAME}_find_so - PARAMS ((lang_input_statement_type *)); -static char *gld${EMULATION_NAME}_search_dir - PARAMS ((const char *, const char *, boolean *)); -static void gld${EMULATION_NAME}_after_open PARAMS ((void)); -static void gld${EMULATION_NAME}_check_needed - PARAMS ((lang_input_statement_type *)); -static boolean gld${EMULATION_NAME}_search_needed - PARAMS ((const char *, const char *)); -static boolean gld${EMULATION_NAME}_try_needed - PARAMS ((const char *, const char *)); -static void gld${EMULATION_NAME}_before_allocation PARAMS ((void)); -static void gld${EMULATION_NAME}_find_assignment - PARAMS ((lang_statement_union_type *)); -static void gld${EMULATION_NAME}_find_exp_assignment PARAMS ((etree_type *)); -static void gld${EMULATION_NAME}_count_need - PARAMS ((lang_input_statement_type *)); -static void gld${EMULATION_NAME}_set_need - PARAMS ((lang_input_statement_type *)); -static char *gld${EMULATION_NAME}_get_script PARAMS ((int *isfile)); - -static void -gld${EMULATION_NAME}_before_parse() -{ - ldfile_output_architecture = bfd_arch_${ARCH}; - config.dynamic_link = true; -} - -/* This is called after the command line arguments have been parsed, - but before the linker script has been read. If this is a native - linker, we add the directories in LD_LIBRARY_PATH to the search - list. */ - -static void -gld${EMULATION_NAME}_set_symbols () -{ -EOF -if [ "x${host}" = "x${target}" ] ; then - if [ "x${DEFAULT_EMULATION}" = "x${EMULATION_NAME}" ] ; then -cat >>e${EMULATION_NAME}.c <>e${EMULATION_NAME}.c <search_dirs_flag - || ! inp->is_archive - || ! inp->dynamic) - return; - - ASSERT (strncmp (inp->local_sym_name, "-l", 2) == 0); - - for (search = search_head; search != NULL; search = search->next) - { - boolean found_static; - - found = gld${EMULATION_NAME}_search_dir (search->name, inp->filename, - &found_static); - if (found != NULL || found_static) - break; - } - - if (found == NULL) - { - /* We did not find a matching .so file. This isn't an error, - since there might still be a matching .a file, which will be - found by the usual search. */ - return; - } - - /* Replace the filename with the one we have found. */ - alc = (char *) xmalloc (strlen (search->name) + strlen (found) + 2); - sprintf (alc, "%s/%s", search->name, found); - inp->filename = alc; - - /* We are only interested in the symbols. */ - inp->just_syms_flag = true; - - /* Turn off the search_dirs_flag to prevent ldfile_open_file from - searching for this file again. */ - inp->search_dirs_flag = false; - - free (found); -} - -/* Search a directory for a .so file. */ - -static char * -gld${EMULATION_NAME}_search_dir (dirname, filename, found_static) - const char *dirname; - const char *filename; - boolean *found_static; -{ - int force_maj, force_min; - const char *dot; - unsigned int len; - char *alc; - char *found; - int max_maj, max_min; - DIR *dir; - struct dirent *entry; - - *found_static = false; - - force_maj = -1; - force_min = -1; - dot = strchr (filename, '.'); - if (dot == NULL) - { - len = strlen (filename); - alc = NULL; - } - else - { - force_maj = atoi (dot + 1); - - len = dot - filename; - alc = (char *) xmalloc (len + 1); - strncpy (alc, filename, len); - alc[len] = '\0'; - filename = alc; - - dot = strchr (dot + 1, '.'); - if (dot != NULL) - force_min = atoi (dot + 1); - } - - found = NULL; - max_maj = max_min = 0; - - dir = opendir (dirname); - if (dir == NULL) - return NULL; - - while ((entry = readdir (dir)) != NULL) - { - const char *s; - int found_maj, found_min; - - if (strncmp (entry->d_name, "lib", 3) != 0 - || strncmp (entry->d_name + 3, filename, len) != 0) - continue; - - if (dot == NULL - && strcmp (entry->d_name + 3 + len, ".a") == 0) - { - *found_static = true; - continue; - } - - /* We accept libfoo.so without a version number, even though the - native linker does not. This is more convenient for packages - which just generate .so files for shared libraries, as on ELF - systems. */ - if (strncmp (entry->d_name + 3 + len, ".so", 3) != 0) - continue; - if (entry->d_name[6 + len] == '\0') - ; - else if (entry->d_name[6 + len] == '.' - && isdigit (entry->d_name[7 + len])) - ; - else - continue; - - for (s = entry->d_name + 6 + len; *s != '\0'; s++) - if (*s != '.' && ! isdigit (*s)) - break; - if (*s != '\0') - continue; - - /* We've found a .so file. Work out the major and minor - version numbers. */ - found_maj = 0; - found_min = 0; - sscanf (entry->d_name + 3 + len, ".so.%d.%d", - &found_maj, &found_min); - - if ((force_maj != -1 && force_maj != found_maj) - || (force_min != -1 && force_min != found_min)) - continue; - - /* We've found a match for the name we are searching for. See - if this is the version we should use. If the major and minor - versions match, we use the last entry in alphabetical order. */ - if (found == NULL - || (found_maj > max_maj) - || (found_maj == max_maj - && (found_min > max_min - || (found_min == max_min - && strcmp (entry->d_name, found) > 0)))) - { - if (found != NULL) - free (found); - found = (char *) xmalloc (strlen (entry->d_name) + 1); - strcpy (found, entry->d_name); - max_maj = found_maj; - max_min = found_min; - } - } - - closedir (dir); - - if (alc != NULL) - free (alc); - - return found; -} - -/* These variables are required to pass information back and forth - between after_open and check_needed. */ - -static struct bfd_link_needed_list *global_needed; -static boolean global_found; - -/* This is called after all the input files have been opened. */ - -static void -gld${EMULATION_NAME}_after_open () -{ - struct bfd_link_needed_list *needed, *l; - - /* We only need to worry about this when doing a final link. */ - if (link_info.relocateable || link_info.shared) - return; - - /* Get the list of files which appear in ld_need entries in dynamic - objects included in the link. For each such file, we want to - track down the corresponding library, and include the symbol - table in the link. This is what the runtime dynamic linker will - do. Tracking the files down here permits one dynamic object to - include another without requiring special action by the person - doing the link. Note that the needed list can actually grow - while we are stepping through this loop. */ - needed = bfd_netbsd_get_needed_list (output_bfd, &link_info); - for (l = needed; l != NULL; l = l->next) - { - struct bfd_link_needed_list *ll; - const char *lname; - search_dirs_type *search; - - lname = l->name; - - /* If we've already seen this file, skip it. */ - for (ll = needed; ll != l; ll = ll->next) - if (strcmp (ll->name, lname) == 0) - break; - if (ll != l) - continue; - - /* See if this file was included in the link explicitly. */ - global_needed = l; - global_found = false; - lang_for_each_input_file (gld${EMULATION_NAME}_check_needed); - if (global_found) - continue; - - if (strncmp (lname, "-l", 2) != 0) - { - bfd *abfd; - - abfd = bfd_openr (lname, bfd_get_target (output_bfd)); - if (abfd != NULL) - { - if (! bfd_check_format (abfd, bfd_object)) - { - (void) bfd_close (abfd); - abfd = NULL; - } - } - if (abfd != NULL) - { - if ((bfd_get_file_flags (abfd) & DYNAMIC) == 0) - { - (void) bfd_close (abfd); - abfd = NULL; - } - } - if (abfd != NULL) - { - /* We've found the needed dynamic object. */ - if (! bfd_link_add_symbols (abfd, &link_info)) - einfo ("%F%B: could not read symbols: %E\n", abfd); - } - else - { - einfo ("%P: warning: %s, needed by %B, not found\n", - lname, l->by); - } - - continue; - } - - lname += 2; - - /* We want to search for the file in the same way that the - dynamic linker will search. That means that we want to use - rpath_link, rpath or -L, then the environment variable - LD_LIBRARY_PATH (native only), then (if rpath was used) the - linker script LIB_SEARCH_DIRS. */ - if (gld${EMULATION_NAME}_search_needed (command_line.rpath_link, - lname)) - continue; - if (command_line.rpath != NULL) - { - if (gld${EMULATION_NAME}_search_needed (command_line.rpath, lname)) - continue; - } - else - { - for (search = search_head; search != NULL; search = search->next) - if (gld${EMULATION_NAME}_try_needed (search->name, lname)) - break; - if (search != NULL) - continue; - } -EOF -if [ "x${host}" = "x${target}" ] ; then - if [ "x${DEFAULT_EMULATION}" = "x${EMULATION_NAME}" ] ; then -cat >>e${EMULATION_NAME}.c <>e${EMULATION_NAME}.c <next) - { - if (search->cmdline) - continue; - if (gld${EMULATION_NAME}_try_needed (search->name, lname)) - break; - } - if (search != NULL) - continue; - } - - einfo ("%P: warning: %s, needed by %B, not found\n", - l->name, l->by); - } -} - -/* Search for a needed file in a path. */ - -static boolean -gld${EMULATION_NAME}_search_needed (path, name) - const char *path; - const char *name; -{ - const char *s; - - if (path == NULL || *path == '\0') - return false; - while (1) - { - const char *dir; - char *dircopy; - - s = strchr (path, ':'); - if (s == NULL) - { - dircopy = NULL; - dir = path; - } - else - { - dircopy = (char *) xmalloc (s - path + 1); - memcpy (dircopy, path, s - path); - dircopy[s - path] = '\0'; - dir = dircopy; - } - - if (gld${EMULATION_NAME}_try_needed (dir, name)) - return true; - - if (dircopy != NULL) - free (dircopy); - - if (s == NULL) - break; - path = s + 1; - } - - return false; -} - -/* This function is called for each possible directory for a needed - dynamic object. */ - -static boolean -gld${EMULATION_NAME}_try_needed (dir, name) - const char *dir; - const char *name; -{ - char *file; - char *alc; - boolean ignore; - bfd *abfd; - - file = gld${EMULATION_NAME}_search_dir (dir, name, &ignore); - if (file == NULL) - return false; - - alc = (char *) xmalloc (strlen (dir) + strlen (file) + 2); - sprintf (alc, "%s/%s", dir, file); - free (file); - abfd = bfd_openr (alc, bfd_get_target (output_bfd)); - if (abfd == NULL) - return false; - if (! bfd_check_format (abfd, bfd_object)) - { - (void) bfd_close (abfd); - return false; - } - if ((bfd_get_file_flags (abfd) & DYNAMIC) == 0) - { - (void) bfd_close (abfd); - return false; - } - - /* We've found the needed dynamic object. */ - - /* Add this file into the symbol table. */ - if (! bfd_link_add_symbols (abfd, &link_info)) - einfo ("%F%B: could not read symbols: %E\n", abfd); - - return true; -} - -/* See if we have already included a needed object in the link. This - does not have to be precise, as it does no harm to include a - dynamic object more than once. */ - -static void -gld${EMULATION_NAME}_check_needed (s) - lang_input_statement_type *s; -{ - if (s->filename == NULL) - return; - if (strncmp (global_needed->name, "-l", 2) != 0) - { - if (strcmp (s->filename, global_needed->name) == 0) - global_found = true; - } - else - { - const char *sname, *lname; - const char *sdot, *ldot; - int lmaj, lmin, smaj, smin; - - lname = global_needed->name + 2; - - sname = strrchr (s->filename, '/'); - if (sname == NULL) - sname = s->filename; - else - ++sname; - - if (strncmp (sname, "lib", 3) != 0) - return; - sname += 3; - - ldot = strchr (lname, '.'); - if (ldot == NULL) - ldot = lname + strlen (lname); - - sdot = strstr (sname, ".so."); - if (sdot == NULL) - return; - - if (sdot - sname != ldot - lname - || strncmp (lname, sname, sdot - sname) != 0) - return; - - lmaj = lmin = -1; - sscanf (ldot, ".%d.%d", &lmaj, &lmin); - smaj = smin = -1; - sscanf (sdot, ".so.%d.%d", &smaj, &smin); - if ((smaj != lmaj && smaj != -1 && lmaj != -1) - || (smin != lmin && smin != -1 && lmin != -1)) - return; - - global_found = true; - } -} - -/* We need to use static variables to pass information around the call - to lang_for_each_statement. Ick. */ - -static const char *find_assign; -static boolean found_assign; - -/* We need to use static variables to pass information around the call - to lang_for_each_input_file. Ick. */ - -static bfd_size_type need_size; -static bfd_size_type need_entries; -static bfd_byte *need_contents; -static bfd_byte *need_pinfo; -static bfd_byte *need_pnames; - -/* The size of one entry in the .need section, not including the file - name. */ - -#define NEED_ENTRY_SIZE (16) - -/* This is called after the sections have been attached to output - sections, but before any sizes or addresses have been set. */ - -static void -gld${EMULATION_NAME}_before_allocation () -{ - struct bfd_link_hash_entry *hdyn = NULL; - asection *sneed; - asection *srules; - asection *sdyn; - - if (link_info.shared) - { - lang_output_section_statement_type *os; - - /* Set the .text section to start at 0x20, not 0x2020. FIXME: - This is too magical. */ - os = lang_output_section_statement_lookup (".text"); - if (os->addr_tree == NULL) - os->addr_tree = exp_intop (0x20); - } - - /* We need to create a __DYNAMIC symbol. We don't do this in the - linker script because we want to set the value to the start of - the dynamic section if there is one, or to zero if there isn't - one. We need to create the symbol before calling - size_dynamic_sections, although we can't set the value until - afterward. */ - if (! link_info.relocateable) - { - hdyn = bfd_link_hash_lookup (link_info.hash, "__DYNAMIC", true, false, - false); - if (hdyn == NULL) - einfo ("%P%F: bfd_link_hash_lookup: %E\n"); - if (! bfd_netbsd_record_link_assignment (output_bfd, &link_info, - "__DYNAMIC")) - einfo ("%P%F: failed to record assignment to __DYNAMIC: %E\n"); - } - - /* If we are going to make any variable assignments, we need to let - the backend linker know about them in case the variables are - referred to by dynamic objects. */ - lang_for_each_statement (gld${EMULATION_NAME}_find_assignment); - - /* Let the backend linker work out the sizes of any sections - required by dynamic linking. */ - if (! bfd_netbsd_size_dynamic_sections (output_bfd, &link_info, &sdyn, - &sneed, &srules)) - einfo ("%P%F: failed to set dynamic section sizes: %E\n"); - - if (sneed != NULL) - { - /* Set up the .need section. See the description of the ld_need - field in include/aout/sun4.h. */ - - need_entries = 0; - need_size = 0; - - lang_for_each_input_file (gld${EMULATION_NAME}_count_need); - - /* We should only have a .need section if we have at least one - dynamic object. */ - ASSERT (need_entries != 0); - - sneed->_raw_size = need_size; - sneed->contents = (bfd_byte *) xmalloc (need_size); - - need_contents = sneed->contents; - need_pinfo = sneed->contents; - need_pnames = sneed->contents + need_entries * 16; - - lang_for_each_input_file (gld${EMULATION_NAME}_set_need); - - ASSERT ((bfd_size_type) (need_pnames - sneed->contents) == need_size); - } - - if (srules != NULL) - { - /* Set up the .rules section. This is just a PATH like string - of the -L arguments given on the command line. We permit the - user to specify the directories using the -rpath command line - option. */ - if (command_line.rpath) - { - srules->_raw_size = strlen (command_line.rpath); - srules->contents = (bfd_byte *) command_line.rpath; - } - else - { - unsigned int size; - search_dirs_type *search; - - size = 0; - for (search = search_head; search != NULL; search = search->next) - if (search->cmdline) - size += strlen (search->name) + 1; - srules->_raw_size = size; - if (size > 0) - { - char *p; - - srules->contents = (bfd_byte *) xmalloc (size); - p = (char *) srules->contents; - *p = '\0'; - for (search = search_head; search != NULL; search = search->next) - { - if (search->cmdline) - { - if (p != (char *) srules->contents) - *p++ = ':'; - strcpy (p, search->name); - p += strlen (p); - } - } - } - } - } - - /* We must assign a value to __DYNAMIC. It should be zero if we are - not doing a dynamic link, or the start of the .dynamic section if - we are doing one. */ - if (! link_info.relocateable) - { - hdyn->type = bfd_link_hash_defined; - hdyn->u.def.value = 0; - if (sdyn != NULL) - hdyn->u.def.section = sdyn; - else - hdyn->u.def.section = bfd_abs_section_ptr; - } -} - -/* This is called by the before_allocation routine via - lang_for_each_statement. It does one of two things: if the - variable find_assign is set, it sets found_assign if it finds an - assignment to that variable; otherwise it tells the backend linker - about all assignment statements, in case they are assignments to - symbols which are referred to by dynamic objects. */ - -static void -gld${EMULATION_NAME}_find_assignment (s) - lang_statement_union_type *s; -{ - if (s->header.type == lang_assignment_statement_enum - && (find_assign == NULL || ! found_assign)) - gld${EMULATION_NAME}_find_exp_assignment (s->assignment_statement.exp); -} - -/* Look through an expression for an assignment statement. */ - -static void -gld${EMULATION_NAME}_find_exp_assignment (exp) - etree_type *exp; -{ - switch (exp->type.node_class) - { - case etree_assign: - if (find_assign != NULL) - { - if (strcmp (find_assign, exp->assign.dst) == 0) - found_assign = true; - return; - } - - if (strcmp (exp->assign.dst, ".") != 0) - { - if (! bfd_netbsd_record_link_assignment (output_bfd, &link_info, - exp->assign.dst)) - einfo ("%P%F: failed to record assignment to %s: %E\n", - exp->assign.dst); - } - gld${EMULATION_NAME}_find_exp_assignment (exp->assign.src); - break; - - case etree_binary: - gld${EMULATION_NAME}_find_exp_assignment (exp->binary.lhs); - gld${EMULATION_NAME}_find_exp_assignment (exp->binary.rhs); - break; - - case etree_trinary: - gld${EMULATION_NAME}_find_exp_assignment (exp->trinary.cond); - gld${EMULATION_NAME}_find_exp_assignment (exp->trinary.lhs); - gld${EMULATION_NAME}_find_exp_assignment (exp->trinary.rhs); - break; - - case etree_unary: - gld${EMULATION_NAME}_find_exp_assignment (exp->unary.child); - break; - - default: - break; - } -} - -/* Work out the size of the .need section, and the number of entries. - The backend will set the ld_need field of the dynamic linking - information to point to the .need section. See include/aout/sun4.h - for more information. */ - -static void -gld${EMULATION_NAME}_count_need (inp) - lang_input_statement_type *inp; -{ - if (inp->the_bfd != NULL - && (inp->the_bfd->flags & DYNAMIC) != 0) - { - ++need_entries; - need_size += NEED_ENTRY_SIZE; - if (! inp->is_archive) - need_size += strlen (inp->filename) + 1; - else - { - ASSERT (inp->local_sym_name[0] == '-' - && inp->local_sym_name[1] == 'l'); - need_size += strlen (inp->local_sym_name + 2) + 1; - } - } -} - -/* Fill in the contents of the .need section. */ - -static void -gld${EMULATION_NAME}_set_need (inp) - lang_input_statement_type *inp; -{ - if (inp->the_bfd != NULL - && (inp->the_bfd->flags & DYNAMIC) != 0) - { - bfd_size_type c; - - /* To really fill in the .need section contents, we need to know - the final file position of the section, but we don't. - Instead, we use offsets, and rely on the BFD backend to - finish the section up correctly. FIXME: Talk about lack of - referential locality. */ - bfd_put_32 (output_bfd, need_pnames - need_contents, need_pinfo); - if (! inp->is_archive) - { - bfd_put_32 (output_bfd, (bfd_vma) 0, need_pinfo + 4); - bfd_put_16 (output_bfd, (bfd_vma) 0, need_pinfo + 8); - bfd_put_16 (output_bfd, (bfd_vma) 0, need_pinfo + 10); - strcpy (need_pnames, inp->filename); - } - else - { - char *verstr; - int maj, min; - - if (bfd_big_endian(output_bfd)) - bfd_put_32 (output_bfd, (bfd_vma) 0x80000000, need_pinfo + 4); - else - bfd_put_32 (output_bfd, (bfd_vma) 0x00000001, need_pinfo + 4); - maj = 0; - min = 0; - verstr = strstr (inp->filename, ".so."); - if (verstr != NULL) - sscanf (verstr, ".so.%d.%d", &maj, &min); - bfd_put_16 (output_bfd, (bfd_vma) maj, need_pinfo + 8); - bfd_put_16 (output_bfd, (bfd_vma) min, need_pinfo + 10); - strcpy (need_pnames, inp->local_sym_name + 2); - } - - c = (need_pinfo - need_contents) / NEED_ENTRY_SIZE; - if (c + 1 >= need_entries) - bfd_put_32 (output_bfd, (bfd_vma) 0, need_pinfo + 12); - else - bfd_put_32 (output_bfd, (bfd_vma) (c + 1) * NEED_ENTRY_SIZE, - need_pinfo + 12); - - need_pinfo += NEED_ENTRY_SIZE; - need_pnames += strlen (need_pnames) + 1; - } -} - -static char * -gld${EMULATION_NAME}_get_script(isfile) - int *isfile; -EOF - -if test -n "$COMPILE_IN" -then -# Scripts compiled in. - -# sed commands to quote an ld script as a C string. -sc='s/["\\]/\\&/g -s/$/\\n\\/ -1s/^/"/ -$s/$/n"/ -' - -cat >>e${EMULATION_NAME}.c <>e${EMULATION_NAME}.c <>e${EMULATION_NAME}.c <e${EMULATION_NAME}.c <children); - - for (j = 0; init[j].ptr; j++) - { - long val = init[j].value; - lang_add_assignment (exp_assop ('=' ,init[j].symbol, exp_intop (val))); - if (init[j].size == sizeof(short)) - *(short *)init[j].ptr = val; - else if (init[j].size == sizeof(int)) - *(int *)init[j].ptr = val; - else if (init[j].size == sizeof(long)) - *(long *)init[j].ptr = val; - /* This might be a long long or other special type. */ - else if (init[j].size == sizeof(bfd_vma)) - *(bfd_vma *)init[j].ptr = val; - else abort(); - } - /* Restore the pointer. */ - stat_ptr = save; - - if (pe.FileAlignment > - pe.SectionAlignment) - { - einfo ("%P: warning, file alignment > section alignment.\n"); - } -} - -static void -gld_${EMULATION_NAME}_after_open() -{ - /* Pass the wacky PE command line options into the output bfd. - FIXME: This should be done via a function, rather than by - including an internal BFD header. */ - if (!coff_data(output_bfd)->pe) - { - einfo ("%F%P: PE operations on non PE file.\n"); - } - - pe_data(output_bfd)->pe_opthdr = pe; - pe_data(output_bfd)->dll = init[DLLOFF].value; - -} - -/* Callback functions for qsort in sort_sections. */ - -static int -sort_by_file_name (a, b) - void *a; - void *b; -{ - lang_statement_union_type **ra = a; - lang_statement_union_type **rb = b; - int i; - - i = strcmp ((*ra)->input_section.ifile->the_bfd->my_archive->filename, - (*rb)->input_section.ifile->the_bfd->my_archive->filename); - if (i != 0) - return i; - - return strcmp ((*ra)->input_section.ifile->filename, - (*rb)->input_section.ifile->filename); -} - -static int -sort_by_section_name (a, b) - void *a; - void *b; -{ - lang_statement_union_type **ra = a; - lang_statement_union_type **rb = b; - return strcmp ((*ra)->input_section.section->name, - (*rb)->input_section.section->name); -} - -/* Subroutine of sort_sections to a contiguous subset of a list of sections. - NEXT_AFTER is the element after the last one to sort. - The result is a pointer to the last element's "next" pointer. */ - -static lang_statement_union_type ** -sort_sections_1 (startptr, next_after, count, sort_func) - lang_statement_union_type **startptr,*next_after; - int count; - int (*sort_func) (); -{ - lang_statement_union_type **vec; - lang_statement_union_type *p; - int i; - lang_statement_union_type **ret; - - if (count == 0) - return startptr; - - vec = ((lang_statement_union_type **) - xmalloc (count * sizeof (lang_statement_union_type *))); - - for (p = *startptr, i = 0; i < count; i++, p = p->next) - vec[i] = p; - - qsort (vec, count, sizeof (vec[0]), sort_func); - - /* Fill in the next pointers again. */ - *startptr = vec[0]; - for (i = 0; i < count - 1; i++) - vec[i]->header.next = vec[i + 1]; - vec[i]->header.next = next_after; - ret = &vec[i]->header.next; - free (vec); - return ret; -} - -/* Sort the .idata\$foo input sections of archives into filename order. - The reason is so dlltool can arrange to have the pe dll import information - generated correctly - the head of the list goes into dh.o, the tail into - dt.o, and the guts into ds[nnnn].o. Note that this is only needed for the - .idata section. - FIXME: This may no longer be necessary with grouped sections. Instead of - sorting on dh.o, ds[nnnn].o, dt.o, one could, for example, have dh.o use - .idata\$4h, have ds[nnnn].o use .idata\$4s[nnnn], and have dt.o use .idata\$4t. - This would have to be elaborated upon to handle multiple dll's - [assuming such an eloboration is possible of course]. - - We also sort sections in '\$' wild statements. These are created by the - place_orphans routine to implement grouped sections. */ - -static void -sort_sections (s) - lang_statement_union_type *s; -{ - for (; s ; s = s->next) - switch (s->header.type) - { - case lang_output_section_statement_enum: - sort_sections (s->output_section_statement.children.head); - break; - case lang_wild_statement_enum: - { - lang_statement_union_type **p = &s->wild_statement.children.head; - - /* Is this the .idata section? */ - if (s->wild_statement.section_name != NULL - && strncmp (s->wild_statement.section_name, ".idata", 6) == 0) - { - /* Sort the children. We want to sort any objects in - the same archive. In order to handle the case of - including a single archive multiple times, we sort - all the children by archive name and then by object - name. After sorting them, we re-thread the pointer - chain. */ - - while (*p) - { - lang_statement_union_type *start = *p; - if (start->header.type != lang_input_section_enum - || !start->input_section.ifile->the_bfd->my_archive) - p = &(start->header.next); - else - { - lang_statement_union_type *end; - int count; - - for (end = start, count = 0; - end && end->header.type == lang_input_section_enum; - end = end->next) - count++; - - p = sort_sections_1 (p, end, count, sort_by_file_name); - } - } - break; - } - - /* If this is a collection of grouped sections, sort them. - The linker script must explicitly mention "*(.foo\$)" or - "*(.foo\$*)". Don't sort them if \$ is not the last - character (not sure if this is really useful, but it - allows explicitly mentioning some \$ sections and letting - the linker handle the rest). */ - if (s->wild_statement.section_name != NULL) - { - char *q = strchr (s->wild_statement.section_name, '\$'); - - if (q != NULL - && (q[1] == '\0' - || (q[1] == '*' && q[2] == '\0'))) - { - lang_statement_union_type *end; - int count; - - for (end = *p, count = 0; end; end = end->next) - { - if (end->header.type != lang_input_section_enum) - abort (); - count++; - } - (void) sort_sections_1 (p, end, count, sort_by_section_name); - } - break; - } - } - break; - default: - break; - } -} - -static void -gld_${EMULATION_NAME}_before_allocation() -{ - extern lang_statement_list_type *stat_ptr; - -#ifdef TARGET_IS_ppcpe - /* Here we rummage through the found bfds to collect toc information */ - { - LANG_FOR_EACH_INPUT_STATEMENT (is) - { - if (!ppc_process_before_allocation(is->the_bfd, &link_info)) - { - einfo("Errors encountered processing file %s\n", is->filename); - } - } - } - - /* We have seen it all. Allocate it, and carry on */ - ppc_allocate_toc_section (&link_info); -#else -#ifdef TARGET_IS_armpe - /* FIXME: we should be able to set the size of the interworking stub - section. - - Here we rummage through the found bfds to collect glue - information. FIXME: should this be based on a command line - option? krk@cygnus.com */ - { - LANG_FOR_EACH_INPUT_STATEMENT (is) - { - if (!arm_process_before_allocation (is->the_bfd, & link_info)) - { - einfo ("Errors encountered processing file %s", is->filename); - } - } - } - - /* We have seen it all. Allocate it, and carry on */ - arm_allocate_interworking_sections (& link_info); -#endif /* TARGET_IS_armpe */ -#endif /* TARGET_IS_ppcpe */ - - sort_sections (stat_ptr->head); -} - -/* Place an orphan section. We use this to put sections with a '\$' in them - into the right place. Any section with a '\$' in them (e.g. .text\$foo) - gets mapped to the output section with everything from the '\$' on stripped - (e.g. .text). - See the Microsoft Portable Executable and Common Object File Format - Specification 4.1, section 4.2, Grouped Sections. - - FIXME: This is now handled by the linker script using wildcards, - but I'm leaving this here in case we want to enable it for sections - which are not mentioned in the linker script. */ - -/*ARGSUSED*/ -static boolean -gld${EMULATION_NAME}_place_orphan (file, s) - lang_input_statement_type *file; - asection *s; -{ - const char *secname; - char *output_secname, *ps; - lang_output_section_statement_type *os; - lang_statement_union_type *l; - - if ((s->flags & SEC_ALLOC) == 0) - return false; - - /* Don't process grouped sections unless doing a final link. - If they're marked as COMDAT sections, we don't want .text\$foo to - end up in .text and then have .text disappear because it's marked - link-once-discard. */ - if (link_info.relocateable) - return false; - - secname = bfd_get_section_name (s->owner, s); - - /* Everything from the '\$' on gets deleted so don't allow '\$' as the - first character. */ - if (*secname == '\$') - einfo ("%P%F: section %s has '\$' as first character\n", secname); - if (strchr (secname + 1, '\$') == NULL) - return false; - - /* Look up the output section. The Microsoft specs say sections names in - image files never contain a '\$'. Fortunately, lang_..._lookup creates - the section if it doesn't exist. */ - output_secname = buystring (secname); - ps = strchr (output_secname + 1, '\$'); - *ps = 0; - os = lang_output_section_statement_lookup (output_secname); - - /* Find the '\$' wild statement for this section. We currently require the - linker script to explicitly mention "*(.foo\$)". - FIXME: ppcpe.sc has .CRT\$foo in the .rdata section. According to the - Microsoft docs this isn't correct so it's not (currently) handled. */ - - ps[0] = '\$'; - ps[1] = 0; - for (l = os->children.head; l; l = l->next) - { - if (l->header.type == lang_wild_statement_enum - && strcmp (l->wild_statement.section_name, output_secname) == 0) - break; - } - ps[0] = 0; - if (l == NULL) -#if 1 - einfo ("%P%F: *(%s\$) missing from linker script\n", output_secname); -#else /* FIXME: This block is untried. It exists to convey the intent, - should one decide to not require *(.foo\$) to appear in the linker - script. */ - { - lang_wild_statement_type *new = new_stat (lang_wild_statement, - &os->children); - new->section_name = xmalloc (strlen (output_secname) + 2); - sprintf (new->section_name, "%s\$", output_secname); - new->filename = NULL; - lang_list_init (&new->children); - l = new; - } -#endif - - /* Link the input section in and we're done for now. - The sections still have to be sorted, but that has to wait until - all such sections have been processed by us. The sorting is done by - sort_sections. */ - wild_doit (&l->wild_statement.children, s, os, file); - - return true; -} - -static char * -gld_${EMULATION_NAME}_get_script(isfile) - int *isfile; -EOF -# Scripts compiled in. -# sed commands to quote an ld script as a C string. -sc="-f ${srcdir}/emultempl/stringify.sed" - -cat >>e${EMULATION_NAME}.c <> e${EMULATION_NAME}.c -echo ' ; else if (link_info.relocateable == true) return' >> e${EMULATION_NAME}.c -sed $sc ldscripts/${EMULATION_NAME}.xr >> e${EMULATION_NAME}.c -echo ' ; else if (!config.text_read_only) return' >> e${EMULATION_NAME}.c -sed $sc ldscripts/${EMULATION_NAME}.xbn >> e${EMULATION_NAME}.c -echo ' ; else if (!config.magic_demand_paged) return' >> e${EMULATION_NAME}.c -sed $sc ldscripts/${EMULATION_NAME}.xn >> e${EMULATION_NAME}.c -echo ' ; else return' >> e${EMULATION_NAME}.c -sed $sc ldscripts/${EMULATION_NAME}.x >> e${EMULATION_NAME}.c -echo '; }' >> e${EMULATION_NAME}.c - -cat >>e${EMULATION_NAME}.c <e${EMULATION_NAME}.c < - SunOS shared library support by Ian Lance Taylor - -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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ - -#define TARGET_IS_${EMULATION_NAME} - -#include - -#include "bfd.h" -#include "sysdep.h" -#include "bfdlink.h" -#include "libiberty.h" - -#include "ld.h" -#include "ldmain.h" -#include "ldemul.h" -#include "ldfile.h" -#include "ldmisc.h" -#include "ldexp.h" -#include "ldlang.h" - -#ifdef HAVE_DIRENT_H -# include -#else -# define dirent direct -# ifdef HAVE_SYS_NDIR_H -# include -# endif -# ifdef HAVE_SYS_DIR_H -# include -# endif -# ifdef HAVE_NDIR_H -# include -# endif -#endif - -static void gld${EMULATION_NAME}_before_parse PARAMS ((void)); -static void gld${EMULATION_NAME}_set_symbols PARAMS ((void)); -static void gld${EMULATION_NAME}_create_output_section_statements - PARAMS ((void)); -static void gld${EMULATION_NAME}_find_so - PARAMS ((lang_input_statement_type *)); -static char *gld${EMULATION_NAME}_search_dir - PARAMS ((const char *, const char *, boolean *)); -static void gld${EMULATION_NAME}_after_open PARAMS ((void)); -static void gld${EMULATION_NAME}_check_needed - PARAMS ((lang_input_statement_type *)); -static boolean gld${EMULATION_NAME}_search_needed - PARAMS ((const char *, const char *)); -static boolean gld${EMULATION_NAME}_try_needed - PARAMS ((const char *, const char *)); -static void gld${EMULATION_NAME}_before_allocation PARAMS ((void)); -static void gld${EMULATION_NAME}_find_assignment - PARAMS ((lang_statement_union_type *)); -static void gld${EMULATION_NAME}_find_exp_assignment PARAMS ((etree_type *)); -static void gld${EMULATION_NAME}_count_need - PARAMS ((lang_input_statement_type *)); -static void gld${EMULATION_NAME}_set_need - PARAMS ((lang_input_statement_type *)); -static char *gld${EMULATION_NAME}_get_script PARAMS ((int *isfile)); - -static void -gld${EMULATION_NAME}_before_parse() -{ - ldfile_output_architecture = bfd_arch_${ARCH}; - config.dynamic_link = true; -} - -/* This is called after the command line arguments have been parsed, - but before the linker script has been read. If this is a native - linker, we add the directories in LD_LIBRARY_PATH to the search - list. */ - -static void -gld${EMULATION_NAME}_set_symbols () -{ -EOF -if [ "x${host}" = "x${target}" ] ; then - if [ "x${DEFAULT_EMULATION}" = "x${EMULATION_NAME}" ] ; then -cat >>e${EMULATION_NAME}.c <>e${EMULATION_NAME}.c <search_dirs_flag - || ! inp->is_archive - || ! inp->dynamic) - return; - - ASSERT (strncmp (inp->local_sym_name, "-l", 2) == 0); - - for (search = search_head; search != NULL; search = search->next) - { - boolean found_static; - - found = gld${EMULATION_NAME}_search_dir (search->name, inp->filename, - &found_static); - if (found != NULL || found_static) - break; - } - - if (found == NULL) - { - /* We did not find a matching .so file. This isn't an error, - since there might still be a matching .a file, which will be - found by the usual search. */ - return; - } - - /* Replace the filename with the one we have found. */ - alc = (char *) xmalloc (strlen (search->name) + strlen (found) + 2); - sprintf (alc, "%s/%s", search->name, found); - inp->filename = alc; - - /* Turn off the search_dirs_flag to prevent ldfile_open_file from - searching for this file again. */ - inp->search_dirs_flag = false; - - free (found); - - /* Now look for the same file name, but with .sa instead of .so. If - found, add it to the list of input files. */ - alc = (char *) xmalloc (strlen (inp->filename) + 1); - strcpy (alc, inp->filename); - strstr (alc + strlen (search->name), ".so")[2] = 'a'; - if (stat (alc, &st) != 0) - free (alc); - else - { - lang_input_statement_type *sa; - - /* Add the .sa file to the statement list just before the .so - file. This is really a hack. */ - sa = ((lang_input_statement_type *) - xmalloc (sizeof (lang_input_statement_type))); - *sa = *inp; - - inp->filename = alc; - inp->local_sym_name = alc; - - inp->header.next = (lang_statement_union_type *) sa; - inp->next_real_file = (lang_statement_union_type *) sa; - } -} - -/* Search a directory for a .so file. */ - -static char * -gld${EMULATION_NAME}_search_dir (dirname, filename, found_static) - const char *dirname; - const char *filename; - boolean *found_static; -{ - int force_maj, force_min; - const char *dot; - unsigned int len; - char *alc; - char *found; - int max_maj, max_min; - DIR *dir; - struct dirent *entry; - - *found_static = false; - - force_maj = -1; - force_min = -1; - dot = strchr (filename, '.'); - if (dot == NULL) - { - len = strlen (filename); - alc = NULL; - } - else - { - force_maj = atoi (dot + 1); - - len = dot - filename; - alc = (char *) xmalloc (len + 1); - strncpy (alc, filename, len); - alc[len] = '\0'; - filename = alc; - - dot = strchr (dot + 1, '.'); - if (dot != NULL) - force_min = atoi (dot + 1); - } - - found = NULL; - max_maj = max_min = 0; - - dir = opendir (dirname); - if (dir == NULL) - return NULL; - - while ((entry = readdir (dir)) != NULL) - { - const char *s; - int found_maj, found_min; - - if (strncmp (entry->d_name, "lib", 3) != 0 - || strncmp (entry->d_name + 3, filename, len) != 0) - continue; - - if (dot == NULL - && strcmp (entry->d_name + 3 + len, ".a") == 0) - { - *found_static = true; - continue; - } - - /* We accept libfoo.so without a version number, even though the - native linker does not. This is more convenient for packages - which just generate .so files for shared libraries, as on ELF - systems. */ - if (strncmp (entry->d_name + 3 + len, ".so", 3) != 0) - continue; - if (entry->d_name[6 + len] == '\0') - ; - else if (entry->d_name[6 + len] == '.' - && isdigit ((unsigned char) entry->d_name[7 + len])) - ; - else - continue; - - for (s = entry->d_name + 6 + len; *s != '\0'; s++) - if (*s != '.' && ! isdigit ((unsigned char) *s)) - break; - if (*s != '\0') - continue; - - /* We've found a .so file. Work out the major and minor - version numbers. */ - found_maj = 0; - found_min = 0; - sscanf (entry->d_name + 3 + len, ".so.%d.%d", - &found_maj, &found_min); - - if ((force_maj != -1 && force_maj != found_maj) - || (force_min != -1 && force_min != found_min)) - continue; - - /* We've found a match for the name we are searching for. See - if this is the version we should use. If the major and minor - versions match, we use the last entry in alphabetical order; - I don't know if this is how SunOS distinguishes libc.so.1.8 - from libc.so.1.8.1, but it ought to suffice. */ - if (found == NULL - || (found_maj > max_maj) - || (found_maj == max_maj - && (found_min > max_min - || (found_min == max_min - && strcmp (entry->d_name, found) > 0)))) - { - if (found != NULL) - free (found); - found = (char *) xmalloc (strlen (entry->d_name) + 1); - strcpy (found, entry->d_name); - max_maj = found_maj; - max_min = found_min; - } - } - - closedir (dir); - - if (alc != NULL) - free (alc); - - return found; -} - -/* These variables are required to pass information back and forth - between after_open and check_needed. */ - -static struct bfd_link_needed_list *global_needed; -static boolean global_found; - -/* This is called after all the input files have been opened. */ - -static void -gld${EMULATION_NAME}_after_open () -{ - struct bfd_link_needed_list *needed, *l; - - /* We only need to worry about this when doing a final link. */ - if (link_info.relocateable || link_info.shared) - return; - - /* Get the list of files which appear in ld_need entries in dynamic - objects included in the link. For each such file, we want to - track down the corresponding library, and include the symbol - table in the link. This is what the runtime dynamic linker will - do. Tracking the files down here permits one dynamic object to - include another without requiring special action by the person - doing the link. Note that the needed list can actually grow - while we are stepping through this loop. */ - needed = bfd_sunos_get_needed_list (output_bfd, &link_info); - for (l = needed; l != NULL; l = l->next) - { - struct bfd_link_needed_list *ll; - const char *lname; - search_dirs_type *search; - - lname = l->name; - - /* If we've already seen this file, skip it. */ - for (ll = needed; ll != l; ll = ll->next) - if (strcmp (ll->name, lname) == 0) - break; - if (ll != l) - continue; - - /* See if this file was included in the link explicitly. */ - global_needed = l; - global_found = false; - lang_for_each_input_file (gld${EMULATION_NAME}_check_needed); - if (global_found) - continue; - - if (strncmp (lname, "-l", 2) != 0) - { - bfd *abfd; - - abfd = bfd_openr (lname, bfd_get_target (output_bfd)); - if (abfd != NULL) - { - if (! bfd_check_format (abfd, bfd_object)) - { - (void) bfd_close (abfd); - abfd = NULL; - } - } - if (abfd != NULL) - { - if ((bfd_get_file_flags (abfd) & DYNAMIC) == 0) - { - (void) bfd_close (abfd); - abfd = NULL; - } - } - if (abfd != NULL) - { - /* We've found the needed dynamic object. */ - if (! bfd_link_add_symbols (abfd, &link_info)) - einfo ("%F%B: could not read symbols: %E\n", abfd); - } - else - { - einfo ("%P: warning: %s, needed by %B, not found\n", - lname, l->by); - } - - continue; - } - - lname += 2; - - /* We want to search for the file in the same way that the - dynamic linker will search. That means that we want to use - rpath_link, rpath or -L, then the environment variable - LD_LIBRARY_PATH (native only), then (if rpath was used) the - linker script LIB_SEARCH_DIRS. */ - if (gld${EMULATION_NAME}_search_needed (command_line.rpath_link, - lname)) - continue; - if (command_line.rpath != NULL) - { - if (gld${EMULATION_NAME}_search_needed (command_line.rpath, lname)) - continue; - } - else - { - for (search = search_head; search != NULL; search = search->next) - if (gld${EMULATION_NAME}_try_needed (search->name, lname)) - break; - if (search != NULL) - continue; - } -EOF -if [ "x${host}" = "x${target}" ] ; then - if [ "x${DEFAULT_EMULATION}" = "x${EMULATION_NAME}" ] ; then -cat >>e${EMULATION_NAME}.c <>e${EMULATION_NAME}.c <next) - { - if (search->cmdline) - continue; - if (gld${EMULATION_NAME}_try_needed (search->name, lname)) - break; - } - if (search != NULL) - continue; - } - - einfo ("%P: warning: %s, needed by %B, not found\n", - l->name, l->by); - } -} - -/* Search for a needed file in a path. */ - -static boolean -gld${EMULATION_NAME}_search_needed (path, name) - const char *path; - const char *name; -{ - const char *s; - - if (path == NULL || *path == '\0') - return false; - while (1) - { - const char *dir; - char *dircopy; - - s = strchr (path, ':'); - if (s == NULL) - { - dircopy = NULL; - dir = path; - } - else - { - dircopy = (char *) xmalloc (s - path + 1); - memcpy (dircopy, path, s - path); - dircopy[s - path] = '\0'; - dir = dircopy; - } - - if (gld${EMULATION_NAME}_try_needed (dir, name)) - return true; - - if (dircopy != NULL) - free (dircopy); - - if (s == NULL) - break; - path = s + 1; - } - - return false; -} - -/* This function is called for each possible directory for a needed - dynamic object. */ - -static boolean -gld${EMULATION_NAME}_try_needed (dir, name) - const char *dir; - const char *name; -{ - char *file; - char *alc; - boolean ignore; - bfd *abfd; - - file = gld${EMULATION_NAME}_search_dir (dir, name, &ignore); - if (file == NULL) - return false; - - alc = (char *) xmalloc (strlen (dir) + strlen (file) + 2); - sprintf (alc, "%s/%s", dir, file); - free (file); - abfd = bfd_openr (alc, bfd_get_target (output_bfd)); - if (abfd == NULL) - return false; - if (! bfd_check_format (abfd, bfd_object)) - { - (void) bfd_close (abfd); - return false; - } - if ((bfd_get_file_flags (abfd) & DYNAMIC) == 0) - { - (void) bfd_close (abfd); - return false; - } - - /* We've found the needed dynamic object. */ - - /* Add this file into the symbol table. */ - if (! bfd_link_add_symbols (abfd, &link_info)) - einfo ("%F%B: could not read symbols: %E\n", abfd); - - return true; -} - -/* See if we have already included a needed object in the link. This - does not have to be precise, as it does no harm to include a - dynamic object more than once. */ - -static void -gld${EMULATION_NAME}_check_needed (s) - lang_input_statement_type *s; -{ - if (s->filename == NULL) - return; - if (strncmp (global_needed->name, "-l", 2) != 0) - { - if (strcmp (s->filename, global_needed->name) == 0) - global_found = true; - } - else - { - const char *sname, *lname; - const char *sdot, *ldot; - int lmaj, lmin, smaj, smin; - - lname = global_needed->name + 2; - - sname = strrchr (s->filename, '/'); - if (sname == NULL) - sname = s->filename; - else - ++sname; - - if (strncmp (sname, "lib", 3) != 0) - return; - sname += 3; - - ldot = strchr (lname, '.'); - if (ldot == NULL) - ldot = lname + strlen (lname); - - sdot = strstr (sname, ".so."); - if (sdot == NULL) - return; - - if (sdot - sname != ldot - lname - || strncmp (lname, sname, sdot - sname) != 0) - return; - - lmaj = lmin = -1; - sscanf (ldot, ".%d.%d", &lmaj, &lmin); - smaj = smin = -1; - sscanf (sdot, ".so.%d.%d", &smaj, &smin); - if ((smaj != lmaj && smaj != -1 && lmaj != -1) - || (smin != lmin && smin != -1 && lmin != -1)) - return; - - global_found = true; - } -} - -/* We need to use static variables to pass information around the call - to lang_for_each_statement. Ick. */ - -static const char *find_assign; -static boolean found_assign; - -/* We need to use static variables to pass information around the call - to lang_for_each_input_file. Ick. */ - -static bfd_size_type need_size; -static bfd_size_type need_entries; -static bfd_byte *need_contents; -static bfd_byte *need_pinfo; -static bfd_byte *need_pnames; - -/* The size of one entry in the .need section, not including the file - name. */ - -#define NEED_ENTRY_SIZE (16) - -/* This is called after the sections have been attached to output - sections, but before any sizes or addresses have been set. */ - -static void -gld${EMULATION_NAME}_before_allocation () -{ - struct bfd_link_hash_entry *hdyn = NULL; - asection *sneed; - asection *srules; - asection *sdyn; - - /* The SunOS native linker creates a shared library whenever there - are any undefined symbols in a link, unless -e is used. This is - pretty weird, but we are compatible. */ - if (! link_info.shared && ! link_info.relocateable && ! entry_from_cmdline) - { - struct bfd_link_hash_entry *h; - - for (h = link_info.hash->undefs; h != NULL; h = h->next) - { - if (h->type == bfd_link_hash_undefined - && h->u.undef.abfd != NULL - && (h->u.undef.abfd->flags & DYNAMIC) == 0 - && strcmp (h->root.string, "__DYNAMIC") != 0 - && strcmp (h->root.string, "__GLOBAL_OFFSET_TABLE_") != 0) - { - find_assign = h->root.string; - found_assign = false; - lang_for_each_statement (gld${EMULATION_NAME}_find_assignment); - if (! found_assign) - { - link_info.shared = true; - break; - } - } - } - } - - if (link_info.shared) - { - lang_output_section_statement_type *os; - - /* Set the .text section to start at 0x20, not 0x2020. FIXME: - This is too magical. */ - os = lang_output_section_statement_lookup (".text"); - if (os->addr_tree == NULL) - os->addr_tree = exp_intop (0x20); - } - - /* We need to create a __DYNAMIC symbol. We don't do this in the - linker script because we want to set the value to the start of - the dynamic section if there is one, or to zero if there isn't - one. We need to create the symbol before calling - size_dynamic_sections, although we can't set the value until - afterward. */ - if (! link_info.relocateable) - { - hdyn = bfd_link_hash_lookup (link_info.hash, "__DYNAMIC", true, false, - false); - if (hdyn == NULL) - einfo ("%P%F: bfd_link_hash_lookup: %E\n"); - if (! bfd_sunos_record_link_assignment (output_bfd, &link_info, - "__DYNAMIC")) - einfo ("%P%F: failed to record assignment to __DYNAMIC: %E\n"); - } - - /* If we are going to make any variable assignments, we need to let - the backend linker know about them in case the variables are - referred to by dynamic objects. */ - lang_for_each_statement (gld${EMULATION_NAME}_find_assignment); - - /* Let the backend linker work out the sizes of any sections - required by dynamic linking. */ - if (! bfd_sunos_size_dynamic_sections (output_bfd, &link_info, &sdyn, - &sneed, &srules)) - einfo ("%P%F: failed to set dynamic section sizes: %E\n"); - - if (sneed != NULL) - { - /* Set up the .need section. See the description of the ld_need - field in include/aout/sun4.h. */ - - need_entries = 0; - need_size = 0; - - lang_for_each_input_file (gld${EMULATION_NAME}_count_need); - - /* We should only have a .need section if we have at least one - dynamic object. */ - ASSERT (need_entries != 0); - - sneed->_raw_size = need_size; - sneed->contents = (bfd_byte *) xmalloc (need_size); - - need_contents = sneed->contents; - need_pinfo = sneed->contents; - need_pnames = sneed->contents + need_entries * 16; - - lang_for_each_input_file (gld${EMULATION_NAME}_set_need); - - ASSERT ((bfd_size_type) (need_pnames - sneed->contents) == need_size); - } - - if (srules != NULL) - { - /* Set up the .rules section. This is just a PATH like string - of the -L arguments given on the command line. We permit the - user to specify the directories using the -rpath command line - option. */ - if (command_line.rpath) - { - srules->_raw_size = strlen (command_line.rpath); - srules->contents = (bfd_byte *) command_line.rpath; - } - else - { - unsigned int size; - search_dirs_type *search; - - size = 0; - for (search = search_head; search != NULL; search = search->next) - if (search->cmdline) - size += strlen (search->name) + 1; - srules->_raw_size = size; - if (size > 0) - { - char *p; - - srules->contents = (bfd_byte *) xmalloc (size); - p = (char *) srules->contents; - *p = '\0'; - for (search = search_head; search != NULL; search = search->next) - { - if (search->cmdline) - { - if (p != (char *) srules->contents) - *p++ = ':'; - strcpy (p, search->name); - p += strlen (p); - } - } - } - } - } - - /* We must assign a value to __DYNAMIC. It should be zero if we are - not doing a dynamic link, or the start of the .dynamic section if - we are doing one. */ - if (! link_info.relocateable) - { - hdyn->type = bfd_link_hash_defined; - hdyn->u.def.value = 0; - if (sdyn != NULL) - hdyn->u.def.section = sdyn; - else - hdyn->u.def.section = bfd_abs_section_ptr; - } -} - -/* This is called by the before_allocation routine via - lang_for_each_statement. It does one of two things: if the - variable find_assign is set, it sets found_assign if it finds an - assignment to that variable; otherwise it tells the backend linker - about all assignment statements, in case they are assignments to - symbols which are referred to by dynamic objects. */ - -static void -gld${EMULATION_NAME}_find_assignment (s) - lang_statement_union_type *s; -{ - if (s->header.type == lang_assignment_statement_enum - && (find_assign == NULL || ! found_assign)) - gld${EMULATION_NAME}_find_exp_assignment (s->assignment_statement.exp); -} - -/* Look through an expression for an assignment statement. */ - -static void -gld${EMULATION_NAME}_find_exp_assignment (exp) - etree_type *exp; -{ - switch (exp->type.node_class) - { - case etree_assign: - if (find_assign != NULL) - { - if (strcmp (find_assign, exp->assign.dst) == 0) - found_assign = true; - return; - } - - if (strcmp (exp->assign.dst, ".") != 0) - { - if (! bfd_sunos_record_link_assignment (output_bfd, &link_info, - exp->assign.dst)) - einfo ("%P%F: failed to record assignment to %s: %E\n", - exp->assign.dst); - } - gld${EMULATION_NAME}_find_exp_assignment (exp->assign.src); - break; - - case etree_binary: - gld${EMULATION_NAME}_find_exp_assignment (exp->binary.lhs); - gld${EMULATION_NAME}_find_exp_assignment (exp->binary.rhs); - break; - - case etree_trinary: - gld${EMULATION_NAME}_find_exp_assignment (exp->trinary.cond); - gld${EMULATION_NAME}_find_exp_assignment (exp->trinary.lhs); - gld${EMULATION_NAME}_find_exp_assignment (exp->trinary.rhs); - break; - - case etree_unary: - gld${EMULATION_NAME}_find_exp_assignment (exp->unary.child); - break; - - default: - break; - } -} - -/* Work out the size of the .need section, and the number of entries. - The backend will set the ld_need field of the dynamic linking - information to point to the .need section. See include/aout/sun4.h - for more information. */ - -static void -gld${EMULATION_NAME}_count_need (inp) - lang_input_statement_type *inp; -{ - if (inp->the_bfd != NULL - && (inp->the_bfd->flags & DYNAMIC) != 0) - { - ++need_entries; - need_size += NEED_ENTRY_SIZE; - if (! inp->is_archive) - need_size += strlen (inp->filename) + 1; - else - { - ASSERT (inp->local_sym_name[0] == '-' - && inp->local_sym_name[1] == 'l'); - need_size += strlen (inp->local_sym_name + 2) + 1; - } - } -} - -/* Fill in the contents of the .need section. */ - -static void -gld${EMULATION_NAME}_set_need (inp) - lang_input_statement_type *inp; -{ - if (inp->the_bfd != NULL - && (inp->the_bfd->flags & DYNAMIC) != 0) - { - bfd_size_type c; - - /* To really fill in the .need section contents, we need to know - the final file position of the section, but we don't. - Instead, we use offsets, and rely on the BFD backend to - finish the section up correctly. FIXME: Talk about lack of - referential locality. */ - bfd_put_32 (output_bfd, need_pnames - need_contents, need_pinfo); - if (! inp->is_archive) - { - bfd_put_32 (output_bfd, (bfd_vma) 0, need_pinfo + 4); - bfd_put_16 (output_bfd, (bfd_vma) 0, need_pinfo + 8); - bfd_put_16 (output_bfd, (bfd_vma) 0, need_pinfo + 10); - strcpy (need_pnames, inp->filename); - } - else - { - char *verstr; - int maj, min; - - bfd_put_32 (output_bfd, (bfd_vma) 0x80000000, need_pinfo + 4); - maj = 0; - min = 0; - verstr = strstr (inp->filename, ".so."); - if (verstr != NULL) - sscanf (verstr, ".so.%d.%d", &maj, &min); - bfd_put_16 (output_bfd, (bfd_vma) maj, need_pinfo + 8); - bfd_put_16 (output_bfd, (bfd_vma) min, need_pinfo + 10); - strcpy (need_pnames, inp->local_sym_name + 2); - } - - c = (need_pinfo - need_contents) / NEED_ENTRY_SIZE; - if (c + 1 >= need_entries) - bfd_put_32 (output_bfd, (bfd_vma) 0, need_pinfo + 12); - else - bfd_put_32 (output_bfd, (bfd_vma) (c + 1) * NEED_ENTRY_SIZE, - need_pinfo + 12); - - need_pinfo += NEED_ENTRY_SIZE; - need_pnames += strlen (need_pnames) + 1; - } -} - -static char * -gld${EMULATION_NAME}_get_script(isfile) - int *isfile; -EOF - -if test -n "$COMPILE_IN" -then -# Scripts compiled in. - -# sed commands to quote an ld script as a C string. -sc='s/["\\]/\\&/g -s/$/\\n\\/ -1s/^/"/ -$s/$/n"/ -' - -cat >>e${EMULATION_NAME}.c <>e${EMULATION_NAME}.c <>e${EMULATION_NAME}.c <e${EMULATION_NAME}.c <.sh file or default. - -DATA_ALIGNMENT_="${DATA_ALIGNMENT_-${DATA_ALIGNMENT-ALIGN(${SEGMENT_SIZE})}}" -DATA_ALIGNMENT_n="${DATA_ALIGNMENT_n-${DATA_ALIGNMENT_}}" -DATA_ALIGNMENT_N="${DATA_ALIGNMENT_N-${DATA_ALIGNMENT-.}}" -DATA_ALIGNMENT_r="${DATA_ALIGNMENT_r-${DATA_ALIGNMENT-}}" -DATA_ALIGNMENT_u="${DATA_ALIGNMENT_u-${DATA_ALIGNMENT_r}}" - -LD_FLAG=r -DATA_ALIGNMENT=${DATA_ALIGNMENT_r} -DEFAULT_DATA_ALIGNMENT="ALIGN(${SEGMENT_SIZE})" -(. ${srcdir}/scripttempl/${SCRIPT_NAME}.sc) | sed -e '/^ *$/d' > \ - ldscripts/${EMULATION_NAME}.xr - -LD_FLAG=u -DATA_ALIGNMENT=${DATA_ALIGNMENT_u} -CONSTRUCTING=" " -(. ${srcdir}/scripttempl/${SCRIPT_NAME}.sc) | sed -e '/^ *$/d' > \ - ldscripts/${EMULATION_NAME}.xu - -LD_FLAG= -DATA_ALIGNMENT=${DATA_ALIGNMENT_} -RELOCATING=" " -(. ${srcdir}/scripttempl/${SCRIPT_NAME}.sc) | sed -e '/^ *$/d' > \ - ldscripts/${EMULATION_NAME}.x - -LD_FLAG=n -DATA_ALIGNMENT=${DATA_ALIGNMENT_n} -TEXT_START_ADDR=${NONPAGED_TEXT_START_ADDR-${TEXT_START_ADDR}} -(. ${srcdir}/scripttempl/${SCRIPT_NAME}.sc) | sed -e '/^ *$/d' > \ - ldscripts/${EMULATION_NAME}.xn - -LD_FLAG=N -DATA_ALIGNMENT=${DATA_ALIGNMENT_N} -(. ${srcdir}/scripttempl/${SCRIPT_NAME}.sc) | sed -e '/^ *$/d' > \ - ldscripts/${EMULATION_NAME}.xbn - -if test -n "$GENERATE_SHLIB_SCRIPT"; then - LD_FLAG=shared - DATA_ALIGNMENT=${DATA_ALIGNMENT_s-${DATA_ALIGNMENT_}} - CREATE_SHLIB=" " - # Note that TEXT_START_ADDR is set to NONPAGED_TEXT_START_ADDR. - (. ${srcdir}/scripttempl/${SCRIPT_NAME}.sc) | sed -e '/^ *$/d' > \ - ldscripts/${EMULATION_NAME}.xs -fi - -test "$DEFAULT_EMULATION" = "$EMULATION_NAME" && COMPILE_IN=true - -# Generate e${EMULATION_NAME}.c. -. ${srcdir}/emultempl/${TEMPLATE_NAME-generic}.em diff --git a/gnu/dist/ld/h8-doc.texi b/gnu/dist/ld/h8-doc.texi deleted file mode 100644 index f3c62a1cc0b4..000000000000 --- a/gnu/dist/ld/h8-doc.texi +++ /dev/null @@ -1,14 +0,0 @@ -@c ------------------------------ CONFIGURATION VARS: -@c 1. Inclusiveness of this manual -@clear GENERIC - -@c 2. Specific target machines -@set H8300 -@set Hitachi -@clear I960 - -@c 3. Properties of this configuration -@set SingleFormat -@clear UsesEnvVars -@c ------------------------------ end CONFIGURATION VARS - diff --git a/gnu/dist/ld/ld.1 b/gnu/dist/ld/ld.1 deleted file mode 100644 index c177c56bebd9..000000000000 --- a/gnu/dist/ld/ld.1 +++ /dev/null @@ -1,1096 +0,0 @@ -.\" Copyright (c) 1991, 92, 93, 94, 95, 96, 1997 Free Software Foundation -.\" See section COPYING for conditions for redistribution -.TH ld 1 "17 August 1992" "cygnus support" "GNU Development Tools" -.de BP -.sp -.ti \-.2i -\(** -.. - -.SH NAME -ld \- the GNU linker - -.SH SYNOPSIS -.hy 0 -.na -.TP -.B ld -.RB "[\|" \-o " -.I output\c -\&\|] \c -.I objfile\c -\&.\|.\|. -.br -.RB "[\|" \-A\c -.I architecture\c -\&\|] -.RB "[\|" "\-b\ "\c -.I input-format\c -\&\|] -.RB "[\|" \-Bstatic "\|]" -.RB "[\|" \-Bdynamic "\|]" -.RB "[\|" \-Bsymbolic "\|]" -.RB "[\|" "\-c\ "\c -.I commandfile\c -\&\|] -.RB "[\|" \-\-cref "\|]" -.RB "[\|" \-d | \-dc | \-dp\c -\|] -.br -.RB "[\|" "\-defsym\ "\c -.I symbol\c -\& = \c -.I expression\c -\&\|] -.RB "[\|" "\-e\ "\c -.I entry\c -\&\|] -.RB "[\|" \-embedded\-relocs "\|]" -.RB "[\|" \-E "\|]" -.RB "[\|" \-export\-dynamic "\|]" -.RB "[\|" "\-f\ "\c -.I name\c -\&\|] -.RB "[\|" "\-\-auxiliary\ "\c -.I name\c -\&\|] -.RB "[\|" "\-F\ "\c -.I name\c -\&\|] -.RB "[\|" "\-\-filter\ "\c -.I name\c -\&\|] -.RB "[\|" "\-format\ "\c -.I input-format\c -\&\|] -.RB "[\|" \-g "\|]" -.RB "[\|" \-G -.I size\c -\&\|] -.RB "[\|" "\-h\ "\c -.I name\c -\&\|] -.RB "[\|" "\-soname\ "\c -.I name\c -\&\|] -.RB "[\|" \-\-help "\|]" -.RB "[\|" \-i "\|]" -.RB "[\|" \-l\c -.I ar\c -\&\|] -.RB "[\|" \-L\c -.I searchdir\c -\&\|] -.RB "[\|" \-M "\|]" -.RB "[\|" \-Map -.I mapfile\c -\&\|] -.RB "[\|" \-m -.I emulation\c -\&\|] -.RB "[\|" \-n | \-N "\|]" -.RB "[\|" \-noinhibit-exec "\|]" -.RB "[\|" \-no\-keep\-memory "\|]" -.RB "[\|" \-no\-warn\-mismatch "\|]" -.RB "[\|" "\-oformat\ "\c -.I output-format\c -\&\|] -.RB "[\|" "\-R\ "\c -.I filename\c -\&\|] -.RB "[\|" \-relax "\|]" -.RB "[\|" \-r | \-Ur "\|]" -.RB "[\|" "\-rpath\ "\c -.I directory\c -\&\|] -.RB "[\|" "\-rpath\-link\ "\c -.I directory\c -\&\|] -.RB "[\|" \-S "\|]" -.RB "[\|" \-s "\|]" -.RB "[\|" \-shared "\|]" -.RB "[\|" \-sort\-common "\|]" -.RB "[\|" "\-split\-by\-reloc\ "\c -.I count\c -\&\|] -.RB "[\|" \-split\-by\-file "\|]" -.RB "[\|" "\-T\ "\c -.I commandfile\c -\&\|] -.RB "[\|" "\-Ttext\ "\c -.I textorg\c -\&\|] -.RB "[\|" "\-Tdata\ "\c -.I dataorg\c -\&\|] -.RB "[\|" "\-Tbss\ "\c -.I bssorg\c -\&\|] -.RB "[\|" \-t "\|]" -.RB "[\|" "\-u\ "\c -.I sym\c -\&] -.RB "[\|" \-V "\|]" -.RB "[\|" \-v "\|]" -.RB "[\|" \-\-verbose "\|]" -.RB "[\|" \-\-version "\|]" -.RB "[\|" \-warn\-common "\|]" -.RB "[\|" \-warn\-constructors "\|]" -.RB "[\|" \-warn\-multiple\-gp "\|]" -.RB "[\|" \-warn\-once "\|]" -.RB "[\|" \-warn\-section\-align "\|]" -.RB "[\|" \-\-whole\-archive "\|]" -.RB "[\|" \-\-no\-whole\-archive "\|]" -.RB "[\|" "\-\-wrap\ "\c -.I symbol\c -\&\|] -.RB "[\|" \-X "\|]" -.RB "[\|" \-x "\|]" -.ad b -.hy 1 -.SH DESCRIPTION -\c -.B ld\c -\& combines a number of object and archive files, relocates -their data and ties up symbol references. Often the last step in -building a new compiled program to run is a call to \c -.B ld\c -\&. - -\c -.B ld\c -\& accepts Linker Command Language files -to provide explicit and total control over the linking process. -This man page does not describe the command language; see the `\|\c -.B ld\c -\|' entry in `\|\c -.B info\c -\|', or the manual -.I -ld: the GNU linker -\&, for full details on the command language and on other aspects of -the GNU linker. - -This version of \c -.B ld\c -\& uses the general purpose BFD libraries -to operate on object files. This allows \c -.B ld\c -\& to read, combine, and -write object files in many different formats\(em\&for example, COFF or -\c -.B a.out\c -\&. Different formats may be linked together to produce any -available kind of object file. You can use `\|\c -.B objdump \-i\c -\|' to get a list of formats supported on various architectures; see -.BR objdump ( 1 ). - -Aside from its flexibility, the GNU linker is more helpful than other -linkers in providing diagnostic information. Many linkers abandon -execution immediately upon encountering an error; whenever possible, -\c -.B ld\c -\& continues executing, allowing you to identify other errors -(or, in some cases, to get an output file in spite of the error). - -The GNU linker \c -.B ld\c -\& is meant to cover a broad range of situations, -and to be as compatible as possible with other linkers. As a result, -you have many choices to control its behavior through the command line, -and through environment variables. - -.SH OPTIONS -The plethora of command-line options may seem intimidating, but in -actual practice few of them are used in any particular context. -For instance, a frequent use of \c -.B ld\c -\& is to link standard Unix -object files on a standard, supported Unix system. On such a system, to -link a file \c -.B hello.o\c -\&: -.sp -.br -$\ ld\ \-o\ output\ /lib/crt0.o\ hello.o\ \-lc -.br -.sp -This tells \c -.B ld\c -\& to produce a file called \c -.B output\c -\& as the -result of linking the file \c -.B /lib/crt0.o\c -\& with \c -.B hello.o\c -\& and -the library \c -.B libc.a\c -\& which will come from the standard search -directories. - -The command-line options to \c -.B ld\c -\& may be specified in any order, and -may be repeated at will. For the most part, repeating an option with a -different argument will either have no further effect, or override prior -occurrences (those further to the left on the command line) of an -option. - -The exceptions\(em\&which may meaningfully be used more than once\(em\&are -\c -.B \-A\c -\&, \c -.B \-b\c -\& (or its synonym \c -.B \-format\c -\&), \c -.B \-defsym\c -\&, -\c -.B \-L\c -\&, \c -.B \-l\c -\&, \c -.B \-R\c -\&, and \c -.B \-u\c -\&. - -The list of object files to be linked together, shown as \c -.I objfile\c -\&, -may follow, precede, or be mixed in with command-line options; save that -an \c -.I objfile\c -\& argument may not be placed between an option flag and -its argument. - -Usually the linker is invoked with at least one object file, but other -forms of binary input files can also be specified with \c -.B \-l\c -\&, -\c -.B \-R\c -\&, and the script command language. If \c -.I no\c -\& binary input -files at all are specified, the linker does not produce any output, and -issues the message `\|\c -.B No input files\c -\|'. - -Option arguments must either follow the option letter without intervening -whitespace, or be given as separate arguments immediately following the -option that requires them. - -.TP -.BI "-A" "architecture" -In the current release of \c -.B ld\c -\&, this option is useful only for the -Intel 960 family of architectures. In that \c -.B ld\c -\& configuration, the -\c -.I architecture\c -\& argument is one of the two-letter names identifying -members of the 960 family; the option specifies the desired output -target, and warns of any incompatible instructions in the input files. -It also modifies the linker's search strategy for archive libraries, to -support the use of libraries specific to each particular -architecture, by including in the search loop names suffixed with the -string identifying the architecture. - -For example, if your \c -.B ld\c -\& command line included `\|\c -.B \-ACA\c -\|' as -well as `\|\c -.B \-ltry\c -\|', the linker would look (in its built-in search -paths, and in any paths you specify with \c -.B \-L\c -\&) for a library with -the names -.sp -.br -try -.br -libtry.a -.br -tryca -.br -libtryca.a -.br -.sp - -The first two possibilities would be considered in any event; the last -two are due to the use of `\|\c -.B \-ACA\c -\|'. - -Future releases of \c -.B ld\c -\& may support similar functionality for -other architecture families. - -You can meaningfully use \c -.B \-A\c -\& more than once on a command line, if -an architecture family allows combination of target architectures; each -use will add another pair of name variants to search for when \c -.B \-l -specifies a library. - -.TP -.BI "\-b " "input-format" -Specify the binary format for input object files that follow this option -on the command line. You don't usually need to specify this, as -\c -.B ld\c -\& is configured to expect as a default input format the most -usual format on each machine. \c -.I input-format\c -\& is a text string, the -name of a particular format supported by the BFD libraries. -\c -.B \-format \c -.I input-format\c -\&\c -\& has the same effect, as does the script command -.BR TARGET . - -You may want to use this option if you are linking files with an unusual -binary format. You can also use \c -.B \-b\c -\& to switch formats explicitly (when -linking object files of different formats), by including -\c -.B \-b \c -.I input-format\c -\&\c -\& before each group of object files in a -particular format. - -The default format is taken from the environment variable -.B GNUTARGET\c -\&. You can also define the input -format from a script, using the command \c -.B TARGET\c -\&. - -.TP -.B \-Bstatic -Do not link against shared libraries. This is only meaningful on -platforms for which shared libraries are supported. - -.TP -.B \-Bdynamic -Link against dynamic libraries. This is only meaningful on platforms -for which shared libraries are supported. This option is normally the -default on such platforms. - -.TP -.B \-Bsymbolic -When creating a shared library, bind references to global symbols to -the definition within the shared library, if any. Normally, it is -possible for a program linked against a shared library to override the -definition within the shared library. This option is only meaningful -on ELF platforms which support shared libraries. - -.TP -.BI "\-c " "commandfile" -Directs \c -.B ld\c -\& to read link commands from the file -\c -.I commandfile\c -\&. These commands will completely override \c -.B ld\c -\&'s -default link format (rather than adding to it); \c -.I commandfile\c -\& must -specify everything necessary to describe the target format. - - -You may also include a script of link commands directly in the command -line by bracketing it between `\|\c -.B {\c -\|' and `\|\c -.B }\c -\|' characters. - -.TP -.B \-\-cref -Output a cross reference table. If a linker map file is being -generated, the cross reference table is printed to the map file. -Otherwise, it is printed on the standard output. - -.TP -.B \-d -.TP -.B \-dc -.TP -.B \-dp -These three options are equivalent; multiple forms are supported for -compatibility with other linkers. Use any of them to make \c -.B ld -assign space to common symbols even if a relocatable output file is -specified (\c -.B \-r\c -\&). The script command -\c -.B FORCE_COMMON_ALLOCATION\c -\& has the same effect. - -.TP -.BI "-defsym " "symbol" "\fR = \fP" expression -Create a global symbol in the output file, containing the absolute -address given by \c -.I expression\c -\&. You may use this option as many -times as necessary to define multiple symbols in the command line. A -limited form of arithmetic is supported for the \c -.I expression\c -\& in this -context: you may give a hexadecimal constant or the name of an existing -symbol, or use \c -.B +\c -\& and \c -.B \-\c -\& to add or subtract hexadecimal -constants or symbols. If you need more elaborate expressions, consider -using the linker command language from a script. - -.TP -.BI "-e " "entry"\c -\& -Use \c -.I entry\c -\& as the explicit symbol for beginning execution of your -program, rather than the default entry point. See the `\|\c -.B ld\c -\|' entry in `\|\c -.B info\c -\|' for a -discussion of defaults and other ways of specifying the -entry point. - -.TP -.B \-embedded\-relocs -This option is only meaningful when linking MIPS embedded PIC code, -generated by the -.B \-membedded\-pic -option to the GNU compiler and assembler. It causes the linker to -create a table which may be used at runtime to relocate any data which -was statically initialized to pointer values. See the code in -testsuite/ld-empic for details. - -.TP -.B \-E -.TP -.B \-export\-dynamic -When creating an ELF file, add all symbols to the dynamic symbol table. -Normally, the dynamic symbol table contains only symbols which are used -by a dynamic object. This option is needed for some uses of -.I dlopen. - -.TP -.BI "-f " "name" -.TP -.BI "--auxiliary " "name" -When creating an ELF shared object, set the internal DT_AUXILIARY field -to the specified name. This tells the dynamic linker that the symbol -table of the shared object should be used as an auxiliary filter on the -symbol table of the shared object -.I name. - -.TP -.BI "-F " "name" -.TP -.BI "--filter " "name" -When creating an ELF shared object, set the internal DT_FILTER field to -the specified name. This tells the dynamic linker that the symbol table -of the shared object should be used as a filter on the symbol table of -the shared object -.I name. - -.TP -.BI "\-format " "input\-format" -Synonym for \c -.B \-b\c -\& \c -.I input\-format\c -\&. - -.TP -.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 -.BI "-h " "name" -.TP -.BI "-soname " "name" -When creating an ELF shared object, set the internal DT_SONAME field to -the specified name. When an executable is linked with a shared object -which has a DT_SONAME field, then when the executable is run the dynamic -linker will attempt to load the shared object specified by the DT_SONAME -field rather than the using the file name given to the linker. - -.TP -.B \-\-help -Print a summary of the command-line options on the standard output and exit. -This option and -.B \-\-version -begin with two dashes instead of one -for compatibility with other GNU programs. The other options start with -only one dash for compatibility with other linkers. - -.TP -.B \-i -Perform an incremental link (same as option \c -.B \-r\c -\&). - -.TP -.BI "\-l" "ar"\c -\& -Add an archive file \c -.I ar\c -\& to the list of files to link. This -option may be used any number of times. \c -.B ld\c -\& will search its -path-list for occurrences of \c -.B lib\c -.I ar\c -\&.a\c -\& for every \c -.I ar -specified. - -.TP -.BI "\-L" "searchdir" -This command adds path \c -.I searchdir\c -\& to the list of paths that -\c -.B ld\c -\& will search for archive libraries. You may use this option -any number of times. - -The default set of paths searched (without being specified with -\c -.B \-L\c -\&) depends on what emulation mode \c -.B ld\c -\& is using, and in -some cases also on how it was configured. The -paths can also be specified in a link script with the \c -.B SEARCH_DIR -command. - -.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 "\-Map " "mapfile"\c -Print to the file -.I mapfile -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 \-\-verbose -or -.I \-V -options. 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 -\& and \c -.B data\c -\& sections. If -the output format supports Unix style magic numbers, the output is -marked as \c -.B OMAGIC\c -\&. - -When you use the `\|\c -.B \-N\c -\&\|' option, the linker does not page-align the -data segment. - -.TP -.B \-n -sets the text segment to be read only, and \c -.B NMAGIC\c -\& is written -if possible. - -.TP -.B \-noinhibit\-exec -Normally, the linker will not produce an output file if it encounters -errors during the link process. With this flag, you can specify that -you wish the output file retained even after non-fatal errors. - -.TP -.B \-no\-keep\-memory -The linker normally optimizes for speed over memory usage by caching -the symbol tables of input files in memory. This option tells the -linker to instead optimize for memory usage, by rereading the symbol -tables as necessary. This may be required if the linker runs out of -memory space while linking a large executable. - -.TP -.B \-no\-warn\-mismatch -Normally the linker will give an error if you try to link together -input files that are mismatched for some reason, perhaps because they -have been compiled for different processors or for different -endiannesses. This option tells the linker that it should silently -permit such possible errors. This option should only be used with -care, in cases when you have taken some special action that ensures -that the linker errors are inappropriate. - -.TP -.BI "\-o " "output" -.I output\c -\& is a name for the program produced by \c -.B ld\c -\&; if this -option is not specified, the name `\|\c -.B a.out\c -\|' is used by default. The -script command \c -.B OUTPUT\c -\& can also specify the output file name. - -.TP -.BI "\-oformat " "output\-format" -Specify the binary format for the output object file. -You don't usually need to specify this, as -\c -.B ld\c -\& is configured to produce as a default output format the most -usual format on each machine. \c -.I output-format\c -\& is a text string, the -name of a particular format supported by the BFD libraries. -The script command -.B OUTPUT_FORMAT -can also specify the output format, but this option overrides it. - -.TP -.BI "\-R " "filename" -Read symbol names and their addresses from \c -.I filename\c -\&, but do not -relocate it or include it in the output. This allows your output file -to refer symbolically to absolute locations of memory defined in other -programs. - -For compatibility with other ELF linkers, if the `\|\c -.B \-R\c -\&\|' option is -followed by a directory name, rather than a file name, it is treated as -the `\|\c -.B \-rpath\c -\&\|' option. - - -.TP -.B \-relax -An option with machine dependent effects. Currently this option is only -supported on the H8/300. - -On some platforms, use this option to perform global optimizations that -become possible when the linker resolves addressing in your program, such -as relaxing address modes and synthesizing new instructions in the -output object file. - -On platforms where this is not supported, `\|\c -.B \-relax\c -\&\|' is accepted, but has no effect. - -.TP -.B \-r -Generates relocatable output\(em\&i.e., generate an output file that can in -turn serve as input to \c -.B ld\c -\&. This is often called \c -.I partial -linking\c -\&. As a side effect, in environments that support standard Unix -magic numbers, this option also sets the output file's magic number to -\c -.B OMAGIC\c -\&. -If this option is not specified, an absolute file is produced. When -linking C++ programs, this option \c -.I will not\c -\& resolve references to -constructors; \c -.B \-Ur\c -\& is an alternative. - -This option does the same as \c -.B \-i\c -\&. - -.TP -.B \-rpath\ \fIdirectory -Add a directory to the runtime library search path. This is used when -linking an ELF executable with shared objects. All -.B \-rpath -arguments are concatenated and passed to the runtime linker, which uses -them to locate shared objects at runtime. The -.B \-rpath -option is also used when locating shared objects which are needed by -shared objects explicitly included in the link; see the description of -the -.B \-rpath\-link -option. If -.B \-rpath -is not used when linking an ELF executable, the contents of the -environment variable -.B LD_RUN_PATH -will be used if it is defined. - -The -.B \-rpath -option may also be used on SunOS. By default, on SunOS, the linker -will form a runtime search patch out of all the -.B \-L -options it is given. If a -.B \-rpath -option is used, the runtime search path will be formed exclusively -using the -.B \-rpath -options, ignoring -the -.B \-L -options. This can be useful when using gcc, which adds many -.B \-L -options which may be on NFS mounted filesystems. - -.TP -.B \-rpath\-link\ \fIdirectory -When using ELF or SunOS, one shared library may require another. This -happens when an -.B ld\ \-shared -link includes a shared library as one of the input files. - -When the linker encounters such a dependency when doing a non-shared, -non-relocateable link, it will automatically try to locate the required -shared library and include it in the link, if it is not included -explicitly. In such a case, the -.B \-rpath\-link -option specifies the first set of directories to search. The -.B \-rpath\-link -option may specify a sequence of directory names either by specifying -a list of names separated by colons, or by appearing multiple times. - -If the required shared library is not found, the linker will issue a -warning and continue with the link. - -.TP -.B \-S -Omits debugger symbol information (but not all symbols) from the output file. - -.TP -.B \-s -Omits all symbol information from the output file. - -.TP -.B \-shared -Create a shared library. This is currently only supported on ELF and -SunOS platforms (on SunOS it is not required, as the linker will -automatically create a shared library when there are undefined symbols -and the -.B \-e -option is not used). - -.TP -.B \-sort\-common -Normally, when -.B ld -places the global common symbols in the appropriate output sections, -it sorts them by size. First come all the one byte symbols, then all -the two bytes, then all the four bytes, and then everything else. -This is to prevent gaps between symbols due to -alignment constraints. This option disables that sorting. - -.TP -.B \-split\-by\-reloc\ \fIcount -Trys to creates extra sections in the output file so that no single -output section in the file contains more than -.I count -relocations. -This is useful when generating huge relocatable for downloading into -certain real time kernels with the COFF object file format; since COFF -cannot represent more than 65535 relocations in a single section. -Note that this will fail to work with object file formats which do not -support arbitrary sections. The linker will not split up individual -input sections for redistribution, so if a single input section -contains more than -.I count -relocations one output section will contain that many relocations. - -.TP -.B \-split\-by\-file -Similar to -.B \-split\-by\-reloc -but creates a new output section for each input file. - -.TP -.BI "\-Tbss " "org"\c -.TP -.BI "\-Tdata " "org"\c -.TP -.BI "\-Ttext " "org"\c -Use \c -.I org\c -\& as the starting address for\(em\&respectively\(em\&the -\c -.B bss\c -\&, \c -.B data\c -\&, or the \c -.B text\c -\& segment of the output file. -\c -.I textorg\c -\& must be a hexadecimal integer. - -.TP -.BI "\-T " "commandfile" -Equivalent to \c -.B \-c \c -.I commandfile\c -\&\c -\&; supported for compatibility with -other tools. - -.TP -.B \-t -Prints names of input files as \c -.B ld\c -\& processes them. - -.TP -.BI "\-u " "sym" -Forces \c -.I sym\c -\& to be entered in the output file as an undefined symbol. -This may, for example, trigger linking of additional modules from -standard libraries. \c -.B \-u\c -\& may be repeated with different option -arguments to enter additional undefined symbols. - -.TP -.B \-Ur -For anything other than C++ programs, this option is equivalent to -\c -.B \-r\c -\&: it generates relocatable output\(em\&i.e., an output file that can in -turn serve as input to \c -.B ld\c -\&. When linking C++ programs, \c -.B \-Ur -.I will\c -\& resolve references to constructors, unlike \c -.B \-r\c -\&. - -.TP -.B \-\-verbose -Display the version number for \c -.B ld -and list the supported emulations. -Display which input files can and can not be opened. - -.TP -.B \-v, \-V -Display the version number for \c -.B ld\c -\&. -The -.B \-V -option also lists the supported emulations. - -.TP -.B \-\-version -Display the version number for \c -.B ld -and exit. - -.TP -.B \-warn\-common -Warn when a common symbol is combined with another common symbol or with -a symbol definition. Unix linkers allow this somewhat sloppy practice, -but linkers on some other operating systems do not. This option allows -you to find potential problems from combining global symbols. - -.TP -.B \-warn\-constructors -Warn if any global constructors are used. This is only useful for a -few object file formats. For formats like COFF or ELF, the linker can -not detect the use of global constructors. - -.TP -.B \-warn\-multiple\-gp -Warn if the output file requires multiple global-pointer values. This -option is only meaningful for certain processors, such as the Alpha. - -.TP -.B \-warn\-once -Only warn once for each undefined symbol, rather than once per module -which refers to it. - -.TP -.B \-warn\-section\-align -Warn if the address of an output section is changed because of -alignment. Typically, the alignment will be set by an input section. -The address will only be changed if it not explicitly specified; that -is, if the SECTIONS command does not specify a start address for the -section. - -.TP -.B \-\-whole\-archive -For each archive mentioned on the command line after the -.B \-\-whole\-archive -option, include every object file in the archive in the link, rather -than searching the archive for the required object files. This is -normally used to turn an archive file into a shared library, forcing -every object to be included in the resulting shared library. - -.TP -.B \-\-no\-whole\-archive -Turn off the effect of the -.B \-\-whole\-archive -option for archives which appear later on the command line. - -.TP -.BI "--wrap " "symbol" -Use a wrapper function for -.I symbol. -Any undefined reference to -.I symbol -will be resolved to -.BI "__wrap_" "symbol". -Any undefined reference to -.BI "__real_" "symbol" -will be resolved to -.I symbol. - -.TP -.B \-X -Delete all temporary local symbols. For most targets, this is all local -symbols whose names begin with `\|\c -.B L\c -\|'. - -.TP -.B \-x -Delete all local symbols. - -.PP - -.SH ENVIRONMENT -\c -You can change the behavior of -.B ld\c -\& with the environment variable \c -.B GNUTARGET\c -\&. - -\c -.B GNUTARGET\c -\& determines the input-file object format if you don't -use \c -.B \-b\c -\& (or its synonym \c -.B \-format\c -\&). Its value should be one -of the BFD names for an input format. If there is no -\c -.B GNUTARGET\c -\& in the environment, \c -.B ld\c -\& uses the natural format -of the host. If \c -.B GNUTARGET\c -\& is set to \c -.B default\c -\& then BFD attempts to discover the -input format by examining binary input files; this method often -succeeds, but there are potential ambiguities, since there is no method -of ensuring that the magic number used to flag object-file formats is -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. - -.PP - -.SH "SEE ALSO" - -.BR objdump ( 1 ) -.br -.br -.RB "`\|" ld "\|' and `\|" binutils "\|'" -entries in -.B info\c -.br -.I -ld: the GNU linker\c -, Steve Chamberlain and Roland Pesch; -.I -The GNU Binary Utilities\c -, Roland H. Pesch. - -.SH COPYING -Copyright (c) 1991, 1992 Free Software Foundation, Inc. -.PP -Permission is granted to make and distribute verbatim copies of -this manual provided the copyright notice and this permission notice -are preserved on all copies. -.PP -Permission is granted to copy and distribute modified versions of this -manual under the conditions for verbatim copying, provided that the -entire resulting derived work is distributed under the terms of a -permission notice identical to this one. -.PP -Permission is granted to copy and distribute translations of this -manual into another language, under the above conditions for modified -versions, except that this permission notice may be included in -translations approved by the Free Software Foundation instead of in -the original English. diff --git a/gnu/dist/ld/ld.h b/gnu/dist/ld/ld.h deleted file mode 100644 index 4375b29aab4e..000000000000 --- a/gnu/dist/ld/ld.h +++ /dev/null @@ -1,177 +0,0 @@ -/* ld.h -- general linker header file - Copyright (C) 1991, 93, 94, 95, 96, 1997 Free Software Foundation, Inc. - - This file is part of GLD, the Gnu Linker. - - GLD 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, or (at your option) - any later version. - - GLD 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 GLD; see the file COPYING. If not, write to the Free - Software Foundation, 59 Temple Place - Suite 330, Boston, MA - 02111-1307, USA. */ - -#ifndef LD_H -#define LD_H - -/* Look in this environment name for the linker to pretend to be */ -#define EMULATION_ENVIRON "LDEMULATION" -/* If in there look for the strings: */ - -/* Look in this variable for a target format */ -#define TARGET_ENVIRON "GNUTARGET" - -/* Input sections which are put in a section of this name are actually - discarded. */ -#define DISCARD_SECTION_NAME "/DISCARD/" - -/* Extra information we hold on sections */ -typedef struct user_section_struct -{ - /* Pointer to the section where this data will go */ - struct lang_input_statement_struct *file; -} section_userdata_type; - - -#define get_userdata(x) ((x)->userdata) - -#define BYTE_SIZE (1) -#define SHORT_SIZE (2) -#define LONG_SIZE (4) -#define QUAD_SIZE (8) - -/* ALIGN macro changed to ALIGN_N to avoid */ -/* conflict in /usr/include/machine/machparam.h */ -/* WARNING: If THIS is a 64 bit address and BOUNDARY is a 32 bit int, - you must coerce boundary to the same type as THIS. - ??? Is there a portable way to avoid this. */ -#define ALIGN_N(this, boundary) \ - ((( (this) + ((boundary) -1)) & (~((boundary)-1)))) - -typedef struct -{ - /* 1 => assign space to common symbols even if `relocatable_output'. */ - boolean force_common_definition; - boolean relax; - - /* Name of runtime interpreter to invoke. */ - char *interpreter; - - /* Name to give runtime libary from the -soname argument. */ - char *soname; - - /* Runtime library search path from the -rpath argument. */ - char *rpath; - - /* Link time runtime library search path from the -rpath-link - argument. */ - char *rpath_link; - - /* Big or little endian as set on command line. */ - enum { ENDIAN_UNSET = 0, ENDIAN_BIG, ENDIAN_LITTLE } endian; - - /* If true, export all symbols in the dynamic symbol table of an ELF - executable. */ - boolean export_dynamic; - - /* If true, build MIPS embedded PIC relocation tables in the output - file. */ - boolean embedded_relocs; - - /* If true, force generation of a file with a .exe file. */ - boolean force_exe_suffix; - - /* If true, generate a cross reference report. */ - boolean cref; - - /* If true (which is the default), warn about mismatched input - files. */ - boolean warn_mismatch; - - /* Name of shared object whose symbol table should be filtered with - this shared object. From the --filter option. */ - char *filter_shlib; - - /* Name of shared object for whose symbol table this shared object - is an auxiliary filter. From the --auxiliary option. */ - char **auxiliary_filters; -} args_type; - -extern args_type command_line; - -typedef int token_code_type; - -typedef struct -{ - bfd_size_type specified_data_size; - boolean magic_demand_paged; - boolean make_executable; - - /* If true, doing a dynamic link. */ - boolean dynamic_link; - - /* If true, do not use SEARCH_DIR directives from the linker script. */ - boolean no_std_path; - - /* If true, build constructors. */ - boolean build_constructors; - - /* If true, warn about any constructors. */ - boolean warn_constructors; - - /* If true, warn about merging common symbols with others. */ - boolean warn_common; - - /* If true, only warn once about a particular undefined symbol. */ - boolean warn_once; - - /* If true, warn if multiple global-pointers are needed (Alpha - only). */ - boolean warn_multiple_gp; - - /* If true, warn if the starting address of an output section - changes due to the alignment of an input section. */ - boolean warn_section_align; - - boolean sort_common; - - boolean text_read_only; - - char *map_filename; - FILE *map_file; - - boolean stats; - - int split_by_reloc; - boolean split_by_file; -} ld_config_type; - -extern ld_config_type config; - -typedef enum -{ - lang_first_phase_enum, - lang_allocating_phase_enum, - lang_final_phase_enum -} lang_phase_type; - -extern boolean had_script; -extern boolean force_make_executable; - -/* Non-zero if we are processing a --defsym from the command line. */ -extern int parsing_defsym; - -extern int yyparse PARAMS ((void)); - -extern void add_cref PARAMS ((const char *, bfd *, asection *, bfd_vma)); -extern void output_cref PARAMS ((FILE *)); -extern void check_nocrossrefs PARAMS ((void)); - -#endif diff --git a/gnu/dist/ld/ld.texinfo b/gnu/dist/ld/ld.texinfo deleted file mode 100644 index 05f3984ef86a..000000000000 --- a/gnu/dist/ld/ld.texinfo +++ /dev/null @@ -1,3700 +0,0 @@ -\input texinfo -@setfilename ld.info -@syncodeindex ky cp -@include configdoc.texi -@c (configdoc.texi is generated by the Makefile) - -@c @smallbook - -@ifinfo -@format -START-INFO-DIR-ENTRY -* Ld: (ld). The GNU linker. -END-INFO-DIR-ENTRY -@end format -@end ifinfo - -@ifinfo -This file documents the @sc{gnu} linker LD. - -Copyright (C) 1991, 92, 93, 94, 95, 96, 97, 1998 Free Software Foundation, Inc. - -Permission is granted to make and distribute verbatim copies of -this manual provided the copyright notice and this permission notice -are preserved on all copies. - -Permission is granted to copy and distribute modified versions of this -manual under the conditions for verbatim copying, provided also that -the entire resulting derived work is distributed under the terms of a -permission notice identical to this one. - -Permission is granted to copy and distribute translations of this manual -into another language, under the above conditions for modified versions. - -@ignore -Permission is granted to process this file through Tex and print the -results, provided the printed document carries copying permission -notice identical to this one except for the removal of this paragraph -(this paragraph not being relevant to the printed manual). - -@end ignore -@end ifinfo -@iftex -@finalout -@setchapternewpage odd -@settitle Using LD, the GNU linker -@titlepage -@title Using ld -@subtitle The GNU linker -@sp 1 -@subtitle @code{ld} version 2 -@subtitle January 1994 -@author Steve Chamberlain -@author Cygnus Support -@page - -@tex -{\parskip=0pt -\hfill Cygnus Support\par -\hfill steve\@cygnus.com, doc\@cygnus.com\par -\hfill {\it Using LD, the GNU linker}\par -\hfill Edited by Jeffrey Osier (jeffrey\@cygnus.com)\par -} -\global\parindent=0pt % Steve likes it this way. -@end tex - -@vskip 0pt plus 1filll -Copyright @copyright{} 1991, 92, 93, 94, 95, 96, 97, 1998 Free Software Foundation, Inc. - -Permission is granted to make and distribute verbatim copies of -this manual provided the copyright notice and this permission notice -are preserved on all copies. - -Permission is granted to copy and distribute modified versions of this -manual under the conditions for verbatim copying, provided also that -the entire resulting derived work is distributed under the terms of a -permission notice identical to this one. - -Permission is granted to copy and distribute translations of this manual -into another language, under the above conditions for modified versions. -@end titlepage -@end iftex -@c FIXME: Talk about importance of *order* of args, cmds to linker! - -@ifinfo -@node Top -@top Using ld -This file documents the @sc{gnu} linker ld. - -@menu -* Overview:: Overview -* Invocation:: Invocation -* Commands:: Command Language -@ifset GENERIC -* Machine Dependent:: Machine Dependent Features -@end ifset -@ifclear GENERIC -@ifset H8300 -* H8/300:: ld and the H8/300 -@end ifset -@ifset Hitachi -* Hitachi:: ld and other Hitachi micros -@end ifset -@ifset I960 -* i960:: ld and the Intel 960 family -@end ifset -@end ifclear -@ifclear SingleFormat -* BFD:: BFD -@end ifclear -@c Following blank line required for remaining bug in makeinfo conds/menus - -* Reporting Bugs:: Reporting Bugs -* MRI:: MRI Compatible Script Files -* Index:: Index -@end menu -@end ifinfo - -@node Overview -@chapter Overview - -@cindex @sc{gnu} linker -@cindex what is this? -@code{ld} combines a number of object and archive files, relocates -their data and ties up symbol references. Usually the last step in -compiling a program is to run @code{ld}. - -@code{ld} accepts Linker Command Language files written in -a superset of AT&T's Link Editor Command Language syntax, -to provide explicit and total control over the linking process. - -@ifclear SingleFormat -This version of @code{ld} uses the general purpose BFD libraries -to operate on object files. This allows @code{ld} to read, combine, and -write object files in many different formats---for example, COFF or -@code{a.out}. Different formats may be linked together to produce any -available kind of object file. @xref{BFD}, for more information. -@end ifclear - -Aside from its flexibility, the @sc{gnu} linker is more helpful than other -linkers in providing diagnostic information. Many linkers abandon -execution immediately upon encountering an error; whenever possible, -@code{ld} continues executing, allowing you to identify other errors -(or, in some cases, to get an output file in spite of the error). - -@node Invocation -@chapter Invocation - -The @sc{gnu} linker @code{ld} is meant to cover a broad range of situations, -and to be as compatible as possible with other linkers. As a result, -you have many choices to control its behavior. - -@ifset UsesEnvVars -@menu -* Options:: Command Line Options -* Environment:: Environment Variables -@end menu - -@node Options -@section Command Line Options -@end ifset - -@cindex command line -@cindex options -The linker supports a plethora of command-line options, but in actual -practice few of them are used in any particular context. -@cindex standard Unix system -For instance, a frequent use of @code{ld} is to link standard Unix -object files on a standard, supported Unix system. On such a system, to -link a file @code{hello.o}: - -@smallexample -ld -o @var{output} /lib/crt0.o hello.o -lc -@end smallexample - -This tells @code{ld} to produce a file called @var{output} as the -result of linking the file @code{/lib/crt0.o} with @code{hello.o} and -the library @code{libc.a}, which will come from the standard search -directories. (See the discussion of the @samp{-l} option below.) - -The command-line options to @code{ld} may be specified in any order, and -may be repeated at will. Repeating most options with a different -argument will either have no further effect, or override prior -occurrences (those further to the left on the command line) of that -option. Options which may be meaningfully specified more than once are -noted in the descriptions below. - -@cindex object files -Non-option arguments are objects files which are to be linked together. -They may follow, precede, or be mixed in with command-line options, -except that an object file argument may not be placed between an option -and its argument. - -Usually the linker is invoked with at least one object file, but you can -specify other forms of binary input files using @samp{-l}, @samp{-R}, -and the script command language. If @emph{no} binary input files at all -are specified, the linker does not produce any output, and issues the -message @samp{No input files}. - -If the linker can not recognize the format of an object file, it will -assume that it is a linker script. A script specified in this way -augments the main linker script used for the link (either the default -linker script or the one specified by using @samp{-T}). This feature -permits the linker to link against a file which appears to be an object -or an archive, but actually merely defines some symbol values, or uses -@code{INPUT} or @code{GROUP} to load other objects. Note that -specifying a script in this way should only be used to augment the main -linker script; if you want to use some command that logically can only -appear once, such as the @code{SECTIONS} or @code{MEMORY} command, you -must replace the default linker script using the @samp{-T} option. -@xref{Commands}. - -For options whose names are a single letter, -option arguments must either follow the option letter without intervening -whitespace, or be given as separate arguments immediately following the -option that requires them. - -For options whose names are multiple letters, either one dash or two can -precede the option name; for example, @samp{--oformat} and -@samp{--oformat} are equivalent. Arguments to multiple-letter options -must either be separated from the option name by an equals sign, or be -given as separate arguments immediately following the option that -requires them. For example, @samp{--oformat srec} and -@samp{--oformat=srec} are equivalent. Unique abbreviations of the names -of multiple-letter options are accepted. - -@table @code -@kindex -a@var{keyword} -@item -a@var{keyword} -This option is supported for HP/UX compatibility. The @var{keyword} -argument must be one of the strings @samp{archive}, @samp{shared}, or -@samp{default}. @samp{-aarchive} is functionally equivalent to -@samp{-Bstatic}, and the other two keywords are functionally equivalent -to @samp{-Bdynamic}. This option may be used any number of times. - -@ifset I960 -@cindex architectures -@kindex -A@var{arch} -@item -A@var{architecture} -@kindex --architecture=@var{arch} -@itemx --architecture=@var{architecture} -In the current release of @code{ld}, this option is useful only for the -Intel 960 family of architectures. In that @code{ld} configuration, the -@var{architecture} argument identifies the particular architecture in -the 960 family, enabling some safeguards and modifying the -archive-library search path. @xref{i960,,@code{ld} and the Intel 960 -family}, for details. - -Future releases of @code{ld} may support similar functionality for -other architecture families. -@end ifset - -@ifclear SingleFormat -@cindex binary input format -@kindex -b @var{format} -@kindex --format=@var{format} -@cindex input format -@cindex input format -@item -b @var{input-format} -@itemx --format=@var{input-format} -@code{ld} may be configured to support more than one kind of object -file. If your @code{ld} is configured this way, you can use the -@samp{-b} option to specify the binary format for input object files -that follow this option on the command line. Even when @code{ld} is -configured to support alternative object formats, you don't usually need -to specify this, as @code{ld} should be configured to expect as a -default input format the most usual format on each machine. -@var{input-format} is a text string, the name of a particular format -supported by the BFD libraries. (You can list the available binary -formats with @samp{objdump -i}.) -@xref{BFD}. - -You may want to use this option if you are linking files with an unusual -binary format. You can also use @samp{-b} to switch formats explicitly (when -linking object files of different formats), by including -@samp{-b @var{input-format}} before each group of object files in a -particular format. - -The default format is taken from the environment variable -@code{GNUTARGET}. -@ifset UsesEnvVars -@xref{Environment}. -@end ifset -You can also define the input -format from a script, using the command @code{TARGET}; see @ref{Option -Commands}. -@end ifclear - -@kindex -c @var{MRI-cmdfile} -@kindex --mri-script=@var{MRI-cmdfile} -@cindex compatibility, MRI -@item -c @var{MRI-commandfile} -@itemx --mri-script=@var{MRI-commandfile} -For compatibility with linkers produced by MRI, @code{ld} accepts script -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 -@kindex -dc -@kindex -dp -@item -d -@itemx -dc -@itemx -dp -These three options are equivalent; multiple forms are supported for -compatibility with other linkers. They -assign space to common symbols even if a relocatable output file is -specified (with @samp{-r}). The script command -@code{FORCE_COMMON_ALLOCATION} has the same effect. @xref{Option -Commands}. - -@cindex entry point, from command line -@kindex -e @var{entry} -@kindex --entry=@var{entry} -@item -e @var{entry} -@itemx --entry=@var{entry} -Use @var{entry} as the explicit symbol for beginning execution of your -program, rather than the default entry point. @xref{Entry Point}, for a -discussion of defaults and other ways of specifying the -entry point. - -@cindex dynamic symbol table -@kindex -E -@kindex --export-dynamic -@item -E -@itemx --export-dynamic -When creating a dynamically linked executable, add all symbols to the -dynamic symbol table. The dynamic symbol table is the set of symbols -which are visible from dynamic objects at run time. - -If you do not use this option, the dynamic symbol table will normally -contain only those symbols which are referenced by some dynamic object -mentioned in the link. - -If you use @code{dlopen} to load a dynamic object which needs to refer -back to the symbols defined by the program, rather than some other -dynamic object, then you will probably need to use this option when -linking the program itself. - -@kindex -f -@kindex --auxiliary -@item -f -@itemx --auxiliary @var{name} -When creating an ELF shared object, set the internal DT_AUXILIARY field -to the specified name. This tells the dynamic linker that the symbol -table of the shared object should be used as an auxiliary filter on the -symbol table of the shared object @var{name}. - -If you later link a program against this filter object, then, when you -run the program, the dynamic linker will see the DT_AUXILIARY field. If -the dynamic linker resolves any symbols from the filter object, it will -first check whether there is a definition in the shared object -@var{name}. If there is one, it will be used instead of the definition -in the filter object. The shared object @var{name} need not exist. -Thus the shared object @var{name} may be used to provide an alternative -implementation of certain functions, perhaps for debugging or for -machine specific performance. - -This option may be specified more than once. The DT_AUXILIARY entries -will be created in the order in which they appear on the command line. - -@kindex -F -@kindex --filter -@item -F @var{name} -@itemx --filter @var{name} -When creating an ELF shared object, set the internal DT_FILTER field to -the specified name. This tells the dynamic linker that the symbol table -of the shared object which is being created should be used as a filter -on the symbol table of the shared object @var{name}. - -If you later link a program against this filter object, then, when you -run the program, the dynamic linker will see the DT_FILTER field. The -dynamic linker will resolve symbols according to the symbol table of the -filter object as usual, but it will actually link to the definitions -found in the shared object @var{name}. Thus the filter object can be -used to select a subset of the symbols provided by the object -@var{name}. - -Some older linkers used the @code{-F} option throughout a compilation -toolchain for specifying object-file format for both input and output -object files. The @sc{gnu} linker uses other mechanisms for this -purpose: the @code{-b}, @code{--format}, @code{--oformat} options, the -@code{TARGET} command in linker scripts, and the @code{GNUTARGET} -environment variable. The @sc{gnu} linker will ignore the @code{-F} -option when not creating an ELF shared object. - -@kindex --force-exe-suffix -@item --force-exe-suffix -Make sure that an output file has a .exe suffix. - -If a successfully built fully linked output file does not have a -@code{.exe} or @code{.dll} suffix, this option forces the linker to copy -the output file to one of the same name with a @code{.exe} suffix. This -option is useful when using unmodified Unix makefiles on a Microsoft -Windows host, since some versions of Windows won't run an image unless -it ends in a @code{.exe} suffix. - -@kindex -g -@item -g -Ignored. Provided for compatibility with other tools. - -@kindex -G -@kindex --gpsize -@cindex object size -@item -G@var{value} -@itemx --gpsize=@var{value} -Set the maximum size of objects to be optimized using the GP register to -@var{size}. This is only meaningful for object file formats such as -MIPS ECOFF which supports putting large and small objects into different -sections. This is ignored for other object file formats. - -@cindex runtime library name -@kindex -h@var{name} -@kindex -soname=@var{name} -@item -h@var{name} -@itemx -soname=@var{name} -When creating an ELF shared object, set the internal DT_SONAME field to -the specified name. When an executable is linked with a shared object -which has a DT_SONAME field, then when the executable is run the dynamic -linker will attempt to load the shared object specified by the DT_SONAME -field rather than the using the file name given to the linker. - -@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{archive} -@kindex --library=@var{archive} -@item -l@var{archive} -@itemx --library=@var{archive} -Add archive file @var{archive} to the list of files to link. This -option may be used any number of times. @code{ld} will search its -path-list for occurrences of @code{lib@var{archive}.a} for every -@var{archive} specified. - -On systems which support shared libraries, @code{ld} may also search for -libraries with extensions other than @code{.a}. Specifically, on ELF -and SunOS systems, @code{ld} will search a directory for a library with -an extension of @code{.so} before searching for one with an extension of -@code{.a}. By convention, a @code{.so} extension indicates a shared -library. - -The linker will search an archive only once, at the location where it is -specified on the command line. If the archive defines a symbol which -was undefined in some object which appeared before the archive on the -command line, the linker will include the appropriate file(s) from the -archive. However, an undefined symbol in an object appearing later on -the command line will not cause the linker to search the archive again. - -See the @code{-(} option for a way to force the linker to search -archives multiple times. - -You may list the same archive multiple times on the command line. - -@ifset GENERIC -This type of archive searching is standard for Unix linkers. However, -if you are using @code{ld} on AIX, note that it is different from the -behaviour of the AIX linker. -@end ifset - -@cindex search directory, from cmd line -@kindex -L@var{dir} -@kindex --library-path=@var{dir} -@item -L@var{searchdir} -@itemx --library-path=@var{searchdir} -Add path @var{searchdir} to the list of paths that @code{ld} will search -for archive libraries and @code{ld} control scripts. You may use this -option any number of times. The directories are searched in the order -in which they are specified on the command line. Directories specified -on the command line are searched before the default directories. All -@code{-L} options apply to all @code{-l} options, regardless of the -order in which the options appear. - -@ifset UsesEnvVars -The default set of paths searched (without being specified with -@samp{-L}) depends on which emulation mode @code{ld} is using, and in -some cases also on how it was configured. @xref{Environment}. -@end ifset - -The paths can also be specified in a link script with the -@code{SEARCH_DIR} command. Directories specified this way are searched -at the point in which the linker script appears in the command line. - -@cindex emulation -@kindex -m @var{emulation} -@item -m@var{emulation} -Emulate the @var{emulation} linker. You can list the available -emulations with the @samp{--verbose} or @samp{-V} options. - -If the @samp{-m} option is not used, the emulation is taken from the -@code{LDEMULATION} environment variable, if that is defined. - -Otherwise, the default emulation depends upon how the linker was -configured. - -@cindex link map -@kindex -M -@kindex --print-map -@item -M -@itemx --print-map -Print a link map to the standard output. A link map provides -information about the link, including the following: - -@itemize @bullet -@item -Where object files and symbols are mapped into memory. -@item -How common symbols are allocated. -@item -All archive members included in the link, with a mention of the symbol -which caused the archive member to be brought in. -@end itemize - -@kindex -n -@cindex read-only text -@cindex NMAGIC -@kindex --nmagic -@item -n -@itemx --nmagic -Set the text segment to be read only, and mark the output as -@code{NMAGIC} if possible. - -@kindex -N -@kindex --omagic -@cindex read/write from cmd line -@cindex OMAGIC -@item -N -@itemx --omagic -Set the text and data sections to be readable and writable. Also, do -not page-align the data segment. If the output format supports Unix -style magic numbers, mark the output as @code{OMAGIC}. - -@kindex -o @var{output} -@kindex --output=@var{output} -@cindex naming the output file -@item -o @var{output} -@itemx --output=@var{output} -Use @var{output} as the name for the program produced by @code{ld}; if this -option is not specified, the name @file{a.out} is used by default. The -script command @code{OUTPUT} can also specify the output file name. - -@cindex partial link -@cindex relocatable output -@kindex -r -@kindex --relocateable -@item -r -@itemx --relocateable -Generate relocatable output---i.e., generate an output file that can in -turn serve as input to @code{ld}. This is often called @dfn{partial -linking}. As a side effect, in environments that support standard Unix -magic numbers, this option also sets the output file's magic number to -@code{OMAGIC}. -@c ; see @code{-N}. -If this option is not specified, an absolute file is produced. When -linking C++ programs, this option @emph{will not} resolve references to -constructors; to do that, use @samp{-Ur}. - -This option does the same thing as @samp{-i}. - -@kindex -R @var{file} -@kindex --just-symbols=@var{file} -@cindex symbol-only input -@item -R @var{filename} -@itemx --just-symbols=@var{filename} -Read symbol names and their addresses from @var{filename}, but do not -relocate it or include it in the output. This allows your output file -to refer symbolically to absolute locations of memory defined in other -programs. You may use this option more than once. - -For compatibility with other ELF linkers, if the @code{-R} option is -followed by a directory name, rather than a file name, it is treated as -the @code{-rpath} option. - -@kindex -s -@kindex --strip-all -@cindex strip all symbols -@item -s -@itemx --strip-all -Omit all symbol information from the output file. - -@kindex -S -@kindex --strip-debug -@cindex strip debugger symbols -@item -S -@itemx --strip-debug -Omit debugger symbol information (but not all symbols) from the output file. - -@kindex -t -@kindex --trace -@cindex input files, displaying -@item -t -@itemx --trace -Print the names of the input files as @code{ld} processes them. - -@kindex -T @var{script} -@kindex --script=@var{script} -@cindex script files -@item -T @var{commandfile} -@itemx --script=@var{commandfile} -Read link commands from the file @var{commandfile}. These commands -replace @code{ld}'s default link script (rather than adding to it), so -@var{commandfile} must specify everything necessary to describe the -target format. You must use this option if you want to use a command -which can only appear once in a linker script, such as the -@code{SECTIONS} or @code{MEMORY} command. @xref{Commands}. If -@var{commandfile} does not exist, @code{ld} looks for it in the -directories specified by any preceding @samp{-L} options. Multiple -@samp{-T} options accumulate. - -@kindex -u @var{symbol} -@kindex --undefined=@var{symbol} -@cindex undefined symbol -@item -u @var{symbol} -@itemx --undefined=@var{symbol} -Force @var{symbol} to be entered in the output file as an undefined symbol. -Doing this may, for example, trigger linking of additional modules from -standard libraries. @samp{-u} may be repeated with different option -arguments to enter additional undefined symbols. -@c Nice idea, but no such command: This option is equivalent -@c to the @code{EXTERN} linker command. - -@kindex -v -@kindex -V -@kindex --version -@cindex version -@item -v -@itemx --version -@itemx -V -Display the version number for @code{ld}. The @code{-V} option also -lists the supported emulations. - -@kindex -x -@kindex --discard-all -@cindex deleting local symbols -@item -x -@itemx --discard-all -Delete all local symbols. - -@kindex -X -@kindex --discard-locals -@cindex local symbols, deleting -@cindex L, deleting symbols beginning -@item -X -@itemx --discard-locals -Delete all temporary local symbols. For most targets, this is all local -symbols whose names begin with @samp{L}. - -@kindex -y @var{symbol} -@kindex --trace-symbol=@var{symbol} -@cindex symbol tracing -@item -y @var{symbol} -@itemx --trace-symbol=@var{symbol} -Print the name of each linked file in which @var{symbol} appears. This -option may be given any number of times. On many systems it is necessary -to prepend an underscore. - -This option is useful when you have an undefined symbol in your link but -don't know where the reference is coming from. - -@kindex -Y @var{path} -@item -Y @var{path} -Add @var{path} to the default library search path. This option exists -for Solaris compatibility. - -@kindex -z @var{keyword} -@item -z @var{keyword} -This option is ignored for Solaris compatibility. - -@kindex -( -@cindex groups of archives -@item -( @var{archives} -) -@itemx --start-group @var{archives} --end-group -The @var{archives} should be a list of archive files. They may be -either explicit file names, or @samp{-l} options. - -The specified archives are searched repeatedly until no new undefined -references are created. Normally, an archive is searched only once in -the order that it is specified on the command line. If a symbol in that -archive is needed to resolve an undefined symbol referred to by an -object in an archive that appears later on the command line, the linker -would not be able to resolve that reference. By grouping the archives, -they all be searched repeatedly until all possible references are -resolved. - -Using this option has a significant performance cost. It is best to use -it only when there are unavoidable circular references between two or -more archives. - -@kindex -assert @var{keyword} -@item -assert @var{keyword} -This option is ignored for SunOS compatibility. - -@kindex -Bdynamic -@kindex -dy -@kindex -call_shared -@item -Bdynamic -@itemx -dy -@itemx -call_shared -Link against dynamic libraries. This is only meaningful on platforms -for which shared libraries are supported. This option is normally the -default on such platforms. The different variants of this option are -for compatibility with various systems. You may use this option -multiple times on the command line: it affects library searching for -@code{-l} options which follow it. - -@kindex -Bstatic -@kindex -dn -@kindex -non_shared -@kindex -static -@item -Bstatic -@itemx -dn -@itemx -non_shared -@itemx -static -Do not link against shared libraries. This is only meaningful on -platforms for which shared libraries are supported. The different -variants of this option are for compatibility with various systems. You -may use this option multiple times on the command line: it affects -library searching for @code{-l} options which follow it. - -@kindex -Bsymbolic -@item -Bsymbolic -When creating a shared library, bind references to global symbols to the -definition within the shared library, if any. Normally, it is possible -for a program linked against a shared library to override the definition -within the shared library. This option is only meaningful on ELF -platforms which support shared libraries. - -@cindex cross reference table -@kindex --cref -@item --cref -Output a cross reference table. If a linker map file is being -generated, the cross reference table is printed to the map file. -Otherwise, it is printed on the standard output. - -The format of the table is intentionally simple, so that it may be -easily processed by a script if necessary. The symbols are printed out, -sorted by name. For each symbol, a list of file names is given. If the -symbol is defined, the first file listed is the location of the -definition. The remaining files contain references to the symbol. - -@cindex symbols, from command line -@kindex --defsym @var{symbol}=@var{exp} -@item --defsym @var{symbol}=@var{expression} -Create a global symbol in the output file, containing the absolute -address given by @var{expression}. You may use this option as many -times as necessary to define multiple symbols in the command line. A -limited form of arithmetic is supported for the @var{expression} in this -context: you may give a hexadecimal constant or the name of an existing -symbol, or use @code{+} and @code{-} to add or subtract hexadecimal -constants or symbols. If you need more elaborate expressions, consider -using the linker command language from a script (@pxref{Assignment, , -Assignment: Symbol Definitions}). @emph{Note:} there should be no -white space between @var{symbol}, the equals sign (``@key{=}''), and -@var{expression}. - -@cindex dynamic linker, from command line -@kindex --dynamic-linker @var{file} -@item --dynamic-linker @var{file} -Set the name of the dynamic linker. This is only meaningful when -generating dynamically linked ELF executables. The default dynamic -linker is normally correct; don't use this unless you know what you are -doing. - -@cindex big-endian objects -@cindex endianness -@kindex -EB -@item -EB -Link big-endian objects. This affects the default output format. - -@cindex little-endian objects -@kindex -EL -@item -EL -Link little-endian objects. This affects the default output format. - -@cindex MIPS embedded PIC code -@kindex --embedded-relocs -@item --embedded-relocs -This option is only meaningful when linking MIPS embedded PIC code, -generated by the -membedded-pic option to the @sc{gnu} compiler and -assembler. It causes the linker to create a table which may be used at -runtime to relocate any data which was statically initialized to pointer -values. See the code in testsuite/ld-empic for details. - -@cindex help -@cindex usage -@kindex --help -@item --help -Print a summary of the command-line options on the standard output and exit. - -@kindex -Map -@item -Map @var{mapfile} -Print a link map to the file @var{mapfile}. See the description of the -@samp{-M} option, above. - -@cindex memory usage -@kindex --no-keep-memory -@item --no-keep-memory -@code{ld} normally optimizes for speed over memory usage by caching the -symbol tables of input files in memory. This option tells @code{ld} to -instead optimize for memory usage, by rereading the symbol tables as -necessary. This may be required if @code{ld} runs out of memory space -while linking a large executable. - -@kindex --no-warn-mismatch -@item --no-warn-mismatch -Normally @code{ld} will give an error if you try to link together input -files that are mismatched for some reason, perhaps because they have -been compiled for different processors or for different endiannesses. -This option tells @code{ld} that it should silently permit such possible -errors. This option should only be used with care, in cases when you -have taken some special action that ensures that the linker errors are -inappropriate. - -@kindex --no-whole-archive -@item --no-whole-archive -Turn off the effect of the @code{--whole-archive} option for subsequent -archive files. - -@cindex output file after errors -@kindex --noinhibit-exec -@item --noinhibit-exec -Retain the executable output file whenever it is still usable. -Normally, the linker will not produce an output file if it encounters -errors during the link process; it exits without writing an output file -when it issues any error whatsoever. - -@ifclear SingleFormat -@kindex --oformat -@item --oformat @var{output-format} -@code{ld} may be configured to support more than one kind of object -file. If your @code{ld} is configured this way, you can use the -@samp{--oformat} option to specify the binary format for the output -object file. Even when @code{ld} is configured to support alternative -object formats, you don't usually need to specify this, as @code{ld} -should be configured to produce as a default output format the most -usual format on each machine. @var{output-format} is a text string, the -name of a particular format supported by the BFD libraries. (You can -list the available binary formats with @samp{objdump -i}.) The script -command @code{OUTPUT_FORMAT} can also specify the output format, but -this option overrides it. @xref{BFD}. -@end ifclear - -@kindex -qmagic -@item -qmagic -This option is ignored for Linux compatibility. - -@kindex -Qy -@item -Qy -This option is ignored for SVR4 compatibility. - -@kindex --relax -@cindex synthesizing linker -@cindex relaxing addressing modes -@item --relax -An option with machine dependent effects. -@ifset GENERIC -This option is only supported on a few targets. -@end ifset -@ifset H8300 -@xref{H8/300,,@code{ld} and the H8/300}. -@end ifset -@ifset I960 -@xref{i960,, @code{ld} and the Intel 960 family}. -@end ifset - -On some platforms, the @samp{--relax} option performs global -optimizations that become possible when the linker resolves addressing -in the program, such as relaxing address modes and synthesizing new -instructions in the output object file. - -@ifset GENERIC -On platforms where this is not supported, @samp{--relax} is accepted, -but ignored. -@end ifset - -@cindex retaining specified symbols -@cindex stripping all but some symbols -@cindex symbols, retaining selectively -@item --retain-symbols-file @var{filename} -Retain @emph{only} the symbols listed in the file @var{filename}, -discarding all others. @var{filename} is simply a flat file, with one -symbol name per line. This option is especially useful in environments -@ifset GENERIC -(such as VxWorks) -@end ifset -where a large global symbol table is accumulated gradually, to conserve -run-time memory. - -@samp{--retain-symbols-file} does @emph{not} discard undefined symbols, -or symbols needed for relocations. - -You may only specify @samp{--retain-symbols-file} once in the command -line. It overrides @samp{-s} and @samp{-S}. - -@ifset GENERIC -@item -rpath @var{dir} -@cindex runtime library search path -@kindex -rpath -Add a directory to the runtime library search path. This is used when -linking an ELF executable with shared objects. All @code{-rpath} -arguments are concatenated and passed to the runtime linker, which uses -them to locate shared objects at runtime. The @code{-rpath} option is -also used when locating shared objects which are needed by shared -objects explicitly included in the link; see the description of the -@code{-rpath-link} option. If @code{-rpath} is not used when linking an -ELF executable, the contents of the environment variable -@code{LD_RUN_PATH} will be used if it is defined. - -The @code{-rpath} option may also be used on SunOS. By default, on -SunOS, the linker will form a runtime search patch out of all the -@code{-L} options it is given. If a @code{-rpath} option is used, the -runtime search path will be formed exclusively using the @code{-rpath} -options, ignoring the @code{-L} options. This can be useful when using -gcc, which adds many @code{-L} options which may be on NFS mounted -filesystems. - -For compatibility with other ELF linkers, if the @code{-R} option is -followed by a directory name, rather than a file name, it is treated as -the @code{-rpath} option. -@end ifset - -@ifset GENERIC -@cindex link-time runtime library search path -@kindex -rpath-link -@item -rpath-link @var{DIR} -When using ELF or SunOS, one shared library may require another. This -happens when an @code{ld -shared} link includes a shared library as one -of the input files. - -When the linker encounters such a dependency when doing a non-shared, -non-relocateable link, it will automatically try to locate the required -shared library and include it in the link, if it is not included -explicitly. In such a case, the @code{-rpath-link} option -specifies the first set of directories to search. The -@code{-rpath-link} option may specify a sequence of directory names -either by specifying a list of names separated by colons, or by -appearing multiple times. - -The linker uses the following search paths to locate required shared -libraries. -@enumerate -@item -Any directories specified by @code{-rpath-link} options. -@item -Any directories specified by @code{-rpath} options. The difference -between @code{-rpath} and @code{-rpath-link} is that directories -specified by @code{-rpath} options are included in the executable and -used at runtime, whereas the @code{-rpath-link} option is only effective -at link time. -@item -On an ELF system, if the @code{-rpath} and @code{rpath-link} options -were not used, search the contents of the environment variable -@code{LD_RUN_PATH}. -@item -On SunOS, if the @code{-rpath} option was not used, search any -directories specified using @code{-L} options. -@item -For a native linker, the contents of the environment variable -@code{LD_LIBRARY_PATH}. -@item -The default directories, normally @file{/lib} and @file{/usr/lib}. -@end enumerate - -If the required shared library is not found, the linker will issue a -warning and continue with the link. -@end ifset - -@kindex -shared -@kindex -Bshareable -@item -shared -@itemx -Bshareable -@cindex shared libraries -Create a shared library. This is currently only supported on ELF, XCOFF -and SunOS platforms. On SunOS, the linker will automatically create a -shared library if the @code{-e} option is not used and there are -undefined symbols in the link. - -@item --sort-common -@kindex --sort-common -This option tells @code{ld} to sort the common symbols by size when it -places them in the appropriate output sections. First come all the one -byte symbols, then all the two bytes, then all the four bytes, and then -everything else. This is to prevent gaps between symbols due to -alignment constraints. - -@kindex --split-by-file -@item --split-by-file -Similar to @code{--split-by-reloc} but creates a new output section for -each input file. - -@kindex --split-by-reloc -@item --split-by-reloc @var{count} -Trys to creates extra sections in the output file so that no single -output section in the file contains more than @var{count} relocations. -This is useful when generating huge relocatable for downloading into -certain real time kernels with the COFF object file format; since COFF -cannot represent more than 65535 relocations in a single section. Note -that this will fail to work with object file formats which do not -support arbitrary sections. The linker will not split up individual -input sections for redistribution, so if a single input section contains -more than @var{count} relocations one output section will contain that -many relocations. - -@kindex --stats -@item --stats -Compute and display statistics about the operation of the linker, such -as execution time and memory usage. - -@kindex --traditional-format -@cindex traditional format -@item --traditional-format -For some targets, the output of @code{ld} is different in some ways from -the output of some existing linker. This switch requests @code{ld} to -use the traditional format instead. - -@cindex dbx -For example, on SunOS, @code{ld} combines duplicate entries in the -symbol string table. This can reduce the size of an output file with -full debugging information by over 30 percent. Unfortunately, the SunOS -@code{dbx} program can not read the resulting program (@code{gdb} has no -trouble). The @samp{--traditional-format} switch tells @code{ld} to not -combine duplicate entries. - -@kindex -Tbss @var{org} -@kindex -Tdata @var{org} -@kindex -Ttext @var{org} -@cindex segment origins, cmd line -@item -Tbss @var{org} -@itemx -Tdata @var{org} -@itemx -Ttext @var{org} -Use @var{org} as the starting address for---respectively---the -@code{bss}, @code{data}, or the @code{text} segment of the output file. -@var{org} must be a single hexadecimal integer; -for compatibility with other linkers, you may omit the leading -@samp{0x} usually associated with hexadecimal values. - -@kindex -Ur -@cindex constructors -@item -Ur -For anything other than C++ programs, this option is equivalent to -@samp{-r}: it generates relocatable output---i.e., an output file that can in -turn serve as input to @code{ld}. When linking C++ programs, @samp{-Ur} -@emph{does} resolve references to constructors, unlike @samp{-r}. -It does not work to use @samp{-Ur} on files that were themselves linked -with @samp{-Ur}; once the constructor table has been built, it cannot -be added to. Use @samp{-Ur} only for the last partial link, and -@samp{-r} for the others. - -@kindex --verbose -@cindex verbose -@item --verbose -Display the version number for @code{ld} and list the linker emulations -supported. Display which input files can and cannot be opened. Display -the linker script if using a default builtin script. - -@kindex --version-script=@var{version-scriptfile} -@cindex version script, symbol versions -@itemx --version-script=@var{version-scriptfile} -Specify the name of a version script to the linker. This is typically -used when creating shared libraries to specify additional information -about the version heirarchy for the library being created. This option -is only meaningful on ELF platforms which support shared libraries. -@xref{Version Script}. - -@kindex --warn-comon -@cindex warnings, on combining symbols -@cindex combining symbols, warnings on -@item --warn-common -Warn when a common symbol is combined with another common symbol or with -a symbol definition. Unix linkers allow this somewhat sloppy practice, -but linkers on some other operating systems do not. This option allows -you to find potential problems from combining global symbols. -Unfortunately, some C libraries use this practice, so you may get some -warnings about symbols in the libraries as well as in your programs. - -There are three kinds of global symbols, illustrated here by C examples: - -@table @samp -@item int i = 1; -A definition, which goes in the initialized data section of the output -file. - -@item extern int i; -An undefined reference, which does not allocate space. -There must be either a definition or a common symbol for the -variable somewhere. - -@item int i; -A common symbol. If there are only (one or more) common symbols for a -variable, it goes in the uninitialized data area of the output file. -The linker merges multiple common symbols for the same variable into a -single symbol. If they are of different sizes, it picks the largest -size. The linker turns a common symbol into a declaration, if there is -a definition of the same variable. -@end table - -The @samp{--warn-common} option can produce five kinds of warnings. -Each warning consists of a pair of lines: the first describes the symbol -just encountered, and the second describes the previous symbol -encountered with the same name. One or both of the two symbols will be -a common symbol. - -@enumerate -@item -Turning a common symbol into a reference, because there is already a -definition for the symbol. -@smallexample -@var{file}(@var{section}): warning: common of `@var{symbol}' - overridden by definition -@var{file}(@var{section}): warning: defined here -@end smallexample - -@item -Turning a common symbol into a reference, because a later definition for -the symbol is encountered. This is the same as the previous case, -except that the symbols are encountered in a different order. -@smallexample -@var{file}(@var{section}): warning: definition of `@var{symbol}' - overriding common -@var{file}(@var{section}): warning: common is here -@end smallexample - -@item -Merging a common symbol with a previous same-sized common symbol. -@smallexample -@var{file}(@var{section}): warning: multiple common - of `@var{symbol}' -@var{file}(@var{section}): warning: previous common is here -@end smallexample - -@item -Merging a common symbol with a previous larger common symbol. -@smallexample -@var{file}(@var{section}): warning: common of `@var{symbol}' - overridden by larger common -@var{file}(@var{section}): warning: larger common is here -@end smallexample - -@item -Merging a common symbol with a previous smaller common symbol. This is -the same as the previous case, except that the symbols are -encountered in a different order. -@smallexample -@var{file}(@var{section}): warning: common of `@var{symbol}' - overriding smaller common -@var{file}(@var{section}): warning: smaller common is here -@end smallexample -@end enumerate - -@kindex --warn-constructors -@item --warn-constructors -Warn if any global constructors are used. This is only useful for a few -object file formats. For formats like COFF or ELF, the linker can not -detect the use of global constructors. - -@kindex --warn-multiple-gp -@item --warn-multiple-gp -Warn if multiple global pointer values are required in the output file. -This is only meaningful for certain processors, such as the Alpha. -Specifically, some processors put large-valued constants in a special -section. A special register (the global pointer) points into the middle -of this section, so that constants can be loaded efficiently via a -base-register relative addressing mode. Since the offset in -base-register relative mode is fixed and relatively small (e.g., 16 -bits), this limits the maximum size of the constant pool. Thus, in -large programs, it is often necessary to use multiple global pointer -values in order to be able to address all possible constants. This -option causes a warning to be issued whenever this case occurs. - -@kindex --warn-once -@cindex warnings, on undefined symbols -@cindex undefined symbols, warnings on -@item --warn-once -Only warn once for each undefined symbol, rather than once per module -which refers to it. - -@kindex --warn-section-align -@cindex warnings, on section alignment -@cindex section alignment, warnings on -@item --warn-section-align -Warn if the address of an output section is changed because of -alignment. Typically, the alignment will be set by an input section. -The address will only be changed if it not explicitly specified; that -is, if the @code{SECTIONS} command does not specify a start address for -the section (@pxref{SECTIONS}). - -@kindex --whole-archive -@cindex including an entire archive -@item --whole-archive -For each archive mentioned on the command line after the -@code{--whole-archive} option, include every object file in the archive -in the link, rather than searching the archive for the required object -files. This is normally used to turn an archive file into a shared -library, forcing every object to be included in the resulting shared -library. This option may be used more than once. - -@kindex --wrap -@item --wrap @var{symbol} -Use a wrapper function for @var{symbol}. Any undefined reference to -@var{symbol} will be resolved to @code{__wrap_@var{symbol}}. Any -undefined reference to @code{__real_@var{symbol}} will be resolved to -@var{symbol}. - -This can be used to provide a wrapper for a system function. The -wrapper function should be called @code{__wrap_@var{symbol}}. If it -wishes to call the system function, it should call -@code{__real_@var{symbol}}. - -Here is a trivial example: - -@smallexample -void * -__wrap_malloc (int c) -@{ - printf ("malloc called with %ld\n", c); - return __real_malloc (c); -@} -@end smallexample - -If you link other code with this file using @code{--wrap malloc}, then -all calls to @code{malloc} will call the function @code{__wrap_malloc} -instead. The call to @code{__real_malloc} in @code{__wrap_malloc} will -call the real @code{malloc} function. - -You may wish to provide a @code{__real_malloc} function as well, so that -links without the @code{--wrap} option will succeed. If you do this, -you should not put the definition of @code{__real_malloc} in the same -file as @code{__wrap_malloc}; if you do, the assembler may resolve the -call before the linker has a chance to wrap it to @code{malloc}. - -@end table - -@ifset UsesEnvVars -@node Environment -@section Environment Variables - -You can change the behavior of @code{ld} with the environment variables -@code{GNUTARGET} and @code{LDEMULATION}. - -@kindex GNUTARGET -@cindex default input format -@code{GNUTARGET} determines the input-file object format if you don't -use @samp{-b} (or its synonym @samp{--format}). Its value should be one -of the BFD names for an input format (@pxref{BFD}). If there is no -@code{GNUTARGET} in the environment, @code{ld} uses the natural format -of the target. If @code{GNUTARGET} is set to @code{default} then BFD -attempts to discover the input format by examining binary input files; -this method often succeeds, but there are potential ambiguities, since -there is no method of ensuring that the magic number used to specify -object-file formats is 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. - -@kindex LDEMULATION -@cindex default emulation -@cindex emulation, default -@code{LDEMULATION} determines the default emulation if you don't use the -@samp{-m} option. The emulation can affect various aspects of linker -behaviour, particularly the default linker script. You can list the -available emulations with the @samp{--verbose} or @samp{-V} options. If -the @samp{-m} option is not used, and the @code{LDEMULATION} environment -variable is not defined, the default emulation depends upon how the -linker was configured. -@end ifset - -@node Commands -@chapter Command Language - -@cindex command files -The command language provides explicit control over the link process, -allowing complete specification of the mapping between the linker's -input files and its output. It controls: -@itemize @bullet -@item -input files -@item -file formats -@item -output file layout -@item -addresses of sections -@item -placement of common blocks -@end itemize - -You may supply a command file (also known as a linker script) to the -linker either explicitly through the @samp{-T} option, or implicitly as -an ordinary file. Normally you should use the @samp{-T} option. An -implicit linker script should only be used when you want to augment, -rather than replace, the default linker script; typically an implicit -linker script would consist only of @code{INPUT} or @code{GROUP} -commands. - -If the linker opens a file which it cannot recognize as a supported -object or archive format, nor as a linker script, it reports an error. - -@menu -* Scripts:: Linker Scripts -* Expressions:: Expressions -* MEMORY:: MEMORY Command -* SECTIONS:: SECTIONS Command -* PHDRS:: PHDRS Command -* Entry Point:: The Entry Point -* Version Script:: Version Script -* Option Commands:: Option Commands -@end menu - -@node Scripts -@section Linker Scripts -The @code{ld} command language is a collection of statements; some are -simple keywords setting a particular option, some are used to select and -group input files or name output files; and two statement -types have a fundamental and pervasive impact on the linking process. - -@cindex fundamental script commands -@cindex commands, fundamental -@cindex output file layout -@cindex layout of output file -The most fundamental command of the @code{ld} command language is the -@code{SECTIONS} command (@pxref{SECTIONS}). Every meaningful command -script must have a @code{SECTIONS} command: it specifies a -``picture'' of the output file's layout, in varying degrees of detail. -No other command is required in all cases. - -The @code{MEMORY} command complements @code{SECTIONS} by describing the -available memory in the target architecture. This command is optional; -if you don't use a @code{MEMORY} command, @code{ld} assumes sufficient -memory is available in a contiguous block for all output. -@xref{MEMORY}. - -@cindex comments -You may include comments in linker scripts just as in C: delimited -by @samp{/*} and @samp{*/}. As in C, comments are syntactically -equivalent to whitespace. - -@node Expressions -@section Expressions -@cindex expression syntax -@cindex arithmetic -Many useful commands involve arithmetic expressions. The syntax for -expressions in the command language is identical to that of C -expressions, with the following features: -@itemize @bullet -@item -All expressions evaluated as integers and -are of ``long'' or ``unsigned long'' type. -@item -All constants are integers. -@item -All of the C arithmetic operators are provided. -@item -You may reference, define, and create global variables. -@item -You may call special purpose built-in functions. -@end itemize - -@menu -* Integers:: Integers -* Symbols:: Symbol Names -* Location Counter:: The Location Counter -* Operators:: Operators -* Evaluation:: Evaluation -* Assignment:: Assignment: Defining Symbols -* Arithmetic Functions:: Built-In Functions -* Semicolons:: Semicolon Usage -@end menu - -@node Integers -@subsection Integers -@cindex integer notation -@cindex octal integers -An octal integer is @samp{0} followed by zero or more of the octal -digits (@samp{01234567}). -@smallexample -_as_octal = 0157255; -@end smallexample - -@cindex decimal integers -A decimal integer starts with a non-zero digit followed by zero or -more digits (@samp{0123456789}). -@smallexample -_as_decimal = 57005; -@end smallexample - -@cindex hexadecimal integers -@kindex 0x -A hexadecimal integer is @samp{0x} or @samp{0X} followed by one or -more hexadecimal digits chosen from @samp{0123456789abcdefABCDEF}. -@smallexample -_as_hex = 0xdead; -@end smallexample - -@cindex negative integers -To write a negative integer, use -the prefix operator @samp{-} (@pxref{Operators}). -@smallexample -_as_neg = -57005; -@end smallexample - -@cindex scaled integers -@cindex K and M integer suffixes -@cindex M and K integer suffixes -@cindex suffixes for integers -@cindex integer suffixes -Additionally the suffixes @code{K} and @code{M} may be used to scale a -constant by -@c TEXI2ROFF-KILL -@ifinfo -@c END TEXI2ROFF-KILL -@code{1024} or @code{1024*1024} -@c TEXI2ROFF-KILL -@end ifinfo -@tex -${\rm 1024}$ or ${\rm 1024}^2$ -@end tex -@c END TEXI2ROFF-KILL -respectively. For example, the following all refer to the same quantity: - -@smallexample - _fourk_1 = 4K; - _fourk_2 = 4096; - _fourk_3 = 0x1000; -@end smallexample - -@node Symbols -@subsection Symbol Names -@cindex symbol names -@cindex names -@cindex quoted symbol names -@kindex " -Unless quoted, symbol names start with a letter, underscore, or point -and may include any letters, underscores, digits, points, -and hyphens. Unquoted symbol names must not conflict with any -keywords. You can specify a symbol which contains odd characters or has -the same name as a keyword, by surrounding the symbol name in double quotes: -@smallexample - "SECTION" = 9; - "with a space" = "also with a space" + 10; -@end smallexample - -Since symbols can contain many non-alphabetic characters, it is safest -to delimit symbols with spaces. For example, @samp{A-B} is one symbol, -whereas @samp{A - B} is an expression involving subtraction. - -@node Location Counter -@subsection The Location Counter -@kindex . -@cindex dot -@cindex location counter -@cindex current output location -The special linker variable @dfn{dot} @samp{.} always contains the -current output location counter. Since the @code{.} always refers to -a location in an output section, it must always appear in an -expression within a @code{SECTIONS} command. The @code{.} symbol -may appear anywhere that an ordinary symbol is allowed in an -expression, but its assignments have a side effect. Assigning a value -to the @code{.} symbol will cause the location counter to be moved. -@cindex holes -This may be used to create holes in the output section. The location -counter may never be moved backwards. -@smallexample -SECTIONS -@{ - output : - @{ - file1(.text) - . = . + 1000; - file2(.text) - . += 1000; - file3(.text) - @} = 0x1234; -@} -@end smallexample -@noindent -In the previous example, @code{file1} is located at the beginning of the -output section, then there is a 1000 byte gap. Then @code{file2} -appears, also with a 1000 byte gap following before @code{file3} is -loaded. The notation @samp{= 0x1234} specifies what data to write in -the gaps (@pxref{Section Options}). - -@iftex -@vfill -@end iftex - -@need 2000 -@node Operators -@subsection Operators -@cindex Operators for arithmetic -@cindex arithmetic operators -@cindex precedence in expressions -The linker recognizes the standard C set of arithmetic operators, with -the standard bindings and precedence levels: -@c TEXI2ROFF-KILL -@ifinfo -@c END TEXI2ROFF-KILL -@smallexample -precedence associativity Operators Notes -(highest) -1 left ! - ~ (1) -2 left * / % -3 left + - -4 left >> << -5 left == != > < <= >= -6 left & -7 left | -8 left && -9 left || -10 right ? : -11 right &= += -= *= /= (2) -(lowest) -@end smallexample -Notes: -(1) Prefix operators -(2) @xref{Assignment}. -@c TEXI2ROFF-KILL -@end ifinfo -@tex -\vskip \baselineskip -%"lispnarrowing" is the extra indent used generally for smallexample -\hskip\lispnarrowing\vbox{\offinterlineskip -\hrule -\halign -{\vrule#&\strut\hfil\ #\ \hfil&\vrule#&\strut\hfil\ #\ \hfil&\vrule#&\strut\hfil\ {\tt #}\ \hfil&\vrule#\cr -height2pt&\omit&&\omit&&\omit&\cr -&Precedence&& Associativity &&{\rm Operators}&\cr -height2pt&\omit&&\omit&&\omit&\cr -\noalign{\hrule} -height2pt&\omit&&\omit&&\omit&\cr -&highest&&&&&\cr -% '176 is tilde, '~' in tt font -&1&&left&&\qquad- \char'176\ !\qquad\dag&\cr -&2&&left&&* / \%&\cr -&3&&left&&+ -&\cr -&4&&left&&>> <<&\cr -&5&&left&&== != > < <= >=&\cr -&6&&left&&\&&\cr -&7&&left&&|&\cr -&8&&left&&{\&\&}&\cr -&9&&left&&||&\cr -&10&&right&&? :&\cr -&11&&right&&\qquad\&= += -= *= /=\qquad\ddag&\cr -&lowest&&&&&\cr -height2pt&\omit&&\omit&&\omit&\cr} -\hrule} -@end tex -@iftex -{ -@obeylines@parskip=0pt@parindent=0pt -@dag@quad Prefix operators. -@ddag@quad @xref{Assignment}. -} -@end iftex -@c END TEXI2ROFF-KILL - -@node Evaluation -@subsection Evaluation - -@cindex lazy evaluation -@cindex expression evaluation order -The linker uses ``lazy evaluation'' for expressions; it only calculates -an expression when absolutely necessary. The linker needs the value of -the start address, and the lengths of memory regions, in order to do any -linking at all; these values are computed as soon as possible when the -linker reads in the command file. However, other values (such as symbol -values) are not known or needed until after storage allocation. Such -values are evaluated later, when other information (such as the sizes of -output sections) is available for use in the symbol assignment -expression. - -@node Assignment -@subsection Assignment: Defining Symbols -@cindex assignment in scripts -@cindex symbol definition, scripts -@cindex variables, defining -You may create global symbols, and assign values (addresses) to global -symbols, using any of the C assignment operators: - -@table @code -@item @var{symbol} = @var{expression} ; -@itemx @var{symbol} &= @var{expression} ; -@itemx @var{symbol} += @var{expression} ; -@itemx @var{symbol} -= @var{expression} ; -@itemx @var{symbol} *= @var{expression} ; -@itemx @var{symbol} /= @var{expression} ; -@end table - -Two things distinguish assignment from other operators in @code{ld} -expressions. -@itemize @bullet -@item -Assignment may only be used at the root of an expression; -@samp{a=b+3;} is allowed, but @samp{a+b=3;} is an error. - -@kindex ; -@cindex semicolon -@item -You must place a trailing semicolon (``@key{;}'') at the end of an -assignment statement. -@end itemize - -Assignment statements may appear: -@itemize @bullet -@item -as commands in their own right in an @code{ld} script; or -@item -as independent statements within a @code{SECTIONS} command; or -@item -as part of the contents of a section definition in a -@code{SECTIONS} command. -@end itemize - -The first two cases are equivalent in effect---both define a symbol with -an absolute address. The last case defines a symbol whose address is -relative to a particular section (@pxref{SECTIONS}). - -@cindex absolute and relocatable symbols -@cindex relocatable and absolute symbols -@cindex symbols, relocatable and absolute -When a linker expression is evaluated and assigned to a variable, it is -given either an absolute or a relocatable type. An absolute expression -type is one in which the symbol contains the value that it will have in -the output file; a relocatable expression type is one in which the -value is expressed as a fixed offset from the base of a section. - -The type of the expression is controlled by its position in the script -file. A symbol assigned within a section definition is created relative -to the base of the section; a symbol assigned in any other place is -created as an absolute symbol. Since a symbol created within a -section definition is relative to the base of the section, it -will remain relocatable if relocatable output is requested. A symbol -may be created with an absolute value even when assigned to within a -section definition by using the absolute assignment function -@code{ABSOLUTE}. For example, to create an absolute symbol whose address -is the last byte of an output section named @code{.data}: -@smallexample -SECTIONS@{ @dots{} - .data : - @{ - *(.data) - _edata = ABSOLUTE(.) ; - @} -@dots{} @} -@end smallexample - -The linker tries to put off the evaluation of an assignment until all -the terms in the source expression are known (@pxref{Evaluation}). For -instance, the sizes of sections cannot be known until after allocation, -so assignments dependent upon these are not performed until after -allocation. Some expressions, such as those depending upon the location -counter @dfn{dot}, @samp{.} must be evaluated during allocation. If the -result of an expression is required, but the value is not available, -then an error results. For example, a script like the following -@smallexample -SECTIONS @{ @dots{} - text 9+this_isnt_constant : - @{ @dots{} - @} -@dots{} @} -@end smallexample -@kindex Non constant expression -@noindent -will cause the error message ``@code{Non constant expression for initial -address}''. - -@cindex provide -In some cases, it is desirable for a linker script to define a symbol -only if it is referenced, and only if it is not defined by any object -included in the link. For example, traditional linkers defined the -symbol @samp{etext}. However, ANSI C requires that the user be able to -use @samp{etext} as a function name without encountering an error. -The @code{PROVIDE} keyword may be used to define a symbol, such as -@samp{etext}, only if it is referenced but not defined. The syntax is -@code{PROVIDE(@var{symbol} = @var{expression})}. - -@node Arithmetic Functions -@subsection Arithmetic Functions -@cindex functions in expression language -The command language includes a number of built-in -functions for use in link script expressions. -@table @code -@kindex ABSOLUTE(@var{exp}) -@cindex expression, absolute -@item ABSOLUTE(@var{exp}) -Return the absolute (non-relocatable, as opposed to non-negative) value -of the expression @var{exp}. Primarily useful to assign an absolute -value to a symbol within a section definition, where symbol values are -normally section-relative. - -@kindex ADDR(@var{section}) -@cindex section address -@item ADDR(@var{section}) -Return the absolute address of the named @var{section}. Your script must -previously have defined the location of that section. In the following -example, @code{symbol_1} and @code{symbol_2} are assigned identical -values: -@smallexample -@group -SECTIONS@{ @dots{} - .output1 : - @{ - start_of_output_1 = ABSOLUTE(.); - @dots{} - @} - .output : - @{ - symbol_1 = ADDR(.output1); - symbol_2 = start_of_output_1; - @} -@dots{} @} -@end group -@end smallexample - -@kindex LOADADDR(@var{section}) -@cindex section load address -@item LOADADDR(@var{section}) -Return the absolute load address of the named @var{section}. This is -normally the same as @code{ADDR}, but it may be different if the -@code{AT} keyword is used in the section definition (@pxref{Section -Options}). - -@kindex ALIGN(@var{exp}) -@cindex rounding up location counter -@item ALIGN(@var{exp}) -Return the result of the current location counter (@code{.}) aligned to -the next @var{exp} boundary. @var{exp} must be an expression whose -value is a power of two. This is equivalent to -@smallexample -(. + @var{exp} - 1) & ~(@var{exp} - 1) -@end smallexample - -@code{ALIGN} doesn't change the value of the location counter---it just -does arithmetic on it. As an example, to align the output @code{.data} -section to the next @code{0x2000} byte boundary after the preceding -section and to set a variable within the section to the next -@code{0x8000} boundary after the input sections: -@smallexample -@group -SECTIONS@{ @dots{} - .data ALIGN(0x2000): @{ - *(.data) - variable = ALIGN(0x8000); - @} -@dots{} @} -@end group -@end smallexample -@noindent -The first use of @code{ALIGN} in this example specifies the location of -a section because it is used as the optional @var{start} attribute of a -section definition (@pxref{Section Options}). The second use simply -defines the value of a variable. - -The built-in @code{NEXT} is closely related to @code{ALIGN}. - -@kindex DEFINED(@var{symbol}) -@cindex symbol defaults -@item DEFINED(@var{symbol}) -Return 1 if @var{symbol} is in the linker global symbol table and is -defined, otherwise return 0. You can use this function to provide default -values for symbols. For example, the following command-file fragment shows how -to set a global symbol @code{begin} to the first location in the -@code{.text} section---but if a symbol called @code{begin} already -existed, its value is preserved: - -@smallexample -@group -SECTIONS@{ @dots{} - .text : @{ - begin = DEFINED(begin) ? begin : . ; - @dots{} - @} -@dots{} @} -@end group -@end smallexample - -@kindex NEXT(@var{exp}) -@cindex unallocated address, next -@item NEXT(@var{exp}) -Return the next unallocated address that is a multiple of @var{exp}. -This function is closely related to @code{ALIGN(@var{exp})}; unless you -use the @code{MEMORY} command to define discontinuous memory for the -output file, the two functions are equivalent. - -@kindex SIZEOF(@var{section}) -@cindex section size -@item SIZEOF(@var{section}) -Return the size in bytes of the named @var{section}, if that section has -been allocated. In the following example, @code{symbol_1} and -@code{symbol_2} are assigned identical values: -@c What does it return if the section hasn't been allocated? 0? -@smallexample -@group -SECTIONS@{ @dots{} - .output @{ - .start = . ; - @dots{} - .end = . ; - @} - symbol_1 = .end - .start ; - symbol_2 = SIZEOF(.output); -@dots{} @} -@end group -@end smallexample - -@kindex SIZEOF_HEADERS -@cindex header size -@kindex sizeof_headers -@item SIZEOF_HEADERS -@itemx sizeof_headers -Return the size in bytes of the output file's headers. You can use this number -as the start address of the first section, if you choose, to facilitate -paging. - -@kindex MAX -@item MAX(@var{exp1}, @var{exp2}) -Returns the maximum of @var{exp1} and @var{exp2}. - -@kindex MIN -@item MIN(@var{exp1}, @var{exp2}) -Returns the minimum of @var{exp1} and @var{exp2}. - -@end table - -@node Semicolons -@subsection Semicolons - -Semicolons (``@key{;}'') are required in the following places. In all -other places they can appear for aesthetic reasons but are otherwise ignored. - -@table @code -@item Assignment -Semicolons must appear at the end of assignment expressions. -@xref{Assignment} - -@item PHDRS -Semicolons must appear at the end of a @code{PHDRS} statement. -@xref{PHDRS} -@end table - -@node MEMORY -@section Memory Layout -@kindex MEMORY -@cindex regions of memory -@cindex discontinuous memory -@cindex allocating memory -The linker's default configuration permits allocation of all available memory. -You can override this configuration by using the @code{MEMORY} command. The -@code{MEMORY} command describes the location and size of blocks of -memory in the target. By using it carefully, you can describe which -memory regions may be used by the linker, and which memory regions it -must avoid. The linker does not shuffle sections to fit into the -available regions, but does move the requested sections into the correct -regions and issue errors when the regions become too full. - -A command file may contain at most one use of the @code{MEMORY} -command; however, you can define as many blocks of memory within it as -you wish. The syntax is: - -@smallexample -@group -MEMORY - @{ - @var{name} (@var{attr}) : ORIGIN = @var{origin}, LENGTH = @var{len} - @dots{} - @} -@end group -@end smallexample -@table @code -@cindex naming memory regions -@item @var{name} -is a name used internally by the linker to refer to the region. Any -symbol name may be used. The region names are stored in a separate -name space, and will not conflict with symbols, file names or section -names. Use distinct names to specify multiple regions. - -@cindex memory region attributes -@item (@var{attr}) -is an optional list of attributes that specify whether to use a -particular memory to place sections that are not listed in the linker -script. Valid attribute lists must be made up of the characters -``@code{ALIRWX}'' that match section attributes. If you omit the -attribute list, you may omit the parentheses around it as well. The -attributes currently supported are: - -@table @samp -@item @code{Letter} -@code{Section Attribute} - -@item @code{R} -Read-only sections. - -@item @code{W} -Read/write sections. - -@item @code{X} -Sections containing executable code. - -@item @code{A} -Allocated sections. - -@item @code{I} -Initialized sections. - -@item @code{L} -Same as @code{I}. - -@item @code{!} -Invert the sense of any of the following attributes. -@end table - -@kindex ORIGIN = -@kindex o = -@kindex org = -@item @var{origin} -is the start address of the region in physical memory. It is -an expression that must evaluate to a constant before -memory allocation is performed. The keyword @code{ORIGIN} may be -abbreviated to @code{org} or @code{o} (but not, for example, @samp{ORG}). - -@kindex LENGTH = -@kindex len = -@kindex l = -@item @var{len} -is the size in bytes of the region (an expression). -The keyword @code{LENGTH} may be abbreviated to @code{len} or @code{l}. -@end table - -For example, to specify that memory has two regions available for -allocation---one starting at 0 for 256 kilobytes, and the other starting -at @code{0x40000000} for four megabytes. The @code{rom} memory region -will get all sections without an explicit memory register that are -either read-only or contain code, while the @code{ram} memory region -will get the sections. - -@smallexample -@group -MEMORY - @{ - rom (rx) : ORIGIN = 0, LENGTH = 256K - ram (!rx) : org = 0x40000000, l = 4M - @} -@end group -@end smallexample - -Once you have defined a region of memory named @var{mem}, you can direct -specific output sections there by using a command ending in -@samp{>@var{mem}} within the @code{SECTIONS} command (@pxref{Section -Options}). If the combined output sections directed to a region are too -big for the region, the linker will issue an error message. - -@node SECTIONS -@section Specifying Output Sections - -@kindex SECTIONS -The @code{SECTIONS} command controls exactly where input sections are -placed into output sections, their order in the output file, and to -which output sections they are allocated. - -You may use at most one @code{SECTIONS} command in a script file, -but you can have as many statements within it as you wish. Statements -within the @code{SECTIONS} command can do one of three things: - -@itemize @bullet -@item -define the entry point; - -@item -assign a value to a symbol; - -@item -describe the placement of a named output section, and which input -sections go into it. -@end itemize - -You can also use the first two operations---defining the entry point and -defining symbols---outside the @code{SECTIONS} command: @pxref{Entry -Point}, and @ref{Assignment}. They are permitted here as well for -your convenience in reading the script, so that symbols and the entry -point can be defined at meaningful points in your output-file layout. - -If you do not use a @code{SECTIONS} command, the linker places each input -section into an identically named output section in the order that the -sections are first encountered in the input files. If all input sections -are present in the first file, for example, the order of sections in the -output file will match the order in the first input file. - -@menu -* Section Definition:: Section Definitions -* Section Placement:: Section Placement -* Section Data Expressions:: Section Data Expressions -* Section Options:: Optional Section Attributes -* Overlays:: Overlays -@end menu - -@node Section Definition -@subsection Section Definitions -@cindex section definition -The most frequently used statement in the @code{SECTIONS} command is -the @dfn{section definition}, which specifies the -properties of an output section: its location, alignment, contents, -fill pattern, and target memory region. Most of -these specifications are optional; the simplest form of a section -definition is -@smallexample -SECTIONS @{ @dots{} - @var{secname} : @{ - @var{contents} - @} -@dots{} @} -@end smallexample -@cindex naming output sections -@noindent -@var{secname} is the name of the output section, and @var{contents} a -specification of what goes there---for example, a list of input files or -sections of input files (@pxref{Section Placement}). The whitespace -around @var{secname} is required, so that the section name is -unambiguous. The other whitespace shown is optional. You do need the -colon @samp{:} and the braces @samp{@{@}}, however. - -@var{secname} must meet the constraints of your output format. In -formats which only support a limited number of sections, such as -@code{a.out}, the name must be one of the names supported by the format -(@code{a.out}, for example, allows only @code{.text}, @code{.data} or -@code{.bss}). If the output format supports any number of sections, but -with numbers and not names (as is the case for Oasys), the name should be -supplied as a quoted numeric string. A section name may consist of any -sequence of characters, but any name which does not conform to the standard -@code{ld} symbol name syntax must be quoted. -@xref{Symbols, , Symbol Names}. - -The special @var{secname} @samp{/DISCARD/} may be used to discard input -sections. Any sections which are assigned to an output section named -@samp{/DISCARD/} are not included in the final link output. - -The linker will not create output sections which do not have any -contents. This is for convenience when referring to input sections that -may or may not exist. For example, -@smallexample -.foo @{ *(.foo) @} -@end smallexample -will only create a @samp{.foo} section in the output file if there is a -@samp{.foo} section in at least one input file. - -@node Section Placement -@subsection Section Placement - -@cindex contents of a section -In a section definition, you can specify the contents of an output -section by listing particular input files, by listing particular -input-file sections, or by a combination of the two. You can also place -arbitrary data in the section, and define symbols relative to the -beginning of the section. - -The @var{contents} of a section definition may include any of the -following kinds of statement. You can include as many of these as you -like in a single section definition, separated from one another by -whitespace. - -@table @code -@kindex @var{filename} -@cindex input files, section defn -@cindex files, including in output sections -@item @var{filename} -You may simply name a particular input file to be placed in the current -output section; @emph{all} sections from that file are placed in the -current section definition. If the file name has already been mentioned -in another section definition, with an explicit section name list, then -only those sections which have not yet been allocated are used. - -To specify a list of particular files by name: -@smallexample -.data : @{ afile.o bfile.o cfile.o @} -@end smallexample -@noindent -The example also illustrates that multiple statements can be included in -the contents of a section definition, since each file name is a separate -statement. - -@kindex @var{filename}(@var{section}) -@cindex files and sections, section defn -@item @var{filename}( @var{section} ) -@itemx @var{filename}( @var{section} , @var{section}, @dots{} ) -@itemx @var{filename}( @var{section} @var{section} @dots{} ) -You can name one or more sections from your input files, for insertion -in the current output section. If you wish to specify a list of -input-file sections inside the parentheses, separate the section names -with whitespace. - -@cindex input sections to output section -@kindex *(@var{section}) -@item * (@var{section}) -@itemx * (@var{section}, @var{section}, @dots{}) -@itemx * (@var{section} @var{section} @dots{}) -Instead of explicitly naming particular input files in a link control -script, you can refer to @emph{all} files from the @code{ld} command -line: use @samp{*} instead of a particular file name before the -parenthesized input-file section list. - -If you have already explicitly included some files by name, @samp{*} -refers to all @emph{remaining} files---those whose places in the output -file have not yet been defined. - -For example, to copy sections @code{1} through @code{4} from an Oasys file -into the @code{.text} section of an @code{a.out} file, and sections @code{13} -and @code{14} into the @code{.data} section: -@smallexample -@group -SECTIONS @{ - .text :@{ - *("1" "2" "3" "4") - @} - - .data :@{ - *("13" "14") - @} -@} -@end group -@end smallexample - -@cindex @code{[@var{section}@dots{}]}, not supported -@samp{[ @var{section} @dots{} ]} used to be accepted as an alternate way -to specify named sections from all unallocated input files. Because -some operating systems (VMS) allow brackets in file names, that notation -is no longer supported. - -@cindex uninitialized data -@cindex commons in output -@kindex *( COMMON ) -@item @var{filename}@code{( COMMON )} -@itemx *( COMMON ) -Specify where in your output file to place uninitialized data -with this notation. @code{*(COMMON)} by itself refers to all -uninitialized data from all input files (so far as it is not yet -allocated); @var{filename}@code{(COMMON)} refers to uninitialized data -from a particular file. Both are special cases of the general -mechanisms for specifying where to place input-file sections: -@code{ld} permits you to refer to uninitialized data as if it -were in an input-file section named @code{COMMON}, regardless of the -input file's format. -@end table - -In any place where you may use a specific file or section name, you may -also use a wildcard pattern. The linker handles wildcards much as the -Unix shell does. A @samp{*} character matches any number of characters. -A @samp{?} character matches any single character. The sequence -@samp{[@var{chars}]} will match a single instance of any of the -@var{chars}; the @samp{-} character may be used to specify a range of -characters, as in @samp{[a-z]} to match any lower case letter. A -@samp{\} character may be used to quote the following character. - -When a file name is matched with a wildcard, the wildcard characters -will not match a @samp{/} character (used to separate directory names on -Unix). A pattern consisting of a single @samp{*} character is an -exception; it will always match any file name. In a section name, the -wildcard characters will match a @samp{/} character. - -Wildcards only match files which are explicitly specified on the command -line. The linker does not search directories to expand wildcards. -However, if you specify a simple file name---a name with no wildcard -characters---in a linker script, and the file name is not also specified -on the command line, the linker will attempt to open the file as though -it appeared on the command line. - -In the following example, the command script arranges the output file -into three consecutive sections, named @code{.text}, @code{.data}, and -@code{.bss}, taking the input for each from the correspondingly named -sections of all the input files: - -@smallexample -@group -SECTIONS @{ - .text : @{ *(.text) @} - .data : @{ *(.data) @} - .bss : @{ *(.bss) *(COMMON) @} -@} -@end group -@end smallexample - -The following example reads all of the sections from file @code{all.o} -and places them at the start of output section @code{outputa} which -starts at location @code{0x10000}. All of section @code{.input1} from -file @code{foo.o} follows immediately, in the same output section. All -of section @code{.input2} from @code{foo.o} goes into output section -@code{outputb}, followed by section @code{.input1} from @code{foo1.o}. -All of the remaining @code{.input1} and @code{.input2} sections from any -files are written to output section @code{outputc}. - -@smallexample -@group -SECTIONS @{ - outputa 0x10000 : - @{ - all.o - foo.o (.input1) - @} - outputb : - @{ - foo.o (.input2) - foo1.o (.input1) - @} - outputc : - @{ - *(.input1) - *(.input2) - @} -@} -@end group -@end smallexample - -This example shows how wildcard patterns might be used to partition -files. All @code{.text} sections are placed in @code{.text}, and all -@code{.bss} sections are placed in @code{.bss}. For all files beginning -with an upper case character, the @code{.data} section is placed into -@code{.DATA}; for all other files, the @code{.data} section is placed -into @code{.data}. - -@smallexample -@group -SECTIONS @{ - .text : @{ *(.text) @} - .DATA : @{ [A-Z]*(.data) @} - .data : @{ *(.data) @} - .bss : @{ *(.bss) @} -@} -@end group -@end smallexample - -@node Section Data Expressions -@subsection Section Data Expressions - -@cindex expressions in a section -The foregoing statements arrange, in your output file, data originating -from your input files. You can also place data directly in an output -section from the link command script. Most of these additional -statements involve expressions (@pxref{Expressions}). Although these -statements are shown separately here for ease of presentation, no such -segregation is needed within a section definition in the @code{SECTIONS} -command; you can intermix them freely with any of the statements we've -just described. - -@table @code -@cindex input filename symbols -@cindex filename symbols -@kindex CREATE_OBJECT_SYMBOLS -@item CREATE_OBJECT_SYMBOLS -Create a symbol for each input file -in the current section, set to the address of the first byte of -data written from that input file. For instance, with @code{a.out} -files it is conventional to have a symbol for each input file. You can -accomplish this by defining the output @code{.text} section as follows: -@smallexample -@group -SECTIONS @{ - .text 0x2020 : - @{ - CREATE_OBJECT_SYMBOLS - *(.text) - _etext = ALIGN(0x2000); - @} - @dots{} -@} -@end group -@end smallexample - -If @code{sample.ld} is a file containing this script, and @code{a.o}, -@code{b.o}, @code{c.o}, and @code{d.o} are four input files with -contents like the following--- -@smallexample -@group -/* a.c */ - -afunction() @{ @} -int adata=1; -int abss; -@end group -@end smallexample - -@noindent -@samp{ld -M -T sample.ld a.o b.o c.o d.o} would create a map like this, -containing symbols matching the object file names: -@smallexample -00000000 A __DYNAMIC -00004020 B _abss -00004000 D _adata -00002020 T _afunction -00004024 B _bbss -00004008 D _bdata -00002038 T _bfunction -00004028 B _cbss -00004010 D _cdata -00002050 T _cfunction -0000402c B _dbss -00004018 D _ddata -00002068 T _dfunction -00004020 D _edata -00004030 B _end -00004000 T _etext -00002020 t a.o -00002038 t b.o -00002050 t c.o -00002068 t d.o -@end smallexample - -@kindex @var{symbol} = @var{expression} ; -@kindex @var{symbol} @var{f}= @var{expression} ; -@item @var{symbol} = @var{expression} ; -@itemx @var{symbol} @var{f}= @var{expression} ; -@var{symbol} is any symbol name (@pxref{Symbols}). ``@var{f}='' -refers to any of the operators @code{&= += -= *= /=} which combine -arithmetic and assignment. - -@cindex assignment, in section defn -When you assign a value to a symbol within a particular section -definition, the value is relative to the beginning of the section -(@pxref{Assignment}). If you write - -@smallexample -@group -SECTIONS @{ - abs = 14 ; - @dots{} - .data : @{ @dots{} rel = 14 ; @dots{} @} - abs2 = 14 + ADDR(.data); - @dots{} -@} -@end group -@end smallexample - -@c FIXME: Try above example! -@noindent -@code{abs} and @code{rel} do not have the same value; @code{rel} has the -same value as @code{abs2}. - -@kindex BYTE(@var{expression}) -@kindex SHORT(@var{expression}) -@kindex LONG(@var{expression}) -@kindex QUAD(@var{expression}) -@kindex SQUAD(@var{expression}) -@cindex direct output -@item BYTE(@var{expression}) -@itemx SHORT(@var{expression}) -@itemx LONG(@var{expression}) -@itemx QUAD(@var{expression}) -@itemx SQUAD(@var{expression}) -By including one of these four statements in a section definition, you -can explicitly place one, two, four, eight unsigned, or eight signed -bytes (respectively) at the current address of that section. When using -a 64 bit host or target, @code{QUAD} and @code{SQUAD} are the same. -When both host and target are 32 bits, @code{QUAD} uses an unsigned 32 -bit value, and @code{SQUAD} sign extends the value. Both will use the -correct endianness when writing out the value. - -@ifclear SingleFormat -Multiple-byte quantities are represented in whatever byte order is -appropriate for the output file format (@pxref{BFD}). -@end ifclear - -@kindex FILL(@var{expression}) -@cindex holes, filling -@cindex unspecified memory -@item FILL(@var{expression}) -Specify the ``fill pattern'' for the current section. Any otherwise -unspecified regions of memory within the section (for example, regions -you skip over by assigning a new value to the location counter @samp{.}) -are filled with the two least significant bytes from the -@var{expression} argument. A @code{FILL} statement covers memory -locations @emph{after} the point it occurs in the section definition; by -including more than one @code{FILL} statement, you can have different -fill patterns in different parts of an output section. -@end table - -@node Section Options -@subsection Optional Section Attributes -@cindex section defn, full syntax -Here is the full syntax of a section definition, including all the -optional portions: - -@smallexample -@group -SECTIONS @{ -@dots{} -@var{secname} @var{start} BLOCK(@var{align}) (NOLOAD) : AT ( @var{ldadr} ) - @{ @var{contents} @} >@var{region} :@var{phdr} =@var{fill} -@dots{} -@} -@end group -@end smallexample - -@var{secname} and @var{contents} are required. @xref{Section -Definition}, and @ref{Section Placement}, for details on -@var{contents}. The remaining elements---@var{start}, -@code{BLOCK(@var{align)}}, @code{(NOLOAD)}, @code{AT ( @var{ldadr} )}, -@code{>@var{region}}, @code{:@var{phdr}}, and @code{=@var{fill}}---are -all optional. - -@table @code -@cindex start address, section -@cindex section start -@cindex section address -@item @var{start} -You can force the output section to be loaded at a specified address by -specifying @var{start} immediately following the section name. -@var{start} can be represented as any expression. The following -example generates section @var{output} at location -@code{0x40000000}: - -@smallexample -@group -SECTIONS @{ - @dots{} - output 0x40000000: @{ - @dots{} - @} - @dots{} -@} -@end group -@end smallexample - -@kindex BLOCK(@var{align}) -@cindex section alignment -@cindex aligning sections -@item BLOCK(@var{align}) -You can include @code{BLOCK()} specification to advance -the location counter @code{.} prior to the beginning of the section, so -that the section will begin at the specified alignment. @var{align} is -an expression. - -@kindex NOLOAD -@cindex prevent unnecessary loading -@cindex loading, preventing -@item (NOLOAD) -The @samp{(NOLOAD)} directive will mark a section to not be loaded at -run time. The linker will process the section normally, but will mark -it so that a program loader will not load it into memory. For example, -in the script sample below, the @code{ROM} section is addressed at -memory location @samp{0} and does not need to be loaded when the program -is run. The contents of the @code{ROM} section will appear in the -linker output file as usual. - -@smallexample -@group -SECTIONS @{ - ROM 0 (NOLOAD) : @{ @dots{} @} - @dots{} -@} -@end group -@end smallexample - -@kindex AT ( @var{ldadr} ) -@cindex specify load address -@cindex load address, specifying -@item AT ( @var{ldadr} ) -The expression @var{ldadr} that follows the @code{AT} keyword specifies -the load address of the section. The default (if you do not use the -@code{AT} keyword) is to make the load address the same as the -relocation address. This feature is designed to make it easy to build a -ROM image. For example, this @code{SECTIONS} definition creates two -output sections: one called @samp{.text}, which starts at @code{0x1000}, -and one called @samp{.mdata}, which is loaded at the end of the -@samp{.text} section even though its relocation address is -@code{0x2000}. The symbol @code{_data} is defined with the value -@code{0x2000}: - -@smallexample -@group -SECTIONS - @{ - .text 0x1000 : @{ *(.text) _etext = . ; @} - .mdata 0x2000 : - AT ( ADDR(.text) + SIZEOF ( .text ) ) - @{ _data = . ; *(.data); _edata = . ; @} - .bss 0x3000 : - @{ _bstart = . ; *(.bss) *(COMMON) ; _bend = . ;@} -@} -@end group -@end smallexample - -The run-time initialization code (for C programs, usually @code{crt0}) -for use with a ROM generated this way has to include something like -the following, to copy the initialized data from the ROM image to its runtime -address: - -@smallexample -@group -char *src = _etext; -char *dst = _data; - -/* ROM has data at end of text; copy it. */ -while (dst < _edata) @{ - *dst++ = *src++; -@} - -/* Zero bss */ -for (dst = _bstart; dst< _bend; dst++) - *dst = 0; -@end group -@end smallexample - -@kindex >@var{region} -@cindex section, assigning to memory region -@cindex memory regions and sections -@item >@var{region} -Assign this section to a previously defined region of memory. -@xref{MEMORY}. - -@kindex :@var{phdr} -@cindex section, assigning to program header -@cindex program headers and sections -@item :@var{phdr} -Assign this section to a segment described by a program header. -@xref{PHDRS}. If a section is assigned to one or more segments, then -all subsequent allocated sections will be assigned to those segments as -well, unless they use an explicitly @code{:@var{phdr}} modifier. To -prevent a section from being assigned to a segment when it would -normally default to one, use @code{:NONE}. - -@kindex =@var{fill} -@cindex section fill pattern -@cindex fill pattern, entire section -@item =@var{fill} -Including @code{=@var{fill}} in a section definition specifies the -initial fill value for that section. You may use any expression to -specify @var{fill}. Any unallocated holes in the current output section -when written to the output file will be filled with the two least -significant bytes of the value, repeated as necessary. You can also -change the fill value with a @code{FILL} statement in the @var{contents} -of a section definition. - -@end table - -@node Overlays -@subsection Overlays -@kindex OVERLAY -@cindex overlays - -The @code{OVERLAY} command provides an easy way to describe sections -which are to be loaded as part of a single memory image but are to be -run at the same memory address. At run time, some sort of overlay -manager will copy the overlaid sections in and out of the runtime memory -address as required, perhaps by simply manipulating addressing bits. -This approach can be useful, for example, when a certain region of -memory is faster than another. - -The @code{OVERLAY} command is used within a @code{SECTIONS} command. It -appears as follows: -@smallexample -@group - OVERLAY @var{start} : [ NOCROSSREFS ] AT ( @var{ldaddr} ) - @{ - @var{secname1} @{ @var{contents} @} :@var{phdr} =@var{fill} - @var{secname2} @{ @var{contents} @} :@var{phdr} =@var{fill} - @dots{} - @} >@var{region} :@var{phdr} =@var{fill} -@end group -@end smallexample - -Everything is optional except @code{OVERLAY} (a keyword), and each -section must have a name (@var{secname1} and @var{secname2} above). The -section definitions within the @code{OVERLAY} construct are identical to -those within the general @code{SECTIONS} contruct (@pxref{SECTIONS}), -except that no addresses and no memory regions may be defined for -sections within an @code{OVERLAY}. - -The sections are all defined with the same starting address. The load -addresses of the sections are arranged such that they are consecutive in -memory starting at the load address used for the @code{OVERLAY} as a -whole (as with normal section definitions, the load address is optional, -and defaults to the start address; the start address is also optional, -and defaults to @code{.}). - -If the @code{NOCROSSREFS} keyword is used, and there any references -among the sections, the linker will report an error. Since the sections -all run at the same address, it normally does not make sense for one -section to refer directly to another. @xref{Option Commands, -NOCROSSREFS}. - -For each section within the @code{OVERLAY}, the linker automatically -defines two symbols. The symbol @code{__load_start_@var{secname}} is -defined as the starting load address of the section. The symbol -@code{__load_stop_@var{secname}} is defined as the final load address of -the section. Any characters within @var{secname} which are not legal -within C identifiers are removed. C (or assembler) code may use these -symbols to move the overlaid sections around as necessary. - -At the end of the overlay, the value of @code{.} is set to the start -address of the overlay plus the size of the largest section. - -Here is an example. Remember that this would appear inside a -@code{SECTIONS} construct. - -@smallexample -@group - OVERLAY 0x1000 : AT (0x4000) - @{ - .text0 @{ o1/*.o(.text) @} - .text1 @{ o2/*.o(.text) @} - @} -@end group -@end smallexample - -This will define both @code{.text0} and @code{.text1} to start at -address 0x1000. @code{.text0} will be loaded at address 0x4000, and -@code{.text1} will be loaded immediately after @code{.text0}. The -following symbols will be defined: @code{__load_start_text0}, -@code{__load_stop_text0}, @code{__load_start_text1}, -@code{__load_stop_text1}. - -C code to copy overlay @code{.text1} into the overlay area might look -like the following. - -@smallexample -@group - extern char __load_start_text1, __load_stop_text1; - memcpy ((char *) 0x1000, &__load_start_text1, - &__load_stop_text1 - &__load_start_text1); -@end group -@end smallexample - -Note that the @code{OVERLAY} command is just syntactic sugar, since -everything it does can be done using the more basic commands. The above -example could have been written identically as follows. - -@smallexample -@group - .text0 0x1000 : AT (0x4000) @{ o1/*.o(.text) @} - __load_start_text0 = LOADADDR (.text0); - __load_stop_text0 = LOADADDR (.text0) + SIZEOF (.text0); - .text1 0x1000 : AT (0x4000 + SIZEOF (.text0)) @{ o2/*.o(.text) @} - __load_start_text1 = LOADADDR (.text1); - __load_stop_text1 = LOADADDR (.text1) + SIZEOF (.text1); - . = 0x1000 + MAX (SIZEOF (.text0), SIZEOF (.text1)); -@end group -@end smallexample - -@node PHDRS -@section ELF Program Headers -@kindex PHDRS -@cindex program headers -@cindex ELF program headers - -The ELF object file format uses @dfn{program headers}, which are read by -the system loader and describe how the program should be loaded into -memory. These program headers must be set correctly in order to run the -program on a native ELF system. The linker will create reasonable -program headers by default. However, in some cases, it is desirable to -specify the program headers more precisely; the @code{PHDRS} command may -be used for this purpose. When the @code{PHDRS} command is used, the -linker will not generate any program headers itself. - -The @code{PHDRS} command is only meaningful when generating an ELF -output file. It is ignored in other cases. This manual does not -describe the details of how the system loader interprets program -headers; for more information, see the ELF ABI. The program headers of -an ELF file may be displayed using the @samp{-p} option of the -@code{objdump} command. - -This is the syntax of the @code{PHDRS} command. The words @code{PHDRS}, -@code{FILEHDR}, @code{AT}, and @code{FLAGS} are keywords. - -@smallexample -@group -PHDRS -@{ - @var{name} @var{type} [ FILEHDR ] [ PHDRS ] [ AT ( @var{address} ) ] - [ FLAGS ( @var{flags} ) ] ; -@} -@end group -@end smallexample - -The @var{name} is used only for reference in the @code{SECTIONS} command -of the linker script. It does not get put into the output file. - -Certain program header types describe segments of memory which are -loaded from the file by the system loader. In the linker script, the -contents of these segments are specified by directing allocated output -sections to be placed in the segment. To do this, the command -describing the output section in the @code{SECTIONS} command should use -@samp{:@var{name}}, where @var{name} is the name of the program header -as it appears in the @code{PHDRS} command. @xref{Section Options}. - -It is normal for certain sections to appear in more than one segment. -This merely implies that one segment of memory contains another. This -is specified by repeating @samp{:@var{name}}, using it once for each -program header in which the section is to appear. - -If a section is placed in one or more segments using @samp{:@var{name}}, -then all subsequent allocated sections which do not specify -@samp{:@var{name}} are placed in the same segments. This is for -convenience, since generally a whole set of contiguous sections will be -placed in a single segment. To prevent a section from being assigned to -a segment when it would normally default to one, use @code{:NONE}. - -The @code{FILEHDR} and @code{PHDRS} keywords which may appear after the -program header type also indicate contents of the segment of memory. -The @code{FILEHDR} keyword means that the segment should include the ELF -file header. The @code{PHDRS} keyword means that the segment should -include the ELF program headers themselves. - -The @var{type} may be one of the following. The numbers indicate the -value of the keyword. - -@table @asis -@item @code{PT_NULL} (0) -Indicates an unused program header. - -@item @code{PT_LOAD} (1) -Indicates that this program header describes a segment to be loaded from -the file. - -@item @code{PT_DYNAMIC} (2) -Indicates a segment where dynamic linking information can be found. - -@item @code{PT_INTERP} (3) -Indicates a segment where the name of the program interpreter may be -found. - -@item @code{PT_NOTE} (4) -Indicates a segment holding note information. - -@item @code{PT_SHLIB} (5) -A reserved program header type, defined but not specified by the ELF -ABI. - -@item @code{PT_PHDR} (6) -Indicates a segment where the program headers may be found. - -@item @var{expression} -An expression giving the numeric type of the program header. This may -be used for types not defined above. -@end table - -It is possible to specify that a segment should be loaded at a -particular address in memory. This is done using an @code{AT} -expression. This is identical to the @code{AT} command used in the -@code{SECTIONS} command (@pxref{Section Options}). Using the @code{AT} -command for a program header overrides any information in the -@code{SECTIONS} command. - -Normally the segment flags are set based on the sections. The -@code{FLAGS} keyword may be used to explicitly specify the segment -flags. The value of @var{flags} must be an integer. It is used to -set the @code{p_flags} field of the program header. - -Here is an example of the use of @code{PHDRS}. This shows a typical set -of program headers used on a native ELF system. - -@example -@group -PHDRS -@{ - headers PT_PHDR PHDRS ; - interp PT_INTERP ; - text PT_LOAD FILEHDR PHDRS ; - data PT_LOAD ; - dynamic PT_DYNAMIC ; -@} - -SECTIONS -@{ - . = SIZEOF_HEADERS; - .interp : @{ *(.interp) @} :text :interp - .text : @{ *(.text) @} :text - .rodata : @{ *(.rodata) @} /* defaults to :text */ - @dots{} - . = . + 0x1000; /* move to a new page in memory */ - .data : @{ *(.data) @} :data - .dynamic : @{ *(.dynamic) @} :data :dynamic - @dots{} -@} -@end group -@end example - -@node Entry Point -@section The Entry Point -@kindex ENTRY(@var{symbol}) -@cindex start of execution -@cindex first instruction -The linker command language includes a command specifically for -defining the first executable instruction in an output file (its -@dfn{entry point}). Its argument is a symbol name: -@smallexample -ENTRY(@var{symbol}) -@end smallexample - -Like symbol assignments, the @code{ENTRY} command may be placed either -as an independent command in the command file, or among the section -definitions within the @code{SECTIONS} command---whatever makes the most -sense for your layout. - -@cindex entry point, defaults -@code{ENTRY} is only one of several ways of choosing the entry point. -You may indicate it in any of the following ways (shown in descending -order of priority: methods higher in the list override methods lower down). -@itemize @bullet -@item -the @samp{-e} @var{entry} command-line option; -@item -the @code{ENTRY(@var{symbol})} command in a linker control script; -@item -the value of the symbol @code{start}, if present; -@item -the address of the first byte of the @code{.text} section, if present; -@item -The address @code{0}. -@end itemize - -For example, you can use these rules to generate an entry point with an -assignment statement: if no symbol @code{start} is defined within your -input files, you can simply define it, assigning it an appropriate -value--- - -@smallexample -start = 0x2020; -@end smallexample - -@noindent -The example shows an absolute address, but you can use any expression. -For example, if your input object files use some other symbol-name -convention for the entry point, you can just assign the value of -whatever symbol contains the start address to @code{start}: - -@smallexample -start = other_symbol ; -@end smallexample - -@node Version Script -@section Version Script -@kindex VERSION @{script text@} -@cindex symbol versions -@cindex version script -@cindex versions of symbols -The linker command script includes a command specifically for -specifying a version script, and is only meaningful for ELF platforms -that support shared libraries. A version script can be -build directly into the linker script that you are using, or you -can supply the version script as just another input file to the linker -at the time that you link. The command script syntax is: -@smallexample -VERSION @{ version script contents @} -@end smallexample -The version script can also be specified to the linker by means of the -@samp{--version-script} linker command line option. -Version scripts are only meaningful when creating shared libraries. - -The format of the version script itself is identical to that used by -Sun's linker in Solaris 2.5. Versioning is done by defining a tree of -version nodes with the names and interdependencies specified in the -version script. The version script can specify which symbols are bound -to which version nodes, and it can reduce a specified set of symbols to -local scope so that they are not globally visible outside of the shared -library. - -The easiest way to demonstrate the version script language is with a few -examples. - -@smallexample -VERS_1.1 @{ - global: - foo1; - local: - old*; - original*; - new*; -@}; - -VERS_1.2 @{ - foo2; -@} VERS_1.1; - -VERS_2.0 @{ - bar1; bar2; -@} VERS_1.2; -@end smallexample - -In this example, three version nodes are defined. @samp{VERS_1.1} is the -first version node defined, and has no other dependencies. The symbol -@samp{foo1} is bound to this version node, and a number of symbols -that have appeared within various object files are reduced in scope to -local so that they are not visible outside of the shared library. - -Next, the node @samp{VERS_1.2} is defined. It depends upon -@samp{VERS_1.1}. The symbol @samp{foo2} is bound to this version node. - -Finally, the node @samp{VERS_2.0} is defined. It depends upon -@samp{VERS_1.2}. The symbols @samp{bar1} and @samp{bar2} are bound to -this version node. - -Symbols defined in the library which aren't specifically bound to a -version node are effectively bound to an unspecified base version of the -library. It is possible to bind all otherwise unspecified symbols to a -given version node using @samp{global: *} somewhere in the version -script. - -Lexically the names of the version nodes have no specific meaning other -than what they might suggest to the person reading them. The @samp{2.0} -version could just as well have appeared in between @samp{1.1} and -@samp{1.2}. However, this would be a confusing way to write a version -script. - -When you link an application against a shared library that has versioned -symbols, the application itself knows which version of each symbol it requires, -and it also knows which version nodes it needs from each shared library it is -linked against. Thus at runtime, the dynamic loader can make a quick check to -make sure that the libraries you have linked against do in fact supply all -of the version nodes that the application will need to resolve all of the -dynamic symbols. In this way it is possible for the dynamic linker to know -with certainty that all external symbols that it needs will be resolvable -without having to search for each symbol reference. - -The symbol versioning is in effect a much more sophisticated way of -doing minor version checking that SunOS does. The fundamental problem -that is being addressed here is that typically references to external -functions are bound on an as-needed basis, and are not all bound when -the application starts up. If a shared library is out of date, a -required interface may be missing; when the application tries to use -that interface, it may suddenly and unexpectedly fail. With symbol -versioning, the user will get a warning when they start their program if -the libraries being used with the application are too old. - -There are several GNU extensions to Sun's versioning approach. The -first of these is the ability to bind a symbol to a version node in the -source file where the symbol is defined instead of in the versioning -script. This was done mainly to reduce the burden on the library -maintainer. This can be done by putting something like: - -@smallexample -__asm__(".symver original_foo,foo@@VERS_1.1"); -@end smallexample - -in the C source file. This renamed the function @samp{original_foo} to -be an alias for @samp{foo} bound to the version node @samp{VERS_1.1}. -The @samp{local:} directive can be used to prevent the symbol -@samp{original_foo} from being exported. - -The second GNU extension is to allow multiple versions of the same function -to appear in a given shared library. In this way an incompatible change to -an interface can take place without increasing the major version number of -the shared library, while still allowing applications linked against the old -interface to continue to function. - -This can only be accomplished by using multiple @samp{.symver} -directives in the assembler. An example of this would be: - -@smallexample -__asm__(".symver original_foo,foo@@"); -__asm__(".symver old_foo,foo@@VERS_1.1"); -__asm__(".symver old_foo1,foo@@VERS_1.2"); -__asm__(".symver new_foo,foo@@@@VERS_2.0"); -@end smallexample - -In this example, @samp{foo@@} represents the symbol @samp{foo} bound to the -unspecified base version of the symbol. The source file that contains this -example would define 4 C functions: @samp{original_foo}, @samp{old_foo}, -@samp{old_foo1}, and @samp{new_foo}. - -When you have multiple definitions of a given symbol, there needs to be -some way to specify a default version to which external references to -this symbol will be bound. This can be accomplished with the -@samp{foo@@@@VERS_2.0} type of @samp{.symver} directive. Only one version of -a symbol can be declared 'default' in this manner - otherwise you would -effectively have multiple definitions of the same symbol. - -If you wish to bind a reference to a specific version of the symbol -within the shared library, you can use the aliases of convenience -(i.e. @samp{old_foo}), or you can use the @samp{.symver} directive to -specifically bind to an external version of the function in question. - -@node Option Commands -@section Option Commands -The command language includes a number of other commands that you can -use for specialized purposes. They are similar in purpose to -command-line options. - -@table @code -@kindex CONSTRUCTORS -@cindex C++ constructors, arranging in link -@cindex constructors, arranging in link -@item CONSTRUCTORS -When linking using the @code{a.out} object file format, the linker uses -an unusual set construct to support C++ global constructors and -destructors. When linking object file formats which do not support -arbitrary sections, such as @code{ECOFF} and @code{XCOFF}, the linker -will automatically recognize C++ global constructors and destructors by -name. For these object file formats, the @code{CONSTRUCTORS} command -tells the linker where this information should be placed. The -@code{CONSTRUCTORS} command is ignored for other object file formats. - -The symbol @w{@code{__CTOR_LIST__}} marks the start of the global -constructors, and the symbol @w{@code{__DTOR_LIST}} marks the end. The -first word in the list is the number of entries, followed by the address -of each constructor or destructor, followed by a zero word. The -compiler must arrange to actually run the code. For these object file -formats @sc{gnu} C++ calls constructors from a subroutine @code{__main}; -a call to @code{__main} is automatically inserted into the startup code -for @code{main}. @sc{gnu} C++ runs destructors either by using -@code{atexit}, or directly from the function @code{exit}. - -For object file formats such as @code{COFF} or @code{ELF} which support -multiple sections, @sc{gnu} C++ will normally arrange to put the -addresses of global constructors and destructors into the @code{.ctors} -and @code{.dtors} sections. Placing the following sequence into your -linker script will build the sort of table which the @sc{gnu} C++ -runtime code expects to see. - -@smallexample - __CTOR_LIST__ = .; - LONG((__CTOR_END__ - __CTOR_LIST__) / 4 - 2) - *(.ctors) - LONG(0) - __CTOR_END__ = .; - __DTOR_LIST__ = .; - LONG((__DTOR_END__ - __DTOR_LIST__) / 4 - 2) - *(.dtors) - LONG(0) - __DTOR_END__ = .; -@end smallexample - -Normally the compiler and linker will handle these issues automatically, -and you will not need to concern yourself with them. However, you may -need to consider this if you are using C++ and writing your own linker -scripts. - -@need 1000 -@kindex FLOAT -@kindex NOFLOAT -@item FLOAT -@itemx NOFLOAT -These keywords were used in some older linkers to request a particular -math subroutine library. @code{ld} doesn't use the keywords, assuming -instead that any necessary subroutines are in libraries specified using -the general mechanisms for linking to archives; but to permit the use of -scripts that were written for the older linkers, the keywords -@code{FLOAT} and @code{NOFLOAT} are accepted and ignored. - -@kindex FORCE_COMMON_ALLOCATION -@cindex common allocation -@item FORCE_COMMON_ALLOCATION -This command has the same effect as the @samp{-d} command-line option: -to make @code{ld} assign space to common symbols even if a relocatable -output file is specified (@samp{-r}). - -@kindex INCLUDE @var{filename} -@cindex including a linker script -@item INCLUDE @var{filename} -Include the linker script @var{filename} at this point. The file will -be searched for in the current directory, and in any directory specified -with the @code{-L} option. You can nest calls to @code{INCLUDE} up to -10 levels deep. - -@kindex INPUT ( @var{files} ) -@cindex binary input files -@item INPUT ( @var{file}, @var{file}, @dots{} ) -@itemx INPUT ( @var{file} @var{file} @dots{} ) -Use this command to include binary input files in the link, without -including them in a particular section definition. -Specify the full name for each @var{file}, including @samp{.a} if -required. - -@code{ld} searches for each @var{file} through the archive-library -search path, just as for files you specify on the command line. -See the description of @samp{-L} in @ref{Options,,Command Line -Options}. - -If you use @samp{-l@var{file}}, @code{ld} will transform the name to -@code{lib@var{file}.a} as with the command line argument @samp{-l}. - -@kindex GROUP ( @var{files} ) -@cindex grouping input files -@item GROUP ( @var{file}, @var{file}, @dots{} ) -@itemx GROUP ( @var{file} @var{file} @dots{} ) -This command is like @code{INPUT}, except that the named files should -all be archives, and they are searched repeatedly until no new undefined -references are created. See the description of @samp{-(} in -@ref{Options,,Command Line Options}. - -@ignore -@kindex MAP ( @var{name} ) -@item MAP ( @var{name} ) -@c MAP(...) appears to look for an F in the arg, ignoring all other -@c chars; if it finds one, it sets "map_option_f" to true. But nothing -@c checks map_option_f. Apparently a stub for the future... -@end ignore - -@kindex OUTPUT ( @var{filename} ) -@cindex naming the output file -@item OUTPUT ( @var{filename} ) -Use this command to name the link output file @var{filename}. The -effect of @code{OUTPUT(@var{filename})} is identical to the effect of -@w{@samp{-o @var{filename}}}, which overrides it. You can use this -command to supply a default output-file name other than @code{a.out}. - -@ifclear SingleFormat -@kindex OUTPUT_ARCH ( @var{bfdname} ) -@cindex machine architecture, output -@item OUTPUT_ARCH ( @var{bfdname} ) -Specify a particular output machine architecture, with one of the names -used by the BFD back-end routines (@pxref{BFD}). This command is often -unnecessary; the architecture is most often set implicitly by either the -system BFD configuration or as a side effect of the @code{OUTPUT_FORMAT} -command. - -@kindex OUTPUT_FORMAT ( @var{bfdname} ) -@cindex format, output file -@item OUTPUT_FORMAT ( @var{bfdname} ) -When @code{ld} is configured to support multiple object code formats, -you can use this command to specify a particular output format. -@var{bfdname} is one of the names used by the BFD back-end routines -(@pxref{BFD}). The effect is identical to the effect of the -@samp{--oformat} command-line option. This selection affects only the -output file; the related command @code{TARGET} affects primarily input -files. -@end ifclear - -@kindex SEARCH_DIR ( @var{path} ) -@cindex path for libraries -@cindex search path, libraries -@item SEARCH_DIR ( @var{path} ) -Add @var{path} to the list of paths where @code{ld} looks for -archive libraries. @code{SEARCH_DIR(@var{path})} has the same -effect as @samp{-L@var{path}} on the command line. - -@kindex STARTUP ( @var{filename} ) -@cindex first input file -@item STARTUP ( @var{filename} ) -Ensure that @var{filename} is the first input file used in the link -process. - -@ifclear SingleFormat -@cindex input file format -@kindex TARGET ( @var{format} ) -@item TARGET ( @var{format} ) -When @code{ld} is configured to support multiple object code formats, -you can use this command to change the input-file object code format -(like the command-line option @samp{-b} or its synonym @samp{--format}). -The argument @var{format} is one of the strings used by BFD to name -binary formats. If @code{TARGET} is specified but @code{OUTPUT_FORMAT} -is not, the last @code{TARGET} argument is also used as the default -format for the @code{ld} output file. @xref{BFD}. - -@kindex GNUTARGET -If you don't use the @code{TARGET} command, @code{ld} uses the value of -the environment variable @code{GNUTARGET}, if available, to select the -output file format. If that variable is also absent, @code{ld} uses -the default format configured for your machine in the BFD libraries. -@end ifclear - -@cindex cross references -@kindex NOCROSSREFS ( @var{sections} ) -@item NOCROSSREFS ( @var{section} @var{section} @dots{} ) -This command may be used to tell @code{ld} to issue an error about any -references among certain sections. - -In certain types of programs, particularly on embedded systems, when one -section is loaded into memory, another section will not be. Any direct -references between the two sections would be errors. For example, it -would be an error if code in one section called a function defined in -the other section. - -The @code{NOCROSSREFS} command takes a list of section names. If -@code{ld} detects any cross references between the sections, it reports -an error and returns a non-zero exit status. The @code{NOCROSSREFS} -command uses output section names, defined in the @code{SECTIONS} -command. It does not use the names of input sections. -@end table - -@ifset GENERIC -@node Machine Dependent -@chapter Machine Dependent Features - -@cindex machine dependencies -@code{ld} has additional features on some platforms; the following -sections describe them. Machines where @code{ld} has no additional -functionality are not listed. - -@menu -* H8/300:: @code{ld} and the H8/300 -* i960:: @code{ld} and the Intel 960 family -@end menu -@end ifset - -@c FIXME! This could use @raisesections/@lowersections, but there seems to be a conflict -@c between those and node-defaulting. -@ifset H8300 -@ifclear GENERIC -@raisesections -@end ifclear -@node H8/300 -@section @code{ld} and the H8/300 - -@cindex H8/300 support -For the H8/300, @code{ld} can perform these global optimizations when -you specify the @samp{--relax} command-line option. - -@table @emph -@cindex relaxing on H8/300 -@item relaxing address modes -@code{ld} finds all @code{jsr} and @code{jmp} instructions whose -targets are within eight bits, and turns them into eight-bit -program-counter relative @code{bsr} and @code{bra} instructions, -respectively. - -@cindex synthesizing on H8/300 -@item synthesizing instructions -@c FIXME: specifically mov.b, or any mov instructions really? -@code{ld} finds all @code{mov.b} instructions which use the -sixteen-bit absolute address form, but refer to the top -page of memory, and changes them to use the eight-bit address form. -(That is: the linker turns @samp{mov.b @code{@@}@var{aa}:16} into -@samp{mov.b @code{@@}@var{aa}:8} whenever the address @var{aa} is in the -top page of memory). -@end table -@ifclear GENERIC -@lowersections -@end ifclear -@end ifset - -@ifclear GENERIC -@ifset Hitachi -@c This stuff is pointless to say unless you're especially concerned -@c with Hitachi chips; don't enable it for generic case, please. -@node Hitachi -@chapter @code{ld} and other Hitachi chips - -@code{ld} also supports the H8/300H, the H8/500, and the Hitachi SH. No -special features, commands, or command-line options are required for -these chips. -@end ifset -@end ifclear - -@ifset I960 -@ifclear GENERIC -@raisesections -@end ifclear -@node i960 -@section @code{ld} and the Intel 960 family - -@cindex i960 support - -You can use the @samp{-A@var{architecture}} command line option to -specify one of the two-letter names identifying members of the 960 -family; the option specifies the desired output target, and warns of any -incompatible instructions in the input files. It also modifies the -linker's search strategy for archive libraries, to support the use of -libraries specific to each particular architecture, by including in the -search loop names suffixed with the string identifying the architecture. - -For example, if your @code{ld} command line included @w{@samp{-ACA}} as -well as @w{@samp{-ltry}}, the linker would look (in its built-in search -paths, and in any paths you specify with @samp{-L}) for a library with -the names - -@smallexample -@group -try -libtry.a -tryca -libtryca.a -@end group -@end smallexample - -@noindent -The first two possibilities would be considered in any event; the last -two are due to the use of @w{@samp{-ACA}}. - -You can meaningfully use @samp{-A} more than once on a command line, since -the 960 architecture family allows combination of target architectures; each -use will add another pair of name variants to search for when @w{@samp{-l}} -specifies a library. - -@cindex @code{--relax} on i960 -@cindex relaxing on i960 -@code{ld} supports the @samp{--relax} option for the i960 family. If -you specify @samp{--relax}, @code{ld} finds all @code{balx} and -@code{calx} instructions whose targets are within 24 bits, and turns -them into 24-bit program-counter relative @code{bal} and @code{cal} -instructions, respectively. @code{ld} also turns @code{cal} -instructions into @code{bal} instructions when it determines that the -target subroutine is a leaf routine (that is, the target subroutine does -not itself call any subroutines). - -@ifclear GENERIC -@lowersections -@end ifclear -@end ifset - -@ifclear SingleFormat -@node BFD -@chapter BFD - -@cindex back end -@cindex object file management -@cindex object formats available -@kindex objdump -i -The linker accesses object and archive files using the BFD libraries. -These libraries allow the linker to use the same routines to operate on -object files whatever the object file format. A different object file -format can be supported simply by creating a new BFD back end and adding -it to the library. To conserve runtime memory, however, the linker and -associated tools are usually configured to support only a subset of the -object file formats available. You can use @code{objdump -i} -(@pxref{objdump,,objdump,binutils.info,The GNU Binary Utilities}) to -list all the formats available for your configuration. - -@cindex BFD requirements -@cindex requirements for BFD -As with most implementations, BFD is a compromise between -several conflicting requirements. The major factor influencing -BFD design was efficiency: any time used converting between -formats is time which would not have been spent had BFD not -been involved. This is partly offset by abstraction payback; since -BFD simplifies applications and back ends, more time and care -may be spent optimizing algorithms for a greater speed. - -One minor artifact of the BFD solution which you should bear in -mind is the potential for information loss. There are two places where -useful information can be lost using the BFD mechanism: during -conversion and during output. @xref{BFD information loss}. - -@menu -* BFD outline:: How it works: an outline of BFD -@end menu - -@node BFD outline -@section How it works: an outline of BFD -@cindex opening object files -@include bfdsumm.texi -@end ifclear - -@node Reporting Bugs -@chapter Reporting Bugs -@cindex bugs in @code{ld} -@cindex reporting bugs in @code{ld} - -Your bug reports play an essential role in making @code{ld} reliable. - -Reporting a bug may help you by bringing a solution to your problem, or -it may not. But in any case the principal function of a bug report is -to help the entire community by making the next version of @code{ld} -work better. Bug reports are your contribution to the maintenance of -@code{ld}. - -In order for a bug report to serve its purpose, you must include the -information that enables us to fix the bug. - -@menu -* Bug Criteria:: Have you found a bug? -* Bug Reporting:: How to report bugs -@end menu - -@node Bug Criteria -@section Have you found a bug? -@cindex bug criteria - -If you are not sure whether you have found a bug, here are some guidelines: - -@itemize @bullet -@cindex fatal signal -@cindex linker crash -@cindex crash of linker -@item -If the linker gets a fatal signal, for any input whatever, that is a -@code{ld} bug. Reliable linkers never crash. - -@cindex error on valid input -@item -If @code{ld} produces an error message for valid input, that is a bug. - -@cindex invalid input -@item -If @code{ld} does not produce an error message for invalid input, that -may be a bug. In the general case, the linker can not verify that -object files are correct. - -@item -If you are an experienced user of linkers, your suggestions for -improvement of @code{ld} are welcome in any case. -@end itemize - -@node Bug Reporting -@section How to report bugs -@cindex bug reports -@cindex @code{ld} bugs, reporting - -A number of companies and individuals offer support for @sc{gnu} -products. If you obtained @code{ld} from a support organization, we -recommend you contact that organization first. - -You can find contact information for many support companies and -individuals in the file @file{etc/SERVICE} in the @sc{gnu} Emacs -distribution. - -In any event, we also recommend that you send bug reports for @code{ld} -to @samp{bug-gnu-utils@@gnu.org}. - -The fundamental principle of reporting bugs usefully is this: -@strong{report all the facts}. If you are not sure whether to state a -fact or leave it out, state it! - -Often people omit facts because they think they know what causes the -problem and assume that some details do not matter. Thus, you might -assume that the name of a symbol you use in an example does not matter. -Well, probably it does not, but one cannot be sure. Perhaps the bug is -a stray memory reference which happens to fetch from the location where -that name is stored in memory; perhaps, if the name were different, the -contents of that location would fool the linker into doing the right -thing despite the bug. Play it safe and give a specific, complete -example. That is the easiest thing for you to do, and the most helpful. - -Keep in mind that the purpose of a bug report is to enable us to fix the bug if -it is new to us. Therefore, always write your bug reports on the assumption -that the bug has not been reported previously. - -Sometimes people give a few sketchy facts and ask, ``Does this ring a -bell?'' Those bug reports are useless, and we urge everyone to -@emph{refuse to respond to them} except to chide the sender to report -bugs properly. - -To enable us to fix the bug, you should include all these things: - -@itemize @bullet -@item -The version of @code{ld}. @code{ld} announces it if you start it with -the @samp{--version} argument. - -Without this, we will not know whether there is any point in looking for -the bug in the current version of @code{ld}. - -@item -Any patches you may have applied to the @code{ld} source, including any -patches made to the @code{BFD} library. - -@item -The type of machine you are using, and the operating system name and -version number. - -@item -What compiler (and its version) was used to compile @code{ld}---e.g. -``@code{gcc-2.7}''. - -@item -The command arguments you gave the linker to link your example and -observe the bug. To guarantee you will not omit something important, -list them all. A copy of the Makefile (or the output from make) is -sufficient. - -If we were to try to guess the arguments, we would probably guess wrong -and then we might not encounter the bug. - -@item -A complete input file, or set of input files, that will reproduce the -bug. It is generally most helpful to send the actual object files, -uuencoded if necessary to get them through the mail system. Making them -available for anonymous FTP is not as good, but may be the only -reasonable choice for large object files. - -If the source files were assembled using @code{gas} or compiled using -@code{gcc}, then it may be OK to send the source files rather than the -object files. In this case, be sure to say exactly what version of -@code{gas} or @code{gcc} was used to produce the object files. Also say -how @code{gas} or @code{gcc} were configured. - -@item -A description of what behavior you observe that you believe is -incorrect. For example, ``It gets a fatal signal.'' - -Of course, if the bug is that @code{ld} gets a fatal signal, then we -will certainly notice it. But if the bug is incorrect output, we might -not notice unless it is glaringly wrong. You might as well not give us -a chance to make a mistake. - -Even if the problem you experience is a fatal signal, you should still -say so explicitly. Suppose something strange is going on, such as, your -copy of @code{ld} is out of synch, or you have encountered a bug in the -C library on your system. (This has happened!) Your copy might crash -and ours would not. If you told us to expect a crash, then when ours -fails to crash, we would know that the bug was not happening for us. If -you had not told us to expect a crash, then we would not be able to draw -any conclusion from our observations. - -@item -If you wish to suggest changes to the @code{ld} source, send us context -diffs, as generated by @code{diff} with the @samp{-u}, @samp{-c}, or -@samp{-p} option. Always send diffs from the old file to the new file. -If you even discuss something in the @code{ld} source, refer to it by -context, not by line number. - -The line numbers in our development sources will not match those in your -sources. Your line numbers would convey no useful information to us. -@end itemize - -Here are some things that are not necessary: - -@itemize @bullet -@item -A description of the envelope of the bug. - -Often people who encounter a bug spend a lot of time investigating -which changes to the input file will make the bug go away and which -changes will not affect it. - -This is often time consuming and not very useful, because the way we -will find the bug is by running a single example under the debugger -with breakpoints, not by pure deduction from a series of examples. -We recommend that you save your time for something else. - -Of course, if you can find a simpler example to report @emph{instead} -of the original one, that is a convenience for us. Errors in the -output will be easier to spot, running under the debugger will take -less time, and so on. - -However, simplification is not vital; if you do not want to do this, -report the bug anyway and send us the entire test case you used. - -@item -A patch for the bug. - -A patch for the bug does help us if it is a good one. But do not omit -the necessary information, such as the test case, on the assumption that -a patch is all we need. We might see problems with your patch and decide -to fix the problem another way, or we might not understand it at all. - -Sometimes with a program as complicated as @code{ld} it is very hard to -construct an example that will make the program follow a certain path -through the code. If you do not send us the example, we will not be -able to construct one, so we will not be able to verify that the bug is -fixed. - -And if we cannot understand what bug you are trying to fix, or why your -patch should be an improvement, we will not install it. A test case will -help us to understand. - -@item -A guess about what the bug is or what it depends on. - -Such guesses are usually wrong. Even we cannot guess right about such -things without first using the debugger to find the facts. -@end itemize - -@node MRI -@appendix MRI Compatible Script Files -@cindex MRI compatibility -To aid users making the transition to @sc{gnu} @code{ld} from the MRI -linker, @code{ld} can use MRI compatible linker scripts as an -alternative to the more general-purpose linker scripting language -described in @ref{Commands,,Command Language}. MRI compatible linker -scripts have a much simpler command set than the scripting language -otherwise used with @code{ld}. @sc{gnu} @code{ld} supports the most -commonly used MRI linker commands; these commands are described here. - -In general, MRI scripts aren't of much use with the @code{a.out} object -file format, since it only has three sections and MRI scripts lack some -features to make use of them. - -You can specify a file containing an MRI-compatible script using the -@samp{-c} command-line option. - -Each command in an MRI-compatible script occupies its own line; each -command line starts with the keyword that identifies the command (though -blank lines are also allowed for punctuation). If a line of an -MRI-compatible script begins with an unrecognized keyword, @code{ld} -issues a warning message, but continues processing the script. - -Lines beginning with @samp{*} are comments. - -You can write these commands using all upper-case letters, or all -lower case; for example, @samp{chip} is the same as @samp{CHIP}. -The following list shows only the upper-case form of each command. - -@table @code -@cindex @code{ABSOLUTE} (MRI) -@item ABSOLUTE @var{secname} -@itemx ABSOLUTE @var{secname}, @var{secname}, @dots{} @var{secname} -Normally, @code{ld} includes in the output file all sections from all -the input files. However, in an MRI-compatible script, you can use the -@code{ABSOLUTE} command to restrict the sections that will be present in -your output program. If the @code{ABSOLUTE} command is used at all in a -script, then only the sections named explicitly in @code{ABSOLUTE} -commands will appear in the linker output. You can still use other -input sections (whatever you select on the command line, or using -@code{LOAD}) to resolve addresses in the output file. - -@cindex @code{ALIAS} (MRI) -@item ALIAS @var{out-secname}, @var{in-secname} -Use this command to place the data from input section @var{in-secname} -in a section called @var{out-secname} in the linker output file. - -@var{in-secname} may be an integer. - -@cindex @code{ALIGN} (MRI) -@item ALIGN @var{secname} = @var{expression} -Align the section called @var{secname} to @var{expression}. The -@var{expression} should be a power of two. - -@cindex @code{BASE} (MRI) -@item BASE @var{expression} -Use the value of @var{expression} as the lowest address (other than -absolute addresses) in the output file. - -@cindex @code{CHIP} (MRI) -@item CHIP @var{expression} -@itemx CHIP @var{expression}, @var{expression} -This command does nothing; it is accepted only for compatibility. - -@cindex @code{END} (MRI) -@item END -This command does nothing whatever; it's only accepted for compatibility. - -@cindex @code{FORMAT} (MRI) -@item FORMAT @var{output-format} -Similar to the @code{OUTPUT_FORMAT} command in the more general linker -language, but restricted to one of these output formats: - -@enumerate -@item -S-records, if @var{output-format} is @samp{S} - -@item -IEEE, if @var{output-format} is @samp{IEEE} - -@item -COFF (the @samp{coff-m68k} variant in BFD), if @var{output-format} is -@samp{COFF} -@end enumerate - -@cindex @code{LIST} (MRI) -@item LIST @var{anything}@dots{} -Print (to the standard output file) a link map, as produced by the -@code{ld} command-line option @samp{-M}. - -The keyword @code{LIST} may be followed by anything on the -same line, with no change in its effect. - -@cindex @code{LOAD} (MRI) -@item LOAD @var{filename} -@itemx LOAD @var{filename}, @var{filename}, @dots{} @var{filename} -Include one or more object file @var{filename} in the link; this has the -same effect as specifying @var{filename} directly on the @code{ld} -command line. - -@cindex @code{NAME} (MRI) -@item NAME @var{output-name} -@var{output-name} is the name for the program produced by @code{ld}; the -MRI-compatible command @code{NAME} is equivalent to the command-line -option @samp{-o} or the general script language command @code{OUTPUT}. - -@cindex @code{ORDER} (MRI) -@item ORDER @var{secname}, @var{secname}, @dots{} @var{secname} -@itemx ORDER @var{secname} @var{secname} @var{secname} -Normally, @code{ld} orders the sections in its output file in the -order in which they first appear in the input files. In an MRI-compatible -script, you can override this ordering with the @code{ORDER} command. The -sections you list with @code{ORDER} will appear first in your output -file, in the order specified. - -@cindex @code{PUBLIC} (MRI) -@item PUBLIC @var{name}=@var{expression} -@itemx PUBLIC @var{name},@var{expression} -@itemx PUBLIC @var{name} @var{expression} -Supply a value (@var{expression}) for external symbol -@var{name} used in the linker input files. - -@cindex @code{SECT} (MRI) -@item SECT @var{secname}, @var{expression} -@itemx SECT @var{secname}=@var{expression} -@itemx SECT @var{secname} @var{expression} -You can use any of these three forms of the @code{SECT} command to -specify the start address (@var{expression}) for section @var{secname}. -If you have more than one @code{SECT} statement for the same -@var{secname}, only the @emph{first} sets the start address. -@end table - -@node Index -@unnumbered Index - -@printindex cp - -@tex -% I think something like @colophon should be in texinfo. In the -% meantime: -\long\def\colophon{\hbox to0pt{}\vfill -\centerline{The body of this manual is set in} -\centerline{\fontname\tenrm,} -\centerline{with headings in {\bf\fontname\tenbf}} -\centerline{and examples in {\tt\fontname\tentt}.} -\centerline{{\it\fontname\tenit\/} and} -\centerline{{\sl\fontname\tensl\/}} -\centerline{are used for emphasis.}\vfill} -\page\colophon -% Blame: doc@cygnus.com, 28mar91. -@end tex - - -@contents -@bye - - diff --git a/gnu/dist/ld/ldcref.c b/gnu/dist/ld/ldcref.c deleted file mode 100644 index 7022daf960e5..000000000000 --- a/gnu/dist/ld/ldcref.c +++ /dev/null @@ -1,547 +0,0 @@ -/* ldcref.c -- output a cross reference table - Copyright (C) 1996, 1997, 1998 Free Software Foundation, Inc. - Written by Ian Lance Taylor - -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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ - -/* This file holds routines that manage the cross reference table. - The table is used to generate cross reference reports. It is also - used to implement the NOCROSSREFS command in the linker script. */ - -#include "bfd.h" -#include "sysdep.h" -#include "bfdlink.h" -#include "libiberty.h" - -#include "ld.h" -#include "ldmain.h" -#include "ldmisc.h" -#include "ldexp.h" -#include "ldlang.h" - -/* We keep an instance of this structure for each reference to a - symbol from a given object. */ - -struct cref_ref -{ - /* The next reference. */ - struct cref_ref *next; - /* The object. */ - bfd *abfd; - /* True if the symbol is defined. */ - unsigned int def : 1; - /* True if the symbol is common. */ - unsigned int common : 1; - /* True if the symbol is undefined. */ - unsigned int undef : 1; -}; - -/* We keep a hash table of symbols. Each entry looks like this. */ - -struct cref_hash_entry -{ - struct bfd_hash_entry root; - /* The demangled name. */ - char *demangled; - /* References to and definitions of this symbol. */ - struct cref_ref *refs; -}; - -/* This is what the hash table looks like. */ - -struct cref_hash_table -{ - struct bfd_hash_table root; -}; - -/* Local functions. */ - -static struct bfd_hash_entry *cref_hash_newfunc - PARAMS ((struct bfd_hash_entry *, struct bfd_hash_table *, const char *)); -static boolean cref_fill_array PARAMS ((struct cref_hash_entry *, PTR)); -static int cref_sort_array PARAMS ((const PTR, const PTR)); -static void output_one_cref PARAMS ((FILE *, struct cref_hash_entry *)); -static boolean check_nocrossref PARAMS ((struct cref_hash_entry *, PTR)); -static void check_refs - PARAMS ((struct cref_hash_entry *, struct bfd_link_hash_entry *, - struct lang_nocrossrefs *)); -static void check_reloc_refs PARAMS ((bfd *, asection *, PTR)); - -/* Look up an entry in the cref hash table. */ - -#define cref_hash_lookup(table, string, create, copy) \ - ((struct cref_hash_entry *) \ - bfd_hash_lookup (&(table)->root, (string), (create), (copy))) - -/* Traverse the cref hash table. */ - -#define cref_hash_traverse(table, func, info) \ - (bfd_hash_traverse \ - (&(table)->root, \ - (boolean (*) PARAMS ((struct bfd_hash_entry *, PTR))) (func), \ - (info))) - -/* The cref hash table. */ - -static struct cref_hash_table cref_table; - -/* Whether the cref hash table has been initialized. */ - -static boolean cref_initialized; - -/* The number of symbols seen so far. */ - -static size_t cref_symcount; - -/* Create an entry in a cref hash table. */ - -static struct bfd_hash_entry * -cref_hash_newfunc (entry, table, string) - struct bfd_hash_entry *entry; - struct bfd_hash_table *table; - const char *string; -{ - struct cref_hash_entry *ret = (struct cref_hash_entry *) entry; - - /* Allocate the structure if it has not already been allocated by a - subclass. */ - if (ret == NULL) - ret = ((struct cref_hash_entry *) - bfd_hash_allocate (table, sizeof (struct cref_hash_entry))); - if (ret == NULL) - return (struct bfd_hash_entry *) ret; - - /* Call the allocation method of the superclass. */ - ret = ((struct cref_hash_entry *) - bfd_hash_newfunc ((struct bfd_hash_entry *) ret, table, string)); - if (ret != NULL) - { - /* Set local fields. */ - ret->demangled = NULL; - ret->refs = NULL; - - /* Keep a count of the number of entries created in the hash - table. */ - ++cref_symcount; - } - - return (struct bfd_hash_entry *) ret; -} - -/* Add a symbol to the cref hash table. This is called for every - symbol that is seen during the link. */ - -/*ARGSUSED*/ -void -add_cref (name, abfd, section, value) - const char *name; - bfd *abfd; - asection *section; - bfd_vma value; -{ - struct cref_hash_entry *h; - struct cref_ref *r; - - if (! cref_initialized) - { - if (! bfd_hash_table_init (&cref_table.root, cref_hash_newfunc)) - einfo ("%X%P: bfd_hash_table_init of cref table failed: %E\n"); - cref_initialized = true; - } - - h = cref_hash_lookup (&cref_table, name, true, false); - if (h == NULL) - einfo ("%X%P: cref_hash_lookup failed: %E\n"); - - for (r = h->refs; r != NULL; r = r->next) - if (r->abfd == abfd) - break; - - if (r == NULL) - { - r = (struct cref_ref *) xmalloc (sizeof *r); - r->next = h->refs; - h->refs = r; - r->abfd = abfd; - r->def = false; - r->common = false; - r->undef = false; - } - - if (bfd_is_und_section (section)) - r->undef = true; - else if (bfd_is_com_section (section)) - r->common = true; - else - r->def = true; -} - -/* Copy the addresses of the hash table entries into an array. This - is called via cref_hash_traverse. We also fill in the demangled - name. */ - -static boolean -cref_fill_array (h, data) - struct cref_hash_entry *h; - PTR data; -{ - struct cref_hash_entry ***pph = (struct cref_hash_entry ***) data; - - ASSERT (h->demangled == NULL); - h->demangled = demangle (h->root.string); - - **pph = h; - - ++*pph; - - return true; -} - -/* Sort an array of cref hash table entries by name. */ - -static int -cref_sort_array (a1, a2) - const PTR a1; - const PTR a2; -{ - const struct cref_hash_entry **p1 = (const struct cref_hash_entry **) a1; - const struct cref_hash_entry **p2 = (const struct cref_hash_entry **) a2; - - return strcmp ((*p1)->demangled, (*p2)->demangled); -} - -/* Write out the cref table. */ - -#define FILECOL (50) - -void -output_cref (fp) - FILE *fp; -{ - int len; - struct cref_hash_entry **csyms, **csym_fill, **csym, **csym_end; - - fprintf (fp, "\nCross Reference Table\n\n"); - fprintf (fp, "Symbol"); - len = sizeof "Symbol" - 1; - while (len < FILECOL) - { - putc (' ' , fp); - ++len; - } - fprintf (fp, "File\n"); - - if (! cref_initialized) - { - fprintf (fp, "No symbols\n"); - return; - } - - csyms = ((struct cref_hash_entry **) - xmalloc (cref_symcount * sizeof (*csyms))); - - csym_fill = csyms; - cref_hash_traverse (&cref_table, cref_fill_array, &csym_fill); - ASSERT ((size_t) (csym_fill - csyms) == cref_symcount); - - qsort (csyms, cref_symcount, sizeof (*csyms), cref_sort_array); - - csym_end = csyms + cref_symcount; - for (csym = csyms; csym < csym_end; csym++) - output_one_cref (fp, *csym); -} - -/* Output one entry in the cross reference table. */ - -static void -output_one_cref (fp, h) - FILE *fp; - struct cref_hash_entry *h; -{ - int len; - struct bfd_link_hash_entry *hl; - struct cref_ref *r; - - hl = bfd_link_hash_lookup (link_info.hash, h->root.string, false, - false, true); - if (hl == NULL) - einfo ("%P: symbol `%T' missing from main hash table\n", - h->root.string); - else - { - /* If this symbol is defined in a dynamic object but never - referenced by a normal object, then don't print it. */ - if (hl->type == bfd_link_hash_defined) - { - if (hl->u.def.section->output_section == NULL) - return; - if (hl->u.def.section->owner != NULL - && (hl->u.def.section->owner->flags & DYNAMIC) != 0) - { - for (r = h->refs; r != NULL; r = r->next) - if ((r->abfd->flags & DYNAMIC) == 0) - break; - if (r == NULL) - return; - } - } - } - - fprintf (fp, "%s ", h->demangled); - len = strlen (h->demangled) + 1; - - for (r = h->refs; r != NULL; r = r->next) - { - if (r->def) - { - while (len < FILECOL) - { - putc (' ', fp); - ++len; - } - lfinfo (fp, "%B\n", r->abfd); - len = 0; - } - } - - for (r = h->refs; r != NULL; r = r->next) - { - if (! r->def) - { - while (len < FILECOL) - { - putc (' ', fp); - ++len; - } - lfinfo (fp, "%B\n", r->abfd); - len = 0; - } - } - - ASSERT (len == 0); -} - -/* Check for prohibited cross references. */ - -void -check_nocrossrefs () -{ - if (! cref_initialized) - return; - - cref_hash_traverse (&cref_table, check_nocrossref, (PTR) NULL); -} - -/* Check one symbol to see if it is a prohibited cross reference. */ - -/*ARGSUSED*/ -static boolean -check_nocrossref (h, ignore) - struct cref_hash_entry *h; - PTR ignore; -{ - struct bfd_link_hash_entry *hl; - asection *defsec; - const char *defsecname; - struct lang_nocrossrefs *ncrs; - struct lang_nocrossref *ncr; - - hl = bfd_link_hash_lookup (link_info.hash, h->root.string, false, - false, true); - if (hl == NULL) - { - einfo ("%P: symbol `%T' missing from main hash table\n", - h->root.string); - return true; - } - - if (hl->type != bfd_link_hash_defined - && hl->type != bfd_link_hash_defweak) - return true; - - defsec = hl->u.def.section->output_section; - if (defsec == NULL) - return true; - defsecname = bfd_get_section_name (defsec->owner, defsec); - - for (ncrs = nocrossref_list; ncrs != NULL; ncrs = ncrs->next) - for (ncr = ncrs->list; ncr != NULL; ncr = ncr->next) - if (strcmp (ncr->name, defsecname) == 0) - check_refs (h, hl, ncrs); - - return true; -} - -/* The struct is used to pass information from check_refs to - check_reloc_refs through bfd_map_over_sections. */ - -struct check_refs_info -{ - struct cref_hash_entry *h; - asection *defsec; - struct lang_nocrossrefs *ncrs; - asymbol **asymbols; - boolean same; -}; - -/* This function is called for each symbol defined in a section which - prohibits cross references. We need to look through all references - to this symbol, and ensure that the references are not from - prohibited sections. */ - -static void -check_refs (h, hl, ncrs) - struct cref_hash_entry *h; - struct bfd_link_hash_entry *hl; - struct lang_nocrossrefs *ncrs; -{ - struct cref_ref *ref; - - for (ref = h->refs; ref != NULL; ref = ref->next) - { - lang_input_statement_type *li; - asymbol **asymbols; - struct check_refs_info info; - - /* We need to look through the relocations for this BFD, to see - if any of the relocations which refer to this symbol are from - a prohibited section. Note that we need to do this even for - the BFD in which the symbol is defined, since even a single - BFD might contain a prohibited cross reference; for this - case, we set the SAME field in INFO, which will cause - CHECK_RELOCS_REFS to check for relocations against the - section as well as against the symbol. */ - - li = (lang_input_statement_type *) ref->abfd->usrdata; - if (li != NULL && li->asymbols != NULL) - asymbols = li->asymbols; - else - { - long symsize; - long symbol_count; - - symsize = bfd_get_symtab_upper_bound (ref->abfd); - if (symsize < 0) - einfo ("%B%F: could not read symbols; %E\n", ref->abfd); - asymbols = (asymbol **) xmalloc (symsize); - symbol_count = bfd_canonicalize_symtab (ref->abfd, asymbols); - if (symbol_count < 0) - einfo ("%B%F: could not read symbols: %E\n", ref->abfd); - if (li != NULL) - { - li->asymbols = asymbols; - li->symbol_count = symbol_count; - } - } - - info.h = h; - info.defsec = hl->u.def.section; - info.ncrs = ncrs; - info.asymbols = asymbols; - if (ref->abfd == hl->u.def.section->owner) - info.same = true; - else - info.same = false; - bfd_map_over_sections (ref->abfd, check_reloc_refs, (PTR) &info); - - if (li == NULL) - free (asymbols); - } -} - -/* This is called via bfd_map_over_sections. INFO->H is a symbol - defined in INFO->DEFSECNAME. If this section maps into any of the - sections listed in INFO->NCRS, other than INFO->DEFSECNAME, then we - look through the relocations. If any of the relocations are to - INFO->H, then we report a prohibited cross reference error. */ - -static void -check_reloc_refs (abfd, sec, iarg) - bfd *abfd; - asection *sec; - PTR iarg; -{ - struct check_refs_info *info = (struct check_refs_info *) iarg; - asection *outsec; - const char *outsecname; - asection *outdefsec; - const char *outdefsecname; - struct lang_nocrossref *ncr; - const char *symname; - long relsize; - arelent **relpp; - long relcount; - arelent **p, **pend; - - outsec = sec->output_section; - outsecname = bfd_get_section_name (outsec->owner, outsec); - - outdefsec = info->defsec->output_section; - outdefsecname = bfd_get_section_name (outdefsec->owner, outdefsec); - - /* The section where the symbol is defined is permitted. */ - if (strcmp (outsecname, outdefsecname) == 0) - return; - - for (ncr = info->ncrs->list; ncr != NULL; ncr = ncr->next) - if (strcmp (outsecname, ncr->name) == 0) - break; - - if (ncr == NULL) - return; - - /* This section is one for which cross references are prohibited. - Look through the relocations, and see if any of them are to - INFO->H. */ - - symname = info->h->root.string; - - relsize = bfd_get_reloc_upper_bound (abfd, sec); - if (relsize < 0) - einfo ("%B%F: could not read relocs: %E\n", abfd); - if (relsize == 0) - return; - - relpp = (arelent **) xmalloc (relsize); - relcount = bfd_canonicalize_reloc (abfd, sec, relpp, info->asymbols); - if (relcount < 0) - einfo ("%B%F: could not read relocs: %E\n", abfd); - - p = relpp; - pend = p + relcount; - for (; p < pend && *p != NULL; p++) - { - arelent *q = *p; - - if (q->sym_ptr_ptr != NULL - && *q->sym_ptr_ptr != NULL - && (strcmp (bfd_asymbol_name (*q->sym_ptr_ptr), symname) == 0 - || (info->same - && bfd_get_section (*q->sym_ptr_ptr) == info->defsec))) - { - /* We found a reloc for the symbol. The symbol is defined - in OUTSECNAME. This reloc is from a section which is - mapped into a section from which references to OUTSECNAME - are prohibited. We must report an error. */ - einfo ("%X%C: prohibited cross reference from %s to `%T' in %s\n", - abfd, sec, q->address, outsecname, - bfd_asymbol_name (*q->sym_ptr_ptr), outdefsecname); - } - } - - free (relpp); -} diff --git a/gnu/dist/ld/ldctor.c b/gnu/dist/ld/ldctor.c deleted file mode 100644 index 6e40938d7f18..000000000000 --- a/gnu/dist/ld/ldctor.c +++ /dev/null @@ -1,256 +0,0 @@ -/* ldctor.c -- constructor support routines - Copyright (C) 1991, 92, 93, 94, 1995 Free Software Foundation, Inc. - By Steve Chamberlain - -This file is part of GLD, the Gnu Linker. - -GLD 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, or (at your option) -any later version. - -GLD 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 GLD; see the file COPYING. If not, write to -the Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ - -#include "bfd.h" -#include "sysdep.h" -#include "bfdlink.h" - -#include "ld.h" -#include "ldexp.h" -#include "ldlang.h" -#include "ldmisc.h" -#include "ldgram.h" -#include "ldmain.h" -#include "ldctor.h" - -/* The list of statements needed to handle constructors. These are - invoked by the command CONSTRUCTORS in the linker script. */ -lang_statement_list_type constructor_list; - -/* The sets we have seen. */ -struct set_info *sets; - -/* Add an entry to a set. H is the entry in the linker hash table. - RELOC is the relocation to use for an entry in the set. SECTION - and VALUE are the value to add. This is called during the first - phase of the link, when we are still gathering symbols together. - We just record the information now. The ldctor_find_constructors - function will construct the sets. */ - -void -ldctor_add_set_entry (h, reloc, name, section, value) - struct bfd_link_hash_entry *h; - bfd_reloc_code_real_type reloc; - const char *name; - asection *section; - bfd_vma value; -{ - struct set_info *p; - struct set_element *e; - struct set_element **epp; - - for (p = sets; p != (struct set_info *) NULL; p = p->next) - if (p->h == h) - break; - - if (p == (struct set_info *) NULL) - { - p = (struct set_info *) xmalloc (sizeof (struct set_info)); - p->next = sets; - sets = p; - p->h = h; - p->reloc = reloc; - p->count = 0; - p->elements = NULL; - } - else - { - if (p->reloc != reloc) - { - einfo ("%P%X: Different relocs used in set %s\n", h->root.string); - return; - } - - /* Don't permit a set to be constructed from different object - file formats. The same reloc may have different results. We - actually could sometimes handle this, but the case is - unlikely to ever arise. Sometimes constructor symbols are in - unusual sections, such as the absolute section--this appears - to be the case in Linux a.out--and in such cases we just - assume everything is OK. */ - if (p->elements != NULL - && section->owner != NULL - && p->elements->section->owner != NULL - && strcmp (bfd_get_target (section->owner), - bfd_get_target (p->elements->section->owner)) != 0) - { - einfo ("%P%X: Different object file formats composing set %s\n", - h->root.string); - return; - } - } - - e = (struct set_element *) xmalloc (sizeof (struct set_element)); - e->next = NULL; - e->name = name; - e->section = section; - e->value = value; - - for (epp = &p->elements; *epp != NULL; epp = &(*epp)->next) - ; - *epp = e; - - ++p->count; -} - -/* This function is called after the first phase of the link and - before the second phase. At this point all set information has - been gathered. We now put the statements to build the sets - themselves into constructor_list. */ - -void -ldctor_build_sets () -{ - static boolean called; - lang_statement_list_type *old; - boolean header_printed; - struct set_info *p; - - /* The emulation code may call us directly, but we only want to do - this once. */ - if (called) - return; - called = true; - - old = stat_ptr; - stat_ptr = &constructor_list; - - lang_list_init (stat_ptr); - - header_printed = false; - for (p = sets; p != (struct set_info *) NULL; p = p->next) - { - struct set_element *e; - reloc_howto_type *howto; - int reloc_size, size; - - /* If the symbol is defined, we may have been invoked from - collect, and the sets may already have been built, so we do - not do anything. */ - if (p->h->type == bfd_link_hash_defined - || p->h->type == bfd_link_hash_defweak) - continue; - - /* For each set we build: - set: - .long number_of_elements - .long element0 - ... - .long elementN - .long 0 - except that we use the right size instead of .long. When - generating relocateable output, we generate relocs instead of - addresses. */ - howto = bfd_reloc_type_lookup (output_bfd, p->reloc); - if (howto == (reloc_howto_type *) NULL) - { - if (link_info.relocateable) - { - einfo ("%P%X: %s does not support reloc %s for set %s\n", - bfd_get_target (output_bfd), - bfd_get_reloc_code_name (p->reloc), - p->h->root.string); - continue; - } - - /* If this is not a relocateable link, all we need is the - size, which we can get from the input BFD. */ - howto = bfd_reloc_type_lookup (p->elements->section->owner, - p->reloc); - if (howto == NULL) - { - einfo ("%P%X: %s does not support reloc %s for set %s\n", - bfd_get_target (p->elements->section->owner), - bfd_get_reloc_code_name (p->reloc), - p->h->root.string); - continue; - } - } - - reloc_size = bfd_get_reloc_size (howto); - switch (reloc_size) - { - case 1: size = BYTE; break; - case 2: size = SHORT; break; - case 4: size = LONG; break; - case 8: - if (howto->complain_on_overflow == complain_overflow_signed) - size = SQUAD; - else - size = QUAD; - break; - default: - einfo ("%P%X: Unsupported size %d for set %s\n", - bfd_get_reloc_size (howto), p->h->root.string); - size = LONG; - break; - } - - lang_add_assignment (exp_assop ('=', ".", - exp_unop (ALIGN_K, - exp_intop (reloc_size)))); - lang_add_assignment (exp_assop ('=', p->h->root.string, - exp_nameop (NAME, "."))); - lang_add_data (size, exp_intop ((bfd_vma) p->count)); - - for (e = p->elements; e != (struct set_element *) NULL; e = e->next) - { - if (config.map_file != NULL) - { - int len; - - if (! header_printed) - { - minfo ("\nSet Symbol\n\n"); - header_printed = true; - } - - minfo ("%s", p->h->root.string); - len = strlen (p->h->root.string); - - if (len >= 19) - { - print_nl (); - len = 0; - } - while (len < 20) - { - print_space (); - ++len; - } - - if (e->name != NULL) - minfo ("%T\n", e->name); - else - minfo ("%G\n", e->section->owner, e->section, e->value); - } - - if (link_info.relocateable) - lang_add_reloc (p->reloc, howto, e->section, e->name, - exp_intop (e->value)); - else - lang_add_data (size, exp_relop (e->section, e->value)); - } - - lang_add_data (size, exp_intop (0)); - } - - stat_ptr = old; -} diff --git a/gnu/dist/ld/ldctor.h b/gnu/dist/ld/ldctor.h deleted file mode 100644 index d87f0dbd5f99..000000000000 --- a/gnu/dist/ld/ldctor.h +++ /dev/null @@ -1,54 +0,0 @@ -/* ldctor.h - linker constructor support - Copyright 1991, 1992, 1993 Free Software Foundation, Inc. - -This file is part of GLD, the Gnu Linker. - -GLD 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, or (at your option) -any later version. - -GLD 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 GLD; see the file COPYING. If not, write to -the Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ - -#ifndef LDCTOR_H -#define LDCTOR_H - -/* List of statements needed to handle constructors */ -extern lang_statement_list_type constructor_list; - -/* We keep a list of these structures for each set we build. */ - -struct set_info -{ - struct set_info *next; /* Next set. */ - struct bfd_link_hash_entry *h; /* Hash table entry. */ - bfd_reloc_code_real_type reloc; /* Reloc to use for an entry. */ - size_t count; /* Number of elements. */ - struct set_element *elements; /* Elements in set. */ -}; - -struct set_element -{ - struct set_element *next; /* Next element. */ - const char *name; /* Name in set (may be NULL). */ - asection *section; /* Section of value in set. */ - bfd_vma value; /* Value in set. */ -}; - -/* The sets we have seen. */ - -extern struct set_info *sets; - -extern void ldctor_add_set_entry PARAMS ((struct bfd_link_hash_entry *, - bfd_reloc_code_real_type, - const char *, asection *, bfd_vma)); -extern void ldctor_build_sets PARAMS ((void)); - -#endif diff --git a/gnu/dist/ld/ldemul.c b/gnu/dist/ld/ldemul.c deleted file mode 100644 index 41cc5446557d..000000000000 --- a/gnu/dist/ld/ldemul.c +++ /dev/null @@ -1,262 +0,0 @@ -/* ldemul.c -- clearing house for ld emulation states - Copyright (C) 1991, 92, 93, 94, 95, 96, 1997 Free Software Foundation, Inc. - -This file is part of GLD, the Gnu Linker. - -GLD 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, or (at your option) -any later version. - -GLD 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 GLD; see the file COPYING. If not, write to -the Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ - -#include "bfd.h" -#include "sysdep.h" - -#include "ld.h" -#include "ldemul.h" -#include "ldmisc.h" -#include "ldexp.h" -#include "ldlang.h" -#include "ldfile.h" -#include "ldmain.h" -#include "ldemul-list.h" - -ld_emulation_xfer_type *ld_emulation; - -void -ldemul_hll(name) - char *name; -{ - ld_emulation->hll(name); -} - - -void ldemul_syslib(name) - char *name; -{ - ld_emulation->syslib(name); -} - -void -ldemul_after_parse() -{ - ld_emulation->after_parse(); -} - -void -ldemul_before_parse() -{ - ld_emulation->before_parse(); -} - -void -ldemul_after_open () -{ - ld_emulation->after_open (); -} - -void -ldemul_after_allocation() -{ - ld_emulation->after_allocation(); -} - -void -ldemul_before_allocation() -{ - if (ld_emulation->before_allocation) - ld_emulation->before_allocation(); -} - - -void -ldemul_set_output_arch() -{ - ld_emulation->set_output_arch(); -} - -void -ldemul_finish() -{ - if (ld_emulation->finish) - ld_emulation->finish(); -} - -void -ldemul_set_symbols() -{ - if (ld_emulation->set_symbols) - ld_emulation->set_symbols(); -} - -void -ldemul_create_output_section_statements() -{ - if (ld_emulation->create_output_section_statements) - ld_emulation->create_output_section_statements(); -} - -char * -ldemul_get_script(isfile) - int *isfile; -{ - return ld_emulation->get_script(isfile); -} - -boolean -ldemul_open_dynamic_archive (arch, search, entry) - const char *arch; - search_dirs_type *search; - lang_input_statement_type *entry; -{ - if (ld_emulation->open_dynamic_archive) - return (*ld_emulation->open_dynamic_archive) (arch, search, entry); - return false; -} - -boolean -ldemul_place_orphan (file, s) - lang_input_statement_type *file; - asection *s; -{ - if (ld_emulation->place_orphan) - return (*ld_emulation->place_orphan) (file, s); - return false; -} - -int -ldemul_parse_args (argc, argv) - int argc; - char **argv; -{ - /* Try and use the emulation parser if there is one. */ - if (ld_emulation->parse_args) - { - return ld_emulation->parse_args (argc, argv); - } - return 0; -} - -/* Let the emulation code handle an unrecognized file. */ - -boolean -ldemul_unrecognized_file (entry) - lang_input_statement_type *entry; -{ - if (ld_emulation->unrecognized_file) - return (*ld_emulation->unrecognized_file) (entry); - return false; -} - -char * -ldemul_choose_target() -{ - return ld_emulation->choose_target(); -} - -/* The default choose_target function. */ - -char * -ldemul_default_target() -{ - char *from_outside = getenv (TARGET_ENVIRON); - if (from_outside != (char *)NULL) - return from_outside; - return ld_emulation->target_name; -} - -void -after_parse_default() -{ - -} - -void -after_open_default () -{ -} - -void -after_allocation_default() -{ - -} - -void -before_allocation_default() -{ - -} - -void -set_output_arch_default() -{ - /* Set the output architecture and machine if possible */ - bfd_set_arch_mach(output_bfd, - ldfile_output_architecture, ldfile_output_machine); -} - -/*ARGSUSED*/ -void -syslib_default(ignore) - char *ignore; -{ - info_msg ("%S SYSLIB ignored\n"); -} - -/*ARGSUSED*/ -void -hll_default(ignore) - char *ignore; -{ - info_msg ("%S HLL ignored\n"); -} - -ld_emulation_xfer_type *ld_emulations[] = { EMULATION_LIST }; - -void -ldemul_choose_mode(target) - char *target; -{ - ld_emulation_xfer_type **eptr = ld_emulations; - /* Ignore "gld" prefix. */ - if (target[0] == 'g' && target[1] == 'l' && target[2] == 'd') - target += 3; - for (; *eptr; eptr++) - { - if (strcmp(target, (*eptr)->emulation_name) == 0) - { - ld_emulation = *eptr; - return; - } - } - einfo ("%P: unrecognised emulation mode: %s\n", target); - einfo ("Supported emulations: "); - ldemul_list_emulations (stderr); - einfo ("%F\n"); -} - -void -ldemul_list_emulations (f) - FILE *f; -{ - ld_emulation_xfer_type **eptr = ld_emulations; - boolean first = true; - - for (; *eptr; eptr++) - { - if (first) - first = false; - else - fprintf (f, " "); - fprintf (f, "%s", (*eptr)->emulation_name); - } -} diff --git a/gnu/dist/ld/ldemul.h b/gnu/dist/ld/ldemul.h deleted file mode 100644 index f01f357ba1ce..000000000000 --- a/gnu/dist/ld/ldemul.h +++ /dev/null @@ -1,138 +0,0 @@ -/* ld-emul.h - Linker emulation header file - Copyright 1991, 92, 93, 94, 95, 96, 1997 Free Software Foundation, Inc. - - This file is part of GLD, the Gnu Linker. - - GLD 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 1, or (at your option) - any later version. - - GLD 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. */ - -#ifndef LDEMUL_H -#define LDEMUL_H - -#if ANSI_PROTOTYPES -struct lang_input_statement_struct; -struct search_dirs; -#endif - -extern void ldemul_hll PARAMS ((char *)); -extern void ldemul_syslib PARAMS ((char *)); -extern void ldemul_after_parse PARAMS ((void)); -extern void ldemul_before_parse PARAMS ((void)); -extern void ldemul_after_open PARAMS ((void)); -extern void ldemul_after_allocation PARAMS ((void)); -extern void ldemul_before_allocation PARAMS ((void)); -extern void ldemul_set_output_arch PARAMS ((void)); -extern char *ldemul_choose_target PARAMS ((void)); -extern void ldemul_choose_mode PARAMS ((char *)); -extern void ldemul_list_emulations PARAMS ((FILE *)); -extern char *ldemul_get_script PARAMS ((int *isfile)); -extern void ldemul_finish PARAMS ((void)); -extern void ldemul_set_symbols PARAMS ((void)); -extern void ldemul_create_output_section_statements PARAMS ((void)); -extern boolean ldemul_place_orphan - PARAMS ((struct lang_input_statement_struct *, asection *)); -extern int ldemul_parse_args PARAMS ((int, char **)); -extern boolean ldemul_unrecognized_file - PARAMS ((struct lang_input_statement_struct *)); -extern boolean ldemul_open_dynamic_archive - PARAMS ((const char *, struct search_dirs *, - struct lang_input_statement_struct *)); -extern char *ldemul_default_target PARAMS ((void)); -extern void after_parse_default PARAMS ((void)); -extern void after_open_default PARAMS ((void)); -extern void after_allocation_default PARAMS ((void)); -extern void before_allocation_default PARAMS ((void)); -extern void set_output_arch_default PARAMS ((void)); -extern void syslib_default PARAMS ((char*)); -extern void hll_default PARAMS ((char*)); - -typedef struct ld_emulation_xfer_struct -{ - /* Run before parsing the command line and script file. - Set the architecture, maybe other things. */ - void (*before_parse) PARAMS ((void)); - - /* Handle the SYSLIB (low level library) script command. */ - void (*syslib) PARAMS ((char *)); - - /* Handle the HLL (high level library) script command. */ - void (*hll) PARAMS ((char *)); - - /* Run after parsing the command line and script file. */ - void (*after_parse) PARAMS ((void)); - - /* Run after opening all input files, and loading the symbols. */ - void (*after_open) PARAMS ((void)); - - /* Run after allocating output sections. */ - void (*after_allocation) PARAMS ( (void)); - - /* Set the output architecture and machine if possible. */ - void (*set_output_arch) PARAMS ((void)); - - /* Decide which target name to use. */ - char * (*choose_target) PARAMS ((void)); - - /* Run before allocating output sections. */ - void (*before_allocation) PARAMS ((void)); - - /* Return the appropriate linker script. */ - char * (*get_script) PARAMS ((int *isfile)); - - /* The name of this emulation. */ - char *emulation_name; - - /* The output format. */ - char *target_name; - - /* Run after assigning values from the script. */ - void (*finish) PARAMS ((void)); - - /* Create any output sections needed by the target. */ - void (*create_output_section_statements) PARAMS ((void)); - - /* Try to open a dynamic library. ARCH is an architecture name, and - is normally the empty string. ENTRY is the lang_input_statement - that should be opened. */ - boolean (*open_dynamic_archive) - PARAMS ((const char *arch, struct search_dirs *, - struct lang_input_statement_struct *entry)); - - /* Place an orphan section. Return true if it was placed, false if - the default action should be taken. This field may be NULL, in - which case the default action will always be taken. */ - boolean (*place_orphan) - PARAMS ((struct lang_input_statement_struct *, asection *)); - - /* Run after assigning parsing with the args, but before - reading the script. Used to initialize symbols used in the script. */ - void (*set_symbols) PARAMS ((void)); - - /* Run to parse args which the base linker doesn't - understand. Return non zero on sucess. */ - int (*parse_args) PARAMS ((int, char **)); - - /* Run to handle files which are not recognized as object files or - archives. Return true if the file was handled. */ - boolean (*unrecognized_file) - PARAMS ((struct lang_input_statement_struct *)); - -} ld_emulation_xfer_type; - -typedef enum -{ - intel_ic960_ld_mode_enum, - default_mode_enum , - intel_gld960_ld_mode_enum -} lang_emulation_mode_enum_type; - -extern ld_emulation_xfer_type *ld_emulations[]; - -#endif diff --git a/gnu/dist/ld/ldexp.c b/gnu/dist/ld/ldexp.c deleted file mode 100644 index 34716213d24c..000000000000 --- a/gnu/dist/ld/ldexp.c +++ /dev/null @@ -1,950 +0,0 @@ -/* This module handles expression trees. -Copyright (C) 1991, 92, 93, 94, 95, 96, 1997 Free Software Foundation, Inc. -Written by Steve Chamberlain of Cygnus Support (sac@cygnus.com). - -This file is part of GLD, the Gnu Linker. - -GLD 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, or (at your option) -any later version. - -GLD 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 GLD; see the file COPYING. If not, write to the Free -Software Foundation, 59 Temple Place - Suite 330, Boston, MA -02111-1307, USA. */ - -/* -This module is in charge of working out the contents of expressions. - -It has to keep track of the relative/absness of a symbol etc. This is -done by keeping all values in a struct (an etree_value_type) which -contains a value, a section to which it is relative and a valid bit. - -*/ - - -#include "bfd.h" -#include "sysdep.h" -#include "bfdlink.h" - -#include "ld.h" -#include "ldmain.h" -#include "ldmisc.h" -#include "ldexp.h" -#include "ldgram.h" -#include "ldlang.h" - -static void exp_print_token PARAMS ((token_code_type code)); -static void make_abs PARAMS ((etree_value_type *ptr)); -static etree_value_type new_abs PARAMS ((bfd_vma value)); -static void check PARAMS ((lang_output_section_statement_type *os, - const char *name, const char *op)); -static etree_value_type new_rel - PARAMS ((bfd_vma value, lang_output_section_statement_type *section)); -static etree_value_type new_rel_from_section - PARAMS ((bfd_vma value, lang_output_section_statement_type *section)); -static etree_value_type fold_binary - PARAMS ((etree_type *tree, - lang_output_section_statement_type *current_section, - lang_phase_type allocation_done, - bfd_vma dot, bfd_vma *dotp)); -static etree_value_type fold_name - PARAMS ((etree_type *tree, - lang_output_section_statement_type *current_section, - lang_phase_type allocation_done, - bfd_vma dot)); -static etree_value_type exp_fold_tree_no_dot - PARAMS ((etree_type *tree, - lang_output_section_statement_type *current_section, - lang_phase_type allocation_done)); - -static void -exp_print_token (code) - token_code_type code; -{ - static CONST struct - { - token_code_type code; - char *name; - } table[] = - { - { INT, "int" }, - { REL, "relocateable" }, - { NAME,"NAME" }, - { PLUSEQ,"+=" }, - { MINUSEQ,"-=" }, - { MULTEQ,"*=" }, - { DIVEQ,"/=" }, - { LSHIFTEQ,"<<=" }, - { RSHIFTEQ,">>=" }, - { ANDEQ,"&=" }, - { OREQ,"|=" }, - { OROR,"||" }, - { ANDAND,"&&" }, - { EQ,"==" }, - { NE,"!=" }, - { LE,"<=" }, - { GE,">=" }, - { LSHIFT,"<<" }, - { RSHIFT,">>=" }, - { ALIGN_K,"ALIGN" }, - { BLOCK,"BLOCK" }, - { SECTIONS,"SECTIONS" }, - { SIZEOF_HEADERS,"SIZEOF_HEADERS" }, - { NEXT,"NEXT" }, - { SIZEOF,"SIZEOF" }, - { ADDR,"ADDR" }, - { LOADADDR,"LOADADDR" }, - { MEMORY,"MEMORY" }, - { DEFINED,"DEFINED" }, - { TARGET_K,"TARGET" }, - { SEARCH_DIR,"SEARCH_DIR" }, - { MAP,"MAP" }, - { QUAD,"QUAD" }, - { SQUAD,"SQUAD" }, - { LONG,"LONG" }, - { SHORT,"SHORT" }, - { BYTE,"BYTE" }, - { ENTRY,"ENTRY" }, - { 0,(char *)NULL } - }; - unsigned int idx; - - for (idx = 0; table[idx].name != (char*)NULL; idx++) { - if (table[idx].code == code) { - fprintf(config.map_file, "%s", table[idx].name); - return; - } - } - /* Not in table, just print it alone */ - fprintf(config.map_file, "%c",code); -} - -static void -make_abs (ptr) - etree_value_type *ptr; -{ - asection *s = ptr->section->bfd_section; - ptr->value += s->vma; - ptr->section = abs_output_section; -} - -static etree_value_type -new_abs (value) - bfd_vma value; -{ - etree_value_type new; - new.valid = true; - new.section = abs_output_section; - new.value = value; - return new; -} - -static void -check (os, name, op) - lang_output_section_statement_type *os; - const char *name; - const char *op; -{ - if (os == NULL) - einfo ("%F%P: %s uses undefined section %s\n", op, name); - if (! os->processed) - einfo ("%F%P: %s forward reference of section %s\n", op, name); -} - -etree_type * -exp_intop (value) - bfd_vma value; -{ - etree_type *new = (etree_type *) stat_alloc(sizeof(new->value)); - new->type.node_code = INT; - new->value.value = value; - new->type.node_class = etree_value; - return new; - -} - -/* Build an expression representing an unnamed relocateable value. */ - -etree_type * -exp_relop (section, value) - asection *section; - bfd_vma value; -{ - etree_type *new = (etree_type *) stat_alloc (sizeof (new->rel)); - new->type.node_code = REL; - new->type.node_class = etree_rel; - new->rel.section = section; - new->rel.value = value; - return new; -} - -static etree_value_type -new_rel (value, section) - bfd_vma value; - lang_output_section_statement_type *section; -{ - etree_value_type new; - new.valid = true; - new.value = value; - new.section = section; - return new; -} - -static etree_value_type -new_rel_from_section (value, section) - bfd_vma value; - lang_output_section_statement_type *section; -{ - etree_value_type new; - new.valid = true; - new.value = value; - new.section = section; - - new.value -= section->bfd_section->vma; - - return new; -} - -static etree_value_type -fold_binary (tree, current_section, allocation_done, dot, dotp) - etree_type *tree; - lang_output_section_statement_type *current_section; - lang_phase_type allocation_done; - bfd_vma dot; - bfd_vma *dotp; -{ - etree_value_type result; - - result = exp_fold_tree (tree->binary.lhs, current_section, - allocation_done, dot, dotp); - if (result.valid) - { - etree_value_type other; - - other = exp_fold_tree (tree->binary.rhs, - current_section, - allocation_done, dot,dotp) ; - if (other.valid) - { - /* If the values are from different sections, or this is an - absolute expression, make both the source arguments - absolute. However, adding or subtracting an absolute - value from a relative value is meaningful, and is an - exception. */ - if (current_section != abs_output_section - && (other.section == abs_output_section - || (result.section == abs_output_section - && tree->type.node_code == '+')) - && (tree->type.node_code == '+' - || tree->type.node_code == '-')) - { - etree_value_type hold; - - /* If there is only one absolute term, make sure it is the - second one. */ - if (other.section != abs_output_section) - { - hold = result; - result = other; - other = hold; - } - } - else if (result.section != other.section - || current_section == abs_output_section) - { - make_abs(&result); - make_abs(&other); - } - - switch (tree->type.node_code) - { - case '%': - if (other.value == 0) - einfo ("%F%S %% by zero\n"); - result.value = ((bfd_signed_vma) result.value - % (bfd_signed_vma) other.value); - break; - - case '/': - if (other.value == 0) - einfo ("%F%S / by zero\n"); - result.value = ((bfd_signed_vma) result.value - / (bfd_signed_vma) other.value); - break; - -#define BOP(x,y) case x : result.value = result.value y other.value; break; - BOP('+',+); - BOP('*',*); - BOP('-',-); - BOP(LSHIFT,<<); - BOP(RSHIFT,>>); - BOP(EQ,==); - BOP(NE,!=); - BOP('<',<); - BOP('>',>); - BOP(LE,<=); - BOP(GE,>=); - BOP('&',&); - BOP('^',^); - BOP('|',|); - BOP(ANDAND,&&); - BOP(OROR,||); - - case MAX: - if (result.value < other.value) - result = other; - break; - - case MIN: - if (result.value > other.value) - result = other; - break; - - default: - FAIL(); - } - } - else - { - result.valid = false; - } - } - - return result; -} - -etree_value_type -invalid () -{ - etree_value_type new; - new.valid = false; - return new; -} - -static etree_value_type -fold_name (tree, current_section, allocation_done, dot) - etree_type *tree; - lang_output_section_statement_type *current_section; - lang_phase_type allocation_done; - bfd_vma dot; -{ - etree_value_type result; - switch (tree->type.node_code) - { - case SIZEOF_HEADERS: - if (allocation_done != lang_first_phase_enum) - { - result = new_abs ((bfd_vma) - bfd_sizeof_headers (output_bfd, - link_info.relocateable)); - } - else - { - result.valid = false; - } - break; - case DEFINED: - if (allocation_done == lang_first_phase_enum) - result.valid = false; - else - { - struct bfd_link_hash_entry *h; - - h = bfd_wrapped_link_hash_lookup (output_bfd, &link_info, - tree->name.name, - false, false, true); - result.value = (h != (struct bfd_link_hash_entry *) NULL - && (h->type == bfd_link_hash_defined - || h->type == bfd_link_hash_defweak - || h->type == bfd_link_hash_common)); - result.section = 0; - result.valid = true; - } - break; - case NAME: - result.valid = false; - if (tree->name.name[0] == '.' && tree->name.name[1] == 0) - { - if (allocation_done != lang_first_phase_enum) - result = new_rel_from_section(dot, current_section); - else - result = invalid(); - } - else if (allocation_done != lang_first_phase_enum) - { - struct bfd_link_hash_entry *h; - - h = bfd_wrapped_link_hash_lookup (output_bfd, &link_info, - tree->name.name, - false, false, true); - if (h != NULL - && (h->type == bfd_link_hash_defined - || h->type == bfd_link_hash_defweak)) - { - if (bfd_is_abs_section (h->u.def.section)) - result = new_abs (h->u.def.value); - else if (allocation_done == lang_final_phase_enum - || allocation_done == lang_allocating_phase_enum) - { - asection *output_section; - - output_section = h->u.def.section->output_section; - if (output_section == NULL) - einfo ("%X%S: unresolvable symbol `%s' referenced in expression\n", - tree->name.name); - else - { - lang_output_section_statement_type *os; - - os = (lang_output_section_statement_lookup - (bfd_get_section_name (output_bfd, - output_section))); - - /* FIXME: Is this correct if this section is - being linked with -R? */ - result = new_rel ((h->u.def.value - + h->u.def.section->output_offset), - os); - } - } - } - else if (allocation_done == lang_final_phase_enum) - einfo ("%F%S: undefined symbol `%s' referenced in expression\n", - tree->name.name); - } - break; - - case ADDR: - if (allocation_done != lang_first_phase_enum) - { - lang_output_section_statement_type *os; - - os = lang_output_section_find (tree->name.name); - check (os, tree->name.name, "ADDR"); - result = new_rel (0, os); - } - else - result = invalid (); - break; - - case LOADADDR: - if (allocation_done != lang_first_phase_enum) - { - lang_output_section_statement_type *os; - - os = lang_output_section_find (tree->name.name); - check (os, tree->name.name, "LOADADDR"); - if (os->load_base == NULL) - result = new_rel (0, os); - else - result = exp_fold_tree_no_dot (os->load_base, - abs_output_section, - allocation_done); - } - else - result = invalid (); - break; - - case SIZEOF: - if (allocation_done != lang_first_phase_enum) - { - lang_output_section_statement_type *os; - - os = lang_output_section_find (tree->name.name); - check (os, tree->name.name, "SIZEOF"); - result = new_abs (os->bfd_section->_raw_size); - } - else - result = invalid (); - break; - - default: - FAIL(); - break; - } - - return result; -} -etree_value_type -exp_fold_tree (tree, current_section, allocation_done, dot, dotp) - etree_type *tree; - lang_output_section_statement_type *current_section; - lang_phase_type allocation_done; - bfd_vma dot; - bfd_vma *dotp; -{ - etree_value_type result; - - if (tree == NULL) - { - result.valid = false; - return result; - } - - switch (tree->type.node_class) - { - case etree_value: - result = new_rel (tree->value.value, current_section); - break; - - case etree_rel: - if (allocation_done != lang_final_phase_enum) - result.valid = false; - else - result = new_rel ((tree->rel.value - + tree->rel.section->output_section->vma - + tree->rel.section->output_offset), - current_section); - break; - - case etree_unary: - result = exp_fold_tree (tree->unary.child, - current_section, - allocation_done, dot, dotp); - if (result.valid) - { - switch (tree->type.node_code) - { - case ALIGN_K: - if (allocation_done != lang_first_phase_enum) - result = new_rel_from_section (ALIGN_N (dot, result.value), - current_section); - else - result.valid = false; - break; - - case ABSOLUTE: - if (allocation_done != lang_first_phase_enum && result.valid) - { - result.value += result.section->bfd_section->vma; - result.section = abs_output_section; - } - else - result.valid = false; - break; - - case '~': - make_abs (&result); - result.value = ~result.value; - break; - - case '!': - make_abs (&result); - result.value = !result.value; - break; - - case '-': - make_abs (&result); - result.value = -result.value; - break; - - case NEXT: - /* Return next place aligned to value. */ - if (allocation_done == lang_allocating_phase_enum) - { - make_abs (&result); - result.value = ALIGN_N (dot, result.value); - } - else - result.valid = false; - break; - - default: - FAIL (); - break; - } - } - break; - - case etree_trinary: - result = exp_fold_tree (tree->trinary.cond, current_section, - allocation_done, dot, dotp); - if (result.valid) - result = exp_fold_tree ((result.value - ? tree->trinary.lhs - : tree->trinary.rhs), - current_section, - allocation_done, dot, dotp); - break; - - case etree_binary: - result = fold_binary (tree, current_section, allocation_done, - dot, dotp); - break; - - case etree_assign: - case etree_provide: - if (tree->assign.dst[0] == '.' && tree->assign.dst[1] == 0) - { - /* Assignment to dot can only be done during allocation */ - if (tree->type.node_class == etree_provide) - einfo ("%F%S can not PROVIDE assignment to location counter\n"); - if (allocation_done == lang_allocating_phase_enum - || (allocation_done == lang_final_phase_enum - && current_section == abs_output_section)) - { - result = exp_fold_tree (tree->assign.src, - current_section, - lang_allocating_phase_enum, dot, - dotp); - if (! result.valid) - einfo ("%F%S invalid assignment to location counter\n"); - else - { - if (current_section == NULL) - einfo ("%F%S assignment to location counter invalid outside of SECTION\n"); - else - { - bfd_vma nextdot; - - nextdot = (result.value - + current_section->bfd_section->vma); - if (nextdot < dot - && current_section != abs_output_section) - { - einfo ("%F%S cannot move location counter backwards (from %V to %V)\n", - dot, nextdot); - } - else - *dotp = nextdot; - } - } - } - } - else - { - result = exp_fold_tree (tree->assign.src, - current_section, allocation_done, - dot, dotp); - if (result.valid) - { - boolean create; - struct bfd_link_hash_entry *h; - - if (tree->type.node_class == etree_assign) - create = true; - else - create = false; - h = bfd_link_hash_lookup (link_info.hash, tree->assign.dst, - create, false, false); - if (h == (struct bfd_link_hash_entry *) NULL) - { - if (tree->type.node_class == etree_assign) - einfo ("%P%F:%s: hash creation failed\n", - tree->assign.dst); - } - else if (tree->type.node_class == etree_provide - && h->type != bfd_link_hash_undefined - && h->type != bfd_link_hash_common) - { - /* Do nothing. The symbol was defined by some - object. */ - } - else - { - /* FIXME: Should we worry if the symbol is already - defined? */ - h->type = bfd_link_hash_defined; - h->u.def.value = result.value; - h->u.def.section = result.section->bfd_section; - } - } - } - break; - - case etree_name: - result = fold_name (tree, current_section, allocation_done, dot); - break; - - default: - FAIL (); - break; - } - - return result; -} - -static etree_value_type -exp_fold_tree_no_dot (tree, current_section, allocation_done) - etree_type *tree; - lang_output_section_statement_type *current_section; - lang_phase_type allocation_done; -{ -return exp_fold_tree(tree, current_section, allocation_done, (bfd_vma) - 0, (bfd_vma *)NULL); -} - -etree_type * -exp_binop (code, lhs, rhs) - int code; - etree_type *lhs; - etree_type *rhs; -{ - etree_type value, *new; - etree_value_type r; - - value.type.node_code = code; - value.binary.lhs = lhs; - value.binary.rhs = rhs; - value.type.node_class = etree_binary; - r = exp_fold_tree_no_dot(&value, - abs_output_section, - lang_first_phase_enum ); - if (r.valid) - { - return exp_intop(r.value); - } - new = (etree_type *) stat_alloc (sizeof (new->binary)); - memcpy((char *)new, (char *)&value, sizeof(new->binary)); - return new; -} - -etree_type * -exp_trinop (code, cond, lhs, rhs) - int code; - etree_type *cond; - etree_type *lhs; - etree_type *rhs; -{ - etree_type value, *new; - etree_value_type r; - value.type.node_code = code; - value.trinary.lhs = lhs; - value.trinary.cond = cond; - value.trinary.rhs = rhs; - value.type.node_class = etree_trinary; - r= exp_fold_tree_no_dot(&value, (lang_output_section_statement_type - *)NULL,lang_first_phase_enum); - if (r.valid) { - return exp_intop(r.value); - } - new = (etree_type *) stat_alloc (sizeof (new->trinary)); - memcpy((char *)new,(char *) &value, sizeof(new->trinary)); - return new; -} - - -etree_type * -exp_unop (code, child) - int code; - etree_type *child; -{ - etree_type value, *new; - - etree_value_type r; - value.unary.type.node_code = code; - value.unary.child = child; - value.unary.type.node_class = etree_unary; - r = exp_fold_tree_no_dot(&value,abs_output_section, - lang_first_phase_enum); - if (r.valid) { - return exp_intop(r.value); - } - new = (etree_type *) stat_alloc (sizeof (new->unary)); - memcpy((char *)new, (char *)&value, sizeof(new->unary)); - return new; -} - - -etree_type * -exp_nameop (code, name) - int code; - CONST char *name; -{ - etree_type value, *new; - etree_value_type r; - value.name.type.node_code = code; - value.name.name = name; - value.name.type.node_class = etree_name; - - - r = exp_fold_tree_no_dot(&value, - (lang_output_section_statement_type *)NULL, - lang_first_phase_enum); - if (r.valid) { - return exp_intop(r.value); - } - new = (etree_type *) stat_alloc (sizeof (new->name)); - memcpy((char *)new, (char *)&value, sizeof(new->name)); - return new; - -} - - - - -etree_type * -exp_assop (code, dst, src) - int code; - CONST char *dst; - etree_type *src; -{ - etree_type value, *new; - - value.assign.type.node_code = code; - - - value.assign.src = src; - value.assign.dst = dst; - value.assign.type.node_class = etree_assign; - -#if 0 - if (exp_fold_tree_no_dot(&value, &result)) { - return exp_intop(result); - } -#endif - new = (etree_type*) stat_alloc (sizeof (new->assign)); - memcpy((char *)new, (char *)&value, sizeof(new->assign)); - return new; -} - -/* Handle PROVIDE. */ - -etree_type * -exp_provide (dst, src) - const char *dst; - etree_type *src; -{ - etree_type *n; - - n = (etree_type *) stat_alloc (sizeof (n->assign)); - n->assign.type.node_code = '='; - n->assign.type.node_class = etree_provide; - n->assign.src = src; - n->assign.dst = dst; - return n; -} - -void -exp_print_tree (tree) - etree_type *tree; -{ - switch (tree->type.node_class) { - case etree_value: - minfo ("0x%v", tree->value.value); - return; - case etree_rel: - if (tree->rel.section->owner != NULL) - minfo ("%B:", tree->rel.section->owner); - minfo ("%s+0x%v", tree->rel.section->name, tree->rel.value); - return; - case etree_assign: -#if 0 - if (tree->assign.dst->sdefs != (asymbol *)NULL){ - fprintf(config.map_file,"%s (%x) ",tree->assign.dst->name, - tree->assign.dst->sdefs->value); - } - else { - fprintf(config.map_file,"%s (UNDEFINED)",tree->assign.dst->name); - } -#endif - fprintf(config.map_file,"%s",tree->assign.dst); - exp_print_token(tree->type.node_code); - exp_print_tree(tree->assign.src); - break; - case etree_provide: - fprintf (config.map_file, "PROVIDE (%s, ", tree->assign.dst); - exp_print_tree (tree->assign.src); - fprintf (config.map_file, ")"); - break; - case etree_binary: - fprintf(config.map_file,"("); - exp_print_tree(tree->binary.lhs); - exp_print_token(tree->type.node_code); - exp_print_tree(tree->binary.rhs); - fprintf(config.map_file,")"); - break; - case etree_trinary: - exp_print_tree(tree->trinary.cond); - fprintf(config.map_file,"?"); - exp_print_tree(tree->trinary.lhs); - fprintf(config.map_file,":"); - exp_print_tree(tree->trinary.rhs); - break; - case etree_unary: - exp_print_token(tree->unary.type.node_code); - if (tree->unary.child) - { - - fprintf(config.map_file,"("); - exp_print_tree(tree->unary.child); - fprintf(config.map_file,")"); - } - - break; - case etree_undef: - fprintf(config.map_file,"????????"); - break; - case etree_name: - if (tree->type.node_code == NAME) { - fprintf(config.map_file,"%s", tree->name.name); - } - else { - exp_print_token(tree->type.node_code); - if (tree->name.name) - fprintf(config.map_file,"(%s)", tree->name.name); - } - break; - default: - FAIL(); - break; - } -} - -bfd_vma -exp_get_vma (tree, def, name, allocation_done) - etree_type *tree; - bfd_vma def; - char *name; - lang_phase_type allocation_done; -{ - etree_value_type r; - - if (tree != NULL) - { - r = exp_fold_tree_no_dot (tree, abs_output_section, allocation_done); - if (! r.valid && name != NULL) - einfo ("%F%S nonconstant expression for %s\n", name); - return r.value; - } - else - return def; -} - -int -exp_get_value_int (tree,def,name, allocation_done) - etree_type *tree; - int def; - char *name; - lang_phase_type allocation_done; -{ - return (int)exp_get_vma(tree,(bfd_vma)def,name, allocation_done); -} - - -bfd_vma -exp_get_abs_int (tree, def, name, allocation_done) - etree_type *tree; - int def; - char *name; - lang_phase_type allocation_done; -{ - etree_value_type res; - res = exp_fold_tree_no_dot (tree, abs_output_section, allocation_done); - - if (res.valid) - { - res.value += res.section->bfd_section->vma; - } - else { - einfo ("%F%S non constant expression for %s\n",name); - } - return res.value; -} diff --git a/gnu/dist/ld/ldexp.h b/gnu/dist/ld/ldexp.h deleted file mode 100644 index 8726a0166090..000000000000 --- a/gnu/dist/ld/ldexp.h +++ /dev/null @@ -1,109 +0,0 @@ -/* ldexp.h - - Copyright 1991, 1992, 1993 Free Software Foundation, Inc. - - This file is part of GLD, the Gnu Linker. - - GLD 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, or (at your option) - any later version. - - GLD 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 GLD; see the file COPYING. If not, write to - the Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ - -#ifndef LDEXP_H -#define LDEXP_H - -/* The result of an expression tree */ -typedef struct -{ - bfd_vma value; - struct lang_output_section_statement_struct *section; - boolean valid; -} etree_value_type; - - - -typedef struct -{ - int node_code; - enum { etree_binary, - etree_trinary, - etree_unary, - etree_name, - etree_assign, - etree_provide, - etree_undef, - etree_unspec, - etree_value, - etree_rel } node_class; -} node_type; - - - -typedef union etree_union -{ - node_type type; - struct { - node_type type; - union etree_union *lhs; - union etree_union *rhs; - } binary; - struct { - node_type type; - union etree_union *cond; - union etree_union *lhs; - union etree_union *rhs; - } trinary; - struct { - node_type type; - CONST char *dst; - union etree_union *src; - } assign; - - struct { - node_type type; - union etree_union *child; - } unary; - struct { - node_type type; - CONST char *name; - } name; - struct { - node_type type; - bfd_vma value; - } value; - struct { - node_type type; - asection *section; - bfd_vma value; - } rel; - -} etree_type; - - -etree_type *exp_intop PARAMS ((bfd_vma)); -etree_type *exp_relop PARAMS ((asection *, bfd_vma)); -etree_value_type invalid PARAMS ((void)); -etree_value_type exp_fold_tree PARAMS ((etree_type *, struct - lang_output_section_statement_struct *, - lang_phase_type, - bfd_vma, bfd_vma *)); -etree_type *exp_binop PARAMS ((int, etree_type *, etree_type *)); -etree_type *exp_trinop PARAMS ((int,etree_type *, etree_type *, etree_type *)); -etree_type *exp_unop PARAMS ((int, etree_type *)); -etree_type *exp_nameop PARAMS ((int, CONST char *)); -etree_type *exp_assop PARAMS ((int, CONST char *, etree_type *)); -etree_type *exp_provide PARAMS ((const char *, etree_type *)); -void exp_print_tree PARAMS ((etree_type *)); -bfd_vma exp_get_vma PARAMS ((etree_type *, bfd_vma, char *, lang_phase_type)); -int exp_get_value_int PARAMS ((etree_type *, int, char *,lang_phase_type)); -bfd_vma exp_get_abs_int PARAMS ((etree_type *, int, char *,lang_phase_type)); - -#endif diff --git a/gnu/dist/ld/ldfile.c b/gnu/dist/ld/ldfile.c deleted file mode 100644 index 3597c4e24fdc..000000000000 --- a/gnu/dist/ld/ldfile.c +++ /dev/null @@ -1,410 +0,0 @@ -/* Copyright (C) 1991, 92, 93, 94, 95, 1998 Free Software Foundation, Inc. - -This file is part of GLD, the Gnu Linker. - -GLD 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 1, or (at your option) -any later version. - -GLD 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 GLD; see the file COPYING. If not, write to the Free -Software Foundation, 59 Temple Place - Suite 330, Boston, MA -02111-1307, USA. */ - -/* - ldfile.c - - look after all the file stuff - - */ - -#include "bfd.h" -#include "sysdep.h" -#include "bfdlink.h" -#include "ld.h" -#include "ldmisc.h" -#include "ldexp.h" -#include "ldlang.h" -#include "ldfile.h" -#include "ldmain.h" -#include "ldgram.h" -#include "ldlex.h" -#include "ldemul.h" - -#include - -const char *ldfile_input_filename; -boolean ldfile_assumed_script = false; -const char *ldfile_output_machine_name = ""; -unsigned long ldfile_output_machine; -enum bfd_architecture ldfile_output_architecture; -search_dirs_type *search_head; - -#ifndef MPW -#ifdef VMS -char *slash = ""; -#else -#if defined (_WIN32) && ! defined (__CYGWIN32__) -char *slash = "\\"; -#else -char *slash = "/"; -#endif -#endif -#else /* MPW */ -/* The MPW path char is a colon. */ -char *slash = ":"; -#endif /* MPW */ - -/* LOCAL */ - -static search_dirs_type **search_tail_ptr = &search_head; - -typedef struct search_arch -{ - char *name; - struct search_arch *next; -} search_arch_type; - -static search_arch_type *search_arch_head; -static search_arch_type **search_arch_tail_ptr = &search_arch_head; - -static boolean ldfile_open_file_search - PARAMS ((const char *arch, lang_input_statement_type *, - const char *lib, const char *suffix)); -static FILE *try_open PARAMS ((const char *name, const char *exten)); - -void -ldfile_add_library_path (name, cmdline) - const char *name; - boolean cmdline; -{ - search_dirs_type *new; - - new = (search_dirs_type *) xmalloc (sizeof (search_dirs_type)); - new->next = NULL; - new->name = name; - new->cmdline = cmdline; - *search_tail_ptr = new; - search_tail_ptr = &new->next; -} - -/* Try to open a BFD for a lang_input_statement. */ - -boolean -ldfile_try_open_bfd (attempt, entry) - const char *attempt; - lang_input_statement_type *entry; -{ - entry->the_bfd = bfd_openr (attempt, entry->target); - - if (trace_file_tries) - info_msg ("attempt to open %s %s\n", attempt, - entry->the_bfd == NULL ? "failed" : "succeeded"); - - if (entry->the_bfd != NULL) - return true; - else - { - if (bfd_get_error () == bfd_error_invalid_target) - einfo ("%F%P: invalid BFD target `%s'\n", entry->target); - return false; - } -} - -/* Search for and open the file specified by ENTRY. If it is an - archive, use ARCH, LIB and SUFFIX to modify the file name. */ - -static boolean -ldfile_open_file_search (arch, entry, lib, suffix) - const char *arch; - lang_input_statement_type *entry; - const char *lib; - const char *suffix; -{ - search_dirs_type *search; - - /* If this is not an archive, try to open it in the current - directory first. */ - if (! entry->is_archive) - { - if (ldfile_try_open_bfd (entry->filename, entry)) - return true; - } - - for (search = search_head; - search != (search_dirs_type *)NULL; - search = search->next) - { - char *string; - - if (entry->dynamic && ! link_info.relocateable) - { - if (ldemul_open_dynamic_archive (arch, search, entry)) - return true; - } - - string = (char *) xmalloc (strlen (search->name) - + strlen (slash) - + strlen (lib) - + strlen (entry->filename) - + strlen (arch) - + strlen (suffix) - + 1); - - if (entry->is_archive) - sprintf (string, "%s%s%s%s%s%s", search->name, slash, - lib, entry->filename, arch, suffix); - else if (entry->filename[0] == '/' || entry->filename[0] == '.' -#if defined (__MSDOS__) || defined (_WIN32) - || entry->filename[0] == '\\' - || (isalpha (entry->filename[0]) - && entry->filename[1] == ':') -#endif - ) - strcpy (string, entry->filename); - else - sprintf (string, "%s%s%s", search->name, slash, entry->filename); - - if (ldfile_try_open_bfd (string, entry)) - { - entry->filename = string; - return true; - } - - free (string); - } - - return false; -} - -/* Open the input file specified by ENTRY. */ - -void -ldfile_open_file (entry) - lang_input_statement_type *entry; -{ - if (entry->the_bfd != NULL) - return; - - if (! entry->search_dirs_flag) - { - if (ldfile_try_open_bfd (entry->filename, entry)) - return; - } - else - { - search_arch_type *arch; - - /* Try to open or lib.a */ - for (arch = search_arch_head; - arch != (search_arch_type *) NULL; - arch = arch->next) - { - if (ldfile_open_file_search (arch->name, entry, "lib", ".a")) - return; -#ifdef VMS - if (ldfile_open_file_search (arch->name, entry, ":lib", ".a")) - return; -#endif - } - } - - einfo("%F%P: cannot open %s: %E\n", entry->local_sym_name); -} - -/* Try to open NAME; if that fails, try NAME with EXTEN appended to it. */ - -static FILE * -try_open (name, exten) - const char *name; - const char *exten; -{ - FILE *result; - char buff[1000]; - - result = fopen (name, "r"); - if (trace_file_tries) - { - if (result == NULL) - info_msg ("cannot find script file "); - else - info_msg ("opened script file "); - info_msg ("%s\n",name); - } - - if (result != NULL) - return result; - - if (*exten) - { - sprintf (buff, "%s%s", name, exten); - result = fopen (buff, "r"); - if (trace_file_tries) - { - if (result == NULL) - info_msg ("cannot find script file "); - else - info_msg ("opened script file "); - info_msg ("%s\n", buff); - } - } - - return result; -} - -/* Try to open NAME; if that fails, look for it in any directories - specified with -L, without and with EXTEND apppended. */ - -FILE * -ldfile_find_command_file (name, extend) - const char *name; - const char *extend; -{ - search_dirs_type *search; - FILE *result; - char buffer[1000]; - - /* First try raw name */ - result = try_open(name,""); - if (result == (FILE *)NULL) { - /* Try now prefixes */ - for (search = search_head; - search != (search_dirs_type *)NULL; - search = search->next) { - sprintf(buffer,"%s%s%s", search->name, slash, name); - result = try_open(buffer, extend); - if (result)break; - } - } - return result; -} - -void -ldfile_open_command_file (name) - const char *name; -{ - FILE *ldlex_input_stack; - ldlex_input_stack = ldfile_find_command_file(name, ""); - - if (ldlex_input_stack == (FILE *)NULL) { - bfd_set_error (bfd_error_system_call); - einfo("%P%F: cannot open linker script file %s: %E\n",name); - } - lex_push_file(ldlex_input_stack, name); - - ldfile_input_filename = name; - lineno = 1; - had_script = true; -} - - - - - -#ifdef GNU960 -static -char * -gnu960_map_archname( name ) -char *name; -{ - struct tabentry { char *cmd_switch; char *arch; }; - static struct tabentry arch_tab[] = { - "", "", - "KA", "ka", - "KB", "kb", - "KC", "mc", /* Synonym for MC */ - "MC", "mc", - "CA", "ca", - "SA", "ka", /* Functionally equivalent to KA */ - "SB", "kb", /* Functionally equivalent to KB */ - NULL, "" - }; - struct tabentry *tp; - - - for ( tp = arch_tab; tp->cmd_switch != NULL; tp++ ){ - if ( !strcmp(name,tp->cmd_switch) ){ - break; - } - } - - if ( tp->cmd_switch == NULL ){ - einfo("%P%F: unknown architecture: %s\n",name); - } - return tp->arch; -} - - - -void -ldfile_add_arch(name) -char *name; -{ - search_arch_type *new = - (search_arch_type *)xmalloc((bfd_size_type)(sizeof(search_arch_type))); - - - if (*name != '\0') { - if (ldfile_output_machine_name[0] != '\0') { - einfo("%P%F: target architecture respecified\n"); - return; - } - ldfile_output_machine_name = name; - } - - new->next = (search_arch_type*)NULL; - new->name = gnu960_map_archname( name ); - *search_arch_tail_ptr = new; - search_arch_tail_ptr = &new->next; - -} - -#else /* not GNU960 */ - - -void -ldfile_add_arch (in_name) - CONST char * in_name; -{ - char *name = buystring(in_name); - search_arch_type *new = - (search_arch_type *) xmalloc (sizeof (search_arch_type)); - - ldfile_output_machine_name = in_name; - - new->name = name; - new->next = (search_arch_type*)NULL; - while (*name) - { - if (isupper ((unsigned char) *name)) - *name = tolower ((unsigned char) *name); - name++; - } - *search_arch_tail_ptr = new; - search_arch_tail_ptr = &new->next; - -} -#endif - -/* Set the output architecture */ -void -ldfile_set_output_arch (string) - CONST char *string; -{ - const bfd_arch_info_type *arch = bfd_scan_arch(string); - - if (arch) { - ldfile_output_architecture = arch->arch; - ldfile_output_machine = arch->mach; - ldfile_output_machine_name = arch->printable_name; - } - else { - einfo("%P%F: cannot represent machine `%s'\n", string); - } -} diff --git a/gnu/dist/ld/ldfile.h b/gnu/dist/ld/ldfile.h deleted file mode 100644 index f33c9ce94627..000000000000 --- a/gnu/dist/ld/ldfile.h +++ /dev/null @@ -1,53 +0,0 @@ -/* ldfile.h - - Copyright 1991, 1992 Free Software Foundation, Inc. - - This file is part of GLD, the Gnu Linker. - - GLD 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 1, or (at your option) - any later version. - - GLD 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 GLD; see the file COPYING. If not, write to - the Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ - -extern const char *ldfile_input_filename; -extern boolean ldfile_assumed_script; -extern unsigned long ldfile_output_machine; -extern enum bfd_architecture ldfile_output_architecture; -extern const char *ldfile_output_machine_name; - -/* Structure used to hold the list of directories to search for - libraries. */ - -typedef struct search_dirs -{ - /* Next directory on list. */ - struct search_dirs *next; - /* Name of directory. */ - const char *name; - /* true if this is from the command line. */ - boolean cmdline; -} search_dirs_type; - -extern search_dirs_type *search_head; - -#if ANSI_PROTOTYPES -struct lang_input_statement_struct; -#endif - -extern void ldfile_add_arch PARAMS ((CONST char *)); -extern void ldfile_add_library_path PARAMS ((const char *, boolean cmdline)); -extern void ldfile_open_command_file PARAMS ((const char *name)); -extern void ldfile_open_file PARAMS ((struct lang_input_statement_struct *)); -extern boolean ldfile_try_open_bfd - PARAMS ((const char *, struct lang_input_statement_struct *)); -extern FILE *ldfile_find_command_file - PARAMS ((const char *name, const char *extend)); -extern void ldfile_set_output_arch PARAMS ((CONST char *)); diff --git a/gnu/dist/ld/ldgram.y b/gnu/dist/ld/ldgram.y deleted file mode 100644 index e07740fdcad5..000000000000 --- a/gnu/dist/ld/ldgram.y +++ /dev/null @@ -1,1022 +0,0 @@ -/* A YACC grammer to parse a superset of the AT&T linker scripting languaue. - Copyright (C) 1991, 92, 93, 94, 95, 96, 1997 Free Software Foundation, Inc. - Written by Steve Chamberlain of Cygnus Support (steve@cygnus.com). - -This file is part of GNU ld. - -This program is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ - -%{ -/* - - */ - -#define DONTDECLARE_MALLOC - -#include "bfd.h" -#include "sysdep.h" -#include "bfdlink.h" -#include "ld.h" -#include "ldexp.h" -#include "ldver.h" -#include "ldlang.h" -#include "ldemul.h" -#include "ldfile.h" -#include "ldmisc.h" -#include "ldmain.h" -#include "mri.h" -#include "ldlex.h" - -#ifndef YYDEBUG -#define YYDEBUG 1 -#endif - -static enum section_type sectype; - -lang_memory_region_type *region; - - -char *current_file; -boolean ldgram_want_filename = true; -boolean had_script = false; -boolean force_make_executable = false; - -boolean ldgram_in_script = false; -boolean ldgram_had_equals = false; - - -#define ERROR_NAME_MAX 20 -static char *error_names[ERROR_NAME_MAX]; -static int error_index; -#define PUSH_ERROR(x) if (error_index < ERROR_NAME_MAX) error_names[error_index] = x; error_index++; -#define POP_ERROR() error_index--; -%} -%union { - bfd_vma integer; - char *name; - int token; - union etree_union *etree; - struct phdr_info - { - boolean filehdr; - boolean phdrs; - union etree_union *at; - union etree_union *flags; - } phdr; - struct lang_nocrossref *nocrossref; - struct lang_output_section_phdr_list *section_phdr; - struct bfd_elf_version_deps *deflist; - struct bfd_elf_version_expr *versyms; - struct bfd_elf_version_tree *versnode; -} - -%type exp opt_exp_with_type mustbe_exp opt_at phdr_type phdr_val -%type opt_exp_without_type -%type fill_opt -%type memspec_opt casesymlist -%token INT -%token NAME LNAME -%type length -%type phdr_qualifiers -%type nocrossref_list -%type phdr_opt -%type opt_nocrossrefs - -%right PLUSEQ MINUSEQ MULTEQ DIVEQ '=' LSHIFTEQ RSHIFTEQ ANDEQ OREQ -%right '?' ':' -%left OROR -%left ANDAND -%left '|' -%left '^' -%left '&' -%left EQ NE -%left '<' '>' LE GE -%left LSHIFT RSHIFT - -%left '+' '-' -%left '*' '/' '%' - -%right UNARY -%token END -%left '(' -%token ALIGN_K BLOCK BIND QUAD SQUAD LONG SHORT BYTE -%token SECTIONS PHDRS -%token '{' '}' -%token SIZEOF_HEADERS OUTPUT_FORMAT FORCE_COMMON_ALLOCATION OUTPUT_ARCH -%token SIZEOF_HEADERS -%token INCLUDE -%token MEMORY DEFSYMEND -%token NOLOAD DSECT COPY INFO OVERLAY -%token NAME LNAME DEFINED TARGET_K SEARCH_DIR MAP ENTRY -%token NEXT -%token SIZEOF ADDR LOADADDR MAX MIN -%token STARTUP HLL SYSLIB FLOAT NOFLOAT NOCROSSREFS -%token ORIGIN FILL -%token LENGTH CREATE_OBJECT_SYMBOLS INPUT GROUP OUTPUT CONSTRUCTORS -%token ALIGNMOD AT PROVIDE -%type assign_op atype -%type filename -%token CHIP LIST SECT ABSOLUTE LOAD NEWLINE ENDWORD ORDER NAMEWORD -%token FORMAT PUBLIC DEFSYMEND BASE ALIAS TRUNCATE REL -%token INPUT_SCRIPT INPUT_MRI_SCRIPT INPUT_DEFSYM CASE EXTERN START -%token VERS_TAG VERS_IDENTIFIER -%token GLOBAL LOCAL VERSIONK INPUT_VERSION_SCRIPT -%type vers_defns -%type vers_tag -%type verdep - -%% - -file: - INPUT_SCRIPT script_file - | INPUT_MRI_SCRIPT mri_script_file - | INPUT_VERSION_SCRIPT version_script_file - | INPUT_DEFSYM defsym_expr - ; - - -filename: NAME; - - -defsym_expr: - { ldlex_defsym(); } - NAME '=' exp - { - ldlex_popstate(); - lang_add_assignment(exp_assop($3,$2,$4)); - } - -/* SYNTAX WITHIN AN MRI SCRIPT FILE */ -mri_script_file: - { - ldlex_mri_script (); - PUSH_ERROR ("MRI style script"); - } - mri_script_lines - { - ldlex_popstate (); - mri_draw_tree (); - POP_ERROR (); - } - ; - -mri_script_lines: - mri_script_lines mri_script_command NEWLINE - | - ; - -mri_script_command: - CHIP exp - | CHIP exp ',' exp - | NAME { - einfo("%P%F: unrecognised keyword in MRI style script '%s'\n",$1); - } - | LIST { - config.map_filename = "-"; - } - | ORDER ordernamelist - | ENDWORD - | PUBLIC NAME '=' exp - { mri_public($2, $4); } - | PUBLIC NAME ',' exp - { mri_public($2, $4); } - | PUBLIC NAME exp - { mri_public($2, $3); } - | FORMAT NAME - { mri_format($2); } - | SECT NAME ',' exp - { mri_output_section($2, $4);} - | SECT NAME exp - { mri_output_section($2, $3);} - | SECT NAME '=' exp - { mri_output_section($2, $4);} - | ALIGN_K NAME '=' exp - { mri_align($2,$4); } - | ALIGN_K NAME ',' exp - { mri_align($2,$4); } - | ALIGNMOD NAME '=' exp - { mri_alignmod($2,$4); } - | ALIGNMOD NAME ',' exp - { mri_alignmod($2,$4); } - | ABSOLUTE mri_abs_name_list - | LOAD mri_load_name_list - | NAMEWORD NAME - { mri_name($2); } - | ALIAS NAME ',' NAME - { mri_alias($2,$4,0);} - | ALIAS NAME ',' INT - { mri_alias($2,0,(int) $4);} - | BASE exp - { mri_base($2); } - | TRUNCATE INT - { mri_truncate((unsigned int) $2); } - | CASE casesymlist - | EXTERN extern_name_list - | INCLUDE filename - { ldfile_open_command_file ($2); } mri_script_lines END - | START NAME - { lang_add_entry ($2, false); } - | - ; - -ordernamelist: - ordernamelist ',' NAME { mri_order($3); } - | ordernamelist NAME { mri_order($2); } - | - ; - -mri_load_name_list: - NAME - { mri_load($1); } - | mri_load_name_list ',' NAME { mri_load($3); } - ; - -mri_abs_name_list: - NAME - { mri_only_load($1); } - | mri_abs_name_list ',' NAME - { mri_only_load($3); } - ; - -casesymlist: - /* empty */ { $$ = NULL; } - | NAME - | casesymlist ',' NAME - ; - -extern_name_list: - NAME - { ldlang_add_undef ($1); } - | extern_name_list ',' NAME - { ldlang_add_undef ($3); } - ; - -script_file: - { - ldlex_both(); - } - ifile_list - { - ldlex_popstate(); - } - ; - - -ifile_list: - ifile_list ifile_p1 - | - ; - - - -ifile_p1: - memory - | sections - | phdrs - | startup - | high_level_library - | low_level_library - | floating_point_support - | statement_anywhere - | version - | ';' - | TARGET_K '(' NAME ')' - { lang_add_target($3); } - | SEARCH_DIR '(' filename ')' - { if (!config.no_std_path) ldfile_add_library_path ($3, false); } - | OUTPUT '(' filename ')' - { lang_add_output($3, 1); } - | OUTPUT_FORMAT '(' NAME ')' - { lang_add_output_format ($3, (char *) NULL, - (char *) NULL, 1); } - | OUTPUT_FORMAT '(' NAME ',' NAME ',' NAME ')' - { lang_add_output_format ($3, $5, $7, 1); } - | OUTPUT_ARCH '(' NAME ')' - { ldfile_set_output_arch($3); } - | FORCE_COMMON_ALLOCATION - { command_line.force_common_definition = true ; } - | INPUT '(' input_list ')' - | GROUP - { lang_enter_group (); } - '(' input_list ')' - { lang_leave_group (); } - | MAP '(' filename ')' - { lang_add_map($3); } - | INCLUDE filename - { ldfile_open_command_file($2); } ifile_list END - | NOCROSSREFS '(' nocrossref_list ')' - { - lang_add_nocrossref ($3); - } - ; - -input_list: - NAME - { lang_add_input_file($1,lang_input_file_is_search_file_enum, - (char *)NULL); } - | input_list ',' NAME - { lang_add_input_file($3,lang_input_file_is_search_file_enum, - (char *)NULL); } - | input_list NAME - { lang_add_input_file($2,lang_input_file_is_search_file_enum, - (char *)NULL); } - | LNAME - { lang_add_input_file($1,lang_input_file_is_l_enum, - (char *)NULL); } - | input_list ',' LNAME - { lang_add_input_file($3,lang_input_file_is_l_enum, - (char *)NULL); } - | input_list LNAME - { lang_add_input_file($2,lang_input_file_is_l_enum, - (char *)NULL); } - ; - -sections: - SECTIONS '{' sec_or_group_p1 '}' - ; - -sec_or_group_p1: - sec_or_group_p1 section - | sec_or_group_p1 statement_anywhere - | - ; - -statement_anywhere: - ENTRY '(' NAME ')' - { lang_add_entry ($3, false); } - | assignment end - ; - -/* The '*' and '?' cases are there because the lexer returns them as - separate tokens rather than as NAME. */ -file_NAME_list: - NAME - { lang_add_wild ($1, current_file); } - | '*' - { lang_add_wild ("*", current_file); } - | '?' - { lang_add_wild ("?", current_file); } - | file_NAME_list opt_comma NAME - { lang_add_wild ($3, current_file); } - | file_NAME_list opt_comma '*' - { lang_add_wild ("*", current_file); } - | file_NAME_list opt_comma '?' - { lang_add_wild ("?", current_file); } - ; - -input_section_spec: - NAME - { - lang_add_wild((char *)NULL, $1); - } - | '[' - { - current_file = (char *)NULL; - } - file_NAME_list - ']' - | NAME - { - current_file = $1; - } - '(' file_NAME_list ')' - | '?' - /* This case is needed because the lexer returns a - single question mark as '?' rather than NAME. */ - { - current_file = "?"; - } - '(' file_NAME_list ')' - | '*' - { - current_file = (char *)NULL; - } - '(' file_NAME_list ')' - ; - -statement: - assignment end - | CREATE_OBJECT_SYMBOLS - { - lang_add_attribute(lang_object_symbols_statement_enum); - } - | ';' - | CONSTRUCTORS - { - - lang_add_attribute(lang_constructors_statement_enum); - } - | input_section_spec - | length '(' mustbe_exp ')' - { - lang_add_data((int) $1,$3); - } - - | FILL '(' mustbe_exp ')' - { - lang_add_fill - (exp_get_value_int($3, - 0, - "fill value", - lang_first_phase_enum)); - } - ; - -statement_list: - statement_list statement - | statement - ; - -statement_list_opt: - /* empty */ - | statement_list - ; - -length: - QUAD - { $$ = $1; } - | SQUAD - { $$ = $1; } - | LONG - { $$ = $1; } - | SHORT - { $$ = $1; } - | BYTE - { $$ = $1; } - ; - -fill_opt: - '=' mustbe_exp - { - $$ = exp_get_value_int($2, - 0, - "fill value", - lang_first_phase_enum); - } - | { $$ = 0; } - ; - - - -assign_op: - PLUSEQ - { $$ = '+'; } - | MINUSEQ - { $$ = '-'; } - | MULTEQ - { $$ = '*'; } - | DIVEQ - { $$ = '/'; } - | LSHIFTEQ - { $$ = LSHIFT; } - | RSHIFTEQ - { $$ = RSHIFT; } - | ANDEQ - { $$ = '&'; } - | OREQ - { $$ = '|'; } - - ; - -end: ';' | ',' - ; - - -assignment: - NAME '=' mustbe_exp - { - lang_add_assignment (exp_assop ($2, $1, $3)); - } - | NAME assign_op mustbe_exp - { - lang_add_assignment (exp_assop ('=', $1, - exp_binop ($2, - exp_nameop (NAME, - $1), - $3))); - } - | PROVIDE '(' NAME '=' mustbe_exp ')' - { - lang_add_assignment (exp_provide ($3, $5)); - } - ; - - -opt_comma: - ',' | ; - - -memory: - MEMORY '{' memory_spec memory_spec_list '}' - ; - -memory_spec_list: - memory_spec_list memory_spec - | memory_spec_list ',' memory_spec - | - ; - - -memory_spec: NAME - { region = lang_memory_region_lookup($1); } - attributes_opt ':' - origin_spec opt_comma length_spec - - ; origin_spec: - ORIGIN '=' mustbe_exp - { region->current = - region->origin = - exp_get_vma($3, 0L,"origin", lang_first_phase_enum); -} - ; - -length_spec: - LENGTH '=' mustbe_exp - { region->length = exp_get_vma($3, - ~((bfd_vma)0), - "length", - lang_first_phase_enum); - } - - -attributes_opt: - '(' NAME ')' - { - lang_set_flags(region, $2); - } - | - - ; - -startup: - STARTUP '(' filename ')' - { lang_startup($3); } - ; - -high_level_library: - HLL '(' high_level_library_NAME_list ')' - | HLL '(' ')' - { ldemul_hll((char *)NULL); } - ; - -high_level_library_NAME_list: - high_level_library_NAME_list opt_comma filename - { ldemul_hll($3); } - | filename - { ldemul_hll($1); } - - ; - -low_level_library: - SYSLIB '(' low_level_library_NAME_list ')' - ; low_level_library_NAME_list: - low_level_library_NAME_list opt_comma filename - { ldemul_syslib($3); } - | - ; - -floating_point_support: - FLOAT - { lang_float(true); } - | NOFLOAT - { lang_float(false); } - ; - -nocrossref_list: - /* empty */ - { - $$ = NULL; - } - | NAME nocrossref_list - { - struct lang_nocrossref *n; - - n = (struct lang_nocrossref *) xmalloc (sizeof *n); - n->name = $1; - n->next = $2; - $$ = n; - } - | NAME ',' nocrossref_list - { - struct lang_nocrossref *n; - - n = (struct lang_nocrossref *) xmalloc (sizeof *n); - n->name = $1; - n->next = $3; - $$ = n; - } - ; - -mustbe_exp: { ldlex_expression(); } - exp - { ldlex_popstate(); $$=$2;} - ; - -exp : - '-' exp %prec UNARY - { $$ = exp_unop('-', $2); } - | '(' exp ')' - { $$ = $2; } - | NEXT '(' exp ')' %prec UNARY - { $$ = exp_unop((int) $1,$3); } - | '!' exp %prec UNARY - { $$ = exp_unop('!', $2); } - | '+' exp %prec UNARY - { $$ = $2; } - | '~' exp %prec UNARY - { $$ = exp_unop('~', $2);} - - | exp '*' exp - { $$ = exp_binop('*', $1, $3); } - | exp '/' exp - { $$ = exp_binop('/', $1, $3); } - | exp '%' exp - { $$ = exp_binop('%', $1, $3); } - | exp '+' exp - { $$ = exp_binop('+', $1, $3); } - | exp '-' exp - { $$ = exp_binop('-' , $1, $3); } - | exp LSHIFT exp - { $$ = exp_binop(LSHIFT , $1, $3); } - | exp RSHIFT exp - { $$ = exp_binop(RSHIFT , $1, $3); } - | exp EQ exp - { $$ = exp_binop(EQ , $1, $3); } - | exp NE exp - { $$ = exp_binop(NE , $1, $3); } - | exp LE exp - { $$ = exp_binop(LE , $1, $3); } - | exp GE exp - { $$ = exp_binop(GE , $1, $3); } - | exp '<' exp - { $$ = exp_binop('<' , $1, $3); } - | exp '>' exp - { $$ = exp_binop('>' , $1, $3); } - | exp '&' exp - { $$ = exp_binop('&' , $1, $3); } - | exp '^' exp - { $$ = exp_binop('^' , $1, $3); } - | exp '|' exp - { $$ = exp_binop('|' , $1, $3); } - | exp '?' exp ':' exp - { $$ = exp_trinop('?' , $1, $3, $5); } - | exp ANDAND exp - { $$ = exp_binop(ANDAND , $1, $3); } - | exp OROR exp - { $$ = exp_binop(OROR , $1, $3); } - | DEFINED '(' NAME ')' - { $$ = exp_nameop(DEFINED, $3); } - | INT - { $$ = exp_intop($1); } - | SIZEOF_HEADERS - { $$ = exp_nameop(SIZEOF_HEADERS,0); } - - | SIZEOF '(' NAME ')' - { $$ = exp_nameop(SIZEOF,$3); } - | ADDR '(' NAME ')' - { $$ = exp_nameop(ADDR,$3); } - | LOADADDR '(' NAME ')' - { $$ = exp_nameop(LOADADDR,$3); } - | ABSOLUTE '(' exp ')' - { $$ = exp_unop(ABSOLUTE, $3); } - | ALIGN_K '(' exp ')' - { $$ = exp_unop(ALIGN_K,$3); } - | BLOCK '(' exp ')' - { $$ = exp_unop(ALIGN_K,$3); } - | NAME - { $$ = exp_nameop(NAME,$1); } - | MAX '(' exp ',' exp ')' - { $$ = exp_binop (MAX, $3, $5 ); } - | MIN '(' exp ',' exp ')' - { $$ = exp_binop (MIN, $3, $5 ); } - ; - - -opt_at: - AT '(' exp ')' { $$ = $3; } - | { $$ = 0; } - ; - -section: NAME { ldlex_expression(); } - opt_exp_with_type - opt_at { ldlex_popstate (); ldlex_script (); } - '{' - { - lang_enter_output_section_statement($1, $3, - sectype, - 0, 0, 0, $4); - } - statement_list_opt - '}' { ldlex_popstate (); ldlex_expression (); } - memspec_opt phdr_opt fill_opt - { - ldlex_popstate (); - lang_leave_output_section_statement ($13, $11, $12); - } - opt_comma - | OVERLAY - { ldlex_expression (); } - opt_exp_without_type opt_nocrossrefs opt_at - { ldlex_popstate (); ldlex_script (); } - '{' - { - lang_enter_overlay ($3, $5, (int) $4); - } - overlay_section - '}' - { ldlex_popstate (); ldlex_expression (); } - memspec_opt phdr_opt fill_opt - { - ldlex_popstate (); - lang_leave_overlay ($14, $12, $13); - } - opt_comma - | /* The GROUP case is just enough to support the gcc - svr3.ifile script. It is not intended to be full - support. I'm not even sure what GROUP is supposed - to mean. */ - GROUP { ldlex_expression (); } - opt_exp_with_type - { - ldlex_popstate (); - lang_add_assignment (exp_assop ('=', ".", $3)); - } - '{' sec_or_group_p1 '}' - ; - -type: - NOLOAD { sectype = noload_section; } - | DSECT { sectype = dsect_section; } - | COPY { sectype = copy_section; } - | INFO { sectype = info_section; } - | OVERLAY { sectype = overlay_section; } - ; - -atype: - '(' type ')' - | /* EMPTY */ { sectype = normal_section; } - | '(' ')' { sectype = normal_section; } - ; - -opt_exp_with_type: - exp atype ':' { $$ = $1; } - | atype ':' { $$ = (etree_type *)NULL; } - | /* The BIND cases are to support the gcc svr3.ifile - script. They aren't intended to implement full - support for the BIND keyword. I'm not even sure - what BIND is supposed to mean. */ - BIND '(' exp ')' atype ':' { $$ = $3; } - | BIND '(' exp ')' BLOCK '(' exp ')' atype ':' - { $$ = $3; } - ; - -opt_exp_without_type: - exp ':' { $$ = $1; } - | ':' { $$ = (etree_type *) NULL; } - ; - -opt_nocrossrefs: - /* empty */ - { $$ = 0; } - | NOCROSSREFS - { $$ = 1; } - ; - -memspec_opt: - '>' NAME - { $$ = $2; } - | { $$ = "*default*"; } - ; - -phdr_opt: - /* empty */ - { - $$ = NULL; - } - | phdr_opt ':' NAME - { - struct lang_output_section_phdr_list *n; - - n = ((struct lang_output_section_phdr_list *) - xmalloc (sizeof *n)); - n->name = $3; - n->used = false; - n->next = $1; - $$ = n; - } - ; - -overlay_section: - /* empty */ - | overlay_section - NAME - { - ldlex_script (); - lang_enter_overlay_section ($2); - } - '{' statement_list_opt '}' - { ldlex_popstate (); ldlex_expression (); } - phdr_opt fill_opt - { - ldlex_popstate (); - lang_leave_overlay_section ($9, $8); - } - opt_comma - ; - -phdrs: - PHDRS '{' phdr_list '}' - ; - -phdr_list: - /* empty */ - | phdr_list phdr - ; - -phdr: - NAME { ldlex_expression (); } - phdr_type phdr_qualifiers { ldlex_popstate (); } - ';' - { - lang_new_phdr ($1, $3, $4.filehdr, $4.phdrs, $4.at, - $4.flags); - } - ; - -phdr_type: - exp - { - $$ = $1; - - if ($1->type.node_class == etree_name - && $1->type.node_code == NAME) - { - const char *s; - unsigned int i; - static const char * const phdr_types[] = - { - "PT_NULL", "PT_LOAD", "PT_DYNAMIC", - "PT_INTERP", "PT_NOTE", "PT_SHLIB", - "PT_PHDR" - }; - - s = $1->name.name; - for (i = 0; - i < sizeof phdr_types / sizeof phdr_types[0]; - i++) - if (strcmp (s, phdr_types[i]) == 0) - { - $$ = exp_intop (i); - break; - } - } - } - ; - -phdr_qualifiers: - /* empty */ - { - memset (&$$, 0, sizeof (struct phdr_info)); - } - | NAME phdr_val phdr_qualifiers - { - $$ = $3; - if (strcmp ($1, "FILEHDR") == 0 && $2 == NULL) - $$.filehdr = true; - else if (strcmp ($1, "PHDRS") == 0 && $2 == NULL) - $$.phdrs = true; - else if (strcmp ($1, "FLAGS") == 0 && $2 != NULL) - $$.flags = $2; - else - einfo ("%X%P:%S: PHDRS syntax error at `%s'\n", $1); - } - | AT '(' exp ')' phdr_qualifiers - { - $$ = $5; - $$.at = $3; - } - ; - -phdr_val: - /* empty */ - { - $$ = NULL; - } - | '(' exp ')' - { - $$ = $2; - } - ; - -/* This syntax is used within an external version script file. */ - -version_script_file: - { - ldlex_version_file (); - PUSH_ERROR ("VERSION script"); - } - vers_nodes - { - ldlex_popstate (); - POP_ERROR (); - } - ; - -/* This is used within a normal linker script file. */ - -version: - { - ldlex_version_script (); - } - VERSIONK '{' vers_nodes '}' - { - ldlex_popstate (); - } - ; - -vers_nodes: - vers_node - | vers_nodes vers_node - ; - -vers_node: - VERS_TAG '{' vers_tag '}' ';' - { - lang_register_vers_node ($1, $3, NULL); - } - | VERS_TAG '{' vers_tag '}' verdep ';' - { - lang_register_vers_node ($1, $3, $5); - } - ; - -verdep: - VERS_TAG - { - $$ = lang_add_vers_depend (NULL, $1); - } - | verdep VERS_TAG - { - $$ = lang_add_vers_depend ($1, $2); - } - ; - -vers_tag: - /* empty */ - { - $$ = lang_new_vers_node (NULL, NULL); - } - | vers_defns ';' - { - $$ = lang_new_vers_node ($1, NULL); - } - | GLOBAL ':' vers_defns ';' - { - $$ = lang_new_vers_node ($3, NULL); - } - | LOCAL ':' vers_defns ';' - { - $$ = lang_new_vers_node (NULL, $3); - } - | GLOBAL ':' vers_defns ';' LOCAL ':' vers_defns ';' - { - $$ = lang_new_vers_node ($3, $7); - } - ; - -vers_defns: - VERS_IDENTIFIER - { - $$ = lang_new_vers_regex (NULL, $1); - } - | vers_defns ';' VERS_IDENTIFIER - { - $$ = lang_new_vers_regex ($1, $3); - } - ; - -%% -void -yyerror(arg) - const char *arg; -{ - if (ldfile_assumed_script) - einfo ("%P:%s: file format not recognized; treating as linker script\n", - ldfile_input_filename); - if (error_index > 0 && error_index < ERROR_NAME_MAX) - einfo ("%P%F:%S: %s in %s\n", arg, error_names[error_index-1]); - else - einfo ("%P%F:%S: %s\n", arg); -} diff --git a/gnu/dist/ld/ldint.texinfo b/gnu/dist/ld/ldint.texinfo deleted file mode 100644 index 01db41a6e79f..000000000000 --- a/gnu/dist/ld/ldint.texinfo +++ /dev/null @@ -1,412 +0,0 @@ -\input texinfo -@setfilename ldint.info - -@ifinfo -@format -START-INFO-DIR-ENTRY -* Ld-Internals: (ldint). The GNU linker internals. -END-INFO-DIR-ENTRY -@end format -@end ifinfo - -@ifinfo -This file documents the internals of the GNU linker ld. - -Copyright (C) 1992, 93, 94, 95, 1996 Free Software Foundation, Inc. -Contributed by Cygnus Support. - -Permission is granted to make and distribute verbatim copies of -this manual provided the copyright notice and this permission notice -are preserved on all copies. - -@ignore -Permission is granted to process this file through Tex and print the -results, provided the printed document carries copying permission -notice identical to this one except for the removal of this paragraph -(this paragraph not being relevant to the printed manual). - -@end ignore -Permission is granted to copy or distribute modified versions of this -manual under the terms of the GPL (for which purpose this text may be -regarded as a program in the language TeX). -@end ifinfo - -@iftex -@finalout -@setchapternewpage off -@settitle GNU Linker Internals -@titlepage -@title{A guide to the internals of the GNU linker} -@author Per Bothner, Steve Chamberlain, Ian Lance Taylor -@author Cygnus Support -@page - -@tex -\def\$#1${{#1}} % Kluge: collect RCS revision info without $...$ -\xdef\manvers{\$Revision: 1.2 $} % For use in headers, footers too -{\parskip=0pt -\hfill Cygnus Support\par -\hfill \manvers\par -\hfill \TeX{}info \texinfoversion\par -} -@end tex - -@vskip 0pt plus 1filll -Copyright @copyright{} 1992, 93, 94, 95, 1996 Free Software Foundation, Inc. - -Permission is granted to make and distribute verbatim copies of -this manual provided the copyright notice and this permission notice -are preserved on all copies. - -@end titlepage -@end iftex - -@node Top -@top - -This file documents the internals of the GNU linker @code{ld}. It is a -collection of miscellaneous information with little form at this point. -Mostly, it is a repository into which you can put information about -GNU @code{ld} as you discover it (or as you design changes to @code{ld}). - -@menu -* README:: The README File -* Emulations:: How linker emulations are generated -@end menu - -@node README -@chapter The @file{README} File - -Check the @file{README} file; it often has useful information that does not -appear anywhere else in the directory. - -@node Emulations -@chapter How linker emulations are generated - -Each linker target has an @dfn{emulation}. The emulation includes the -default linker script, and certain emulations also modify certain types -of linker behaviour. - -Emulations are created during the build process by the shell script -@file{genscripts.sh}. - -The @file{genscripts.sh} script starts by reading a file in the -@file{emulparams} directory. This is a shell script which sets various -shell variables used by @file{genscripts.sh} and the other shell scripts -it invokes. - -The @file{genscripts.sh} script will invoke a shell script in the -@file{scripttempl} directory in order to create default linker scripts -written in the linker command language. The @file{scripttempl} script -will be invoked 5 (or, in some cases, 6) times, with different -assignments to shell variables, to create different default scripts. -The choice of script is made based on the command line options. - -After creating the scripts, @file{genscripts.sh} will invoke yet another -shell script, this time in the @file{emultempl} directory. That shell -script will create the emulation source file, which contains C code. -This C code permits the linker emulation to override various linker -behaviours. Most targets use the generic emulation code, which is in -@file{emultempl/generic.em}. - -To summarize, @file{genscripts.sh} reads three shell scripts: an -emulation parameters script in the @file{emulparams} directory, a linker -script generation script in the @file{scripttempl} directory, and an -emulation source file generation script in the @file{emultempl} -directory. - -For example, the Sun 4 linker sets up variables in -@file{emulparams/sun4.sh}, creates linker scripts using -@file{scripttempl/aout.sc}, and creates the emulation code using -@file{emultempl/sunos.em}. - -Note that the linker can support several emulations simultaneously, -depending upon how it is configured. An emulation can be selected with -the @code{-m} option. The @code{-V} option will list all supported -emulations. - -@menu -* emulation parameters:: @file{emulparams} scripts -* linker scripts:: @file{scripttempl} scripts -* linker emulations:: @file{emultempl} scripts -@end menu - -@node emulation parameters -@section @file{emulparams} scripts - -Each target selects a particular file in the @file{emulparams} directory -by setting the shell variable @code{targ_emul} in @file{configure.tgt}. -This shell variable is used by the @file{configure} script to control -building an emulation source file. - -Certain conventions are enforced. Suppose the @code{targ_emul} variable -is set to @var{emul} in @file{configure.tgt}. The name of the emulation -shell script will be @file{emulparams/@var{emul}.sh}. The -@file{Makefile} must have a target named @file{e@var{emul}.c}; this -target must depend upon @file{emulparams/@var{emul}.sh}, as well as the -appropriate scripts in the @file{scripttempl} and @file{emultempl} -directories. The @file{Makefile} target must invoke @code{GENSCRIPTS} -with two arguments: @var{emul}, and the value of the make variable -@code{tdir_@var{emul}}. The value of the latter variable will be set by -the @file{configure} script, and is used to set the default target -directory to search. - -By convention, the @file{emulparams/@var{emul}.sh} shell script should -only set shell variables. It may set shell variables which are to be -interpreted by the @file{scripttempl} and the @file{emultempl} scripts. -Certain shell variables are interpreted directly by the -@file{genscripts.sh} script. - -Here is a list of shell variables interpreted by @file{genscripts.sh}, -as well as some conventional shell variables interpreted by the -@file{scripttempl} and @file{emultempl} scripts. - -@table @code -@item SCRIPT_NAME -This is the name of the @file{scripttempl} script to use. If -@code{SCRIPT_NAME} is set to @var{script}, @file{genscripts.sh} will use -the script @file{scriptteml/@var{script}.sc}. - -@item TEMPLATE_NAME -This is the name of the @file{emultemlp} script to use. If -@code{TEMPLATE_NAME} is set to @var{template}, @file{genscripts.sh} will -use the script @file{emultempl/@var{template}.em}. If this variable is -not set, the default value is @samp{generic}. - -@item GENERATE_SHLIB_SCRIPT -If this is set to a nonempty string, @file{genscripts.sh} will invoke -the @file{scripttempl} script an extra time to create a shared library -script. @ref{linker scripts}. - -@item OUTPUT_FORMAT -This is normally set to indicate the BFD output format use (e.g., -@samp{"a.out-sunos-big"}. The @file{scripttempl} script will normally -use it in an @code{OUTPUT_FORMAT} expression in the linker script. - -@item ARCH -This is normally set to indicate the architecture to use (e.g., -@samp{sparc}). The @file{scripttempl} script will normally use it in an -@code{OUTPUT_ARCH} expression in the linker script. - -@item ENTRY -Some @file{scripttempl} scripts use this to set the entry address, in an -@code{ENTRY} expression in the linker script. - -@item TEXT_START_ADDR -Some @file{scripttempl} scripts use this to set the start address of the -@samp{.text} section. - -@item NONPAGED_TEXT_START_ADDR -If this is defined, the @file{genscripts.sh} script sets -@code{TEXT_START_ADDR} to its value before running the -@file{scripttempl} script for the @code{-n} and @code{-N} options -(@pxref{linker scripts}). - -@item SEGMENT_SIZE -The @file{genscripts.sh} script uses this to set the default value of -@code{DATA_ALIGNMENT} when running the @file{scripttempl} script. - -@item TARGET_PAGE_SIZE -If @code{SEGMENT_SIZE} is not defined, the @file{genscripts.sh} script -uses this to define it. -@end table - -@node linker scripts -@section @file{scripttempl} scripts - -Each linker target uses a @file{scripttempl} script to generate the -default linker scripts. The name of the @file{scripttempl} script is -set by the @code{SCRIPT_NAME} variable in the @file{emulparams} script. -If @code{SCRIPT_NAME} is set to @var{script}, @code{genscripts.sh} will -invoke @file{scripttempl/@var{script}.sc}. - -The @file{genscripts.sh} script will invoke the @file{scripttempl} -script 5 or 6 times. Each time it will set the shell variable -@code{LD_FLAG} to a different value. When the linker is run, the -options used will direct it to select a particular script. (Script -selection is controlled by the @code{get_script} emulation entry point; -this describes the conventional behaviour). - -The @file{scripttempl} script should just write a linker script, written -in the linker command language, to standard output. If the emulation -name--the name of the @file{emulparams} file without the @file{.sc} -extension--is @var{emul}, then the output will be directed to -@file{ldscripts/@var{emul}.@var{extension}} in the build directory, -where @var{extension} changes each time the @file{scripttempl} script is -invoked. - -Here is the list of values assigned to @code{LD_FLAG}. - -@table @code -@item (empty) -The script generated is used by default (when none of the following -cases apply). The output has an extension of @file{.x}. -@item n -The script generated is used when the linker is invoked with the -@code{-n} option. The output has an extension of @file{.xn}. -@item N -The script generated is used when the linker is invoked with the -@code{-N} option. The output has an extension of @file{.xbn}. -@item r -The script generated is used when the linker is invoked with the -@code{-r} option. The output has an extension of @file{.xr}. -@item u -The script generated is used when the linker is invoked with the -@code{-Ur} option. The output has an extension of @file{.xu}. -@item shared -The @file{scripttempl} script is only invoked with @code{LD_FLAG} set to -this value if @code{GENERATE_SHLIB_SCRIPT} is defined in the -@file{emulparams} file. The @file{emultempl} script must arrange to use -this script at the appropriate time, normally when the linker is invoked -with the @code{-shared} option. The output has an extension of -@file{.xs}. -@end table - -Besides the shell variables set by the @file{emulparams} script, and the -@code{LD_FLAG} variable, the @file{genscripts.sh} script will set -certain variables for each run of the @file{scripttempl} script. - -@table @code -@item RELOCATING -This will be set to a non-empty string when the linker is doing a final -relocation (e.g., all scripts other than @code{-r} and @code{-Ur}). - -@item CONSTRUCTING -This will be set to a non-empty string when the linker is building -global constructor and destructor tables (e.g., all scripts other than -@code{-r}). - -@item DATA_ALIGNMENT -This will be set to an @code{ALIGN} expression when the output should be -page aligned, or to @samp{.} when generating the @code{-N} script. - -@item CREATE_SHLIB -This will be set to a non-empty string when generating a @code{-shared} -script. -@end table - -The conventional way to write a @file{scripttempl} script is to first -set a few shell variables, and then write out a linker script using -@code{cat} with a here document. The linker script will use variable -substitutions, based on the above variables and those set in the -@file{emulparams} script, to control its behaviour. - -When there are parts of the @file{scripttempl} script which should only -be run when doing a final relocation, they should be enclosed within a -variable substitution based on @code{RELOCATING}. For example, on many -targets special symbols such as @code{_end} should be defined when doing -a final link. Naturally, those symbols should not be defined when doing -a relocateable link using @code{-r}. The @file{scripttempl} script -could use a construct like this to define those symbols: -@smallexample - $@{RELOCATING+ _end = .;@} -@end smallexample -This will do the symbol assignment only if the @code{RELOCATING} -variable is defined. - -The basic job of the linker script is to put the sections in the correct -order, and at the correct memory addresses. For some targets, the -linker script may have to do some other operations. - -For example, on most MIPS platforms, the linker is responsible for -defining the special symbol @code{_gp}, used to initialize the -@code{$gp} register. It must be set to the start of the small data -section plus @code{0x8000}. Naturally, it should only be defined when -doing a final relocation. This will typically be done like this: -@smallexample - $@{RELOCATING+ _gp = ALIGN(16) + 0x8000;@} -@end smallexample -This line would appear just before the sections which compose the small -data section (@samp{.sdata}, @samp{.sbss}). All those sections would be -contiguous in memory. - -Many COFF systems build constructor tables in the linker script. The -compiler will arrange to output the address of each global constructor -in a @samp{.ctor} section, and the address of each global destructor in -a @samp{.dtor} section (this is done by defining -@code{ASM_OUTPUT_CONSTRUCTOR} and @code{ASM_OUTPUT_DESTRUCTOR} in the -@code{gcc} configuration files). The @code{gcc} runtime support -routines expect the constructor table to be named @code{__CTOR_LIST__}. -They expect it to be a list of words, with the first word being the -count of the number of entries. There should be a trailing zero word. -(Actually, the count may be -1 if the trailing word is present, and the -trailing word may be omitted if the count is correct, but, as the -@code{gcc} behaviour has changed slightly over the years, it is safest -to provide both). Here is a typical way that might be handled in a -@file{scripttempl} file. -@smallexample - $@{CONSTRUCTING+ __CTOR_LIST__ = .;@} - $@{CONSTRUCTING+ LONG((__CTOR_END__ - __CTOR_LIST__) / 4 - 2)@} - $@{CONSTRUCTING+ *(.ctors)@} - $@{CONSTRUCTING+ LONG(0)@} - $@{CONSTRUCTING+ __CTOR_END__ = .;@} - $@{CONSTRUCTING+ __DTOR_LIST__ = .;@} - $@{CONSTRUCTING+ LONG((__DTOR_END__ - __DTOR_LIST__) / 4 - 2)@} - $@{CONSTRUCTING+ *(.dtors)@} - $@{CONSTRUCTING+ LONG(0)@} - $@{CONSTRUCTING+ __DTOR_END__ = .;@} -@end smallexample -The use of @code{CONSTRUCTING} ensures that these linker script commands -will only appear when the linker is supposed to be building the -constructor and destructor tables. This example is written for a target -which uses 4 byte pointers. - -Embedded systems often need to set a stack address. This is normally -best done by using the @code{PROVIDE} construct with a default stack -address. This permits the user to easily override the stack address -using the @code{--defsym} option. Here is an example: -@smallexample - $@{RELOCATING+ PROVIDE (__stack = 0x80000000);@} -@end smallexample -The value of the symbol @code{__stack} would then be used in the startup -code to initialize the stack pointer. - -@node linker emulations -@section @file{emultempl} scripts - -Each linker target uses an @file{emultempl} script to generate the -emulation code. The name of the @file{emultempl} script is set by the -@code{TEMPLATE_NAME} variable in the @file{emulparams} script. If the -@code{TEMPLATE_NAME} variable is not set, the default is -@samp{generic}. If the value of @code{TEMPLATE_NAME} is @var{template}, -@file{genscripts.sh} will use @file{emultempl/@var{template}.em}. - -Most targets use the generic @file{emultempl} script, -@file{emultempl/generic.em}. A different @file{emultempl} script is -only needed if the linker must support unusual actions, such as linking -against shared libraries. - -The @file{emultempl} script is normally written as a simple invocation -of @code{cat} with a here document. The document will use a few -variable substitutions. Typically each function names uses a -substitution involving @code{EMULATION_NAME}, for ease of debugging when -the linker supports multiple emulations. - -Every function and variable in the emitted file should be static. The -only globally visible object must be named -@code{ld_@var{EMULATION_NAME}_emulation}, where @var{EMULATION_NAME} is -the name of the emulation set in @file{configure.tgt} (this is also the -name of the @file{emulparams} file without the @file{.sh} extension). -The @file{genscripts.sh} script will set the shell variable -@code{EMULATION_NAME} before invoking the @file{emultempl} script. - -The @code{ld_@var{EMULATION_NAME}_emulation} variable must be a -@code{struct ld_emulation_xfer_struct}, as defined in @file{ldemul.h}. -It defines a set of function pointers which are invoked by the linker, -as well as strings for the emulation name (normally set from the shell -variable @code{EMULATION_NAME} and the default BFD target name (normally -set from the shell variable @code{OUTPUT_FORMAT} which is normally set -by the @file{emulparams} file). - -The @file{genscripts.sh} script will set the shell variable -@code{COMPILE_IN} when it invokes the @file{emultempl} script for the -default emulation. In this case, the @file{emultempl} script should -include the linker scripts directly, and return them from the -@code{get_scripts} entry point. When the emulation is not the default, -the @code{get_scripts} entry point should just return a file name. See -@file{emultempl/generic.em} for an example of how this is done. - -At some point, the linker emulation entry points should be documented. - -@contents -@bye diff --git a/gnu/dist/ld/ldlang.c b/gnu/dist/ld/ldlang.c deleted file mode 100644 index 6cdab2b1e715..000000000000 --- a/gnu/dist/ld/ldlang.c +++ /dev/null @@ -1,4123 +0,0 @@ -/* Linker command language support. - Copyright (C) 1991, 92, 93, 94, 95, 96, 97, 1998 - Free Software Foundation, Inc. - -This file is part of GLD, the Gnu Linker. - -GLD 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 1, or (at your option) -any later version. - -GLD 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 GLD; see the file COPYING. If not, write to the Free -Software Foundation, 59 Temple Place - Suite 330, Boston, MA -02111-1307, USA. */ - -#include "bfd.h" -#include "sysdep.h" -#include "libiberty.h" -#include "obstack.h" -#include "bfdlink.h" - -#include "ld.h" -#include "ldmain.h" -#include "ldgram.h" -#include "ldexp.h" -#include "ldlang.h" -#include "ldemul.h" -#include "ldlex.h" -#include "ldmisc.h" -#include "ldctor.h" -#include "ldfile.h" -#include "fnmatch.h" - -#include - -/* FORWARDS */ -static lang_statement_union_type *new_statement PARAMS ((enum statement_enum, - size_t, - lang_statement_list_type*)); - - -/* LOCALS */ -static struct obstack stat_obstack; - -#define obstack_chunk_alloc xmalloc -#define obstack_chunk_free free -static CONST char *startup_file; -static lang_statement_list_type input_file_chain; -static boolean placed_commons = false; -static lang_output_section_statement_type *default_common_section; -static boolean map_option_f; -static bfd_vma print_dot; -static lang_input_statement_type *first_file; -static lang_statement_list_type lang_output_section_statement; -static CONST char *current_target; -static CONST char *output_target; -static lang_statement_list_type statement_list; -static struct lang_phdr *lang_phdr_list; - -static void lang_for_each_statement_worker - PARAMS ((void (*func) (lang_statement_union_type *), - lang_statement_union_type *s)); -static lang_input_statement_type *new_afile - PARAMS ((const char *name, lang_input_file_enum_type file_type, - const char *target, boolean add_to_list)); -static void init_os PARAMS ((lang_output_section_statement_type *s)); -static void exp_init_os PARAMS ((etree_type *)); -static void section_already_linked PARAMS ((bfd *, asection *, PTR)); -static boolean wildcardp PARAMS ((const char *)); -static void wild_section PARAMS ((lang_wild_statement_type *ptr, - const char *section, - lang_input_statement_type *file, - lang_output_section_statement_type *output)); -static lang_input_statement_type *lookup_name PARAMS ((const char *name)); -static void load_symbols PARAMS ((lang_input_statement_type *entry, - lang_statement_list_type *)); -static void wild_file PARAMS ((lang_wild_statement_type *, const char *, - lang_input_statement_type *, - lang_output_section_statement_type *)); -static void wild PARAMS ((lang_wild_statement_type *s, - const char *section, const char *file, - const char *target, - lang_output_section_statement_type *output)); -static bfd *open_output PARAMS ((const char *name)); -static void ldlang_open_output PARAMS ((lang_statement_union_type *statement)); -static void open_input_bfds - PARAMS ((lang_statement_union_type *statement, boolean)); -static void lang_reasonable_defaults PARAMS ((void)); -static void lang_place_undefineds PARAMS ((void)); -static void map_input_to_output_sections - PARAMS ((lang_statement_union_type *s, - const char *target, - lang_output_section_statement_type *output_section_statement)); -static void print_output_section_statement - PARAMS ((lang_output_section_statement_type *output_section_statement)); -static void print_assignment - PARAMS ((lang_assignment_statement_type *assignment, - lang_output_section_statement_type *output_section)); -static void print_input_statement PARAMS ((lang_input_statement_type *statm)); -static boolean print_one_symbol PARAMS ((struct bfd_link_hash_entry *, PTR)); -static void print_input_section PARAMS ((lang_input_section_type *in)); -static void print_fill_statement PARAMS ((lang_fill_statement_type *fill)); -static void print_data_statement PARAMS ((lang_data_statement_type *data)); -static void print_address_statement PARAMS ((lang_address_statement_type *)); -static void print_reloc_statement PARAMS ((lang_reloc_statement_type *reloc)); -static void print_padding_statement PARAMS ((lang_padding_statement_type *s)); -static void print_wild_statement - PARAMS ((lang_wild_statement_type *w, - lang_output_section_statement_type *os)); -static void print_group - PARAMS ((lang_group_statement_type *, lang_output_section_statement_type *)); -static void print_statement PARAMS ((lang_statement_union_type *s, - lang_output_section_statement_type *os)); -static void print_statement_list PARAMS ((lang_statement_union_type *s, - lang_output_section_statement_type *os)); -static void print_statements PARAMS ((void)); -static bfd_vma insert_pad PARAMS ((lang_statement_union_type **this_ptr, - fill_type fill, unsigned int power, - asection *output_section_statement, - bfd_vma dot)); -static bfd_vma size_input_section - PARAMS ((lang_statement_union_type **this_ptr, - lang_output_section_statement_type *output_section_statement, - fill_type fill, bfd_vma dot, boolean relax)); -static void lang_finish PARAMS ((void)); -static void ignore_bfd_errors PARAMS ((const char *, ...)); -static void lang_check PARAMS ((void)); -static void lang_common PARAMS ((void)); -static boolean lang_one_common PARAMS ((struct bfd_link_hash_entry *, PTR)); -static void lang_place_orphans PARAMS ((void)); -static int topower PARAMS ((int)); -static void lang_set_startof PARAMS ((void)); -static void reset_memory_regions PARAMS ((void)); -static void lang_record_phdrs PARAMS ((void)); - -/* EXPORTS */ -lang_output_section_statement_type *abs_output_section; -lang_statement_list_type *stat_ptr = &statement_list; -lang_statement_list_type file_chain = { 0 }; -const char *entry_symbol = NULL; -boolean entry_from_cmdline; -boolean lang_has_input_file = false; -boolean had_output_filename = false; -boolean lang_float_flag = false; -boolean delete_output_file_on_failure = false; -struct lang_nocrossrefs *nocrossref_list; - -etree_type *base; /* Relocation base - or null */ - - -#if defined(__STDC__) || defined(ALMOST_STDC) -#define cat(a,b) a##b -#else -#define cat(a,b) a/**/b -#endif - -#define new_stat(x,y) (cat(x,_type)*) new_statement(cat(x,_enum), sizeof(cat(x,_type)),y) - -#define outside_section_address(q) ( (q)->output_offset + (q)->output_section->vma) - -#define outside_symbol_address(q) ((q)->value + outside_section_address(q->section)) - -#define SECTION_NAME_MAP_LENGTH (16) - -PTR -stat_alloc (size) - size_t size; -{ - return obstack_alloc (&stat_obstack, size); -} - -/*---------------------------------------------------------------------- - lang_for_each_statement walks the parse tree and calls the provided - function for each node -*/ - -static void -lang_for_each_statement_worker (func, s) - void (*func) PARAMS ((lang_statement_union_type *)); - lang_statement_union_type *s; -{ - for (; s != (lang_statement_union_type *) NULL; s = s->next) - { - func (s); - - switch (s->header.type) - { - case lang_constructors_statement_enum: - lang_for_each_statement_worker (func, constructor_list.head); - break; - case lang_output_section_statement_enum: - lang_for_each_statement_worker - (func, - s->output_section_statement.children.head); - break; - case lang_wild_statement_enum: - lang_for_each_statement_worker - (func, - s->wild_statement.children.head); - break; - case lang_group_statement_enum: - lang_for_each_statement_worker (func, - s->group_statement.children.head); - break; - case lang_data_statement_enum: - case lang_reloc_statement_enum: - case lang_object_symbols_statement_enum: - case lang_output_statement_enum: - case lang_target_statement_enum: - case lang_input_section_enum: - case lang_input_statement_enum: - case lang_assignment_statement_enum: - case lang_padding_statement_enum: - case lang_address_statement_enum: - case lang_fill_statement_enum: - break; - default: - FAIL (); - break; - } - } -} - -void -lang_for_each_statement (func) - void (*func) PARAMS ((lang_statement_union_type *)); -{ - lang_for_each_statement_worker (func, - statement_list.head); -} - -/*----------------------------------------------------------------------*/ -void -lang_list_init (list) - lang_statement_list_type *list; -{ - list->head = (lang_statement_union_type *) NULL; - list->tail = &list->head; -} - -/*---------------------------------------------------------------------- - - build a new statement node for the parse tree - - */ - -static -lang_statement_union_type * -new_statement (type, size, list) - enum statement_enum type; - size_t size; - lang_statement_list_type * list; -{ - lang_statement_union_type *new = (lang_statement_union_type *) - stat_alloc (size); - - new->header.type = type; - new->header.next = (lang_statement_union_type *) NULL; - lang_statement_append (list, new, &new->header.next); - return new; -} - -/* - Build a new input file node for the language. There are several ways - in which we treat an input file, eg, we only look at symbols, or - prefix it with a -l etc. - - We can be supplied with requests for input files more than once; - they may, for example be split over serveral lines like foo.o(.text) - foo.o(.data) etc, so when asked for a file we check that we havn't - got it already so we don't duplicate the bfd. - - */ -static lang_input_statement_type * -new_afile (name, file_type, target, add_to_list) - CONST char *name; - lang_input_file_enum_type file_type; - CONST char *target; - boolean add_to_list; -{ - lang_input_statement_type *p; - - if (add_to_list) - p = new_stat (lang_input_statement, stat_ptr); - else - { - p = ((lang_input_statement_type *) - stat_alloc (sizeof (lang_input_statement_type))); - p->header.next = NULL; - } - - lang_has_input_file = true; - p->target = target; - switch (file_type) - { - case lang_input_file_is_symbols_only_enum: - p->filename = name; - p->is_archive = false; - p->real = true; - p->local_sym_name = name; - p->just_syms_flag = true; - p->search_dirs_flag = false; - break; - case lang_input_file_is_fake_enum: - p->filename = name; - p->is_archive = false; - p->real = false; - p->local_sym_name = name; - p->just_syms_flag = false; - p->search_dirs_flag = false; - break; - case lang_input_file_is_l_enum: - p->is_archive = true; - p->filename = name; - p->real = true; - p->local_sym_name = concat ("-l", name, (const char *) NULL); - p->just_syms_flag = false; - p->search_dirs_flag = true; - break; - case lang_input_file_is_marker_enum: - p->filename = name; - p->is_archive = false; - p->real = false; - p->local_sym_name = name; - p->just_syms_flag = false; - p->search_dirs_flag = true; - break; - case lang_input_file_is_search_file_enum: - p->filename = name; - p->is_archive = false; - p->real = true; - p->local_sym_name = name; - p->just_syms_flag = false; - p->search_dirs_flag = true; - break; - case lang_input_file_is_file_enum: - p->filename = name; - p->is_archive = false; - p->real = true; - p->local_sym_name = name; - p->just_syms_flag = false; - p->search_dirs_flag = false; - break; - default: - FAIL (); - } - p->the_bfd = (bfd *) NULL; - p->asymbols = (asymbol **) NULL; - p->next_real_file = (lang_statement_union_type *) NULL; - p->next = (lang_statement_union_type *) NULL; - p->symbol_count = 0; - p->dynamic = config.dynamic_link; - p->whole_archive = whole_archive; - p->loaded = false; - lang_statement_append (&input_file_chain, - (lang_statement_union_type *) p, - &p->next_real_file); - return p; -} - -lang_input_statement_type * -lang_add_input_file (name, file_type, target) - CONST char *name; - lang_input_file_enum_type file_type; - CONST char *target; -{ - lang_has_input_file = true; - return new_afile (name, file_type, target, true); -} - -/* Build enough state so that the parser can build its tree */ -void -lang_init () -{ - obstack_begin (&stat_obstack, 1000); - - stat_ptr = &statement_list; - - lang_list_init (stat_ptr); - - lang_list_init (&input_file_chain); - lang_list_init (&lang_output_section_statement); - lang_list_init (&file_chain); - first_file = lang_add_input_file ((char *) NULL, - lang_input_file_is_marker_enum, - (char *) NULL); - abs_output_section = lang_output_section_statement_lookup (BFD_ABS_SECTION_NAME); - - abs_output_section->bfd_section = bfd_abs_section_ptr; - -} - -/*---------------------------------------------------------------------- - A region is an area of memory declared with the - MEMORY { name:org=exp, len=exp ... } - syntax. - - We maintain a list of all the regions here - - If no regions are specified in the script, then the default is used - which is created when looked up to be the entire data space -*/ - -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 * -lang_memory_region_lookup (name) - CONST char *CONST name; -{ - lang_memory_region_type *p; - - for (p = lang_memory_region_list; - p != (lang_memory_region_type *) NULL; - p = p->next) - { - if (strcmp (p->name, name) == 0) - { - return p; - } - } - -#if 0 - /* This code used to always use the first region in the list as the - default region. I changed it to instead use a region - encompassing all of memory as the default region. This permits - NOLOAD sections to work reasonably without requiring a region. - People should specify what region they mean, if they really want - a region. */ - if (strcmp (name, "*default*") == 0) - { - if (lang_memory_region_list != (lang_memory_region_type *) NULL) - { - return lang_memory_region_list; - } - } -#endif - - { - lang_memory_region_type *new = - (lang_memory_region_type *) stat_alloc (sizeof (lang_memory_region_type)); - - new->name = buystring (name); - new->next = (lang_memory_region_type *) NULL; - - *lang_memory_region_list_tail = new; - lang_memory_region_list_tail = &new->next; - new->origin = 0; - new->flags = 0; - new->not_flags = 0; - new->length = ~(bfd_size_type)0; - new->current = 0; - new->had_full_message = false; - - return new; - } -} - - -lang_memory_region_type * -lang_memory_default (section) - asection *section; -{ - lang_memory_region_type *p; - - flagword sec_flags = section->flags; - - /* Override SEC_DATA to mean a writable section. */ - if ((sec_flags & (SEC_ALLOC | SEC_READONLY | SEC_CODE)) == SEC_ALLOC) - sec_flags |= SEC_DATA; - - for (p = lang_memory_region_list; - p != (lang_memory_region_type *) NULL; - p = p->next) - { - if ((p->flags & sec_flags) != 0 - && (p->not_flags & sec_flags) == 0) - { - return p; - } - } - return lang_memory_region_lookup ("*default*"); -} - -lang_output_section_statement_type * -lang_output_section_find (name) - CONST char *CONST name; -{ - lang_statement_union_type *u; - lang_output_section_statement_type *lookup; - - for (u = lang_output_section_statement.head; - u != (lang_statement_union_type *) NULL; - u = lookup->next) - { - lookup = &u->output_section_statement; - if (strcmp (name, lookup->name) == 0) - { - return lookup; - } - } - return (lang_output_section_statement_type *) NULL; -} - -lang_output_section_statement_type * -lang_output_section_statement_lookup (name) - CONST char *CONST name; -{ - lang_output_section_statement_type *lookup; - - lookup = lang_output_section_find (name); - if (lookup == (lang_output_section_statement_type *) NULL) - { - - lookup = (lang_output_section_statement_type *) - new_stat (lang_output_section_statement, stat_ptr); - lookup->region = (lang_memory_region_type *) NULL; - lookup->fill = 0; - lookup->block_value = 1; - lookup->name = name; - - lookup->next = (lang_statement_union_type *) NULL; - lookup->bfd_section = (asection *) NULL; - lookup->processed = false; - lookup->sectype = normal_section; - lookup->addr_tree = (etree_type *) NULL; - lang_list_init (&lookup->children); - - lookup->memspec = (CONST char *) NULL; - lookup->flags = 0; - lookup->subsection_alignment = -1; - lookup->section_alignment = -1; - lookup->load_base = (union etree_union *) NULL; - lookup->phdrs = NULL; - - lang_statement_append (&lang_output_section_statement, - (lang_statement_union_type *) lookup, - &lookup->next); - } - return lookup; -} - -static void -lang_map_flags (flag) - flagword flag; -{ - if (flag & SEC_ALLOC) - minfo ("a"); - - if (flag & SEC_CODE) - minfo ("x"); - - if (flag & SEC_READONLY) - minfo ("r"); - - if (flag & SEC_DATA) - minfo ("w"); - - if (flag & SEC_LOAD) - minfo ("l"); -} - -void -lang_map () -{ - lang_memory_region_type *m; - - minfo ("\nMemory Configuration\n\n"); - fprintf (config.map_file, "%-16s %-18s %-18s %s\n", - "Name", "Origin", "Length", "Attributes"); - - for (m = lang_memory_region_list; - m != (lang_memory_region_type *) NULL; - m = m->next) - { - char buf[100]; - int len; - - fprintf (config.map_file, "%-16s ", m->name); - - sprintf_vma (buf, m->origin); - minfo ("0x%s ", buf); - len = strlen (buf); - while (len < 16) - { - print_space (); - ++len; - } - - minfo ("0x%V", m->length); - if (m->flags || m->not_flags) - { -#ifndef BFD64 - minfo (" "); -#endif - if (m->flags) - { - print_space (); - lang_map_flags (m->flags); - } - - if (m->not_flags) - { - minfo (" !"); - lang_map_flags (m->not_flags); - } - } - - print_nl (); - } - - fprintf (config.map_file, "\nLinker script and memory map\n\n"); - - print_statements (); -} - -/* Initialize an output section. */ - -static void -init_os (s) - lang_output_section_statement_type *s; -{ - section_userdata_type *new; - - if (s->bfd_section != NULL) - return; - - if (strcmp (s->name, DISCARD_SECTION_NAME) == 0) - einfo ("%P%F: Illegal use of `%s' section", DISCARD_SECTION_NAME); - - new = ((section_userdata_type *) - stat_alloc (sizeof (section_userdata_type))); - - s->bfd_section = bfd_get_section_by_name (output_bfd, s->name); - if (s->bfd_section == (asection *) NULL) - s->bfd_section = bfd_make_section (output_bfd, s->name); - if (s->bfd_section == (asection *) NULL) - { - einfo ("%P%F: output format %s cannot represent section called %s\n", - output_bfd->xvec->name, s->name); - } - s->bfd_section->output_section = s->bfd_section; - - /* We initialize an output sections output offset to minus its own */ - /* vma to allow us to output a section through itself */ - s->bfd_section->output_offset = 0; - get_userdata (s->bfd_section) = (PTR) new; - - /* If there is a base address, make sure that any sections it might - mention are initialized. */ - if (s->addr_tree != NULL) - exp_init_os (s->addr_tree); -} - -/* Make sure that all output sections mentioned in an expression are - initialized. */ - -static void -exp_init_os (exp) - etree_type *exp; -{ - switch (exp->type.node_class) - { - case etree_assign: - exp_init_os (exp->assign.src); - break; - - case etree_binary: - exp_init_os (exp->binary.lhs); - exp_init_os (exp->binary.rhs); - break; - - case etree_trinary: - exp_init_os (exp->trinary.cond); - exp_init_os (exp->trinary.lhs); - exp_init_os (exp->trinary.rhs); - break; - - case etree_unary: - exp_init_os (exp->unary.child); - break; - - case etree_name: - switch (exp->type.node_code) - { - case ADDR: - case LOADADDR: - case SIZEOF: - { - lang_output_section_statement_type *os; - - os = lang_output_section_find (exp->name.name); - if (os != NULL && os->bfd_section == NULL) - init_os (os); - } - } - break; - - default: - break; - } -} - -/* Sections marked with the SEC_LINK_ONCE flag should only be linked - once into the output. This routine checks each sections, and - arranges to discard it if a section of the same name has already - been linked. This code assumes that all relevant sections have the - SEC_LINK_ONCE flag set; that is, it does not depend solely upon the - section name. This is called via bfd_map_over_sections. */ - -/*ARGSUSED*/ -static void -section_already_linked (abfd, sec, data) - bfd *abfd; - asection *sec; - PTR data; -{ - lang_input_statement_type *entry = (lang_input_statement_type *) data; - struct sec_link_once - { - struct sec_link_once *next; - asection *sec; - }; - static struct sec_link_once *sec_link_once_list; - flagword flags; - const char *name; - struct sec_link_once *l; - - /* If we are only reading symbols from this object, then we want to - discard all sections. */ - if (entry->just_syms_flag) - { - sec->output_section = bfd_abs_section_ptr; - sec->output_offset = sec->vma; - return; - } - - flags = bfd_get_section_flags (abfd, sec); - - if ((flags & SEC_LINK_ONCE) == 0) - return; - - name = bfd_get_section_name (abfd, sec); - - for (l = sec_link_once_list; l != NULL; l = l->next) - { - if (strcmp (name, bfd_get_section_name (l->sec->owner, l->sec)) == 0) - { - /* The section has already been linked. See if we should - issue a warning. */ - switch (flags & SEC_LINK_DUPLICATES) - { - default: - abort (); - - case SEC_LINK_DUPLICATES_DISCARD: - break; - - case SEC_LINK_DUPLICATES_ONE_ONLY: - einfo ("%P: %B: warning: ignoring duplicate section `%s'\n", - abfd, name); - break; - - case SEC_LINK_DUPLICATES_SAME_CONTENTS: - /* FIXME: We should really dig out the contents of both - sections and memcmp them. The COFF/PE spec says that - the Microsoft linker does not implement this - correctly, so I'm not going to bother doing it - either. */ - /* Fall through. */ - case SEC_LINK_DUPLICATES_SAME_SIZE: - if (bfd_section_size (abfd, sec) - != bfd_section_size (l->sec->owner, l->sec)) - einfo ("%P: %B: warning: duplicate section `%s' has different size\n", - abfd, name); - break; - } - - /* Set the output_section field so that wild_doit does not - create a lang_input_section structure for this section. */ - sec->output_section = bfd_abs_section_ptr; - - return; - } - } - - /* This is the first section with this name. Record it. */ - - l = (struct sec_link_once *) xmalloc (sizeof *l); - l->sec = sec; - l->next = sec_link_once_list; - sec_link_once_list = l; -} - -/* The wild routines. - - These expand statements like *(.text) and foo.o to a list of - explicit actions, like foo.o(.text), bar.o(.text) and - foo.o(.text, .data). */ - -/* Return true if the PATTERN argument is a wildcard pattern. - Although backslashes are treated specially if a pattern contains - wildcards, we do not consider the mere presence of a backslash to - be enough to cause the the pattern to be treated as a wildcard. - That lets us handle DOS filenames more naturally. */ - -static boolean -wildcardp (pattern) - const char *pattern; -{ - const char *s; - - for (s = pattern; *s != '\0'; ++s) - if (*s == '?' - || *s == '*' - || *s == '[') - return true; - return false; -} - -/* Add SECTION to the output section OUTPUT. Do this by creating a - lang_input_section statement which is placed at PTR. FILE is the - input file which holds SECTION. */ - -void -wild_doit (ptr, section, output, file) - lang_statement_list_type *ptr; - asection *section; - lang_output_section_statement_type *output; - lang_input_statement_type *file; -{ - flagword flags; - boolean discard; - - flags = bfd_get_section_flags (section->owner, section); - - discard = false; - - /* If we are doing a final link, discard sections marked with - SEC_EXCLUDE. */ - if (! link_info.relocateable - && (flags & SEC_EXCLUDE) != 0) - discard = true; - - /* Discard input sections which are assigned to a section named - DISCARD_SECTION_NAME. */ - if (strcmp (output->name, DISCARD_SECTION_NAME) == 0) - discard = true; - - /* Discard debugging sections if we are stripping debugging - information. */ - if ((link_info.strip == strip_debugger || link_info.strip == strip_all) - && (flags & SEC_DEBUGGING) != 0) - discard = true; - - if (discard) - { - if (section->output_section == NULL) - { - /* This prevents future calls from assigning this section. */ - section->output_section = bfd_abs_section_ptr; - } - return; - } - - if (section->output_section == NULL) - { - boolean first; - lang_input_section_type *new; - flagword flags; - - if (output->bfd_section == NULL) - { - init_os (output); - first = true; - } - else - first = false; - - /* Add a section reference to the list */ - new = new_stat (lang_input_section, ptr); - - new->section = section; - new->ifile = file; - section->output_section = output->bfd_section; - - flags = section->flags; - - /* We don't copy the SEC_NEVER_LOAD flag from an input section - to an output section, because we want to be able to include a - SEC_NEVER_LOAD section in the middle of an otherwise loaded - section (I don't know why we want to do this, but we do). - build_link_order in ldwrite.c handles this case by turning - the embedded SEC_NEVER_LOAD section into a fill. */ - - flags &= ~ SEC_NEVER_LOAD; - - /* If final link, don't copy the SEC_LINK_ONCE flags, they've - already been processed. One reason to do this is that on pe - format targets, .text$foo sections go into .text and it's odd - to see .text with SEC_LINK_ONCE set. */ - - if (! link_info.relocateable) - flags &= ~ (SEC_LINK_ONCE | SEC_LINK_DUPLICATES); - - /* If this is not the first input section, and the SEC_READONLY - flag is not currently set, then don't set it just because the - input section has it set. */ - - if (! first && (section->output_section->flags & SEC_READONLY) == 0) - flags &= ~ SEC_READONLY; - - section->output_section->flags |= flags; - - /* If SEC_READONLY is not set in the input section, then clear - it from the output section. */ - if ((section->flags & SEC_READONLY) == 0) - section->output_section->flags &= ~SEC_READONLY; - - switch (output->sectype) - { - case normal_section: - break; - case dsect_section: - case copy_section: - case info_section: - case overlay_section: - output->bfd_section->flags &= ~SEC_ALLOC; - break; - case noload_section: - output->bfd_section->flags &= ~SEC_LOAD; - output->bfd_section->flags |= SEC_NEVER_LOAD; - break; - } - - if (section->alignment_power > output->bfd_section->alignment_power) - output->bfd_section->alignment_power = section->alignment_power; - - /* If supplied an aligment, then force it. */ - if (output->section_alignment != -1) - output->bfd_section->alignment_power = output->section_alignment; - } -} - -/* Expand a wild statement for a particular FILE. SECTION may be - NULL, in which case it is a wild card. */ - -static void -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; -{ - if (file->just_syms_flag == false) - { - register asection *s; - boolean wildcard; - - if (section == NULL) - wildcard = false; - else - wildcard = wildcardp (section); - - for (s = file->the_bfd->sections; s != NULL; s = s->next) - { - boolean match; - - /* Attach all sections named SECTION. If SECTION is NULL, - then attach all sections. - - Previously, if SECTION was NULL, this code did not call - wild_doit if the SEC_IS_COMMON flag was set for the - section. I did not understand that, and I took it out. - --ian@cygnus.com. */ - - if (section == NULL) - match = true; - else - { - const char *name; - - name = bfd_get_section_name (file->the_bfd, s); - if (wildcard) - match = fnmatch (section, name, 0) == 0 ? true : false; - else - match = strcmp (section, name) == 0 ? true : false; - } - if (match) - wild_doit (&ptr->children, s, output, file); - } - } -} - -/* This is passed a file name which must have been seen already and - added to the statement tree. We will see if it has been opened - already and had its symbols read. If not then we'll read it. */ - -static lang_input_statement_type * -lookup_name (name) - const char *name; -{ - lang_input_statement_type *search; - - for (search = (lang_input_statement_type *) input_file_chain.head; - search != (lang_input_statement_type *) NULL; - search = (lang_input_statement_type *) search->next_real_file) - { - if (search->filename == (char *) NULL && name == (char *) NULL) - return search; - if (search->filename != (char *) NULL - && name != (char *) NULL - && strcmp (search->filename, name) == 0) - break; - } - - if (search == (lang_input_statement_type *) NULL) - search = new_afile (name, lang_input_file_is_file_enum, default_target, - false); - - /* If we have already added this file, or this file is not real - (FIXME: can that ever actually happen?) or the name is NULL - (FIXME: can that ever actually happen?) don't add this file. */ - if (search->loaded - || ! search->real - || search->filename == (const char *) NULL) - return search; - - load_symbols (search, (lang_statement_list_type *) NULL); - - return search; -} - -/* Get the symbols for an input file. */ - -static void -load_symbols (entry, place) - lang_input_statement_type *entry; - lang_statement_list_type *place; -{ - char **matching; - - if (entry->loaded) - return; - - ldfile_open_file (entry); - - if (! bfd_check_format (entry->the_bfd, bfd_archive) - && ! bfd_check_format_matches (entry->the_bfd, bfd_object, &matching)) - { - bfd_error_type err; - lang_statement_list_type *hold; - - err = bfd_get_error (); - if (err == bfd_error_file_ambiguously_recognized) - { - char **p; - - einfo ("%B: file not recognized: %E\n", entry->the_bfd); - einfo ("%B: matching formats:", entry->the_bfd); - for (p = matching; *p != NULL; p++) - einfo (" %s", *p); - einfo ("%F\n"); - } - else if (err != bfd_error_file_not_recognized - || place == NULL) - einfo ("%F%B: file not recognized: %E\n", entry->the_bfd); - - bfd_close (entry->the_bfd); - entry->the_bfd = NULL; - - /* See if the emulation has some special knowledge. */ - - if (ldemul_unrecognized_file (entry)) - return; - - /* Try to interpret the file as a linker script. */ - - ldfile_open_command_file (entry->filename); - - hold = stat_ptr; - stat_ptr = place; - - ldfile_assumed_script = true; - parser_input = input_script; - yyparse (); - ldfile_assumed_script = false; - - stat_ptr = hold; - - return; - } - - /* We don't call ldlang_add_file for an archive. Instead, the - add_symbols entry point will call ldlang_add_file, via the - add_archive_element callback, for each element of the archive - which is used. */ - switch (bfd_get_format (entry->the_bfd)) - { - default: - break; - - case bfd_object: - ldlang_add_file (entry); - if (trace_files || trace_file_tries) - info_msg ("%I\n", entry); - break; - - case bfd_archive: - if (entry->whole_archive) - { - bfd *member = bfd_openr_next_archived_file (entry->the_bfd, - (bfd *) NULL); - while (member != NULL) - { - if (! bfd_check_format (member, bfd_object)) - einfo ("%F%B: object %B in archive is not object\n", - entry->the_bfd, member); - if (! ((*link_info.callbacks->add_archive_element) - (&link_info, member, "--whole-archive"))) - abort (); - if (! bfd_link_add_symbols (member, &link_info)) - einfo ("%F%B: could not read symbols: %E\n", member); - member = bfd_openr_next_archived_file (entry->the_bfd, - member); - } - - entry->loaded = true; - - return; - } - } - - if (! bfd_link_add_symbols (entry->the_bfd, &link_info)) - einfo ("%F%B: could not read symbols: %E\n", entry->the_bfd); - - entry->loaded = true; -} - -/* Handle a wild statement for a single file F. */ - -static void -wild_file (s, section, f, output) - lang_wild_statement_type *s; - const char *section; - lang_input_statement_type *f; - lang_output_section_statement_type *output; -{ - if (f->the_bfd == NULL - || ! bfd_check_format (f->the_bfd, bfd_archive)) - wild_section (s, section, f, output); - else - { - bfd *member; - - /* This is an archive file. We must map each member of the - archive separately. */ - member = bfd_openr_next_archived_file (f->the_bfd, (bfd *) NULL); - while (member != NULL) - { - /* When lookup_name is called, it will call the add_symbols - entry point for the archive. For each element of the - archive which is included, BFD will call ldlang_add_file, - which will set the usrdata field of the member to the - lang_input_statement. */ - if (member->usrdata != NULL) - { - wild_section (s, section, - (lang_input_statement_type *) member->usrdata, - output); - } - - member = bfd_openr_next_archived_file (f->the_bfd, member); - } - } -} - -/* Handle a wild statement. SECTION or FILE or both may be NULL, - indicating that it is a wildcard. Separate lang_input_section - statements are created for each part of the expansion; they are - added after the wild statement S. OUTPUT is the output section. */ - -static void -wild (s, section, file, target, output) - lang_wild_statement_type *s; - const char *section; - const char *file; - const char *target; - lang_output_section_statement_type *output; -{ - lang_input_statement_type *f; - - if (file == (char *) NULL) - { - /* Perform the iteration over all files in the list */ - for (f = (lang_input_statement_type *) file_chain.head; - f != (lang_input_statement_type *) NULL; - f = (lang_input_statement_type *) f->next) - { - wild_file (s, section, f, output); - } - } - else if (wildcardp (file)) - { - for (f = (lang_input_statement_type *) file_chain.head; - f != (lang_input_statement_type *) NULL; - f = (lang_input_statement_type *) f->next) - { - if (fnmatch (file, f->filename, FNM_FILE_NAME) == 0) - wild_file (s, section, f, output); - } - } - else - { - /* Perform the iteration over a single file */ - f = lookup_name (file); - wild_file (s, section, f, output); - } - - if (section != (char *) NULL - && strcmp (section, "COMMON") == 0 - && default_common_section == NULL) - { - /* Remember the section that common is going to in case we later - get something which doesn't know where to put it. */ - default_common_section = output; - } -} - -/* Open the output file. */ - -static bfd * -open_output (name) - const char *name; -{ - bfd *output; - - if (output_target == (char *) NULL) - { - if (current_target != (char *) NULL) - output_target = current_target; - else - output_target = default_target; - } - output = bfd_openw (name, output_target); - - if (output == (bfd *) NULL) - { - if (bfd_get_error () == bfd_error_invalid_target) - { - einfo ("%P%F: target %s not found\n", output_target); - } - einfo ("%P%F: cannot open output file %s: %E\n", name); - } - - delete_output_file_on_failure = true; - - /* output->flags |= D_PAGED;*/ - - if (! bfd_set_format (output, bfd_object)) - einfo ("%P%F:%s: can not make object file: %E\n", name); - if (! bfd_set_arch_mach (output, - ldfile_output_architecture, - ldfile_output_machine)) - einfo ("%P%F:%s: can not set architecture: %E\n", name); - - link_info.hash = bfd_link_hash_table_create (output); - if (link_info.hash == (struct bfd_link_hash_table *) NULL) - einfo ("%P%F: can not create link hash table: %E\n"); - - bfd_set_gp_size (output, g_switch_value); - return output; -} - - - - -static void -ldlang_open_output (statement) - lang_statement_union_type * statement; -{ - switch (statement->header.type) - { - case lang_output_statement_enum: - ASSERT (output_bfd == (bfd *) NULL); - output_bfd = open_output (statement->output_statement.name); - ldemul_set_output_arch (); - if (config.magic_demand_paged && !link_info.relocateable) - output_bfd->flags |= D_PAGED; - else - output_bfd->flags &= ~D_PAGED; - if (config.text_read_only) - output_bfd->flags |= WP_TEXT; - else - output_bfd->flags &= ~WP_TEXT; - if (link_info.traditional_format) - output_bfd->flags |= BFD_TRADITIONAL_FORMAT; - else - output_bfd->flags &= ~BFD_TRADITIONAL_FORMAT; - break; - - case lang_target_statement_enum: - current_target = statement->target_statement.target; - break; - default: - break; - } -} - -/* Open all the input files. */ - -static void -open_input_bfds (s, force) - lang_statement_union_type *s; - boolean force; -{ - for (; s != (lang_statement_union_type *) NULL; s = s->next) - { - switch (s->header.type) - { - case lang_constructors_statement_enum: - open_input_bfds (constructor_list.head, force); - break; - case lang_output_section_statement_enum: - open_input_bfds (s->output_section_statement.children.head, force); - break; - case lang_wild_statement_enum: - /* Maybe we should load the file's symbols */ - if (s->wild_statement.filename - && ! wildcardp (s->wild_statement.filename)) - (void) lookup_name (s->wild_statement.filename); - open_input_bfds (s->wild_statement.children.head, force); - break; - case lang_group_statement_enum: - { - struct bfd_link_hash_entry *undefs; - - /* We must continually search the entries in the group - until no new symbols are added to the list of undefined - symbols. */ - - do - { - undefs = link_info.hash->undefs_tail; - open_input_bfds (s->group_statement.children.head, true); - } - while (undefs != link_info.hash->undefs_tail); - } - break; - case lang_target_statement_enum: - current_target = s->target_statement.target; - break; - case lang_input_statement_enum: - if (s->input_statement.real == true) - { - lang_statement_list_type add; - - s->input_statement.target = current_target; - - /* If we are being called from within a group, and this - is an archive which has already been searched, then - force it to be researched. */ - if (force - && s->input_statement.loaded - && bfd_check_format (s->input_statement.the_bfd, - bfd_archive)) - s->input_statement.loaded = false; - - lang_list_init (&add); - - load_symbols (&s->input_statement, &add); - - if (add.head != NULL) - { - *add.tail = s->next; - s->next = add.head; - } - } - break; - default: - break; - } - } -} - -/* If there are [COMMONS] statements, put a wild one into the bss section */ - -static void -lang_reasonable_defaults () -{ -#if 0 - lang_output_section_statement_lookup (".text"); - lang_output_section_statement_lookup (".data"); - - default_common_section = - lang_output_section_statement_lookup (".bss"); - - - if (placed_commons == false) - { - lang_wild_statement_type *new = - new_stat (lang_wild_statement, - &default_common_section->children); - - new->section_name = "COMMON"; - new->filename = (char *) NULL; - lang_list_init (&new->children); - } -#endif - -} - -/* - Add the supplied name to the symbol table as an undefined reference. - Remove items from the chain as we open input bfds - */ -typedef struct ldlang_undef_chain_list -{ - struct ldlang_undef_chain_list *next; - char *name; -} ldlang_undef_chain_list_type; - -static ldlang_undef_chain_list_type *ldlang_undef_chain_list_head; - -void -ldlang_add_undef (name) - CONST char *CONST name; -{ - ldlang_undef_chain_list_type *new = - ((ldlang_undef_chain_list_type *) - stat_alloc (sizeof (ldlang_undef_chain_list_type))); - - new->next = ldlang_undef_chain_list_head; - ldlang_undef_chain_list_head = new; - - new->name = buystring (name); -} - -/* Run through the list of undefineds created above and place them - into the linker hash table as undefined symbols belonging to the - script file. -*/ -static void -lang_place_undefineds () -{ - ldlang_undef_chain_list_type *ptr; - - for (ptr = ldlang_undef_chain_list_head; - ptr != (ldlang_undef_chain_list_type *) NULL; - ptr = ptr->next) - { - struct bfd_link_hash_entry *h; - - h = bfd_link_hash_lookup (link_info.hash, ptr->name, true, false, true); - if (h == (struct bfd_link_hash_entry *) NULL) - einfo ("%P%F: bfd_link_hash_lookup failed: %E\n"); - if (h->type == bfd_link_hash_new) - { - h->type = bfd_link_hash_undefined; - h->u.undef.abfd = NULL; - bfd_link_add_undef (link_info.hash, h); - } - } -} - -/* Open input files and attatch to output sections */ -static void -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) - { - switch (s->header.type) - { - - - case lang_wild_statement_enum: - wild (&s->wild_statement, s->wild_statement.section_name, - s->wild_statement.filename, target, - output_section_statement); - - break; - case lang_constructors_statement_enum: - map_input_to_output_sections (constructor_list.head, - target, - output_section_statement); - break; - case lang_output_section_statement_enum: - map_input_to_output_sections (s->output_section_statement.children.head, - target, - &s->output_section_statement); - break; - case lang_output_statement_enum: - break; - case lang_target_statement_enum: - target = s->target_statement.target; - break; - case lang_group_statement_enum: - map_input_to_output_sections (s->group_statement.children.head, - target, - output_section_statement); - break; - case lang_fill_statement_enum: - case lang_input_section_enum: - case lang_object_symbols_statement_enum: - case lang_data_statement_enum: - case lang_reloc_statement_enum: - case lang_padding_statement_enum: - case lang_input_statement_enum: - if (output_section_statement != NULL - && output_section_statement->bfd_section == NULL) - init_os (output_section_statement); - break; - case lang_assignment_statement_enum: - if (output_section_statement != NULL - && output_section_statement->bfd_section == NULL) - init_os (output_section_statement); - - /* Make sure that any sections mentioned in the assignment - are initialized. */ - exp_init_os (s->assignment_statement.exp); - break; - case lang_afile_asection_pair_statement_enum: - FAIL (); - break; - case lang_address_statement_enum: - /* Mark the specified section with the supplied address */ - { - lang_output_section_statement_type *os = - lang_output_section_statement_lookup - (s->address_statement.section_name); - - if (os->bfd_section == NULL) - init_os (os); - os->addr_tree = s->address_statement.address; - } - break; - } - } -} - -static void -print_output_section_statement (output_section_statement) - lang_output_section_statement_type * output_section_statement; -{ - asection *section = output_section_statement->bfd_section; - int len; - - if (output_section_statement != abs_output_section) - { - minfo ("\n%s", output_section_statement->name); - - if (section != NULL) - { - print_dot = section->vma; - - len = strlen (output_section_statement->name); - if (len >= SECTION_NAME_MAP_LENGTH - 1) - { - print_nl (); - len = 0; - } - while (len < SECTION_NAME_MAP_LENGTH) - { - print_space (); - ++len; - } - - minfo ("0x%V %W", section->vma, section->_raw_size); - - if (output_section_statement->load_base != NULL) - { - bfd_vma addr; - - addr = exp_get_abs_int (output_section_statement->load_base, 0, - "load base", lang_final_phase_enum); - minfo (" load address 0x%V", addr); - } - } - - print_nl (); - } - - print_statement_list (output_section_statement->children.head, - output_section_statement); -} - -static void -print_assignment (assignment, output_section) - lang_assignment_statement_type * assignment; - lang_output_section_statement_type * output_section; -{ - int i; - etree_value_type result; - - for (i = 0; i < SECTION_NAME_MAP_LENGTH; i++) - print_space (); - - result = exp_fold_tree (assignment->exp->assign.src, output_section, - lang_final_phase_enum, print_dot, &print_dot); - if (result.valid) - minfo ("0x%V", result.value + result.section->bfd_section->vma); - else - { - minfo ("*undef* "); -#ifdef BFD64 - minfo (" "); -#endif - } - - minfo (" "); - - exp_print_tree (assignment->exp); - - print_nl (); -} - -static void -print_input_statement (statm) - lang_input_statement_type * statm; -{ - if (statm->filename != (char *) NULL) - { - fprintf (config.map_file, "LOAD %s\n", statm->filename); - } -} - -/* Print all symbols defined in a particular section. This is called - via bfd_link_hash_traverse. */ - -static boolean -print_one_symbol (hash_entry, ptr) - struct bfd_link_hash_entry *hash_entry; - PTR ptr; -{ - asection *sec = (asection *) ptr; - - if ((hash_entry->type == bfd_link_hash_defined - || hash_entry->type == bfd_link_hash_defweak) - && sec == hash_entry->u.def.section) - { - int i; - - for (i = 0; i < SECTION_NAME_MAP_LENGTH; i++) - print_space (); - minfo ("0x%V ", - (hash_entry->u.def.value - + hash_entry->u.def.section->output_offset - + hash_entry->u.def.section->output_section->vma)); - - minfo (" %T\n", hash_entry->root.string); - } - - return true; -} - -/* Print information about an input section to the map file. */ - -static void -print_input_section (in) - lang_input_section_type * in; -{ - asection *i = in->section; - bfd_size_type size = i->_cooked_size != 0 ? i->_cooked_size : i->_raw_size; - - if (size != 0) - { - print_space (); - - minfo ("%s", i->name); - - if (i->output_section != NULL) - { - int len; - - len = 1 + strlen (i->name); - if (len >= SECTION_NAME_MAP_LENGTH - 1) - { - print_nl (); - len = 0; - } - while (len < SECTION_NAME_MAP_LENGTH) - { - print_space (); - ++len; - } - - minfo ("0x%V %W %B\n", - i->output_section->vma + i->output_offset, size, - i->owner); - - if (i->_cooked_size != 0 && i->_cooked_size != i->_raw_size) - { - len = SECTION_NAME_MAP_LENGTH + 3; -#ifdef BFD64 - len += 16; -#else - len += 8; -#endif - while (len > 0) - { - print_space (); - --len; - } - - minfo ("%W (size before relaxing)\n", i->_raw_size); - } - - bfd_link_hash_traverse (link_info.hash, print_one_symbol, (PTR) i); - - print_dot = i->output_section->vma + i->output_offset + size; - } - } -} - -static void -print_fill_statement (fill) - lang_fill_statement_type * fill; -{ - fprintf (config.map_file, " FILL mask 0x%x\n", fill->fill); -} - -static void -print_data_statement (data) - lang_data_statement_type * data; -{ - int i; - bfd_vma addr; - bfd_size_type size; - const char *name; - - for (i = 0; i < SECTION_NAME_MAP_LENGTH; i++) - print_space (); - - addr = data->output_vma; - if (data->output_section != NULL) - addr += data->output_section->vma; - - switch (data->type) - { - default: - abort (); - case BYTE: - size = BYTE_SIZE; - name = "BYTE"; - break; - case SHORT: - size = SHORT_SIZE; - name = "SHORT"; - break; - case LONG: - size = LONG_SIZE; - name = "LONG"; - break; - case QUAD: - size = QUAD_SIZE; - name = "QUAD"; - break; - case SQUAD: - size = QUAD_SIZE; - name = "SQUAD"; - break; - } - - minfo ("0x%V %W %s 0x%v", addr, size, name, data->value); - - if (data->exp->type.node_class != etree_value) - { - print_space (); - exp_print_tree (data->exp); - } - - print_nl (); - - print_dot = addr + size; -} - -/* Print an address statement. These are generated by options like - -Ttext. */ - -static void -print_address_statement (address) - lang_address_statement_type *address; -{ - minfo ("Address of section %s set to ", address->section_name); - exp_print_tree (address->address); - print_nl (); -} - -/* Print a reloc statement. */ - -static void -print_reloc_statement (reloc) - lang_reloc_statement_type *reloc; -{ - int i; - bfd_vma addr; - bfd_size_type size; - - for (i = 0; i < SECTION_NAME_MAP_LENGTH; i++) - print_space (); - - addr = reloc->output_vma; - if (reloc->output_section != NULL) - addr += reloc->output_section->vma; - - size = bfd_get_reloc_size (reloc->howto); - - minfo ("0x%V %W RELOC %s ", addr, size, reloc->howto->name); - - if (reloc->name != NULL) - minfo ("%s+", reloc->name); - else - minfo ("%s+", reloc->section->name); - - exp_print_tree (reloc->addend_exp); - - print_nl (); - - print_dot = addr + size; -} - -static void -print_padding_statement (s) - lang_padding_statement_type *s; -{ - int len; - bfd_vma addr; - - minfo (" *fill*"); - - len = sizeof " *fill*" - 1; - while (len < SECTION_NAME_MAP_LENGTH) - { - print_space (); - ++len; - } - - addr = s->output_offset; - if (s->output_section != NULL) - addr += s->output_section->vma; - minfo ("0x%V %W", addr, s->size); - - if (s->fill != 0) - minfo (" %u", s->fill); - - print_nl (); - - print_dot = addr + s->size; -} - -static void -print_wild_statement (w, os) - lang_wild_statement_type * w; - lang_output_section_statement_type * os; -{ - print_space (); - - if (w->filename != NULL) - minfo ("%s", w->filename); - else - minfo ("*"); - - if (w->section_name != NULL) - minfo ("(%s)", w->section_name); - else - minfo ("(*)"); - - print_nl (); - - print_statement_list (w->children.head, os); -} - -/* Print a group statement. */ - -static void -print_group (s, os) - lang_group_statement_type *s; - lang_output_section_statement_type *os; -{ - fprintf (config.map_file, "START GROUP\n"); - print_statement_list (s->children.head, os); - fprintf (config.map_file, "END GROUP\n"); -} - -/* Print the list of statements in S. - This can be called for any statement type. */ - -static void -print_statement_list (s, os) - lang_statement_union_type *s; - lang_output_section_statement_type *os; -{ - while (s != NULL) - { - print_statement (s, os); - s = s->next; - } -} - -/* Print the first statement in statement list S. - This can be called for any statement type. */ - -static void -print_statement (s, os) - lang_statement_union_type *s; - lang_output_section_statement_type *os; -{ - switch (s->header.type) - { - default: - fprintf (config.map_file, "Fail with %d\n", s->header.type); - FAIL (); - break; - case lang_constructors_statement_enum: - if (constructor_list.head != NULL) - { - minfo (" CONSTRUCTORS\n"); - print_statement_list (constructor_list.head, os); - } - break; - case lang_wild_statement_enum: - print_wild_statement (&s->wild_statement, os); - break; - case lang_address_statement_enum: - print_address_statement (&s->address_statement); - break; - case lang_object_symbols_statement_enum: - minfo (" CREATE_OBJECT_SYMBOLS\n"); - break; - case lang_fill_statement_enum: - print_fill_statement (&s->fill_statement); - break; - case lang_data_statement_enum: - print_data_statement (&s->data_statement); - break; - case lang_reloc_statement_enum: - print_reloc_statement (&s->reloc_statement); - break; - case lang_input_section_enum: - print_input_section (&s->input_section); - break; - case lang_padding_statement_enum: - print_padding_statement (&s->padding_statement); - break; - case lang_output_section_statement_enum: - print_output_section_statement (&s->output_section_statement); - break; - case lang_assignment_statement_enum: - print_assignment (&s->assignment_statement, os); - break; - case lang_target_statement_enum: - fprintf (config.map_file, "TARGET(%s)\n", s->target_statement.target); - break; - case lang_output_statement_enum: - minfo ("OUTPUT(%s", s->output_statement.name); - if (output_target != NULL) - minfo (" %s", output_target); - minfo (")\n"); - break; - case lang_input_statement_enum: - print_input_statement (&s->input_statement); - break; - case lang_group_statement_enum: - print_group (&s->group_statement, os); - break; - case lang_afile_asection_pair_statement_enum: - FAIL (); - break; - } -} - -static void -print_statements () -{ - print_statement_list (statement_list.head, abs_output_section); -} - -/* Print the first N statements in statement list S to STDERR. - If N == 0, nothing is printed. - If N < 0, the entire list is printed. - Intended to be called from GDB. */ - -void -dprint_statement (s, n) - lang_statement_union_type * s; - int n; -{ - FILE *map_save = config.map_file; - - config.map_file = stderr; - - if (n < 0) - print_statement_list (s, abs_output_section); - else - { - while (s && --n >= 0) - { - print_statement (s, abs_output_section); - s = s->next; - } - } - - config.map_file = map_save; -} - -static bfd_vma -insert_pad (this_ptr, fill, power, output_section_statement, dot) - lang_statement_union_type ** this_ptr; - fill_type fill; - unsigned int power; - asection * output_section_statement; - bfd_vma dot; -{ - /* Align this section first to the - input sections requirement, then - to the output section's requirement. - If this alignment is > than any seen before, - then record it too. Perform the alignment by - inserting a magic 'padding' statement. - */ - - unsigned int alignment_needed = align_power (dot, power) - dot; - - if (alignment_needed != 0) - { - lang_statement_union_type *new = - ((lang_statement_union_type *) - stat_alloc (sizeof (lang_padding_statement_type))); - - /* Link into existing chain */ - new->header.next = *this_ptr; - *this_ptr = new; - new->header.type = lang_padding_statement_enum; - new->padding_statement.output_section = output_section_statement; - new->padding_statement.output_offset = - dot - output_section_statement->vma; - new->padding_statement.fill = fill; - new->padding_statement.size = alignment_needed; - } - - - /* Remember the most restrictive alignment */ - if (power > output_section_statement->alignment_power) - { - output_section_statement->alignment_power = power; - } - output_section_statement->_raw_size += alignment_needed; - return alignment_needed + dot; - -} - -/* Work out how much this section will move the dot point */ -static bfd_vma -size_input_section (this_ptr, output_section_statement, fill, dot, relax) - lang_statement_union_type ** this_ptr; - lang_output_section_statement_type * output_section_statement; - fill_type fill; - bfd_vma dot; - boolean relax; -{ - lang_input_section_type *is = &((*this_ptr)->input_section); - asection *i = is->section; - - if (is->ifile->just_syms_flag == false) - { - if (output_section_statement->subsection_alignment != -1) - i->alignment_power = - output_section_statement->subsection_alignment; - - dot = insert_pad (this_ptr, fill, i->alignment_power, - output_section_statement->bfd_section, dot); - - /* Remember where in the output section this input section goes */ - - i->output_offset = dot - output_section_statement->bfd_section->vma; - - /* Mark how big the output section must be to contain this now - */ - if (i->_cooked_size != 0) - dot += i->_cooked_size; - else - dot += i->_raw_size; - output_section_statement->bfd_section->_raw_size = dot - output_section_statement->bfd_section->vma; - } - else - { - i->output_offset = i->vma - output_section_statement->bfd_section->vma; - } - - return dot; -} - -/* This variable indicates whether bfd_relax_section should be called - again. */ - -static boolean relax_again; - -/* Set the sizes for all the output sections. */ - -bfd_vma -lang_size_sections (s, output_section_statement, prev, fill, dot, relax) - lang_statement_union_type * s; - lang_output_section_statement_type * output_section_statement; - lang_statement_union_type ** prev; - fill_type fill; - bfd_vma dot; - boolean relax; -{ - /* Size up the sections from their constituent parts */ - for (; s != (lang_statement_union_type *) NULL; s = s->next) - { - switch (s->header.type) - { - - case lang_output_section_statement_enum: - { - bfd_vma after; - lang_output_section_statement_type *os = &s->output_section_statement; - - if (os->bfd_section == NULL) - { - /* This section was never actually created. */ - break; - } - - /* If this is a COFF shared library section, use the size and - address from the input section. FIXME: This is COFF - specific; it would be cleaner if there were some other way - to do this, but nothing simple comes to mind. */ - if ((os->bfd_section->flags & SEC_COFF_SHARED_LIBRARY) != 0) - { - asection *input; - - if (os->children.head == NULL - || os->children.head->next != NULL - || os->children.head->header.type != lang_input_section_enum) - einfo ("%P%X: Internal error on COFF shared library section %s\n", - os->name); - - input = os->children.head->input_section.section; - bfd_set_section_vma (os->bfd_section->owner, - os->bfd_section, - bfd_section_vma (input->owner, input)); - os->bfd_section->_raw_size = input->_raw_size; - break; - } - - if (bfd_is_abs_section (os->bfd_section)) - { - /* No matter what happens, an abs section starts at zero */ - ASSERT (os->bfd_section->vma == 0); - } - else - { - if (os->addr_tree == (etree_type *) NULL) - { - /* No address specified for this section, get one - from the region specification - */ - if (os->region == (lang_memory_region_type *) NULL - || (((bfd_get_section_flags (output_bfd, os->bfd_section) - & (SEC_ALLOC | SEC_LOAD)) != 0) - && os->region->name[0] == '*' - && strcmp (os->region->name, "*default*") == 0)) - { - os->region = lang_memory_default (os->bfd_section); - } - - /* If a loadable section is using the default memory - region, and some non default memory regions were - defined, issue a warning. */ - if ((bfd_get_section_flags (output_bfd, os->bfd_section) - & (SEC_ALLOC | SEC_LOAD)) != 0 - && ! link_info.relocateable - && strcmp (os->region->name, "*default*") == 0 - && lang_memory_region_list != NULL - && (strcmp (lang_memory_region_list->name, "*default*") != 0 - || lang_memory_region_list->next != NULL)) - einfo ("%P: warning: no memory region specified for section `%s'\n", - bfd_get_section_name (output_bfd, os->bfd_section)); - - dot = os->region->current; - if (os->section_alignment == -1) - { - bfd_vma olddot; - - olddot = dot; - dot = align_power (dot, os->bfd_section->alignment_power); - if (dot != olddot && config.warn_section_align) - einfo ("%P: warning: changing start of section %s by %u bytes\n", - os->name, (unsigned int) (dot - olddot)); - } - } - else - { - etree_value_type r; - - r = exp_fold_tree (os->addr_tree, - abs_output_section, - lang_allocating_phase_enum, - dot, &dot); - if (r.valid == false) - { - einfo ("%F%S: non constant address expression for section %s\n", - os->name); - } - dot = r.value + r.section->bfd_section->vma; - } - /* The section starts here */ - /* First, align to what the section needs */ - - if (os->section_alignment != -1) - dot = align_power (dot, os->section_alignment); - - bfd_set_section_vma (0, os->bfd_section, dot); - - os->bfd_section->output_offset = 0; - } - - (void) lang_size_sections (os->children.head, os, &os->children.head, - os->fill, dot, relax); - /* Ignore the size of the input sections, use the vma and size to */ - /* align against */ - - after = ALIGN_N (os->bfd_section->vma + - os->bfd_section->_raw_size, - /* The coercion here is important, see ld.h. */ - (bfd_vma) os->block_value); - - if (bfd_is_abs_section (os->bfd_section)) - ASSERT (after == os->bfd_section->vma); - else - os->bfd_section->_raw_size = after - os->bfd_section->vma; - dot = os->bfd_section->vma + os->bfd_section->_raw_size; - os->processed = true; - - /* Replace into region ? */ - if (os->region != (lang_memory_region_type *) NULL) - { - os->region->current = dot; - /* Make sure this isn't silly. */ - if (os->region->current < os->region->origin - || (os->region->current - os->region->origin - > os->region->length)) - { - if (os->addr_tree != (etree_type *) NULL) - { - einfo ("%X%P: address 0x%v of %B section %s is not within region %s\n", - os->region->current, - os->bfd_section->owner, - os->bfd_section->name, - os->region->name); - } - else - { - einfo ("%X%P: region %s is full (%B section %s)\n", - os->region->name, - os->bfd_section->owner, - os->bfd_section->name); - } - /* Reset the region pointer. */ - os->region->current = os->region->origin; - } - } - } - break; - - case lang_constructors_statement_enum: - dot = lang_size_sections (constructor_list.head, - output_section_statement, - &s->wild_statement.children.head, - fill, - dot, relax); - break; - - case lang_data_statement_enum: - { - unsigned int size = 0; - - s->data_statement.output_vma = dot - output_section_statement->bfd_section->vma; - s->data_statement.output_section = - output_section_statement->bfd_section; - - switch (s->data_statement.type) - { - case QUAD: - case SQUAD: - size = QUAD_SIZE; - break; - case LONG: - size = LONG_SIZE; - break; - case SHORT: - size = SHORT_SIZE; - break; - case BYTE: - size = BYTE_SIZE; - break; - } - - dot += size; - output_section_statement->bfd_section->_raw_size += size; - /* The output section gets contents, and then we inspect for - any flags set in the input script which override any ALLOC */ - output_section_statement->bfd_section->flags |= SEC_HAS_CONTENTS; - if (!(output_section_statement->flags & SEC_NEVER_LOAD)) { - output_section_statement->bfd_section->flags |= SEC_ALLOC | SEC_LOAD; - } - } - break; - - case lang_reloc_statement_enum: - { - int size; - - s->reloc_statement.output_vma = - dot - output_section_statement->bfd_section->vma; - s->reloc_statement.output_section = - output_section_statement->bfd_section; - size = bfd_get_reloc_size (s->reloc_statement.howto); - dot += size; - output_section_statement->bfd_section->_raw_size += size; - } - break; - - case lang_wild_statement_enum: - - dot = lang_size_sections (s->wild_statement.children.head, - output_section_statement, - &s->wild_statement.children.head, - - fill, dot, relax); - - break; - - case lang_object_symbols_statement_enum: - link_info.create_object_symbols_section = - output_section_statement->bfd_section; - break; - case lang_output_statement_enum: - case lang_target_statement_enum: - break; - case lang_input_section_enum: - { - asection *i; - - i = (*prev)->input_section.section; - if (! relax) - { - if (i->_cooked_size == 0) - i->_cooked_size = i->_raw_size; - } - else - { - boolean again; - - if (! bfd_relax_section (i->owner, i, &link_info, &again)) - einfo ("%P%F: can't relax section: %E\n"); - if (again) - relax_again = true; - } - dot = size_input_section (prev, - output_section_statement, - output_section_statement->fill, - dot, relax); - } - break; - case lang_input_statement_enum: - break; - case lang_fill_statement_enum: - s->fill_statement.output_section = output_section_statement->bfd_section; - - fill = s->fill_statement.fill; - break; - case lang_assignment_statement_enum: - { - bfd_vma newdot = dot; - - exp_fold_tree (s->assignment_statement.exp, - output_section_statement, - lang_allocating_phase_enum, - dot, - &newdot); - - if (newdot != dot && !relax) - { - /* The assignment changed dot. Insert a pad. */ - if (output_section_statement == abs_output_section) - { - /* If we don't have an output section, then just adjust - the default memory address. */ - lang_memory_region_lookup ("*default*")->current = newdot; - } - else - { - lang_statement_union_type *new = - ((lang_statement_union_type *) - stat_alloc (sizeof (lang_padding_statement_type))); - - /* Link into existing chain */ - new->header.next = *prev; - *prev = new; - new->header.type = lang_padding_statement_enum; - new->padding_statement.output_section = - output_section_statement->bfd_section; - new->padding_statement.output_offset = - dot - output_section_statement->bfd_section->vma; - new->padding_statement.fill = fill; - new->padding_statement.size = newdot - dot; - output_section_statement->bfd_section->_raw_size += - new->padding_statement.size; - } - - dot = newdot; - } - } - break; - - case lang_padding_statement_enum: - /* If we are relaxing, and this is not the first pass, some - padding statements may have been inserted during previous - passes. We may have to move the padding statement to a new - location if dot has a different value at this point in this - pass than it did at this point in the previous pass. */ - s->padding_statement.output_offset = - dot - output_section_statement->bfd_section->vma; - dot += s->padding_statement.size; - output_section_statement->bfd_section->_raw_size += - s->padding_statement.size; - break; - - case lang_group_statement_enum: - dot = lang_size_sections (s->group_statement.children.head, - output_section_statement, - &s->group_statement.children.head, - fill, dot, relax); - break; - - default: - FAIL (); - break; - - /* This can only get here when relaxing is turned on */ - - case lang_address_statement_enum: - break; - } - prev = &s->header.next; - } - return dot; -} - -bfd_vma -lang_do_assignments (s, output_section_statement, fill, dot) - lang_statement_union_type * s; - lang_output_section_statement_type * output_section_statement; - fill_type fill; - bfd_vma dot; -{ - for (; s != (lang_statement_union_type *) NULL; s = s->next) - { - switch (s->header.type) - { - case lang_constructors_statement_enum: - dot = lang_do_assignments (constructor_list.head, - output_section_statement, - fill, - dot); - break; - - case lang_output_section_statement_enum: - { - lang_output_section_statement_type *os = - &(s->output_section_statement); - - if (os->bfd_section != NULL) - { - dot = os->bfd_section->vma; - (void) lang_do_assignments (os->children.head, os, - os->fill, dot); - dot = os->bfd_section->vma + os->bfd_section->_raw_size; - } - if (os->load_base) - { - /* If nothing has been placed into the output section then - it won't have a bfd_section. */ - if (os->bfd_section) - { - os->bfd_section->lma - = exp_get_abs_int(os->load_base, 0,"load base", lang_final_phase_enum); - } - } - } - break; - case lang_wild_statement_enum: - - dot = lang_do_assignments (s->wild_statement.children.head, - output_section_statement, - fill, dot); - - break; - - case lang_object_symbols_statement_enum: - case lang_output_statement_enum: - case lang_target_statement_enum: -#if 0 - case lang_common_statement_enum: -#endif - break; - case lang_data_statement_enum: - { - etree_value_type value; - - value = exp_fold_tree (s->data_statement.exp, - abs_output_section, - lang_final_phase_enum, dot, &dot); - s->data_statement.value = value.value; - if (value.valid == false) - einfo ("%F%P: invalid data statement\n"); - } - switch (s->data_statement.type) - { - case QUAD: - case SQUAD: - dot += QUAD_SIZE; - break; - case LONG: - dot += LONG_SIZE; - break; - case SHORT: - dot += SHORT_SIZE; - break; - case BYTE: - dot += BYTE_SIZE; - break; - } - break; - - case lang_reloc_statement_enum: - { - etree_value_type value; - - value = exp_fold_tree (s->reloc_statement.addend_exp, - abs_output_section, - lang_final_phase_enum, dot, &dot); - s->reloc_statement.addend_value = value.value; - if (value.valid == false) - einfo ("%F%P: invalid reloc statement\n"); - } - dot += bfd_get_reloc_size (s->reloc_statement.howto); - break; - - case lang_input_section_enum: - { - asection *in = s->input_section.section; - - if (in->_cooked_size != 0) - dot += in->_cooked_size; - else - dot += in->_raw_size; - } - break; - - case lang_input_statement_enum: - break; - case lang_fill_statement_enum: - fill = s->fill_statement.fill; - break; - case lang_assignment_statement_enum: - { - exp_fold_tree (s->assignment_statement.exp, - output_section_statement, - lang_final_phase_enum, - dot, - &dot); - } - - break; - case lang_padding_statement_enum: - dot += s->padding_statement.size; - break; - - case lang_group_statement_enum: - dot = lang_do_assignments (s->group_statement.children.head, - output_section_statement, - fill, dot); - - break; - - default: - FAIL (); - break; - case lang_address_statement_enum: - break; - } - - } - return dot; -} - -/* Fix any .startof. or .sizeof. symbols. When the assemblers see the - operator .startof. (section_name), it produces an undefined symbol - .startof.section_name. Similarly, when it sees - .sizeof. (section_name), it produces an undefined symbol - .sizeof.section_name. For all the output sections, we look for - such symbols, and set them to the correct value. */ - -static void -lang_set_startof () -{ - asection *s; - - if (link_info.relocateable) - return; - - for (s = output_bfd->sections; s != NULL; s = s->next) - { - const char *secname; - char *buf; - struct bfd_link_hash_entry *h; - - secname = bfd_get_section_name (output_bfd, s); - buf = xmalloc (10 + strlen (secname)); - - sprintf (buf, ".startof.%s", secname); - h = bfd_link_hash_lookup (link_info.hash, buf, false, false, true); - if (h != NULL && h->type == bfd_link_hash_undefined) - { - h->type = bfd_link_hash_defined; - h->u.def.value = bfd_get_section_vma (output_bfd, s); - h->u.def.section = bfd_abs_section_ptr; - } - - sprintf (buf, ".sizeof.%s", secname); - h = bfd_link_hash_lookup (link_info.hash, buf, false, false, true); - if (h != NULL && h->type == bfd_link_hash_undefined) - { - h->type = bfd_link_hash_defined; - if (s->_cooked_size != 0) - h->u.def.value = s->_cooked_size; - else - h->u.def.value = s->_raw_size; - h->u.def.section = bfd_abs_section_ptr; - } - - free (buf); - } -} - -static void -lang_finish () -{ - struct bfd_link_hash_entry *h; - boolean warn; - - if (link_info.relocateable || link_info.shared) - warn = false; - else - warn = true; - - if (entry_symbol == (char *) NULL) - { - /* No entry has been specified. Look for start, but don't warn - if we don't find it. */ - entry_symbol = "start"; - warn = false; - } - - h = bfd_link_hash_lookup (link_info.hash, entry_symbol, false, false, true); - if (h != (struct bfd_link_hash_entry *) NULL - && (h->type == bfd_link_hash_defined - || h->type == bfd_link_hash_defweak) - && h->u.def.section->output_section != NULL) - { - bfd_vma val; - - val = (h->u.def.value - + bfd_get_section_vma (output_bfd, - h->u.def.section->output_section) - + h->u.def.section->output_offset); - if (! bfd_set_start_address (output_bfd, val)) - einfo ("%P%F:%s: can't set start address\n", entry_symbol); - } - else - { - asection *ts; - - /* Can't find the entry symbol. Use the first address in the - text section. */ - ts = bfd_get_section_by_name (output_bfd, ".text"); - if (ts != (asection *) NULL) - { - if (warn) - einfo ("%P: warning: cannot find entry symbol %s; defaulting to %V\n", - entry_symbol, bfd_get_section_vma (output_bfd, ts)); - if (! bfd_set_start_address (output_bfd, - bfd_get_section_vma (output_bfd, ts))) - einfo ("%P%F: can't set start address\n"); - } - else - { - if (warn) - einfo ("%P: warning: cannot find entry symbol %s; not setting start address\n", - entry_symbol); - } - } -} - -/* This is a small function used when we want to ignore errors from - BFD. */ - -static void -#ifdef ANSI_PROTOTYPES -ignore_bfd_errors (const char *s, ...) -#else -ignore_bfd_errors (s) - const char *s; -#endif -{ - /* Don't do anything. */ -} - -/* Check that the architecture of all the input files is compatible - with the output file. Also call the backend to let it do any - other checking that is needed. */ - -static void -lang_check () -{ - lang_statement_union_type *file; - bfd *input_bfd; - CONST bfd_arch_info_type *compatible; - - for (file = file_chain.head; - file != (lang_statement_union_type *) NULL; - file = file->input_statement.next) - { - input_bfd = file->input_statement.the_bfd; - compatible = bfd_arch_get_compatible (input_bfd, - output_bfd); - if (compatible == NULL) - { - if (command_line.warn_mismatch) - einfo ("%P: warning: %s architecture of input file `%B' is incompatible with %s output\n", - bfd_printable_name (input_bfd), input_bfd, - bfd_printable_name (output_bfd)); - } - else - { - bfd_error_handler_type pfn = NULL; - - /* If we aren't supposed to warn about mismatched input - files, temporarily set the BFD error handler to a - function which will do nothing. We still want to call - bfd_merge_private_bfd_data, since it may set up - information which is needed in the output file. */ - if (! command_line.warn_mismatch) - pfn = bfd_set_error_handler (ignore_bfd_errors); - if (! bfd_merge_private_bfd_data (input_bfd, output_bfd)) - { - if (command_line.warn_mismatch) - einfo ("%E%X: failed to merge target specific data of file %B\n", - input_bfd); - } - if (! command_line.warn_mismatch) - bfd_set_error_handler (pfn); - } - } -} - -/* Look through all the global common symbols and attach them to the - correct section. The -sort-common command line switch may be used - to roughly sort the entries by size. */ - -static void -lang_common () -{ - if (link_info.relocateable - && ! command_line.force_common_definition) - return; - - if (! config.sort_common) - bfd_link_hash_traverse (link_info.hash, lang_one_common, (PTR) NULL); - else - { - int power; - - for (power = 4; power >= 0; power--) - bfd_link_hash_traverse (link_info.hash, lang_one_common, - (PTR) &power); - } -} - -/* Place one common symbol in the correct section. */ - -static boolean -lang_one_common (h, info) - struct bfd_link_hash_entry *h; - PTR info; -{ - unsigned int power_of_two; - bfd_vma size; - asection *section; - - if (h->type != bfd_link_hash_common) - return true; - - size = h->u.c.size; - power_of_two = h->u.c.p->alignment_power; - - if (config.sort_common - && power_of_two < (unsigned int) *(int *) info) - return true; - - section = h->u.c.p->section; - - /* Increase the size of the section. */ - section->_raw_size = ALIGN_N (section->_raw_size, - (bfd_size_type) (1 << power_of_two)); - - /* Adjust the alignment if necessary. */ - if (power_of_two > section->alignment_power) - section->alignment_power = power_of_two; - - /* Change the symbol from common to defined. */ - h->type = bfd_link_hash_defined; - h->u.def.section = section; - h->u.def.value = section->_raw_size; - - /* Increase the size of the section. */ - section->_raw_size += size; - - /* Make sure the section is allocated in memory, and make sure that - it is no longer a common section. */ - section->flags |= SEC_ALLOC; - section->flags &= ~ SEC_IS_COMMON; - - if (config.map_file != NULL) - { - static boolean header_printed; - int len; - char *name; - char buf[50]; - - if (! header_printed) - { - minfo ("\nAllocating common symbols\n"); - minfo ("Common symbol size file\n\n"); - header_printed = true; - } - - name = demangle (h->root.string); - minfo ("%s", name); - len = strlen (name); - free (name); - - if (len >= 19) - { - print_nl (); - len = 0; - } - while (len < 20) - { - print_space (); - ++len; - } - - minfo ("0x"); - if (size <= 0xffffffff) - sprintf (buf, "%lx", (unsigned long) size); - else - sprintf_vma (buf, size); - minfo ("%s", buf); - len = strlen (buf); - - while (len < 16) - { - print_space (); - ++len; - } - - minfo ("%B\n", section->owner); - } - - return true; -} - -/* -run through the input files and ensure that every input -section has somewhere to go. If one is found without -a destination then create an input request and place it -into the statement tree. -*/ - -static void -lang_place_orphans () -{ - lang_input_statement_type *file; - - for (file = (lang_input_statement_type *) file_chain.head; - file != (lang_input_statement_type *) NULL; - file = (lang_input_statement_type *) file->next) - { - asection *s; - - for (s = file->the_bfd->sections; - s != (asection *) NULL; - s = s->next) - { - if (s->output_section == (asection *) NULL) - { - /* This section of the file is not attatched, root - around for a sensible place for it to go */ - - if (file->just_syms_flag) - { - /* We are only retrieving symbol values from this - file. We want the symbols to act as though the - values in the file are absolute. */ - s->output_section = bfd_abs_section_ptr; - s->output_offset = s->vma; - } - else if (strcmp (s->name, "COMMON") == 0) - { - /* This is a lonely common section which must have - come from an archive. We attach to the section - with the wildcard. */ - if (! link_info.relocateable - || command_line.force_common_definition) - { - if (default_common_section == NULL) - { -#if 0 - /* This message happens when using the - svr3.ifile linker script, so I have - disabled it. */ - info_msg ("%P: no [COMMON] command, defaulting to .bss\n"); -#endif - default_common_section = - lang_output_section_statement_lookup (".bss"); - - } - wild_doit (&default_common_section->children, s, - default_common_section, file); - } - } - else if (ldemul_place_orphan (file, s)) - ; - else - { - lang_output_section_statement_type *os = - lang_output_section_statement_lookup (s->name); - - wild_doit (&os->children, s, os, file); - } - } - } - } -} - - -void -lang_set_flags (ptr, flags) - lang_memory_region_type *ptr; - CONST char *flags; -{ - flagword *ptr_flags = &ptr->flags; - - ptr->flags = ptr->not_flags = 0; - while (*flags) - { - switch (*flags) - { - case '!': - ptr_flags = (ptr_flags == &ptr->flags) ? &ptr->not_flags : &ptr->flags; - break; - - case 'A': case 'a': - *ptr_flags |= SEC_ALLOC; - break; - - case 'R': case 'r': - *ptr_flags |= SEC_READONLY; - break; - - case 'W': case 'w': - *ptr_flags |= SEC_DATA; - break; - - case 'X': case 'x': - *ptr_flags |= SEC_CODE; - break; - - case 'L': case 'l': - case 'I': case 'i': - *ptr_flags |= SEC_LOAD; - break; - - default: - einfo ("%P%F: invalid syntax in flags\n"); - break; - } - flags++; - } -} - -/* Call a function on each input file. This function will be called - on an archive, but not on the elements. */ - -void -lang_for_each_input_file (func) - void (*func) PARAMS ((lang_input_statement_type *)); -{ - lang_input_statement_type *f; - - for (f = (lang_input_statement_type *) input_file_chain.head; - f != NULL; - f = (lang_input_statement_type *) f->next_real_file) - func (f); -} - -/* Call a function on each file. The function will be called on all - the elements of an archive which are included in the link, but will - not be called on the archive file itself. */ - -void -lang_for_each_file (func) - void (*func) PARAMS ((lang_input_statement_type *)); -{ - lang_input_statement_type *f; - - for (f = (lang_input_statement_type *) file_chain.head; - f != (lang_input_statement_type *) NULL; - f = (lang_input_statement_type *) f->next) - { - func (f); - } -} - -#if 0 - -/* Not used. */ - -void -lang_for_each_input_section (func) - void (*func) PARAMS ((bfd * ab, asection * as)); -{ - lang_input_statement_type *f; - - for (f = (lang_input_statement_type *) file_chain.head; - f != (lang_input_statement_type *) NULL; - f = (lang_input_statement_type *) f->next) - { - asection *s; - - for (s = f->the_bfd->sections; - s != (asection *) NULL; - s = s->next) - { - func (f->the_bfd, s); - } - } -} - -#endif - -void -ldlang_add_file (entry) - lang_input_statement_type * entry; -{ - bfd **pp; - - lang_statement_append (&file_chain, - (lang_statement_union_type *) entry, - &entry->next); - - /* The BFD linker needs to have a list of all input BFDs involved in - a link. */ - ASSERT (entry->the_bfd->link_next == (bfd *) NULL); - ASSERT (entry->the_bfd != output_bfd); - for (pp = &link_info.input_bfds; - *pp != (bfd *) NULL; - pp = &(*pp)->link_next) - ; - *pp = entry->the_bfd; - entry->the_bfd->usrdata = (PTR) entry; - bfd_set_gp_size (entry->the_bfd, g_switch_value); - - /* Look through the sections and check for any which should not be - included in the link. We need to do this now, so that we can - notice when the backend linker tries to report multiple - definition errors for symbols which are in sections we aren't - going to link. FIXME: It might be better to entirely ignore - symbols which are defined in sections which are going to be - discarded. This would require modifying the backend linker for - each backend which might set the SEC_LINK_ONCE flag. If we do - this, we should probably handle SEC_EXCLUDE in the same way. */ - - bfd_map_over_sections (entry->the_bfd, section_already_linked, (PTR) entry); -} - -void -lang_add_output (name, from_script) - CONST char *name; - int from_script; -{ - /* Make -o on command line override OUTPUT in script. */ - if (had_output_filename == false || !from_script) - { - output_filename = name; - had_output_filename = true; - } -} - - -static lang_output_section_statement_type *current_section; - -static int -topower (x) - int x; -{ - unsigned int i = 1; - int l; - - if (x < 0) - return -1; - - for (l = 0; l < 32; l++) - { - if (i >= (unsigned int) x) - return l; - i <<= 1; - } - - return 0; -} - -void -lang_enter_output_section_statement (output_section_statement_name, - address_exp, sectype, block_value, - align, subalign, ebase) - const char *output_section_statement_name; - etree_type * address_exp; - enum section_type sectype; - bfd_vma block_value; - etree_type *align; - etree_type *subalign; - etree_type *ebase; -{ - lang_output_section_statement_type *os; - - current_section = - os = - lang_output_section_statement_lookup (output_section_statement_name); - - - - /* Add this statement to tree */ - /* add_statement(lang_output_section_statement_enum, - output_section_statement);*/ - /* Make next things chain into subchain of this */ - - if (os->addr_tree == - (etree_type *) NULL) - { - os->addr_tree = - address_exp; - } - os->sectype = sectype; - if (sectype != noload_section) - os->flags = SEC_NO_FLAGS; - else - os->flags = SEC_NEVER_LOAD; - os->block_value = block_value ? block_value : 1; - stat_ptr = &os->children; - - os->subsection_alignment = topower( - exp_get_value_int(subalign, -1, - "subsection alignment", - 0)); - os->section_alignment = topower( - exp_get_value_int(align, -1, - "section alignment", 0)); - - os->load_base = ebase; -} - - -void -lang_final () -{ - lang_output_statement_type *new = - new_stat (lang_output_statement, stat_ptr); - - new->name = output_filename; -} - -/* Reset the current counters in the regions */ -static void -reset_memory_regions () -{ - lang_memory_region_type *p = lang_memory_region_list; - - for (p = lang_memory_region_list; - p != (lang_memory_region_type *) NULL; - p = p->next) - { - p->old_length = (bfd_size_type) (p->current - p->origin); - p->current = p->origin; - } -} - -void -lang_process () -{ - lang_reasonable_defaults (); - current_target = default_target; - - lang_for_each_statement (ldlang_open_output); /* Open the output file */ - - ldemul_create_output_section_statements (); - - /* Add to the hash table all undefineds on the command line */ - lang_place_undefineds (); - - /* Create a bfd for each input file */ - current_target = default_target; - open_input_bfds (statement_list.head, false); - - ldemul_after_open (); - - /* Make sure that we're not mixing architectures. We call this - after all the input files have been opened, but before we do any - other processing, so that any operations merge_private_bfd_data - does on the output file will be known during the rest of the - link. */ - lang_check (); - - /* Build all sets based on the information gathered from the input - files. */ - ldctor_build_sets (); - - /* Size up the common data */ - lang_common (); - - /* Run through the contours of the script and attach input sections - to the correct output sections - */ - map_input_to_output_sections (statement_list.head, (char *) NULL, - (lang_output_section_statement_type *) NULL); - - - /* Find any sections not attached explicitly and handle them */ - lang_place_orphans (); - - ldemul_before_allocation (); - - /* We must record the program headers before we try to fix the - section positions, since they will affect SIZEOF_HEADERS. */ - lang_record_phdrs (); - - /* Now run around and relax if we can */ - if (command_line.relax) - { - /* First time round is a trial run to get the 'worst case' - addresses of the objects if there was no relaxing. */ - lang_size_sections (statement_list.head, - abs_output_section, - &(statement_list.head), 0, (bfd_vma) 0, false); - - /* Keep relaxing until bfd_relax_section gives up. */ - do - { - reset_memory_regions (); - - relax_again = false; - - /* Do all the assignments with our current guesses as to - section sizes. */ - lang_do_assignments (statement_list.head, - abs_output_section, - (fill_type) 0, (bfd_vma) 0); - - /* Perform another relax pass - this time we know where the - globals are, so can make better guess. */ - lang_size_sections (statement_list.head, - abs_output_section, - &(statement_list.head), 0, (bfd_vma) 0, true); - } - while (relax_again); - } - else - { - /* Size up the sections. */ - lang_size_sections (statement_list.head, - abs_output_section, - &(statement_list.head), 0, (bfd_vma) 0, false); - } - - /* See if anything special should be done now we know how big - everything is. */ - ldemul_after_allocation (); - - /* Fix any .startof. or .sizeof. symbols. */ - lang_set_startof (); - - /* Do all the assignments, now that we know the final restingplaces - of all the symbols */ - - lang_do_assignments (statement_list.head, - abs_output_section, - (fill_type) 0, (bfd_vma) 0); - - /* Final stuffs */ - - ldemul_finish (); - lang_finish (); -} - -/* EXPORTED TO YACC */ - -void -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); - - if (section_name != (char *) NULL && strcmp (section_name, "COMMON") == 0) - { - placed_commons = true; - } - if (filename != (char *) NULL) - { - lang_has_input_file = true; - } - new->section_name = section_name; - new->filename = filename; - lang_list_init (&new->children); -} - -void -lang_section_start (name, address) - CONST char *name; - etree_type * address; -{ - lang_address_statement_type *ad = new_stat (lang_address_statement, stat_ptr); - - ad->section_name = name; - ad->address = address; -} - -/* Set the start symbol to NAME. CMDLINE is nonzero if this is called - because of a -e argument on the command line, or zero if this is - called by ENTRY in a linker script. Command line arguments take - precedence. */ - -/* WINDOWS_NT. When an entry point has been specified, we will also force - this symbol to be defined by calling ldlang_add_undef (equivalent to - having switch -u entry_name on the command line). The reason we do - this is so that the user doesn't have to because they would have to use - the -u switch if they were specifying an entry point other than - _mainCRTStartup. Specifically, if creating a windows application, entry - point _WinMainCRTStartup must be specified. - What I have found for non console applications (entry not _mainCRTStartup) - is that the .obj that contains mainCRTStartup is brought in since it is - the first encountered in libc.lib and it has other symbols in it which will - be pulled in by the link process. To avoid this, adding -u with the entry - point name specified forces the correct .obj to be used. We can avoid - making the user do this by always adding the entry point name as an - undefined symbol. */ - -void -lang_add_entry (name, cmdline) - CONST char *name; - boolean cmdline; -{ - if (entry_symbol == NULL - || cmdline - || ! entry_from_cmdline) - { - entry_symbol = name; - entry_from_cmdline = cmdline; - } -#if 0 - /* don't do this yet. It seems to work (the executables run), but the - image created is very different from what I was getting before indicating - that something else is being pulled in. When everything else is working, - then try to put this back in to see if it will do the right thing for - other more complicated applications */ - ldlang_add_undef (name); -#endif -} - -void -lang_add_target (name) - CONST char *name; -{ - lang_target_statement_type *new = new_stat (lang_target_statement, - stat_ptr); - - new->target = name; - -} - -void -lang_add_map (name) - CONST char *name; -{ - while (*name) - { - switch (*name) - { - case 'F': - map_option_f = true; - break; - } - name++; - } -} - -void -lang_add_fill (exp) - int exp; -{ - lang_fill_statement_type *new = new_stat (lang_fill_statement, - stat_ptr); - - new->fill = exp; -} - -void -lang_add_data (type, exp) - int type; - union etree_union *exp; -{ - - lang_data_statement_type *new = new_stat (lang_data_statement, - stat_ptr); - - new->exp = exp; - new->type = type; - -} - -/* Create a new reloc statement. RELOC is the BFD relocation type to - generate. HOWTO is the corresponding howto structure (we could - look this up, but the caller has already done so). SECTION is the - section to generate a reloc against, or NAME is the name of the - symbol to generate a reloc against. Exactly one of SECTION and - NAME must be NULL. ADDEND is an expression for the addend. */ - -void -lang_add_reloc (reloc, howto, section, name, addend) - bfd_reloc_code_real_type reloc; - reloc_howto_type *howto; - asection *section; - const char *name; - union etree_union *addend; -{ - lang_reloc_statement_type *p = new_stat (lang_reloc_statement, stat_ptr); - - p->reloc = reloc; - p->howto = howto; - p->section = section; - p->name = name; - p->addend_exp = addend; - - p->addend_value = 0; - p->output_section = NULL; - p->output_vma = 0; -} - -void -lang_add_assignment (exp) - etree_type * exp; -{ - lang_assignment_statement_type *new = new_stat (lang_assignment_statement, - stat_ptr); - - new->exp = exp; -} - -void -lang_add_attribute (attribute) - enum statement_enum attribute; -{ - new_statement (attribute, sizeof (lang_statement_union_type), stat_ptr); -} - -void -lang_startup (name) - CONST char *name; -{ - if (startup_file != (char *) NULL) - { - einfo ("%P%Fmultiple STARTUP files\n"); - } - first_file->filename = name; - first_file->local_sym_name = name; - first_file->real = true; - - startup_file = name; -} - -void -lang_float (maybe) - boolean maybe; -{ - lang_float_flag = maybe; -} - -void -lang_leave_output_section_statement (fill, memspec, phdrs) - bfd_vma fill; - const char *memspec; - struct lang_output_section_phdr_list *phdrs; -{ - current_section->fill = fill; - current_section->region = lang_memory_region_lookup (memspec); - current_section->phdrs = phdrs; - stat_ptr = &statement_list; -} - -/* - Create an absolute symbol with the given name with the value of the - address of first byte of the section named. - - If the symbol already exists, then do nothing. -*/ -void -lang_abs_symbol_at_beginning_of (secname, name) - const char *secname; - const char *name; -{ - struct bfd_link_hash_entry *h; - - h = bfd_link_hash_lookup (link_info.hash, name, true, true, true); - if (h == (struct bfd_link_hash_entry *) NULL) - einfo ("%P%F: bfd_link_hash_lookup failed: %E\n"); - - if (h->type == bfd_link_hash_new - || h->type == bfd_link_hash_undefined) - { - asection *sec; - - h->type = bfd_link_hash_defined; - - sec = bfd_get_section_by_name (output_bfd, secname); - if (sec == (asection *) NULL) - h->u.def.value = 0; - else - h->u.def.value = bfd_get_section_vma (output_bfd, sec); - - h->u.def.section = bfd_abs_section_ptr; - } -} - -/* - Create an absolute symbol with the given name with the value of the - address of the first byte after the end of the section named. - - If the symbol already exists, then do nothing. -*/ -void -lang_abs_symbol_at_end_of (secname, name) - const char *secname; - const char *name; -{ - struct bfd_link_hash_entry *h; - - h = bfd_link_hash_lookup (link_info.hash, name, true, true, true); - if (h == (struct bfd_link_hash_entry *) NULL) - einfo ("%P%F: bfd_link_hash_lookup failed: %E\n"); - - if (h->type == bfd_link_hash_new - || h->type == bfd_link_hash_undefined) - { - asection *sec; - - h->type = bfd_link_hash_defined; - - sec = bfd_get_section_by_name (output_bfd, secname); - if (sec == (asection *) NULL) - h->u.def.value = 0; - else - h->u.def.value = (bfd_get_section_vma (output_bfd, sec) - + bfd_section_size (output_bfd, sec)); - - h->u.def.section = bfd_abs_section_ptr; - } -} - -void -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. -oformat overrides scripts. */ - -void -lang_add_output_format (format, big, little, from_script) - const char *format; - const char *big; - const char *little; - int from_script; -{ - if (output_target == NULL || !from_script) - { - if (command_line.endian == ENDIAN_BIG - && big != NULL) - format = big; - else if (command_line.endian == ENDIAN_LITTLE - && little != NULL) - format = little; - - output_target = format; - } -} - -/* Enter a group. This creates a new lang_group_statement, and sets - stat_ptr to build new statements within the group. */ - -void -lang_enter_group () -{ - lang_group_statement_type *g; - - g = new_stat (lang_group_statement, stat_ptr); - lang_list_init (&g->children); - stat_ptr = &g->children; -} - -/* Leave a group. This just resets stat_ptr to start writing to the - regular list of statements again. Note that this will not work if - groups can occur inside anything else which can adjust stat_ptr, - but currently they can't. */ - -void -lang_leave_group () -{ - stat_ptr = &statement_list; -} - -/* Add a new program header. This is called for each entry in a PHDRS - command in a linker script. */ - -void -lang_new_phdr (name, type, filehdr, phdrs, at, flags) - const char *name; - etree_type *type; - boolean filehdr; - boolean phdrs; - etree_type *at; - etree_type *flags; -{ - struct lang_phdr *n, **pp; - - n = (struct lang_phdr *) stat_alloc (sizeof (struct lang_phdr)); - n->next = NULL; - n->name = name; - n->type = exp_get_value_int (type, 0, "program header type", - lang_final_phase_enum); - n->filehdr = filehdr; - n->phdrs = phdrs; - n->at = at; - n->flags = flags; - - for (pp = &lang_phdr_list; *pp != NULL; pp = &(*pp)->next) - ; - *pp = n; -} - -/* Record the program header information in the output BFD. FIXME: We - should not be calling an ELF specific function here. */ - -static void -lang_record_phdrs () -{ - unsigned int alc; - asection **secs; - struct lang_output_section_phdr_list *last; - struct lang_phdr *l; - lang_statement_union_type *u; - - alc = 10; - secs = (asection **) xmalloc (alc * sizeof (asection *)); - last = NULL; - for (l = lang_phdr_list; l != NULL; l = l->next) - { - unsigned int c; - flagword flags; - bfd_vma at; - - c = 0; - for (u = lang_output_section_statement.head; - u != NULL; - u = u->output_section_statement.next) - { - lang_output_section_statement_type *os; - struct lang_output_section_phdr_list *pl; - - os = &u->output_section_statement; - - pl = os->phdrs; - if (pl != NULL) - last = pl; - else - { - if (os->sectype == noload_section - || os->bfd_section == NULL - || (os->bfd_section->flags & SEC_ALLOC) == 0) - continue; - pl = last; - } - - if (os->bfd_section == NULL) - continue; - - for (; pl != NULL; pl = pl->next) - { - if (strcmp (pl->name, l->name) == 0) - { - if (c >= alc) - { - alc *= 2; - secs = ((asection **) - xrealloc (secs, alc * sizeof (asection *))); - } - secs[c] = os->bfd_section; - ++c; - pl->used = true; - } - } - } - - if (l->flags == NULL) - flags = 0; - else - flags = exp_get_vma (l->flags, 0, "phdr flags", - lang_final_phase_enum); - - if (l->at == NULL) - at = 0; - else - at = exp_get_vma (l->at, 0, "phdr load address", - lang_final_phase_enum); - - if (! bfd_record_phdr (output_bfd, l->type, - l->flags == NULL ? false : true, - flags, - l->at == NULL ? false : true, - at, l->filehdr, l->phdrs, c, secs)) - einfo ("%F%P: bfd_record_phdr failed: %E\n"); - } - - free (secs); - - /* Make sure all the phdr assignments succeeded. */ - for (u = lang_output_section_statement.head; - u != NULL; - u = u->output_section_statement.next) - { - struct lang_output_section_phdr_list *pl; - - if (u->output_section_statement.bfd_section == NULL) - continue; - - for (pl = u->output_section_statement.phdrs; - pl != NULL; - pl = pl->next) - if (! pl->used && strcmp (pl->name, "NONE") != 0) - einfo ("%X%P: section `%s' assigned to non-existent phdr `%s'\n", - u->output_section_statement.name, pl->name); - } -} - -/* Record a list of sections which may not be cross referenced. */ - -void -lang_add_nocrossref (l) - struct lang_nocrossref *l; -{ - struct lang_nocrossrefs *n; - - n = (struct lang_nocrossrefs *) xmalloc (sizeof *n); - n->next = nocrossref_list; - n->list = l; - nocrossref_list = n; - - /* Set notice_all so that we get informed about all symbols. */ - link_info.notice_all = true; -} - -/* Overlay handling. We handle overlays with some static variables. */ - -/* The overlay virtual address. */ -static etree_type *overlay_vma; - -/* The overlay load address. */ -static etree_type *overlay_lma; - -/* Whether nocrossrefs is set for this overlay. */ -static int overlay_nocrossrefs; - -/* An expression for the maximum section size seen so far. */ -static etree_type *overlay_max; - -/* A list of all the sections in this overlay. */ - -struct overlay_list -{ - struct overlay_list *next; - lang_output_section_statement_type *os; -}; - -static struct overlay_list *overlay_list; - -/* Start handling an overlay. */ - -void -lang_enter_overlay (vma_expr, lma_expr, nocrossrefs) - etree_type *vma_expr; - etree_type *lma_expr; - int nocrossrefs; -{ - /* The grammar should prevent nested overlays from occurring. */ - ASSERT (overlay_vma == NULL - && overlay_lma == NULL - && overlay_list == NULL - && overlay_max == NULL); - - overlay_vma = vma_expr; - overlay_lma = lma_expr; - overlay_nocrossrefs = nocrossrefs; -} - -/* Start a section in an overlay. We handle this by calling - lang_enter_output_section_statement with the correct VMA and LMA. */ - -void -lang_enter_overlay_section (name) - const char *name; -{ - struct overlay_list *n; - etree_type *size; - - lang_enter_output_section_statement (name, overlay_vma, normal_section, - 0, 0, 0, overlay_lma); - - /* If this is the first section, then base the VMA and LMA of future - sections on this one. This will work correctly even if `.' is - used in the addresses. */ - if (overlay_list == NULL) - { - overlay_vma = exp_nameop (ADDR, name); - overlay_lma = exp_nameop (LOADADDR, name); - } - - /* Remember the section. */ - n = (struct overlay_list *) xmalloc (sizeof *n); - n->os = current_section; - n->next = overlay_list; - overlay_list = n; - - size = exp_nameop (SIZEOF, name); - - /* Adjust the LMA for the next section. */ - overlay_lma = exp_binop ('+', overlay_lma, size); - - /* Arrange to work out the maximum section end address. */ - if (overlay_max == NULL) - overlay_max = size; - else - overlay_max = exp_binop (MAX, overlay_max, size); -} - -/* Finish a section in an overlay. There isn't any special to do - here. */ - -void -lang_leave_overlay_section (fill, phdrs) - bfd_vma fill; - struct lang_output_section_phdr_list *phdrs; -{ - const char *name; - char *clean, *s2; - const char *s1; - char *buf; - - name = current_section->name; - - lang_leave_output_section_statement (fill, "*default*", phdrs); - - /* Define the magic symbols. */ - - clean = xmalloc (strlen (name) + 1); - s2 = clean; - for (s1 = name; *s1 != '\0'; s1++) - if (isalnum ((unsigned char) *s1) || *s1 == '_') - *s2++ = *s1; - *s2 = '\0'; - - buf = xmalloc (strlen (clean) + sizeof "__load_start_"); - sprintf (buf, "__load_start_%s", clean); - lang_add_assignment (exp_assop ('=', buf, - exp_nameop (LOADADDR, name))); - - buf = xmalloc (strlen (clean) + sizeof "__load_stop_"); - sprintf (buf, "__load_stop_%s", clean); - lang_add_assignment (exp_assop ('=', buf, - exp_binop ('+', - exp_nameop (LOADADDR, name), - exp_nameop (SIZEOF, name)))); - - free (clean); -} - -/* Finish an overlay. If there are any overlay wide settings, this - looks through all the sections in the overlay and sets them. */ - -void -lang_leave_overlay (fill, memspec, phdrs) - bfd_vma fill; - const char *memspec; - struct lang_output_section_phdr_list *phdrs; -{ - lang_memory_region_type *region; - struct overlay_list *l; - struct lang_nocrossref *nocrossref; - - if (memspec == NULL) - region = NULL; - else - region = lang_memory_region_lookup (memspec); - - nocrossref = NULL; - - l = overlay_list; - while (l != NULL) - { - struct overlay_list *next; - - if (fill != 0 && l->os->fill == 0) - l->os->fill = fill; - if (region != NULL && l->os->region == NULL) - l->os->region = region; - if (phdrs != NULL && l->os->phdrs == NULL) - l->os->phdrs = phdrs; - - if (overlay_nocrossrefs) - { - struct lang_nocrossref *nc; - - nc = (struct lang_nocrossref *) xmalloc (sizeof *nc); - nc->name = l->os->name; - nc->next = nocrossref; - nocrossref = nc; - } - - next = l->next; - free (l); - l = next; - } - - if (nocrossref != NULL) - lang_add_nocrossref (nocrossref); - - /* Update . for the end of the overlay. */ - lang_add_assignment (exp_assop ('=', ".", - exp_binop ('+', overlay_vma, overlay_max))); - - overlay_vma = NULL; - overlay_lma = NULL; - overlay_nocrossrefs = 0; - overlay_list = NULL; - overlay_max = NULL; -} - -/* Version handling. This is only useful for ELF. */ - -/* This global variable holds the version tree that we build. */ - -struct bfd_elf_version_tree *lang_elf_version_info; - -/* This is called for each variable name or match expression. */ - -struct bfd_elf_version_expr * -lang_new_vers_regex (orig, new) - struct bfd_elf_version_expr *orig; - const char *new; -{ - struct bfd_elf_version_expr *ret; - - ret = (struct bfd_elf_version_expr *) xmalloc (sizeof *ret); - ret->next = orig; - ret->match = new; - return ret; -} - -/* This is called for each set of variable names and match - expressions. */ - -struct bfd_elf_version_tree * -lang_new_vers_node (globals, locals) - struct bfd_elf_version_expr *globals; - struct bfd_elf_version_expr *locals; -{ - struct bfd_elf_version_tree *ret; - - ret = (struct bfd_elf_version_tree *) xmalloc (sizeof *ret); - ret->next = NULL; - ret->name = NULL; - ret->vernum = 0; - ret->globals = globals; - ret->locals = locals; - ret->deps = NULL; - ret->name_indx = (unsigned int) -1; - ret->used = 0; - return ret; -} - -/* This static variable keeps track of version indices. */ - -static int version_index; - -/* This is called when we know the name and dependencies of the - version. */ - -void -lang_register_vers_node (name, version, deps) - const char *name; - struct bfd_elf_version_tree *version; - struct bfd_elf_version_deps *deps; -{ - struct bfd_elf_version_tree *t, **pp; - struct bfd_elf_version_expr *e1; - - /* Make sure this node has a unique name. */ - for (t = lang_elf_version_info; t != NULL; t = t->next) - if (strcmp (t->name, name) == 0) - einfo ("%X%P: duplicate version tag `%s'\n", name); - - /* Check the global and local match names, and make sure there - aren't any duplicates. */ - - for (e1 = version->globals; e1 != NULL; e1 = e1->next) - { - for (t = lang_elf_version_info; t != NULL; t = t->next) - { - struct bfd_elf_version_expr *e2; - - for (e2 = t->locals; e2 != NULL; e2 = e2->next) - if (strcmp (e1->match, e2->match) == 0) - einfo ("%X%P: duplicate expression `%s' in version information\n", - e1->match); - } - } - - for (e1 = version->locals; e1 != NULL; e1 = e1->next) - { - for (t = lang_elf_version_info; t != NULL; t = t->next) - { - struct bfd_elf_version_expr *e2; - - for (e2 = t->globals; e2 != NULL; e2 = e2->next) - if (strcmp (e1->match, e2->match) == 0) - einfo ("%X%P: duplicate expression `%s' in version information\n", - e1->match); - } - } - - version->deps = deps; - version->name = name; - ++version_index; - version->vernum = version_index; - - for (pp = &lang_elf_version_info; *pp != NULL; pp = &(*pp)->next) - ; - *pp = version; -} - -/* This is called when we see a version dependency. */ - -struct bfd_elf_version_deps * -lang_add_vers_depend (list, name) - struct bfd_elf_version_deps *list; - const char *name; -{ - struct bfd_elf_version_deps *ret; - struct bfd_elf_version_tree *t; - - ret = (struct bfd_elf_version_deps *) xmalloc (sizeof *ret); - ret->next = list; - - for (t = lang_elf_version_info; t != NULL; t = t->next) - { - if (strcmp (t->name, name) == 0) - { - ret->version_needed = t; - return ret; - } - } - - einfo ("%X%P: unable to find version dependency `%s'\n", name); - - return ret; -} diff --git a/gnu/dist/ld/ldlang.h b/gnu/dist/ld/ldlang.h deleted file mode 100644 index 60edc0f3209d..000000000000 --- a/gnu/dist/ld/ldlang.h +++ /dev/null @@ -1,485 +0,0 @@ -/* ldlang.h - linker command language support - Copyright 1991, 92, 93, 94, 95, 96, 1997 Free Software Foundation, Inc. - - This file is part of GLD, the Gnu Linker. - - GLD 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 1, or (at your option) - any later version. - - GLD 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 GLD; see the file COPYING. If not, write to the Free - Software Foundation, 59 Temple Place - Suite 330, Boston, MA - 02111-1307, USA. */ - -#ifndef LDLANG_H -#define LDLANG_H - -typedef enum -{ - lang_input_file_is_l_enum, - lang_input_file_is_symbols_only_enum, - lang_input_file_is_marker_enum, - lang_input_file_is_fake_enum, - lang_input_file_is_search_file_enum, - lang_input_file_is_file_enum -} lang_input_file_enum_type; - -typedef unsigned int fill_type; -typedef struct statement_list -{ - union lang_statement_union *head; - union lang_statement_union **tail; -} lang_statement_list_type; - - -typedef struct memory_region_struct -{ - char *name; - struct memory_region_struct *next; - bfd_vma origin; - bfd_size_type length; - bfd_vma current; - bfd_size_type old_length; - flagword flags; - flagword not_flags; - boolean had_full_message; -} lang_memory_region_type ; - -typedef struct lang_statement_header_struct -{ - union lang_statement_union *next; - enum statement_enum - { - lang_output_section_statement_enum, - lang_assignment_statement_enum, - lang_input_statement_enum, - lang_address_statement_enum, - lang_wild_statement_enum, - lang_input_section_enum, - lang_object_symbols_statement_enum, - lang_fill_statement_enum, - lang_data_statement_enum, - lang_reloc_statement_enum, - lang_target_statement_enum, - lang_output_statement_enum, - lang_padding_statement_enum, - lang_group_statement_enum, - - lang_afile_asection_pair_statement_enum, - lang_constructors_statement_enum - } type; -} lang_statement_header_type; - - -typedef struct -{ - lang_statement_header_type header; - union etree_union *exp; -} lang_assignment_statement_type; - - -typedef struct lang_target_statement_struct -{ - lang_statement_header_type header; - const char *target; -} lang_target_statement_type; - - -typedef struct lang_output_statement_struct -{ - lang_statement_header_type header; - const char *name; -} lang_output_statement_type; - -/* Section types specified in a linker script. */ - -enum section_type -{ - normal_section, - dsect_section, - copy_section, - noload_section, - info_section, - overlay_section -}; - -/* This structure holds a list of program headers describing segments - in which this section should be placed. */ - -struct lang_output_section_phdr_list -{ - struct lang_output_section_phdr_list *next; - const char *name; - boolean used; -}; - -typedef struct lang_output_section_statement_struct -{ - lang_statement_header_type header; - union etree_union *addr_tree; - lang_statement_list_type children; - const char *memspec; - union lang_statement_union *next; - const char *name; - - boolean processed; - - asection *bfd_section; - flagword flags; /* Or together of all input sections */ - enum section_type sectype; - struct memory_region_struct *region; - size_t block_value; - fill_type fill; - - int subsection_alignment; /* alignment of components */ - int section_alignment; /* alignment of start of section */ - - union etree_union *load_base; - - struct lang_output_section_phdr_list *phdrs; -} lang_output_section_statement_type; - - -typedef struct -{ - lang_statement_header_type header; -} lang_common_statement_type; - -typedef struct -{ - lang_statement_header_type header; -} lang_object_symbols_statement_type; - -typedef struct -{ - lang_statement_header_type header; - fill_type fill; - int size; - asection *output_section; -} lang_fill_statement_type; - -typedef struct -{ - lang_statement_header_type header; - unsigned int type; - union etree_union *exp; - bfd_vma value; - asection *output_section; - bfd_vma output_vma; -} lang_data_statement_type; - -/* Generate a reloc in the output file. */ - -typedef struct -{ - lang_statement_header_type header; - - /* Reloc to generate. */ - bfd_reloc_code_real_type reloc; - - /* Reloc howto structure. */ - reloc_howto_type *howto; - - /* Section to generate reloc against. Exactly one of section and - name must be NULL. */ - asection *section; - - /* Name of symbol to generate reloc against. Exactly one of section - and name must be NULL. */ - const char *name; - - /* Expression for addend. */ - union etree_union *addend_exp; - - /* Resolved addend. */ - bfd_vma addend_value; - - /* Output section where reloc should be performed. */ - asection *output_section; - - /* VMA within output section. */ - bfd_vma output_vma; -} lang_reloc_statement_type; - -typedef struct lang_input_statement_struct -{ - lang_statement_header_type header; - /* Name of this file. */ - const char *filename; - /* Name to use for the symbol giving address of text start */ - /* Usually the same as filename, but for a file spec'd with -l - this is the -l switch itself rather than the filename. */ - const char *local_sym_name; - - bfd *the_bfd; - - boolean closed; - file_ptr passive_position; - - /* Symbol table of the file. */ - asymbol **asymbols; - unsigned int symbol_count; - - /* Point to the next file - whatever it is, wanders up and down - archives */ - - union lang_statement_union *next; - /* Point to the next file, but skips archive contents */ - union lang_statement_union *next_real_file; - - boolean is_archive; - - /* 1 means search a set of directories for this file. */ - boolean search_dirs_flag; - - /* 1 means this is base file of incremental load. - Do not load this file's text or data. - Also default text_start to after this file's bss. */ - - boolean just_syms_flag; - - /* Whether to search for this entry as a dynamic archive. */ - boolean dynamic; - - /* Whether to include the entire contents of an archive. */ - boolean whole_archive; - - boolean loaded; - - /* unsigned int globals_in_this_file;*/ - const char *target; - boolean real; -} lang_input_statement_type; - -typedef struct -{ - lang_statement_header_type header; - asection *section; - lang_input_statement_type *ifile; - -} lang_input_section_type; - - -typedef struct -{ - lang_statement_header_type header; - asection *section; - union lang_statement_union *file; -} lang_afile_asection_pair_statement_type; - -typedef struct lang_wild_statement_struct -{ - lang_statement_header_type header; - const char *section_name; - const char *filename; - lang_statement_list_type children; -} lang_wild_statement_type; - -typedef struct lang_address_statement_struct -{ - lang_statement_header_type header; - const char *section_name; - union etree_union *address; -} lang_address_statement_type; - -typedef struct -{ - lang_statement_header_type header; - bfd_vma output_offset; - size_t size; - asection *output_section; - fill_type fill; -} lang_padding_statement_type; - -/* A group statement collects a set of libraries together. The - libraries are searched multiple times, until no new undefined - symbols are found. The effect is to search a group of libraries as - though they were a single library. */ - -typedef struct -{ - lang_statement_header_type header; - lang_statement_list_type children; -} lang_group_statement_type; - -typedef union lang_statement_union -{ - lang_statement_header_type header; - union lang_statement_union *next; - lang_wild_statement_type wild_statement; - lang_data_statement_type data_statement; - lang_reloc_statement_type reloc_statement; - lang_address_statement_type address_statement; - lang_output_section_statement_type output_section_statement; - lang_afile_asection_pair_statement_type afile_asection_pair_statement; - lang_assignment_statement_type assignment_statement; - lang_input_statement_type input_statement; - lang_target_statement_type target_statement; - lang_output_statement_type output_statement; - lang_input_section_type input_section; - lang_common_statement_type common_statement; - lang_object_symbols_statement_type object_symbols_statement; - lang_fill_statement_type fill_statement; - lang_padding_statement_type padding_statement; - lang_group_statement_type group_statement; -} lang_statement_union_type; - -/* This structure holds information about a program header, from the - PHDRS command in the linker script. */ - -struct lang_phdr -{ - struct lang_phdr *next; - const char *name; - unsigned long type; - boolean filehdr; - boolean phdrs; - etree_type *at; - etree_type *flags; -}; - -/* This structure is used to hold a list of sections which may not - cross reference each other. */ - -struct lang_nocrossref -{ - struct lang_nocrossref *next; - const char *name; -}; - -/* The list of nocrossref lists. */ - -struct lang_nocrossrefs -{ - struct lang_nocrossrefs *next; - struct lang_nocrossref *list; -}; - -extern struct lang_nocrossrefs *nocrossref_list; - -extern lang_output_section_statement_type *abs_output_section; -extern boolean lang_has_input_file; -extern etree_type *base; -extern lang_statement_list_type *stat_ptr; -extern boolean delete_output_file_on_failure; - -extern const char *entry_symbol; -extern boolean entry_from_cmdline; - -extern void lang_init PARAMS ((void)); -extern struct memory_region_struct *lang_memory_region_lookup - PARAMS ((const char *const)); -extern struct memory_region_struct *lang_memory_region_default - PARAMS ((asection *)); -extern void lang_map PARAMS ((void)); -extern void lang_set_flags PARAMS ((lang_memory_region_type *, const char *)); -extern void lang_add_output PARAMS ((const char *, int from_script)); -extern void lang_enter_output_section_statement - PARAMS ((const char *output_section_statement_name, - etree_type * address_exp, - enum section_type sectype, - bfd_vma block_value, - etree_type *align, - etree_type *subalign, - etree_type *)); -extern void lang_final PARAMS ((void)); -extern void lang_process PARAMS ((void)); -extern void lang_section_start PARAMS ((const char *, union etree_union *)); -extern void lang_add_entry PARAMS ((const char *, boolean)); -extern void lang_add_target PARAMS ((const char *)); -extern void lang_add_wild PARAMS ((const char *const , const char *const)); -extern void lang_add_map PARAMS ((const char *)); -extern void lang_add_fill PARAMS ((int)); -extern void lang_add_assignment PARAMS ((union etree_union *)); -extern void lang_add_attribute PARAMS ((enum statement_enum)); -extern void lang_startup PARAMS ((const char *)); -extern void lang_float PARAMS ((enum bfd_boolean)); -extern void lang_leave_output_section_statement - PARAMS ((bfd_vma, const char *, struct lang_output_section_phdr_list *)); -extern void lang_abs_symbol_at_end_of PARAMS ((const char *, const char *)); -extern void lang_abs_symbol_at_beginning_of PARAMS ((const char *, - const char *)); -extern void lang_statement_append PARAMS ((struct statement_list *, - union lang_statement_union *, - union lang_statement_union **)); -extern void lang_for_each_input_file - PARAMS ((void (*dothis) (lang_input_statement_type *))); -extern void lang_for_each_file - PARAMS ((void (*dothis) (lang_input_statement_type *))); -extern bfd_vma lang_do_assignments - PARAMS ((lang_statement_union_type * s, - lang_output_section_statement_type *output_section_statement, - fill_type fill, - bfd_vma dot)); - -#define LANG_FOR_EACH_INPUT_STATEMENT(statement) \ - extern lang_statement_list_type file_chain; \ - lang_input_statement_type *statement; \ - for (statement = (lang_input_statement_type *)file_chain.head;\ - statement != (lang_input_statement_type *)NULL; \ - statement = (lang_input_statement_type *)statement->next)\ - -extern void lang_process PARAMS ((void)); -extern void ldlang_add_file PARAMS ((lang_input_statement_type *)); -extern lang_output_section_statement_type *lang_output_section_find - PARAMS ((const char * const)); -extern lang_input_statement_type *lang_add_input_file - PARAMS ((const char *name, lang_input_file_enum_type file_type, - const char *target)); -extern void lang_add_keepsyms_file PARAMS ((const char *filename)); -extern lang_output_section_statement_type * - lang_output_section_statement_lookup PARAMS ((const char * const name)); -extern void ldlang_add_undef PARAMS ((const char *const name)); -extern void lang_add_output_format PARAMS ((const char *, const char *, - const char *, int from_script)); -extern void lang_list_init PARAMS ((lang_statement_list_type*)); -extern void lang_add_data PARAMS ((int type, union etree_union *)); -extern void lang_add_reloc - PARAMS ((bfd_reloc_code_real_type reloc, reloc_howto_type *howto, - asection *section, const char *name, union etree_union *addend)); -extern void lang_for_each_statement - PARAMS ((void (*func) (lang_statement_union_type *))); -extern PTR stat_alloc PARAMS ((size_t size)); -extern void dprint_statement PARAMS ((lang_statement_union_type *, int)); -extern bfd_vma lang_size_sections - PARAMS ((lang_statement_union_type *s, - lang_output_section_statement_type *output_section_statement, - lang_statement_union_type **prev, fill_type fill, - bfd_vma dot, boolean relax)); -extern void lang_enter_group PARAMS ((void)); -extern void lang_leave_group PARAMS ((void)); -extern void wild_doit - PARAMS ((lang_statement_list_type *ptr, asection *section, - lang_output_section_statement_type *output, - lang_input_statement_type *file)); -extern void lang_new_phdr - PARAMS ((const char *, etree_type *, boolean, boolean, etree_type *, - etree_type *)); -extern void lang_add_nocrossref PARAMS ((struct lang_nocrossref *)); -extern void lang_enter_overlay PARAMS ((etree_type *, etree_type *, int)); -extern void lang_enter_overlay_section PARAMS ((const char *)); -extern void lang_leave_overlay_section - PARAMS ((bfd_vma, struct lang_output_section_phdr_list *)); -extern void lang_leave_overlay - PARAMS ((bfd_vma, const char *, struct lang_output_section_phdr_list *)); - -extern struct bfd_elf_version_tree *lang_elf_version_info; - -extern struct bfd_elf_version_expr *lang_new_vers_regex - PARAMS ((struct bfd_elf_version_expr *, const char *)); -extern struct bfd_elf_version_tree *lang_new_vers_node - PARAMS ((struct bfd_elf_version_expr *, struct bfd_elf_version_expr *)); -extern struct bfd_elf_version_deps *lang_add_vers_depend - PARAMS ((struct bfd_elf_version_deps *, const char *)); -extern void lang_register_vers_node - PARAMS ((const char *, struct bfd_elf_version_tree *, - struct bfd_elf_version_deps *)); - -#endif diff --git a/gnu/dist/ld/ldlex.h b/gnu/dist/ld/ldlex.h deleted file mode 100644 index 53444cacad78..000000000000 --- a/gnu/dist/ld/ldlex.h +++ /dev/null @@ -1,62 +0,0 @@ -/* ldlex.h - - Copyright 1991, 92, 93, 94, 95, 1997 Free Software Foundation, Inc. - - This file is part of GLD, the Gnu Linker. - - GLD 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 1, or (at your option) - any later version. - - GLD 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 GLD; see the file COPYING. If not, write to the Free - Software Foundation, 59 Temple Place - Suite 330, Boston, MA - 02111-1307, USA. */ - -#ifndef LDLEX_H -#define LDLEX_H - -#include - -/* The initial parser states. */ -typedef enum input_enum { - input_selected, /* We've set the initial state. */ - input_script, - input_mri_script, - input_version_script, - input_defsym -} input_type; - -extern input_type parser_input; - -extern unsigned int lineno; -extern const char *lex_string; - -/* In ldlex.l. */ -extern int yylex PARAMS ((void)); -extern void lex_push_file PARAMS ((FILE *, const char *)); -extern void lex_redirect PARAMS ((const char *)); -extern void ldlex_script PARAMS ((void)); -extern void ldlex_mri_script PARAMS ((void)); -extern void ldlex_version_script PARAMS ((void)); -extern void ldlex_version_file PARAMS ((void)); -extern void ldlex_defsym PARAMS ((void)); -extern void ldlex_expression PARAMS ((void)); -extern void ldlex_both PARAMS ((void)); -extern void ldlex_command PARAMS ((void)); -extern void ldlex_popstate PARAMS ((void)); - -/* In lexsup.c. */ -extern int lex_input PARAMS ((void)); -extern void lex_unput PARAMS ((int)); -#ifndef yywrap -extern int yywrap PARAMS ((void)); -#endif -extern void parse_args PARAMS ((int, char **)); - -#endif diff --git a/gnu/dist/ld/ldlex.l b/gnu/dist/ld/ldlex.l deleted file mode 100644 index dfdf73775913..000000000000 --- a/gnu/dist/ld/ldlex.l +++ /dev/null @@ -1,647 +0,0 @@ -%{ - -/* Copyright (C) 1991, 92, 93, 94, 95, 96, 97, 1998 - Free Software Foundation, Inc. - -This file is part of GLD, the Gnu Linker. - -GLD 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, or (at your option) -any later version. - -GLD 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 GLD; see the file COPYING. If not, write to the Free -Software Foundation, 59 Temple Place - Suite 330, Boston, MA -02111-1307, USA. */ - -/* -This was written by steve chamberlain - sac@cygnus.com -*/ - - -#include -#include -#include - -#ifdef MPW -/* Prevent enum redefinition problems. */ -#define TRUE_FALSE_ALREADY_DEFINED -#endif /* MPW */ - -#include "bfd.h" -#include "sysdep.h" -#include "ld.h" -#include "ldgram.h" -#include "ldmisc.h" -#include "ldexp.h" -#include "ldlang.h" -#include "ldfile.h" -#include "ldlex.h" -#include "ldmain.h" - -/* The type of top-level parser input. - yylex and yyparse (indirectly) both check this. */ -input_type parser_input; - -/* Line number in the current input file. - (FIXME Actually, it doesn't appear to get reset for each file?) */ -unsigned int lineno = 1; - -/* The string we are currently lexing, or NULL if we are reading a - file. */ -const char *lex_string = NULL; - -/* Support for flex reading from more than one input file (stream). - `include_stack' is flex's input state for each open file; - `file_name_stack' is the file names. `lineno_stack' is the current - line numbers. - - If `include_stack_ptr' is 0, we haven't started reading anything yet. - Otherwise, stack elements 0 through `include_stack_ptr - 1' are valid. */ - -#undef YY_INPUT -#define YY_INPUT(buf,result,max_size) yy_input(buf, &result, max_size) - -#define MAX_INCLUDE_DEPTH 10 -static YY_BUFFER_STATE include_stack[MAX_INCLUDE_DEPTH]; -static const char *file_name_stack[MAX_INCLUDE_DEPTH]; -static unsigned int lineno_stack[MAX_INCLUDE_DEPTH]; -static unsigned int include_stack_ptr = 0; - -static YY_BUFFER_STATE yy_create_string_buffer PARAMS ((const char *string, - size_t size)); -static void yy_input PARAMS ((char *, int *result, int max_size)); - -static void comment PARAMS ((void)); -static void lex_warn_invalid PARAMS ((char *where, char *what)); - -/* STATES - EXPRESSION definitely in an expression - SCRIPT definitely in a script - BOTH either EXPRESSION or SCRIPT - DEFSYMEXP in an argument to -defsym - MRI in an MRI script - VERS_START starting a Sun style mapfile - VERS_SCRIPT a Sun style mapfile - VERS_NODE a node within a Sun style mapfile -*/ -#define RTOKEN(x) { yylval.token = x; return x; } - -/* Some versions of flex want this. */ -#ifndef yywrap -int yywrap () { return 1; } -#endif -%} - -%a 4000 -%o 5000 - -CMDFILENAMECHAR [_a-zA-Z0-9\/\.\\_\+\$\:\[\]\\\,\=\&\!\<\>\-\~] -CMDFILENAMECHAR1 [_a-zA-Z0-9\/\.\\_\+\$\:\[\]\\\,\=\&\!\<\>\~] -FILENAMECHAR1 [_a-zA-Z\/\.\\\$\_\~] -SYMBOLCHARN [_a-zA-Z\/\.\\\$\_\~0-9] -FILENAMECHAR [_a-zA-Z0-9\/\.\-\_\+\=\$\:\[\]\\\,\~] -WILDCHAR [_a-zA-Z0-9\/\.\-\_\+\=\$\:\[\]\\\,\~\?\*] -WHITE [ \t\n\r]+ - -NOCFILENAMECHAR [_a-zA-Z0-9\/\.\-\_\+\$\:\[\]\\\~] - -V_TAG [.$_a-zA-Z][._a-zA-Z0-9]* -V_IDENTIFIER [*?.$_a-zA-Z][*?_a-zA-Z0-9]* - -%s SCRIPT -%s EXPRESSION -%s BOTH -%s DEFSYMEXP -%s MRI -%s VERS_START -%s VERS_SCRIPT -%s VERS_NODE -%% - - if (parser_input != input_selected) - { - /* The first token of the input determines the initial parser state. */ - input_type t = parser_input; - parser_input = input_selected; - switch (t) - { - case input_script: return INPUT_SCRIPT; break; - case input_mri_script: return INPUT_MRI_SCRIPT; break; - case input_version_script: return INPUT_VERSION_SCRIPT; break; - case input_defsym: return INPUT_DEFSYM; break; - default: abort (); - } - } - -"/*" { comment(); } - - -"-" { RTOKEN('-');} -"+" { RTOKEN('+');} -{FILENAMECHAR1}{SYMBOLCHARN}* { yylval.name = buystring(yytext); return NAME; } -"=" { RTOKEN('='); } - -"$"([0-9A-Fa-f])+ { - yylval.integer = bfd_scan_vma (yytext+1, 0,16); - return INT; - } - -([0-9A-Fa-f])+(H|h|X|x|B|b|O|o|D|d) { - int ibase ; - switch (yytext[yyleng-1]) { - case 'X': - case 'x': - case 'H': - case 'h': - ibase = 16; - break; - case 'O': - case 'o': - ibase = 8; - break; - case 'B': - case 'b': - ibase = 2; - break; - default: - ibase = 10; - } - yylval.integer = bfd_scan_vma (yytext, 0, - ibase); - return INT; - } -((("$"|"0x")([0-9A-Fa-f])+)|(([0-9])+))(M|K|m|k)? { - char *s = yytext; - - if (*s == '$') - ++s; - yylval.integer = bfd_scan_vma (s, 0, 0); - if (yytext[yyleng-1] == 'M' - || yytext[yyleng-1] == 'm') - yylval.integer *= 1024 * 1024; - if (yytext[yyleng-1] == 'K' - || yytext[yyleng-1]=='k') - yylval.integer *= 1024; - return INT; - } -"]" { RTOKEN(']');} -"[" { RTOKEN('[');} -"<<=" { RTOKEN(LSHIFTEQ);} -">>=" { RTOKEN(RSHIFTEQ);} -"||" { RTOKEN(OROR);} -"==" { RTOKEN(EQ);} -"!=" { RTOKEN(NE);} -">=" { RTOKEN(GE);} -"<=" { RTOKEN(LE);} -"<<" { RTOKEN(LSHIFT);} -">>" { RTOKEN(RSHIFT);} -"+=" { RTOKEN(PLUSEQ);} -"-=" { RTOKEN(MINUSEQ);} -"*=" { RTOKEN(MULTEQ);} -"/=" { RTOKEN(DIVEQ);} -"&=" { RTOKEN(ANDEQ);} -"|=" { RTOKEN(OREQ);} -"&&" { RTOKEN(ANDAND);} -">" { RTOKEN('>');} -"," { RTOKEN(',');} -"&" { RTOKEN('&');} -"|" { RTOKEN('|');} -"~" { RTOKEN('~');} -"!" { RTOKEN('!');} -"?" { RTOKEN('?');} -"*" { RTOKEN('*');} -"+" { RTOKEN('+');} -"-" { RTOKEN('-');} -"/" { RTOKEN('/');} -"%" { RTOKEN('%');} -"<" { RTOKEN('<');} -"=" { RTOKEN('=');} -"}" { RTOKEN('}') ; } -"{" { RTOKEN('{'); } -")" { RTOKEN(')');} -"(" { RTOKEN('(');} -":" { RTOKEN(':'); } -";" { RTOKEN(';');} -"MEMORY" { RTOKEN(MEMORY);} -"ORIGIN" { RTOKEN(ORIGIN);} -"VERSION" { RTOKEN(VERSIONK);} -"BLOCK" { RTOKEN(BLOCK);} -"BIND" { RTOKEN(BIND);} -"LENGTH" { RTOKEN(LENGTH);} -"ALIGN" { RTOKEN(ALIGN_K);} -"ADDR" { RTOKEN(ADDR);} -"LOADADDR" { RTOKEN(LOADADDR);} -"MAX" { RTOKEN(MAX); } -"MIN" { RTOKEN(MIN); } -"ENTRY" { RTOKEN(ENTRY);} -"NEXT" { RTOKEN(NEXT);} -"sizeof_headers" { RTOKEN(SIZEOF_HEADERS);} -"SIZEOF_HEADERS" { RTOKEN(SIZEOF_HEADERS);} -"MAP" { RTOKEN(MAP);} -"SIZEOF" { RTOKEN(SIZEOF);} -"TARGET" { RTOKEN(TARGET_K);} -"SEARCH_DIR" { RTOKEN(SEARCH_DIR);} -"OUTPUT" { RTOKEN(OUTPUT);} -"INPUT" { RTOKEN(INPUT);} -"GROUP" { RTOKEN(GROUP);} -"DEFINED" { RTOKEN(DEFINED);} -"CREATE_OBJECT_SYMBOLS" { RTOKEN(CREATE_OBJECT_SYMBOLS);} -"CONSTRUCTORS" { RTOKEN( CONSTRUCTORS);} -"FORCE_COMMON_ALLOCATION" { RTOKEN(FORCE_COMMON_ALLOCATION);} -"SECTIONS" { RTOKEN(SECTIONS);} -"FILL" { RTOKEN(FILL);} -"STARTUP" { RTOKEN(STARTUP);} -"OUTPUT_FORMAT" { RTOKEN(OUTPUT_FORMAT);} -"OUTPUT_ARCH" { RTOKEN( OUTPUT_ARCH);} -"HLL" { RTOKEN(HLL);} -"SYSLIB" { RTOKEN(SYSLIB);} -"FLOAT" { RTOKEN(FLOAT);} -"QUAD" { RTOKEN( QUAD);} -"SQUAD" { RTOKEN( SQUAD);} -"LONG" { RTOKEN( LONG);} -"SHORT" { RTOKEN( SHORT);} -"BYTE" { RTOKEN( BYTE);} -"NOFLOAT" { RTOKEN(NOFLOAT);} -"NOCROSSREFS" { RTOKEN(NOCROSSREFS);} -"OVERLAY" { RTOKEN(OVERLAY); } -"NOLOAD" { RTOKEN(NOLOAD);} -"DSECT" { RTOKEN(DSECT);} -"COPY" { RTOKEN(COPY);} -"INFO" { RTOKEN(INFO);} -"OVERLAY" { RTOKEN(OVERLAY);} -"o" { RTOKEN(ORIGIN);} -"org" { RTOKEN(ORIGIN);} -"l" { RTOKEN( LENGTH);} -"len" { RTOKEN( LENGTH);} -"INCLUDE" { RTOKEN(INCLUDE);} -"PHDRS" { RTOKEN (PHDRS); } -"AT" { RTOKEN(AT);} -"PROVIDE" { RTOKEN(PROVIDE); } -"#".*\n? { ++ lineno; } -"\n" { ++ lineno; RTOKEN(NEWLINE); } -"*".* { /* Mri comment line */ } -";".* { /* Mri comment line */ } -"END" { RTOKEN(ENDWORD); } -"ALIGNMOD" { RTOKEN(ALIGNMOD);} -"ALIGN" { RTOKEN(ALIGN_K);} -"CHIP" { RTOKEN(CHIP); } -"BASE" { RTOKEN(BASE); } -"ALIAS" { RTOKEN(ALIAS); } -"TRUNCATE" { RTOKEN(TRUNCATE); } -"LOAD" { RTOKEN(LOAD); } -"PUBLIC" { RTOKEN(PUBLIC); } -"ORDER" { RTOKEN(ORDER); } -"NAME" { RTOKEN(NAMEWORD); } -"FORMAT" { RTOKEN(FORMAT); } -"CASE" { RTOKEN(CASE); } -"EXTERN" { RTOKEN(EXTERN); } -"START" { RTOKEN(START); } -"LIST".* { RTOKEN(LIST); /* LIST and ignore to end of line */ } -"SECT" { RTOKEN(SECT); } -"ABSOLUTE" { RTOKEN(ABSOLUTE); } -"end" { RTOKEN(ENDWORD); } -"alignmod" { RTOKEN(ALIGNMOD);} -"align" { RTOKEN(ALIGN_K);} -"chip" { RTOKEN(CHIP); } -"base" { RTOKEN(BASE); } -"alias" { RTOKEN(ALIAS); } -"truncate" { RTOKEN(TRUNCATE); } -"load" { RTOKEN(LOAD); } -"public" { RTOKEN(PUBLIC); } -"order" { RTOKEN(ORDER); } -"name" { RTOKEN(NAMEWORD); } -"format" { RTOKEN(FORMAT); } -"case" { RTOKEN(CASE); } -"extern" { RTOKEN(EXTERN); } -"start" { RTOKEN(START); } -"list".* { RTOKEN(LIST); /* LIST and ignore to end of line */ } -"sect" { RTOKEN(SECT); } -"absolute" { RTOKEN(ABSOLUTE); } - -{FILENAMECHAR1}{NOCFILENAMECHAR}* { -/* Filename without commas, needed to parse mri stuff */ - yylval.name = buystring(yytext); - return NAME; - } - - -{FILENAMECHAR1}{FILENAMECHAR}* { - yylval.name = buystring(yytext); - return NAME; - } -"-l"{FILENAMECHAR}+ { - yylval.name = buystring (yytext + 2); - return LNAME; - } -