From efa6c49704b5d4a46840c7d93f1312010ad2bae4 Mon Sep 17 00:00:00 2001 From: Ian Lance Taylor Date: Fri, 26 Apr 1996 22:15:10 +0000 Subject: [PATCH] * ldmisc.h (demangle): Declare. * ldmisc.c: Include "libiberty.h". Include demangle.h with "", not <>. (demangle): Make non-static. Remove remove_underscore paramter. Always return an allocated string. (vfinfo): Free result of demangle. Add case 'G'. Use %T to print functionname, rather than calling demangle. Print a colon between the BFD(section+offset) and the line number. * ldmain.c (add_archive_element): Improve format of archive information in map file. (constructor_callback): Don't print anything to the map file. * ldlang.c (lang_one_common): Improve format of common symbol information in map file. * ldctor.c (ldctor_build_sets): If producing a map file, print set information. * ldwrite.c (print_symbol_table): Print a newline before the header in the map file. * Makefile.in: Rebuild dependencies. --- ld/ChangeLog | 19 ++ ld/Makefile.in | 465 ++++++++++++++++++++++++++++--------------------- ld/ldlang.c | 48 ++++- ld/ldmain.c | 81 ++++++++- ld/ldmisc.c | 55 +++--- ld/ldmisc.h | 3 +- ld/ldwrite.c | 58 +++++- 7 files changed, 496 insertions(+), 233 deletions(-) diff --git a/ld/ChangeLog b/ld/ChangeLog index 2d67298282c..ed25a4b0e98 100644 --- a/ld/ChangeLog +++ b/ld/ChangeLog @@ -1,5 +1,24 @@ Fri Apr 26 14:42:27 1996 Ian Lance Taylor + * ldmisc.h (demangle): Declare. + * ldmisc.c: Include "libiberty.h". Include demangle.h with "", + not <>. + (demangle): Make non-static. Remove remove_underscore paramter. + Always return an allocated string. + (vfinfo): Free result of demangle. Add case 'G'. Use %T to print + functionname, rather than calling demangle. Print a colon between + the BFD(section+offset) and the line number. + * ldmain.c (add_archive_element): Improve format of archive + information in map file. + (constructor_callback): Don't print anything to the map file. + * ldlang.c (lang_one_common): Improve format of common symbol + information in map file. + * ldctor.c (ldctor_build_sets): If producing a map file, print set + information. + * ldwrite.c (print_symbol_table): Print a newline before the + header in the map file. + * Makefile.in: Rebuild dependencies. + * ldmisc.c (vfinfo): Reindent. Mon Apr 22 12:07:32 1996 Ian Lance Taylor diff --git a/ld/Makefile.in b/ld/Makefile.in index 7704a2332cf..a34523d3786 100644 --- a/ld/Makefile.in +++ b/ld/Makefile.in @@ -74,7 +74,7 @@ LEX = `if [ -f ../flex/flex ] ; then echo ../flex/flex ; else echo flex ; fi` EMUL = @EMUL@ EMULATION_OFILES = @EMULATION_OFILES@ -# Seach path to override the default search path for -lfoo libraries. +# 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.) @@ -194,20 +194,90 @@ BFDDEP = ../bfd/libbfd.a BFDLIB = @BFDLIB@ LIBIBERTY = ../libiberty/libiberty.a -ALL_EMULATIONS = ea29k.o ealpha.o earmaoutl.o earmaoutb.o \ - ecoff_sparc.o eebmon29k.o \ - eelf32_sparc.o eelf32bmip.o eelf32lmip.o eelf32ppc.o eelf32lppc.o \ - eelf64_sparc.o eelf_i386.o egld960.o ego32.o eh8300.o \ - eh8300h.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 \ - ei386nbsd.o ei386nw.o elnk960.o em68k4knbsd.o em68kaout.o em68kaux.o \ - em68kcoff.o em68kelf.o em68klynx.o em68knbsd.o em88kbcs.o emipsbig.o \ - emipsbsd.o emipsidt.o emipsidtl.o emipslit.o enews.o ens32knbsd.o \ - eppcnw.o eriscix.o esa29200.o eshl.o esh.o esparclynx.o esparcnbsd.o \ - est2000.o esun3.o esun4.o evanilla.o evax.o evsta.o \ - ez8001.o ez8002.o ei386pe.o earmpe.o eelf32b4300.o eelf32l4300.o \ - eaixppc.o eaixrs6.o eppcmacos.o edelta68.o eppcpe.o em68kpsos.o +ALL_EMULATIONS = \ + ea29k.o \ + eaixppc.o \ + eaixrs6.o \ + ealpha.o \ + earmaoutb.o \ + earmaoutl.o \ + earmcoff.o \ + earmpe.o \ + ecoff_sparc.o \ + edelta68.o \ + eebmon29k.o \ + eelf32_sparc.o \ + eelf32b4300.o \ + eelf32bmip.o \ + eelf32l4300.o \ + eelf32lmip.o \ + eelf32lppc.o \ + eelf32ppc.o \ + eelf64_sparc.o \ + eelf_i386.o \ + egld960.o \ + egld960coff.o \ + ego32.o \ + eh8300.o \ + eh8300h.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 \ + enews.o \ + ens32knbsd.o \ + epc532machaout.o \ + eppcmacos.o \ + eppcnw.o \ + eppcpe.o \ + eriscix.o \ + esa29200.o \ + esh.o \ + eshl.o \ + esparcaout.o \ + esparclynx.o \ + esparcnbsd.o \ + est2000.o \ + esun3.o \ + esun4.o \ + evanilla.o \ + evax.o \ + evsta.o \ + ew65.o \ + ez8001.o \ + ez8002.o CFILES = ldctor.c ldemul.c ldexp.c ldfile.c ldlang.c \ ldmain.c ldmisc.c ldver.c ldwrite.c lexsup.c \ @@ -273,48 +343,128 @@ GENSCRIPTS = $(SHELL) $(srcdir)/genscripts.sh ${srcdir} ${libdir} @host@ @target GEN_DEPENDS = $(srcdir)/genscripts.sh $(srcdir)/emultempl/stringify.sed @TDIRS@ -esun4.c: $(srcdir)/emulparams/sun4.sh \ - $(srcdir)/emultempl/sunos.em $(srcdir)/scripttempl/aout.sc ${GEN_DEPENDS} - ${GENSCRIPTS} sun4 "$(tdir_sun4)" -esun3.c: $(srcdir)/emulparams/sun3.sh \ - $(srcdir)/emultempl/sunos.em $(srcdir)/scripttempl/aout.sc ${GEN_DEPENDS} - ${GENSCRIPTS} sun3 "$(tdir_sun3)" +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)" +# start-sanitize-arc +earcelf.c: $(srcdir)/emulparams/arcelf.sh \ + $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS} + ${GENSCRIPTS} arcelf "$(tdir_arcelf)" +# end-sanitize-arc +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)" earmpe.c: $(srcdir)/emulparams/armpe.sh \ $(srcdir)/emultempl/pe.em $(srcdir)/scripttempl/pe.sc ${GEN_DEPENDS} ${GENSCRIPTS} armpe "$(tdir_armpe)" -evsta.c: $(srcdir)/emulparams/vsta.sh \ - $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/aout.sc ${GEN_DEPENDS} - ${GENSCRIPTS} vsta "$(tdir_vsta)" +ecoff_sparc.c: $(srcdir)/emulparams/coff_sparc.sh \ + $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/sparccoff.sc ${GEN_DEPENDS} + ${GENSCRIPTS} coff_sparc "$(tdir_coff_sparc)" +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)" +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/elfmips.sc ${GEN_DEPENDS} + ${GENSCRIPTS} elf32bmip "$(tdir_elf32bmip)" +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/elfmips.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)" +eelf32ppc.c: $(srcdir)/emulparams/elf32ppc.sh \ + $(srcdir)/emultempl/elf32.em $(srcdir)/scripttempl/elfppc.sc ${GEN_DEPENDS} + ${GENSCRIPTS} elf32ppc "$(tdir_elf32ppc)" +eelf64_sparc.c: $(srcdir)/emulparams/elf64_sparc.sh \ + $(srcdir)/emultempl/generic.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)" -enews.c: $(srcdir)/emulparams/news.sh \ - $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/aout.sc ${GEN_DEPENDS} - ${GENSCRIPTS} news "$(tdir_news)" -evax.c: $(srcdir)/emulparams/vax.sh \ - $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/aout.sc ${GEN_DEPENDS} - ${GENSCRIPTS} vax "$(tdir_vax)" +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)" +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)" -ei386pe.c: $(srcdir)/emulparams/i386pe.sh \ - $(srcdir)/emultempl/pe.em $(srcdir)/scripttempl/pe.sc ${GEN_DEPENDS} - ${GENSCRIPTS} i386pe "$(tdir_i386pe)" -eppcpe.c: $(srcdir)/emulparams/ppcpe.sh \ - $(srcdir)/emultempl/pe.em $(srcdir)/scripttempl/ppcpe.sc ${GEN_DEPENDS} - ${GENSCRIPTS} ppcpe "$(tdir_ppcpe)" 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)" @@ -324,60 +474,24 @@ ei386moss.c: $(srcdir)/emulparams/i386moss.sh \ ei386msdos.c: $(srcdir)/emulparams/i386msdos.sh \ $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/i386msdos.sc ${GEN_DEPENDS} ${GENSCRIPTS} i386msdos "$(tdir_i386msdos)" -eebmon29k.c: $(srcdir)/emulparams/ebmon29k.sh \ - $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/ebmon29k.sc ${GEN_DEPENDS} - ${GENSCRIPTS} ebmon29k "$(tdir_ebmon29k)" -esa29200.c: $(srcdir)/emulparams/sa29200.sh \ - $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/sa29200.sc ${GEN_DEPENDS} - ${GENSCRIPTS} sa29200 "$(tdir_sa29200)" -ea29k.c: $(srcdir)/emulparams/a29k.sh \ - $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/a29k.sc ${GEN_DEPENDS} - ${GENSCRIPTS} a29k "$(tdir_a29k)" -em88kbcs.c: $(srcdir)/emulparams/m88kbcs.sh \ - $(srcdir)/emultempl/m88kbcs.em $(srcdir)/scripttempl/m88kbcs.sc ${GEN_DEPENDS} - ${GENSCRIPTS} m88kbcs "$(tdir_m88kbcs)" -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)" -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)" -esh.c: $(srcdir)/emulparams/sh.sh \ - $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/sh.sc ${GEN_DEPENDS} - ${GENSCRIPTS} sh "$(tdir_sh)" -eshl.c: $(srcdir)/emulparams/shl.sh \ - $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/sh.sc ${GEN_DEPENDS} - ${GENSCRIPTS} shl "$(tdir_shl)" -est2000.c: $(srcdir)/emulparams/st2000.sh \ - $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/st2000.sc ${GEN_DEPENDS} - ${GENSCRIPTS} st2000 "$(tdir_st2000)" -evanilla.c: $(srcdir)/emulparams/vanilla.sh \ - $(srcdir)/emultempl/vanilla.em $(srcdir)/scripttempl/vanilla.sc ${GEN_DEPENDS} - ${GENSCRIPTS} vanilla "$(tdir_vanilla)" +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)" -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)" +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)" @@ -387,150 +501,107 @@ em68kcoff.c: $(srcdir)/emulparams/m68kcoff.sh \ 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)" -ei386coff.c: $(srcdir)/emulparams/i386coff.sh \ - $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/i386coff.sc ${GEN_DEPENDS} - ${GENSCRIPTS} i386coff "$(tdir_i386coff)" -ei386lynx.c: $(srcdir)/emulparams/i386lynx.sh \ - $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/i386lynx.sc ${GEN_DEPENDS} - ${GENSCRIPTS} i386lynx "$(tdir_i386lynx)" -emipslit.c: $(srcdir)/emulparams/mipslit.sh \ - $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/mips.sc ${GEN_DEPENDS} - ${GENSCRIPTS} mipslit "$(tdir_mipslit)" -ei386bsd.c: $(srcdir)/emulparams/i386bsd.sh \ +em68knbsd.c: $(srcdir)/emulparams/m68knbsd.sh \ $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/aout.sc ${GEN_DEPENDS} - ${GENSCRIPTS} i386bsd "$(tdir_i386bsd)" + ${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/m88kbcs.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 "$(tdir_mipsbig)" + ${GENSCRIPTS} mipsbig emipsbsd.c: $(srcdir)/emulparams/mipsbsd.sh \ $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/mipsbsd.sc ${GEN_DEPENDS} - ${GENSCRIPTS} mipsbsd "$(tdir_mipsbsd)" + ${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)" -eelf_i386.c: $(srcdir)/emulparams/elf_i386.sh \ - $(srcdir)/emultempl/elf32.em $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS} - ${GENSCRIPTS} elf_i386 "$(tdir_elf_i386)" -eelf32bmip.c: $(srcdir)/emulparams/elf32bmip.sh \ - $(srcdir)/emultempl/elf32.em $(srcdir)/scripttempl/elfmips.sc ${GEN_DEPENDS} - ${GENSCRIPTS} elf32bmip "$(tdir_elf32bmip)" -eelf32lmip.c: $(srcdir)/emulparams/elf32lmip.sh \ - $(srcdir)/emultempl/elf32.em $(srcdir)/scripttempl/elfmips.sc ${GEN_DEPENDS} - ${GENSCRIPTS} elf32lmip "$(tdir_elf32lmip)" -eelf32b4300.c: $(srcdir)/emulparams/elf32b4300.sh \ - $(srcdir)/emultempl/elf32.em $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS} - ${GENSCRIPTS} elf32b4300 "$(tdir_elf32b4300)" -eelf32l4300.c: $(srcdir)/emulparams/elf32l4300.sh \ - $(srcdir)/emultempl/elf32.em $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS} - ${GENSCRIPTS} elf32l4300 "$(tdir_elf32l4300)" -ealpha.c: $(srcdir)/emulparams/alpha.sh \ - $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/alpha.sc ${GEN_DEPENDS} - ${GENSCRIPTS} alpha "$(tdir_alpha)" -ecoff_sparc.c: $(srcdir)/emulparams/coff_sparc.sh \ - $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/sparccoff.sc ${GEN_DEPENDS} - ${GENSCRIPTS} coff_sparc "$(tdir_coff_sparc)" -esparclynx.c: $(srcdir)/emulparams/sparclynx.sh \ - $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/sparclynx.sc ${GEN_DEPENDS} - ${GENSCRIPTS} sparclynx "$(tdir_sparclynx)" -eelf32ppc.c: $(srcdir)/emulparams/elf32ppc.sh \ - $(srcdir)/emultempl/elf32.em $(srcdir)/scripttempl/elfppc.sc ${GEN_DEPENDS} - ${GENSCRIPTS} elf32ppc "$(tdir_elf32ppc)" -eelf32lppc.c: $(srcdir)/emulparams/elf32lppc.sh \ - $(srcdir)/emultempl/elf32.em $(srcdir)/scripttempl/elfppc.sc ${GEN_DEPENDS} - ${GENSCRIPTS} elf32lppc "$(tdir_elf32lppc)" -eriscix.c: $(srcdir)/emulparams/riscix.sh \ +emipslit.c: $(srcdir)/emulparams/mipslit.sh \ + $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/mips.sc ${GEN_DEPENDS} + ${GENSCRIPTS} mipslit "$(tdir_mipslit)" +enews.c: $(srcdir)/emulparams/news.sh \ $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/aout.sc ${GEN_DEPENDS} - ${GENSCRIPTS} riscix "$(tdir_riscix)" -em68kaout.c: $(srcdir)/emulparams/m68kaout.sh \ + ${GENSCRIPTS} news "$(tdir_news)" +ens32knbsd.c: $(srcdir)/emulparams/ns32knbsd.sh \ $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/aout.sc ${GEN_DEPENDS} - ${GENSCRIPTS} m68kaout "$(tdir_m68kaout)" -ei386linux.c: $(srcdir)/emulparams/i386linux.sh \ - $(srcdir)/emultempl/linux.em $(srcdir)/scripttempl/aout.sc ${GEN_DEPENDS} - ${GENSCRIPTS} i386linux "$(tdir_i386linux)" -eelf32_sparc.c: $(srcdir)/emulparams/elf32_sparc.sh \ - $(srcdir)/emultempl/elf32.em $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS} - ${GENSCRIPTS} elf32_sparc "$(tdir_elf32_sparc)" -eelf64_sparc.c: $(srcdir)/emulparams/elf64_sparc.sh \ - $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS} - ${GENSCRIPTS} elf64_sparc "$(tdir_elf64_sparc)" - + ${GENSCRIPTS} ns32knbsd "$(tdir_ns32knbsd)" epc532machaout.c: $(srcdir)/emulparams/pc532machaout.sh \ $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/aout.sc ${GEN_DEPENDS} ${GENSCRIPTS} pc532machaout "$(tdir_pc532machaout)" - -ew65.c: $(srcdir)/emulparams/w65.sh \ - $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/w65.sc ${GEN_DEPENDS} - ${GENSCRIPTS} w65 "$(tdir_w65)" - eppcmacos.c: $(srcdir)/emulparams/ppcmacos.sh \ $(srcdir)/emultempl/aix.em $(srcdir)/scripttempl/aix.sc ${GEN_DEPENDS} ${GENSCRIPTS} ppcmacos "$(tdir_ppcmacos)" - -ei386nw.c: $(srcdir)/emulparams/i386nw.sh \ - $(srcdir)/emultempl/elf32.em $(srcdir)/scripttempl/nw.sc ${GEN_DEPENDS} - ${GENSCRIPTS} i386nw "$(tdir_i386nw)" eppcnw.c: $(srcdir)/emulparams/ppcnw.sh \ $(srcdir)/emultempl/elf32.em $(srcdir)/scripttempl/nw.sc ${GEN_DEPENDS} ${GENSCRIPTS} ppcnw "$(tdir_ppcnw)" - -ei386nbsd.c: $(srcdir)/emulparams/i386nbsd.sh \ - $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/aout.sc ${GEN_DEPENDS} - ${GENSCRIPTS} i386nbsd "$(tdir_i386nbsd)" -em68k4knbsd.c: $(srcdir)/emulparams/m68k4knbsd.sh \ - $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/aout.sc ${GEN_DEPENDS} - ${GENSCRIPTS} m68k4knbsd "$(tdir_m68k4knbsd)" -em68knbsd.c: $(srcdir)/emulparams/m68knbsd.sh \ +eppcpe.c: $(srcdir)/emulparams/ppcpe.sh \ + $(srcdir)/emultempl/pe.em $(srcdir)/scripttempl/ppcpe.sc ${GEN_DEPENDS} + ${GENSCRIPTS} ppcpe "$(tdir_ppcpe)" +# start-sanitize-rce +erce.c: $(srcdir)/emulparams/rce.sh \ + $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/rce.sc ${GEN_DEPENDS} + ${GENSCRIPTS} rce "$(tdir_rce)" +# end-sanitize-rce +eriscix.c: $(srcdir)/emulparams/riscix.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)" -ens32knbsd.c: $(srcdir)/emulparams/ns32knbsd.sh \ + ${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)" +eshl.c: $(srcdir)/emulparams/shl.sh \ + $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/sh.sc ${GEN_DEPENDS} + ${GENSCRIPTS} shl "$(tdir_shl)" +esparcaout.c: $(srcdir)/emulparams/sparcaout.sh \ $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/aout.sc ${GEN_DEPENDS} - ${GENSCRIPTS} ns32knbsd "$(tdir_ns32knbsd)" + ${GENSCRIPTS} sparcaout "$(tdir_sparcaout)" +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)" -earmaoutl.c: $(srcdir)/emulparams/armaoutl.sh \ - $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/armaout.sc ${GEN_DEPENDS} - ${GENSCRIPTS} armaoutl "$(tdir_armaoutl)" -earmaoutb.c: $(srcdir)/emulparams/armaoutb.sh \ - $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/armaout.sc ${GEN_DEPENDS} - ${GENSCRIPTS} armaoutb "$(tdir_armaoutb)" -earmcoff.c: $(srcdir)/emulparams/armcoff.sh \ - $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/armcoff.sc ${GEN_DEPENDS} - ${GENSCRIPTS} armcoff "$(tdir_armcoff)" +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)" +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)" +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)" -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)" -edelta68.c: $(srcdir)/emulparams/delta68.sh \ - $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/delta68.sc ${GEN_DEPENDS} - ${GENSCRIPTS} delta68 "$(tdir_delta68)" -# start-sanitize-arc -earcelf.c: $(srcdir)/emulparams/arcelf.sh \ - $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS} - ${GENSCRIPTS} arcelf "$(tdir_arcelf)" -# end-sanitize-arc -# start-sanitize-rce -erce.c: $(srcdir)/emulparams/rce.sh \ - $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/rce.sc ${GEN_DEPENDS} - ${GENSCRIPTS} rce "$(tdir_rce)" -# end-sanitize-rce $(LD_PROG): $(OFILES) $(BFDDEP) $(LIBIBERTY) $(CC) $(HLDFLAGS) $(CFLAGS) $(LDFLAGS) -o $(LD_PROG) $(OFILES) $(BFDLIB) $(LIBIBERTY) $(EXTRALIBS) @@ -934,8 +1005,8 @@ ldmain.o: ldmain.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \ ldemul.h ldlex.h ldfile.h ldctor.h ldmisc.o: ldmisc.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \ $(INCDIR)/obstack.h sysdep.h config.h $(INCDIR)/fopen-same.h \ - ld.h ldmisc.h ldexp.h ldlang.h ldgram.h ldlex.h ldmain.h \ - ldfile.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 \ $(INCDIR)/obstack.h sysdep.h config.h $(INCDIR)/fopen-same.h \ ld.h ldver.h ldemul.h ldmain.h diff --git a/ld/ldlang.c b/ld/ldlang.c index f9e0e7124be..56b588d8a88 100644 --- a/ld/ldlang.c +++ b/ld/ldlang.c @@ -2592,9 +2592,51 @@ lang_one_common (h, info) section->flags |= SEC_ALLOC; if (config.map_file != NULL) - fprintf (config.map_file, "Allocating common %s: %lx at %lx %s\n", - h->root.string, (unsigned long) size, - (unsigned long) h->u.def.value, section->owner->filename); + { + 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; } diff --git a/ld/ldmain.c b/ld/ldmain.c index aee02e7cb41..d637a50af29 100644 --- a/ld/ldmain.c +++ b/ld/ldmain.c @@ -637,7 +637,82 @@ add_archive_element (info, abfd, name) ldlang_add_file (input); if (config.map_file != (FILE *) NULL) - minfo ("%s needed due to %T\n", abfd->filename, name); + { + static boolean header_printed; + struct bfd_link_hash_entry *h; + bfd *from; + int len; + + h = bfd_link_hash_lookup (link_info.hash, name, false, false, true); + + if (h == NULL) + from = NULL; + else + { + switch (h->type) + { + default: + from = NULL; + break; + + case bfd_link_hash_defined: + case bfd_link_hash_defweak: + from = h->u.def.section->owner; + break; + + case bfd_link_hash_undefined: + case bfd_link_hash_undefweak: + from = h->u.undef.abfd; + break; + + case bfd_link_hash_common: + from = h->u.c.p->section->owner; + break; + } + } + + if (! header_printed) + { + char buf[100]; + + sprintf (buf, "%-29s %s\n\n", "Archive member included", + "because of file (symbol)"); + minfo ("%s", buf); + header_printed = true; + } + + if (bfd_my_archive (abfd) == NULL) + { + minfo ("%s", bfd_get_filename (abfd)); + len = strlen (bfd_get_filename (abfd)); + } + else + { + minfo ("%s(%s)", bfd_get_filename (bfd_my_archive (abfd)), + bfd_get_filename (abfd)); + len = (strlen (bfd_get_filename (bfd_my_archive (abfd))) + + strlen (bfd_get_filename (abfd)) + + 2); + } + + if (len >= 29) + { + print_nl (); + len = 0; + } + while (len < 30) + { + print_space (); + ++len; + } + + if (from != NULL) + minfo ("%B ", from); + if (h != NULL) + minfo ("(%T)\n", h->root.string); + else + minfo ("(%s)\n", name); + } if (trace_files || trace_file_tries) info_msg ("%I\n", input); @@ -820,10 +895,6 @@ constructor_callback (info, constructor, name, abfd, section, value) else strcpy (s, "__DTOR_LIST__"); - if (config.map_file != (FILE *) NULL) - fprintf (config.map_file, - "Adding %s to constructor/destructor set %s\n", name, set_name); - h = bfd_link_hash_lookup (info->hash, set_name, true, true, true); if (h == (struct bfd_link_hash_entry *) NULL) einfo ("%P%F: bfd_link_hash_lookup failed: %E\n"); diff --git a/ld/ldmisc.c b/ld/ldmisc.c index 4f36290d88d..1e08efbebe7 100644 --- a/ld/ldmisc.c +++ b/ld/ldmisc.c @@ -20,7 +20,8 @@ the Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307 #include "bfd.h" #include "sysdep.h" -#include +#include "libiberty.h" +#include "demangle.h" #ifdef ANSI_PROTOTYPES #include @@ -46,8 +47,6 @@ static void finfo PARAMS ((FILE *, const char *, ...)); /* VARARGS*/ static void finfo (); #endif -static const char *demangle PARAMS ((const char *string, - int remove_underscore)); /* %% literal % @@ -63,34 +62,29 @@ static const char *demangle PARAMS ((const char *string, %v hex bfd_vma, no leading zeros %C clever filename:linenumber with function %D like %C, but no function name + %G like %D, but only function name %R info about a relent %s arbitrary string, like printf %d integer, like printf %u integer, like printf */ -static const char * -demangle (string, remove_underscore) +char * +demangle (string) const char *string; - int remove_underscore; { - const char *res; + char *res; - if (remove_underscore - && output_bfd != NULL + if (output_bfd != NULL && bfd_get_symbol_leading_char (output_bfd) == string[0]) ++string; /* This is a hack for better error reporting on XCOFF. */ - if (remove_underscore && string[0] == '.') + if (string[0] == '.') ++string; - /* Note that there's a memory leak here, we keep buying memory for - demangled names, and never free. But if you have so many errors - that you run out of VM with the error messages, then there's - something up. */ res = cplus_demangle (string, DMGL_ANSI | DMGL_PARAMS); - return res ? res : string; + return res ? res : xstrdup (string); } static void @@ -156,10 +150,16 @@ vfinfo (fp, fmt, arg) { const char *name = va_arg (arg, const char *); - if (name != (const char *) NULL) - fprintf (fp, "%s", demangle (name, 1)); - else + if (name == (const char *) NULL) fprintf (fp, "no symbol"); + else + { + char *demangled; + + demangled = demangle (name); + fprintf (fp, "%s", demangled); + free (demangled); + } } break; @@ -230,6 +230,7 @@ vfinfo (fp, fmt, arg) case 'C': case 'D': + case 'G': /* Clever filename:linenumber with function name if possible, or section name as a last resort. The arguments are a BFD, a section, and an offset. */ @@ -279,7 +280,15 @@ vfinfo (fp, fmt, arg) &filename, &functionname, &linenumber)) { - if (functionname != NULL && fmt[-1] == 'C') + if (functionname != NULL && fmt[-1] == 'G') + { + finfo (fp, "%B:", abfd); + if (filename != NULL + && strcmp (filename, bfd_get_filename (abfd)) != 0) + fprintf (fp, "%s:", filename); + finfo (fp, "%T", functionname); + } + else if (functionname != NULL && fmt[-1] == 'C') { if (filename == (char *) NULL) filename = abfd->filename; @@ -294,8 +303,8 @@ vfinfo (fp, fmt, arg) /* We use abfd->filename in this initial line, in case filename is a .h file or something similarly unhelpful. */ - finfo (fp, "%B: In function `%s':\n", - abfd, demangle (functionname, 1)); + finfo (fp, "%B: In function `%T':\n", + abfd, functionname); last_bfd = abfd; if (last_file != NULL) @@ -317,7 +326,7 @@ vfinfo (fp, fmt, arg) { finfo (fp, "%B(%s+0x%v)", abfd, section->name, offset); if (linenumber != 0) - finfo (fp, "%u", linenumber); + finfo (fp, ":%u", linenumber); } else if (linenumber != 0) finfo (fp, "%B:%s:%u", abfd, filename, linenumber); @@ -357,7 +366,7 @@ vfinfo (fp, fmt, arg) case 'u': /* unsigned integer, like printf */ - fprintf (fp,"%u", va_arg (arg, unsigned int)); + fprintf (fp, "%u", va_arg (arg, unsigned int)); break; } } diff --git a/ld/ldmisc.h b/ld/ldmisc.h index 83920f4f38d..ea93399689c 100644 --- a/ld/ldmisc.h +++ b/ld/ldmisc.h @@ -1,5 +1,5 @@ /* ldmisc.h - - Copyright (C) 1991, 92, 93, 94 Free Software Foundation, Inc. + Copyright (C) 1991, 92, 93, 94, 95, 1996 Free Software Foundation, Inc. This file is part of GLD, the Gnu Linker. @@ -49,5 +49,6 @@ do { info_assert(__FILE__,__LINE__); } while (0) extern void print_space PARAMS ((void)); extern void print_nl PARAMS ((void)); extern void print_address PARAMS ((bfd_vma value)); +extern char *demangle PARAMS ((const char *)); #endif diff --git a/ld/ldwrite.c b/ld/ldwrite.c index 3dee0e382a6..4160ae2508b 100644 --- a/ld/ldwrite.c +++ b/ld/ldwrite.c @@ -64,6 +64,58 @@ build_link_order (statement) value = statement->data_statement.value; + /* If the endianness of the output BFD is not known, then we + base the endianness of the data on the first input file. + By convention, the bfd_put routines for an unknown + endianness are big endian, so we must swap here if the + input file is little endian. */ + if (! bfd_big_endian (output_bfd) + && ! bfd_little_endian (output_bfd)) + { + boolean swap; + + swap = false; + if (command_line.endian == ENDIAN_LITTLE) + swap = true; + else if (command_line.endian == ENDIAN_UNSET) + { + LANG_FOR_EACH_INPUT_STATEMENT (s) + { + if (s->the_bfd != NULL) + { + if (bfd_little_endian (s->the_bfd)) + swap = true; + break; + } + } + } + + if (swap) + { + bfd_byte buffer[8]; + + switch (statement->data_statement.type) + { + case QUAD: + bfd_putl64 (value, buffer); + value = bfd_getb64 (buffer); + break; + case LONG: + bfd_putl32 (value, buffer); + value = bfd_getb32 (buffer); + break; + case SHORT: + bfd_putl16 (value, buffer); + value = bfd_getb16 (buffer); + break; + case BYTE: + break; + default: + abort (); + } + } + } + ASSERT (output_section->owner == output_bfd); switch (statement->data_statement.type) { @@ -114,9 +166,8 @@ build_link_order (statement) link_order->u.reloc.p->reloc = rs->reloc; link_order->u.reloc.p->addend = rs->addend_value; - if (rs->section != (asection *) NULL) + if (rs->name == NULL) { - ASSERT (rs->name == (const char *) NULL); link_order->type = bfd_section_reloc_link_order; if (rs->section->owner == output_bfd) link_order->u.reloc.p->u.section = rs->section; @@ -128,7 +179,6 @@ build_link_order (statement) } else { - ASSERT (rs->name != (const char *) NULL); link_order->type = bfd_symbol_reloc_link_order; link_order->u.reloc.p->u.name = rs->name; } @@ -453,7 +503,7 @@ ldwrite () static void print_symbol_table () { - fprintf (config.map_file, "**FILES**\n\n"); + fprintf (config.map_file, "\n**FILES**\n\n"); lang_for_each_file (print_file_stuff); fprintf (config.map_file, "**GLOBAL SYMBOLS**\n\n"); -- 2.30.2