summaryrefslogtreecommitdiffstats
path: root/contrib/binutils/ld
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/binutils/ld')
-rw-r--r--contrib/binutils/ld/ChangeLog2311
-rw-r--r--contrib/binutils/ld/Makefile.am348
-rw-r--r--contrib/binutils/ld/Makefile.in793
-rw-r--r--contrib/binutils/ld/NEWS33
-rw-r--r--contrib/binutils/ld/aclocal.m4761
-rw-r--r--contrib/binutils/ld/config.in150
-rwxr-xr-xcontrib/binutils/ld/configure3061
-rw-r--r--contrib/binutils/ld/configure.host112
-rw-r--r--contrib/binutils/ld/configure.in97
-rw-r--r--contrib/binutils/ld/configure.tgt124
-rw-r--r--contrib/binutils/ld/deffile.h128
-rw-r--r--contrib/binutils/ld/deffilep.y1024
-rw-r--r--contrib/binutils/ld/emulparams/armaoutb.sh7
-rw-r--r--contrib/binutils/ld/emulparams/armaoutl.sh7
-rw-r--r--contrib/binutils/ld/emulparams/armcoff.sh6
-rw-r--r--contrib/binutils/ld/emulparams/armelf.sh22
-rw-r--r--contrib/binutils/ld/emulparams/armelf_linux.sh19
-rw-r--r--contrib/binutils/ld/emulparams/armelf_linux26.sh20
-rw-r--r--contrib/binutils/ld/emulparams/armelf_oabi.sh21
-rw-r--r--contrib/binutils/ld/emulparams/armnbsd.sh7
-rw-r--r--contrib/binutils/ld/emulparams/armpe.sh9
-rw-r--r--contrib/binutils/ld/emulparams/coff_sparc.sh7
-rw-r--r--contrib/binutils/ld/emulparams/elf32_sparc.sh1
-rwxr-xr-xcontrib/binutils/ld/emulparams/elf32bmipn32.sh75
-rw-r--r--contrib/binutils/ld/emulparams/elf32ebmip.sh1
-rw-r--r--contrib/binutils/ld/emulparams/elf32elmip.sh1
-rw-r--r--contrib/binutils/ld/emulparams/elf32lppc.sh8
-rw-r--r--contrib/binutils/ld/emulparams/elf32ppc.sh8
-rw-r--r--contrib/binutils/ld/emulparams/elf32ppclinux.sh8
-rw-r--r--contrib/binutils/ld/emulparams/elf64_sparc.sh34
-rwxr-xr-xcontrib/binutils/ld/emulparams/elf64bmip.sh79
-rw-r--r--contrib/binutils/ld/emulparams/i386pe.sh3
-rw-r--r--contrib/binutils/ld/emulparams/i386pe_posix.sh9
-rw-r--r--contrib/binutils/ld/emulparams/ppcmacos.sh4
-rw-r--r--contrib/binutils/ld/emulparams/ppcnw.sh7
-rw-r--r--contrib/binutils/ld/emulparams/ppcpe.sh7
-rw-r--r--contrib/binutils/ld/emulparams/sparcaout.sh8
-rw-r--r--contrib/binutils/ld/emulparams/sparclinux.sh7
-rw-r--r--contrib/binutils/ld/emulparams/sparcnbsd.sh5
-rw-r--r--contrib/binutils/ld/emultempl/armcoff.em292
-rw-r--r--contrib/binutils/ld/emultempl/armelf.em1293
-rw-r--r--contrib/binutils/ld/emultempl/armelf_oabi.em177
-rw-r--r--contrib/binutils/ld/emultempl/astring.sed13
-rw-r--r--contrib/binutils/ld/emultempl/elf32.em154
-rw-r--r--contrib/binutils/ld/emultempl/generic.em16
-rw-r--r--contrib/binutils/ld/emultempl/linux.em41
-rw-r--r--contrib/binutils/ld/emultempl/ostring.sed4
-rw-r--r--contrib/binutils/ld/emultempl/pe.em1189
-rw-r--r--contrib/binutils/ld/emultempl/vanilla.em12
-rwxr-xr-xcontrib/binutils/ld/genscripts.sh42
-rw-r--r--contrib/binutils/ld/ld.142
-rw-r--r--contrib/binutils/ld/ld.h74
-rw-r--r--contrib/binutils/ld/ld.texinfo3680
-rw-r--r--contrib/binutils/ld/ldcref.c34
-rw-r--r--contrib/binutils/ld/ldctor.c149
-rw-r--r--contrib/binutils/ld/ldctor.h12
-rw-r--r--contrib/binutils/ld/ldemul.c62
-rw-r--r--contrib/binutils/ld/ldemul.h22
-rw-r--r--contrib/binutils/ld/ldexp.c131
-rw-r--r--contrib/binutils/ld/ldexp.h17
-rw-r--r--contrib/binutils/ld/ldfile.c84
-rw-r--r--contrib/binutils/ld/ldfile.h3
-rw-r--r--contrib/binutils/ld/ldgram.y228
-rw-r--r--contrib/binutils/ld/ldint.texinfo160
-rw-r--r--contrib/binutils/ld/ldlang.c2165
-rw-r--r--contrib/binutils/ld/ldlang.h24
-rw-r--r--contrib/binutils/ld/ldlex.l31
-rw-r--r--contrib/binutils/ld/ldmain.c197
-rw-r--r--contrib/binutils/ld/ldmain.h8
-rw-r--r--contrib/binutils/ld/ldmisc.c40
-rw-r--r--contrib/binutils/ld/ldver.c6
-rw-r--r--contrib/binutils/ld/ldwrite.c8
-rw-r--r--contrib/binutils/ld/lexsup.c425
-rw-r--r--contrib/binutils/ld/mri.c13
-rw-r--r--contrib/binutils/ld/pe-dll.c1924
-rw-r--r--contrib/binutils/ld/pe-dll.h48
-rw-r--r--contrib/binutils/ld/po/Make-in251
-rw-r--r--contrib/binutils/ld/po/POTFILES.in29
-rw-r--r--contrib/binutils/ld/po/ld.pot1502
-rw-r--r--contrib/binutils/ld/scripttempl/aout.sc6
-rw-r--r--contrib/binutils/ld/scripttempl/armaout.sc35
-rw-r--r--contrib/binutils/ld/scripttempl/armcoff.sc62
-rw-r--r--contrib/binutils/ld/scripttempl/elf.sc184
-rw-r--r--contrib/binutils/ld/scripttempl/elfppc.sc288
-rw-r--r--contrib/binutils/ld/scripttempl/pe.sc60
-rw-r--r--contrib/binutils/ld/scripttempl/ppcpe.sc198
-rw-r--r--contrib/binutils/ld/scripttempl/sparccoff.sc48
-rw-r--r--contrib/binutils/ld/scripttempl/v850.sc45
-rw-r--r--contrib/binutils/ld/sysdep.h4
89 files changed, 20848 insertions, 4016 deletions
diff --git a/contrib/binutils/ld/ChangeLog b/contrib/binutils/ld/ChangeLog
index 6baf1f4..62357d9 100644
--- a/contrib/binutils/ld/ChangeLog
+++ b/contrib/binutils/ld/ChangeLog
@@ -1,8 +1,2008 @@
+2000-05-03 Alan Modra <alan@linuxcare.com.au>
+
+ From Ulf Carlsson <ulfc@engr.sgi.com> and Andreas Jaeger <aj@suse.de>
+ * lexsup.c (set_section_start): Use bfd_scan_vma rather than
+ strtoul.
+
+2000-04-29 Andreas Jaeger <aj@suse.de>
+
+ * ld.h: Correctly check GCC version.
+
+2000-04-19 Alan Modra <alan@linuxcare.com.au>
+
+ * ld.texinfo (Simple Example): Remove extraneous paragraph.
+
+2000-04-04 Alan Modra <alan@linuxcare.com.au>
+
+ * po/ld.pot: Regenerate.
+
+ * lexsup.c (help): Restore translated part of bug string.
+
+ * Makefile.am (MKDEP): Use gcc -MM rather than mkdep.
+ (DEP): Quote when passing vars to sub-make. Add warning message
+ to end.
+ (DEP1): Rewrite for "gcc -MM".
+ (CLEANFILES): Add DEP2.
+ Update dependencies.
+ * Makefile.in: Regenerate.
+
+2000-04-03 Alan Modra <alan@linuxcare.com.au>
+
+ * ld.h: #include "bin-bugs.h"
+ * lexsup.c (help): Use REPORT_BUGS_TO.
+
+2000-03-27 Denis Chertykov <denisc@overta.ru>
+
+ * configure.tgt (avr-*-*): New target support.
+ * Makefile.am: Likewise.
+ * scripttempl/elf32avr.sc: New script file.
+ * emulparams/avr1200.sh: New file.
+ * emulparams/avr23xx.sh: New file.
+ * emulparams/avr4433.sh New file.
+ * emulparams/avr44x4.sh New file.
+ * emulparams/avr85xx.sh New file.
+ * emulparams/avrmega103.sh New file.
+ * emulparams/avrmega161.sh New file.
+ * emulparams/avrmega603.sh New file.
+ * Makefile.in: Regenerate.
+
+2000-03-09 Andreas Jaeger <aj@suse.de>
+
+ * Makefile.am (check-DEJAGNU): Also unset LANG.
+ * Makefile.in: Rebuild.
+
+2000-03-06 Ian Lance Taylor <ian@zembu.com>
+
+ * ldfile.c (ldfile_try_open_bfd): Don't crash if we see an empty
+ archive.
+
+2000-03-02 H.J. Lu <hjl@gnu.org>
+
+ * emulparams/elf32mcore.sh: Include "getopt.h".
+
+2000-03-01 Ian Lance Taylor <ian@zembu.com>
+
+ * configure.tgt: Remove *-*-aout, *-*-coff, and *-*-netware.
+
+2000-03-01 H.J. Lu <hjl@gnu.org>
+
+ * emulparams/mipspe.sh: Add SUBSYSTEM and INITIAL_SYMBOL_CHAR.
+ * emulparams/shpe.sh: Likewise.
+
+2000-03-01 Nick Clifton <nickc@cygnus.com>
+
+ * pe-dll.c: Remove unused variables and add ATTRIBUTE_UNUSED
+ to unused parameters.
+
+ * emultempl/pe.em: Add "#ifdef DLL_SUPPORT" around static
+ functions only used by DLL code.
+ (_place_orphan): Initialise 'dollar'.
+
+2000-03-01 H.J. Lu <hjl@gnu.org>
+
+ * ldmain.c (undefined_symbol): Take one more arg, fatal, to
+ indicate if the undefined symbol is a fatal error or not.
+ Don't delete the output file if "fatal" is false.
+
+2000-02-29 H.J. Lu <hjl@gnu.org>
+
+ * Makefile.am (check-DEJAGNU): Also pass LIBS="$(LIBS)".
+ Set LC_COLLATE and LC_ALL to null and export them. It is for
+ sort which expects the C locale.
+ Add $(LIBS) to all $(HOSTING_LIBS).
+ * Makefile.in: Rebuild.
+
+2000-02-29 Alan Modra <alan@spri.levels.unisa.edu.au>
+
+ * emultempl/{aix.em, armcoff.em, armelf.em, armelf_oabi.em,
+ beos.em, elf32.em, generic.em, gld960.em, gld960c.em, hppaelf.em,
+ linux.em, lnk960.em, mipsecoff.em, sunos.em, vanilla.em}
+ (ld_emulation_xfer_struct): Add missing NULL initialiser for
+ find_potential_libraries.
+
+2000-02-28 Jim Blandy <jimb@redhat.com>
+
+ * ldgram.y (exclude_name_list): Don't require a comma to separate
+ list entries; the lexer considers commas to be valid part of a
+ filename, so in something like `foo, bar' the comma is considered
+ part of the first filename, `foo,'.
+ * ld.texinfo: Update section on EXCLUDE_FILE lists.
+
+2000-02-27 Loren J. Rittle <ljrittle@acm.org>
+
+ * configure.host: Added HOSTING_CRT0, HOSTING_LIBS for
+ host "i[3456]86-*-freebsdelf*".
+
+2000-02-27 Mark Elbrecht <snowball3@bigfoot.com>
+
+ * scripttempl/i386go32.sc: Move misplaced semicolons.
+
+2000-02-25 Ian Lance Taylor <ian@zembu.com>
+
+ * Makefile.am (ALL_EMULATIONS): Remove ehppaelf.o.
+ (ALL_64_EMULATIONS): Remove eelf64hppa.o.
+ (eelf64hppa.c, ehppaelf.c): Remove targets.
+ * Makefile.in: Rebuild.
+
+2000-02-25 Alexandre Oliva <oliva@lsd.ic.unicamp.br>
+
+ * configure.tgt (targ_extra_ofiles): Enable elf64_sparc on
+ GNU/Linux/sparc, but keep the default as 32.
+
+ * configure.tgt: Enable elf64_sparc on Solaris7+/sparc. And make
+ it default if sparcv9 or sparc64.
+
+2000-02-24 Nick Clifton <nickc@cygnus.com>
+
+ * Makefile.am: Add rules to build emipspe.o and earmpe.o.
+ * Makefile.in: Regenerate.
+ * configure.tgt: Add targets for arm-wince, sh-pe and mips-pe.
+
+ * ldemul.h (ld_emulation_xfer_struct): Add new field:
+ find_potential_libraries.
+ * ldemul.c (ldemul_find_potential_libraries): New function.
+
+ * ldfile.c (ldfile_open_file_search): Allow function to be
+ exported.
+ (ldfile_open_file): Call ldemul_find_potential_libraries.
+ * ldfile.h: Add prototype for ldfile_open_file_search.
+
+ * pe-dll.c: Add support for ARM, MIPS and SH targets.
+
+ * emulparams/mipspe.sh: New file. Parameters for mips-pe target.
+ * emulparams/shpe.sh: New file. Parameters for sh-pe target.
+
+ * emultempl/pe.em: Add support for ARM, MIPS and SH DLLs.
+ (gld_X_find_potential_libraries): New function. Search for
+ libraries called "*.lib".
+
+ * scriptempl/pe.sc: Add .pdata section.
+
+2000-02-23 Richard Henderson <rth@cygnus.com>
+
+ * scripttempl/elfd10v.sc: Remove dynamic linking hooks.
+ Add and use memory regions.
+
+2000-02-23 Linas Vepstas (linas@linas.org)
+
+ * emulparams/elf32i370.sh, scripttempl/elfi370.sc: New.
+
+ * Makefile.am: Add support for Linux/IBM 370.
+ * configure.tgt: Likewise.
+
+ * Makefile.in: Regenerate.
+
+2000-02-21 Alan Modra <alan@spri.levels.unisa.edu.au>
+
+ * ldlang.c (print_input_section, print_data_statement,
+ print_reloc_statement, print_padding_statement, insert_pad,
+ size_input_section, lang_check_section_addresses,
+ lang_size_sections, lang_do_assignments, lang_set_startof,
+ lang_one_common): Change `opb' to unsigned.
+ (lang_do_assignments): Also change `size' to unsigned.
+
+2000-02-16 Richard Henderson <rth@cygnus.com>
+
+ * scripttempl/elf.sc: Place OTHER_PLT_RELOC_SECTION.
+
+2000-02-16 Timothy Wall <twall@cygnus.com>
+
+ * mri.c (mri_draw_tree): Add default LMA region argument to call
+ to lang_leave_output_section_statement.
+ * ldlang.h: Update prototypes with LMA region arguments.
+ * ldlang.c (lang_size_sections): Encapsulate region bounds
+ checking in os_check_region call.
+ (os_check_region): New function.
+ (lang_output_section_statement_lookup): Initialize lma_region.
+ (lang_leave_output_section_statement): Add LMA region argument.
+ (lang_leave_overlay): Ditto.
+ * ldgram.y: Handle LMA region syntax.
+ * ld.texinfo (Output Section Description): Describe LMA region usage.
+ * emultempl/armelf.em (gld$place_orphan): Add default value for
+ lma region in call to lang_leave_output_statement.
+ * emultempl/elf32.em (gld$place_orphan): Add default value for
+ lma region in call to lang_leave_output_statement.
+ * emultempl/pe.em (gld$place_orphan): Add default value for
+ lma region in call to lang_leave_output_statement.
+
+
+2000-02-04 Timothy Wall <twall@redhat.com>
+
+ * ldlang.c (lang_check_section_addresses): Use bytes instead of
+ octets when calculating section end addresses.
+
+2000-02-04 Timothy Wall <twall@redhat.com>
+
+ * ldlang.c (lang_size_sections): Fix typo in ALIGN_N invocation.
+
+2000-02-03 Timothy Wall <twall@redhat.com>
+
+ * ld/ldexp.c (fold_name): Make SIZEOF operator return byte count, not
+ octet count.
+ * ld/ldlang.c (print_input_section, print_data_statement,
+ print_reloc_statement, print_padding_statement): Print target
+ address values and section sizes as bytes, not octets.
+ (insert_pad) Calculate padding size in octets, and adjust "dot"
+ by bytes.
+ (size_input_section) Always adjust "dot" by bytes, not octets.
+ (lang_check_section_addresses, lang_do_assignments) Adjust
+ "dot" by bytes, not octets. Use the larger of the directive size
+ or octets_per_byte for the number of octets actually allocated in
+ the output section.
+ (lang_set_startof) Make sure STARTOF returns a target address.
+ (lang_one_common) Record size changes in octets.
+ (lang_abs_symbol_at_end_of) Section end symbol's value is
+ recorded in target bytes.
+ * ld.texinfo: Updated description of BYTE, SHORT, LONG, etc.
+ to be clear about behavior when an octet is smaller than one byte.
+
+2000-01-27 Alan Modra <alan@spri.levels.unisa.edu.au>
+
+ * ldcref.c (output_cref): Don't pass message strings to printf
+ as format arg.
+ Update copyright.
+
+ * ldmisc.c (vfinfo): Same here.
+ Update copyright.
+
+2000-01-23 Alan Modra <alan@spri.levels.unisa.edu.au>
+
+ * emultempl/{armcoff.em,armelf.em,armelf_oabi.em,beos.em,
+ generic.em,gld960.em,gld960c.em,hppaelf.em,linux.em,lnk960.em,
+ mipsecoff.em,sunos.em,vanilla.em} (ld_emulation_xfer_struct):
+ Add missing NULL initialisers, and comments.
+
+ * testsuite/ld-srec/sr3.cc (__rethrow): New.
+
+2000-01-21 Nick Clifton <nickc@cygnus.com>
+
+ * ldlang.c (lang_size_sections): Fix typo in comment.
+
+2000-01-18 H.J. Lu <hjl@gnu.org>
+
+ * ldlang.c (lang_size_sections): Also update the current
+ address of a region if the SEC_NEVER_LOAD bit is not set.
+
+2000-01-10 Philip Blundell <pb@futuretv.com>
+
+ * configure.tgt (arm*-*-conix*): New target.
+
+2000-01-07 Nick Clifton <nickc@cygnus.com>
+
+ * ld.texinfo (Options): Remind users to preceed linker command
+ line switches with -Wl, (or whatever is appropriate) if it is
+ being invoked by a comnpiler driver program.
+ Fix description of the behaviour of the -n command line switch.
+
+Wed Jan 5 08:02:12 2000 Catherine Moore <clm@cygnus.com>
+
+ * ld.h (wildcard_spec): Change exclude_name to exclude_name_list.
+ (name_list): New.
+ * ld.texinfo (EXCLUDE_FILE): Update documentation.
+ * ldgram.y (wildcard_spec): Support a list of excluded_files.
+ (exclude_name_list): New.
+ ldlang.c (walk_wild_section): Support list of excluded files.
+ (print_wild_statement): Likewise.
+ (lang_add_wild): Likewise.
+ * ldlang.h (lang_wild_statement_type): Likewise.
+ * scripttempl/elf.sc (OTHER_EXCLUDE_FILES): Support.
+
+2000-01-04 Mumit Khan <khan@xraylith.wisc.edu>
+
+ * pe-dll.c (pe_dll_warn_dup_exports): New variable.
+ (process_def_file): Use.
+ (pe_dll_compat_implib): New variable.
+ (make_one): Use.
+
+ * pe-dll.h: Add exports of pe_dll_warn_dup_exports and
+ pe_dll_compat_implib.
+
+ * emultempl/pe.em (longopts): Add warn-duplicate-exports and
+ compat-implib options.
+ (gld_${EMULATION_NAME}_list_options): List new options.
+ (gld_${EMULATION_NAME}_parse_args): Handle.
+
+ * pe-dll.c (pe_dll_generate_implib): Use the correct name for output
+ dll.
+
+ * deffilep.y (opt_name): Allow "." in name.
+
+1999-12-02 Nick Clifton <nickc@cygnus.com>
+
+ * Makefile.am: Fix arm-epoc-pe dependencies.
+ * Makefile.in: Regenerate.
+
+ * emulparams/arm_epoc_pe.sh (SCRIPT_NAME): Set to epocpe.
+
+ * scripttempl/epocpe.sc: New file: copy of pe.sc, customised for
+ EPOC by placing .rdata into .text.
+
+1999-11-26 Andreas Schwab <schwab@suse.de>
+
+ * configure.in: Put AC_MSG_CHECKING/AC_MSG_RESULT around check for
+ STRINGIFY. Use yes/no instead of true/false as value for cache
+ variable.
+ * configure: Regenerate.
+
+1999-11-24 Nick Clifton <nickc@cygnus.com>
+
+ * ldlang.c (IGNORE_SECTION): Section must have both ALLOC and LOAD
+ attributes in order to be checked.
+
+1999-11-22 Nick Clifton <nickc@cygnus.com>
+
+ * ldlang.c (lang_check_section_addresses): Fix test to determine
+ if a section should be tested.
+ (IGNORE_SECTION): New macro.
+
+Wed Nov 3 23:31:19 1999 Jeffrey A Law (law@cygnus.com)
+
+ * emultempl/elf32.em (gld${EMULATION_NAME}_open_dynamic_archive):
+ Clean up code to use EXTRA_SHLIB_EXTENSION.
+
+1999-11-03 Nick Clifton <nickc@cygnus.com>
+
+ * emulparams/elf32mcore.sh (OUTPUT_FORMAT): Change to little endian.
+ * emulparams/mcorepe.sh (OUTPUT_FORMAT): Change to little endian.
+
+1999-11-01 Steve Chamberlain <sac@pobox.com>
+
+ * ldlang.c (section_already_linked): Rework to use hash table.
+ (already_linked_newfunc): New function.
+ (already_linked_table_init): New function.
+ (already_linked_table_free): New function.
+ (lang_process): Initialize and free the already_linked hash table.
+
+1999-10-27 Andreas Jaeger <aj@suse.de>
+
+ * ld/configure.host: Added HOSTING_CRT0, HOSTING_LIBS for
+ target "mips*-*-linux-gnu*".
+
+1999-10-27 Scott Bambrough <scottb@netwinder.org>
+
+ * emultempl/armelf.em: Include ctype.h to prevent compile time
+ warnings.
+
+1999-10-26 Nick Clifton <nickc@cygnus.com>
+
+ * emultempl/armcoff.em (gld{}_finish): Remove extraneous
+ underscore from prototype.
+ * emultempl/armelf.em (gld{}_finish): Remove extraneous
+ underscore from prototype.
+
+1999-10-07 Geoffrey Keating <geoffk@cygnus.com>
+
+ * scripttempl/elf.sc (.rel.sdata): Combine all the sdata relocs
+ being .rel.sdata, .rel.sdata.*, .rel.gnu.linkonce.s*.
+ (.rela.sdata): Likewise for .rela.sdata.* and .rela.gnu.linkonce.s*.
+ (.rel.sbss): Make like .rel.bss.
+ (.rela.sbss): Make like .rel.bss.
+ (.sdata): Don't include .gnu.linkonce.s.* or .sdata.* when
+ ld -r.
+ (.sbss): Do the same things as for .bss: include SDATA_START_SYMBOLS,
+ .dynsbss.
+
+1999-09-29 Andrew Haley <aph@cygnus.com>
+
+ * emultempl/pe.em (gld_${EMULATION_NAME}_place_orphan): Defer
+ merging sections when not relocating.
+
+1999-09-28 Mumit Khan <khan@xraylith.wisc.edu>
+
+ * pe-dll.c (process_def_file): Move the offset lookup from here to
+ (fill_exported_offsets): here. New static function.
+ (fill_edata): Use.
+
+1999-09-28 Mumit Khan <khan@xraylith.wisc.edu>
+
+ * deffilep.y (tokens): Add upper and lower case versions of DATA,
+ CONSTANT, NONAME and PRIVATE tokens.
+ (command): Use DATAU.
+ (expline): Allow for drectve syntax as well.
+ (exp_opt_list): Likewise.
+ (exp_opt): Likewise.
+ * pe-dll.c (make_one): Only generate the idata entries for data
+ symbols.
+
+1999-09-28 Geoffrey Keating <geoffk@cygnus.com>
+
+ * scripttempl/elf.sc (.sdata): Include .gnu.linkonce.s.* sections
+ in .sdata too.
+
+1999-09-26 Nick Clifton <nickc@cygnus.com>
+
+ * scripttempl/elf.sc (.bss): Accept sections named .bss.*
+ (.sbss): Accept sections names .sbss.*
+
+1999-09-22 Nick Clifton <nickc@cygnus.com>
+
+ * Makefile.am: Add earm_epoc_pe.c build target.
+
+Sat Sep 18 07:57:10 1999 Jeffrey A Law (law@cygnus.com)
+
+ * emulparms/elf64hppa.sh (OTHER_READONLY_SYMBOLS): Remove ".stubs",
+ they've been renamed to ".stub", which is handled automatically
+ by elf.sc.
+
+Fri Sep 17 11:00:33 1999 Jeffrey A Law (law@cygnus.com)
+
+ * emulparms/elf64hppa.sh (TEXT_START_SYMBOLS): Kill completely.
+ (DATA_START_SYMBOLS): Kill __hp_load_map definition
+
+Thu Sep 16 10:59:56 1999 Jeffrey A Law (law@cygnus.com)
+
+ * emultempl/elf32.em (gld${EMULATION_NAME}_open_dynamic_archive):
+ Use the same filename extension for the bfd_elf_dt_needed_name call
+ as we did for finding the library.
+
+ * emulparms/elf64hppa.sh (DATA_START_SYMBOLS): Define.
+ (OTHER_READWRITE_SECTIONS): No longer define __hp_load_map.
+
+ * emulparms/elf64hppa.sh (TEXT_START_SYMBOLS): Define.
+
+Wed Sep 15 02:47:43 1999 Jeffrey A Law (law@cygnus.com)
+
+ * emulparms/elf64hppa.sh (SHLIB_TEXT_START_ADDR): Define.
+ (SHLIB_DATA_ADDR): Likewise.
+
+ * emulparms/elf64hppa.sh (TEXT_DYNAMIC): Define.
+
+ * emulparms/elf64hppa.h (OTHER_READWRITE_SECTIONS): No longer combine
+ the .plt, .dlt, .opd into a single output section. Provide values
+ for __gp and __hp_load_map.
+
+1999-09-14 Michael Meissner <meissner@cygnus.com>
+
+ * configure.in (Canonicalization of target names): Remove adding
+ ${CONFIG_SHELL} in front of $ac_config_sub, since autoconfig 2.14
+ generates $ac_config_sub with a ${CONFIG_SHELL} already.
+ * configure: Regenerate.
+
+1999-09-14 Donn Terry <donn@interix.com>
+
+ * emultempl/pe.em (gld_${EMULATION_NAME}_after_open): allow for
+ terminating null.
+
+1999-09-14 Ulrich Drepper <drepper@cygnus.com>
+
+ * configure.in: Define EXTRA_SHLIB_EXTENSION to ".sl" for HP target.
+ * config.in: Add EXTRA_SHLIB_EXTENSION.
+
+ * emultempl/elf32.em (gld${EMULATION_NAME}_open_dynamic_archive):
+ Search for second shared lib extension only if EXTRA_SHLIB_EXTENSION
+ is defined.
+
+1999-09-14 Nick Clifton <nickc@cygnus.com>
+
+ * Makefile.in: Add earm_epoc_pe.c build target.
+
+Tue Sep 14 05:26:34 1999 Jeffrey A Law (law@cygnus.com)
+
+ * emulparms/elf64hppa.sh (OTHER_GOT_RELOC_SECTIONS): Add .rela.dlt.
+
+1999-09-13 Donn Terry <donn@interix.com>
+
+ * emultempl/pe.em: Remove the output file at the start, in case it
+ is not writable.
+
+Mon Sep 13 00:17:18 1999 Jeffrey A Law (law@cygnus.com)
+
+ * emultempl/elf32.em (gld${EMULATION_NAME}_open_dynamic_archive):
+ Search for file with .sl extension if no file with a .so extension
+ is found.
+
+ * emulparms/elf64hppa.sh (OTHER_READWRITE_SECTIONS): Put .plt
+ at the start of the .dlt output section.
+
+1999-09-12 Ian Lance Taylor <ian@zembu.com>
+
+ * pe.em: Don't include "../bfd/libbfd.h".
+ (gld_${EMULATION_NAME}_after_open): Use xmalloc rather than
+ bfd_alloc.
+
+ * pe-dll.h: New file.
+ * pe-dll.c: Include "pe-dll.h". Mark unused arguments as needed
+ to avoid warnings.
+ (edata_sz, reloc_sz): Change from int to size_t.
+ (pe_details_type): Change type of imagebase_reloc from int to
+ unsigned int.
+ (pe_detail_list): Fully initialize last entry.
+ (pe_dll_id_target): Change parameter to const.
+ (pe_dll_generate_def_file): Likewise.
+ (pe_dll_generate_implib): Likewise.
+ (pe_implied_import_dll): Likewise. Change dll_name to const.
+ * emultempl/pe.em: Include "pe-dll.h". Remove declarations now in
+ pe-dll.h.
+ (init): Fully initialize __dll__ entry.
+ (gld_${EMULATION_NAME}_after_open): Remove unused variables
+ sequence, elt, and i.
+ * deffile.h: Add preprocessor guard.
+ * deffilep.y (def_debug): Remove.
+ * Makefile.am: Rebuild dependencies.
+ (HFILES): Add pe-dll.h.
+
+1999-09-12 Donn Terry <donn@interix.com>
+
+ * ld.h (ld_abort): Declare.
+ (abort): Define.
+ * ldmisc.c (ld_abort): Define.
+
+ * scripttempl/pe.sc: Use ${ENTRY} rather than _mainCRTStartup.
+ Move .bss section after .rdata. Move .reloc section after .rsrc.
+
+ * lexsup.c (parse_args): Use strtoul for --split-by-reloc
+ argument.
+
+ * lexsup.c (parse_args): If we get an unrecognized argument,
+ mention --help.
+
+ * ldlang.c (section_already_linked): Use comdat information if it
+ is available.
+
+ * emultempl/pe.em (PE_DEF_SECTION_ALIGNMENT): If
+ OVERRIDE_SECTION_ALIGNMENT is defined, change to that.
+ (gld_${EMULATION_NAME}_before_parse): Use EXECUTABLE_NAME if it is
+ defined, rather than a.exe.
+ (init): Define __subsystem__ as ${SUBSYSTEM}.
+ (set_pe_subsystem): Add ${INITIAL_SYMBOL_CHAR} before entry symbol
+ name.
+
+1999-09-12 Ian Lance Taylor <ian@zembu.com>
+
+ * ldlang.c (open_output): Change local variable desired_endian
+ from int to enum bfd_endian.
+
+ * emulparams/arm_epoc_pe.sh: Define ENTRY, SUBSYSTEM and
+ INITIAL_SYMBOL_CHAR.
+ * emulparams/armpe.sh: Likewise.
+ * emulparams/morepe.sh: Likewise.
+ * emulparams/ppcpe.sh: Likewise.
+ * emulparams/i386pe.sh (ENTRY): Define as _mainCRTStartup.
+ (SUBSYSTEM): Define as PE_DEF_SUBSYSTEM.
+
+Fri Sep 10 00:22:50 1999 Jeffrey A Law (law@cygnus.com)
+
+ * emulparms/elf64hppa.sh (LIB_PATH): Define.
+
+ * emulparms/elf64hppa.sh (OTHER_READONLY_SECTIONS): Put stubs before
+ unwinders so that they are closer to the text section.
+ (OTHER_BSS_SECTIONS): Define.
+ (EXECUTABLE_SYMBOLS): Provide __SYSTEM_ID and _FPU_STATUS.
+ (INIT_START, INIT_END): Define.
+ (FINI_START, FINI_END): Define.
+ * scripttempl/elf.sc: Add support for INIT_START, INIT_END,
+ FINI_START, FINI_END and OTHER_BSS_SECTIONS.
+
+Thu Sep 9 21:43:58 1999 Jeffrey A Law (law@cygnus.com)
+
+ * emulparms/elf64hppa.sh (TEXT_START_ADDR): Move up one page.
+ (DATA_ADDR): Define.
+
+1999-09-09 Stan Shebs <shebs@andros.cygnus.com>
+
+ * emulparams/d10velf.sh (READONLY_START_ADDR): Set to 0x2000004.
+
+1999-09-09 Andreas Schwab <schwab@suse.de>
+
+ * ld.texinfo: Fix arguments of @var to not contain punctuation.
+
+Thu Sep 9 05:52:34 1999 Jeffrey A Law (law@cygnus.com)
+
+ * emulparms/elf64hppa.sh (OTHER_READWRITE_SECTIONS): Define.
+
+1999-09-08 Ulrich Drepper <drepper@cygnus.com>
+
+ * emulparams/elf64hppa.sh (ELFSIZE): New. Set to 64.
+
+Wed Sep 8 00:07:39 1999 Jeffrey A Law (law@cygnus.com)
+
+ * emulparms/elf64hppa.sh (ENTRY): Define to main.
+
+1999-09-03 Scott Bambrough <scottb@netwinder.org>
+
+ * ld/configure.host: Added HOSTING_CRT0, HOSTING_LIBS for
+ target "arm*-*-linux-gnu*"
+
+1999-09-04 Steve Chamberlain <sac@pobox.com>
+
+ * configure.tgt (pjl-*-*, pj-*-*): New targets.
+ * emulparams/pjelf.sh: New file.
+ * emulparams/pjlelf.sh: New file.
+ * scripttempl/pj.sc: New file.
+ * Makefile.am (ALL_EMULATIONS): Add epjelf.o and epjlelf.o.
+ (epjelf.o, epjlelf.o): New targets.
+ * Makefile.in: Rebuild.
+
+Fri Sep 3 20:17:08 1999 Jeffrey A Law (law@cygnus.com)
+
+ * emulparams/elf64hppa.sh (MAXPAGESIZE): Define.
+ (OTHER_READONLY_SECTIONS, DATA_PLT): Likewise.
+
+Thu Sep 2 14:32:03 1999 Jeffrey A Law (law@cygnus.com)
+
+ * emulparams/elf64hppa.sh: New file.
+ * configure.tgt (hppa*w-*-*): Use elf64hppa emulation.
+ * Makefile.am (ALL_64_EMULATIONS): Add eelf64hppa.o
+ (eelf64hppa.c): Add dependencies.
+ * Makefile.in: Rebuilt.
+
+1999-08-25 Philip Blundell <pb@nexus.co.uk>
+
+ * emulparams/armelf.sh (OTHER_BSS_SYMBOLS): Add __end__.
+ * emulparams/armelf_linux.sh: Likewise.
+ * emulparams/armelf_linux26.sh: Likewise.
+
+1999-08-24 Nick Clifton <nickc@cygnus.com>
+
+ From a patch submitted by Roland McGrath <roland@baalperazim.frob.com>
+
+ * configure.tgt (arm-*-netbsd*): New target.
+ * Makefile.am (ALL_EMULATIONS): Add earmnbsd.o.
+ (earmnbsd.c): New rule with deps.
+ * Makefile.on: Regenerate.
+ * emulparams/armnbsd.sh: New file.
+
+1999-08-23 Nick Clifton <nickc@cygnus.com>
+
+ * emulparams/elf32mcore.sh (PARSE_AND_LIST_ARGS): Define.
+ Implement --base-file command line switch.
+
+ * emultempl/elf32.em: Add ability for individual targets to have
+ their own command line switches by defining PARSE_AND_LIST_ARGS.
+
+1999-08-19 Andreas Schwab <schwab@suse.de>
+
+ * configure.host: Use ${CC} instead of gcc for finding compiler
+ related files.
+
+1999-08-11 Nick Clifton <nickc@cygnus.com>
+
+ * scripttempl/mcorepe.sc (OUTPUT_FORMAT): Fix typo.
+
+1999-08-09 Mark Elbrecht <snowball3@bigfoot.com>
+
+ * scripttempl/i386go32.sc: Handle g++ exception sections.
+
+1999-08-09 Ian Lance Taylor <ian@zembu.com>
+
+ From Wally Iimura <iimura@microunity.com>:
+ * ldlang.c (lang_size_sections): When checking whether an address
+ is within a region, don't get confused by wrapping around at the
+ end of the address space.
+
+1999-08-08 Ian Lance Taylor <ian@zembu.com>
+
+ * ldlang.c (wild_doit): Update for renaming of SEC_SHORT to
+ SEC_SMALL_DATA.
+
+ * Makefile.am: Rename .dep* files to DEP*. Change DEP variable to
+ MKDEP. Rebuild dependencies.
+ * Makefile.in: Rebuild.
+
+1999-08-08 Jakub Jelinek <jj@ultra.linux.cz>
+
+ * configure.host (sparc-*-linux-gnu*): New host.
+ (sparc64-*-linux-gnu*): New host.
+
+1999-08-06 Ian Lance Taylor <ian@zembu.com>
+
+ * lexsup.c (is_num): Reindent.
+ (parse_args): Mention program name in error message.
+
+ * emultempl/ostring.sed: Rename from stringify.sed.
+ * emultempl/astring.sed: New file.
+ * Makefile.am (stringify.sed): New target.
+ (GEN_DEPENDS): Change $(srcdir)/emultempl/stringify.sed to
+ stringify.sed.
+ * configure.in: Define and substitute STRINGIFY.
+ * emultempl/*.em: Use stringify.sed from build directory rather
+ than source directory.
+ * emultempl/elf32.em: Use stringify.sed rather than inline sed
+ script.
+ * emultempl/gld960.em, emultempl/gld960c.em: Likewise.
+ * emultempl/hppaelf.em, emultempl/linux.em: Likewise.
+ * emultempl/lnk960.em, emultempl/sunos.em: Likewise.
+ * configure, Makefile.in: Rebuild.
+
+1999-08-05 Donn Terry <donn@interix.com>
+
+ * emulparams/i386pe.sh: Define ENTRY, SUBSYSTEM, and
+ INITIAL_SYMBOL_CHAR.
+ * emulparams/i386pe_posix.sh: New file.
+ * Makefile.am (YACC): If bison is not in the source tree, use
+ @YACC@ rather than bison -y.
+ (LEX): If flex is not in the source tree, use @LEX@ rather than
+ flex.
+ (ALL_EMULATIONS): Add ei386pe_posix.o.
+ (ei386pe_posix.c): New target.
+ * configure.tgt (i[3456]86-*-interix*): New target.
+ * configure.host (i[3456]86-pc-interix*): New host.
+ * Makefile.in: Rebuild.
+
+1999-08-03 Ian Lance Taylor <ian@zembu.com>
+
+ * emulparams/elf32ppc.sh (MAXPAGESIZE): Change to 0x10000.
+ * emulparams/elf32ppclinux.sh (MAXPAGESIZE): Likewise.
+
+1999-08-03 H.J. Lu <hjl@gnu.org>
+
+ * Makefile.am (ALL_EMULATIONS): Remove ego32.o.
+ (ego32.c): Remove.
+ * Makefile.in: Rebuild.
+
+1999-07-22 Philip Blundell <pb@nexus.co.uk>
+
+ * emulparams/armelf_linux26.sh (DATA_START_SYMBOLS): Define.
+ (OTHER_BSS_SYMBOLS, OTHER_BSS_END_SYMBOLS): Likewise.
+ * emulparams/armelf_linux.sh (DATA_START_SYMBOLS): Define.
+
+ * configure.tgt (arm*-*-uclinux*, thumb-*-uclinux*,
+ thumb-*-linux-gnu*): New targets.
+
+1999-07-21 Mark Elbrecht <snowball3@bigfoot.com>
+
+ * scripttempl/i386go32.sc: Add handling of linkonce sections.
+
+ * configure.bat: Remove; obsolete.
+ * emulparams/go32.sh: Remove; obsolete.
+ * scripttempl/go32coff.sc: Remove; obsolete.
+
+1999-07-21 H.J. Lu <hjl@gnu.org>
+
+ * configure.tgt (mips*el-*-vxworks*): New target.
+
+1999-07-21 Brad M. Garcia <bgarcia@fore.com>
+
+ * configure.tgt (i[3456]86-*-vxworks*): New target.
+
+Tue Jul 20 15:18:46 1999 Bob Manson <manson@charmed.cygnus.com>
+
+ * ldlang.c (lang_gc_sections): Only handle the start symbol
+ specially if there is one.
+
+Mon Jul 19 14:19:14 1999 Mark P. Mitchell <mark@codesourcery.com>
+
+ * emulparams/elf32bmipn32.sh (OTHER_RELOCATING_SECTIONS): Add
+ .MIPS.events and .MIPS.content handling.
+ * emulparams/elf64bmip.sh (OTHER_RELOCATING_SECTIONS): Likewise.
+
+1999-07-17 Nick Clifton <nickc@cygnus.com>
+
+ * ldlang.c (get_target): New function: Return true iff the
+ given target is the target being sought.
+ (stricpy): New function: Like strcpy but convert to lower
+ case as well.
+ (strcut): New function: Like strstr but remove the located
+ substring as well.
+ (name_compare): New function: Compute a compatability rating
+ for two target names.
+ (winner): New variable: Best target found by
+ closest_target_match() so far.
+ (closest_target_match): New function: Find the target which is
+ the closest match to the original target.
+ (get_first_input_target): New function: Find the target format
+ of the first of the linker's input file.
+ (open_output): Be more clever about deciding the output target
+ format.
+
+1999-07-16 Jakub Jelinek <jj@ultra.linux.cz>
+
+ * emulparams/elf64_sparc.sh: Add 64-bit directories to native LIB_PATH.
+
+Thu Jul 15 15:55:15 1999 Mark P. Mitchell <mark@codesourcery.com>
+
+ * configure.host: Set up HOSTING_CRT0 and HOSTING_LIBS for IRIX6.
+
+1999-07-15 Ian Lance Taylor <ian@zembu.com>
+
+ * configure.in: Bump version number to 2.9.5.
+ * configure: Rebuild.
+
+1999-07-14 Richard Henderson <rth@cygnus.com>
+
+ * ldlang.c (wild_doit): Copy SEC_SHORT to output section.
+
+ * scripttempl/elf.sc: Re-order .rel[a].foo outputs to the
+ same order seen for the main sections. Add
+ OTHER_READONLY_RELOC_SECTIONS and OTHER_GOT_RELOC_SECTIONS.
+
+1999-07-12 Andreas Schwab <schwab@suse.de>
+
+ * emultempl/linux.em (ld_${EMULATION_NAME}_emulation): Fill in
+ structure initializations.
+
+ * emultempl/elf32.em (ld_${EMULATION_NAME}_emulation): Add missing
+ comma in initializer.
+
+1999-07-11 Ian Lance Taylor <ian@zembu.com>
+
+ * Many files: Changes to avoid gcc warnings: Add ATTRIBUTE_UNUSED
+ as appropriate. Fill in structure initializations.
+
+1999-07-10 Ian Lance Taylor <ian@zembu.com>
+
+ * ldfile.c: Revert patch of 1999-07-08.
+ (ldfile_try_open_bfd): If we are searching for the file, skip
+ files with an incompatible architecture.
+
+1999-07-09 Nick Clifton <nickc@cygnus.com>
+
+ * scripttempl/armcoff.sc (OUTPUT_FORMAT): Include big endian and
+ little endian formats.
+
+1999-07-08 Felix Lee <flee@cygnus.com>
+
+ * scripttempl/mcorepe.sc: fix quoting problem, for bash 2.x
+
+1999-07-08 Jakub Jelinek <jj@ultra.linux.cz>
+
+ * ldfile.c (ldfile_open_file_search): Skip libraries made for
+ incompatible architectures in the search path. Let the user know
+ about any such skips.
+
+Thu Jul 8 12:32:23 1999 John David Anglin <dave@hiauly1.hia.nrc.ca>
+
+ * configure.tgt (hppa*-linux-gnu*): New target.
+
+1999-07-07 Mark Mitchell <mark@codesourcery.com>
+
+ * Makefile.am (ALL_64_EMULATIONS): Add eelf64bmip.
+ (eelf64bmip): New target.
+ * Makefile.in: Regenerated.
+ * configure.tgt (mips-sgi-irix6*): Add 64-bit emulation.
+ * emulparams/elf64bmip.sh: New file.
+
+1999-07-05 Nick Clifton <nickc@cygnus.com>
+
+ * emultempl/pe.em (after_open): Abort if input format is ARM and
+ output format is not.
+ * emultempl/armcoff.em (after_open): Abort if input format is ARM
+ and output format is not.
+ * emultempl/armelf.em (after_open): Abort if input format is ARM
+ and output format is not.
+
+1999-07-02 Ian Lance Taylor <ian@zembu.com>
+
+ * ldlang.c: Revert change of 1999-06-23.
+
+1999-06-30 Mark Mitchell <mark@codesourcery.com>
+
+ * Makefile.am (ALL_EMULATIONS): Add eelf32bmipn32.o.
+ (eelf32bmipn32.c): New target.
+ * Makefile.in: Regenerated.
+ * configure.tgt (mips-sgi-irix6*): Make n32 the default
+ emulation.
+ * emulparams/elf32bmipn32.sh: New file.
+
+1999-06-28 Jim Pick <jim@jimpick.com>
+
+ * emultempl/armelf.em: Added code so that .xs linker scripts are
+ called so that ARM shared libraries are built correctly.
+
+1999-06-22 Mark Mitchell <mark@codesourcery.com>
+
+ * ldmain.c (main): Initialize link_info.init_function and
+ link_info.fini_function.
+ * lexsup.c (OPTION_INIT): New macro.
+ (OPTION_FINI): Likewise.
+ (ld_options): Add descriptions for them.
+ (parse_args): Handle them.
+
+1999-06-23 Ian Lance Taylor <ian@zembu.com>
+
+ * ldlang.c (section_already_linked): Only discard link once
+ sections if we are building constructors.
+
+1999-06-22 Nick Clifton <nickc@cygnus.com>
+
+ * ld.texinfo (Location Counter): Describe behaviour of
+ location counter inside section statements.
+
+1999-06-20 Mark Mitchell <mark@codesourcery.com>
+
+ * scripttempl/elf.sc (WRITABLE_RODATA): New variable for
+ controlling whether or not .rodata is in the data segment or the
+ text segment.
+
+1999-06-18 Nick Clifton <nickc@cygnus.com>
+
+ * emultempl/pe.em: Add new command line switch --thumb-entry.
+ * emultempl/armelf.em: Add new command line switch --thumb-entry.
+ * emultempl/armcoff.em: Add new command line switch --thumb-entry.
+ * ld.texinfo: Document new ARM command line switch: --thumb-entry.
+1999-06-20 H.J. Lu <hjl@gnu.org>
+
+ * configure.in (all_libpath): Accumulate across all enabled targets.
+
+Sun Jun 20 14:10:33 1999 Richard Henderson <rth@cygnus.com>
+
+ * emultempl/armelf.em: Watch EMULATION_LIBPATH instead of
+ DEFAULT_EMULATION.
+ * emultempl/elf32.em: Likewise.
+ * emultempl/sunos.em: Likewise.
+
+Fri Jun 18 15:24:48 1999 Richard Henderson <rth@cygnus.com>
+
+ * Makefile.am (GENSCRIPTS): Pass EMULATION_LIBPATH, not EMUL.
+ * configure.in (all_emuls): Add targ_extra_libpath.
+ (all_libpath, EMULATION_LIBPATH): Define.
+ * configure.tgt (powerpc-*-linux-gnu*): Define targ_extra_libpath.
+ * genscripts.sh (LIB_PATH): Define if emulation in EMULATION_LIBPATH.
+
+Mon Jun 14 10:38:36 1999 Andreas Schwab <schwab@issan.cs.uni-dortmund.de>
+
+ * ld.texinfo: Fix use of @item vs. @itemx.
+
+1999-06-13 Ian Lance Taylor <ian@zembu.com>
+
+ From Thomas Zenker <thz@lennartz-electronic.de>:
+ * ldgram.y (attributes_opt): Use attributes_list instead of NAME.
+ (attributes_list, attributes_string): New nonterminals.
+ * ldlang.c (lang_set_flags): Add invert parameter. Don't handle
+ '!'.
+ * ldlang.c (lang_set_flags): Update declaration.
+
+1999-06-12 Ian Lance Taylor <ian@zembu.com>
+
+ * emultempl/pe.em (gld_${EMULATION_NAME}_after_parse): Don't add
+ entry_symbol as an undefined symbol when doing a relocateable
+ link. From <jeffdb@goodnet.com>.
+
+1999-06-12 David O'Brien <obrien@freebsd.org>
+
+ * configure.tgt: (i[3456]86-*-freebsd*): Now defaults to ELF.
+
+1999-06-09 Nick Clifton <nickc@cygnus.com>
+
+ * lexsup.c (help): Restore previous format of output.
+
+1999-06-04 Nick Clifton <nickc@cygnus.com>
+
+ * emultempl/pe.em: If compiling for arm_epoc_pe rename
+ interworking functions to avoid a name space clash.
+
+1999-06-02 Jason Merrill <jason@yorick.cygnus.com>
+
+ * scripttempl/v850.sc: Add initp support.
+
+1999-06-02 Nick Clifton <nickc@cygnus.com>
+
+ * emultempl/pe.em: Rename global arm interworking functions to
+ avoid name collision when all targets BFD is built.
+
+1999-05-30 Cort Dougan <cort@attis.cs.nmt.edu>
+
+ * Makefile.am (ALL_EMULATIONS): Add eelf32ppclinux.o.
+ * configure.tgt (powerpc-*-linux-gnu): Use it.
+ * emulparams/elf32ppclinux.sh: New file.
+
+1999-05-29 Ian Lance Taylor <ian@zembu.com>
+
+ * ld.texinfo (Options): Clarify that options which refer to files
+ must be properly ordered.
+
+1999-05-29 Nick Clifton <nickc@cygnus.com>
+
+ * emultempl/armelf.em (..._parse_args): New function: Parse
+ command line option. Accept arm-elf specific command line option
+ '-p' or '--no-pipeline-knowledge'.
+ (..._list_options): New function: Describe the new command line
+ option.
+ (..._before_allocation): Pass the value of the new variable
+ no_pipeline_knowledge to bfd_elf32_arm_process_before_allocation.
+
+ * emultemp/armelf_oabi.em (..._before_allocation): Pass zero as
+ the third parameter to bfd_elf32_arm_process_before_allocation.
+
+1999-05-28 Nick Clifton <nickc@cygnus.com>
+
+ * lexsup.c (help): Minor formatting changes.
+
+1999-05-28 Martin Dorey <mdorey@madge.com>
+
+ * configure.tgt (i960-*-elf*): New target.
+ * emulparams/elf32_i960.sh: New file.
+ * Makefile.am (ALL_EMULATIONS): Add eelf32_i960.o.
+ (eelf32_i960.c): New target.
+ * Makefile.in: Rebuild.
+
+1999-05-26 Nick Clifton <nickc@cygnus.com>
+
+ * emulparams/armelf_oabi.sh (TEMPLATE_NAME): Set to armelf_oabi.
+
+1999-05-24 Philip Blundell <philb@gnu.org>
+
+ * emultempl/armelf.em (before_parse): Set config.dynamic_link and
+ config.has_shared.
+ * emulparams/armelf.sh (GENERATE_SHLIB_SCRIPT): Define.
+ * emulparams/armelf_linux.sh (GENERATE_SHLIB_SCRIPT): Likewise.
+
+1999-04-13 Philip Blundell <philb@gnu.org>
+
+ * emultempl/armelf.em: Add definitions related to shared objects
+ (copied from elf32.em).
+
+Wed May 19 12:44:26 1999 Andreas Schwab <schwab@issan.cs.uni-dortmund.de>
+
+ * Makefile.am (ALL_EMULATIONS): Remove earmlinux.o and
+ earm26linux.o, add earmelf_linux.o and earmelf_linux26.o.
+ * Makefile.in: Regenerated.
+
+1999-05-16 Nick Clifton <nickc@cygnus.com>
+
+ * emulparams/elf32mcore.sh (GENERATE_SHLIB_SCRIPT): Define.
+ (TEMPLATE_NAME): Define.
+
+Thu May 13 09:48:09 1999 Joel Sherrill (joel@OARcorp.com)
+
+ * configure.tgt (i386-*-rtemself*, sh-*-rtemself*): New targets.
+ (mips*el-*-rtems*, powerpcle-*-rtems*): New targets.
+
+1999-05-10 DJ Delorie <dj@cygnus.com>
+
+ * scripttempl/pe.sc: Specify the output arch, which Ian says is
+ the Right Thing to do.
+
+ * emultempl/pe.em: various changes to parameterize the
+ target-specific information.
+ (gld_i386pe_after_open): Detect and fix MS import libraries
+ by renaming the member objects (which are all named the same).
+
+ * pe-dll.c: various changes to parameterize the target-specific
+ information.
+ (generate_reloc): support relocs more generically to allow for
+ expansion.
+ (pe_exe_build_sections): new; used to add .relocs to .exes
+ (pe_exe_fill_sections): ditto
+
+1999-05-10 Catherine Moore <clm@cygnus.com>
+
+ * emultempl/pe.em (gld_${EMULATION_NAME}_after_open):
+ Check for TARGET_IS_arm_epoc_pe.
+ (gld_${EMULATION_NAME}_before_allocation): Likewise.
+
+1999-05-12 Anthony Green <green@cygnus.com>
+
+ * ldlang.c (walk_wild, walk_wild_file, walk_wild_section,
+ output_section_callback, gc_section_callback): New functions for
+ generic section walks.
+ (wild, lang_gc_wild): Use walk_wild.
+ (wild_file, lang_gc_wild_file): Deleted. Common logic moved to
+ walk_wild_file.
+ (wild_section, lang_gc_wild_section): Deleted. Common logic moved
+ to walk_fild_section. Unique logic moved into callbacks
+ output_section_callback and gc_section_callback.
+
+1999-04-26 Tom Tromey <tromey@cygnus.com>
+
+ * aclocal.m4, configure: Updated for new version of libtool.
+
+1999-04-12 Philip Blundell <pb@nexus.co.uk>
+
+ * emulparams/armelf_linux.sh: New file. Support for ARM
+ GNU/Linux ELF ABI.
+ * emulparams/armelf_linux26.sh: New file. APCS-26 version of above.
+ * configure.tgt: For arm*-*-linux-gnu*, set default emulation to
+ `armelf_linux', and also include `armelf_linux26' and `armelf'.
+ * Makefile.am: Add rules to make earmlinux.c and earmlinux26.c.
+ (ALL_EMULATIONS): Add earmlinux.o and earmlinux26.o.
+ * Makefile.in: Regenerate.
+
+1999-04-11 Richard Henderson <rth@cygnus.com>
+
+ * Makefile.am (ALL_EMULATIONS): Add elf_i386_be.o.
+ * configure.tgt (i[3456]86-*-beos*): Use it.
+ * emulparams/elf_i386_be.sh: New file.
+ * Makefile.in: Rebuild.
+
+ * configure.in (environ): Detect declaration.
+ * ldmain.c (main): Don't declare environ.
+ * sysdep.h (environ): Declare if needed.
+ * configure, config.in: Rebuild.
+
+1999-04-11 Richard Henderson <rth@cygnus.com>
+
+ * ldgram.y (ldgram_vers_current_lang): New.
+ (vers_defns): Accept `extern "lang" { }' syntax.
+ * ldlex.l (vers_node_nesting): New.
+ (V_IDENTIFIER): Accept . and $ in symbols.
+ (VERS_NODE): Accept `extern "lang" { }' tokens. Nest VERS_NODE states.
+ * ldlang.c (lang_new_vers_regex): New `lang' argument. Update callers.
+ (lang_vers_match_lang_c): New function.
+ (lang_vers_match_lang_cplusplus): New function.
+ (lang_vers_match_lang_java): New function.
+ (lang_do_version_exports_section): Fix iteration. Don't free
+ section contents, as it is still in use by the patterns.
+
+1999-04-10 Richard Henderson <rth@cygnus.com>
+
+ * ldmain.c (main): Init link_info.no_undefined.
+ * lexsup.c: Add command-line option --no-undefined.
+
+1999-04-06 Ian Lance Taylor <ian@zembu.com>
+
+ * ld.h (LC_MESSAGES): Never define.
+ * ldmain.c (main): Don't pass LC_MESSAGES to setlocale if the
+ system does not define it.
+
+1999-04-06 H.J. Lu <hjl@gnu.org>
+
+ * ldmain.h (demangling): Declare.
+ * ldmain.c (demangling): New global variable.
+ (main): Initialize demangling.
+ * ldmisc.c (vfinfo): Don't demangle symbol if ! demangling.
+ * lexsup.c (ld_options, parse_args): Handle --demangle and
+ --no-demangle.
+ * ld.texinfo, ld.1: Document --demangle/--no-demangle.
+
+ * ldlex.l (V_IDENTIFIER): Allow '.' in symbol.
+
+1999-04-05 Chris Torek <torek@BSDI.COM>
+
+ * emultempl/sunos.em (gld${EMULATION_NAME}_search_dir): Check that
+ a shared library really exists, avoiding broken symlinks.
+
+ * ldfile.c (ldfile_open_file): Generate a better error message if
+ we can't find a -l file.
+
+1999-04-05 DJ Delorie <dj@cygnus.com>
+
+ * configure.tgt (i386-*-pe): add targ_extra_ofiles for other PE
+ targets (i386-pe and i386-winnt)
+
+1999-04-04 Ian Lance Taylor <ian@zembu.com>
+
+ * deffilep.y: Include "sysdep.h" and "ldmisc.h".
+ (def_file_add_directive): Change return type to void. Remove
+ unused locals sh_reserve, sh_commit, and j.
+ (def_ungetc): Always return a value.
+ (def_lex): Correct parenthesization of || within &&.
+ * deffile.h (def_file_add_directive): Update declaration.
+ * pe-dll.c: Include <time.h>, <ctype.h>, and "ldemul.h".
+ (generate_edata): Remove unused local i.
+ (quoteput): Add cast to avoid warning.
+ (pe_dll_generate_def_file): Fix type in format string.
+ (quick_symbol): Remove unused local blhe.
+ (pe_dll_generate_implib): Add cast to avoid warning.
+ (pe_process_import_defs): Remove unused locals ar_head, ar_tail,
+ and n.
+ (pe_as16): Comment out.
+
+1999-04-04 Don Bowman <don@pixsci.com>
+
+ * configure.tgt: Add mips*-*-vxworks* target.
+
+1999-03-31 Nick Clifton <nickc@cygnus.com>
+
+ * Makefile.in (ALL_EMULATIONS): Add earm_epoc_pe.o
+ Add build rule and dependencies for earm_epoc_pe.c.
+
+ * emulparams/arm_epoc_pe.sh: New file.
+
+ * configure.tgt: Add 'targ_extra_ofiles' for ARM based PE
+ targets.
+
+1999-03-31 Philip Blundell <pb@nexus.co.uk>
+
+ * configure.tgt: Match `arm*-*-linux-gnu*' not
+ `armv*-*-linux-gnu'.
+
+1999-03-26 Andreas Schwab <schwab@issan.cs.uni-dortmund.de>
+
+ * scripttempl/elf.sc: Put the .eh_frame and .gcc_except_table
+ sections in the data segment.
+
+Fri Mar 26 12:05:51 1999 Catherine Moore <clm@cygnus.com>
+
+ * ld.h (wildcard_spec): Add exclude_name.
+ * ldgram.y (EXCLUDE_FILE): New token.
+ (wildcard_spec): Set exclude_name.
+ (file_NAME_list): Recognize EXCLUDE_FILE.
+ * ldlang.c (wild_section): Check for excluded files.
+ (print_wild_statement): Print excluded files.
+ (lang_add_wild): New argument exclude_filename.
+ Set exclude_filename.
+ * ldlang.h (lang_wild_statement_type): Add exclude_filename.
+ * ldlex.l: New token EXCLUDE_FILE.
+ * mri.c (mri_draw_tree): Add argument to lang_add_wild.
+ * scripttempl/elf.sc (CTOR, DTOR): Exclude crtend.o from ctor wildcard.
+ Reorder sorted and unsorted ctors.
+ * scripttempl/elfd10v.sc (CTOR, DTOR): Likewise.
+ * scripttempl/elfd30v.sc (CTOR, DTOR): Likewise.
+ * scripttempl/elfppc.sc (CTOR, DTOR): Likewise.
+
+1999-03-26 Nick Clifton <nickc@cygnus.com>
+
+ * ldlang.c (lang_gc_sections): If entry_symbol is not defined,
+ default to "start".
+
+1999-03-03 Nick Clifton <nickc@cygnus.com>
+
+ * scripttempl/elf.sc: Add explicit placements for the .eh_frame
+ and .gcc_except_table sections.
+
+Wed Mar 3 09:13:34 1999 Catherine Moore <clm@cygnus.clm>
+
+ * scripttempl/elf.sc: Remove .end.ctors and .end.dtors
+ sections. Reorder .ctors section entries.
+ * scripttempl/elfd10v.sc: Likewise.
+ * scripttempl/elfd30v.sc: Likewise.
+ * scripttempl/elfppc.sc: Likewise.
+
+1999-02-26 Jim Lemke <jlemke@cygnus.com>
+
+ * ldmain.c (main): Wrong error msg for -r and --mpc860c0.
+
+1999-02-25 Nick Clifton <nickc@cygnus.com>
+
+ * ldlang.c (lang_check_section_addresses): Remove extraneous
+ backslash.
+
+Thu Feb 25 15:07:24 1999 Catherine Moore <clm@cygnus.com>
+
+ * scripttempl/elf.sc: Don't gather .ctor and .dtor sections
+ for relocateable links.
+ * scripttempl/elfd10v.sc: Likewise.
+ * scripttempl/elfd30v.sc: Likewise.
+ * scripttempl/elfppc.sc: Likewise.
+
+1999-02-22 Jim Lemke <jlemke@cygnus.com>
+
+ * ldint.texinfo: remove extraneous right brace.
+ * ldmain.c (main): initialize and check option "mpc860c0".
+ * lexsup.c (ld_options, parse_args): add option "mpc860c0".
+
+Wed Feb 17 12:10:06 1999 Stan Cox <scox@cygnus.com>
+
+ * mpw-elfmips.c (gldelf32ebmip_before_allocation): Remove special
+ .reginfo section handling.
+ * emultempl/elf32.em (gld${EMULATION_NAME}_before_allocation): Likewise.
+ * emulparams/elf32elmip.sh (INITIAL_READONLY_SECTIONS): Removed
+ * emulparams/elf32ebmip.sh (INITIAL_READONLY_SECTIONS): Removed
+
+1999-02-17 Nick Clifton <nickc@cygnus.com>
+
+ Patch from: Scott Bambrough <scottb@corelcomputer.com>
+
+ * configure.tgt: Added armv*-*-linux-gnu to $targ_emul
+ recognition.
+
+Wed Feb 17 Andreas Schwab <schwab@issan.cs.uni-dortmund.de>
+
+ * emultempl/armelf_oabi.em
+ (bfd_elf32_arm_allocate_interworking_sections,
+ bfd_elf32_arm_get_bfd_for_interworking,
+ bfd_elf32_arm_process_before_allocation): Define them to use the
+ old ABI versions of the functions.
+
+Tue Feb 16 16:48:19 1999 Ian Lance Taylor <ian@cygnus.com>
+
+ * configure.in: Change AC_PREREQ to 2.13. Change AM_PROG_INSTALL
+ to AC_PROG_INSTALL. Change AM_EXEEXT to AC_EXEEXT.
+ * Makefile.am (earmelf_oabi.c): Changes spaces to tab.
+ * acconfig.h: Remove.
+ * aclocal.m4: Rebuild.
+ * configure: Rebuild.
+ * Makefile.in: Rebuild.
+
+Mon Feb 15 18:21:48 1999 Vladimir N. Makarov <vmakarov@cygnus.com>
+
+ * ldexp.h (struct etree_value_type): Change valid onto valid_p.
+
+ * ldexp.c (new_abs): Ditto.
+ (new_rel, new_rel_from_section, fold_binary, invalid, fold_name,
+ exp_fold_tree, exp_binop, exp_trinop, stat_alloc,
+ exp_get_abs_int): Ditto
+
+ * ldlang.c (print_assignment, lang_size_sections,
+ lang_do_assignments): Ditto.
+
+1999-02-11 Nick Clifton <nickc@cygnus.com>
+
+ * ldlang.c (lang_check_section_addresses): New function: Check
+ addresses assigned to section for overlaps.
+ (lang_process): Call lang_check_section_addresses if suitable.
+
+ * ld.h: Add new boolean field to args_type structure:
+ 'check_section_addresses'.
+
+ * ldmain.c: Initialise check_section_addresses field to true.
+
+ * lexsup.c: Add new command line options '--no-check-sections' and
+ '--check-sections'.
+
+ * ld.texinfo: Document new command line options '--check-sections'
+ and '--no-check-sections'.
+
+1999-02-08 Nick Clifton <nickc@cygnus.com>
+
+ * configure.tgt: Add support for StrongARM target.
+
+Wed Feb 3 19:41:01 1999 Ian Lance Taylor <ian@cygnus.com>
+
+ * ldctor.c (ldctor_build_sets): Just set SEC_KEEP once. Check for
+ an owner of a section before using it to look up a reloc type.
+ Don't set SEC_KEEP for the absolute section.
+
+Mon Feb 1 11:39:46 1999 Catherine Moore <clm@cygnus.com>
+
+ * Makefile.am (earmelf_oabi.o): New.
+ * Makefile.in: Regenerate.
+ * configure.tgt (arm-*-oabi): New.
+ (thumb-*-oabi): New.
+ * emulparams/armelf_oabi.sh: New.
+ * emultempl/armelf_oabi.em: New.
+
+1999-01-31 17:57:31 1998 Michael Meissner <meissner@cygnus.com>
+
+ * scripttempl/elfppc.sc: Add support for -fleading-underscores
+ switch in all linker generated symbols.
+
+ * configure.tgt (powerpc{,le}*-*-vxworks): Add as aliases for
+ powerpc{,le}-*-eabi.
+
+Wed Jan 20 17:01:48 1999 Ian Lance Taylor <ian@cygnus.com>
+
+ * configure.tgt (i[3456]86-*-solaris2*): New target. From Pavel
+ Roskin <pavel_roskin@geocities.com>.
+
+1999-01-19 Nick Clifton <nickc@cygnus.com>
+
+ * ldlang.c (lang_size_sections): Count loadable sections as
+ contributing to the size of the current segment.
+
+1999-01-15 Nick Clifton <nickc@cygnus.com>
+
+ * ldlang.c (lang_size_sections): Only update the current
+ address of a region if the section just placed into it is an
+ allocated section.
+
+1999-01-12 Nick Clifton <nickc@cygnus.com>
+
+ * Makefile.am: Replace efr30.o with eelf32fr30.o.
+ * Makefile.in: Regenerate.
+
+ * configure.tgt: Replace fr30 with elf32fr30.
+
+ * emulparams/elf32fr30.sh: New file: Replaces fr30.sh, and uses
+ generic elf.sc script. Also replaces the .stack section with a
+ user definable symbol __stack.
+
+1999-01-11 Nick Clifton <nickc@cygnus.com>
+
+ * scripttempl/fr30.sc: Fill .init and .fini sections with NOP
+ pattern.
+
+1999-01-03 Ken Raeburn <raeburn@cygnus.com>
+
+ * Makefile.am (check-DEJAGNU): No longer provide HOSTING_EMU,
+ HOSTING_CRT0, HOSTING_LIBS; the test suite can extract them from
+ configure.host and configure.tgt now.
+ * Makefile.in: Rebuild.
+
+1998-12-27 Ulrich Drepper <drepper@cygnus.com>
+
+ * lexsup.c (parse_args, case OPTION_RPATH): Avoid adding duplicate
+ elements to rpath.
+
+Thu Dec 10 11:12:28 1998 Andreas Schwab <schwab@issan.cs.uni-dortmund.de>
+
+ * Makefile.am (ALL_EMULATIONS): Remove pe-dll.o and deffilep.o.
+ (ALL_EMUL_EXTRA_OFILES): New variable. Put them here instead.
+ * configure.in: Set EMUL_EXTRA_OFILES to $(ALL_EMUL_EXTRA_OFILES)
+ if configuring with all targets.
+ * configure, Makefile.in, aclocal.m4: Rebuild.
+
+ * emultempl/pe.em (pe_enable_stdcall_fixup): Make static.
+ (pe_dll_do_default_excludes): Removed, unused.
+ (pe_def_file, pe_dll_export_everything, pe_dll_kill_ats,
+ pe_dll_stdcall_aliases): Don't initialize them, this file may be
+ compiled more than once.
+ * pe-dll.c (pe_def_file, pe_dll_export_everything,
+ pe_dll_do_default_excludes, pe_dll_kill_ats,
+ pe_dll_stdcall_aliases): Define and initialize them here instead.
+ (generate_reloc): Fix allocation of reloc_addresses array to use
+ bfd_vma instead of unsigned long. Fix element size in qsort call.
+ (reloc_sort): Compare pointers to bfd_vma instead of unsigned
+ long.
+
+Mon Dec 7 21:10:09 1998 J.J. van der Heijden <j.j.vanderheijden@student.utwente.nl>
+
+ * configure.tgt (i[3456]86-*-mingw32*): Add cygwin target specific
+ files.
+
+Sun Dec 6 16:33:33 1998 Ian Lance Taylor <ian@cygnus.com>
+
+ * configure.tgt (m68*-*-gnu*): New target. From Aymeric Vincent
+ <aymeric.vincent@emi.u-bordeaux.fr>.
+
+1998-12-04 Nick Clifton <nickc@cygnus.com>
+
+ * emulparams/fr30.sh (TEXT_START_ADDR): Change TEXT_START_ADDR
+ from 0x100000 to 0x10000 so that it fits in 20 bits.
+
+Sat Nov 28 22:32:20 1998 Ian Lance Taylor <ian@cygnus.com>
+
+ * ldemul.h (ldemul_recognized_file): Declare.
+
+Sat Nov 28 22:30:55 1998 Andreas Schwab <schwab@issan.cs.uni-dortmund.de>
+
+ * ldlang.c (lang_add_wild): Don't pretend that there is an input
+ file if the filename is a wildcard pattern.
+
+1998-11-25 DJ Delorie <dj@cygnus.com>
+
+ * ldemul.h (ld_emulation_xfer_struct): new hook "recognized_file"
+ * ldemul.c (ldemul_recognized_file): new function, new hook
+ * ldint.texinfo: document new hook.
+ * ldlang.c (load_symbols): call recognized_hook for all objects we
+ do recognize, in case the emulation needs to handle them
+ specially. PE DLLs use this.
+ * pe-dll.c (pe_dll_generate_def_file): take out hack and debug
+ printfs
+ * emultempl/pe.em (gld_i386_recognized_file): new function
+ (gld_i486_unrecognized_file): take out hack
+
+1998-11-23 DJ Delorie <dj@cygnus.com>
+
+ * pe-dll.c (fill_edata): fill in timestamp
+ (make_head): name object files sequentially to ensure
+ they link in the right order.
+ (make_tail): same here
+ (pe_process_import_defs): use sequential names for bfds to ensure
+ proper link order.
+ (pe_implied_import_dll): new function; handles linking directly
+ against DLLs by simulating IMPORTS directives. * emultempl/pe.em
+ (gld_i386pe_before_parse): hack bfd to not recognize .dll files
+ via bfd_pe_dll_not_recognized_hack
+
+1998-11-23 DJ Delorie <dj@cygnus.com>
+
+ * emultempl/pe.em (gld_i386pe_parse_args): Conditionalize call to
+ pe_dll_add_excludes
+
+Mon Nov 23 14:36:18 1998 Nick Clifton <nickc@cygnus.com>
+
+ * emultempl/pe.em (after_parse): Only create an undefined entry
+ symbol if one has been specified.
+
+1998-11-23 DJ Delorie <dj@cygnus.com>
+
+ * emultempl/pe.em (gld_i386pe_after_open): call
+ pe_process_import_defs
+ * pe-dll.c (pe_dll_generate_def_file): calculate BASE from
+ pe_data, only print if actually set. Print version only if
+ set.
+ (save_relocs): save relocs for both input and output.
+ (make_one): support internal/external different names.
+ (pe_dll_generate_implib): support new make_one
+ (pe_process_import_defs): new function; handles IMPORT
+ directives in .def files.
+
+Fri Nov 20 13:06:49 1998 Nick Clifton <nickc@cygnus.com>
+
+ * ldmisc.c (vfinfo): Cope with empty symbol names.
+
+Thu Nov 19 13:31:15 1998 Nick Clifton <nickc@cygnus.com>
+
+ * scripttempl/pe.sc: Add provision of '_end' symbol.
+
+Wed Nov 18 18:18:43 1998 Geoffrey Noer <noer@cygnus.com>
+
+ * configure.tgt: change refs from cygwin32* to cygwin*.
+ * aclocal.m4: regenerate
+ * configure.in: don't need to call AM_CYGWIN32.
+ * configure: regenerate
+
+Mon Nov 16 22:14:07 1998 DJ Delorie <dj@cygnus.com>
+
+ * emultempl/pe.em (gld_i386_finish): generate import library
+ * deffile.h: add hint member.
+ * pe-dll.c (pe_dll_generate_implib): New function with helpers;
+ generates the import library directly from the export table.
+ (fill_edata): remember the actual hint for the import library.
+
+Sat Nov 14 14:36:24 1998 Ian Lance Taylor <ian@cygnus.com>
+
+ * ld.1: Some cleanups from NOKUBI Hirotaka <hnokubi@yyy.or.jp>.
+
+Thu Nov 12 19:21:57 1998 Dave Brolley <brolley@cygnus.com>
+
+ * po/ld.pot: Regenerated.
+ * po/POTFILES.in: Regenerated.
+ * configure: Regenerated.
+ * aclocal.m4: Regenerated.
+ * Makefile.in: Regenerated.
+
+Wed Nov 11 18:10:15 1998 DJ Delorie <dj@cygnus.com>
+
+ * pe-dll.c (generate_reloc): don't output PE relocs for sections
+ that won't be loaded.
+
+Wed Nov 11 13:44:54 1998 DJ Delorie <dj@cygnus.com>
+
+ * pe-dll.c (fill_edata): don't strip underscores
+
+Tue Nov 10 21:28:19 1998 DJ Delorie <dj@cygnus.com>
+
+ * ld.texinfo: added i386pe option summary
+
+Tue Nov 10 17:53:17 1998 DJ Delorie <dj@cygnus.com>
+
+ * pe-dll.c (process_def_file): properly note undefined exported
+ symbols, clean up old code.
+ (pe_dll_generate_def_file): don't crash if pe_def_file is NULL
+ * emultempl/pe.em (gld_i386_parse_args): add
+ (en/dis)able-stdcall-fixups
+ (pe_fixup_stdcalls): warn about stdcall fixups
+ (gld_i386_unrecognized_file): make exported symbols undefs so that
+ archive members get pulled in
+
+Tue Nov 10 14:50:51 1998 Catherine Moore <clm@cygnus.com>
+
+ * scripttempl/elfd10v.sc: Add KEEP attribute to .init,
+ .fini, .dtors and .ctors. Add .data and .text
+ wildcards to support section garbage collection.
+
+Mon Nov 9 22:52:50 1998 DJ Delorie <dj@indy.delorie.com>
+
+ * deffilep.y: properly handle relocs with multiple def_files,
+ cache import module names
+
+Mon Nov 9 22:44:58 1998 DJ Delorie <dj@cygnus.com>
+
+ * pe-dll.c (process_def_file): don't assume exports won't move
+ during a realloc
+
+Mon Nov 9 16:41:30 1998 DJ Delorie <dj@cygnus.com>
+
+ * pe-dll.c: New file; direct support for PE DLLs
+ * deffile.h: New file; direct support for PE DLLs
+ * deffilep.y: New file; direct support for PE DLLs
+ * emultempl/pe.em: add direct support for PE DLLs
+ * configure.tgt: allow target-specific extra files
+ * configure.in: allow target-specific extra files
+ * ldlang.c (lang_add_assignment): return the assignment so that
+ one can change the value later based on the object files (pe-dll
+ DEF files do this)
+ * ldint.texinfo: add section for emulation walkthrough
+ * Makefile.am: add new files and target-specific extra files
+ * emultempl/pe.em (gld_i386_list_options): list dll-specific
+ options.
+ * pe-dll.c (process_def_file): auto-export everything if
+ nothing is otherwise exported.
+
+Wed Nov 4 16:39:18 1998 Nick Clifton <nickc@cygnus.com>
+
+ * Makefile.am: Add support for FR30 target.
+ * configure.tgt: Add support for FR30 target.
+ * Makefile.in: Regenerate.
+ * emulparams/fr30.sh: New file.
+ * scripttemp/fr30.sc: New file.
+
+Mon Nov 2 14:47:15 1998 Catherine Moore <clm@cygnus.com>
+
+ * ldmain.c (main): Don't report error for dynamic links and
+ --gc-sections.
+
+1998-10-26 16:05 Ulrich Drepper <drepper@cygnus.com>
+
+ * lexsup.c (ld_options): Change text of -O to Optimize output file".
+ (parse_args): Set link_info.optimize based on -O argument.
+ * ldmain.c (main): Initialize link_info.optimze to false.
+ * ld.texinfo: Describe -O option.
+ * ld.1: Likewise.
+
+Mon Oct 12 14:29:56 1998 Nick Clifton <nickc@cygnus.com>
+
+ * scripttempl/v850.sc: Move .sbss and .scommon sections into their
+ own segment, so that they can be next to the .bss section and so
+ initialised by the same piece of code.
+
+Fri Oct 9 15:59:52 1998 Catherine Moore <clm@cygnus.com>
+
+ * scripttempl/elf.sc: Merge .sdata.* etc sections.
+ * ldctor.c (ldctor_build_sets): Set SEC_KEEP for
+ ctor sections.
+
+Mon Oct 5 09:40:43 1998 Catherine Moore <clm@cygnus.com>
+
+ * ldmain.c (main): Error if --gc-sections and
+ dyanmic linking.
+ * scripttempl/v850.sc: Add KEEP attribute to .init,
+ .fini, .dtors and .ctors. Add .data and .text
+ wildcards to support section garbage collection.
+
+Wed Sep 30 11:19:15 1998 Nick Clifton <nickc@cygnus.com>
+
+ * scripttempl/v850.sc: Rename .call_table section to
+ .call_table_data and create a new section called
+ .call_table_text.
+
+Sun Sep 20 00:43:26 1998 Ian Lance Taylor <ian@cygnus.com>
+
+ * scripttempl/elf.sc: Add alignment at the end of the .bss
+ section, so that it is included in the memsize of the segment.
+
+Fri Sep 18 13:42:42 1998 Catherine Moore <clm@cygnus.com>
+
+ * emultempl/elf32.em (gld_place_orphan): Don't process for
+ sections with SEC_EXCLUDE flag.
+
+Fri Sep 4 09:24:02 1998 Nick Clifton <nickc@cygnus.com>
+
+ * emulparams/d30velf.sh (TEXT_SIZE): Increased to 2000K.
+ (DATA_SIZE): Increased to 2000K.
+
+Thu Sep 3 17:30:58 1998 Richard Henderson <rth@cygnus.com>
+
+ * emulparams/d10velf.sh (TEMPLATE_NAME): Use elf32.
+
+Mon Aug 31 01:06:00 1998 Catherine Moore <clm@cygnus.com>
+
+ * Makefile.am: Change armelf.sc to elf.sc
+ * Makefile.in: Regenerate.
+
+Mon Aug 31 11:12:04 1998 Catherine Moore <clm@cygnus.com>
+
+ * emulparams/armelf.sh: Change SCRIPT_NAME to
+ elf. Change TEXT_START_ADDR to 0x8000. Define
+ OTHER_TEXT_SECTIONS, OTHER_BSS_SYMBOLS and
+ OTHER_BSS_END_SYMBOLS.
+ * scripttempl/elf.sc: Modify to use
+ OTHER_BSS_END_SYMBOLS.
+ * scripttempl/elfarm.sc: Remove file.
+
+Tue Aug 18 12:05:34 1998 Catherine Moore <clm@cygnus.com>
+
+ * emultempl/armelf.em (gld_armelf_before_allocation):
+ Add bfd_ prefix to elf32_arm_process_before_allocation
+ and elf32_arm_allocate_interworking_sections.
+ (gld_armelf_after_open): Add bfd_ prefix to
+ elf32_arm_get_bfd_for_interworking.
+
+Fri Aug 14 15:34:29 1998 Ian Lance Taylor <ian@cygnus.com>
+
+ * Makefile.am: Rebuild dependencies.
+ * Makefile.in: Rebuild.
+
+ * ldgram.y: Include "ldctor.h".
+ (statement): Accept SORT around CONSTRUCTORS.
+ * ldctor.c: Include <ctype.h>.
+ (constructors_sorted): New global variable.
+ (ctor_prio, ctor_cmp): New static functions.
+ (ldctor_build_sets): Sort constructors if requested.
+ * ldctor.h (constructors_sorted): Declare.
+ * ldlang.c (print_statement): Print sorted CONSTRUCTORS
+ correctly.
+ * scripttempl/elf.sc: Add sort around CONSTRUCTORS.
+ * ld.texinfo (Output Section Keywords): Document SORT
+ (CONSTRUCTORS).
+
+Thu Aug 13 12:20:39 1998 Catherine Moore <clm@cygnus.com>
+
+ * emulparams/armelf.sh: Define TEMPLATE_NAME to armelf.
+ * scripttempl/elfarm.sc: Include .glue_7t and .glue7
+ sections.
+ * emultempl/armelf.em: New file.
+
+Thu Aug 13 12:52:45 1998 H.J. Lu <hjl@gnu.org>
+
+ * Makefile.am (ld.dvi): Use " instead of ' for MAKEINFO.
+ * Makefile.in: Rebuild.
+
+Tue Aug 11 16:17:01 1998 Catherine Moore <clm@cygnus.com>
+
+ * scripttempl/elfarm.sc: Change text start address
+ back to zero.
+
+Tue Aug 11 10:01:12 1998 Jeffrey A Law (law@cygnus.com)
+
+ * emulparms/mn10200.sh (MAX_PAGESIZE): Define to 1.
+ * emulparms/mn10300.sh (MAX_PAGESIZE): Define to 1.
+
+Sun Aug 9 20:31:27 1998 Catherine Moore <clm@cygnus.com>
+
+ * scripttempl/elfarm.sc: Set text start address to
+ 0x8000. Add __bss_end definition.
+
+Sat Aug 1 11:47:37 1998 Catherine Moore <clm@cygnus.com>
+
+ * scripttempl/elfarm.sc: New file.
+ * emulparams/armelf.sh: Set SCRIPT_NAME to elfarm.
+
+Fri Jul 31 15:56:16 1998 Catherine Moore <clm@cygnus.com>
+
+ * emulparams/armelf.sh: New file.
+ * configure.tgt: Recognize thumb-elf and arm-elf.
+ * Makefile.am (earmelf.o): New.
+ * Makefile.in: Rebuild.
+
+Fri Jul 24 12:00:57 1998 Ian Lance Taylor <ian@cygnus.com>
+
+ * Makefile.am (install-exec-local): Don't remove the file before
+ checking whether $(bindir) == $(tooldir)/bin. From Maciej
+ W. Rozycki <macro@ds2.pg.gda.pl>.
+ * Makefile.in: Rebuild.
+
+ * configure.tgt: Recognize h8[35]00*-coff* as well as -hms*.
+
+Thu Jul 23 11:15:12 1998 Ian Lance Taylor <ian@cygnus.com>
+
+ * scripttempl/aout.sc: If ALIGNMENT is defined, use it to set
+ alignment of end symbol.
+ * scripttempl/elf.sc: Likewise.
+ * emulparams/sun4.sh (ALIGNMENT): Define.
+ * emulparams/elf32_sparc.sh (ALIGNMENT): Define.
+ * ldint.texinfo (emulation parameters): Document ALIGNMENT.
+
+ * lexsup.c (parse_args): Add missing break statement.
+
+ * ldlang.c (lang_gc_sections_1): Add default case to switch to
+ avoid warnings.
+
+Tue Jul 14 15:42:17 1998 Richard Henderson <rth@cygnus.com>
+
+ * configure.tgt (i?86-*-beos{pe,elf,}*): Recognize.
+ * Makefile.am (ei386beos.o): New.
+ * emulparams/i386beos.sh: New file.
+ * emultempl/beos.em, scripttempl/i386beos.sc: New file.
+
+Tue Jul 14 15:35:42 1998 Richard Henderson <rth@cygnus.com>
+
+ * lexsup.c: New option --version-exports-section.
+ * ld.h (struct args_type): Add version_exports_section.
+ * ldlang.c (lang_do_version_exports_section): New function.
+ (lang_process): Call it.
+
+Mon Jul 13 13:20:23 1998 Steve Chamberlain <sac@transmeta.com>
+
+ * ldlex.l: Accept ASSERT.
+ * ldgram.y (exp): Add ASSERT_K case.
+ * ldexp.h (node_type): Add etree_assert to node_class enum.
+ (etree_type): Add assert_s field.
+ (exp_assert): Declare.
+ * ldexp.c (exp_fold_tree): Handle etree_assert.
+ (exp_assert): New function.
+ (exp_print_tree): Handle etree_assert.
+ * ld.texinfo (Miscellaneous Commands): Document ASSERT.
+
+Wed Jul 8 14:03:12 1998 Ian Lance Taylor <ian@cygnus.com>
+
+ * ldgram.y: Change MAX to MAX_K and MIN to MIN_K, to avoid
+ conflicts with system header files. Change all uses.
+
+ * Makefile.am (MAINTAINERCLEANFILES): Define.
+ * Makefile.in: Rebuild.
+
+Tue Jul 7 18:03:22 1998 Ian Lance Taylor <ian@cygnus.com>
+
+ * Makefile.am (ldver.texi): New target.
+ (ld.info, ld.dvi): Depend upon ldver.texi.
+ * ld.texinfo: Include ldver.texi. Mention version number on title
+ page and in top node.
+ * Makefile.in: Rebuild.
+
+Mon Jul 6 14:55:13 1998 Ian Lance Taylor <ian@cygnus.com>
+
+ * configure.tgt (i[3456]86-*-solaris*): New target.
+
+Fri Jul 3 14:19:06 1998 Ian Lance Taylor <ian@cygnus.com>
+
+ * ldlang.c (wild_section): Don't get an assertion failure if the
+ section is discarded.
+
+ * scripttempl/pe.sc: Use SORT to sort sections appropriately.
+ * emultempl/pe.em (sort_by_file_name): Remove.
+ (sort_by_section_name): Remove.
+ (sort_sections_1, sort_sections): Remove.
+ (gld_${EMULATION_NAME}_before_allocation): Don't call
+ sort_sections.
+ (hold_section, hold_section_name): New static variables.
+ (hold_use, hold_text, hold_rdata, hold_data, hold_bss): Likewise.
+ (gld_${EMULATION_NAME}_place_orphan): Rewrite. Look for a good
+ place to put the section. Align the section. Sort the input
+ sections by name.
+ (gld_${EMULATION_NAME}_place_section): New static function.
+
+ * ldlang.c (wild_sort): When sorting by file name, sort by archive
+ name first.
+
+ * emultempl/pe.em (set_pe_subsystem): Don't call
+ ldlang_add_undef.
+ (gld_${EMULATION_NAME}_after_parse): New static function.
+ (ld_${EMULATION_NAME}_emulation): Use new after_parse function
+ rather than after_parse_default.
+
+ * ldgram.y (extern_name_list): Do not require symbols to be
+ separated by commas.
+ (ifile_p1): Add EXTERN.
+ * ldlex.l: Accept EXTERN in BOTH and SCRIPT mode as well as MRI
+ mode.
+ * ld.texinfo (Options): Mention that EXTERN is equivalent to -u.
+ (Miscellaneous Commands): Document EXTERN.
+
+Wed Jul 1 19:40:34 1998 Richard Henderson <rth@cygnus.com>
+
+ * ld.h (args_type): Add gc_sections.
+ * ldgram.y (ldgram_had_keep, KEEP): New.
+ (input_section_spec_no_keep): Rename from old input_section_spec.
+ (input_section_spec): New. Recognize KEEP.
+ * ldlang.c (wild_section): Handle keep sections.
+ (lang_gc_wild_section, lang_gc_wild_file, lang_gc_wild): New.
+ (lang_gc_sections_1, lang_gc_sections): New.
+ (lang_process): Invoke lang_gc_sections.
+ (lang_add_wild): Add keep argument. Update all callers.
+ * ldlang.h (lang_wild_statement_struct): Add keep_sections.
+ * ldlex.l (KEEP): Match it.
+ * ldmain.c (main): Error on -r and --gc-sections.
+ * lexsup.c: Add --gc-sections.
+
+ * scripttempl/elf.sc: Merge .text.* etc sections appropriately.
+ Mark startup sections with KEEP.
+ * scripttempl/elfppc.sc: Likewise.
+
+ * ld.texinfo: Update for --gc-sections and KEEP.
+
+Wed Jul 1 15:21:20 1998 Ian Lance Taylor <ian@cygnus.com>
+
+ From Peter Jordan <pjordan@chla.usc.edu>:
+ * scripttempl/i386go32.sc: Correct constructor handling for -u.
+
+Tue Jun 23 15:17:27 1998 Ian Lance Taylor <ian@cygnus.com>
+
+ * Makefile.am (install-data-local): Make ldscripts subdirectory.
+ * Makefile.in: Rebuild.
+
+Tue Jun 23 15:17:04 1998 Mike Stump <mrs@wrs.com>
+
+ * Makefile.am (install-exec-local): Don't let EXEEXT interfere
+ with the program transform name.
+ * Makefile.in: Rebuild.
+
+Sun Jun 21 23:55:16 1998 Jeffrey A Law (law@cygnus.com)
+
+ * ld.texinfo: Note that -relax may make symbolic debugging
+ impossible on some platforms.
+
+Tue Jun 16 12:51:13 1998 Geoff Keating <geoffk@ozemail.com.au>
+
+ * Makefile.am (Makefile): Remove target.
+ (config.status): New target.
+ * Makefile.in: Rebuild.
+
+ * configure.host (powerpc*-*-linux-gnu*): New host.
+
+Fri Jun 12 17:38:07 1998 Doug Evans <devans@seba.cygnus.com>
+
+ * scripttempl/elf.sc (INPUT_FILES): Optional INPUT spec.
+
+ * emulparams/m32relf.sh (OTHER_RELOCATING_SECTIONS): Change top of
+ stack to 8MB.
+
+Fri Jun 12 19:33:17 1998 Ian Lance Taylor <ian@cygnus.com>
+
+ * Makefile.am (HFILES): Remove config.h.
+ (EMULATION_OFILES, POTFILES): Move patch of May 14 from
+ Makefile.in to Makefile.am.
+ (earmcoff.c): Depend upon armcoff.em, not generic.em.
+ * po/Make-in (all-yes): Correct misspelling in $(PACKAGE).
+ ($(srcdir)/$(PACKAGE).pot): Pass -C to $(XGETTEXT).
+ * Makefile.in, po/POTFILES.in, po/ld.pot: Rebuild.
+
+Fri Jun 12 13:43:17 1998 Tom Tromey <tromey@cygnus.com>
+
+ * po/Make-in (all-yes): If maintainer mode, depend on .pot file.
+ ($(PACKAGE).pot): Unconditionally depend on POTFILES.
+
+Tue Jun 9 09:36:48 1998 Nick Clifton <nickc@cygnus.com>
+
+ * ldlang.c (lang_finish): Add CONST type modifier to declaration
+ of 'send'.
+
+Fri Jun 5 18:19:59 1998 Ian Lance Taylor <ian@cygnus.com>
+
+ * emultempl/aix.em (gld${EMULATION_NAME}_before_parse): Set
+ config.has_shared to true.
+ * emultempl/linux.em (gld${EMULATION_NAME}_before_parse):
+ Likewise.
+ * emultempl/sunos.em (gld${EMULATION_NAME}_before_parse):
+ Likewise.
+
+Tue Jun 2 12:55:03 1998 Ian Lance Taylor <ian@cygnus.com>
+
+ * ldlang.c (lang_finish): If the entry symbol is not found, try
+ parsing it as a number.
+ * ld.texinfo (Options): Document this.
+
+Mon Jun 1 14:01:20 1998 Ian Lance Taylor <ian@cygnus.com>
+
+ * ld.texinfo (Input Section Wildcards): Document SORT keyword.
+
+Mon May 18 12:42:53 1998 Doug Evans <devans@canuck.cygnus.com>
+
+ * ld.h (ld_config_type): New member has_shared.
+ * ldmain.c (main): Initialize it.
+ * emultempl/elf32.em (gld${EMULATION_NAME}_before_parse): Set it.
+ * lexsup.c (parse_args): Treat -shared as error if not supported.
+
+Mon May 18 13:14:43 1998 Ian Lance Taylor <ian@cygnus.com>
+
+ From Jason Merrill <jason@cygnus.com>:
+ * ldlang.c (wild_sort): Correct order of sort.
+ * scripttempl/elf.sc: Put *crtbegin.o before other .ctors and
+ .dtors.
+ * scripttempl/elfd10v.sc: Likewise.
+ * scripttempl/elfd30v.sc: Likewise.
+ * scripttempl/elfppc.sc: Likewise.
+
+Fri May 15 00:22:35 1998 Ian Lance Taylor <ian@cygnus.com>
+
+ * ldlex.l: Recognize keyword SORT.
+ * ldgram.y (current_file): Change to struct wildcard_spec.
+ (%union): Add new fields cname and wildcard.
+ (wildcard_name, wildcard_spec): New nonterminals.
+ (file_NAME_list): Use wildcard_spec.
+ (input_section_spec): Change current_file usage.
+ * ld.h (struct wildcard_spec): Define.
+ * ldlang.h (lang_wild_statement_struct): Add new fields
+ sections_sorted and filenames_sorted.
+ (lang_add_wild): Update declaration.
+ * ldlang.c (wild_sort): New static function.
+ (wild_section): Use wild_sort.
+ (print_wild_statement): Print sorting information.
+ (lang_add_wild): Add new parameters sections_sorted and
+ filenames_sorted. Change all callers.
+ * mri.c (mri_draw_tree): Update calls to lang_add_wild.
+ * scripttempl/elf.sc: Sort .ctors.* and .dtors.* by section name.
+ * scripttempl/elfd10v.sc: Likewise.
+ * scripttempl/elfd30v.sc: Likewise.
+ * scripttempl/elfppc.sc: Likewise.
+
+Thu May 14 18:39:16 1998 Richard Henderson <rth@cygnus.com>
+
+ * emulparams/m32relf.sh (TEMPLATE_NAME): Define.
+
+Thu May 14 14:51:24 1998 Nick Clifton <nickc@cygnus.com>
+
+ * ldemul.h: Add new prototype: ldemul_list_emulation_options.
+ (ld_emulation_xfer_struct): Add new field: list_options.
+ * ldemul.c (ldemul_list_options): New function. Call the
+ list_options field of the ld_emulation_xfer_struct for each
+ supported emulation, if such a function is present.
+ * lexsup.c (help): Call ldemul_list_emulation_options.
+ * emultempl/pe.em (gld_<>_list_options): New function. Describe
+ the pe emulation specific command line options.
+ * emultempl/armcoff.em (gld<>_list_options): New function.
+ Describe the armcoff emulation specific command line options.
+
+ * emultempl/pe.em: Add a new command line option:
+ --support-old-code.
+ * emultempl/armcoff.em: Ditto.
+ * ld.texinfo: Document the --support-old-code option.
+
+ * Makefile.in: Add emulation files for POTFILES.in target.
+ * emultempl/pe.em: Internationalise suitable strings.
+ * emultempl/armcoff.em: Internationalise suitable strings.
+ * po/POTFILES.in: Rebuilt.
+
+Sun May 10 22:36:30 1998 Jeffrey A Law (law@cygnus.com)
+
+ * po/Make-in (install-info): New target.
+
+Tue Apr 28 19:18:30 1998 Tom Tromey <tromey@cygnus.com>
+
+ * ldmain.c (main): Conditionally call setlocale.
+ * ld.h: Include <locale.h> if HAVE_LOCALE_H.
+ (LC_MESSAGES): Now can be defined even when ENABLE_NLS.
+
Mon Apr 27 11:56:21 1998 Ian Lance Taylor <ian@cygnus.com>
- * configure.in: Set version number to 2.9.1.
+ * configure.in: Change version number to 2.9.4
* configure: Rebuild.
+ * ld.texinfo (Options) [-rpath-link]: Mention ld.so.conf.
+
Based on patch from H.J. Lu <hjl@gnu.org>:
* emultempl/elf32.em (global_vercheck_needed): New file static
variable.
@@ -16,6 +2016,66 @@ Mon Apr 27 11:56:21 1998 Ian Lance Taylor <ian@cygnus.com>
whether the libraries needs any incompatible versions.
(gld${EMULATION_NAME}_vercheck): New static function.
+Wed Apr 22 16:01:35 1998 Tom Tromey <tromey@cygnus.com>
+
+ * po/Make-in (MKINSTALLDIRS): Don't look in $(top_srcdir).
+
+Wed Apr 22 12:40:56 1998 Ian Lance Taylor <ian@cygnus.com>
+
+ * Makefile.am (check-DEJAGNU): Add $(INTLLIBS) to LIBIBERTY when
+ invoking runtest.
+ * Makefile.in: Rebuild.
+
+ * lexsup.c (parse_args): Change -l options into --library options
+ to avoid confusion between -li and -library.
+
+ * ld.texinfo (MEMORY): Clarify use of >REGION.
+
+Tue Apr 21 23:12:40 1998 Tom Tromey <tromey@scribbles.cygnus.com>
+
+ * Many files: Added gettext invocations around user-visible
+ strings.
+ * ld.h: Added gettext-related includes and defines.
+ * ldmain.c: Call setlocale, bindtextdomain, textdomain.
+ * acconfig.h (ENABLE_NLS, HAVE_CATGETS, HAVE_GETTEXT, HAVE_STPCPY,
+ HAVE_LC_MESSAGES): Define.
+ * configure.in: Call CY_GNU_GETTEXT. Create po/Makefile.in and
+ po/Makefile. Use AM_PROG_LEX.
+ (TDIRS): AC_SUBST early on, to avoid having value split when it
+ happens to cross line 90 of the generated sed script.
+ * Makefile.am (SUBDIRS): New macro.
+ (POTFILES): Likewise.
+ (po/POTFILES.in): New target.
+ (ld_new_LDADD): Added INTLLIBS.
+ (ld_new_DEPENDENCIES): Added INTLDEPS.
+ * po/Make-in, po/POTFILES.in, po/gas.pot: New files.
+
+Tue Apr 21 23:07:07 1998 Ian Lance Taylor <ian@cygnus.com>
+
+ * ld.texinfo (Simple Example): Rewrite a few things as suggested
+ by Nick Clifton <nickc@cygnus.com>.
+ (PROVIDE): Likewise.
+
+Tue Apr 21 09:55:06 1998 Nick Clifton <nickc@cygnus.com>
+
+ * emultempl/pe.em: Rename external arm interworking functions
+ to conform to BFD naming conventions. Add code to _after_open()
+ function to obtain a bfd for use by the interworking code.
+
+ * emultempl/armcoff.em: Rename external arm interworking functions
+ to conform to BFD naming conventions. Add new _after_open()
+ function to obtain a bfd for use by the interworking code.
+
+Sun Apr 19 19:23:09 1998 Richard Henderson <rth@cygnus.com>
+
+ * ldlang.c (lang_size_sections) [case lang_assignment_statement_enum]:
+ Update dot and the default memory section even when relaxing.
+
+Sat Apr 18 18:41:12 1998 Richard Henderson <rth@cygnus.com>
+
+ * ldlang.c (lang_one_common): Manipulate the section's cooked size
+ rather than its raw size.
+
Tue Apr 7 13:35:29 1998 H.J. Lu <hjl@gnu.org>
* configure.in (TESTBFDLIB): New. Defined and substituted.
@@ -37,21 +2097,27 @@ Sun Apr 5 13:07:57 1998 Ian Lance Taylor <ian@cygnus.com>
* scripttempl/pe.sc: Use shell variables to avoid depending upon
how $ is handled when expanding a shell substitution.
-Fri Apr 3 13:31:46 1998 Ian Lance Taylor <ian@cygnus.com>
+Fri Apr 3 00:56:50 1998 Ian Lance Taylor <ian@cygnus.com>
* Makefile.am (MOSTLYCLEANFILES): Add ld.log and ld.sum.
- (DISTCLEANFILES): Define with site.exp and site.bak.
+ (DISTCLEANFILES): Add site.exp and site.bak.
* Makefile.in: Rebuild.
- * Makefile.am (DISTCLEANFILES): Remove.
+ * configure.in: Put the tdirs in a file and use AC_SUBST_FILE,
+ rather than in a shell variable and using AC_SUBST.
+ * Makefile.am (DISTCLEANFILES): Remove ldscripts. Add tdirs.
(distclean-local): New target.
- * Makefile.in: Rebuild.
+ * configure, Makefile.in: Rebuild.
+
+ * ld.texinfo: Completely rewrite linker script documentation.
-Mon Mar 30 16:12:48 1998 Ian Lance Taylor <ian@cygnus.com>
+Mon Mar 30 12:47:33 1998 Ian Lance Taylor <ian@cygnus.com>
- * configure.in: Set version number to 2.9.
+ * configure.in: Set version to 2.9.1.
* configure: Rebuild.
+ * Branched binutils 2.9.
+
Sat Mar 28 16:48:19 1998 Ian Lance Taylor <ian@cygnus.com>
* Makefile.am (MOSTLYCLEANFILES): Remove tmpdir.
@@ -131,6 +2197,12 @@ Mon Mar 2 19:24:08 1998 Michael Meissner <meissner@cygnus.com>
* ldlang.c (lang_size_sections): If the default memory region is
*default*, see if there is a memory region that could be used.
+Thu Feb 26 17:09:53 1998 Michael Meissner <meissner@cygnus.com>
+
+ * scripttempl/elfd30v.sc: Add support for .eit_v section and put
+ it at 0xfffff020.
+ * emulparams/d30v{elf,_o,_e}.sh: Ditto.
+
Mon Feb 23 17:46:51 1998 Ian Lance Taylor <ian@cygnus.com>
* emultempl/pe.em (sort_sections): Permit the wildcard to include
@@ -250,7 +2322,7 @@ Wed Jan 28 14:06:30 1998 Richard Henderson <rth@cygnus.com>
* emulparams/elf64_sparc.sh (ELFSIZE): 64
(TEXT_START_ADDR): Round off, since SIZEOF_HEADERS is added later.
(DATA_PLT): Needed by v9 abi.
-
+
Wed Jan 28 16:37:27 1998 J.J. van der Heijden <J.J.vanderHeijden@student.utwente.nl>
* configure.tgt (i[3456]86-*-mingw32*): New entry.
@@ -318,6 +2390,17 @@ Fri Jan 2 20:15:37 1998 Michael Meissner <meissner@cygnus.com>
(lang_set_flags): Update prototype to match new calling sequence.
(lang_memory_region_default): Add prototype.
+ * emulparams/d30v{_e,_o,elf}.sh ({TEXT,DATA,EMEM}_DEF_SECTION):
+ Define whether or not the region gets default sections, and if so,
+ what sections.
+
+ * scripttempl/elfd30v.sc (MEMORY): Set up which of the regions get
+ default sections.
+
+Thu Jan 1 22:58:04 1998 Michael Meissner <meissner@cygnus.com>
+
+ * scripttempl/elfd30v.sc (.eh_frame): Link into the data section.
+
Thu Jan 1 18:04:51 1998 Jeffrey A Law (law@cygnus.com)
* scripttempl/h8300h.sc: Fix typo.
@@ -335,22 +2418,71 @@ Wed Dec 17 12:14:11 1997 Ian Lance Taylor <ian@cygnus.com>
multiple times on the same argument and confuse the getopt
internals.
+Thu Dec 11 09:00:15 1997 Michael Meissner <meissner@cygnus.com>
+
+ * configure.tgt (d30v-elf-*): Rename d30velf_e to d30v_e and
+ d30velf_o to d30v_o to work in DOS environments.
+ * Makefile.{am,in}: Ditto.
+
+ * emulparams/d30v_{o,e}: Rename from d30velf_{o,e}.
+ * emulparams/d30velf_{o,e}: Deleted.
+
Wed Dec 10 17:40:08 1997 Nick Clifton <nickc@cygnus.com>
* scripttempl/armcoff.sc: Add glue sections (code taken from Arm
- branch).
+ branch).
* emulparams/armcoff.sh (TEMPLATE_NAME): Set to armcoff.
* emultempl/armcoff.em: New file, imported from Arm branch.
+Wed Dec 10 14:10:44 1997 Michael Meissner <meissner@cygnus.com>
+
+ * scripttempl/elfd30v.sc: Add .rel and .rela sections for all
+ defined sections. Set up __{D,C}TOR_{LIST,END}__. Add onchip and
+ external memory sections for rodata. Delete .string, .rodata1,
+ and .data1 sections.
+
Tue Dec 9 15:28:17 1997 Michael Meissner <meissner@cygnus.com>
* Makefile.am: Add Oct 23 changes to Makefile.in here.
* Makefile.{am,in}: (ALL_EMULATIONS): Add ed10velf.o.
-
+ * Makefile.{am,in}: (ALL_EMULATIONS): Add etic80coff.o.
+
+ * Makefile.{am,in}: (ALL_EMULATIONS): Add ed30velf{,_e,_o}.o.
+ (ed30velf_e.c): Like d30velf, except .text/.data/etc always go in
+ external memory.
+ (ed30velf_o.c): Like d30velf, except .text/.data/etc always go in
+ onchip memory.
+
+ * emulparams/d30velf.sh (STACK_START_ADDR): Top of default
+ stack.
+ ({TEXT,DATA,EMEM}_SIZE): Sizes of the 3 memory areas.
+ ({TEXT,DATA,BSS}_MEMORY): Which memory region .text, .data, and
+ .bss should go in.
+
+ * emulparams/d30velf_{e,o}.sh: New files to be explicit whether
+ .text, .data, etc go in external memory or onchip memory.
+
+ * configure.tgt (d30v-*-*ext*): New configuration to default
+ .text, .data, etc. in external memory.
+ (d30v-*-*onchip*): New configuration to default .text, .data,
+ etc. in onchip memory.
+ (d30v-*-*): Add d30velf_{e,o} emulations.
+
+ * scripttempl/elfd30v.sc: Allow .text, .data, .bss to be put in
+ either the onchip text/data areas or the external memory area.
+ (MEMORY): Get sizes from d30velf.sh.
+ (.e{data,text,bss}): Put sections in the external memory region.
+ (.stext): Put section in the onchip text region.
+ (.s{data,bss}): Put sections in the onchip data region.
+ (__stack): Assign from ${STACK_START_ADDR}.
+ (.text): Put in ${TEXT_MEMORY} memory region.
+ (.data{,1}/.strings/.rodata{,1}): Put in ${DATA_MEMORY} memory
+ region.
+ (.bss): Put in ${BSS_MEMORY} memory region.
Tue Dec 2 10:14:47 1997 Nick Clifton <nickc@cygnus.com>
@@ -363,6 +2495,18 @@ Sat Nov 22 15:23:19 1997 Ian Lance Taylor <ian@cygnus.com>
correctly. Pass 0 rather than hex_mode to bfd_scan_vma.
* ldlex.h (hex_mode): Don't declare.
+Sun Nov 16 20:16:45 1997 Michael Meissner <meissner@cygnus.com>
+
+ * emulparams/d30velf.sh ({DATA,EMEM}_START_ADDR): Define as start
+ of internal data area and external memory on chip.
+
+ * scripttempl/elfd30v.sc: Define a MEMORY region that describes
+ the 3 regions of memory on the chip. Put .text/.init/.fini into
+ the text memory region, put other segments into the data memory
+ region. Add more of the standard elf sections. Default __stack
+ to be 0x20008000, which is 1 byte beyond end of the internal data
+ region.
+
Thu Nov 13 13:45:00 1997 Andrew Cagney <cagney@b1.cygnus.com>
* configure.tgt (targ_extra_emuls): Make FreeBSD a i386bsd
@@ -448,7 +2592,7 @@ Thu Oct 2 18:40:28 1997 Ian Lance Taylor <ian@cygnus.com>
Wed Oct 1 16:41:00 1997 Nick Clifton <nickc@cygnus.com>
* emulparams/v850.sh (ROZDATA_START_ADDR, ROSDATA_START_ADDR): New
- Variables.
+ Variables.
* scripttempl/v850.sc: Move read only areas out of zero and small
data sections and into their own sections.
@@ -474,6 +2618,17 @@ Wed Sep 17 16:45:34 1997 Nick Clifton <nickc@cygnus.com>
* Makefile.am, Makefile.in: Add rule for ev850.c
* configure.tgt (targ_extra_emuls): Add v850 target.
+Wed Sep 17 16:43:39 1997 Nick Clifton <nickc@cygnus.com>
+
+ * emulparams/v850.sh (CALL_TABLE_START_ADDR): New entry.
+ * scripttempl/v850.sc: Add call table data area
+
+Mon Sep 15 11:29:13 1997 Ken Raeburn <raeburn@cygnus.com>
+
+ Merge change from Martin Hunt:
+
+ * scripttempl/elfd30v.sc: Put .rodata in the .text section.
+
Tue Sep 9 07:49:56 1997 Fred Fish <fnf@ninemoons.com>
* ldlang.c (lang_memory_region_lookup): Remove extraneous
@@ -516,6 +2671,13 @@ Wed Aug 20 11:14:13 1997 Ian Lance Taylor <ian@cygnus.com>
* ld.texinfo (Section Definition): Clarify use of whitespace.
(Section Placement): Likewise.
+Mon Aug 18 11:12:03 1997 Nick Clifton <nickc@cygnus.com>
+
+ * configure.tgt (targ_extra_emuls): Add support for v850e target.
+
+Mon Aug 18 11:12:03 1997 Nick Clifton <nickc@cygnus.com>
+
+ * configure.tgt (targ_extra_emuls): Add support for v850e target.
Sat Aug 9 00:42:27 1997 Ian Lance Taylor <ian@cygnus.com>
@@ -681,6 +2843,13 @@ Mon May 5 18:19:55 1997 Philip Blundell <pjb27@cam.ac.uk>
* configure.tgt, configure.host: cope with '*-*-linux-gnuaout'
targets.
+Fri May 2 15:54:28 1997 Mike Meissner <meissner@cygnus.com>
+
+ * scripttempl/tic80coff.sc (.text): Add a leading underscore to
+ __{D,C}TOR_{LIST,END}__ definations. Rearrange the order of items
+ in the .text section. Move .const, .ctors, .dtors into separate
+ sections.
+
Wed Apr 30 12:23:21 1997 Manfred Hollstein <manfred@s-direktnet.de>
* scripttempl/m88kbcs.sc (__.initp.end, _etext): Added whitespace
@@ -826,12 +2995,26 @@ Sun Mar 9 23:06:35 1997 Eric Youngdale <eric@andante.jic.com>
* ldgram.y (vers_node): Correct typo of '(' for '{'.
+Fri Mar 7 18:40:12 1997 Fred Fish <fnf@cygnus.com>
+
+ * scripttempl/tic80coff.sc (ENTRY): Entry symbol is __start
+ rather than _start.
+ (__edata): Define this rather than "edata".
+ (__end): Define this rather than "end".
+
+Tue Mar 4 17:18:35 1997 Michael Meissner <meissner@cygnus.com>
+
+ * configure.tgt (tic80-*-*): Allow dropping of -coff.
+
Sun Mar 2 22:59:49 1997 Fred Fish <fnf@cygnus.com>
* Makefile.in (ld.dvi): Set MAKEINFO environment variable as well
as TEXINPUTS. Needed for building in separate build dir.
* ldint.texinfo (SCRIPT_NAME): Fix typo.
-
+ * emulparams/tic80coff.sh: Rewrite to include internal documentation
+ about each shell variable that is set (or not set).
+ * scripttempl/tic80coff.sc: Complete rewrite.
+
Fri Feb 28 17:42:27 1997 Ian Lance Taylor <ian@cygnus.com>
* ldmain.c (main): Call bfd_set_default_target.
@@ -906,6 +3089,13 @@ Mon Feb 24 18:16:09 1997 Ian Lance Taylor <ian@cygnus.com>
* scripttempl/elf.sc: Add .gnu.version sections.
* ld.texinfo: Document symbol versioning.
+Fri Feb 21 17:37:51 1997 Martin M. Hunt <hunt@pizza.cygnus.com>
+
+ * Makefile.in (ed30velf.c): New target.
+ * configure.tgt (d30v-*-*): New target.
+ * emulparams/d30velf.sh: New file.
+ * scripttempl/elfd30v.sc: New file.
+
Fri Feb 14 18:28:31 1997 Ian Lance Taylor <ian@cygnus.com>
* ld.texinfo (Option Commands): Document the INCLUDE command.
@@ -925,6 +3115,13 @@ Tue Feb 11 15:34:26 1997 Ian Lance Taylor <ian@cygnus.com>
* scripttempl/elfmips.sc: When relocating, put .mips16.fn.* and
.mips16.call.* in .text.
+Sun Feb 9 18:09:13 1997 Fred Fish <fnf@cygnus.com>
+
+ * emulparams/tic80coff.sh: New (dummy) file for TIc80.
+ * scripttempl/tic80coff.sc: New (dummy) file for TIc80.
+ * Makefile.in (etic80coff.c): Add target and rule to build it.
+ * configure.tgt (tic80-*-coff): Set targ_emul to tic80coff.
+
Fri Jan 31 13:16:53 1997 Ian Lance Taylor <ian@cygnus.com>
* emultempl/sunos.em (gld${EMULATION_NAME}_find_so): Search for
@@ -1045,7 +3242,7 @@ Fri Dec 13 14:08:50 1996 Michael Meissner <meissner@tiktok.cygnus.com>
where the different sections go. Change some whitespace.
* emulparams/v850.sh ({TEXT,{Z,S,T}DATA}_START_ADDR): Define
- appropriately. Remove crud not used anymore.
+ appropriately. Remove crud not used anymore.
Fri Dec 13 10:19:57 1996 Jeffrey A Law (law@cygnus.com)
@@ -1108,7 +3305,7 @@ Tue Nov 5 10:57:50 1996 Martin M. Hunt <hunt@pizza.cygnus.com>
* emulparams/d10velf.sh (READONLY_START_ADDR): Changed to 0x2000004.
(EMBEDDED): Define.
-
+
Fri Nov 1 10:01:27 1996 Ian Lance Taylor <ian@cygnus.com>
* ld.texinfo: Add section on reporting bugs.
@@ -1123,10 +3320,10 @@ Thu Oct 31 09:28:59 1996 Jeffrey A Law (law@cygnus.com)
Tue Oct 29 12:33:05 1996 Martin M. Hunt <hunt@pizza.cygnus.com>
- * emulparams/d10velf.sh: Changes needed for D10V-EVA board.
- Set TEXT_START_ADDR to 0x1000000. Set READONLY_START_ADDR to
+ * emulparams/d10velf.sh: Changes needed for D10V-EVA board.
+ Set TEXT_START_ADDR to 0x1000000. Set READONLY_START_ADDR to
0x2000000.
-
+
* scripttempl/elfd10v.sc: Fix calculation of .text. Change
.stack to start at 0x2007ffe.
@@ -1895,7 +4092,7 @@ Thu May 9 08:52:23 1996 Rob Savoye <rob@chinadoll.cygnus.com>
* emulparams/{elf32bmip.sh,elf32lmip.sh,mipsidt.sh,mipsidtl.sh}:
Set a new variable to signify if the final target is an embedded
- system.
+ system.
* scripttempl/{mips.sc,elfmips.sc}: Don't add SIZEOF_HEADERS to
.text for an embedded system.
@@ -2438,7 +4635,7 @@ Wed Jan 31 17:30:19 1996 Steve Chamberlain <sac@slash.cygnus.com>
* configure.tgt (i[345]86-*-cygwin32, powerpcle-*-cygwin32): New.
* emultempl/pe.em (definfo init): Make the default stack reserve
of a PPC larger.
-
+
Wed Jan 31 14:34:23 1996 Richard Henderson <rth@tamu.edu>
* configure.tgt (m68*-apple-aux*): New target.
@@ -2866,7 +5063,7 @@ Fri Oct 27 18:03:17 1995 Niklas Hallqvist <niklas@appli.se>
m88kbcs,mipsbig,mipsbsd,mipsidt,mipsidtl,mipslit,news,ns32knbsd,
pc532machaout,riscix,sa29200,sh,shl,sparclynx,sparcnbsd,
st2000,sun3,sun4,vanilla,vax,vsta,w65,z8001,z8002}.sh: Changed
- PAGE_SIZE to TARGET_PAGE_SIZE.
+ PAGE_SIZE to TARGET_PAGE_SIZE.
* emulparams/m68knbsd.h: Ditto.
(TEXT_START_ADDR, NONPAGED_TEXT_START_ADDR): We have 8K pagesize.
@@ -2876,7 +5073,7 @@ Fri Oct 27 18:03:17 1995 Niklas Hallqvist <niklas@appli.se>
* emulparams/m68k4knbsd.sh: New file.
* scripttempl/aout.sc: Expand EXECUTABLE_SYMBOLS if relocating.
-
+
Fri Oct 27 17:59:09 1995 Ian Lance Taylor <ian@cygnus.com>
* emultempl/aix.em: Include ldctor.h.
@@ -2903,7 +5100,7 @@ Fri Oct 27 17:59:09 1995 Ian Lance Taylor <ian@cygnus.com>
new name parameter.
(constructor_callback): Pass name to ldctor_add_new_set_entry for
new name parameter.
-
+
* ldmisc.c (demangle): Fix indentation. Remove a leading period.
Thu Oct 26 22:22:49 1995 Stan Shebs <shebs@andros.cygnus.com>
@@ -3318,7 +5515,7 @@ Mon Aug 21 18:30:42 1995 steve chamberlain <sac@slash.cygnus.com>
(set_pe_value): New function.
Thu Aug 17 13:35:49 1995 steve chamberlain <sac@slash.cygnus.com>
-
+
* emultempl/{armpe.sc, i386pe.sc}: Deleted.
* emultempl/pe.sc: New file performs generic PE support and sorts
@@ -3338,7 +5535,7 @@ Wed Aug 16 11:38:59 1995 steve chamberlain <sac@slash.cygnus.com>
* scripttempl/armpe.sc: Always start code at 0x401000, even
if -r.
* ldwrite.c (strdup): New extern declaration.
- * ldgram.y (atype): New rule to clarify type parsing.
+ * ldgram.y (atype): New rule to clarify type parsing.
* ldlang.c (init_os): Remove commented out code.
(lang_size_sections): Set SEC_ALLOC and SEC_LOAD bits
unless told not to by the link script.
@@ -3875,7 +6072,7 @@ Thu Mar 2 14:34:43 1995 Ian Lance Taylor <ian@cygnus.com>
Doc note from pierre@phi.la.tce.com (Pierre Willard):
* ld.texinfo: -X and -x work even if -s or -S are not specified.
- * ld.1: Similar change.
+ * ld.1: Similar change.
Wed Mar 1 13:51:16 1995 Ian Lance Taylor <ian@cygnus.com>
@@ -4177,7 +6374,7 @@ Mon Oct 31 19:35:17 1994 Ian Lance Taylor <ian@sanguine.cygnus.com>
Wed Oct 26 13:59:12 1994 J.T. Conklin (jtc@phishhead.cygnus.com)
- * Makefile.in (ALL_EMULATIONS): Added ei386nbsd.o, ens32knbsd.o
+ * Makefile.in (ALL_EMULATIONS): Added ei386nbsd.o, ens32knbsd.o
and esparcnbsd.o; sorted entries.
(ei386nbsd.c,ens32knbsd.c,esparcnbsd.c): New targets.
@@ -4186,7 +6383,7 @@ Wed Oct 26 13:59:12 1994 J.T. Conklin (jtc@phishhead.cygnus.com)
* config/{i386-nbsd.mt,ns32k-nbsd.mt,sparc-nbsd.mt}: New files.
* emulparams/{i386nbsd.sh,ns32knbsd.sh,sparcnbsd.sh}: New files.
- * configure.in (i[345]86-*-netbsd*, ns32k-pc532-netbsd*,
+ * configure.in (i[345]86-*-netbsd*, ns32k-pc532-netbsd*,
sparc*-*-netbsd*): Use above configs.
Tue Oct 25 11:47:10 1994 Ian Lance Taylor <ian@sanguine.cygnus.com>
@@ -4215,7 +6412,7 @@ Fri Oct 14 14:35:38 1994 J.T. Conklin (jtc@rtl.cygnus.com)
* config/{i386,ppc}-nw.mt, emulparams/{i386,ppc}nw.sh,
scripttempl/nw.sc: New files, for i386 and powerpc netware.
-
+
* configure.in: Changed netware ld_target name to be {i386,ppc}-nw
instead of {i386,ppc}-elf.
@@ -4597,7 +6794,7 @@ Wed Jul 20 15:49:27 1994 Ian Lance Taylor (ian@sanguine.cygnus.com)
Sun Jul 10 00:33:24 1994 Ian Dall (dall@hfrd.dsto.gov.au)
* emulparams/pc532machaout.sh: New file. Pc532 mach script
- parameters.
+ parameters.
* emulparams/netbsd532.sh: New file. Netbsd 532 script parameters.
@@ -4860,7 +7057,7 @@ Thu Jun 9 08:35:17 1994 Ian Lance Taylor (ian@cygnus.com)
Thu Jun 9 06:52:29 1994 Bill Cox (bill@rtl.cygnus.com)
* Makefile.in (check): Delete ld.new dependency so that a regression
- test doesn't trigger a rebuild of the linker.
+ test doesn't trigger a rebuild of the linker.
Thu Jun 9 00:17:20 1994 Ian Lance Taylor (ian@tweedledumb.cygnus.com)
@@ -5466,7 +7663,7 @@ Thu Feb 17 15:51:23 1994 Ian Lance Taylor (ian@tweedledumb.cygnus.com)
Thu Feb 17 09:32:14 1994 David J. Mackenzie (djm@thepub.cygnus.com)
* ldlang.c, ldmain.c, ldmisc.c: Use bfd_get_error and
- bfd_set_error and new error names.
+ bfd_set_error and new error names.
Tue Feb 15 20:14:53 1994 Ken Raeburn (raeburn@cujo.cygnus.com)
@@ -5522,7 +7719,7 @@ Sun Feb 6 20:31:56 1994 David J. Mackenzie (djm@thepub.cygnus.com)
Call xmalloc_set_program_name.
* ldlang.c (lang_size_sections): Check if bfd_relax_section set
- bfd_errno.
+ bfd_errno.
Sat Feb 5 03:54:34 1994 David J. Mackenzie (djm@thepub.cygnus.com)
@@ -5585,9 +7782,9 @@ Thu Jan 27 17:19:54 1994 Steve Chamberlain (sac@jonny.cygnus.com)
Thu Jan 27 12:35:01 1994 David J. Mackenzie (djm@thepub.cygnus.com)
- * ldmain.c ldmain.h ldgram.y: If -v -V or --version was given,
+ * ldmain.c ldmain.h ldgram.y: If -v -V or --version was given,
exit successfully instead of complaining if no input files are
- given.
+ given.
Tue Jan 25 13:19:41 1994 Stan Shebs (shebs@andros.cygnus.com)
@@ -5862,7 +8059,7 @@ Wed Dec 1 14:04:20 1993 Ken Raeburn (raeburn@cygnus.com)
* Makefile.in (ALL_EMULATIONS): Add em_coff_sparc.o.
(em_coff_sparc.c): Add dependencies and build rules.
- * ldmisc.c (errno, sys_nerr, sys_errlist): Don't declare.
+ * ldmisc.c (errno, sys_nerr, sys_errlist): Don't declare.
Wed Dec 1 12:19:55 1993 Ian Lance Taylor (ian@tweedledumb.cygnus.com)
@@ -5916,7 +8113,7 @@ Fri Nov 5 09:02:52 1993 D. V. Henkel-Wallace (gumby@blues.cygnus.com)
Fri Nov 5 21:47:55 1993 David J. Mackenzie (djm@thepub.cygnus.com)
- * emulparams/i386mach.sh (TEXT_START_ADDR, NONPAGED_TEXT_START_ADDR):
+ * emulparams/i386mach.sh (TEXT_START_ADDR, NONPAGED_TEXT_START_ADDR):
Correct values (?).
Wed Nov 3 15:10:15 1993 Ken Raeburn (raeburn@rover.cygnus.com)
@@ -6125,7 +8322,7 @@ Sun Sep 12 16:04:40 1993 Doug Evans (dje@cygnus.com)
Fri Sep 10 09:36:29 1993 Jeffrey Wheat (cassidy@cygnus.com)
- * Makefile.in: Changed CXX back to g++.
+ * Makefile.in: Changed CXX back to g++.
Fri Sep 10 09:34:29 1993 Jeffrey Wheat (cassidy@cygnus.com)
@@ -6368,7 +8565,7 @@ Thu Jul 15 12:44:35 1993 David J. Mackenzie (djm@thepub.cygnus.com)
* ldmain.c (set_scripts_dir): Don't look in "." first.
* ldgram.y, ldlang.c, ldsym.c: Remove traces of unused var
- option_longmap.
+ option_longmap.
Thu Jul 15 10:55:59 1993 Ian Lance Taylor (ian@cygnus.com)
@@ -6453,7 +8650,7 @@ Mon Jul 5 14:29:48 1993 Ian Lance Taylor (ian@cygnus.com)
Fri Jul 2 18:06:05 1993 David J. Mackenzie (djm@thepub.cygnus.com)
* genscripts.sh: Put the scripts in the ldscripts directory, not
- emulations.
+ emulations.
* configure.in (ldscripts): Make, instead of emulations.
* Makefile.in (scriptdir): Take off the "ld" part.
(install, clean, distclean): Use ldscripts, not emulations.
@@ -6509,7 +8706,7 @@ Mon Jun 21 16:38:35 1993 David J. Mackenzie (djm@thepub.cygnus.com)
* ldlang.h: Change prototype.
Thu Jun 17 16:53:56 1993 david d `zoo' zuhn (zoo@cygnus.com)
-
+
* Makefile.in: canonicalize install.sh; for use within
this directory (and subdirs)
@@ -6597,7 +8794,7 @@ Mon Jun 7 12:53:28 1993 Per Bothner (bothner@rtl.cygnus.com)
Fri Jun 4 16:18:24 1993 david d `zoo' zuhn (zoo at cirdan.cygnus.com)
- * Makefile.in: remove install:all and install-info:info
+ * Makefile.in: remove install:all and install-info:info
dependencies (these cause some spurious rebuilds at 'make install'
time)
@@ -6888,7 +9085,7 @@ Fri Jan 8 14:39:07 1993 Steve Chamberlain (sac@thepub.cygnus.com)
Fix support for NOLOAD, add INCLUDE
* ldfile.c (ldfile_open_command_file): pass file name to
lex_push_file.
- * ldlex.l, ldgram.y: tidy up, parse INCLUDE and NOLOAD
+ * ldlex.l, ldgram.y: tidy up, parse INCLUDE and NOLOAD
* ldlang.c (wild_doit): make output sections inherit NEVER_LOAD
attribute.
@@ -6993,7 +9190,7 @@ Thu Oct 15 15:20:26 1992 Steve Chamberlain (sac@thepub.cygnus.com)
Thu Oct 8 09:05:25 1992 Steve Chamberlain (sac@thepub.cygnus.com)
- * ldmisc.c (demangle,vfinfo): use the new underscore in bfd to
+ * ldmisc.c (demangle,vfinfo): use the new underscore in bfd to
to demangle symbols better
Tue Oct 6 13:08:54 1992 Ian Lance Taylor (ian@cygnus.com)
@@ -7008,7 +9205,7 @@ Mon Oct 5 14:07:37 1992 Ian Lance Taylor (ian@cygnus.com)
Mon Oct 5 08:55:14 1992 Steve Chamberlain (sac@thepub.cygnus.com)
- * ldmain.c (linear_library): don't even think about processing
+ * ldmain.c (linear_library): don't even think about processing
an object file if it's already been done
Thu Oct 1 23:14:59 1992 david d `zoo' zuhn (zoo at cirdan.cygnus.com)
@@ -7125,8 +9322,8 @@ Wed Aug 26 17:28:51 1992 Steve Chamberlain (sac@thepub.cygnus.com)
* ldwrite.c (ldwrite): use malloc to allocate the largest space
used, and pass that down.
* relax.c,relax.h (write_relaxnorel): use the passed malloc area rather
- than alloca.
-
+ than alloca.
+
Mon Aug 24 14:42:06 1992 Ian Lance Taylor (ian@cygnus.com)
* configure.in, config/ose68.mt: renamed OSE to ose.
@@ -7146,7 +9343,7 @@ Thu Aug 13 11:49:34 1992 Steve Chamberlain (sac@thepub.cygnus.com)
* ldlex.l: now parses comment correctly, added ~ to acceptable
chars in filenames
-
+
* ldexp.c (exp_unop): pass down abs_output_section - now can have
unary -ve constants.
@@ -7198,7 +9395,7 @@ Fri Jul 17 22:06:11 1992 K. Richard Pixley (rich@rtl.cygnus.com)
Tue Jul 14 08:34:34 1992 Steve Chamberlain (sac@thepub.cygnus.com)
* ldlang.c (lang_map): print changes in sizes due to relaxing
- (size_input_section): maintain the delta information.
+ (size_input_section): maintain the delta information.
* ldlang.h: add new field to struct to contain delta info.
* relax.c (relax_section): complain if input not relaxable.
* ldlex.l : add '_', ',' and '$' to chars which can appear at the
@@ -7213,7 +9410,7 @@ Wed Jul 1 17:51:19 1992 Steve Chamberlain (sac@thepub.cygnus.com)
* ldmain.c (Q_enter_global_ref), ldindr.c (add_indirect): fix for
aliasing problems
-
+
Thu Jun 18 09:38:56 1992 Steve Chamberlain (sac@thepub.cygnus.com)
@@ -7299,7 +9496,7 @@ Tue May 5 17:47:33 1992 Steve Chamberlain (sac@thepub.cygnus.com)
* ldmain.c (main): take out ./ from library path, and close file
before unlinking. Make multiple defs of a symbol create an
unexecable file.
- * ldmisc.c: fatal errosrs delete output file
+ * ldmisc.c: fatal errosrs delete output file
Tue May 5 14:05:05 1992 Per Bothner (bothner@rtl.cygnus.com)
@@ -7375,7 +9572,7 @@ Thu Apr 9 05:52:02 1992 Ken Raeburn (Raeburn@Cygnus.COM)
Sat Apr 4 17:44:06 1992 Steve Chamberlain (sac@thepub.cygnus.com)
- * ldlex.l, ldgram.y, ldlex.h: Rewrote lexer. Now it's much nicer.
+ * ldlex.l, ldgram.y, ldlex.h: Rewrote lexer. Now it's much nicer.
* h8300*: fix bit rot and add support for h8300xray target
* go32.sh: target emulation for go32.
@@ -7427,7 +9624,7 @@ Fri Feb 28 08:17:45 1992 Steve Chamberlain (sac at thepub.cygnus.com)
Thu Feb 27 09:20:41 1992 Steve Chamberlain (sac at thepub.cygnus.com)
-
+
* cplus-dem.c: yet another copy of this - maybe it should go into
libiberty ?
* ldgram.y: now -V and -v have different actions
@@ -7514,7 +9711,7 @@ Thu Feb 6 11:40:15 1992 Steve Chamberlain (sac at rtl.cygnus.com)
* config/mt-coff-h8300: use EMUL like everything else
* ldlang.c: (print_padding_statement): print the right address.
* Makefile.in, config.h, ldemul.c: renamed h8300hds to h8300hms
-
+
Tue Feb 4 15:28:01 1992 Steve Chamberlain (sac at rtl.cygnus.com)
@@ -7594,7 +9791,7 @@ Sat Dec 7 17:19:26 1991 Steve Chamberlain (sac at rtl.cygnus.com)
* ldfile.c: include ctype.h
* ldmain.c: include the requried prototype headers
* ldwrite.c: get_reloc_upper_bound has been renamed
- bfd_get_reloc_upper_bound
+ bfd_get_reloc_upper_bound
Fri Dec 6 23:29:26 1991 K. Richard Pixley (rich at rtl.cygnus.com)
@@ -7640,7 +9837,7 @@ Thu Nov 14 19:55:09 1991 Per Bothner (bothner at cygnus.com)
Wed Nov 13 15:17:43 1991 Per Bothner (bothner at cygnus.com)
* Makefile.in: Rename .c files generated from ldtemplate
- to have names starting with ld__. This helps 'make clean'.
+ to have names starting with ld__. This helps 'make clean'.
Tue Nov 12 18:36:50 1991 Steve Chamberlain (sac at cygnus.com)
@@ -7687,7 +9884,7 @@ Wed Oct 16 12:27:08 1991 Per Bothner (bothner at cygnus.com)
ldgram.y, ldlex.l, ldlnk960.c, ldmain.c, ldmisc.c, ldmisc.h,
ldsym.c, ldsym.h, ldtemplate, ldvanilla.c, ldver.c, ldver.h,
ldwarn.c, ldwarn.h, ldwrite.c, ldwrite.h, mkscript.c:
- Add or update copyright notices.
+ Add or update copyright notices.
Mon Oct 14 23:55:27 1991 Per Bothner (bothner at cygnus.com)
@@ -7774,7 +9971,7 @@ Tue Oct 8 14:51:21 1991 Roland H. Pesch (pesch at cygnus.com)
Fri Oct 4 21:51:58 1991 John Gilmore (gnu at cygnus.com)
* Makefile.in: Avoid using $< in non-suffix rules (breaks on Sun
- Make).
+ Make).
* ldfile.c, ldlang.c, ldmain.c, ldwrite.c: Cope with renames of a
few BFD types & enums.
diff --git a/contrib/binutils/ld/Makefile.am b/contrib/binutils/ld/Makefile.am
index e5be23d..a0eb125 100644
--- a/contrib/binutils/ld/Makefile.am
+++ b/contrib/binutils/ld/Makefile.am
@@ -1,12 +1,17 @@
## Process this file with automake to generate Makefile.in
+## FIXME: work around apparent automake bug.
+INTLLIBS = @INTLLIBS@
+
AUTOMAKE_OPTIONS = cygnus dejagnu
+SUBDIRS = po
+
tooldir = $(exec_prefix)/$(target_alias)
-YACC = `if [ -f ../bison/bison ] ; then echo ../bison/bison -y -L../bison/bison ; else echo bison -y ; fi`
+YACC = `if [ -f ../bison/bison ]; then echo ../bison/bison -y -L$(srcdir)/../bison/; else echo @YACC@; fi`
YFLAGS = -d
-LEX = `if [ -f ../flex/flex ] ; then echo ../flex/flex ; else echo flex ; fi`
+LEX = `if [ -f ../flex/flex ]; then echo ../flex/flex; else echo @LEX@; fi`
# We put the scripts in the directory $(scriptdir)/ldscripts.
# We can't put the scripts in $(datadir) because the SEARCH_DIR
@@ -15,6 +20,7 @@ scriptdir = $(tooldir)/lib
EMUL = @EMUL@
EMULATION_OFILES = @EMULATION_OFILES@
+EMUL_EXTRA_OFILES = @EMUL_EXTRA_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.
@@ -27,7 +33,7 @@ LIB_PATH =
BASEDIR = $(srcdir)/..
BFDDIR = $(BASEDIR)/bfd
INCDIR = $(BASEDIR)/include
-DEP = mkdep
+MKDEP = gcc -MM
# What version of the manual to build
DOCVER = gen
@@ -84,7 +90,7 @@ 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)
+INCLUDES = -D_GNU_SOURCE -I. -I$(srcdir) -I../bfd -I$(BFDDIR) -I$(INCDIR) -I$(top_srcdir)/../intl -I../intl $(HDEFINES) $(CFLAGS) -DLOCALEDIR="\"$(prefix)/share/locale\""
BFDLIB = ../bfd/libbfd.la
LIBIBERTY = ../libiberty/libiberty.a
@@ -95,27 +101,50 @@ ALL_EMULATIONS = \
eaixrs6.o \
ealpha.o \
earcelf.o \
+ earmelf.o \
+ earmelf_oabi.o \
+ earmelf_linux.o \
+ earmelf_linux26.o \
earmaoutb.o \
earmaoutl.o \
earmcoff.o \
+ earmnbsd.o \
earmpe.o \
+ earm_epoc_pe.o \
+ eavr1200.o \
+ eavr23xx.o \
+ eavr44x4.o \
+ eavr4433.o \
+ eavr85xx.o \
+ eavrmega603.o \
+ eavrmega103.o \
+ eavrmega161.o \
ecoff_sparc.o \
ed10velf.o \
+ ed30velf.o \
+ ed30v_e.o \
+ ed30v_o.o \
edelta68.o \
eebmon29k.o \
eelf32_sparc.o \
+ eelf32_i960.o \
eelf32b4300.o \
eelf32bmip.o \
eelf32ebmip.o \
eelf32elmip.o \
+ eelf32bmipn32.o \
+ eelf32i370.o \
eelf32l4300.o \
eelf32lmip.o \
eelf32lppc.o \
eelf32ppc.o \
+ eelf32ppclinux.o \
eelf_i386.o \
+ eelf_i386_be.o \
egld960.o \
egld960coff.o \
- ego32.o \
+ eelf32fr30.o \
+ eelf32mcore.o \
eh8300.o \
eh8300h.o \
eh8300s.o \
@@ -126,8 +155,8 @@ ALL_EMULATIONS = \
eh8500s.o \
ehp300bsd.o \
ehp3hpux.o \
- ehppaelf.o \
ei386aout.o \
+ ei386beos.o \
ei386bsd.o \
ei386coff.o \
ei386go32.o \
@@ -139,6 +168,7 @@ ALL_EMULATIONS = \
ei386nbsd.o \
ei386nw.o \
ei386pe.o \
+ ei386pe_posix.o \
elnk960.o \
em68k4knbsd.o \
em68kaout.o \
@@ -150,13 +180,17 @@ ALL_EMULATIONS = \
em68knbsd.o \
em68kpsos.o \
em88kbcs.o \
+ emcorepe.o \
emipsbig.o \
emipsbsd.o \
emipsidt.o \
emipsidtl.o \
emipslit.o \
emipslnews.o \
+ emipspe.o \
enews.o \
+ epjelf.o \
+ epjlelf.o \
ens32knbsd.o \
epc532macha.o \
eppcmacos.o \
@@ -168,6 +202,7 @@ ALL_EMULATIONS = \
eshelf.o \
eshlelf.o \
eshl.o \
+ eshpe.o \
esparcaout.o \
esparclinux.o \
esparclynx.o \
@@ -177,6 +212,7 @@ ALL_EMULATIONS = \
esun4.o \
etic30aout.o \
etic30coff.o \
+ etic80coff.o \
evanilla.o \
evax.o \
evsta.o \
@@ -186,25 +222,40 @@ ALL_EMULATIONS = \
ALL_64_EMULATIONS = \
eelf64_sparc.o \
- eelf64alpha.o
+ eelf64alpha.o \
+ eelf64bmip.o
+
+ALL_EMUL_EXTRA_OFILES = \
+ pe-dll.o \
+ deffilep.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
+ mri.c ldcref.c pe-dll.c
-HFILES = config.h ld.h ldctor.h ldemul.h ldexp.h ldfile.h \
+HFILES = ld.h ldctor.h ldemul.h ldexp.h ldfile.h \
ldlang.h ldlex.h ldmain.h ldmisc.h ldver.h \
- ldwrite.h mri.h
+ ldwrite.h mri.h deffile.h pe-dll.h
-GENERATED_CFILES = ldgram.c ldlex.c
-GENERATED_HFILES = ldgram.h ldemul-list.h
+GENERATED_CFILES = ldgram.c ldlex.c deffilep.c
+GENERATED_HFILES = ldgram.h ldemul-list.h deffilep.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}
+ ldfile.o ldcref.o ${EMULATION_OFILES} ${EMUL_EXTRA_OFILES}
STAGESTUFF = *.o ldscripts/* e*.c
+# At the moment this is just a list of those emulation template files
+# that contain internationalised strings.
+EMULATION_FILES = emultempl/pe.em emultempl/armcoff.em
+
+POTFILES = $(CFILES) $(HFILES) $(EMULATION_FILES)
+
+po/POTFILES.in: @MAINT@ Makefile
+ for file in $(POTFILES); do echo $$file; done | sort > tmp \
+ && mv tmp $(srcdir)/po/POTFILES.in
+
ldmain.o: ldmain.c config.status
$(COMPILE) -c -DDEFAULT_EMULATION='"$(EMUL)"' -DSCRIPTDIR='"$(scriptdir)"' -DTARGET='"@target@"' $(srcdir)/ldmain.c
@@ -223,10 +274,13 @@ ldemul-list.h: Makefile
echo " 0") >ldemul-tmp.h
mv ldemul-tmp.h ldemul-list.h
+stringify.sed: ${srcdir}/emultempl/$(STRINGIFY)
+ cp ${srcdir}/emultempl/$(STRINGIFY) stringify.sed
+
# 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
+GENSCRIPTS = $(SHELL) $(srcdir)/genscripts.sh ${srcdir} ${libdir} @host@ @target@ @target_alias@ "@EMULATION_LIBPATH@" "@NATIVE_LIB_DIRS@"
+GEN_DEPENDS = $(srcdir)/genscripts.sh stringify.sed
@TDIRS@
ea29k.c: $(srcdir)/emulparams/a29k.sh \
@@ -244,6 +298,18 @@ ealpha.c: $(srcdir)/emulparams/alpha.sh \
earcelf.c: $(srcdir)/emulparams/arcelf.sh \
$(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS}
${GENSCRIPTS} arcelf "$(tdir_arcelf)"
+earmelf.c: $(srcdir)/emulparams/armelf.sh \
+ $(srcdir)/emultempl/armelf.em $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS}
+ ${GENSCRIPTS} armelf "$(tdir_armelf)"
+earmelf_oabi.c: $(srcdir)/emulparams/armelf_oabi.sh \
+ $(srcdir)/emultempl/armelf_oabi.em $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS}
+ ${GENSCRIPTS} armelf_oabi "$(tdir_armelf)"
+earmelf_linux.c: $(srcdir)/emulparams/armelf_linux.sh \
+ $(srcdir)/emultempl/armelf.em $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS}
+ ${GENSCRIPTS} armelf_linux "$(tdir_armelf_linux)"
+earmelf_linux26.c: $(srcdir)/emulparams/armelf_linux26.sh \
+ $(srcdir)/emultempl/armelf.em $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS}
+ ${GENSCRIPTS} armelf_linux26 "$(tdir_armelf_linux26)"
earmaoutb.c: $(srcdir)/emulparams/armaoutb.sh \
$(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/armaout.sc ${GEN_DEPENDS}
${GENSCRIPTS} armaoutb "$(tdir_armaoutb)"
@@ -251,29 +317,85 @@ 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}
+ $(srcdir)/emultempl/armcoff.em $(srcdir)/scripttempl/armcoff.sc ${GEN_DEPENDS}
${GENSCRIPTS} armcoff "$(tdir_armcoff)"
+earmnbsd.c: $(srcdir)/emulparams/armnbsd.sh \
+ $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/aout.sc ${GEN_DEPENDS}
+ ${GENSCRIPTS} armnbsd "$(tdir_armnbsd)"
+earm_epoc_pe.c: $(srcdir)/emulparams/arm_epoc_pe.sh \
+ $(srcdir)/emultempl/pe.em $(srcdir)/scripttempl/epocpe.sc ${GEN_DEPENDS}
+ ${GENSCRIPTS} arm_epoc_pe "$(tdir_armpe)"
earmpe.c: $(srcdir)/emulparams/armpe.sh \
$(srcdir)/emultempl/pe.em $(srcdir)/scripttempl/pe.sc ${GEN_DEPENDS}
${GENSCRIPTS} armpe "$(tdir_armpe)"
+eavr85xx.c: $(srcdir)/emulparams/avr85xx.sh \
+ $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/elf32avr.sc \
+ ${GEN_DEPENDS}
+ ${GENSCRIPTS} avr85xx "$(tdir_avr85xx)"
+eavr1200.c: $(srcdir)/emulparams/avr1200.sh \
+ $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/elf32avr.sc \
+ ${GEN_DEPENDS}
+ ${GENSCRIPTS} avr1200 "$(tdir_avr85xx)"
+eavr23xx.c: $(srcdir)/emulparams/avr23xx.sh \
+ $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/elf32avr.sc \
+ ${GEN_DEPENDS}
+ ${GENSCRIPTS} avr23xx "$(tdir_avr85xx)"
+eavr44x4.c: $(srcdir)/emulparams/avr44x4.sh \
+ $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/elf32avr.sc \
+ ${GEN_DEPENDS}
+ ${GENSCRIPTS} avr44x4 "$(tdir_avr85xx)"
+eavr4433.c: $(srcdir)/emulparams/avr4433.sh \
+ $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/elf32avr.sc \
+ ${GEN_DEPENDS}
+ ${GENSCRIPTS} avr4433 "$(tdir_avr85xx)"
+eavrmega603.c: $(srcdir)/emulparams/avrmega603.sh \
+ $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/elf32avr.sc \
+ ${GEN_DEPENDS}
+ ${GENSCRIPTS} avrmega603 "$(tdir_avr85xx)"
+eavrmega103.c: $(srcdir)/emulparams/avrmega103.sh \
+ $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/elf32avr.sc \
+ ${GEN_DEPENDS}
+ ${GENSCRIPTS} avrmega103 "$(tdir_avr85xx)"
+eavrmega161.c: $(srcdir)/emulparams/avrmega161.sh \
+ $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/elf32avr.sc \
+ ${GEN_DEPENDS}
+ ${GENSCRIPTS} avrmega161 "$(tdir_avr85xx)"
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)"
+ed30velf.c: $(srcdir)/emulparams/d30velf.sh \
+ $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/elfd30v.sc ${GEN_DEPENDS}
+ ${GENSCRIPTS} d30velf "$(tdir_d30v)"
+ed30v_o.c: $(srcdir)/emulparams/d30v_o.sh \
+ $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/elfd30v.sc ${GEN_DEPENDS}
+ ${GENSCRIPTS} d30v_o "$(tdir_d30v)"
+ed30v_e.c: $(srcdir)/emulparams/d30v_e.sh \
+ $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/elfd30v.sc ${GEN_DEPENDS}
+ ${GENSCRIPTS} d30v_e "$(tdir_d30v)"
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)"
+eelf32fr30.c: $(srcdir)/emulparams/elf32fr30.sh \
+ $(srcdir)/emultempl/elf32.em $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS}
+ ${GENSCRIPTS} elf32fr30 "$(tdir_fr30)"
+eelf32mcore.c: $(srcdir)/emulparams/elf32mcore.sh \
+ $(srcdir)/emultempl/elf32.em $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS}
+ ${GENSCRIPTS} elf32mcore "$(tdir_mcore)"
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)"
+eelf32_i960.c: $(srcdir)/emulparams/elf32_i960.sh \
+ $(srcdir)/emultempl/elf32.em $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS}
+ ${GENSCRIPTS} elf32_i960 "$(tdir_elf32_i960)"
eelf32b4300.c: $(srcdir)/emulparams/elf32b4300.sh \
$(srcdir)/emultempl/elf32.em $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS}
${GENSCRIPTS} elf32b4300 "$(tdir_elf32b4300)"
@@ -289,6 +411,9 @@ eelf32ebmip.c: $(srcdir)/emulparams/elf32ebmip.sh \
eelf32elmip.c: $(srcdir)/emulparams/elf32elmip.sh \
$(srcdir)/emultempl/elf32.em $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS}
${GENSCRIPTS} elf32elmip "$(tdir_elf32elmip)"
+eelf32bmipn32.c: $(srcdir)/emulparams/elf32bmipn32.sh \
+ $(srcdir)/emultempl/elf32.em $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS}
+ ${GENSCRIPTS} elf32bmipn32 "$(tdir_elf32bmipn32)"
eelf32l4300.c: $(srcdir)/emulparams/elf32l4300.sh \
$(srcdir)/emultempl/elf32.em $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS}
${GENSCRIPTS} elf32l4300 "$(tdir_elf32l4300)"
@@ -304,24 +429,33 @@ eelf32lsmip.c: $(srcdir)/emulparams/elf32lsmip.sh \
eelf32ppc.c: $(srcdir)/emulparams/elf32ppc.sh \
$(srcdir)/emultempl/elf32.em $(srcdir)/scripttempl/elfppc.sc ${GEN_DEPENDS}
${GENSCRIPTS} elf32ppc "$(tdir_elf32ppc)"
+eelf32ppclinux.c: $(srcdir)/emulparams/elf32ppclinux.sh \
+ $(srcdir)/emultempl/elf32.em $(srcdir)/scripttempl/elfppc.sc ${GEN_DEPENDS}
+ ${GENSCRIPTS} elf32ppclinux "$(tdir_elf32ppclinux)"
+eelf32i370.c: $(srcdir)/emulparams/elf32i370.sh \
+ $(srcdir)/emultempl/elf32.em $(srcdir)/scripttempl/elfi370.sc ${GEN_DEPENDS}
+ ${GENSCRIPTS} elf32i370 "$(tdir_elf32i370)"
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)"
+eelf64bmip.c: $(srcdir)/emulparams/elf64bmip.sh \
+ $(srcdir)/emultempl/elf32.em $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS}
+ ${GENSCRIPTS} elf64bmip "$(tdir_elf64bmip)"
eelf_i386.c: $(srcdir)/emulparams/elf_i386.sh \
$(srcdir)/emultempl/elf32.em $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS}
${GENSCRIPTS} elf_i386 "$(tdir_elf_i386)"
+eelf_i386_be.c: $(srcdir)/emulparams/elf_i386_be.sh \
+ $(srcdir)/emultempl/elf32.em $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS}
+ ${GENSCRIPTS} elf_i386_be "$(tdir_elf_i386_be)"
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)"
@@ -352,12 +486,12 @@ ehp300bsd.c: $(srcdir)/emulparams/hp300bsd.sh \
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)"
+ei386beos.c: $(srcdir)/emulparams/i386beos.sh \
+ $(srcdir)/emultempl/beos.em $(srcdir)/scripttempl/i386beos.sc ${GEN_DEPENDS}
+ ${GENSCRIPTS} i386beos "$(tdir_i386beos)"
ei386bsd.c: $(srcdir)/emulparams/i386bsd.sh \
$(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/aout.sc ${GEN_DEPENDS}
${GENSCRIPTS} i386bsd "$(tdir_i386bsd)"
@@ -391,6 +525,9 @@ ei386nw.c: $(srcdir)/emulparams/i386nw.sh \
ei386pe.c: $(srcdir)/emulparams/i386pe.sh \
$(srcdir)/emultempl/pe.em $(srcdir)/scripttempl/pe.sc ${GEN_DEPENDS}
${GENSCRIPTS} i386pe "$(tdir_i386pe)"
+ei386pe_posix.c: $(srcdir)/emulparams/i386pe_posix.sh \
+ $(srcdir)/emultempl/pe.em $(srcdir)/scripttempl/pe.sc ${GEN_DEPENDS}
+ ${GENSCRIPTS} i386pe_posix "$(tdir_i386pe_posix)"
elnk960.c: $(srcdir)/emulparams/lnk960.sh \
$(srcdir)/emultempl/lnk960.em $(srcdir)/scripttempl/i960.sc ${GEN_DEPENDS}
${GENSCRIPTS} lnk960 "$(tdir_lnk960)"
@@ -424,6 +561,9 @@ em68kpsos.c: $(srcdir)/emulparams/m68kpsos.sh \
em88kbcs.c: $(srcdir)/emulparams/m88kbcs.sh \
$(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/m88kbcs.sc ${GEN_DEPENDS}
${GENSCRIPTS} m88kbcs "$(tdir_m88kbcs)"
+emcorepe.c: $(srcdir)/emulparams/mcorepe.sh \
+ $(srcdir)/emultempl/pe.em $(srcdir)/scripttempl/pe.sc ${GEN_DEPENDS}
+ ${GENSCRIPTS} mcorepe "$(tdir_mcorepe)"
emipsbig.c: $(srcdir)/emulparams/mipsbig.sh \
$(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/mips.sc ${GEN_DEPENDS}
${GENSCRIPTS} mipsbig
@@ -442,6 +582,9 @@ emipslit.c: $(srcdir)/emulparams/mipslit.sh \
emipslnews.c: $(srcdir)/emulparams/mipslnews.sh \
$(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/mips.sc ${GEN_DEPENDS}
${GENSCRIPTS} mipslnews
+emipspe.c: $(srcdir)/emulparams/mipspe.sh \
+ $(srcdir)/emultempl/pe.em $(srcdir)/scripttempl/pe.sc ${GEN_DEPENDS}
+ ${GENSCRIPTS} mipspe "$(tdir_mips)"
emn10300.c: $(srcdir)/emulparams/mn10300.sh \
$(srcdir)/emultempl/elf32.em $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS}
${GENSCRIPTS} mn10300 "$(tdir_mn10300)"
@@ -457,6 +600,12 @@ ens32knbsd.c: $(srcdir)/emulparams/ns32knbsd.sh \
epc532macha.c: $(srcdir)/emulparams/pc532macha.sh \
$(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/aout.sc ${GEN_DEPENDS}
${GENSCRIPTS} pc532macha "$(tdir_pc532macha)"
+epjelf.c: $(srcdir)/emulparams/pjelf.sh \
+ $(srcdir)/emultempl/elf32.em $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS}
+ ${GENSCRIPTS} pjelf "$(tdir_pjelf)"
+epjlelf.c: $(srcdir)/emulparams/pjlelf.sh \
+ $(srcdir)/emultempl/elf32.em $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS}
+ ${GENSCRIPTS} pjlelf "$(tdir_pjlelf)"
eppcmacos.c: $(srcdir)/emulparams/ppcmacos.sh \
$(srcdir)/emultempl/aix.em $(srcdir)/scripttempl/aix.sc ${GEN_DEPENDS}
${GENSCRIPTS} ppcmacos "$(tdir_ppcmacos)"
@@ -484,6 +633,9 @@ eshlelf.c: $(srcdir)/emulparams/shlelf.sh \
eshl.c: $(srcdir)/emulparams/shl.sh \
$(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/sh.sc ${GEN_DEPENDS}
${GENSCRIPTS} shl "$(tdir_shl)"
+eshpe.c: $(srcdir)/emulparams/shpe.sh \
+ $(srcdir)/emultempl/pe.em $(srcdir)/scripttempl/pe.sc ${GEN_DEPENDS}
+ ${GENSCRIPTS} shpe "$(tdir_shl)"
esparcaout.c: $(srcdir)/emulparams/sparcaout.sh \
$(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/aout.sc ${GEN_DEPENDS}
${GENSCRIPTS} sparcaout "$(tdir_sparcaout)"
@@ -511,6 +663,9 @@ etic30aout.c: $(srcdir)/emulparams/tic30aout.sh \
etic30coff.c: $(srcdir)/emulparams/tic30coff.sh \
$(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/tic30coff.sc ${GEN_DEPENDS}
${GENSCRIPTS} tic30coff "$(tdir_tic30coff)"
+etic80coff.c: $(srcdir)/emulparams/tic80coff.sh \
+ $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/tic80coff.sc ${GEN_DEPENDS}
+ ${GENSCRIPTS} tic80coff "$(tdir_tic80coff)"
evanilla.c: $(srcdir)/emulparams/vanilla.sh \
$(srcdir)/emultempl/vanilla.em $(srcdir)/scripttempl/vanilla.sc ${GEN_DEPENDS}
${GENSCRIPTS} vanilla "$(tdir_vanilla)"
@@ -535,8 +690,8 @@ ez8002.c: $(srcdir)/emulparams/z8002.sh \
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)
+ld_new_DEPENDENCIES = $(EMULATION_OFILES) $(EMUL_EXTRA_OFILES) $(BFDLIB) $(LIBIBERTY) $(INTLDEPS)
+ld_new_LDADD = $(EMULATION_OFILES) $(EMUL_EXTRA_OFILES) $(BFDLIB) $(LIBIBERTY) $(INTLLIBS)
# The generated emulation files mostly have the same dependencies.
$(EMULATION_OFILES): ../bfd/bfd.h sysdep.h config.h $(INCDIR)/bfdlink.h \
@@ -549,6 +704,7 @@ TESTBFDLIB = @TESTBFDLIB@
check-DEJAGNU: site.exp
srcroot=`cd $(srcdir) && pwd`; export srcroot; \
r=`pwd`; export r; \
+ LC_COLLATE=; LC_ALL=; LANG=; export LC_COLLATE LC_ALL LANG; \
EXPECT=$(EXPECT); export EXPECT; \
if [ -f $(top_builddir)/../expect/expect ]; then \
TCL_LIBRARY=`cd $(top_srcdir)/../tcl/library && pwd`; \
@@ -561,8 +717,7 @@ check-DEJAGNU: site.exp
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)" \
+ LIBIBERTY="$(LIBIBERTY) $(INTLLIBS)" LIBS="$(LIBS)" \
$(RUNTESTFLAGS); \
else echo "WARNING: could not find \`runtest'" 1>&2; :;\
fi
@@ -574,16 +729,16 @@ check-DEJAGNU: site.exp
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)
+ ./ld-new$(EXEEXT) $(HOSTING_EMU) -o ld1$(EXEEXT) $(HOSTING_CRT0) ld-partial.o $(TESTBFDLIB) $(LIBIBERTY) $(HOSTING_LIBS) $(LIBS)
ld1-full$(EXEEXT): ld-new
- ./ld-new$(EXEEXT) $(HOSTING_EMU) -o ld1-full$(EXEEXT) $(HOSTING_CRT0) $(OFILES) $(TESTBFDLIB) $(LIBIBERTY) $(HOSTING_LIBS)
+ ./ld-new$(EXEEXT) $(HOSTING_EMU) -o ld1-full$(EXEEXT) $(HOSTING_CRT0) $(OFILES) $(TESTBFDLIB) $(LIBIBERTY) $(HOSTING_LIBS) $(LIBS)
ld2$(EXEEXT): ld1$(EXEEXT)
- ./ld1$(EXEEXT) $(HOSTING_EMU) -o ld2$(EXEEXT) $(HOSTING_CRT0) $(OFILES) $(TESTBFDLIB) $(LIBIBERTY) $(HOSTING_LIBS)
+ ./ld1$(EXEEXT) $(HOSTING_EMU) -o ld2$(EXEEXT) $(HOSTING_CRT0) $(OFILES) $(TESTBFDLIB) $(LIBIBERTY) $(HOSTING_LIBS) $(LIBS)
ld3$(EXEEXT): ld2$(EXEEXT)
- ./ld2$(EXEEXT) $(HOSTING_EMU) -o ld3$(EXEEXT) $(HOSTING_CRT0) $(OFILES) $(TESTBFDLIB) $(LIBIBERTY) $(HOSTING_LIBS)
+ ./ld2$(EXEEXT) $(HOSTING_EMU) -o ld3$(EXEEXT) $(HOSTING_CRT0) $(OFILES) $(TESTBFDLIB) $(LIBIBERTY) $(HOSTING_LIBS) $(LIBS)
bootstrap: ld3$(EXEEXT)
cmp ld2$(EXEEXT) ld3$(EXEEXT)
@@ -630,22 +785,29 @@ configdoc.texi: ${DOCVER}-doc.texi
|| 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
+ldver.texi: Makefile
+ rm -f $@
+ echo '@set VERSION $(VERSION)' > $@
+
+ld.info: $(srcdir)/ld.texinfo configdoc.texi ldver.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
+ld.dvi: $(srcdir)/ld.texinfo configdoc.texi ldver.texi
TEXINPUTS=$(top_srcdir)/../texinfo:$$TEXINPUTS \
- MAKEINFO='$(MAKEINFO) -I $(srcdir) -I $(BFDDIR)/doc' $(TEXI2DVI) $(srcdir)/ld.texinfo
+ MAKEINFO="$(MAKEINFO) -I $(srcdir) -I $(BFDDIR)/doc" $(TEXI2DVI) $(srcdir)/ld.texinfo
+
+MAINTAINERCLEANFILES = ldver.texi
# We want to reconfigure if configure.host or configure.tgt changes.
-Makefile: configure.host configure.tgt
+config.status: $(srcdir)/configure $(srcdir)/configure.host $(srcdir)/configure.tgt
+ $(SHELL) ./config.status --recheck
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
+CLEANFILES = dep.sed DEP DEP1 DEP2
.PHONY: install-exec-local install-data-local
@@ -653,19 +815,19 @@ 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)'`; \
+ echo " $(LIBTOOL) --mode=install $(INSTALL_PROGRAM) $$p $(bindir)/`echo $$p|sed -e 's/$(EXEEXT)$$//' -e 's/-new//'|sed '$(transform)'|sed 's/$$/$(EXEEXT)/'`"; \
+ $(LIBTOOL) --mode=install $(INSTALL_PROGRAM) $$p $(bindir)/`echo $$p|sed -e 's/$(EXEEXT)$$//' -e 's/-new//'|sed '$(transform)'|sed 's/$$/$(EXEEXT)/'`; \
else :; fi; \
done
- rm -f $(tooldir)/bin/ld$(EXEEXT)
n=`echo ld | sed '$(transform)'`; \
if [ "$(bindir)/$$n$(EXEEXT)" != "$(tooldir)/bin/ld$(EXEEXT)" ]; then \
+ rm -f $(tooldir)/bin/ld$(EXEEXT); \
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)
+ $(mkinstalldirs) $(scriptdir)/ldscripts
for f in ldscripts/*; do \
$(INSTALL_DATA) $$f $(scriptdir)/$$f ; \
done
@@ -675,43 +837,42 @@ install-data-local:
LDDISTSTUFF = ldgram.c ldgram.h ldlex.c
diststuff: $(LDDISTSTUFF) info
-DISTCLEANFILES = site.exp site.bak
-
+DISTCLEANFILES = tdirs 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
+# 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) MKDEP="$(MKDEP)" DEP1
+ sed -f dep.sed < DEP1 > $@
+ echo '# IF YOU PUT ANYTHING HERE IT WILL GO AWAY' >> $@
+
+DEP1: $(CFILES) $(GENERATED_CFILES)
+ echo '# DO NOT DELETE THIS LINE -- mkdep uses it.' > DEP2
+ echo '# DO NOT PUT ANYTHING AFTER THIS LINE, IT WILL GO AWAY.' >> DEP2
+ $(MKDEP) $(INCLUDES) $(CFLAGS) $? >> DEP2
+ mv -f DEP2 $@
dep.sed: dep-in.sed config.status
sed <$(srcdir)/dep-in.sed >dep.sed \
-e 's!@INCDIR@!$(INCDIR)!' \
-e 's!@SRCDIR@!$(srcdir)!'
-dep: .dep
+dep: DEP
sed -e '/^..DO NOT DELETE THIS LINE/,$$d' < Makefile > tmp-Makefile
- cat .dep >> tmp-Makefile
+ cat DEP >> tmp-Makefile
$(srcdir)/../move-if-change tmp-Makefile Makefile
-dep-in: .dep
+dep-in: DEP
sed -e '/^..DO NOT DELETE THIS LINE/,$$d' < $(srcdir)/Makefile.in > tmp-Makefile.in
- cat .dep >> tmp-Makefile.in
+ cat DEP >> tmp-Makefile.in
$(srcdir)/../move-if-change tmp-Makefile.in $(srcdir)/Makefile.in
-dep-am: .dep
+dep-am: DEP
sed -e '/^..DO NOT DELETE THIS LINE/,$$d' < $(srcdir)/Makefile.am > tmp-Makefile.am
- cat .dep >> tmp-Makefile.am
+ cat DEP >> tmp-Makefile.am
$(srcdir)/../move-if-change tmp-Makefile.am $(srcdir)/Makefile.am
.PHONY: dep dep-in dep-am
@@ -720,59 +881,70 @@ dep-am: .dep
# 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
+ ld.h $(INCDIR)/bin-bugs.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
+ sysdep.h config.h $(INCDIR)/fopen-same.h ld.h $(INCDIR)/bin-bugs.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
+ ld.h $(INCDIR)/bin-bugs.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
+ ld.h $(INCDIR)/bin-bugs.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
+ $(INCDIR)/obstack.h $(INCDIR)/bfdlink.h ld.h $(INCDIR)/bin-bugs.h \
+ ldmain.h ldgram.h ldexp.h ldlang.h ldemul.h ldlex.h \
+ ldmisc.h ldctor.h ldfile.h $(INCDIR)/fnmatch.h $(INCDIR)/demangle.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
+ $(INCDIR)/progress.h $(INCDIR)/bfdlink.h ld.h $(INCDIR)/bin-bugs.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
+ $(INCDIR)/demangle.h ld.h $(INCDIR)/bin-bugs.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
+ sysdep.h config.h $(INCDIR)/fopen-same.h ld.h $(INCDIR)/bin-bugs.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
+ $(INCDIR)/libiberty.h ld.h $(INCDIR)/bin-bugs.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 \
+ $(INCDIR)/bfdlink.h ld.h $(INCDIR)/bin-bugs.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
+ config.h $(INCDIR)/fopen-same.h ld.h $(INCDIR)/bin-bugs.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
+ $(INCDIR)/libiberty.h ld.h $(INCDIR)/bin-bugs.h ldmain.h \
+ ldmisc.h ldexp.h ldlang.h
+pe-dll.o: pe-dll.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \
+ sysdep.h config.h $(INCDIR)/fopen-same.h $(INCDIR)/bfdlink.h \
+ $(INCDIR)/libiberty.h ld.h $(INCDIR)/bin-bugs.h ldexp.h \
+ ldlang.h ldwrite.h ldmisc.h ldgram.h ldmain.h ldemul.h \
+ $(INCDIR)/coff/internal.h ../bfd/libcoff.h deffile.h \
+ pe-dll.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
+ ld.h $(INCDIR)/bin-bugs.h ldexp.h ldver.h ldlang.h \
+ ldemul.h ldfile.h ldmisc.h ldmain.h mri.h ldctor.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
-
+ ld.h $(INCDIR)/bin-bugs.h ldgram.h ldmisc.h ldexp.h \
+ ldlang.h ldfile.h ldlex.h ldmain.h
+deffilep.o: deffilep.c $(INCDIR)/libiberty.h $(INCDIR)/ansidecl.h \
+ ../bfd/bfd.h sysdep.h config.h $(INCDIR)/fopen-same.h \
+ ld.h $(INCDIR)/bin-bugs.h ldmisc.h deffile.h
# IF YOU PUT ANYTHING HERE IT WILL GO AWAY
diff --git a/contrib/binutils/ld/Makefile.in b/contrib/binutils/ld/Makefile.in
index c37aab3..6f95ee5 100644
--- a/contrib/binutils/ld/Makefile.in
+++ b/contrib/binutils/ld/Makefile.in
@@ -1,6 +1,6 @@
-# Makefile.in generated automatically by automake 1.2e from Makefile.am
+# Makefile.in generated automatically by automake 1.4 from Makefile.am
-# Copyright (C) 1994, 1995, 1996, 1997, 1998 Free Software Foundation, Inc.
+# Copyright (C) 1994, 1995-8, 1999 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.
@@ -32,6 +32,8 @@ mandir = @mandir@
includedir = @includedir@
oldincludedir = /usr/include
+DESTDIR =
+
pkgdatadir = $(datadir)/@PACKAGE@
pkglibdir = $(libdir)/@PACKAGE@
pkgincludedir = $(includedir)/@PACKAGE@
@@ -44,7 +46,7 @@ AUTOMAKE = @AUTOMAKE@
AUTOHEADER = @AUTOHEADER@
INSTALL = @INSTALL@
-INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@ $(AM_INSTALL_PROGRAM_FLAGS)
INSTALL_DATA = @INSTALL_DATA@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
transform = @program_transform_name@
@@ -61,28 +63,54 @@ host_alias = @host_alias@
host_triplet = @host@
target_alias = @target_alias@
target_triplet = @target@
+AS = @AS@
+CATALOGS = @CATALOGS@
+CATOBJEXT = @CATOBJEXT@
CC = @CC@
+CC_FOR_BUILD = @CC_FOR_BUILD@
+DATADIRNAME = @DATADIRNAME@
+DLLTOOL = @DLLTOOL@
+EMULATION_LIBPATH = @EMULATION_LIBPATH@
EXEEXT = @EXEEXT@
+EXEEXT_FOR_BUILD = @EXEEXT_FOR_BUILD@
+GMOFILES = @GMOFILES@
+GMSGFMT = @GMSGFMT@
+GT_NO = @GT_NO@
+GT_YES = @GT_YES@
HDEFINES = @HDEFINES@
-LD = @LD@
+INCLUDE_LOCALE_H = @INCLUDE_LOCALE_H@
+INSTOBJEXT = @INSTOBJEXT@
+INTLDEPS = @INTLDEPS@
+INTLOBJS = @INTLOBJS@
LIBTOOL = @LIBTOOL@
LN_S = @LN_S@
MAINT = @MAINT@
MAKEINFO = @MAKEINFO@
+MKINSTALLDIRS = @MKINSTALLDIRS@
+MSGFMT = @MSGFMT@
NATIVE_LIB_DIRS = @NATIVE_LIB_DIRS@
-NM = @NM@
+OBJDUMP = @OBJDUMP@
PACKAGE = @PACKAGE@
+POFILES = @POFILES@
+POSUB = @POSUB@
RANLIB = @RANLIB@
-TDIRS = @TDIRS@
+STRINGIFY = @STRINGIFY@
+USE_INCLUDED_LIBINTL = @USE_INCLUDED_LIBINTL@
+USE_NLS = @USE_NLS@
VERSION = @VERSION@
+l = @l@
+
+INTLLIBS = @INTLLIBS@
AUTOMAKE_OPTIONS = cygnus dejagnu
+SUBDIRS = po
+
tooldir = $(exec_prefix)/$(target_alias)
-YACC = `if [ -f ../bison/bison ] ; then echo ../bison/bison -y -L../bison/bison ; else echo bison -y ; fi`
+YACC = `if [ -f ../bison/bison ]; then echo ../bison/bison -y -L$(srcdir)/../bison/; else echo @YACC@; fi`
YFLAGS = -d
-LEX = `if [ -f ../flex/flex ] ; then echo ../flex/flex ; else echo flex ; fi`
+LEX = `if [ -f ../flex/flex ]; then echo ../flex/flex; else echo @LEX@; fi`
# We put the scripts in the directory $(scriptdir)/ldscripts.
# We can't put the scripts in $(datadir) because the SEARCH_DIR
@@ -91,6 +119,7 @@ scriptdir = $(tooldir)/lib
EMUL = @EMUL@
EMULATION_OFILES = @EMULATION_OFILES@
+EMUL_EXTRA_OFILES = @EMUL_EXTRA_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.
@@ -98,12 +127,12 @@ EMULATION_OFILES = @EMULATION_OFILES@
# 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 =
+LIB_PATH =
BASEDIR = $(srcdir)/..
BFDDIR = $(BASEDIR)/bfd
-INCDIR = $(BASEDIR)/include
-DEP = mkdep
+INCDIR = $(BASEDIR)/include
+MKDEP = gcc -MM
# What version of the manual to build
DOCVER = gen
@@ -118,11 +147,13 @@ 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 =
+
+RUNTESTFLAGS =
CC_FOR_TARGET = ` \
if [ -f $$r/../gcc/xgcc ] ; then \
@@ -139,6 +170,7 @@ CC_FOR_TARGET = ` \
fi; \
fi`
+
CXX = gcc
CXX_FOR_TARGET = ` \
if [ -f $$r/../gcc/xgcc ] ; then \
@@ -155,12 +187,13 @@ CXX_FOR_TARGET = ` \
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)
+INCLUDES = -D_GNU_SOURCE -I. -I$(srcdir) -I../bfd -I$(BFDDIR) -I$(INCDIR) -I$(top_srcdir)/../intl -I../intl $(HDEFINES) $(CFLAGS) -DLOCALEDIR="\"$(prefix)/share/locale\""
BFDLIB = ../bfd/libbfd.la
LIBIBERTY = ../libiberty/libiberty.a
@@ -171,27 +204,50 @@ ALL_EMULATIONS = \
eaixrs6.o \
ealpha.o \
earcelf.o \
+ earmelf.o \
+ earmelf_oabi.o \
+ earmelf_linux.o \
+ earmelf_linux26.o \
earmaoutb.o \
earmaoutl.o \
earmcoff.o \
+ earmnbsd.o \
earmpe.o \
+ earm_epoc_pe.o \
+ eavr1200.o \
+ eavr23xx.o \
+ eavr44x4.o \
+ eavr4433.o \
+ eavr85xx.o \
+ eavrmega603.o \
+ eavrmega103.o \
+ eavrmega161.o \
ecoff_sparc.o \
ed10velf.o \
+ ed30velf.o \
+ ed30v_e.o \
+ ed30v_o.o \
edelta68.o \
eebmon29k.o \
eelf32_sparc.o \
+ eelf32_i960.o \
eelf32b4300.o \
eelf32bmip.o \
eelf32ebmip.o \
eelf32elmip.o \
+ eelf32bmipn32.o \
+ eelf32i370.o \
eelf32l4300.o \
eelf32lmip.o \
eelf32lppc.o \
eelf32ppc.o \
+ eelf32ppclinux.o \
eelf_i386.o \
+ eelf_i386_be.o \
egld960.o \
egld960coff.o \
- ego32.o \
+ eelf32fr30.o \
+ eelf32mcore.o \
eh8300.o \
eh8300h.o \
eh8300s.o \
@@ -202,8 +258,8 @@ ALL_EMULATIONS = \
eh8500s.o \
ehp300bsd.o \
ehp3hpux.o \
- ehppaelf.o \
ei386aout.o \
+ ei386beos.o \
ei386bsd.o \
ei386coff.o \
ei386go32.o \
@@ -215,6 +271,7 @@ ALL_EMULATIONS = \
ei386nbsd.o \
ei386nw.o \
ei386pe.o \
+ ei386pe_posix.o \
elnk960.o \
em68k4knbsd.o \
em68kaout.o \
@@ -226,13 +283,17 @@ ALL_EMULATIONS = \
em68knbsd.o \
em68kpsos.o \
em88kbcs.o \
+ emcorepe.o \
emipsbig.o \
emipsbsd.o \
emipsidt.o \
emipsidtl.o \
emipslit.o \
emipslnews.o \
+ emipspe.o \
enews.o \
+ epjelf.o \
+ epjlelf.o \
ens32knbsd.o \
epc532macha.o \
eppcmacos.o \
@@ -244,6 +305,7 @@ ALL_EMULATIONS = \
eshelf.o \
eshlelf.o \
eshl.o \
+ eshpe.o \
esparcaout.o \
esparclinux.o \
esparclynx.o \
@@ -253,6 +315,7 @@ ALL_EMULATIONS = \
esun4.o \
etic30aout.o \
etic30coff.o \
+ etic80coff.o \
evanilla.o \
evax.o \
evsta.o \
@@ -260,49 +323,70 @@ ALL_EMULATIONS = \
ez8001.o \
ez8002.o
+
ALL_64_EMULATIONS = \
eelf64_sparc.o \
- eelf64alpha.o
+ eelf64alpha.o \
+ eelf64bmip.o
+
+
+ALL_EMUL_EXTRA_OFILES = \
+ pe-dll.o \
+ deffilep.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
+ mri.c ldcref.c pe-dll.c
+
-HFILES = config.h ld.h ldctor.h ldemul.h ldexp.h ldfile.h \
+HFILES = ld.h ldctor.h ldemul.h ldexp.h ldfile.h \
ldlang.h ldlex.h ldmain.h ldmisc.h ldver.h \
- ldwrite.h mri.h
+ ldwrite.h mri.h deffile.h pe-dll.h
-GENERATED_CFILES = ldgram.c ldlex.c
-GENERATED_HFILES = ldgram.h ldemul-list.h
+
+GENERATED_CFILES = ldgram.c ldlex.c deffilep.c
+GENERATED_HFILES = ldgram.h ldemul-list.h deffilep.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}
+ ldfile.o ldcref.o ${EMULATION_OFILES} ${EMUL_EXTRA_OFILES}
+
STAGESTUFF = *.o ldscripts/* e*.c
+# At the moment this is just a list of those emulation template files
+# that contain internationalised strings.
+EMULATION_FILES = emultempl/pe.em emultempl/armcoff.em
+
+POTFILES = $(CFILES) $(HFILES) $(EMULATION_FILES)
+
# 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
+GENSCRIPTS = $(SHELL) $(srcdir)/genscripts.sh ${srcdir} ${libdir} @host@ @target@ @target_alias@ "@EMULATION_LIBPATH@" "@NATIVE_LIB_DIRS@"
+GEN_DEPENDS = $(srcdir)/genscripts.sh 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)
+
+ld_new_DEPENDENCIES = $(EMULATION_OFILES) $(EMUL_EXTRA_OFILES) $(BFDLIB) $(LIBIBERTY) $(INTLDEPS)
+ld_new_LDADD = $(EMULATION_OFILES) $(EMUL_EXTRA_OFILES) $(BFDLIB) $(LIBIBERTY) $(INTLLIBS)
# This is the real libbfd.a created by libtool.
TESTBFDLIB = @TESTBFDLIB@
+MAINTAINERCLEANFILES = ldver.texi
+
MOSTLYCLEANFILES = $(STAGESTUFF) ld1$(EXEEXT) ld2$(EXEEXT) ld3$(EXEEXT) \
ldemul-list.h crtbegin.o crtend.o ld.log ld.sum
-CLEANFILES = dep.sed .dep .dep1
+
+CLEANFILES = dep.sed DEP DEP1 DEP2
# 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
+DISTCLEANFILES = tdirs site.exp site.bak
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
mkinstalldirs = $(SHELL) $(top_srcdir)/../mkinstalldirs
CONFIG_HEADER = config.h
@@ -321,59 +405,64 @@ 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 $@
+COMPILE = $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+LTCOMPILE = $(LIBTOOL) --mode=compile $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+CCLD = $(CC)
+LINK = $(LIBTOOL) --mode=link $(CCLD) $(AM_CFLAGS) $(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
+man1dir = $(mandir)/man1
+MANS = $(man_MANS)
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
+DIST_COMMON = README ./stamp-h.in ChangeLog Makefile.am Makefile.in \
+NEWS TODO acinclude.m4 aclocal.m4 config.in configure configure.in \
+ldgram.c ldlex.c
DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST)
TAR = tar
-GZIP = --best
+GZIP_ENV = --best
SOURCES = $(ld_new_SOURCES)
OBJECTS = $(ld_new_OBJECTS)
-default: all
-
+all: all-redirect
.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)
+.SUFFIXES: .S .c .dvi .info .l .lo .o .ps .s .texi .texinfo .txi .y
+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4)
cd $(top_srcdir) && $(AUTOMAKE) --cygnus Makefile
-Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+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
+$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ 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)
+$(srcdir)/configure: @MAINTAINER_MODE_TRUE@$(srcdir)/configure.in $(ACLOCAL_M4) $(CONFIGURE_DEPENDENCIES)
cd $(srcdir) && $(AUTOCONF)
config.h: stamp-h
- @:
+ @if test ! -f $@; then \
+ rm -f stamp-h; \
+ $(MAKE) stamp-h; \
+ else :; fi
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
+ @echo timestamp > stamp-h 2> /dev/null
+$(srcdir)/config.in: @MAINTAINER_MODE_TRUE@$(srcdir)/stamp-h.in
+ @if test ! -f $@; then \
+ rm -f $(srcdir)/stamp-h.in; \
+ $(MAKE) $(srcdir)/stamp-h.in; \
+ else :; fi
+$(srcdir)/stamp-h.in: $(top_srcdir)/configure.in $(ACLOCAL_M4)
cd $(top_srcdir) && $(AUTOHEADER)
- @echo timestamp > $(srcdir)/stamp-h.in
+ @echo timestamp > $(srcdir)/stamp-h.in 2> /dev/null
mostlyclean-hdr:
@@ -434,15 +523,15 @@ 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)
+.l.c:
+ $(LEX) $(AM_LFLAGS) $(LFLAGS) $< && mv $(LEX_OUTPUT_ROOT).c $@
.y.c:
- $(YACC) $(YFLAGS) $< && mv y.tab.c $*.c
+ $(YACC) $(AM_YFLAGS) $(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
@@ -455,7 +544,7 @@ DVIPS = dvips
$(MAKEINFO) -I $(srcdir) $<
.texi.dvi:
- TEXINPUTS=$(top_srcdir)/../texinfo:$$TEXINPUTS \
+ TEXINPUTS=$(top_srcdir)/../texinfo/texinfo.tex:$$TEXINPUTS \
MAKEINFO='$(MAKEINFO) -I $(srcdir)' $(TEXI2DVI) $<
.texi:
@@ -471,28 +560,42 @@ DVIPS = dvips
$(MAKEINFO) -I $(srcdir) $<
.texinfo.dvi:
- TEXINPUTS=$(top_srcdir)/../texinfo:$$TEXINPUTS \
+ TEXINPUTS=$(top_srcdir)/../texinfo/texinfo.tex:$$TEXINPUTS \
+ MAKEINFO='$(MAKEINFO) -I $(srcdir)' $(TEXI2DVI) $<
+
+.txi.info:
+ @rm -f $@ $@-[0-9] $@-[0-9][0-9]
+ $(MAKEINFO) -I $(srcdir) $<
+
+.txi.dvi:
+ TEXINPUTS=$(top_srcdir)/../texinfo/texinfo.tex:$$TEXINPUTS \
MAKEINFO='$(MAKEINFO) -I $(srcdir)' $(TEXI2DVI) $<
+
+.txi:
+ @rm -f $@ $@-[0-9] $@-[0-9][0-9]
+ $(MAKEINFO) -I $(srcdir) $<
.dvi.ps:
$(DVIPS) $< -o $@
install-info-am: $(INFO_DEPS)
@$(NORMAL_INSTALL)
- $(mkinstalldirs) $(infodir)
- @for file in $(INFO_DEPS); do \
+ $(mkinstalldirs) $(DESTDIR)$(infodir)
+ @list='$(INFO_DEPS)'; \
+ for file in $$list; 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; \
+ echo " $(INSTALL_DATA) $$d/$$ifile $(DESTDIR)$(infodir)/$$ifile"; \
+ $(INSTALL_DATA) $$d/$$ifile $(DESTDIR)$(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 || :;\
+ list='$(INFO_DEPS)'; \
+ for file in $$list; do \
+ echo " install-info --info-dir=$(DESTDIR)$(infodir) $(DESTDIR)$(infodir)/$$file";\
+ install-info --info-dir=$(DESTDIR)$(infodir) $(DESTDIR)$(infodir)/$$file || :;\
done; \
else : ; fi
@@ -501,17 +604,20 @@ uninstall-info:
@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 \
+ list='$(INFO_DEPS)'; \
+ for file in $$list; do \
test -z "$ii" \
- || install-info --info-dir=$(infodir) --remove $$file; \
+ || install-info --info-dir=$(DESTDIR)$(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]); \
+ @$(NORMAL_UNINSTALL)
+ list='$(INFO_DEPS)'; \
+ for file in $$list; do \
+ (cd $(DESTDIR)$(infodir) && rm -f $$file $$file-[0-9] $$file-[0-9][0-9]); \
done
dist-info: $(INFO_DEPS)
- for base in $(INFO_DEPS); do \
+ list='$(INFO_DEPS)'; \
+ for base in $$list; do \
if test -f $$base; then d=.; else d=$(srcdir); fi; \
for file in `cd $$d && eval echo $$base*`; do \
test -f $(distdir)/$$file \
@@ -537,31 +643,119 @@ maintainer-clean-aminfo:
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
+install-man1:
+ $(mkinstalldirs) $(DESTDIR)$(man1dir)
+ @list='$(man1_MANS)'; \
+ l2='$(man_MANS)'; for i in $$l2; do \
+ case "$$i" in \
+ *.1*) list="$$list $$i" ;; \
+ esac; \
+ done; \
+ for i in $$list; do \
+ if test -f $(srcdir)/$$i; then file=$(srcdir)/$$i; \
+ else file=$$i; fi; \
+ ext=`echo $$i | sed -e 's/^.*\\.//'`; \
+ inst=`echo $$i | sed -e 's/\\.[0-9a-z]*$$//'`; \
+ inst=`echo $$inst | sed '$(transform)'`.$$ext; \
+ echo " $(INSTALL_DATA) $$file $(DESTDIR)$(man1dir)/$$inst"; \
+ $(INSTALL_DATA) $$file $(DESTDIR)$(man1dir)/$$inst; \
+ done
+uninstall-man1:
+ @list='$(man1_MANS)'; \
+ l2='$(man_MANS)'; for i in $$l2; do \
+ case "$$i" in \
+ *.1*) list="$$list $$i" ;; \
+ esac; \
+ done; \
+ for i in $$list; do \
+ ext=`echo $$i | sed -e 's/^.*\\.//'`; \
+ inst=`echo $$i | sed -e 's/\\.[0-9a-z]*$$//'`; \
+ inst=`echo $$inst | sed '$(transform)'`.$$ext; \
+ echo " rm -f $(DESTDIR)$(man1dir)/$$inst"; \
+ rm -f $(DESTDIR)$(man1dir)/$$inst; \
+ done
+install-man: $(MANS)
+ @$(NORMAL_INSTALL)
+ $(MAKE) $(AM_MAKEFLAGS) install-man1
+uninstall-man:
+ @$(NORMAL_UNINSTALL)
+ $(MAKE) $(AM_MAKEFLAGS) uninstall-man1
+
+# This directory's subdirectories are mostly independent; you can cd
+# into them and run `make' without going through this Makefile.
+# To change the values of `make' variables: instead of editing Makefiles,
+# (1) if the variable is set in `config.status', edit `config.status'
+# (which will cause the Makefiles to be regenerated when you run `make');
+# (2) otherwise, pass the desired values on the `make' command line.
+
+@SET_MAKE@
+
+all-recursive install-data-recursive install-exec-recursive \
+installdirs-recursive install-recursive uninstall-recursive install-info-recursive \
+check-recursive installcheck-recursive info-recursive dvi-recursive:
+ @set fnord $(MAKEFLAGS); amf=$$2; \
+ dot_seen=no; \
+ target=`echo $@ | sed s/-recursive//`; \
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ echo "Making $$target in $$subdir"; \
+ if test "$$subdir" = "."; then \
+ dot_seen=yes; \
+ local_target="$$target-am"; \
+ else \
+ local_target="$$target"; \
+ fi; \
+ (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
+ || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \
+ done; \
+ if test "$$dot_seen" = "no"; then \
+ $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \
+ fi; test -z "$$fail"
+
+mostlyclean-recursive clean-recursive distclean-recursive \
+maintainer-clean-recursive:
+ @set fnord $(MAKEFLAGS); amf=$$2; \
+ dot_seen=no; \
+ rev=''; list='$(SUBDIRS)'; for subdir in $$list; do \
+ rev="$$subdir $$rev"; \
+ test "$$subdir" = "." && dot_seen=yes; \
+ done; \
+ test "$$dot_seen" = "no" && rev=". $$rev"; \
+ target=`echo $@ | sed s/-recursive//`; \
+ for subdir in $$rev; do \
+ echo "Making $$target in $$subdir"; \
+ if test "$$subdir" = "."; then \
+ local_target="$$target-am"; \
+ else \
+ local_target="$$target"; \
+ fi; \
+ (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
+ || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \
+ done && test -z "$$fail"
+tags-recursive:
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \
+ done
tags: TAGS
ID: $(HEADERS) $(SOURCES) $(LISP)
+ list='$(SOURCES) $(HEADERS)'; \
+ unique=`for i in $$list; do echo $$i; done | \
+ awk ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
here=`pwd` && cd $(srcdir) \
- && mkid -f$$here/ID $(SOURCES) $(HEADERS) $(LISP)
+ && mkid -f$$here/ID $$unique $(LISP)
-TAGS: $(HEADERS) $(SOURCES) config.in $(TAGS_DEPENDENCIES) $(LISP)
+TAGS: tags-recursive $(HEADERS) $(SOURCES) config.in $(TAGS_DEPENDENCIES) $(LISP)
tags=; \
here=`pwd`; \
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ if test "$$subdir" = .; then :; else \
+ test -f $$subdir/TAGS && tags="$$tags -i $$here/$$subdir/TAGS"; \
+ fi; \
+ done; \
list='$(SOURCES) $(HEADERS)'; \
unique=`for i in $$list; do echo $$i; done | \
awk ' { files[$$0] = 1; } \
@@ -586,29 +780,31 @@ top_distdir = $(distdir)
# tarfile.
distcheck: dist
-rm -rf $(distdir)
- GZIP=$(GZIP) $(TAR) zxf $(distdir).tar.gz
+ GZIP=$(GZIP_ENV) $(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
+ && $(MAKE) $(AM_MAKEFLAGS) \
+ && $(MAKE) $(AM_MAKEFLAGS) dvi \
+ && $(MAKE) $(AM_MAKEFLAGS) check \
+ && $(MAKE) $(AM_MAKEFLAGS) install \
+ && $(MAKE) $(AM_MAKEFLAGS) installcheck \
+ && $(MAKE) $(AM_MAKEFLAGS) dist
-rm -rf $(distdir)
- @echo "========================"; \
- echo "$(distdir).tar.gz is ready for distribution"; \
- echo "========================"
+ @banner="$(distdir).tar.gz is ready for distribution"; \
+ dashes=`echo "$$banner" | sed s/./=/g`; \
+ echo "$$dashes"; \
+ echo "$$banner"; \
+ echo "$$dashes"
dist: distdir
-chmod -R a+r $(distdir)
- GZIP=$(GZIP) $(TAR) chozf $(distdir).tar.gz $(distdir)
+ GZIP=$(GZIP_ENV) $(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)
+ GZIP=$(GZIP_ENV) $(TAR) chozf $(distdir).tar.gz $(distdir)
-rm -rf $(distdir)
distdir: $(DISTFILES)
-rm -rf $(distdir)
@@ -616,18 +812,32 @@ distdir: $(DISTFILES)
-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; \
+ if test -d $$d/$$file; then \
+ cp -pr $$d/$$file $(distdir)/$$file; \
+ else \
+ test -f $(distdir)/$$file \
+ || ln $$d/$$file $(distdir)/$$file 2> /dev/null \
+ || cp -p $$d/$$file $(distdir)/$$file || :; \
+ fi; \
+ done
+ for subdir in $(SUBDIRS); do \
+ if test "$$subdir" = .; then :; else \
+ test -d $(distdir)/$$subdir \
+ || mkdir $(distdir)/$$subdir \
+ || exit 1; \
+ chmod 777 $(distdir)/$$subdir; \
+ (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) top_distdir=../$(distdir) distdir=../$(distdir)/$$subdir distdir) \
+ || exit 1; \
+ fi; \
done
- $(MAKE) top_distdir="$(top_distdir)" distdir="$(distdir)" dist-info
+ $(MAKE) $(AM_MAKEFLAGS) 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
+ @test ! -f site.bak || 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
@@ -641,32 +851,41 @@ site.exp: Makefile
@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
+ @test ! -f site.exp || sed '1,/^## All variables above are.*##/ d' site.exp >> $@-t
+ @test ! -f site.exp || 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
-
+info-am: $(INFO_DEPS)
+info: info-recursive
+dvi-am: $(DVIS)
+dvi: dvi-recursive
+check-am:
+ $(MAKE) $(AM_MAKEFLAGS) check-DEJAGNU
+check: check-recursive
+installcheck-am:
+installcheck: installcheck-recursive
+install-info-am:
+install-info: install-info-recursive
+all-recursive-am: config.h
+ $(MAKE) $(AM_MAKEFLAGS) all-recursive
+
+install-exec-am: install-exec-local
+install-exec: install-exec-recursive
+
+install-data-am: install-man install-data-local
+install-data: install-data-recursive
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+install: install-recursive
+uninstall-am: uninstall-man
+uninstall: uninstall-recursive
+all-am: Makefile $(PROGRAMS) $(MANS) config.h
+all-redirect: all-recursive-am
install-strip:
- $(MAKE) INSTALL_PROGRAM='$(INSTALL_PROGRAM) -s' INSTALL_SCRIPT='$(INSTALL_PROGRAM)' install
-installdirs:
- $(mkinstalldirs) $(mandir)/man1
+ $(MAKE) $(AM_MAKEFLAGS) AM_INSTALL_PROGRAM_FLAGS=-s install
+installdirs: installdirs-recursive
+installdirs-am:
+ $(mkinstalldirs) $(DESTDIR)$(mandir)/man1
mostlyclean-generic:
@@ -676,50 +895,71 @@ clean-generic:
-test -z "$(CLEANFILES)" || rm -f $(CLEANFILES)
distclean-generic:
- -rm -f Makefile $(DISTCLEANFILES)
+ -rm -f Makefile $(CONFIG_CLEAN_FILES)
-rm -f config.cache config.log stamp-h stamp-h[0-9]*
- -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+ -test -z "$(DISTCLEANFILES)" || rm -f $(DISTCLEANFILES)
maintainer-clean-generic:
- -test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES)
- -test -z "$(BUILT_SOURCES)" || rm -f $(BUILT_SOURCES)
-mostlyclean: mostlyclean-hdr mostlyclean-noinstPROGRAMS \
+ -test -z "ldlexlldgramhldgramc$(MAINTAINERCLEANFILES)" || rm -f ldlexl ldgramh ldgramc $(MAINTAINERCLEANFILES)
+mostlyclean-am: 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
+mostlyclean: mostlyclean-recursive
+
+clean-am: clean-hdr clean-noinstPROGRAMS clean-compile clean-libtool \
+ clean-aminfo clean-tags clean-generic mostlyclean-am
+
+clean: clean-recursive
-distclean: distclean-hdr distclean-noinstPROGRAMS distclean-compile \
+distclean-am: distclean-hdr distclean-noinstPROGRAMS distclean-compile \
distclean-libtool distclean-aminfo distclean-tags \
- distclean-generic clean distclean-local
- -rm -f config.status
+ distclean-generic clean-am distclean-local
-rm -f libtool
-maintainer-clean: maintainer-clean-hdr maintainer-clean-noinstPROGRAMS \
+distclean: distclean-recursive
+ -rm -f config.status
+
+maintainer-clean-am: maintainer-clean-hdr \
+ maintainer-clean-noinstPROGRAMS \
maintainer-clean-compile maintainer-clean-libtool \
maintainer-clean-aminfo maintainer-clean-tags \
- maintainer-clean-generic distclean
+ maintainer-clean-generic distclean-am
@echo "This command is intended for maintainers to use;"
@echo "it deletes files that may require special tools to rebuild."
+
+maintainer-clean: maintainer-clean-recursive
-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 \
+.PHONY: 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-man1 uninstall-man1 install-man \
+uninstall-man install-data-recursive uninstall-data-recursive \
+install-exec-recursive uninstall-exec-recursive installdirs-recursive \
+uninstalldirs-recursive all-recursive check-recursive \
+installcheck-recursive info-recursive dvi-recursive \
+mostlyclean-recursive distclean-recursive clean-recursive \
+maintainer-clean-recursive tags tags-recursive mostlyclean-tags \
+distclean-tags clean-tags maintainer-clean-tags distdir check-DEJAGNU \
+info-am info dvi-am dvi check check-am installcheck-am installcheck \
+install-info-am install-info all-recursive-am install-exec-local \
+install-exec-am install-exec install-data-local install-data-am \
+install-data install-am install uninstall-am uninstall all-redirect \
+all-am all installdirs-am installdirs mostlyclean-generic \
distclean-generic clean-generic maintainer-clean-generic clean \
mostlyclean distclean maintainer-clean
+po/POTFILES.in: @MAINT@ Makefile
+ for file in $(POTFILES); do echo $$file; done | sort > tmp \
+ && mv tmp $(srcdir)/po/POTFILES.in
+
ldmain.o: ldmain.c config.status
$(COMPILE) -c -DDEFAULT_EMULATION='"$(EMUL)"' -DSCRIPTDIR='"$(scriptdir)"' -DTARGET='"@target@"' $(srcdir)/ldmain.c
@@ -737,6 +977,9 @@ ldemul-list.h: Makefile
done;\
echo " 0") >ldemul-tmp.h
mv ldemul-tmp.h ldemul-list.h
+
+stringify.sed: ${srcdir}/emultempl/$(STRINGIFY)
+ cp ${srcdir}/emultempl/$(STRINGIFY) stringify.sed
@TDIRS@
ea29k.c: $(srcdir)/emulparams/a29k.sh \
@@ -754,6 +997,18 @@ ealpha.c: $(srcdir)/emulparams/alpha.sh \
earcelf.c: $(srcdir)/emulparams/arcelf.sh \
$(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS}
${GENSCRIPTS} arcelf "$(tdir_arcelf)"
+earmelf.c: $(srcdir)/emulparams/armelf.sh \
+ $(srcdir)/emultempl/armelf.em $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS}
+ ${GENSCRIPTS} armelf "$(tdir_armelf)"
+earmelf_oabi.c: $(srcdir)/emulparams/armelf_oabi.sh \
+ $(srcdir)/emultempl/armelf_oabi.em $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS}
+ ${GENSCRIPTS} armelf_oabi "$(tdir_armelf)"
+earmelf_linux.c: $(srcdir)/emulparams/armelf_linux.sh \
+ $(srcdir)/emultempl/armelf.em $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS}
+ ${GENSCRIPTS} armelf_linux "$(tdir_armelf_linux)"
+earmelf_linux26.c: $(srcdir)/emulparams/armelf_linux26.sh \
+ $(srcdir)/emultempl/armelf.em $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS}
+ ${GENSCRIPTS} armelf_linux26 "$(tdir_armelf_linux26)"
earmaoutb.c: $(srcdir)/emulparams/armaoutb.sh \
$(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/armaout.sc ${GEN_DEPENDS}
${GENSCRIPTS} armaoutb "$(tdir_armaoutb)"
@@ -761,29 +1016,85 @@ 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}
+ $(srcdir)/emultempl/armcoff.em $(srcdir)/scripttempl/armcoff.sc ${GEN_DEPENDS}
${GENSCRIPTS} armcoff "$(tdir_armcoff)"
+earmnbsd.c: $(srcdir)/emulparams/armnbsd.sh \
+ $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/aout.sc ${GEN_DEPENDS}
+ ${GENSCRIPTS} armnbsd "$(tdir_armnbsd)"
+earm_epoc_pe.c: $(srcdir)/emulparams/arm_epoc_pe.sh \
+ $(srcdir)/emultempl/pe.em $(srcdir)/scripttempl/epocpe.sc ${GEN_DEPENDS}
+ ${GENSCRIPTS} arm_epoc_pe "$(tdir_armpe)"
earmpe.c: $(srcdir)/emulparams/armpe.sh \
$(srcdir)/emultempl/pe.em $(srcdir)/scripttempl/pe.sc ${GEN_DEPENDS}
${GENSCRIPTS} armpe "$(tdir_armpe)"
+eavr85xx.c: $(srcdir)/emulparams/avr85xx.sh \
+ $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/elf32avr.sc \
+ ${GEN_DEPENDS}
+ ${GENSCRIPTS} avr85xx "$(tdir_avr85xx)"
+eavr1200.c: $(srcdir)/emulparams/avr1200.sh \
+ $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/elf32avr.sc \
+ ${GEN_DEPENDS}
+ ${GENSCRIPTS} avr1200 "$(tdir_avr85xx)"
+eavr23xx.c: $(srcdir)/emulparams/avr23xx.sh \
+ $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/elf32avr.sc \
+ ${GEN_DEPENDS}
+ ${GENSCRIPTS} avr23xx "$(tdir_avr85xx)"
+eavr44x4.c: $(srcdir)/emulparams/avr44x4.sh \
+ $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/elf32avr.sc \
+ ${GEN_DEPENDS}
+ ${GENSCRIPTS} avr44x4 "$(tdir_avr85xx)"
+eavr4433.c: $(srcdir)/emulparams/avr4433.sh \
+ $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/elf32avr.sc \
+ ${GEN_DEPENDS}
+ ${GENSCRIPTS} avr4433 "$(tdir_avr85xx)"
+eavrmega603.c: $(srcdir)/emulparams/avrmega603.sh \
+ $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/elf32avr.sc \
+ ${GEN_DEPENDS}
+ ${GENSCRIPTS} avrmega603 "$(tdir_avr85xx)"
+eavrmega103.c: $(srcdir)/emulparams/avrmega103.sh \
+ $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/elf32avr.sc \
+ ${GEN_DEPENDS}
+ ${GENSCRIPTS} avrmega103 "$(tdir_avr85xx)"
+eavrmega161.c: $(srcdir)/emulparams/avrmega161.sh \
+ $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/elf32avr.sc \
+ ${GEN_DEPENDS}
+ ${GENSCRIPTS} avrmega161 "$(tdir_avr85xx)"
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)"
+ed30velf.c: $(srcdir)/emulparams/d30velf.sh \
+ $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/elfd30v.sc ${GEN_DEPENDS}
+ ${GENSCRIPTS} d30velf "$(tdir_d30v)"
+ed30v_o.c: $(srcdir)/emulparams/d30v_o.sh \
+ $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/elfd30v.sc ${GEN_DEPENDS}
+ ${GENSCRIPTS} d30v_o "$(tdir_d30v)"
+ed30v_e.c: $(srcdir)/emulparams/d30v_e.sh \
+ $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/elfd30v.sc ${GEN_DEPENDS}
+ ${GENSCRIPTS} d30v_e "$(tdir_d30v)"
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)"
+eelf32fr30.c: $(srcdir)/emulparams/elf32fr30.sh \
+ $(srcdir)/emultempl/elf32.em $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS}
+ ${GENSCRIPTS} elf32fr30 "$(tdir_fr30)"
+eelf32mcore.c: $(srcdir)/emulparams/elf32mcore.sh \
+ $(srcdir)/emultempl/elf32.em $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS}
+ ${GENSCRIPTS} elf32mcore "$(tdir_mcore)"
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)"
+eelf32_i960.c: $(srcdir)/emulparams/elf32_i960.sh \
+ $(srcdir)/emultempl/elf32.em $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS}
+ ${GENSCRIPTS} elf32_i960 "$(tdir_elf32_i960)"
eelf32b4300.c: $(srcdir)/emulparams/elf32b4300.sh \
$(srcdir)/emultempl/elf32.em $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS}
${GENSCRIPTS} elf32b4300 "$(tdir_elf32b4300)"
@@ -799,6 +1110,9 @@ eelf32ebmip.c: $(srcdir)/emulparams/elf32ebmip.sh \
eelf32elmip.c: $(srcdir)/emulparams/elf32elmip.sh \
$(srcdir)/emultempl/elf32.em $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS}
${GENSCRIPTS} elf32elmip "$(tdir_elf32elmip)"
+eelf32bmipn32.c: $(srcdir)/emulparams/elf32bmipn32.sh \
+ $(srcdir)/emultempl/elf32.em $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS}
+ ${GENSCRIPTS} elf32bmipn32 "$(tdir_elf32bmipn32)"
eelf32l4300.c: $(srcdir)/emulparams/elf32l4300.sh \
$(srcdir)/emultempl/elf32.em $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS}
${GENSCRIPTS} elf32l4300 "$(tdir_elf32l4300)"
@@ -814,24 +1128,33 @@ eelf32lsmip.c: $(srcdir)/emulparams/elf32lsmip.sh \
eelf32ppc.c: $(srcdir)/emulparams/elf32ppc.sh \
$(srcdir)/emultempl/elf32.em $(srcdir)/scripttempl/elfppc.sc ${GEN_DEPENDS}
${GENSCRIPTS} elf32ppc "$(tdir_elf32ppc)"
+eelf32ppclinux.c: $(srcdir)/emulparams/elf32ppclinux.sh \
+ $(srcdir)/emultempl/elf32.em $(srcdir)/scripttempl/elfppc.sc ${GEN_DEPENDS}
+ ${GENSCRIPTS} elf32ppclinux "$(tdir_elf32ppclinux)"
+eelf32i370.c: $(srcdir)/emulparams/elf32i370.sh \
+ $(srcdir)/emultempl/elf32.em $(srcdir)/scripttempl/elfi370.sc ${GEN_DEPENDS}
+ ${GENSCRIPTS} elf32i370 "$(tdir_elf32i370)"
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)"
+eelf64bmip.c: $(srcdir)/emulparams/elf64bmip.sh \
+ $(srcdir)/emultempl/elf32.em $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS}
+ ${GENSCRIPTS} elf64bmip "$(tdir_elf64bmip)"
eelf_i386.c: $(srcdir)/emulparams/elf_i386.sh \
$(srcdir)/emultempl/elf32.em $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS}
${GENSCRIPTS} elf_i386 "$(tdir_elf_i386)"
+eelf_i386_be.c: $(srcdir)/emulparams/elf_i386_be.sh \
+ $(srcdir)/emultempl/elf32.em $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS}
+ ${GENSCRIPTS} elf_i386_be "$(tdir_elf_i386_be)"
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)"
@@ -862,12 +1185,12 @@ ehp300bsd.c: $(srcdir)/emulparams/hp300bsd.sh \
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)"
+ei386beos.c: $(srcdir)/emulparams/i386beos.sh \
+ $(srcdir)/emultempl/beos.em $(srcdir)/scripttempl/i386beos.sc ${GEN_DEPENDS}
+ ${GENSCRIPTS} i386beos "$(tdir_i386beos)"
ei386bsd.c: $(srcdir)/emulparams/i386bsd.sh \
$(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/aout.sc ${GEN_DEPENDS}
${GENSCRIPTS} i386bsd "$(tdir_i386bsd)"
@@ -901,6 +1224,9 @@ ei386nw.c: $(srcdir)/emulparams/i386nw.sh \
ei386pe.c: $(srcdir)/emulparams/i386pe.sh \
$(srcdir)/emultempl/pe.em $(srcdir)/scripttempl/pe.sc ${GEN_DEPENDS}
${GENSCRIPTS} i386pe "$(tdir_i386pe)"
+ei386pe_posix.c: $(srcdir)/emulparams/i386pe_posix.sh \
+ $(srcdir)/emultempl/pe.em $(srcdir)/scripttempl/pe.sc ${GEN_DEPENDS}
+ ${GENSCRIPTS} i386pe_posix "$(tdir_i386pe_posix)"
elnk960.c: $(srcdir)/emulparams/lnk960.sh \
$(srcdir)/emultempl/lnk960.em $(srcdir)/scripttempl/i960.sc ${GEN_DEPENDS}
${GENSCRIPTS} lnk960 "$(tdir_lnk960)"
@@ -934,6 +1260,9 @@ em68kpsos.c: $(srcdir)/emulparams/m68kpsos.sh \
em88kbcs.c: $(srcdir)/emulparams/m88kbcs.sh \
$(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/m88kbcs.sc ${GEN_DEPENDS}
${GENSCRIPTS} m88kbcs "$(tdir_m88kbcs)"
+emcorepe.c: $(srcdir)/emulparams/mcorepe.sh \
+ $(srcdir)/emultempl/pe.em $(srcdir)/scripttempl/pe.sc ${GEN_DEPENDS}
+ ${GENSCRIPTS} mcorepe "$(tdir_mcorepe)"
emipsbig.c: $(srcdir)/emulparams/mipsbig.sh \
$(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/mips.sc ${GEN_DEPENDS}
${GENSCRIPTS} mipsbig
@@ -952,6 +1281,9 @@ emipslit.c: $(srcdir)/emulparams/mipslit.sh \
emipslnews.c: $(srcdir)/emulparams/mipslnews.sh \
$(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/mips.sc ${GEN_DEPENDS}
${GENSCRIPTS} mipslnews
+emipspe.c: $(srcdir)/emulparams/mipspe.sh \
+ $(srcdir)/emultempl/pe.em $(srcdir)/scripttempl/pe.sc ${GEN_DEPENDS}
+ ${GENSCRIPTS} mipspe "$(tdir_mips)"
emn10300.c: $(srcdir)/emulparams/mn10300.sh \
$(srcdir)/emultempl/elf32.em $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS}
${GENSCRIPTS} mn10300 "$(tdir_mn10300)"
@@ -967,6 +1299,12 @@ ens32knbsd.c: $(srcdir)/emulparams/ns32knbsd.sh \
epc532macha.c: $(srcdir)/emulparams/pc532macha.sh \
$(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/aout.sc ${GEN_DEPENDS}
${GENSCRIPTS} pc532macha "$(tdir_pc532macha)"
+epjelf.c: $(srcdir)/emulparams/pjelf.sh \
+ $(srcdir)/emultempl/elf32.em $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS}
+ ${GENSCRIPTS} pjelf "$(tdir_pjelf)"
+epjlelf.c: $(srcdir)/emulparams/pjlelf.sh \
+ $(srcdir)/emultempl/elf32.em $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS}
+ ${GENSCRIPTS} pjlelf "$(tdir_pjlelf)"
eppcmacos.c: $(srcdir)/emulparams/ppcmacos.sh \
$(srcdir)/emultempl/aix.em $(srcdir)/scripttempl/aix.sc ${GEN_DEPENDS}
${GENSCRIPTS} ppcmacos "$(tdir_ppcmacos)"
@@ -994,6 +1332,9 @@ eshlelf.c: $(srcdir)/emulparams/shlelf.sh \
eshl.c: $(srcdir)/emulparams/shl.sh \
$(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/sh.sc ${GEN_DEPENDS}
${GENSCRIPTS} shl "$(tdir_shl)"
+eshpe.c: $(srcdir)/emulparams/shpe.sh \
+ $(srcdir)/emultempl/pe.em $(srcdir)/scripttempl/pe.sc ${GEN_DEPENDS}
+ ${GENSCRIPTS} shpe "$(tdir_shl)"
esparcaout.c: $(srcdir)/emulparams/sparcaout.sh \
$(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/aout.sc ${GEN_DEPENDS}
${GENSCRIPTS} sparcaout "$(tdir_sparcaout)"
@@ -1021,6 +1362,9 @@ etic30aout.c: $(srcdir)/emulparams/tic30aout.sh \
etic30coff.c: $(srcdir)/emulparams/tic30coff.sh \
$(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/tic30coff.sc ${GEN_DEPENDS}
${GENSCRIPTS} tic30coff "$(tdir_tic30coff)"
+etic80coff.c: $(srcdir)/emulparams/tic80coff.sh \
+ $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/tic80coff.sc ${GEN_DEPENDS}
+ ${GENSCRIPTS} tic80coff "$(tdir_tic80coff)"
evanilla.c: $(srcdir)/emulparams/vanilla.sh \
$(srcdir)/emultempl/vanilla.em $(srcdir)/scripttempl/vanilla.sc ${GEN_DEPENDS}
${GENSCRIPTS} vanilla "$(tdir_vanilla)"
@@ -1051,6 +1395,7 @@ $(EMULATION_OFILES): ../bfd/bfd.h sysdep.h config.h $(INCDIR)/bfdlink.h \
check-DEJAGNU: site.exp
srcroot=`cd $(srcdir) && pwd`; export srcroot; \
r=`pwd`; export r; \
+ LC_COLLATE=; LC_ALL=; LANG=; export LC_COLLATE LC_ALL LANG; \
EXPECT=$(EXPECT); export EXPECT; \
if [ -f $(top_builddir)/../expect/expect ]; then \
TCL_LIBRARY=`cd $(top_srcdir)/../tcl/library && pwd`; \
@@ -1063,8 +1408,7 @@ check-DEJAGNU: site.exp
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)" \
+ LIBIBERTY="$(LIBIBERTY) $(INTLLIBS)" LIBS="$(LIBS)" \
$(RUNTESTFLAGS); \
else echo "WARNING: could not find \`runtest'" 1>&2; :;\
fi
@@ -1076,16 +1420,16 @@ check-DEJAGNU: site.exp
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)
+ ./ld-new$(EXEEXT) $(HOSTING_EMU) -o ld1$(EXEEXT) $(HOSTING_CRT0) ld-partial.o $(TESTBFDLIB) $(LIBIBERTY) $(HOSTING_LIBS) $(LIBS)
ld1-full$(EXEEXT): ld-new
- ./ld-new$(EXEEXT) $(HOSTING_EMU) -o ld1-full$(EXEEXT) $(HOSTING_CRT0) $(OFILES) $(TESTBFDLIB) $(LIBIBERTY) $(HOSTING_LIBS)
+ ./ld-new$(EXEEXT) $(HOSTING_EMU) -o ld1-full$(EXEEXT) $(HOSTING_CRT0) $(OFILES) $(TESTBFDLIB) $(LIBIBERTY) $(HOSTING_LIBS) $(LIBS)
ld2$(EXEEXT): ld1$(EXEEXT)
- ./ld1$(EXEEXT) $(HOSTING_EMU) -o ld2$(EXEEXT) $(HOSTING_CRT0) $(OFILES) $(TESTBFDLIB) $(LIBIBERTY) $(HOSTING_LIBS)
+ ./ld1$(EXEEXT) $(HOSTING_EMU) -o ld2$(EXEEXT) $(HOSTING_CRT0) $(OFILES) $(TESTBFDLIB) $(LIBIBERTY) $(HOSTING_LIBS) $(LIBS)
ld3$(EXEEXT): ld2$(EXEEXT)
- ./ld2$(EXEEXT) $(HOSTING_EMU) -o ld3$(EXEEXT) $(HOSTING_CRT0) $(OFILES) $(TESTBFDLIB) $(LIBIBERTY) $(HOSTING_LIBS)
+ ./ld2$(EXEEXT) $(HOSTING_EMU) -o ld3$(EXEEXT) $(HOSTING_CRT0) $(OFILES) $(TESTBFDLIB) $(LIBIBERTY) $(HOSTING_LIBS) $(LIBS)
bootstrap: ld3$(EXEEXT)
cmp ld2$(EXEEXT) ld3$(EXEEXT)
@@ -1132,16 +1476,21 @@ configdoc.texi: ${DOCVER}-doc.texi
|| 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
+ldver.texi: Makefile
+ rm -f $@
+ echo '@set VERSION $(VERSION)' > $@
+
+ld.info: $(srcdir)/ld.texinfo configdoc.texi ldver.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
+ld.dvi: $(srcdir)/ld.texinfo configdoc.texi ldver.texi
TEXINPUTS=$(top_srcdir)/../texinfo:$$TEXINPUTS \
- MAKEINFO='$(MAKEINFO) -I $(srcdir) -I $(BFDDIR)/doc' $(TEXI2DVI) $(srcdir)/ld.texinfo
+ 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
+config.status: $(srcdir)/configure $(srcdir)/configure.host $(srcdir)/configure.tgt
+ $(SHELL) ./config.status --recheck
mostlyclean-local:
-rm -rf tmpdir
@@ -1151,59 +1500,58 @@ 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)'`; \
+ echo " $(LIBTOOL) --mode=install $(INSTALL_PROGRAM) $$p $(bindir)/`echo $$p|sed -e 's/$(EXEEXT)$$//' -e 's/-new//'|sed '$(transform)'|sed 's/$$/$(EXEEXT)/'`"; \
+ $(LIBTOOL) --mode=install $(INSTALL_PROGRAM) $$p $(bindir)/`echo $$p|sed -e 's/$(EXEEXT)$$//' -e 's/-new//'|sed '$(transform)'|sed 's/$$/$(EXEEXT)/'`; \
else :; fi; \
done
- rm -f $(tooldir)/bin/ld$(EXEEXT)
n=`echo ld | sed '$(transform)'`; \
if [ "$(bindir)/$$n$(EXEEXT)" != "$(tooldir)/bin/ld$(EXEEXT)" ]; then \
+ rm -f $(tooldir)/bin/ld$(EXEEXT); \
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)
+ $(mkinstalldirs) $(scriptdir)/ldscripts
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
+# 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) MKDEP="$(MKDEP)" DEP1
+ sed -f dep.sed < DEP1 > $@
+ echo '# IF YOU PUT ANYTHING HERE IT WILL GO AWAY' >> $@
+
+DEP1: $(CFILES) $(GENERATED_CFILES)
+ echo '# DO NOT DELETE THIS LINE -- mkdep uses it.' > DEP2
+ echo '# DO NOT PUT ANYTHING AFTER THIS LINE, IT WILL GO AWAY.' >> DEP2
+ $(MKDEP) $(INCLUDES) $(CFLAGS) $? >> DEP2
+ mv -f DEP2 $@
dep.sed: dep-in.sed config.status
sed <$(srcdir)/dep-in.sed >dep.sed \
-e 's!@INCDIR@!$(INCDIR)!' \
-e 's!@SRCDIR@!$(srcdir)!'
-dep: .dep
+dep: DEP
sed -e '/^..DO NOT DELETE THIS LINE/,$$d' < Makefile > tmp-Makefile
- cat .dep >> tmp-Makefile
+ cat DEP >> tmp-Makefile
$(srcdir)/../move-if-change tmp-Makefile Makefile
-dep-in: .dep
+dep-in: DEP
sed -e '/^..DO NOT DELETE THIS LINE/,$$d' < $(srcdir)/Makefile.in > tmp-Makefile.in
- cat .dep >> tmp-Makefile.in
+ cat DEP >> tmp-Makefile.in
$(srcdir)/../move-if-change tmp-Makefile.in $(srcdir)/Makefile.in
-dep-am: .dep
+dep-am: DEP
sed -e '/^..DO NOT DELETE THIS LINE/,$$d' < $(srcdir)/Makefile.am > tmp-Makefile.am
- cat .dep >> tmp-Makefile.am
+ cat DEP >> tmp-Makefile.am
$(srcdir)/../move-if-change tmp-Makefile.am $(srcdir)/Makefile.am
.PHONY: dep dep-in dep-am
@@ -1212,61 +1560,72 @@ dep-am: .dep
# 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
+ ld.h $(INCDIR)/bin-bugs.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
+ sysdep.h config.h $(INCDIR)/fopen-same.h ld.h $(INCDIR)/bin-bugs.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
+ ld.h $(INCDIR)/bin-bugs.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
+ ld.h $(INCDIR)/bin-bugs.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
+ $(INCDIR)/obstack.h $(INCDIR)/bfdlink.h ld.h $(INCDIR)/bin-bugs.h \
+ ldmain.h ldgram.h ldexp.h ldlang.h ldemul.h ldlex.h \
+ ldmisc.h ldctor.h ldfile.h $(INCDIR)/fnmatch.h $(INCDIR)/demangle.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
+ $(INCDIR)/progress.h $(INCDIR)/bfdlink.h ld.h $(INCDIR)/bin-bugs.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
+ $(INCDIR)/demangle.h ld.h $(INCDIR)/bin-bugs.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
+ sysdep.h config.h $(INCDIR)/fopen-same.h ld.h $(INCDIR)/bin-bugs.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
+ $(INCDIR)/libiberty.h ld.h $(INCDIR)/bin-bugs.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 \
+ $(INCDIR)/bfdlink.h ld.h $(INCDIR)/bin-bugs.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
+ config.h $(INCDIR)/fopen-same.h ld.h $(INCDIR)/bin-bugs.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
+ $(INCDIR)/libiberty.h ld.h $(INCDIR)/bin-bugs.h ldmain.h \
+ ldmisc.h ldexp.h ldlang.h
+pe-dll.o: pe-dll.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \
+ sysdep.h config.h $(INCDIR)/fopen-same.h $(INCDIR)/bfdlink.h \
+ $(INCDIR)/libiberty.h ld.h $(INCDIR)/bin-bugs.h ldexp.h \
+ ldlang.h ldwrite.h ldmisc.h ldgram.h ldmain.h ldemul.h \
+ $(INCDIR)/coff/internal.h ../bfd/libcoff.h deffile.h \
+ pe-dll.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
+ ld.h $(INCDIR)/bin-bugs.h ldexp.h ldver.h ldlang.h \
+ ldemul.h ldfile.h ldmisc.h ldmain.h mri.h ldctor.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
-
+ ld.h $(INCDIR)/bin-bugs.h ldgram.h ldmisc.h ldexp.h \
+ ldlang.h ldfile.h ldlex.h ldmain.h
+deffilep.o: deffilep.c $(INCDIR)/libiberty.h $(INCDIR)/ansidecl.h \
+ ../bfd/bfd.h sysdep.h config.h $(INCDIR)/fopen-same.h \
+ ld.h $(INCDIR)/bin-bugs.h ldmisc.h deffile.h
# IF YOU PUT ANYTHING HERE IT WILL GO AWAY
# Tell versions [3.59,3.63) of GNU make to not export all variables.
diff --git a/contrib/binutils/ld/NEWS b/contrib/binutils/ld/NEWS
index ba32596..2c2340f 100644
--- a/contrib/binutils/ld/NEWS
+++ b/contrib/binutils/ld/NEWS
@@ -1,5 +1,36 @@
-*- text -*-
+Changes in version 2.10:
+
+* Added garbage collection of unused sections, enabled by --gc-sections.
+ It does require a bit of backend support; currently implemented are
+ ppc-elf, mips-elf, and mn10300-elf. Others will ignore the option.
+
+* Added SORT to the linker script language to permit sorting sections by file
+ name or section name.
+
+* Added EXTERN to the linker script language as an equivalent to the -u
+ command-line option.
+
+* Added ASSERT to the linker script language.
+
+* Added EXCLUDE_FILE to the linker script language for further control over
+ wildcard file names.
+
+* Added -O option to optimize linker output (as of this writing, this only
+affects ELF shared library generation).
+
+* The -e option now accepts a number as well as a symbol name.
+
+* Added --no-undefined option to disallow undefined symbols when creating a
+ shared library.
+
+* The linker now issues a warning, not an error, for an undefined symbol when
+ using -Bsymbolic; use the new --no-undefined option to get the old
+ behaviour.
+
+* Added --demangle and --no-demangle options.
+
Changes in version 2.9:
* Added SQUAD to the linker script language.
@@ -7,7 +38,7 @@ Changes in version 2.9:
* 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.
+ are not placed in a specific memory region are placed.
Changes in version 2.8:
diff --git a/contrib/binutils/ld/aclocal.m4 b/contrib/binutils/ld/aclocal.m4
index cbf8bd1..8bebfa0 100644
--- a/contrib/binutils/ld/aclocal.m4
+++ b/contrib/binutils/ld/aclocal.m4
@@ -1,7 +1,7 @@
-dnl aclocal.m4 generated automatically by aclocal 1.2e
+dnl aclocal.m4 generated automatically by aclocal 1.4
-dnl Copyright (C) 1994, 1995, 1996, 1997, 1998 Free Software Foundation, Inc.
-dnl This Makefile.in is free software; the Free Software Foundation
+dnl Copyright (C) 1994, 1995-8, 1999 Free Software Foundation, Inc.
+dnl This file 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.
@@ -22,7 +22,7 @@ dnl Usage:
dnl AM_INIT_AUTOMAKE(package,version, [no-define])
AC_DEFUN(AM_INIT_AUTOMAKE,
-[AC_REQUIRE([AM_PROG_INSTALL])
+[AC_REQUIRE([AC_PROG_INSTALL])
PACKAGE=[$1]
AC_SUBST(PACKAGE)
VERSION=[$2]
@@ -32,8 +32,8 @@ 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_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package])
+AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version number of package]))
AC_REQUIRE([AM_SANITY_CHECK])
AC_REQUIRE([AC_ARG_PROGRAM])
dnl FIXME This is truly gross.
@@ -45,15 +45,6 @@ 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.
#
@@ -114,32 +105,75 @@ 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
+# serial 40 AC_PROG_LIBTOOL
+AC_DEFUN(AC_PROG_LIBTOOL,
+[AC_REQUIRE([AC_LIBTOOL_SETUP])dnl
+
+# Save cache, so that ltconfig can load it
+AC_CACHE_SAVE
+
+# Actually configure libtool. ac_aux_dir is where install-sh is found.
+CC="$CC" CFLAGS="$CFLAGS" CPPFLAGS="$CPPFLAGS" \
+LD="$LD" LDFLAGS="$LDFLAGS" LIBS="$LIBS" \
+LN_S="$LN_S" NM="$NM" RANLIB="$RANLIB" \
+DLLTOOL="$DLLTOOL" AS="$AS" OBJDUMP="$OBJDUMP" \
+${CONFIG_SHELL-/bin/sh} $ac_aux_dir/ltconfig --no-reexec \
+$libtool_flags --no-verify $ac_aux_dir/ltmain.sh $lt_target \
+|| AC_MSG_ERROR([libtool configure failed])
+
+# Reload cache, that may have been modified by ltconfig
+AC_CACHE_LOAD
+
+# This can be used to rebuild libtool when needed
+LIBTOOL_DEPS="$ac_aux_dir/ltconfig $ac_aux_dir/ltmain.sh"
+
+# Always use our own libtool.
+LIBTOOL='$(SHELL) $(top_builddir)/libtool'
+AC_SUBST(LIBTOOL)dnl
+
+# Redirect the config.log output again, so that the ltconfig log is not
+# clobbered by the next message.
+exec 5>>./config.log
+])
+
+AC_DEFUN(AC_LIBTOOL_SETUP,
+[AC_PREREQ(2.13)dnl
+AC_REQUIRE([AC_ENABLE_SHARED])dnl
+AC_REQUIRE([AC_ENABLE_STATIC])dnl
+AC_REQUIRE([AC_ENABLE_FAST_INSTALL])dnl
AC_REQUIRE([AC_CANONICAL_HOST])dnl
+AC_REQUIRE([AC_CANONICAL_BUILD])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_LD])dnl
+AC_REQUIRE([AC_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
+
+case "$target" in
+NONE) lt_target="$host" ;;
+*) lt_target="$target" ;;
+esac
# Check for any special flags to pass to ltconfig.
-libtool_flags=
+libtool_flags="--cache-file=$cache_file"
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 "$enable_fast_install" = no && libtool_flags="$libtool_flags --disable-fast-install"
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"
+ifdef([AC_PROVIDE_AC_LIBTOOL_DLOPEN],
+[libtool_flags="$libtool_flags --enable-dlopen"])
+ifdef([AC_PROVIDE_AC_LIBTOOL_WIN32_DLL],
+[libtool_flags="$libtool_flags --enable-win32-dll"])
+AC_ARG_ENABLE(libtool-lock,
+ [ --disable-libtool-lock avoid locking (might break parallel builds)])
+test "x$enable_libtool_lock" = xno && libtool_flags="$libtool_flags --disable-lock"
+test x"$silent" = xyes && libtool_flags="$libtool_flags --silent"
# Some flags need to be propagated to the compiler or linker for good
# libtool support.
-case "$host" in
+case "$lt_target" in
*-*-irix6*)
# Find out which ABI we are using.
echo '[#]line __oline__ "configure"' > conftest.$ac_ext
@@ -161,30 +195,42 @@ case "$host" in
*-*-sco3.2v5*)
# On SCO OpenServer 5, we need -belf to get full-featured binaries.
+ SAVE_CFLAGS="$CFLAGS"
CFLAGS="$CFLAGS -belf"
+ AC_CACHE_CHECK([whether the C compiler needs -belf], lt_cv_cc_needs_belf,
+ [AC_TRY_LINK([],[],[lt_cv_cc_needs_belf=yes],[lt_cv_cc_needs_belf=no])])
+ if test x"$lt_cv_cc_needs_belf" != x"yes"; then
+ # this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf
+ CFLAGS="$SAVE_CFLAGS"
+ fi
;;
-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])
+ifdef([AC_PROVIDE_AC_LIBTOOL_WIN32_DLL],
+[*-*-cygwin* | *-*-mingw*)
+ AC_CHECK_TOOL(DLLTOOL, dlltool, false)
+ AC_CHECK_TOOL(AS, as, false)
+ AC_CHECK_TOOL(OBJDUMP, objdump, false)
+ ;;
])
+esac
+])
+
+# AC_LIBTOOL_DLOPEN - enable checks for dlopen support
+AC_DEFUN(AC_LIBTOOL_DLOPEN, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])])
+
+# AC_LIBTOOL_WIN32_DLL - declare package support for building win32 dll's
+AC_DEFUN(AC_LIBTOOL_WIN32_DLL, [AC_BEFORE([$0], [AC_LIBTOOL_SETUP])])
-# AM_ENABLE_SHARED - implement the --enable-shared flag
-# Usage: AM_ENABLE_SHARED[(DEFAULT)]
+# AC_ENABLE_SHARED - implement the --enable-shared flag
+# Usage: AC_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_DEFUN(AC_ENABLE_SHARED, [dnl
+define([AC_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]
+<< --enable-shared[=PKGS] build shared libraries [default=>>AC_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 ;;
@@ -201,29 +247,23 @@ no) enable_shared=no ;;
IFS="$ac_save_ifs"
;;
esac],
-enable_shared=AM_ENABLE_SHARED_DEFAULT)dnl
+enable_shared=AC_ENABLE_SHARED_DEFAULT)dnl
])
-# AM_DISABLE_SHARED - set the default shared flag to --disable-shared
-AC_DEFUN(AM_DISABLE_SHARED,
-[AM_ENABLE_SHARED(no)])
+# AC_DISABLE_SHARED - set the default shared flag to --disable-shared
+AC_DEFUN(AC_DISABLE_SHARED, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
+AC_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)]
+# AC_ENABLE_STATIC - implement the --enable-static flag
+# Usage: AC_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_DEFUN(AC_ENABLE_STATIC, [dnl
+define([AC_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]
+<< --enable-static[=PKGS] build static libraries [default=>>AC_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 ;;
@@ -240,28 +280,73 @@ no) enable_static=no ;;
IFS="$ac_save_ifs"
;;
esac],
-enable_static=AM_ENABLE_STATIC_DEFAULT)dnl
+enable_static=AC_ENABLE_STATIC_DEFAULT)dnl
])
+# AC_DISABLE_STATIC - set the default static flag to --disable-static
+AC_DEFUN(AC_DISABLE_STATIC, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
+AC_ENABLE_STATIC(no)])
+
-# AM_PROG_LD - find the path to the GNU or non-GNU linker
-AC_DEFUN(AM_PROG_LD,
+# AC_ENABLE_FAST_INSTALL - implement the --enable-fast-install flag
+# Usage: AC_ENABLE_FAST_INSTALL[(DEFAULT)]
+# Where DEFAULT is either `yes' or `no'. If omitted, it defaults to
+# `yes'.
+AC_DEFUN(AC_ENABLE_FAST_INSTALL, [dnl
+define([AC_ENABLE_FAST_INSTALL_DEFAULT], ifelse($1, no, no, yes))dnl
+AC_ARG_ENABLE(fast-install,
+changequote(<<, >>)dnl
+<< --enable-fast-install[=PKGS] optimize for fast installation [default=>>AC_ENABLE_FAST_INSTALL_DEFAULT],
+changequote([, ])dnl
+[p=${PACKAGE-default}
+case "$enableval" in
+yes) enable_fast_install=yes ;;
+no) enable_fast_install=no ;;
+*)
+ enable_fast_install=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_fast_install=yes
+ fi
+ done
+ IFS="$ac_save_ifs"
+ ;;
+esac],
+enable_fast_install=AC_ENABLE_FAST_INSTALL_DEFAULT)dnl
+])
+
+# AC_ENABLE_FAST_INSTALL - set the default to --disable-fast-install
+AC_DEFUN(AC_DISABLE_FAST_INSTALL, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
+AC_ENABLE_FAST_INSTALL(no)])
+
+# AC_PROG_LD - find the path to the GNU or non-GNU linker
+AC_DEFUN(AC_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_REQUIRE([AC_PROG_CC])dnl
+AC_REQUIRE([AC_CANONICAL_HOST])dnl
+AC_REQUIRE([AC_CANONICAL_BUILD])dnl
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.
+ # Accept absolute paths.
changequote(,)dnl
- /* | [A-Za-z]:\\*)
+ [\\/]* | [A-Za-z]:[\\/]*)
+ re_direlt='/[^/][^/]*/\.\./'
changequote([,])dnl
- test -z "$LD" && LD="$ac_prog"
- ;;
+ # Canonicalize the path of ld
+ ac_prog=`echo $ac_prog| sed 's%\\\\%/%g'`
+ while echo $ac_prog | grep "$re_direlt" > /dev/null 2>&1; do
+ ac_prog=`echo $ac_prog| sed "s%$re_direlt%/%"`
+ done
+ test -z "$LD" && LD="$ac_prog"
+ ;;
"")
# If it fails, then pretend we aren't using GCC.
ac_prog=ld
@@ -278,10 +363,10 @@ else
fi
AC_CACHE_VAL(ac_cv_path_LD,
[if test -z "$LD"; then
- IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:"
+ IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR-:}"
for ac_dir in $PATH; do
test -z "$ac_dir" && ac_dir=.
- if test -f "$ac_dir/$ac_prog"; then
+ if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; 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.
@@ -289,7 +374,7 @@ AC_CACHE_VAL(ac_cv_path_LD,
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
+ test "$with_gnu_ld" != yes && break
fi
fi
done
@@ -304,11 +389,10 @@ 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_PROG_LD_GNU
])
-AC_DEFUN(AM_PROG_LD_GNU,
+AC_DEFUN(AC_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 </dev/null | egrep '(GNU|with BFD)' 1>&5; then
@@ -318,43 +402,117 @@ else
fi])
])
-# AM_PROG_NM - find the path to a BSD-compatible name lister
-AC_DEFUN(AM_PROG_NM,
+# AC_PROG_NM - find the path to a BSD-compatible name lister
+AC_DEFUN(AC_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
+[if test -n "$NM"; then
+ # Let the user override the test.
+ ac_cv_path_NM="$NM"
+else
+ IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR-:}"
+ for ac_dir in $PATH /usr/ccs/bin /usr/ucb /bin; do
test -z "$ac_dir" && ac_dir=.
- if test -f $ac_dir/nm; then
+ if test -f $ac_dir/nm || test -f $ac_dir/nm$ac_exeext ; 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"
+ ac_cv_path_NM="$ac_dir/nm -B"
+ break
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"
+ ac_cv_path_NM="$ac_dir/nm -p"
+ break
else
- ac_cv_path_NM="$ac_dir/nm"
+ ac_cv_path_NM=${ac_cv_path_NM="$ac_dir/nm"} # keep the first match, but
+ continue # so that we can try to find one that supports BSD flags
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"
AC_MSG_RESULT([$NM])
-AC_SUBST(NM)
])
+# AC_CHECK_LIBM - check for math library
+AC_DEFUN(AC_CHECK_LIBM,
+[AC_REQUIRE([AC_CANONICAL_HOST])dnl
+LIBM=
+case "$lt_target" in
+*-*-beos* | *-*-cygwin*)
+ # These system don't have libm
+ ;;
+*-ncr-sysv4.3*)
+ AC_CHECK_LIB(mw, _mwvalidcheckl, LIBM="-lmw")
+ AC_CHECK_LIB(m, main, LIBM="$LIBM -lm")
+ ;;
+*)
+ AC_CHECK_LIB(m, main, LIBM="-lm")
+ ;;
+esac
+])
+
+# AC_LIBLTDL_CONVENIENCE[(dir)] - sets LIBLTDL to the link flags for
+# the libltdl convenience library, adds --enable-ltdl-convenience to
+# the configure arguments. Note that LIBLTDL is not AC_SUBSTed, nor
+# is AC_CONFIG_SUBDIRS called. If DIR is not provided, it is assumed
+# to be `${top_builddir}/libltdl'. Make sure you start DIR with
+# '${top_builddir}/' (note the single quotes!) if your package is not
+# flat, and, if you're not using automake, define top_builddir as
+# appropriate in the Makefiles.
+AC_DEFUN(AC_LIBLTDL_CONVENIENCE, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
+ case "$enable_ltdl_convenience" in
+ no) AC_MSG_ERROR([this package needs a convenience libltdl]) ;;
+ "") enable_ltdl_convenience=yes
+ ac_configure_args="$ac_configure_args --enable-ltdl-convenience" ;;
+ esac
+ LIBLTDL=ifelse($#,1,$1,['${top_builddir}/libltdl'])/libltdlc.la
+ INCLTDL=ifelse($#,1,-I$1,['-I${top_builddir}/libltdl'])
+])
+
+# AC_LIBLTDL_INSTALLABLE[(dir)] - sets LIBLTDL to the link flags for
+# the libltdl installable library, and adds --enable-ltdl-install to
+# the configure arguments. Note that LIBLTDL is not AC_SUBSTed, nor
+# is AC_CONFIG_SUBDIRS called. If DIR is not provided, it is assumed
+# to be `${top_builddir}/libltdl'. Make sure you start DIR with
+# '${top_builddir}/' (note the single quotes!) if your package is not
+# flat, and, if you're not using automake, define top_builddir as
+# appropriate in the Makefiles.
+# In the future, this macro may have to be called after AC_PROG_LIBTOOL.
+AC_DEFUN(AC_LIBLTDL_INSTALLABLE, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
+ AC_CHECK_LIB(ltdl, main,
+ [test x"$enable_ltdl_install" != xyes && enable_ltdl_install=no],
+ [if test x"$enable_ltdl_install" = xno; then
+ AC_MSG_WARN([libltdl not installed, but installation disabled])
+ else
+ enable_ltdl_install=yes
+ fi
+ ])
+ if test x"$enable_ltdl_install" = x"yes"; then
+ ac_configure_args="$ac_configure_args --enable-ltdl-install"
+ LIBLTDL=ifelse($#,1,$1,['${top_builddir}/libltdl'])/libltdl.la
+ INCLTDL=ifelse($#,1,-I$1,['-I${top_builddir}/libltdl'])
+ else
+ ac_configure_args="$ac_configure_args --enable-ltdl-install=no"
+ LIBLTDL="-lltdl"
+ INCLTDL=
+ fi
+])
+
+dnl old names
+AC_DEFUN(AM_PROG_LIBTOOL, [indir([AC_PROG_LIBTOOL])])dnl
+AC_DEFUN(AM_ENABLE_SHARED, [indir([AC_ENABLE_SHARED], $@)])dnl
+AC_DEFUN(AM_ENABLE_STATIC, [indir([AC_ENABLE_STATIC], $@)])dnl
+AC_DEFUN(AM_DISABLE_SHARED, [indir([AC_DISABLE_SHARED], $@)])dnl
+AC_DEFUN(AM_DISABLE_STATIC, [indir([AC_DISABLE_STATIC], $@)])dnl
+AC_DEFUN(AM_PROG_LD, [indir([AC_PROG_LD])])dnl
+AC_DEFUN(AM_PROG_NM, [indir([AC_PROG_NM])])dnl
+
+dnl This is just to silence aclocal about the macro not being used
+ifelse([AC_DISABLE_FAST_INSTALL])dnl
+
# Like AC_CONFIG_HEADER, but automatically create stamp file.
AC_DEFUN(AM_CONFIG_HEADER,
@@ -378,62 +536,359 @@ for am_file in <<$1>>; do
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
+# This file is derived from `gettext.m4'. The difference is that the
+# included macros assume Cygnus-style source and build trees.
+
+# Macro to add for using GNU gettext.
+# Ulrich Drepper <drepper@cygnus.com>, 1995.
+#
+# This file file be copied and used freely without restrictions. It can
+# be used in projects which are not available under the GNU Public License
+# but which still want to provide support for the GNU gettext functionality.
+# Please note that the actual code is *not* freely available.
+
+# serial 3
+
+AC_DEFUN(CY_WITH_NLS,
+ [AC_MSG_CHECKING([whether NLS is requested])
+ dnl Default is enabled NLS
+ AC_ARG_ENABLE(nls,
+ [ --disable-nls do not use Native Language Support],
+ USE_NLS=$enableval, USE_NLS=yes)
+ AC_MSG_RESULT($USE_NLS)
+ AC_SUBST(USE_NLS)
+
+ USE_INCLUDED_LIBINTL=no
+
+ dnl If we use NLS figure out what method
+ if test "$USE_NLS" = "yes"; then
+ AC_DEFINE(ENABLE_NLS, 1, [Define to 1 if NLS is requested])
+ AC_MSG_CHECKING([whether included gettext is requested])
+ AC_ARG_WITH(included-gettext,
+ [ --with-included-gettext use the GNU gettext library included here],
+ nls_cv_force_use_gnu_gettext=$withval,
+ nls_cv_force_use_gnu_gettext=no)
+ AC_MSG_RESULT($nls_cv_force_use_gnu_gettext)
+
+ nls_cv_use_gnu_gettext="$nls_cv_force_use_gnu_gettext"
+ if test "$nls_cv_force_use_gnu_gettext" != "yes"; then
+ dnl User does not insist on using GNU NLS library. Figure out what
+ dnl to use. If gettext or catgets are available (in this order) we
+ dnl use this. Else we have to fall back to GNU NLS library.
+ dnl catgets is only used if permitted by option --with-catgets.
+ nls_cv_header_intl=
+ nls_cv_header_libgt=
+ CATOBJEXT=NONE
+
+ AC_CHECK_HEADER(libintl.h,
+ [AC_CACHE_CHECK([for gettext in libc], gt_cv_func_gettext_libc,
+ [AC_TRY_LINK([#include <libintl.h>], [return (int) gettext ("")],
+ gt_cv_func_gettext_libc=yes, gt_cv_func_gettext_libc=no)])
+
+ if test "$gt_cv_func_gettext_libc" != "yes"; then
+ AC_CHECK_LIB(intl, bindtextdomain,
+ [AC_CACHE_CHECK([for gettext in libintl],
+ gt_cv_func_gettext_libintl,
+ [AC_TRY_LINK([], [return (int) gettext ("")],
+ gt_cv_func_gettext_libintl=yes,
+ gt_cv_func_gettext_libintl=no)])])
+ fi
+
+ if test "$gt_cv_func_gettext_libc" = "yes" \
+ || test "$gt_cv_func_gettext_libintl" = "yes"; then
+ AC_DEFINE(HAVE_GETTEXT, 1,
+ [Define as 1 if you have gettext and don't want to use GNU gettext.])
+ AM_PATH_PROG_WITH_TEST(MSGFMT, msgfmt,
+ [test -z "`$ac_dir/$ac_word -h 2>&1 | grep 'dv '`"], no)dnl
+ if test "$MSGFMT" != "no"; then
+ AC_CHECK_FUNCS(dcgettext)
+ AC_PATH_PROG(GMSGFMT, gmsgfmt, $MSGFMT)
+ AM_PATH_PROG_WITH_TEST(XGETTEXT, xgettext,
+ [test -z "`$ac_dir/$ac_word -h 2>&1 | grep '(HELP)'`"], :)
+ AC_TRY_LINK(, [extern int _nl_msg_cat_cntr;
+ return _nl_msg_cat_cntr],
+ [CATOBJEXT=.gmo
+ DATADIRNAME=share],
+ [CATOBJEXT=.mo
+ DATADIRNAME=lib])
+ INSTOBJEXT=.mo
+ fi
+ fi
+ ])
+
+ dnl In the standard gettext, we would now check for catgets.
+ dnl However, we never want to use catgets for our releases.
+
+ if test "$CATOBJEXT" = "NONE"; then
+ dnl Neither gettext nor catgets in included in the C library.
+ dnl Fall back on GNU gettext library.
+ nls_cv_use_gnu_gettext=yes
+ fi
+ fi
+
+ if test "$nls_cv_use_gnu_gettext" = "yes"; then
+ dnl Mark actions used to generate GNU NLS library.
+ INTLOBJS="\$(GETTOBJS)"
+ AM_PATH_PROG_WITH_TEST(MSGFMT, msgfmt,
+ [test -z "`$ac_dir/$ac_word -h 2>&1 | grep 'dv '`"], msgfmt)
+ AC_PATH_PROG(GMSGFMT, gmsgfmt, $MSGFMT)
+ AM_PATH_PROG_WITH_TEST(XGETTEXT, xgettext,
+ [test -z "`$ac_dir/$ac_word -h 2>&1 | grep '(HELP)'`"], :)
+ AC_SUBST(MSGFMT)
+ USE_INCLUDED_LIBINTL=yes
+ CATOBJEXT=.gmo
+ INSTOBJEXT=.mo
+ DATADIRNAME=share
+ INTLDEPS='$(top_builddir)/../intl/libintl.a'
+ INTLLIBS=$INTLDEPS
+ LIBS=`echo $LIBS | sed -e 's/-lintl//'`
+ nls_cv_header_intl=libintl.h
+ nls_cv_header_libgt=libgettext.h
+ fi
+
+ dnl Test whether we really found GNU xgettext.
+ if test "$XGETTEXT" != ":"; then
+ dnl If it is no GNU xgettext we define it as : so that the
+ dnl Makefiles still can work.
+ if $XGETTEXT --omit-header /dev/null 2> /dev/null; then
+ : ;
+ else
+ AC_MSG_RESULT(
+ [found xgettext programs is not GNU xgettext; ignore it])
+ XGETTEXT=":"
+ fi
+ fi
+
+ # We need to process the po/ directory.
+ POSUB=po
+ else
+ DATADIRNAME=share
+ nls_cv_header_intl=libintl.h
+ nls_cv_header_libgt=libgettext.h
+ fi
+
+ # If this is used in GNU gettext we have to set USE_NLS to `yes'
+ # because some of the sources are only built for this goal.
+ if test "$PACKAGE" = gettext; then
+ USE_NLS=yes
+ USE_INCLUDED_LIBINTL=yes
+ fi
+
+ dnl These rules are solely for the distribution goal. While doing this
+ dnl we only have to keep exactly one list of the available catalogs
+ dnl in configure.in.
+ for lang in $ALL_LINGUAS; do
+ GMOFILES="$GMOFILES $lang.gmo"
+ POFILES="$POFILES $lang.po"
+ done
+
+ dnl Make all variables we use known to autoconf.
+ AC_SUBST(USE_INCLUDED_LIBINTL)
+ AC_SUBST(CATALOGS)
+ AC_SUBST(CATOBJEXT)
+ AC_SUBST(DATADIRNAME)
+ AC_SUBST(GMOFILES)
+ AC_SUBST(INSTOBJEXT)
+ AC_SUBST(INTLDEPS)
+ AC_SUBST(INTLLIBS)
+ AC_SUBST(INTLOBJS)
+ AC_SUBST(POFILES)
+ AC_SUBST(POSUB)
+ ])
+
+AC_DEFUN(CY_GNU_GETTEXT,
+ [AC_REQUIRE([AC_PROG_MAKE_SET])dnl
+ AC_REQUIRE([AC_PROG_CC])dnl
+ AC_REQUIRE([AC_PROG_RANLIB])dnl
+ AC_REQUIRE([AC_ISC_POSIX])dnl
+ AC_REQUIRE([AC_HEADER_STDC])dnl
+ AC_REQUIRE([AC_C_CONST])dnl
+ AC_REQUIRE([AC_C_INLINE])dnl
+ AC_REQUIRE([AC_TYPE_OFF_T])dnl
+ AC_REQUIRE([AC_TYPE_SIZE_T])dnl
+ AC_REQUIRE([AC_FUNC_ALLOCA])dnl
+ AC_REQUIRE([AC_FUNC_MMAP])dnl
+
+ AC_CHECK_HEADERS([argz.h limits.h locale.h nl_types.h malloc.h string.h \
+unistd.h values.h sys/param.h])
+ AC_CHECK_FUNCS([getcwd munmap putenv setenv setlocale strchr strcasecmp \
+__argz_count __argz_stringify __argz_next])
+
+ if test "${ac_cv_func_stpcpy+set}" != "set"; then
+ AC_CHECK_FUNCS(stpcpy)
+ fi
+ if test "${ac_cv_func_stpcpy}" = "yes"; then
+ AC_DEFINE(HAVE_STPCPY, 1, [Define if you have the stpcpy function])
+ fi
+
+ AM_LC_MESSAGES
+ CY_WITH_NLS
+
+ if test "x$CATOBJEXT" != "x"; then
+ if test "x$ALL_LINGUAS" = "x"; then
+ LINGUAS=
+ else
+ AC_MSG_CHECKING(for catalogs to be installed)
+ NEW_LINGUAS=
+ for lang in ${LINGUAS=$ALL_LINGUAS}; do
+ case "$ALL_LINGUAS" in
+ *$lang*) NEW_LINGUAS="$NEW_LINGUAS $lang" ;;
+ esac
+ done
+ LINGUAS=$NEW_LINGUAS
+ AC_MSG_RESULT($LINGUAS)
+ fi
+
+ dnl Construct list of names of catalog files to be constructed.
+ if test -n "$LINGUAS"; then
+ for lang in $LINGUAS; do CATALOGS="$CATALOGS $lang$CATOBJEXT"; done
+ fi
+ fi
+
+ dnl The reference to <locale.h> in the installed <libintl.h> file
+ dnl must be resolved because we cannot expect the users of this
+ dnl to define HAVE_LOCALE_H.
+ if test $ac_cv_header_locale_h = yes; then
+ INCLUDE_LOCALE_H="#include <locale.h>"
+ else
+ INCLUDE_LOCALE_H="\
+/* The system does not provide the header <locale.h>. Take care yourself. */"
+ fi
+ AC_SUBST(INCLUDE_LOCALE_H)
+
+ dnl Determine which catalog format we have (if any is needed)
+ dnl For now we know about two different formats:
+ dnl Linux libc-5 and the normal X/Open format
+ if test -f $srcdir/po2tbl.sed.in; then
+ if test "$CATOBJEXT" = ".cat"; then
+ AC_CHECK_HEADER(linux/version.h, msgformat=linux, msgformat=xopen)
+
+ dnl Transform the SED scripts while copying because some dumb SEDs
+ dnl cannot handle comments.
+ sed -e '/^#/d' $srcdir/$msgformat-msg.sed > po2msg.sed
+ fi
+ dnl po2tbl.sed is always needed.
+ sed -e '/^#.*[^\\]$/d' -e '/^#$/d' \
+ $srcdir/po2tbl.sed.in > po2tbl.sed
+ fi
+
+ dnl In the intl/Makefile.in we have a special dependency which makes
+ dnl only sense for gettext. We comment this out for non-gettext
+ dnl packages.
+ if test "$PACKAGE" = "gettext"; then
+ GT_NO="#NO#"
+ GT_YES=
+ else
+ GT_NO=
+ GT_YES="#YES#"
+ fi
+ AC_SUBST(GT_NO)
+ AC_SUBST(GT_YES)
+
+ MKINSTALLDIRS="\$(srcdir)/../../mkinstalldirs"
+ AC_SUBST(MKINSTALLDIRS)
+
+ dnl *** For now the libtool support in intl/Makefile is not for real.
+ l=
+ AC_SUBST(l)
+
+ dnl Generate list of files to be processed by xgettext which will
+ dnl be included in po/Makefile. But only do this if the po directory
+ dnl exists in srcdir.
+ if test -d $srcdir/po; then
+ test -d po || mkdir po
+ if test "x$srcdir" != "x."; then
+ if test "x`echo $srcdir | sed 's@/.*@@'`" = "x"; then
+ posrcprefix="$srcdir/"
+ else
+ posrcprefix="../$srcdir/"
+ fi
+ else
+ posrcprefix="../"
+ fi
+ rm -f po/POTFILES
+ sed -e "/^#/d" -e "/^\$/d" -e "s,.*, $posrcprefix& \\\\," -e "\$s/\(.*\) \\\\/\1/" \
+ < $srcdir/po/POTFILES.in > po/POTFILES
+ fi
+ ])
+
+# Search path for a program which passes the given test.
+# Ulrich Drepper <drepper@cygnus.com>, 1996.
+#
+# This file file be copied and used freely without restrictions. It can
+# be used in projects which are not available under the GNU Public License
+# but which still want to provide support for the GNU gettext functionality.
+# Please note that the actual code is *not* freely available.
+
+# serial 1
+
+dnl AM_PATH_PROG_WITH_TEST(VARIABLE, PROG-TO-CHECK-FOR,
+dnl TEST-PERFORMED-ON-FOUND_PROGRAM [, VALUE-IF-NOT-FOUND [, PATH]])
+AC_DEFUN(AM_PATH_PROG_WITH_TEST,
+[# Extract the first word of "$2", so it can be a program name with args.
+set dummy $2; ac_word=[$]2
+AC_MSG_CHECKING([for $ac_word])
+AC_CACHE_VAL(ac_cv_path_$1,
+[case "[$]$1" in
+ /*)
+ ac_cv_path_$1="[$]$1" # Let the user override the test with a path.
+ ;;
+ *)
+ IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:"
+ for ac_dir in ifelse([$5], , $PATH, [$5]); do
+ test -z "$ac_dir" && ac_dir=.
+ if test -f $ac_dir/$ac_word; then
+ if [$3]; then
+ ac_cv_path_$1="$ac_dir/$ac_word"
+ break
+ fi
+ fi
+ done
+ IFS="$ac_save_ifs"
+dnl If no 4th arg is given, leave the cache variable unset,
+dnl so AC_PATH_PROGS will keep looking.
+ifelse([$4], , , [ test -z "[$]ac_cv_path_$1" && ac_cv_path_$1="$4"
+])dnl
+ ;;
+esac])dnl
+$1="$ac_cv_path_$1"
+if test -n "[$]$1"; then
+ AC_MSG_RESULT([$]$1)
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
+ AC_MSG_RESULT(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])
+AC_SUBST($1)dnl
+])
+
+# Check whether LC_MESSAGES is available in <locale.h>.
+# Ulrich Drepper <drepper@cygnus.com>, 1995.
+#
+# This file file be copied and used freely without restrictions. It can
+# be used in projects which are not available under the GNU Public License
+# but which still want to provide support for the GNU gettext functionality.
+# Please note that the actual code is *not* freely available.
+
+# serial 1
+
+AC_DEFUN(AM_LC_MESSAGES,
+ [if test $ac_cv_header_locale_h = yes; then
+ AC_CACHE_CHECK([for LC_MESSAGES], am_cv_val_LC_MESSAGES,
+ [AC_TRY_LINK([#include <locale.h>], [return LC_MESSAGES],
+ am_cv_val_LC_MESSAGES=yes, am_cv_val_LC_MESSAGES=no)])
+ if test $am_cv_val_LC_MESSAGES = yes; then
+ AC_DEFINE(HAVE_LC_MESSAGES, 1,
+ [Define if your locale.h file contains LC_MESSAGES.])
+ fi
+ fi])
+
+
+dnl AM_PROG_LEX
+dnl Look for flex, lex or missing, then run AC_PROG_LEX and AC_DECL_YYTEXT
+AC_DEFUN(AM_PROG_LEX,
+[missing_dir=ifelse([$1],,`cd $ac_aux_dir && pwd`,$1)
+AC_CHECK_PROGS(LEX, flex lex, "$missing_dir/missing flex")
+AC_PROG_LEX
+AC_DECL_YYTEXT])
# Add --enable-maintainer-mode option to configure.
# From Jim Meyering
@@ -449,12 +904,22 @@ AC_DEFUN(AM_MAINTAINER_MODE,
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
+ AM_CONDITIONAL(MAINTAINER_MODE, test $USE_MAINTAINER_MODE = yes)
+ MAINT=$MAINTAINER_MODE_TRUE
AC_SUBST(MAINT)dnl
]
)
+# Define a conditional.
+
+AC_DEFUN(AM_CONDITIONAL,
+[AC_SUBST($1_TRUE)
+AC_SUBST($1_FALSE)
+if $2; then
+ $1_TRUE=
+ $1_FALSE='#'
+else
+ $1_TRUE='#'
+ $1_FALSE=
+fi])
+
diff --git a/contrib/binutils/ld/config.in b/contrib/binutils/ld/config.in
index a9de5b8..5e17bdc 100644
--- a/contrib/binutils/ld/config.in
+++ b/contrib/binutils/ld/config.in
@@ -1,38 +1,114 @@
/* config.in. Generated automatically from configure.in by autoheader. */
-/* Name of package. */
-#undef PACKAGE
+/* Define if using alloca.c. */
+#undef C_ALLOCA
-/* Version of package. */
-#undef VERSION
+/* Define to empty if the keyword does not work. */
+#undef const
-/* Whether strstr must be declared even if <string.h> is included. */
-#undef NEED_DECLARATION_STRSTR
+/* Define to one of _getb67, GETB67, getb67 for Cray-2 and Cray-YMP systems.
+ This function is required for alloca.c support on those systems. */
+#undef CRAY_STACKSEG_END
-/* Whether free must be declared even if <stdlib.h> is included. */
-#undef NEED_DECLARATION_FREE
+/* Define if you have alloca, as a function or macro. */
+#undef HAVE_ALLOCA
-/* Whether sbrk must be declared even if <unistd.h> is included. */
-#undef NEED_DECLARATION_SBRK
+/* Define if you have <alloca.h> and it should be used (not on Ultrix). */
+#undef HAVE_ALLOCA_H
-/* Whether getenv must be declared even if <stdlib.h> is included. */
-#undef NEED_DECLARATION_GETENV
+/* Define if you have a working `mmap' system call. */
+#undef HAVE_MMAP
+
+/* Define as __inline if that's what the C compiler calls it. */
+#undef inline
+
+/* Define to `long' if <sys/types.h> doesn't define. */
+#undef off_t
+
+/* Define if you need to in order for stat and other things to work. */
+#undef _POSIX_SOURCE
+
+/* Define to `unsigned' if <sys/types.h> doesn't define. */
+#undef size_t
+
+/* If using the C implementation of alloca, define if you know the
+ direction of stack growth for your system; otherwise it will be
+ automatically deduced at run-time.
+ STACK_DIRECTION > 0 => grows toward higher addresses
+ STACK_DIRECTION < 0 => grows toward lower addresses
+ STACK_DIRECTION = 0 => direction of growth unknown
+ */
+#undef STACK_DIRECTION
+
+/* Define if you have the ANSI C header files. */
+#undef STDC_HEADERS
/* 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 __argz_count function. */
+#undef HAVE___ARGZ_COUNT
+
+/* Define if you have the __argz_next function. */
+#undef HAVE___ARGZ_NEXT
+
+/* Define if you have the __argz_stringify function. */
+#undef HAVE___ARGZ_STRINGIFY
+
+/* Define if you have the dcgettext function. */
+#undef HAVE_DCGETTEXT
+
+/* Define if you have the getcwd function. */
+#undef HAVE_GETCWD
+
+/* Define if you have the getpagesize function. */
+#undef HAVE_GETPAGESIZE
+
+/* Define if you have the munmap function. */
+#undef HAVE_MUNMAP
+
+/* Define if you have the putenv function. */
+#undef HAVE_PUTENV
/* Define if you have the sbrk function. */
#undef HAVE_SBRK
+/* Define if you have the setenv function. */
+#undef HAVE_SETENV
+
+/* Define if you have the setlocale function. */
+#undef HAVE_SETLOCALE
+
+/* Define if you have the stpcpy function. */
+#undef HAVE_STPCPY
+
+/* Define if you have the strcasecmp function. */
+#undef HAVE_STRCASECMP
+
+/* Define if you have the strchr function. */
+#undef HAVE_STRCHR
+
+/* Define if you have the <argz.h> header file. */
+#undef HAVE_ARGZ_H
+
/* Define if you have the <dirent.h> header file. */
#undef HAVE_DIRENT_H
+/* Define if you have the <limits.h> header file. */
+#undef HAVE_LIMITS_H
+
+/* Define if you have the <locale.h> header file. */
+#undef HAVE_LOCALE_H
+
+/* Define if you have the <malloc.h> header file. */
+#undef HAVE_MALLOC_H
+
/* Define if you have the <ndir.h> header file. */
#undef HAVE_NDIR_H
+/* Define if you have the <nl_types.h> header file. */
+#undef HAVE_NL_TYPES_H
+
/* Define if you have the <stdlib.h> header file. */
#undef HAVE_STDLIB_H
@@ -48,5 +124,51 @@
/* Define if you have the <sys/ndir.h> header file. */
#undef HAVE_SYS_NDIR_H
+/* Define if you have the <sys/param.h> header file. */
+#undef HAVE_SYS_PARAM_H
+
/* Define if you have the <unistd.h> header file. */
#undef HAVE_UNISTD_H
+
+/* Define if you have the <values.h> header file. */
+#undef HAVE_VALUES_H
+
+/* Name of package */
+#undef PACKAGE
+
+/* Version number of package */
+#undef VERSION
+
+/* Define if you have the stpcpy function */
+#undef HAVE_STPCPY
+
+/* Define if your locale.h file contains LC_MESSAGES. */
+#undef HAVE_LC_MESSAGES
+
+/* Define to 1 if NLS is requested */
+#undef ENABLE_NLS
+
+/* Define as 1 if you have gettext and don't want to use GNU gettext. */
+#undef HAVE_GETTEXT
+
+/* Use b modifier when opening binary files? */
+#undef USE_BINARY_FOPEN
+
+/* Define if strstr is not declared in system header files. */
+#undef NEED_DECLARATION_STRSTR
+
+/* Define if free is not declared in system header files. */
+#undef NEED_DECLARATION_FREE
+
+/* Define if sbrk is not declared in system header files. */
+#undef NEED_DECLARATION_SBRK
+
+/* Define if getenv is not declared in system header files. */
+#undef NEED_DECLARATION_GETENV
+
+/* Define if environ is not declared in system header files. */
+#undef NEED_DECLARATION_ENVIRON
+
+/* Additional extension a shared object might have. */
+#undef EXTRA_SHLIB_EXTENSION
+
diff --git a/contrib/binutils/ld/configure b/contrib/binutils/ld/configure
index d15e3d2..707add1 100755
--- a/contrib/binutils/ld/configure
+++ b/contrib/binutils/ld/configure
@@ -1,7 +1,7 @@
#! /bin/sh
# Guess values for system-dependent variables and create Makefiles.
-# Generated automatically using autoconf version 2.12.1
+# Generated automatically using autoconf version 2.13.1
# Copyright (C) 1992, 93, 94, 95, 96 Free Software Foundation, Inc.
#
# This configure script is free software; the Free Software Foundation
@@ -12,20 +12,24 @@ 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"
+ --enable-shared[=PKGS] build shared libraries [default=yes]"
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"
+ --enable-static[=PKGS] build static libraries [default=yes]"
+ac_help="$ac_help
+ --enable-fast-install[=PKGS] optimize for fast installation [default=yes]"
ac_help="$ac_help
--with-gnu-ld assume the C compiler uses GNU ld [default=no]"
ac_help="$ac_help
+ --disable-libtool-lock avoid locking (might break parallel builds)"
+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
+ --disable-nls do not use Native Language Support"
+ac_help="$ac_help
+ --with-included-gettext use the GNU gettext library included here"
+ac_help="$ac_help
--enable-maintainer-mode enable make rules and dependencies not useful
(and sometimes confusing) to the casual installer"
@@ -350,7 +354,7 @@ EOF
verbose=yes ;;
-version | --version | --versio | --versi | --vers)
- echo "configure generated by autoconf version 2.12.1"
+ echo "configure generated by autoconf version 2.13.1"
exit 0 ;;
-with-* | --with-*)
@@ -510,7 +514,7 @@ done
if test -r "$cache_file"; then
echo "loading cache $cache_file"
- . $cache_file
+ test -f "$cache_file" && . $cache_file
else
echo "creating cache $cache_file"
> $cache_file
@@ -520,9 +524,11 @@ 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'
+ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
cross_compiling=$ac_cv_prog_cc_cross
+ac_exeext=
+ac_objext=o
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
@@ -552,9 +558,130 @@ 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.
+ac_config_guess="$SHELL $ac_aux_dir/config.guess"
+ac_config_sub="$SHELL $ac_aux_dir/config.sub"
+ac_configure="$SHELL $ac_aux_dir/configure" # This should be Cygnus configure.
+
+
+echo $ac_n "checking host system type""... $ac_c" 1>&6
+echo "configure:568: checking host system type" >&5
+if test "x$ac_cv_host" = "x" || (test "x$host" != "xNONE" && test "x$host" != "x$ac_cv_host_alias"); then
+
+# Make sure we can run config.sub.
+ if $ac_config_sub sun4 >/dev/null 2>&1; then :
+ else { echo "configure: error: can not run $ac_config_sub" 1>&2; exit 1; }
+ fi
+
+ ac_cv_host_alias=$host
+ case "$ac_cv_host_alias" in
+ NONE)
+ case $nonopt in
+ NONE)
+ if ac_cv_host_alias=`$ac_config_guess`; then :
+ else { echo "configure: error: can not guess host type; you must specify one" 1>&2; exit 1; }
+ fi ;;
+ *) ac_cv_host_alias=$nonopt ;;
+ esac ;;
+ esac
+
+ ac_cv_host=`$ac_config_sub $ac_cv_host_alias`
+ ac_cv_host_cpu=`echo $ac_cv_host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
+ ac_cv_host_vendor=`echo $ac_cv_host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'`
+ ac_cv_host_os=`echo $ac_cv_host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
+else
+ echo $ac_n "(cached) $ac_c" 1>&6
+fi
+
+echo "$ac_t""$ac_cv_host" 1>&6
+
+host=$ac_cv_host
+host_alias=$ac_cv_host_alias
+host_cpu=$ac_cv_host_cpu
+host_vendor=$ac_cv_host_vendor
+host_os=$ac_cv_host_os
+
+
+
+
+
+echo $ac_n "checking target system type""... $ac_c" 1>&6
+echo "configure:609: checking target system type" >&5
+if test "x$ac_cv_target" = "x" || (test "x$target" != "xNONE" && test "x$target" != "x$ac_cv_target_alias"); then
+
+# Make sure we can run config.sub.
+ if $ac_config_sub sun4 >/dev/null 2>&1; then :
+ else { echo "configure: error: can not run $ac_config_sub" 1>&2; exit 1; }
+ fi
+
+ ac_cv_target_alias=$target
+ case "$ac_cv_target_alias" in
+ NONE)
+ case $nonopt in
+ NONE)
+ ac_cv_target_alias=$host_alias ;;
+
+ *) ac_cv_target_alias=$nonopt ;;
+ esac ;;
+ esac
+
+ ac_cv_target=`$ac_config_sub $ac_cv_target_alias`
+ ac_cv_target_cpu=`echo $ac_cv_target | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
+ ac_cv_target_vendor=`echo $ac_cv_target | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'`
+ ac_cv_target_os=`echo $ac_cv_target | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
+else
+ echo $ac_n "(cached) $ac_c" 1>&6
+fi
+
+echo "$ac_t""$ac_cv_target" 1>&6
+
+target=$ac_cv_target
+target_alias=$ac_cv_target_alias
+target_cpu=$ac_cv_target_cpu
+target_vendor=$ac_cv_target_vendor
+target_os=$ac_cv_target_os
+
+
+
+
+
+echo $ac_n "checking build system type""... $ac_c" 1>&6
+echo "configure:649: checking build system type" >&5
+if test "x$ac_cv_build" = "x" || (test "x$build" != "xNONE" && test "x$build" != "x$ac_cv_build_alias"); then
+
+# Make sure we can run config.sub.
+ if $ac_config_sub sun4 >/dev/null 2>&1; then :
+ else { echo "configure: error: can not run $ac_config_sub" 1>&2; exit 1; }
+ fi
+
+ ac_cv_build_alias=$build
+ case "$ac_cv_build_alias" in
+ NONE)
+ case $nonopt in
+ NONE)
+ ac_cv_build_alias=$host_alias ;;
+
+ *) ac_cv_build_alias=$nonopt ;;
+ esac ;;
+ esac
+
+ ac_cv_build=`$ac_config_sub $ac_cv_build_alias`
+ ac_cv_build_cpu=`echo $ac_cv_build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
+ ac_cv_build_vendor=`echo $ac_cv_build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'`
+ ac_cv_build_os=`echo $ac_cv_build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
+else
+ echo $ac_n "(cached) $ac_c" 1>&6
+fi
+
+echo "$ac_t""$ac_cv_build" 1>&6
+
+build=$ac_cv_build
+build_alias=$ac_cv_build_alias
+build_cpu=$ac_cv_build_cpu
+build_vendor=$ac_cv_build_vendor
+build_os=$ac_cv_build_os
+
+
+
# Do some error checking and defaulting for the host and target type.
@@ -577,69 +704,6 @@ 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, &&
@@ -658,12 +722,12 @@ test "$host_alias" != "$target_alias" &&
# 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
+echo "configure:726: checking for a BSD compatible install" >&5
if test -z "$INSTALL"; then
-if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then
+if eval "test \"\${ac_cv_path_install+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
- IFS="${IFS= }"; ac_save_IFS="$IFS"; IFS="${IFS}:"
+ IFS="${IFS= }"; ac_save_IFS="$IFS"; IFS=":"
for ac_dir in $PATH; do
# Account for people who put trailing slashes in PATH elements.
case "$ac_dir/" in
@@ -678,6 +742,10 @@ else
grep dspmsg $ac_dir/$ac_prog >/dev/null 2>&1; then
# AIX install. It has an incompatible calling convention.
:
+ elif test $ac_prog = install &&
+ grep pwplus $ac_dir/$ac_prog >/dev/null 2>&1; then
+ # program-specific install script used by HP pwplus--don't use.
+ :
else
ac_cv_path_install="$ac_dir/$ac_prog -c"
break 2
@@ -706,13 +774,12 @@ echo "$ac_t""$INSTALL" 1>&6
# 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}'
-test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL_PROGRAM}'
+test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644'
echo $ac_n "checking whether build environment is sane""... $ac_c" 1>&6
-echo "configure:716: checking whether build environment is sane" >&5
+echo "configure:783: checking whether build environment is sane" >&5
# Just in case
sleep 1
echo timestamp > conftestfile
@@ -760,18 +827,18 @@ EOF_SED
rm -f conftestsed
fi
test "$program_prefix" != NONE &&
- program_transform_name="s,^,${program_prefix},; $program_transform_name"
+ 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"
+ 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
+echo "configure:840: 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
+if eval "test \"\${ac_cv_prog_make_${ac_make}_set+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftestmake <<\EOF
@@ -798,7 +865,7 @@ fi
PACKAGE=ld
-VERSION=2.9.1
+VERSION=2.9.5
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; }
@@ -815,7 +882,7 @@ EOF
missing_dir=`cd $ac_aux_dir && pwd`
echo $ac_n "checking for working aclocal""... $ac_c" 1>&6
-echo "configure:819: checking for working aclocal" >&5
+echo "configure:886: 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.
@@ -828,7 +895,7 @@ else
fi
echo $ac_n "checking for working autoconf""... $ac_c" 1>&6
-echo "configure:832: checking for working autoconf" >&5
+echo "configure:899: 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.
@@ -841,7 +908,7 @@ else
fi
echo $ac_n "checking for working automake""... $ac_c" 1>&6
-echo "configure:845: checking for working automake" >&5
+echo "configure:912: 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.
@@ -854,7 +921,7 @@ else
fi
echo $ac_n "checking for working autoheader""... $ac_c" 1>&6
-echo "configure:858: checking for working autoheader" >&5
+echo "configure:925: 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.
@@ -867,7 +934,7 @@ else
fi
echo $ac_n "checking for working makeinfo""... $ac_c" 1>&6
-echo "configure:871: checking for working makeinfo" >&5
+echo "configure:938: 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.
@@ -927,18 +994,42 @@ else
enable_static=yes
fi
+# Check whether --enable-fast-install or --disable-fast-install was given.
+if test "${enable_fast_install+set}" = set; then
+ enableval="$enable_fast_install"
+ p=${PACKAGE-default}
+case "$enableval" in
+yes) enable_fast_install=yes ;;
+no) enable_fast_install=no ;;
+*)
+ enable_fast_install=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_fast_install=yes
+ fi
+ done
+ IFS="$ac_save_ifs"
+ ;;
+esac
+else
+ enable_fast_install=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 "configure:1024: checking for $ac_word" >&5
+if eval "test \"\${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
+ IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":"
+ ac_dummy="$PATH"
+ for ac_dir in $ac_dummy; do
test -z "$ac_dir" && ac_dir=.
if test -f $ac_dir/$ac_word; then
ac_cv_prog_RANLIB="ranlib"
@@ -959,15 +1050,16 @@ 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 "configure:1054: checking for $ac_word" >&5
+if eval "test \"\${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
+ IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":"
+ ac_dummy="$PATH"
+ for ac_dir in $ac_dummy; do
test -z "$ac_dir" && ac_dir=.
if test -f $ac_dir/$ac_word; then
ac_cv_prog_CC="gcc"
@@ -988,16 +1080,17 @@ 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 "configure:1084: checking for $ac_word" >&5
+if eval "test \"\${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}:"
+ IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":"
ac_prog_rejected=no
- for ac_dir in $PATH; do
+ ac_dummy="$PATH"
+ for ac_dir in $ac_dummy; 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
@@ -1032,25 +1125,61 @@ else
echo "$ac_t""no" 1>&6
fi
+ if test -z "$CC"; then
+ case "`uname -s`" in
+ *win32* | *WIN32* | *CYGWIN*)
+ # Extract the first word of "cl", so it can be a program name with args.
+set dummy cl; ac_word=$2
+echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
+echo "configure:1135: checking for $ac_word" >&5
+if eval "test \"\${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=":"
+ ac_dummy="$PATH"
+ for ac_dir in $ac_dummy; do
+ test -z "$ac_dir" && ac_dir=.
+ if test -f $ac_dir/$ac_word; then
+ ac_cv_prog_CC="cl"
+ 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
+ ;;
+ esac
+ 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
+echo $ac_n "checking whether the C compiler ($CC $CFLAGS $CPPFLAGS $LDFLAGS) works""... $ac_c" 1>&6
+echo "configure:1167: checking whether the C compiler ($CC $CFLAGS $CPPFLAGS $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'
+ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
cross_compiling=$ac_cv_prog_cc_cross
-cat > conftest.$ac_ext <<EOF
-#line 1050 "configure"
+cat > conftest.$ac_ext << EOF
+
+#line 1178 "configure"
#include "confdefs.h"
+
main(){return(0);}
EOF
-if { (eval echo configure:1054: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:1183: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; 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
@@ -1064,19 +1193,25 @@ else
ac_cv_prog_cc_works=no
fi
rm -fr conftest*
+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${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
+cross_compiling=$ac_cv_prog_cc_cross
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_n "checking whether the C compiler ($CC $CFLAGS $CPPFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6
+echo "configure:1209: checking whether the C compiler ($CC $CFLAGS $CPPFLAGS $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 "configure:1214: checking whether we are using GNU C" >&5
+if eval "test \"\${ac_cv_prog_gcc+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.c <<EOF
@@ -1084,7 +1219,7 @@ else
yes;
#endif
EOF
-if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:1088: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then
+if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:1223: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then
ac_cv_prog_gcc=yes
else
ac_cv_prog_gcc=no
@@ -1095,12 +1230,16 @@ 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
+else
+ GCC=
+fi
+
+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:1242: checking whether ${CC-cc} accepts -g" >&5
+if eval "test \"\${ac_cv_prog_cc_g+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
echo 'void f(){}' > conftest.c
@@ -1114,16 +1253,20 @@ 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
+if test "$ac_test_CFLAGS" = set; then
+ CFLAGS="$ac_save_CFLAGS"
+elif test $ac_cv_prog_cc_g = yes; then
+ if test "$GCC" = yes; then
CFLAGS="-g -O2"
else
- CFLAGS="-O2"
+ CFLAGS="-g"
fi
else
- GCC=
- test "${CFLAGS+set}" = set || CFLAGS="-g"
+ if test "$GCC" = yes; then
+ CFLAGS="-O2"
+ else
+ CFLAGS=
+ fi
fi
# Check whether --with-gnu-ld or --without-gnu-ld was given.
@@ -1134,18 +1277,23 @@ 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
+echo "configure:1285: 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"
- ;;
+ # Accept absolute paths.
+ [\\/]* | [A-Za-z]:[\\/]*)
+ re_direlt='/[^/][^/]*/\.\./'
+ # Canonicalize the path of ld
+ ac_prog=`echo $ac_prog| sed 's%\\\\%/%g'`
+ while echo $ac_prog | grep "$re_direlt" > /dev/null 2>&1; do
+ ac_prog=`echo $ac_prog| sed "s%$re_direlt%/%"`
+ done
+ test -z "$LD" && LD="$ac_prog"
+ ;;
"")
# If it fails, then pretend we aren't using GCC.
ac_prog=ld
@@ -1157,19 +1305,19 @@ echo "configure:1143: checking for ld used by GCC" >&5
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
+echo "configure:1309: 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
+echo "configure:1312: checking for non-GNU ld" >&5
fi
-if eval "test \"`echo '$''{'ac_cv_path_LD'+set}'`\" = set"; then
+if eval "test \"\${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}:"
+ IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR-:}"
for ac_dir in $PATH; do
test -z "$ac_dir" && ac_dir=.
- if test -f "$ac_dir/$ac_prog"; then
+ if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; 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.
@@ -1177,7 +1325,7 @@ else
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
+ test "$with_gnu_ld" != yes && break
fi
fi
done
@@ -1194,10 +1342,9 @@ 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 "configure:1347: checking if the linker ($LD) is GNU ld" >&5
+if eval "test \"\${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.
@@ -1212,45 +1359,44 @@ 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 "configure:1363: checking for BSD-compatible nm" >&5
+if eval "test \"\${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
+ if test -n "$NM"; then
+ # Let the user override the test.
+ ac_cv_path_NM="$NM"
+else
+ IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR-:}"
+ for ac_dir in $PATH /usr/ccs/bin /usr/ucb /bin; do
test -z "$ac_dir" && ac_dir=.
- if test -f $ac_dir/nm; then
+ if test -f $ac_dir/nm || test -f $ac_dir/nm$ac_exeext ; 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"
+ ac_cv_path_NM="$ac_dir/nm -B"
+ break
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"
+ ac_cv_path_NM="$ac_dir/nm -p"
+ break
else
- ac_cv_path_NM="$ac_dir/nm"
+ ac_cv_path_NM=${ac_cv_path_NM="$ac_dir/nm"} # keep the first match, but
+ continue # so that we can try to find one that supports BSD flags
fi
- break
fi
done
IFS="$ac_save_ifs"
test -z "$ac_cv_path_NM" && ac_cv_path_NM=nm
- ;;
-esac
+fi
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 "configure:1399: checking whether ln -s works" >&5
+if eval "test \"\${ac_cv_prog_LN_S+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
rm -f conftestdata
@@ -1269,24 +1415,37 @@ else
echo "$ac_t""no" 1>&6
fi
-# Always use our own libtool.
-LIBTOOL='$(SHELL) $(top_builddir)/libtool'
+
+case "$target" in
+NONE) lt_target="$host" ;;
+*) lt_target="$target" ;;
+esac
# Check for any special flags to pass to ltconfig.
-libtool_flags=
+libtool_flags="--cache-file=$cache_file"
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 "$enable_fast_install" = no && libtool_flags="$libtool_flags --disable-fast-install"
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"
+
+# Check whether --enable-libtool-lock or --disable-libtool-lock was given.
+if test "${enable_libtool_lock+set}" = set; then
+ enableval="$enable_libtool_lock"
+ :
+fi
+
+test "x$enable_libtool_lock" = xno && libtool_flags="$libtool_flags --disable-lock"
+test x"$silent" = xyes && libtool_flags="$libtool_flags --silent"
+
# Some flags need to be propagated to the compiler or linker for good
# libtool support.
-case "$host" in
+case "$lt_target" 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
+ echo '#line 1448 "configure"' > conftest.$ac_ext
+ if { (eval echo configure:1449: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
case "`/usr/bin/file conftest.o`" in
*32-bit*)
LD="${LD-ld} -32"
@@ -1304,17 +1463,122 @@ case "$host" in
*-*-sco3.2v5*)
# On SCO OpenServer 5, we need -belf to get full-featured binaries.
+ SAVE_CFLAGS="$CFLAGS"
CFLAGS="$CFLAGS -belf"
+ echo $ac_n "checking whether the C compiler needs -belf""... $ac_c" 1>&6
+echo "configure:1470: checking whether the C compiler needs -belf" >&5
+if eval "test \"\${lt_cv_cc_needs_belf+set}\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ cat > conftest.$ac_ext <<EOF
+#line 1475 "configure"
+#include "confdefs.h"
+
+int main() {
+
+; return 0; }
+EOF
+if { (eval echo configure:1482: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+ rm -rf conftest*
+ lt_cv_cc_needs_belf=yes
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ lt_cv_cc_needs_belf=no
+fi
+rm -f conftest*
+fi
+
+echo "$ac_t""$lt_cv_cc_needs_belf" 1>&6
+ if test x"$lt_cv_cc_needs_belf" != x"yes"; then
+ # this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf
+ CFLAGS="$SAVE_CFLAGS"
+ fi
;;
+
+
esac
+
+# Save cache, so that ltconfig can load it
+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 | grep ac_space) 2>&1` 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
+
+
# 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 \
+LD="$LD" LDFLAGS="$LDFLAGS" LIBS="$LIBS" \
+LN_S="$LN_S" NM="$NM" RANLIB="$RANLIB" \
+DLLTOOL="$DLLTOOL" AS="$AS" OBJDUMP="$OBJDUMP" \
+${CONFIG_SHELL-/bin/sh} $ac_aux_dir/ltconfig --no-reexec \
+$libtool_flags --no-verify $ac_aux_dir/ltmain.sh $lt_target \
|| { echo "configure: error: libtool configure failed" 1>&2; exit 1; }
+# Reload cache, that may have been modified by ltconfig
+if test -r "$cache_file"; then
+ echo "loading cache $cache_file"
+ test -f "$cache_file" && . $cache_file
+else
+ echo "creating cache $cache_file"
+ > $cache_file
+fi
+
+
+# This can be used to rebuild libtool when needed
+LIBTOOL_DEPS="$ac_aux_dir/ltconfig $ac_aux_dir/ltmain.sh"
+
+# Always use our own libtool.
+LIBTOOL='$(SHELL) $(top_builddir)/libtool'
+
+# Redirect the config.log output again, so that the ltconfig log is not
+# clobbered by the next message.
+exec 5>>./config.log
+
# Check whether --enable-targets or --disable-targets was given.
if test "${enable_targets+set}" = set; then
@@ -1354,15 +1618,16 @@ 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:1358: checking for $ac_word" >&5
-if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
+echo "configure:1622: checking for $ac_word" >&5
+if eval "test \"\${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
+ IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":"
+ ac_dummy="$PATH"
+ for ac_dir in $ac_dummy; do
test -z "$ac_dir" && ac_dir=.
if test -f $ac_dir/$ac_word; then
ac_cv_prog_CC="gcc"
@@ -1383,16 +1648,17 @@ 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 "configure:1652: checking for $ac_word" >&5
+if eval "test \"\${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}:"
+ IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":"
ac_prog_rejected=no
- for ac_dir in $PATH; do
+ ac_dummy="$PATH"
+ for ac_dir in $ac_dummy; 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
@@ -1427,25 +1693,61 @@ else
echo "$ac_t""no" 1>&6
fi
+ if test -z "$CC"; then
+ case "`uname -s`" in
+ *win32* | *WIN32* | *CYGWIN*)
+ # Extract the first word of "cl", so it can be a program name with args.
+set dummy cl; ac_word=$2
+echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
+echo "configure:1703: checking for $ac_word" >&5
+if eval "test \"\${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=":"
+ ac_dummy="$PATH"
+ for ac_dir in $ac_dummy; do
+ test -z "$ac_dir" && ac_dir=.
+ if test -f $ac_dir/$ac_word; then
+ ac_cv_prog_CC="cl"
+ 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
+ ;;
+ esac
+ 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
+echo $ac_n "checking whether the C compiler ($CC $CFLAGS $CPPFLAGS $LDFLAGS) works""... $ac_c" 1>&6
+echo "configure:1735: checking whether the C compiler ($CC $CFLAGS $CPPFLAGS $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'
+ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
cross_compiling=$ac_cv_prog_cc_cross
-cat > conftest.$ac_ext <<EOF
-#line 1445 "configure"
+cat > conftest.$ac_ext << EOF
+
+#line 1746 "configure"
#include "confdefs.h"
+
main(){return(0);}
EOF
-if { (eval echo configure:1449: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:1751: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; 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
@@ -1459,19 +1761,25 @@ else
ac_cv_prog_cc_works=no
fi
rm -fr conftest*
+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${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
+cross_compiling=$ac_cv_prog_cc_cross
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_n "checking whether the C compiler ($CC $CFLAGS $CPPFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6
+echo "configure:1777: checking whether the C compiler ($CC $CFLAGS $CPPFLAGS $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 "configure:1782: checking whether we are using GNU C" >&5
+if eval "test \"\${ac_cv_prog_gcc+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.c <<EOF
@@ -1479,7 +1787,7 @@ else
yes;
#endif
EOF
-if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:1483: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then
+if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:1791: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then
ac_cv_prog_gcc=yes
else
ac_cv_prog_gcc=no
@@ -1490,12 +1798,16 @@ 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
+else
+ GCC=
+fi
+
+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:1810: checking whether ${CC-cc} accepts -g" >&5
+if eval "test \"\${ac_cv_prog_cc_g+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
echo 'void f(){}' > conftest.c
@@ -1509,104 +1821,1932 @@ 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
+if test "$ac_test_CFLAGS" = set; then
+ CFLAGS="$ac_save_CFLAGS"
+elif test $ac_cv_prog_cc_g = yes; then
+ if test "$GCC" = yes; then
CFLAGS="-g -O2"
else
+ CFLAGS="-g"
+ fi
+else
+ if test "$GCC" = yes; then
CFLAGS="-O2"
+ else
+ CFLAGS=
fi
+fi
+
+# 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:1853: checking for a BSD compatible install" >&5
+if test -z "$INSTALL"; then
+if eval "test \"\${ac_cv_path_install+set}\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
else
- GCC=
- test "${CFLAGS+set}" = set || CFLAGS="-g"
+ IFS="${IFS= }"; ac_save_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.
+ :
+ elif test $ac_prog = install &&
+ grep pwplus $ac_dir/$ac_prog >/dev/null 2>&1; then
+ # program-specific install script used by HP pwplus--don't use.
+ :
+ 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_SCRIPT" && INSTALL_SCRIPT='${INSTALL}'
+
+test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644'
+
+
+ALL_LINGUAS=
+echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6
+echo "configure:1912: 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 \"\${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 <<EOF
+#line 1927 "configure"
+#include "confdefs.h"
+#include <assert.h>
+Syntax Error
+EOF
+ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+{ (eval echo configure:1933: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
+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 <<EOF
+#line 1944 "configure"
+#include "confdefs.h"
+#include <assert.h>
+Syntax Error
+EOF
+ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+{ (eval echo configure:1950: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
+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} -nologo -E"
+ cat > conftest.$ac_ext <<EOF
+#line 1961 "configure"
+#include "confdefs.h"
+#include <assert.h>
+Syntax Error
+EOF
+ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+{ (eval echo configure:1967: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
+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*
+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 for POSIXized ISC""... $ac_c" 1>&6
+echo "configure:1992: checking for POSIXized ISC" >&5
+if test -d /etc/conf/kconfig.d &&
+ grep _POSIX_VERSION /usr/include/sys/unistd.h >/dev/null 2>&1
+then
+ echo "$ac_t""yes" 1>&6
+ ISC=yes # If later tests want to check for ISC.
+ cat >> confdefs.h <<\EOF
+#define _POSIX_SOURCE 1
+EOF
+
+ if test "$GCC" = yes; then
+ CC="$CC -posix"
+ else
+ CC="$CC -Xp"
+ fi
+else
+ echo "$ac_t""no" 1>&6
+ ISC=
+fi
+
+echo $ac_n "checking for ANSI C header files""... $ac_c" 1>&6
+echo "configure:2013: checking for ANSI C header files" >&5
+if eval "test \"\${ac_cv_header_stdc+set}\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ cat > conftest.$ac_ext <<EOF
+#line 2018 "configure"
+#include "confdefs.h"
+#include <stdlib.h>
+#include <stdarg.h>
+#include <string.h>
+#include <float.h>
+EOF
+ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+{ (eval echo configure:2026: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
+if test -z "$ac_err"; then
+ rm -rf conftest*
+ ac_cv_header_stdc=yes
+else
+ echo "$ac_err" >&5
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ ac_cv_header_stdc=no
+fi
+rm -f conftest*
+
+if test $ac_cv_header_stdc = yes; then
+ # SunOS 4.x string.h does not declare mem*, contrary to ANSI.
+cat > conftest.$ac_ext <<EOF
+#line 2043 "configure"
+#include "confdefs.h"
+#include <string.h>
+EOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+ egrep "memchr" >/dev/null 2>&1; then
+ :
+else
+ rm -rf conftest*
+ ac_cv_header_stdc=no
+fi
+rm -f conftest*
+
+fi
+
+if test $ac_cv_header_stdc = yes; then
+ # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI.
+cat > conftest.$ac_ext <<EOF
+#line 2061 "configure"
+#include "confdefs.h"
+#include <stdlib.h>
+EOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+ egrep "free" >/dev/null 2>&1; then
+ :
+else
+ rm -rf conftest*
+ ac_cv_header_stdc=no
+fi
+rm -f conftest*
+
+fi
+
+if test $ac_cv_header_stdc = yes; then
+ # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi.
+if test "$cross_compiling" = yes; then
+ :
+else
+ cat > conftest.$ac_ext <<EOF
+#line 2082 "configure"
+#include "confdefs.h"
+#include <ctype.h>
+#define ISLOWER(c) ('a' <= (c) && (c) <= 'z')
+#define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c))
+#define XOR(e, f) (((e) && !(f)) || (!(e) && (f)))
+int main () { int i; for (i = 0; i < 256; i++)
+if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) exit(2);
+exit (0); }
+
+EOF
+if { (eval echo configure:2093: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+then
+ :
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -fr conftest*
+ ac_cv_header_stdc=no
+fi
+rm -fr conftest*
fi
+fi
+fi
-test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL_PROGRAM}'
+echo "$ac_t""$ac_cv_header_stdc" 1>&6
+if test $ac_cv_header_stdc = yes; then
+ cat >> confdefs.h <<\EOF
+#define STDC_HEADERS 1
+EOF
-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
+fi
+
+echo $ac_n "checking for working const""... $ac_c" 1>&6
+echo "configure:2117: checking for working const" >&5
+if eval "test \"\${ac_cv_c_const+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 1534 "configure"
+#line 2122 "configure"
#include "confdefs.h"
int main() {
-return __CYGWIN32__;
+
+/* Ultrix mips cc rejects this. */
+typedef int charset[2]; const charset x;
+/* SunOS 4.1.1 cc rejects this. */
+char const *const *ccp;
+char **p;
+/* NEC SVR4.0.2 mips cc rejects this. */
+struct point {int x, y;};
+static struct point const zero = {0,0};
+/* AIX XL C 1.02.0.0 rejects this.
+ It does not let you subtract one const X* pointer from another in an arm
+ of an if-expression whose if-part is not a constant expression */
+const char *g = "string";
+ccp = &g + (g ? g-g : 0);
+/* HPUX 7.0 cc rejects these. */
+++ccp;
+p = (char**) ccp;
+ccp = (char const *const *) p;
+{ /* SCO 3.2v4 cc rejects this. */
+ char *t;
+ char const *s = 0 ? (char *) 0 : (char const *) 0;
+
+ *t++ = 0;
+}
+{ /* Someone thinks the Sun supposedly-ANSI compiler will reject this. */
+ int x[] = {25, 17};
+ const int *foo = &x[0];
+ ++foo;
+}
+{ /* Sun SC1.0 ANSI compiler rejects this -- but not the above. */
+ typedef const int *iptr;
+ iptr p = 0;
+ ++p;
+}
+{ /* AIX XL C 1.02.0.0 rejects this saying
+ "k.c", line 2.27: 1506-025 (S) Operand must be a modifiable lvalue. */
+ struct s { int j; const int *ap[3]; };
+ struct s *b; b->j = 5;
+}
+{ /* ULTRIX-32 V3.1 (Rev 9) vcc rejects this */
+ const int foo = 10;
+}
+
; return 0; }
EOF
-if { (eval echo configure:1541: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:2171: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
- am_cv_cygwin32=yes
+ ac_cv_c_const=yes
else
echo "configure: failed program was:" >&5
cat conftest.$ac_ext >&5
rm -rf conftest*
- am_cv_cygwin32=no
+ ac_cv_c_const=no
fi
rm -f conftest*
+fi
+
+echo "$ac_t""$ac_cv_c_const" 1>&6
+if test $ac_cv_c_const = no; then
+ cat >> confdefs.h <<\EOF
+#define const
+EOF
+
+fi
+
+echo $ac_n "checking for inline""... $ac_c" 1>&6
+echo "configure:2192: checking for inline" >&5
+if eval "test \"\${ac_cv_c_inline+set}\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ ac_cv_c_inline=no
+for ac_kw in inline __inline__ __inline; do
+ cat > conftest.$ac_ext <<EOF
+#line 2199 "configure"
+#include "confdefs.h"
+
+int main() {
+} $ac_kw int foo() {
+; return 0; }
+EOF
+if { (eval echo configure:2206: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+ rm -rf conftest*
+ ac_cv_c_inline=$ac_kw; break
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+fi
rm -f conftest*
+done
+
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_t""$ac_cv_c_inline" 1>&6
+case "$ac_cv_c_inline" in
+ inline | yes) ;;
+ no) cat >> confdefs.h <<\EOF
+#define inline
+EOF
+ ;;
+ *) cat >> confdefs.h <<EOF
+#define inline $ac_cv_c_inline
+EOF
+ ;;
+esac
+
+echo $ac_n "checking for off_t""... $ac_c" 1>&6
+echo "configure:2232: checking for off_t" >&5
+if eval "test \"\${ac_cv_type_off_t+set}\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ cat > conftest.$ac_ext <<EOF
+#line 2237 "configure"
+#include "confdefs.h"
+#include <sys/types.h>
+#if STDC_HEADERS
+#include <stdlib.h>
+#include <stddef.h>
+#endif
+EOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+ egrep "(^|[^a-zA-Z_0-9])off_t[^a-zA-Z_0-9]" >/dev/null 2>&1; then
+ rm -rf conftest*
+ eval "ac_cv_type_off_t=yes"
+else
+ rm -rf conftest*
+ eval "ac_cv_type_off_t=no"
+fi
+rm -f conftest*
+
+fi
+if eval "test \"`echo '$ac_cv_type_'off_t`\" = yes"; then
+ echo "$ac_t""yes" 1>&6
+else
+ echo "$ac_t""no" 1>&6
+ cat >> confdefs.h <<EOF
+#define off_t long
+EOF
+
+fi
+
+echo $ac_n "checking for size_t""... $ac_c" 1>&6
+echo "configure:2267: checking for size_t" >&5
+if eval "test \"\${ac_cv_type_size_t+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 1563 "configure"
+#line 2272 "configure"
#include "confdefs.h"
+#include <sys/types.h>
+#if STDC_HEADERS
+#include <stdlib.h>
+#include <stddef.h>
+#endif
+EOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+ egrep "(^|[^a-zA-Z_0-9])size_t[^a-zA-Z_0-9]" >/dev/null 2>&1; then
+ rm -rf conftest*
+ eval "ac_cv_type_size_t=yes"
+else
+ rm -rf conftest*
+ eval "ac_cv_type_size_t=no"
+fi
+rm -f conftest*
+
+fi
+if eval "test \"`echo '$ac_cv_type_'size_t`\" = yes"; then
+ echo "$ac_t""yes" 1>&6
+else
+ echo "$ac_t""no" 1>&6
+ cat >> confdefs.h <<EOF
+#define size_t unsigned
+EOF
+
+fi
+# The Ultrix 4.2 mips builtin alloca declared by alloca.h only works
+# for constant arguments. Useless!
+echo $ac_n "checking for working alloca.h""... $ac_c" 1>&6
+echo "configure:2304: checking for working alloca.h" >&5
+if eval "test \"\${ac_cv_header_alloca_h+set}\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ cat > conftest.$ac_ext <<EOF
+#line 2309 "configure"
+#include "confdefs.h"
+#include <alloca.h>
int main() {
-return __MINGW32__;
+char *p = alloca(2 * sizeof(int));
; return 0; }
EOF
-if { (eval echo configure:1570: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:2316: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
- am_cv_mingw32=yes
+ ac_cv_header_alloca_h=yes
else
echo "configure: failed program was:" >&5
cat conftest.$ac_ext >&5
rm -rf conftest*
- am_cv_mingw32=no
+ ac_cv_header_alloca_h=no
fi
rm -f conftest*
+fi
+
+echo "$ac_t""$ac_cv_header_alloca_h" 1>&6
+if test $ac_cv_header_alloca_h = yes; then
+ cat >> confdefs.h <<\EOF
+#define HAVE_ALLOCA_H 1
+EOF
+
+fi
+
+echo $ac_n "checking for alloca""... $ac_c" 1>&6
+echo "configure:2337: checking for alloca" >&5
+if eval "test \"\${ac_cv_func_alloca_works+set}\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ cat > conftest.$ac_ext <<EOF
+#line 2342 "configure"
+#include "confdefs.h"
+
+#ifdef __GNUC__
+# define alloca __builtin_alloca
+#else
+# ifdef _MSC_VER
+# include <malloc.h>
+# define alloca _alloca
+# else
+# if HAVE_ALLOCA_H
+# include <alloca.h>
+# else
+# ifdef _AIX
+ #pragma alloca
+# else
+# ifndef alloca /* predefined by HP cc +Olibcalls */
+char *alloca ();
+# endif
+# endif
+# endif
+# endif
+#endif
+
+int main() {
+char *p = (char *) alloca(1);
+; return 0; }
+EOF
+if { (eval echo configure:2370: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+ rm -rf conftest*
+ ac_cv_func_alloca_works=yes
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ ac_cv_func_alloca_works=no
+fi
rm -f conftest*
fi
-echo "$ac_t""$am_cv_mingw32" 1>&6
-MINGW32=
-test "$am_cv_mingw32" = yes && MINGW32=yes
+echo "$ac_t""$ac_cv_func_alloca_works" 1>&6
+if test $ac_cv_func_alloca_works = yes; then
+ cat >> confdefs.h <<\EOF
+#define HAVE_ALLOCA 1
+EOF
+fi
-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
+if test $ac_cv_func_alloca_works = no; then
+ # The SVR3 libPW and SVR4 libucb both contain incompatible functions
+ # that cause trouble. Some versions do not even contain alloca or
+ # contain a buggy version. If you still want to use their alloca,
+ # use ar to extract alloca.o from them instead of compiling alloca.c.
+ ALLOCA=alloca.${ac_objext}
+ cat >> confdefs.h <<\EOF
+#define C_ALLOCA 1
+EOF
+
+
+echo $ac_n "checking whether alloca needs Cray hooks""... $ac_c" 1>&6
+echo "configure:2402: checking whether alloca needs Cray hooks" >&5
+if eval "test \"\${ac_cv_os_cray+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
- if test "$CYGWIN32" = yes || test "$MINGW32" = yes; then
-am_cv_exeext=.exe
+ cat > conftest.$ac_ext <<EOF
+#line 2407 "configure"
+#include "confdefs.h"
+#if defined(CRAY) && ! defined(CRAY2)
+webecray
+#else
+wenotbecray
+#endif
+
+EOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+ egrep "webecray" >/dev/null 2>&1; then
+ rm -rf conftest*
+ ac_cv_os_cray=yes
+else
+ rm -rf conftest*
+ ac_cv_os_cray=no
+fi
+rm -f conftest*
+
+fi
+
+echo "$ac_t""$ac_cv_os_cray" 1>&6
+if test $ac_cv_os_cray = yes; then
+for ac_func in _getb67 GETB67 getb67; do
+ echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
+echo "configure:2432: checking for $ac_func" >&5
+if eval "test \"\${ac_cv_func_$ac_func+set}\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
else
-cat > am_c_test.c << 'EOF'
+ cat > conftest.$ac_ext <<EOF
+#line 2437 "configure"
+#include "confdefs.h"
+/* System header to define __stub macros and hopefully few prototypes,
+ which can conflict with char $ac_func(); below. */
+#include <assert.h>
+/* 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();
+char (*f)();
+
int main() {
-/* Nothing needed here */
+
+/* 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
+f = $ac_func;
+#endif
+
+; return 0; }
+EOF
+if { (eval echo configure:2461: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; 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
+ cat >> confdefs.h <<EOF
+#define CRAY_STACKSEG_END $ac_func
+EOF
+
+ break
+else
+ echo "$ac_t""no" 1>&6
+fi
+
+done
+fi
+
+echo $ac_n "checking stack direction for C alloca""... $ac_c" 1>&6
+echo "configure:2488: checking stack direction for C alloca" >&5
+if eval "test \"\${ac_cv_c_stack_direction+set}\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ if test "$cross_compiling" = yes; then
+ ac_cv_c_stack_direction=0
+else
+ cat > conftest.$ac_ext <<EOF
+#line 2496 "configure"
+#include "confdefs.h"
+find_stack_direction ()
+{
+ static char *addr = 0;
+ auto char dummy;
+ if (addr == 0)
+ {
+ addr = &dummy;
+ return find_stack_direction ();
+ }
+ else
+ return (&dummy > addr) ? 1 : -1;
+}
+main ()
+{
+ exit (find_stack_direction() < 0);
+}
+EOF
+if { (eval echo configure:2515: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+then
+ ac_cv_c_stack_direction=1
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -fr conftest*
+ ac_cv_c_stack_direction=-1
+fi
+rm -fr conftest*
+fi
+
+fi
+
+echo "$ac_t""$ac_cv_c_stack_direction" 1>&6
+cat >> confdefs.h <<EOF
+#define STACK_DIRECTION $ac_cv_c_stack_direction
+EOF
+
+fi
+
+for ac_hdr in unistd.h
+do
+ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
+echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
+echo "configure:2540: checking for $ac_hdr" >&5
+if eval "test \"\${ac_cv_header_$ac_safe+set}\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ cat > conftest.$ac_ext <<EOF
+#line 2545 "configure"
+#include "confdefs.h"
+#include <$ac_hdr>
+EOF
+ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+{ (eval echo configure:2550: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
+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 <<EOF
+#define $ac_tr_hdr 1
+EOF
+
+else
+ echo "$ac_t""no" 1>&6
+fi
+done
+
+for ac_func in getpagesize
+do
+echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
+echo "configure:2579: checking for $ac_func" >&5
+if eval "test \"\${ac_cv_func_$ac_func+set}\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ cat > conftest.$ac_ext <<EOF
+#line 2584 "configure"
+#include "confdefs.h"
+/* System header to define __stub macros and hopefully few prototypes,
+ which can conflict with char $ac_func(); below. */
+#include <assert.h>
+/* 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();
+char (*f)();
+
+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
+f = $ac_func;
+#endif
+
+; return 0; }
+EOF
+if { (eval echo configure:2608: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; 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 <<EOF
+#define $ac_tr_func 1
+EOF
+
+else
+ echo "$ac_t""no" 1>&6
+fi
+done
+
+echo $ac_n "checking for working mmap""... $ac_c" 1>&6
+echo "configure:2633: checking for working mmap" >&5
+if eval "test \"\${ac_cv_func_mmap_fixed_mapped+set}\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ if test "$cross_compiling" = yes; then
+ ac_cv_func_mmap_fixed_mapped=no
+else
+ cat > conftest.$ac_ext <<EOF
+#line 2641 "configure"
+#include "confdefs.h"
+
+/* Thanks to Mike Haertel and Jim Avera for this test.
+ Here is a matrix of mmap possibilities:
+ mmap private not fixed
+ mmap private fixed at somewhere currently unmapped
+ mmap private fixed at somewhere already mapped
+ mmap shared not fixed
+ mmap shared fixed at somewhere currently unmapped
+ mmap shared fixed at somewhere already mapped
+ For private mappings, we should verify that changes cannot be read()
+ back from the file, nor mmap's back from the file at a different
+ address. (There have been systems where private was not correctly
+ implemented like the infamous i386 svr4.0, and systems where the
+ VM page cache was not coherent with the filesystem buffer cache
+ like early versions of FreeBSD and possibly contemporary NetBSD.)
+ For shared mappings, we should conversely verify that changes get
+ propogated back to all the places they're supposed to be.
+
+ Grep wants private fixed already mapped.
+ The main things grep needs to know about mmap are:
+ * does it exist and is it safe to write into the mmap'd area
+ * how to use it (BSD variants) */
+#include <sys/types.h>
+#include <fcntl.h>
+#include <sys/mman.h>
+
+/* This mess was copied from the GNU getpagesize.h. */
+#ifndef HAVE_GETPAGESIZE
+# ifdef HAVE_UNISTD_H
+# include <unistd.h>
+# endif
+
+/* Assume that all systems that can run configure have sys/param.h. */
+# ifndef HAVE_SYS_PARAM_H
+# define HAVE_SYS_PARAM_H 1
+# endif
+
+# ifdef _SC_PAGESIZE
+# define getpagesize() sysconf(_SC_PAGESIZE)
+# else /* no _SC_PAGESIZE */
+# ifdef HAVE_SYS_PARAM_H
+# include <sys/param.h>
+# ifdef EXEC_PAGESIZE
+# define getpagesize() EXEC_PAGESIZE
+# else /* no EXEC_PAGESIZE */
+# ifdef NBPG
+# define getpagesize() NBPG * CLSIZE
+# ifndef CLSIZE
+# define CLSIZE 1
+# endif /* no CLSIZE */
+# else /* no NBPG */
+# ifdef NBPC
+# define getpagesize() NBPC
+# else /* no NBPC */
+# ifdef PAGESIZE
+# define getpagesize() PAGESIZE
+# endif /* PAGESIZE */
+# endif /* no NBPC */
+# endif /* no NBPG */
+# endif /* no EXEC_PAGESIZE */
+# else /* no HAVE_SYS_PARAM_H */
+# define getpagesize() 8192 /* punt totally */
+# endif /* no HAVE_SYS_PARAM_H */
+# endif /* no _SC_PAGESIZE */
+
+#endif /* no HAVE_GETPAGESIZE */
+
+#ifdef __cplusplus
+extern "C" { void *malloc(unsigned); }
+#else
+char *malloc();
+#endif
+
+int
+main()
+{
+ char *data, *data2, *data3;
+ int i, pagesize;
+ int fd;
+
+ pagesize = getpagesize();
+
+ /*
+ * First, make a file with some known garbage in it.
+ */
+ data = malloc(pagesize);
+ if (!data)
+ exit(1);
+ for (i = 0; i < pagesize; ++i)
+ *(data + i) = rand();
+ umask(0);
+ fd = creat("conftestmmap", 0600);
+ if (fd < 0)
+ exit(1);
+ if (write(fd, data, pagesize) != pagesize)
+ exit(1);
+ close(fd);
+
+ /*
+ * Next, try to mmap the file at a fixed address which
+ * already has something else allocated at it. If we can,
+ * also make sure that we see the same garbage.
+ */
+ fd = open("conftestmmap", O_RDWR);
+ if (fd < 0)
+ exit(1);
+ data2 = malloc(2 * pagesize);
+ if (!data2)
+ exit(1);
+ data2 += (pagesize - ((int) data2 & (pagesize - 1))) & (pagesize - 1);
+ if (data2 != mmap(data2, pagesize, PROT_READ | PROT_WRITE,
+ MAP_PRIVATE | MAP_FIXED, fd, 0L))
+ exit(1);
+ for (i = 0; i < pagesize; ++i)
+ if (*(data + i) != *(data2 + i))
+ exit(1);
+
+ /*
+ * Finally, make sure that changes to the mapped area
+ * do not percolate back to the file as seen by read().
+ * (This is a bug on some variants of i386 svr4.0.)
+ */
+ for (i = 0; i < pagesize; ++i)
+ *(data2 + i) = *(data2 + i) + 1;
+ data3 = malloc(pagesize);
+ if (!data3)
+ exit(1);
+ if (read(fd, data3, pagesize) != pagesize)
+ exit(1);
+ for (i = 0; i < pagesize; ++i)
+ if (*(data + i) != *(data3 + i))
+ exit(1);
+ close(fd);
+ unlink("conftestmmap");
+ exit(0);
}
+
+EOF
+if { (eval echo configure:2781: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+then
+ ac_cv_func_mmap_fixed_mapped=yes
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -fr conftest*
+ ac_cv_func_mmap_fixed_mapped=no
+fi
+rm -fr conftest*
+fi
+
+fi
+
+echo "$ac_t""$ac_cv_func_mmap_fixed_mapped" 1>&6
+if test $ac_cv_func_mmap_fixed_mapped = yes; then
+ cat >> confdefs.h <<\EOF
+#define HAVE_MMAP 1
+EOF
+
+fi
+
+
+ for ac_hdr in argz.h limits.h locale.h nl_types.h malloc.h string.h \
+unistd.h values.h sys/param.h
+do
+ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
+echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
+echo "configure:2809: checking for $ac_hdr" >&5
+if eval "test \"\${ac_cv_header_$ac_safe+set}\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ cat > conftest.$ac_ext <<EOF
+#line 2814 "configure"
+#include "confdefs.h"
+#include <$ac_hdr>
+EOF
+ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+{ (eval echo configure:2819: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
+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 <<EOF
+#define $ac_tr_hdr 1
+EOF
+
+else
+ echo "$ac_t""no" 1>&6
+fi
+done
+
+ for ac_func in getcwd munmap putenv setenv setlocale strchr strcasecmp \
+__argz_count __argz_stringify __argz_next
+do
+echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
+echo "configure:2849: checking for $ac_func" >&5
+if eval "test \"\${ac_cv_func_$ac_func+set}\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ cat > conftest.$ac_ext <<EOF
+#line 2854 "configure"
+#include "confdefs.h"
+/* System header to define __stub macros and hopefully few prototypes,
+ which can conflict with char $ac_func(); below. */
+#include <assert.h>
+/* 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();
+char (*f)();
+
+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
+f = $ac_func;
+#endif
+
+; return 0; }
+EOF
+if { (eval echo configure:2878: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; 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 <<EOF
+#define $ac_tr_func 1
+EOF
+
+else
+ echo "$ac_t""no" 1>&6
+fi
+done
+
+
+ if test "${ac_cv_func_stpcpy+set}" != "set"; then
+ for ac_func in stpcpy
+do
+echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
+echo "configure:2907: checking for $ac_func" >&5
+if eval "test \"\${ac_cv_func_$ac_func+set}\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ cat > conftest.$ac_ext <<EOF
+#line 2912 "configure"
+#include "confdefs.h"
+/* System header to define __stub macros and hopefully few prototypes,
+ which can conflict with char $ac_func(); below. */
+#include <assert.h>
+/* 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();
+char (*f)();
+
+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
+f = $ac_func;
+#endif
+
+; return 0; }
+EOF
+if { (eval echo configure:2936: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; 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 <<EOF
+#define $ac_tr_func 1
+EOF
+
+else
+ echo "$ac_t""no" 1>&6
+fi
+done
+
+ fi
+ if test "${ac_cv_func_stpcpy}" = "yes"; then
+ cat >> confdefs.h <<\EOF
+#define HAVE_STPCPY 1
+EOF
+
+ fi
+
+ if test $ac_cv_header_locale_h = yes; then
+ echo $ac_n "checking for LC_MESSAGES""... $ac_c" 1>&6
+echo "configure:2970: checking for LC_MESSAGES" >&5
+if eval "test \"\${am_cv_val_LC_MESSAGES+set}\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ cat > conftest.$ac_ext <<EOF
+#line 2975 "configure"
+#include "confdefs.h"
+#include <locale.h>
+int main() {
+return LC_MESSAGES
+; return 0; }
+EOF
+if { (eval echo configure:2982: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+ rm -rf conftest*
+ am_cv_val_LC_MESSAGES=yes
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ am_cv_val_LC_MESSAGES=no
+fi
+rm -f conftest*
+fi
+
+echo "$ac_t""$am_cv_val_LC_MESSAGES" 1>&6
+ if test $am_cv_val_LC_MESSAGES = yes; then
+ cat >> confdefs.h <<\EOF
+#define HAVE_LC_MESSAGES 1
+EOF
+
+ fi
+ fi
+ echo $ac_n "checking whether NLS is requested""... $ac_c" 1>&6
+echo "configure:3003: checking whether NLS is requested" >&5
+ # Check whether --enable-nls or --disable-nls was given.
+if test "${enable_nls+set}" = set; then
+ enableval="$enable_nls"
+ USE_NLS=$enableval
+else
+ USE_NLS=yes
+fi
+
+ echo "$ac_t""$USE_NLS" 1>&6
+
+
+ USE_INCLUDED_LIBINTL=no
+
+ if test "$USE_NLS" = "yes"; then
+ cat >> confdefs.h <<\EOF
+#define ENABLE_NLS 1
+EOF
+
+ echo $ac_n "checking whether included gettext is requested""... $ac_c" 1>&6
+echo "configure:3023: checking whether included gettext is requested" >&5
+ # Check whether --with-included-gettext or --without-included-gettext was given.
+if test "${with_included_gettext+set}" = set; then
+ withval="$with_included_gettext"
+ nls_cv_force_use_gnu_gettext=$withval
+else
+ nls_cv_force_use_gnu_gettext=no
+fi
+
+ echo "$ac_t""$nls_cv_force_use_gnu_gettext" 1>&6
+
+ nls_cv_use_gnu_gettext="$nls_cv_force_use_gnu_gettext"
+ if test "$nls_cv_force_use_gnu_gettext" != "yes"; then
+ nls_cv_header_intl=
+ nls_cv_header_libgt=
+ CATOBJEXT=NONE
+
+ ac_safe=`echo "libintl.h" | sed 'y%./+-%__p_%'`
+echo $ac_n "checking for libintl.h""... $ac_c" 1>&6
+echo "configure:3042: checking for libintl.h" >&5
+if eval "test \"\${ac_cv_header_$ac_safe+set}\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ cat > conftest.$ac_ext <<EOF
+#line 3047 "configure"
+#include "confdefs.h"
+#include <libintl.h>
+EOF
+ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+{ (eval echo configure:3052: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
+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
+ echo $ac_n "checking for gettext in libc""... $ac_c" 1>&6
+echo "configure:3069: checking for gettext in libc" >&5
+if eval "test \"\${gt_cv_func_gettext_libc+set}\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ cat > conftest.$ac_ext <<EOF
+#line 3074 "configure"
+#include "confdefs.h"
+#include <libintl.h>
+int main() {
+return (int) gettext ("")
+; return 0; }
+EOF
+if { (eval echo configure:3081: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+ rm -rf conftest*
+ gt_cv_func_gettext_libc=yes
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ gt_cv_func_gettext_libc=no
+fi
+rm -f conftest*
+fi
+
+echo "$ac_t""$gt_cv_func_gettext_libc" 1>&6
+
+ if test "$gt_cv_func_gettext_libc" != "yes"; then
+ echo $ac_n "checking for bindtextdomain in -lintl""... $ac_c" 1>&6
+echo "configure:3097: checking for bindtextdomain in -lintl" >&5
+ac_lib_var=`echo intl'_'bindtextdomain | sed 'y%./+-:%__p__%'`
+if eval "test \"\${ac_cv_lib_$ac_lib_var+set}\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ ac_save_LIBS="$LIBS"
+LIBS="-lintl $LIBS"
+cat > conftest.$ac_ext <<EOF
+#line 3105 "configure"
+#include "confdefs.h"
+/* 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 bindtextdomain();
+
+int main() {
+bindtextdomain()
+; return 0; }
+EOF
+if { (eval echo configure:3116: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; 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
+ echo $ac_n "checking for gettext in libintl""... $ac_c" 1>&6
+echo "configure:3132: checking for gettext in libintl" >&5
+if eval "test \"\${gt_cv_func_gettext_libintl+set}\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ cat > conftest.$ac_ext <<EOF
+#line 3137 "configure"
+#include "confdefs.h"
+
+int main() {
+return (int) gettext ("")
+; return 0; }
+EOF
+if { (eval echo configure:3144: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+ rm -rf conftest*
+ gt_cv_func_gettext_libintl=yes
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ gt_cv_func_gettext_libintl=no
+fi
+rm -f conftest*
+fi
+
+echo "$ac_t""$gt_cv_func_gettext_libintl" 1>&6
+else
+ echo "$ac_t""no" 1>&6
+fi
+
+ fi
+
+ if test "$gt_cv_func_gettext_libc" = "yes" \
+ || test "$gt_cv_func_gettext_libintl" = "yes"; then
+ cat >> confdefs.h <<\EOF
+#define HAVE_GETTEXT 1
+EOF
+
+ # Extract the first word of "msgfmt", so it can be a program name with args.
+set dummy msgfmt; ac_word=$2
+echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
+echo "configure:3172: checking for $ac_word" >&5
+if eval "test \"\${ac_cv_path_MSGFMT+set}\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ case "$MSGFMT" in
+ /*)
+ ac_cv_path_MSGFMT="$MSGFMT" # Let the user override the test with a path.
+ ;;
+ *)
+ 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
+ if test -z "`$ac_dir/$ac_word -h 2>&1 | grep 'dv '`"; then
+ ac_cv_path_MSGFMT="$ac_dir/$ac_word"
+ break
+ fi
+ fi
+ done
+ IFS="$ac_save_ifs"
+ test -z "$ac_cv_path_MSGFMT" && ac_cv_path_MSGFMT="no"
+ ;;
+esac
+fi
+MSGFMT="$ac_cv_path_MSGFMT"
+if test -n "$MSGFMT"; then
+ echo "$ac_t""$MSGFMT" 1>&6
+else
+ echo "$ac_t""no" 1>&6
+fi
+ if test "$MSGFMT" != "no"; then
+ for ac_func in dcgettext
+do
+echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
+echo "configure:3206: checking for $ac_func" >&5
+if eval "test \"\${ac_cv_func_$ac_func+set}\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ cat > conftest.$ac_ext <<EOF
+#line 3211 "configure"
+#include "confdefs.h"
+/* System header to define __stub macros and hopefully few prototypes,
+ which can conflict with char $ac_func(); below. */
+#include <assert.h>
+/* 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();
+char (*f)();
+
+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
+f = $ac_func;
+#endif
+
+; return 0; }
+EOF
+if { (eval echo configure:3235: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; 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 <<EOF
+#define $ac_tr_func 1
+EOF
+
+else
+ echo "$ac_t""no" 1>&6
+fi
+done
+
+ # Extract the first word of "gmsgfmt", so it can be a program name with args.
+set dummy gmsgfmt; ac_word=$2
+echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
+echo "configure:3262: checking for $ac_word" >&5
+if eval "test \"\${ac_cv_path_GMSGFMT+set}\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ case "$GMSGFMT" in
+ /*)
+ ac_cv_path_GMSGFMT="$GMSGFMT" # Let the user override the test with a path.
+ ;;
+ ?:/*)
+ ac_cv_path_GMSGFMT="$GMSGFMT" # Let the user override the test with a dos path.
+ ;;
+ *)
+ IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":"
+ ac_dummy="$PATH"
+ for ac_dir in $ac_dummy; do
+ test -z "$ac_dir" && ac_dir=.
+ if test -f $ac_dir/$ac_word; then
+ ac_cv_path_GMSGFMT="$ac_dir/$ac_word"
+ break
+ fi
+ done
+ IFS="$ac_save_ifs"
+ test -z "$ac_cv_path_GMSGFMT" && ac_cv_path_GMSGFMT="$MSGFMT"
+ ;;
+esac
+fi
+GMSGFMT="$ac_cv_path_GMSGFMT"
+if test -n "$GMSGFMT"; then
+ echo "$ac_t""$GMSGFMT" 1>&6
+else
+ echo "$ac_t""no" 1>&6
+fi
+
+ # Extract the first word of "xgettext", so it can be a program name with args.
+set dummy xgettext; ac_word=$2
+echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
+echo "configure:3298: checking for $ac_word" >&5
+if eval "test \"\${ac_cv_path_XGETTEXT+set}\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ case "$XGETTEXT" in
+ /*)
+ ac_cv_path_XGETTEXT="$XGETTEXT" # Let the user override the test with a path.
+ ;;
+ *)
+ 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
+ if test -z "`$ac_dir/$ac_word -h 2>&1 | grep '(HELP)'`"; then
+ ac_cv_path_XGETTEXT="$ac_dir/$ac_word"
+ break
+ fi
+ fi
+ done
+ IFS="$ac_save_ifs"
+ test -z "$ac_cv_path_XGETTEXT" && ac_cv_path_XGETTEXT=":"
+ ;;
+esac
+fi
+XGETTEXT="$ac_cv_path_XGETTEXT"
+if test -n "$XGETTEXT"; then
+ echo "$ac_t""$XGETTEXT" 1>&6
+else
+ echo "$ac_t""no" 1>&6
+fi
+
+ cat > conftest.$ac_ext <<EOF
+#line 3330 "configure"
+#include "confdefs.h"
+
+int main() {
+extern int _nl_msg_cat_cntr;
+ return _nl_msg_cat_cntr
+; return 0; }
+EOF
+if { (eval echo configure:3338: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+ rm -rf conftest*
+ CATOBJEXT=.gmo
+ DATADIRNAME=share
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ CATOBJEXT=.mo
+ DATADIRNAME=lib
+fi
+rm -f conftest*
+ INSTOBJEXT=.mo
+ fi
+ fi
+
+else
+ echo "$ac_t""no" 1>&6
+fi
+
+
+
+ if test "$CATOBJEXT" = "NONE"; then
+ nls_cv_use_gnu_gettext=yes
+ fi
+ fi
+
+ if test "$nls_cv_use_gnu_gettext" = "yes"; then
+ INTLOBJS="\$(GETTOBJS)"
+ # Extract the first word of "msgfmt", so it can be a program name with args.
+set dummy msgfmt; ac_word=$2
+echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
+echo "configure:3370: checking for $ac_word" >&5
+if eval "test \"\${ac_cv_path_MSGFMT+set}\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ case "$MSGFMT" in
+ /*)
+ ac_cv_path_MSGFMT="$MSGFMT" # Let the user override the test with a path.
+ ;;
+ *)
+ 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
+ if test -z "`$ac_dir/$ac_word -h 2>&1 | grep 'dv '`"; then
+ ac_cv_path_MSGFMT="$ac_dir/$ac_word"
+ break
+ fi
+ fi
+ done
+ IFS="$ac_save_ifs"
+ test -z "$ac_cv_path_MSGFMT" && ac_cv_path_MSGFMT="msgfmt"
+ ;;
+esac
+fi
+MSGFMT="$ac_cv_path_MSGFMT"
+if test -n "$MSGFMT"; then
+ echo "$ac_t""$MSGFMT" 1>&6
+else
+ echo "$ac_t""no" 1>&6
+fi
+
+ # Extract the first word of "gmsgfmt", so it can be a program name with args.
+set dummy gmsgfmt; ac_word=$2
+echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
+echo "configure:3404: checking for $ac_word" >&5
+if eval "test \"\${ac_cv_path_GMSGFMT+set}\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ case "$GMSGFMT" in
+ /*)
+ ac_cv_path_GMSGFMT="$GMSGFMT" # Let the user override the test with a path.
+ ;;
+ ?:/*)
+ ac_cv_path_GMSGFMT="$GMSGFMT" # Let the user override the test with a dos path.
+ ;;
+ *)
+ IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":"
+ ac_dummy="$PATH"
+ for ac_dir in $ac_dummy; do
+ test -z "$ac_dir" && ac_dir=.
+ if test -f $ac_dir/$ac_word; then
+ ac_cv_path_GMSGFMT="$ac_dir/$ac_word"
+ break
+ fi
+ done
+ IFS="$ac_save_ifs"
+ test -z "$ac_cv_path_GMSGFMT" && ac_cv_path_GMSGFMT="$MSGFMT"
+ ;;
+esac
+fi
+GMSGFMT="$ac_cv_path_GMSGFMT"
+if test -n "$GMSGFMT"; then
+ echo "$ac_t""$GMSGFMT" 1>&6
+else
+ echo "$ac_t""no" 1>&6
+fi
+
+ # Extract the first word of "xgettext", so it can be a program name with args.
+set dummy xgettext; ac_word=$2
+echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
+echo "configure:3440: checking for $ac_word" >&5
+if eval "test \"\${ac_cv_path_XGETTEXT+set}\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ case "$XGETTEXT" in
+ /*)
+ ac_cv_path_XGETTEXT="$XGETTEXT" # Let the user override the test with a path.
+ ;;
+ *)
+ 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
+ if test -z "`$ac_dir/$ac_word -h 2>&1 | grep '(HELP)'`"; then
+ ac_cv_path_XGETTEXT="$ac_dir/$ac_word"
+ break
+ fi
+ fi
+ done
+ IFS="$ac_save_ifs"
+ test -z "$ac_cv_path_XGETTEXT" && ac_cv_path_XGETTEXT=":"
+ ;;
+esac
+fi
+XGETTEXT="$ac_cv_path_XGETTEXT"
+if test -n "$XGETTEXT"; then
+ echo "$ac_t""$XGETTEXT" 1>&6
+else
+ echo "$ac_t""no" 1>&6
+fi
+
+
+ USE_INCLUDED_LIBINTL=yes
+ CATOBJEXT=.gmo
+ INSTOBJEXT=.mo
+ DATADIRNAME=share
+ INTLDEPS='$(top_builddir)/../intl/libintl.a'
+ INTLLIBS=$INTLDEPS
+ LIBS=`echo $LIBS | sed -e 's/-lintl//'`
+ nls_cv_header_intl=libintl.h
+ nls_cv_header_libgt=libgettext.h
+ fi
+
+ if test "$XGETTEXT" != ":"; then
+ if $XGETTEXT --omit-header /dev/null 2> /dev/null; then
+ : ;
+ else
+ echo "$ac_t""found xgettext programs is not GNU xgettext; ignore it" 1>&6
+ XGETTEXT=":"
+ fi
+ fi
+
+ # We need to process the po/ directory.
+ POSUB=po
+ else
+ DATADIRNAME=share
+ nls_cv_header_intl=libintl.h
+ nls_cv_header_libgt=libgettext.h
+ fi
+
+ # If this is used in GNU gettext we have to set USE_NLS to `yes'
+ # because some of the sources are only built for this goal.
+ if test "$PACKAGE" = gettext; then
+ USE_NLS=yes
+ USE_INCLUDED_LIBINTL=yes
+ fi
+
+ for lang in $ALL_LINGUAS; do
+ GMOFILES="$GMOFILES $lang.gmo"
+ POFILES="$POFILES $lang.po"
+ done
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ if test "x$CATOBJEXT" != "x"; then
+ if test "x$ALL_LINGUAS" = "x"; then
+ LINGUAS=
+ else
+ echo $ac_n "checking for catalogs to be installed""... $ac_c" 1>&6
+echo "configure:3530: checking for catalogs to be installed" >&5
+ NEW_LINGUAS=
+ for lang in ${LINGUAS=$ALL_LINGUAS}; do
+ case "$ALL_LINGUAS" in
+ *$lang*) NEW_LINGUAS="$NEW_LINGUAS $lang" ;;
+ esac
+ done
+ LINGUAS=$NEW_LINGUAS
+ echo "$ac_t""$LINGUAS" 1>&6
+ fi
+
+ if test -n "$LINGUAS"; then
+ for lang in $LINGUAS; do CATALOGS="$CATALOGS $lang$CATOBJEXT"; done
+ fi
+ fi
+
+ if test $ac_cv_header_locale_h = yes; then
+ INCLUDE_LOCALE_H="#include <locale.h>"
+ else
+ INCLUDE_LOCALE_H="\
+/* The system does not provide the header <locale.h>. Take care yourself. */"
+ fi
+
+
+ if test -f $srcdir/po2tbl.sed.in; then
+ if test "$CATOBJEXT" = ".cat"; then
+ ac_safe=`echo "linux/version.h" | sed 'y%./+-%__p_%'`
+echo $ac_n "checking for linux/version.h""... $ac_c" 1>&6
+echo "configure:3558: checking for linux/version.h" >&5
+if eval "test \"\${ac_cv_header_$ac_safe+set}\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ cat > conftest.$ac_ext <<EOF
+#line 3563 "configure"
+#include "confdefs.h"
+#include <linux/version.h>
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*
+ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+{ (eval echo configure:3568: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
+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
+ msgformat=linux
+else
+ echo "$ac_t""no" 1>&6
+msgformat=xopen
+fi
+
+
+ sed -e '/^#/d' $srcdir/$msgformat-msg.sed > po2msg.sed
+ fi
+ sed -e '/^#.*[^\\]$/d' -e '/^#$/d' \
+ $srcdir/po2tbl.sed.in > po2tbl.sed
+ fi
+
+ if test "$PACKAGE" = "gettext"; then
+ GT_NO="#NO#"
+ GT_YES=
+ else
+ GT_NO=
+ GT_YES="#YES#"
+ fi
+
+
+
+ MKINSTALLDIRS="\$(srcdir)/../../mkinstalldirs"
+
+
+ l=
+
+
+ if test -d $srcdir/po; then
+ test -d po || mkdir po
+ if test "x$srcdir" != "x."; then
+ if test "x`echo $srcdir | sed 's@/.*@@'`" = "x"; then
+ posrcprefix="$srcdir/"
+ else
+ posrcprefix="../$srcdir/"
+ fi
+ else
+ posrcprefix="../"
+ fi
+ rm -f po/POTFILES
+ sed -e "/^#/d" -e "/^\$/d" -e "s,.*, $posrcprefix& \\\\," -e "\$s/\(.*\) \\\\/\1/" \
+ < $srcdir/po/POTFILES.in > po/POTFILES
+ fi
+
+
+echo $ac_n "checking for Cygwin environment""... $ac_c" 1>&6
+echo "configure:3631: checking for Cygwin environment" >&5
+if eval "test \"\${ac_cv_cygwin+set}\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ cat > conftest.$ac_ext <<EOF
+#line 3636 "configure"
+#include "confdefs.h"
+
+int main() {
-test x"${am_cv_exeext}" = x && am_cv_exeext=no
+#ifndef __CYGWIN__
+#define __CYGWIN__ __CYGWIN32__
+#endif
+return __CYGWIN__;
+; return 0; }
+EOF
+if { (eval echo configure:3647: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+ rm -rf conftest*
+ ac_cv_cygwin=yes
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ ac_cv_cygwin=no
+fi
+rm -f conftest*
+fi
+
+echo "$ac_t""$ac_cv_cygwin" 1>&6
+CYGWIN=
+test "$ac_cv_cygwin" = yes && CYGWIN=yes
+echo $ac_n "checking for mingw32 environment""... $ac_c" 1>&6
+echo "configure:3663: checking for mingw32 environment" >&5
+if eval "test \"\${ac_cv_mingw32+set}\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ cat > conftest.$ac_ext <<EOF
+#line 3668 "configure"
+#include "confdefs.h"
+
+int main() {
+return __MINGW32__;
+; return 0; }
+EOF
+if { (eval echo configure:3675: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+ rm -rf conftest*
+ ac_cv_mingw32=yes
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ ac_cv_mingw32=no
+fi
+rm -f conftest*
+fi
+
+echo "$ac_t""$ac_cv_mingw32" 1>&6
+MINGW32=
+test "$ac_cv_mingw32" = yes && MINGW32=yes
+echo $ac_n "checking for EMX OS/2 environment""... $ac_c" 1>&6
+echo "configure:3691: checking for EMX OS/2 environment" >&5
+if eval "test \"\${ac_cv_emxos2+set}\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ cat > conftest.$ac_ext <<EOF
+#line 3696 "configure"
+#include "confdefs.h"
+
+int main() {
+return __EMX__;
+; return 0; }
+EOF
+if { (eval echo configure:3703: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+ rm -rf conftest*
+ ac_cv_emxos2=yes
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ ac_cv_emxos2=no
+fi
+rm -f conftest*
fi
+
+echo "$ac_t""$ac_cv_emxos2" 1>&6
+EMXOS2=
+test "$ac_cv_emxos2" = yes && EMXOS2=yes
+
+
+
+echo $ac_n "checking for executable suffix""... $ac_c" 1>&6
+echo "configure:3722: checking for executable suffix" >&5
+if eval "test \"\${ac_cv_exeext+set}\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ if test "$CYGWIN" = yes || test "$MINGW32" = yes || test "$EMXOS2" = yes; then
+ ac_cv_exeext=.exe
+else
+ rm -f conftest*
+ echo 'int main () { return 0; }' > conftest.$ac_ext
+ ac_cv_exeext=
+ if { (eval echo configure:3732: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then
+ for file in conftest.*; do
+ case $file in
+ *.c | *.C | *.o | *.obj | *.xcoff) ;;
+ *) ac_cv_exeext=`echo $file | sed -e s/conftest//` ;;
+ esac
+ done
+ else
+ { echo "configure: error: installation or configuration problem: compiler cannot create executables." 1>&2; exit 1; }
+ fi
+ rm -f conftest*
+ test x"${ac_cv_exeext}" = x && ac_cv_exeext=no
+fi
+fi
+
EXEEXT=""
-test x"${am_cv_exeext}" != xno && EXEEXT=${am_cv_exeext}
-echo "$ac_t""${am_cv_exeext}" 1>&6
+test x"${ac_cv_exeext}" != xno && EXEEXT=${ac_cv_exeext}
+echo "$ac_t""${ac_cv_exeext}" 1>&6
+ac_exeext=$EXEEXT
for ac_prog in 'bison -y' byacc
@@ -1614,15 +3754,16 @@ 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 "configure:3758: checking for $ac_word" >&5
+if eval "test \"\${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
+ IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":"
+ ac_dummy="$PATH"
+ for ac_dir in $ac_dummy; do
test -z "$ac_dir" && ac_dir=.
if test -f $ac_dir/$ac_word; then
ac_cv_prog_YACC="$ac_prog"
@@ -1643,18 +3784,55 @@ test -n "$YACC" && break
done
test -n "$YACC" || YACC="yacc"
+missing_dir=`cd $ac_aux_dir && pwd`
+for ac_prog in flex lex
+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:3794: checking for $ac_word" >&5
+if eval "test \"\${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=":"
+ ac_dummy="$PATH"
+ for ac_dir in $ac_dummy; do
+ test -z "$ac_dir" && ac_dir=.
+ if test -f $ac_dir/$ac_word; then
+ ac_cv_prog_LEX="$ac_prog"
+ break
+ fi
+ done
+ IFS="$ac_save_ifs"
+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
+
+test -n "$LEX" && break
+done
+test -n "$LEX" || LEX=""$missing_dir/missing flex""
+
# 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 "configure:3827: checking for $ac_word" >&5
+if eval "test \"\${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
+ IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":"
+ ac_dummy="$PATH"
+ for ac_dir in $ac_dummy; do
test -z "$ac_dir" && ac_dir=.
if test -f $ac_dir/$ac_word; then
ac_cv_prog_LEX="flex"
@@ -1679,15 +3857,15 @@ then
*) 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 "configure:3861: checking for yywrap in -l$ac_lib" >&5
+ac_lib_var=`echo $ac_lib'_'yywrap | sed 'y%./+-:%__p__%'`
+if eval "test \"\${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 <<EOF
-#line 1691 "configure"
+#line 3869 "configure"
#include "confdefs.h"
/* Override any gcc2 internal prototype to avoid an error. */
/* We use char because int might match the return type of a gcc2
@@ -1698,7 +3876,7 @@ int main() {
yywrap()
; return 0; }
EOF
-if { (eval echo configure:1702: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:3880: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
@@ -1720,70 +3898,9 @@ 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 <<EOF
-#line 1740 "configure"
-#include "confdefs.h"
-#include <assert.h>
-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 <<EOF
-#line 1757 "configure"
-#include "confdefs.h"
-#include <assert.h>
-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 "configure:3903: checking lex output file root" >&5
+if eval "test \"\${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
@@ -1803,8 +3920,8 @@ 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 "configure:3924: checking whether yytext is a pointer" >&5
+if eval "test \"\${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
@@ -1815,14 +3932,14 @@ echo 'extern char *yytext;' >>$LEX_OUTPUT_ROOT.c
ac_save_LIBS="$LIBS"
LIBS="$LIBS $LEXLIB"
cat > conftest.$ac_ext <<EOF
-#line 1819 "configure"
+#line 3936 "configure"
#include "confdefs.h"
`cat $LEX_OUTPUT_ROOT.c`
int main() {
; return 0; }
EOF
-if { (eval echo configure:1826: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:3943: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
ac_cv_prog_lex_yytext_pointer=yes
else
@@ -1845,7 +3962,7 @@ 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
+echo "configure:3966: 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"
@@ -1855,11 +3972,16 @@ else
fi
echo "$ac_t""$USE_MAINTAINER_MODE" 1>&6
- if test $USE_MAINTAINER_MODE = yes; then
- MAINT=
- else
- MAINT='#M#'
- fi
+
+
+if test $USE_MAINTAINER_MODE = yes; then
+ MAINTAINER_MODE_TRUE=
+ MAINTAINER_MODE_FALSE='#'
+else
+ MAINTAINER_MODE_TRUE='#'
+ MAINTAINER_MODE_FALSE=
+fi
+ MAINT=$MAINTAINER_MODE_TRUE
@@ -1874,18 +3996,18 @@ 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 "configure:4000: checking for $ac_hdr" >&5
+if eval "test \"\${ac_cv_header_$ac_safe+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 1883 "configure"
+#line 4005 "configure"
#include "confdefs.h"
#include <$ac_hdr>
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`
+{ (eval echo configure:4010: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
rm -rf conftest*
eval "ac_cv_header_$ac_safe=yes"
@@ -1913,12 +4035,12 @@ 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 "configure:4039: checking for $ac_func" >&5
+if eval "test \"\${ac_cv_func_$ac_func+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 1922 "configure"
+#line 4044 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char $ac_func(); below. */
@@ -1927,6 +4049,7 @@ else
/* 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();
+char (*f)();
int main() {
@@ -1936,12 +4059,12 @@ int main() {
#if defined (__stub_$ac_func) || defined (__stub___$ac_func)
choke me
#else
-$ac_func();
+f = $ac_func;
#endif
; return 0; }
EOF
-if { (eval echo configure:1945: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:4068: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_func_$ac_func=yes"
else
@@ -1970,12 +4093,12 @@ 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 "configure:4097: checking for $ac_hdr that defines DIR" >&5
+if eval "test \"\${ac_cv_header_dirent_$ac_safe+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 1979 "configure"
+#line 4102 "configure"
#include "confdefs.h"
#include <sys/types.h>
#include <$ac_hdr>
@@ -1983,7 +4106,7 @@ int main() {
DIR *dirp = 0;
; return 0; }
EOF
-if { (eval echo configure:1987: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:4110: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
eval "ac_cv_header_dirent_$ac_safe=yes"
else
@@ -2008,15 +4131,15 @@ 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 "configure:4135: checking for opendir in -ldir" >&5
+ac_lib_var=`echo dir'_'opendir | sed 'y%./+-:%__p__%'`
+if eval "test \"\${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 <<EOF
-#line 2020 "configure"
+#line 4143 "configure"
#include "confdefs.h"
/* Override any gcc2 internal prototype to avoid an error. */
/* We use char because int might match the return type of a gcc2
@@ -2027,7 +4150,7 @@ int main() {
opendir()
; return 0; }
EOF
-if { (eval echo configure:2031: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:4154: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
@@ -2049,15 +4172,15 @@ 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 "configure:4176: checking for opendir in -lx" >&5
+ac_lib_var=`echo x'_'opendir | sed 'y%./+-:%__p__%'`
+if eval "test \"\${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 <<EOF
-#line 2061 "configure"
+#line 4184 "configure"
#include "confdefs.h"
/* Override any gcc2 internal prototype to avoid an error. */
/* We use char because int might match the return type of a gcc2
@@ -2068,7 +4191,7 @@ int main() {
opendir()
; return 0; }
EOF
-if { (eval echo configure:2072: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:4195: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
@@ -2093,7 +4216,7 @@ fi
case "${host}" in
-i[345]86-*-msdos* | i[345]86-*-go32* | i[345]86-*-mingw32* | *-*-cygwin32* | *-*-windows)
+*-*-msdos* | *-*-go32* | *-*-mingw32* | *-*-cygwin* | *-*-windows*)
cat >> confdefs.h <<\EOF
#define USE_BINARY_FOPEN 1
EOF
@@ -2101,12 +4224,12 @@ 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 "configure:4228: checking whether strstr must be declared" >&5
+if eval "test \"\${bfd_cv_decl_needed_strstr+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 2110 "configure"
+#line 4233 "configure"
#include "confdefs.h"
#include <stdio.h>
@@ -2127,7 +4250,7 @@ int main() {
char *(*pfn) = (char *(*)) strstr
; return 0; }
EOF
-if { (eval echo configure:2131: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:4254: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
bfd_cv_decl_needed_strstr=no
else
@@ -2141,20 +4264,19 @@ 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 <<EOF
-#define $bfd_tr_decl 1
+ cat >> confdefs.h <<\EOF
+#define NEED_DECLARATION_STRSTR 1
EOF
fi
echo $ac_n "checking whether free must be declared""... $ac_c" 1>&6
-echo "configure:2153: checking whether free must be declared" >&5
-if eval "test \"`echo '$''{'bfd_cv_decl_needed_free'+set}'`\" = set"; then
+echo "configure:4275: checking whether free must be declared" >&5
+if eval "test \"\${bfd_cv_decl_needed_free+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 2158 "configure"
+#line 4280 "configure"
#include "confdefs.h"
#include <stdio.h>
@@ -2175,7 +4297,7 @@ int main() {
char *(*pfn) = (char *(*)) free
; return 0; }
EOF
-if { (eval echo configure:2179: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:4301: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
bfd_cv_decl_needed_free=no
else
@@ -2189,20 +4311,19 @@ 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 <<EOF
-#define $bfd_tr_decl 1
+ cat >> confdefs.h <<\EOF
+#define NEED_DECLARATION_FREE 1
EOF
fi
echo $ac_n "checking whether sbrk must be declared""... $ac_c" 1>&6
-echo "configure:2201: checking whether sbrk must be declared" >&5
-if eval "test \"`echo '$''{'bfd_cv_decl_needed_sbrk'+set}'`\" = set"; then
+echo "configure:4322: checking whether sbrk must be declared" >&5
+if eval "test \"\${bfd_cv_decl_needed_sbrk+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 2206 "configure"
+#line 4327 "configure"
#include "confdefs.h"
#include <stdio.h>
@@ -2223,7 +4344,7 @@ int main() {
char *(*pfn) = (char *(*)) sbrk
; return 0; }
EOF
-if { (eval echo configure:2227: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:4348: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
bfd_cv_decl_needed_sbrk=no
else
@@ -2237,20 +4358,19 @@ 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 <<EOF
-#define $bfd_tr_decl 1
+ cat >> confdefs.h <<\EOF
+#define NEED_DECLARATION_SBRK 1
EOF
fi
echo $ac_n "checking whether getenv must be declared""... $ac_c" 1>&6
-echo "configure:2249: checking whether getenv must be declared" >&5
-if eval "test \"`echo '$''{'bfd_cv_decl_needed_getenv'+set}'`\" = set"; then
+echo "configure:4369: checking whether getenv must be declared" >&5
+if eval "test \"\${bfd_cv_decl_needed_getenv+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 2254 "configure"
+#line 4374 "configure"
#include "confdefs.h"
#include <stdio.h>
@@ -2271,7 +4391,7 @@ int main() {
char *(*pfn) = (char *(*)) getenv
; return 0; }
EOF
-if { (eval echo configure:2275: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:4395: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
bfd_cv_decl_needed_getenv=no
else
@@ -2285,11 +4405,96 @@ 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 <<EOF
-#define $bfd_tr_decl 1
+ cat >> confdefs.h <<\EOF
+#define NEED_DECLARATION_GETENV 1
+EOF
+
+fi
+
+echo $ac_n "checking whether environ must be declared""... $ac_c" 1>&6
+echo "configure:4416: checking whether environ must be declared" >&5
+if eval "test \"\${bfd_cv_decl_needed_environ+set}\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ cat > conftest.$ac_ext <<EOF
+#line 4421 "configure"
+#include "confdefs.h"
+
+#include <stdio.h>
+#ifdef HAVE_STRING_H
+#include <string.h>
+#else
+#ifdef HAVE_STRINGS_H
+#include <strings.h>
+#endif
+#endif
+#ifdef HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+#ifdef HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+int main() {
+char *(*pfn) = (char *(*)) environ
+; return 0; }
+EOF
+if { (eval echo configure:4442: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+ rm -rf conftest*
+ bfd_cv_decl_needed_environ=no
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ bfd_cv_decl_needed_environ=yes
+fi
+rm -f conftest*
+fi
+
+echo "$ac_t""$bfd_cv_decl_needed_environ" 1>&6
+if test $bfd_cv_decl_needed_environ = yes; then
+ cat >> confdefs.h <<\EOF
+#define NEED_DECLARATION_ENVIRON 1
+EOF
+
+fi
+
+
+# When converting linker scripts into strings for use in emulation
+# files, use astring.sed if the compiler supports ANSI string
+# concatenation, or ostring.sed otherwise. This is to support the
+# broken Microsoft MSVC compiler, which limits the length of string
+# constants, while still supporting pre-ANSI compilers which do not
+# support string concatenation.
+echo $ac_n "checking whether ANSI C string concatenation works""... $ac_c" 1>&6
+echo "configure:4470: checking whether ANSI C string concatenation works" >&5
+if eval "test \"\${ld_cv_string_concatenation+set}\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ cat > conftest.$ac_ext <<EOF
+#line 4475 "configure"
+#include "confdefs.h"
+
+int main() {
+char *a = "a" "a";
+; return 0; }
EOF
+if { (eval echo configure:4482: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+ rm -rf conftest*
+ ld_cv_string_concatenation=yes
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ ld_cv_string_concatenation=no
+fi
+rm -f conftest*
+fi
+echo "$ac_t""$ld_cv_string_concatenation" 1>&6
+if test "$ld_cv_string_concatenation" = "yes"; then
+ STRINGIFY=astring.sed
+else
+ STRINGIFY=ostring.sed
fi
@@ -2298,7 +4503,10 @@ fi
all_targets=
EMUL=
all_emuls=
-TDIRS=
+all_emul_extras=
+all_libpath=
+
+rm -f tdirs
for targ_alias in `echo $target_alias $enable_targets | sed 's/,/ /g'`
do
@@ -2306,7 +4514,7 @@ do
all_targets=true
else
# Canonicalize the secondary target names.
- result=`${CONFIG_SHELL-/bin/sh} $ac_config_sub $targ_alias 2>/dev/null`
+ result=`$ac_config_sub $targ_alias 2>/dev/null`
if test -n "$result"; then
targ=$result
else
@@ -2319,15 +4527,36 @@ do
EMUL=$targ_emul
fi
- for i in $targ_emul $targ_extra_emuls; do
+ for i in $targ_emul $targ_extra_emuls $targ_extra_libpath; 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"
+ echo tdir_$i=$result >> tdirs
+ ;;
+ esac
+ done
+
+ for i in $targ_emul $targ_extra_libpath; do
+ case " $all_libpath " in
+ *" ${i} "*) ;;
+ *)
+ if test -z "$all_libpath"; then
+ all_libpath=${i}
+ else
+ all_libpath="$all_libpath ${i}"
+ fi
+ ;;
+ esac
+ done
+
+ for i in $targ_extra_ofiles; do
+ case " $all_emul_extras " in
+ *" ${i} "*) ;;
+ *)
+ all_emul_extras="$all_emul_extras ${i}"
;;
esac
done
@@ -2336,6 +4565,8 @@ done
+TDIRS=tdirs
+
if test x${all_targets} = xtrue; then
if test x${want64} = xtrue; then
@@ -2343,11 +4574,17 @@ if test x${all_targets} = xtrue; then
else
EMULATION_OFILES='$(ALL_EMULATIONS)'
fi
+ EMUL_EXTRA_OFILES='$(ALL_EMUL_EXTRA_OFILES)'
else
EMULATION_OFILES=$all_emuls
+ EMUL_EXTRA_OFILES=$all_emul_extras
fi
+
+EMULATION_LIBPATH=$all_libpath
+
+
if test x${enable_static} = xno; then
TESTBFDLIB="--rpath ../bfd/.libs ../bfd/.libs/libbfd.so"
else
@@ -2355,6 +4592,18 @@ else
fi
+target_vendor=${target_vendor=$host_vendor}
+case "$target_vendor" in
+ hp) EXTRA_SHLIB_EXTENSION=".sl" ;;
+ *) EXTRA_SHLIB_EXTENSION= ;;
+esac
+if test x${EXTRA_SHLIB_EXTENSION} != x ; then
+ cat >> confdefs.h <<EOF
+#define EXTRA_SHLIB_EXTENSION "$EXTRA_SHLIB_EXTENSION"
+EOF
+
+fi
+
trap '' 1 2 15
cat > confcache <<\EOF
# This file is a shell script that caches the results of configure
@@ -2378,7 +4627,7 @@ EOF
# 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
+ case `(ac_space=' '; set | grep ac_space) 2>&1` in
*ac_space=\ *)
# `set' does not quote correctly, so add quotes (double-quote substitution
# turns \\\\ into \\, and sed turns \\ into \).
@@ -2445,7 +4694,7 @@ do
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"
+ echo "$CONFIG_STATUS generated by autoconf version 2.13.1"
exit 0 ;;
-help | --help | --hel | --he | --h)
echo "\$ac_cs_usage"; exit 0 ;;
@@ -2456,7 +4705,7 @@ 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
+trap 'rm -fr `echo "Makefile po/Makefile.in:po/Make-in config.h:config.in" | sed "s/:[^ ]*//g"` conftest*; exit 1' 1 2 15
EOF
cat >> $CONFIG_STATUS <<EOF
@@ -2469,6 +4718,7 @@ s%@SHELL@%$SHELL%g
s%@CFLAGS@%$CFLAGS%g
s%@CPPFLAGS@%$CPPFLAGS%g
s%@CXXFLAGS@%$CXXFLAGS%g
+s%@FFLAGS@%$FFLAGS%g
s%@DEFS@%$DEFS%g
s%@LDFLAGS@%$LDFLAGS%g
s%@LIBS@%$LIBS%g
@@ -2503,8 +4753,8 @@ 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%@INSTALL_DATA@%$INSTALL_DATA%g
s%@PACKAGE@%$PACKAGE%g
s%@VERSION@%$VERSION%g
s%@ACLOCAL@%$ACLOCAL%g
@@ -2515,24 +4765,49 @@ 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%@CPP@%$CPP%g
+s%@ALLOCA@%$ALLOCA%g
+s%@USE_NLS@%$USE_NLS%g
+s%@MSGFMT@%$MSGFMT%g
+s%@GMSGFMT@%$GMSGFMT%g
+s%@XGETTEXT@%$XGETTEXT%g
+s%@USE_INCLUDED_LIBINTL@%$USE_INCLUDED_LIBINTL%g
+s%@CATALOGS@%$CATALOGS%g
+s%@CATOBJEXT@%$CATOBJEXT%g
+s%@DATADIRNAME@%$DATADIRNAME%g
+s%@GMOFILES@%$GMOFILES%g
+s%@INSTOBJEXT@%$INSTOBJEXT%g
+s%@INTLDEPS@%$INTLDEPS%g
+s%@INTLLIBS@%$INTLLIBS%g
+s%@INTLOBJS@%$INTLOBJS%g
+s%@POFILES@%$POFILES%g
+s%@POSUB@%$POSUB%g
+s%@INCLUDE_LOCALE_H@%$INCLUDE_LOCALE_H%g
+s%@GT_NO@%$GT_NO%g
+s%@GT_YES@%$GT_YES%g
+s%@MKINSTALLDIRS@%$MKINSTALLDIRS%g
+s%@l@%$l%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%@MAINTAINER_MODE_TRUE@%$MAINTAINER_MODE_TRUE%g
+s%@MAINTAINER_MODE_FALSE@%$MAINTAINER_MODE_FALSE%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%@STRINGIFY@%$STRINGIFY%g
s%@EMUL@%$EMUL%g
-s%@TDIRS@%$TDIRS%g
+/@TDIRS@/r $TDIRS
+s%@TDIRS@%%g
s%@EMULATION_OFILES@%$EMULATION_OFILES%g
+s%@EMUL_EXTRA_OFILES@%$EMUL_EXTRA_OFILES%g
+s%@EMULATION_LIBPATH@%$EMULATION_LIBPATH%g
s%@TESTBFDLIB@%$TESTBFDLIB%g
CEOF
@@ -2575,7 +4850,7 @@ EOF
cat >> $CONFIG_STATUS <<EOF
-CONFIG_FILES=\${CONFIG_FILES-"Makefile"}
+CONFIG_FILES=\${CONFIG_FILES-"Makefile po/Makefile.in:po/Make-in"}
EOF
cat >> $CONFIG_STATUS <<\EOF
for ac_file in .. $CONFIG_FILES; do if test "x$ac_file" != x..; then
@@ -2748,10 +5023,10 @@ cat >> $CONFIG_STATUS <<EOF
EOF
cat >> $CONFIG_STATUS <<\EOF
test -z "$CONFIG_HEADERS" || echo timestamp > stamp-h
-
+sed -e '/POTFILES =/r po/POTFILES' po/Makefile.in > po/Makefile
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
+test "$no_create" = yes || $SHELL $CONFIG_STATUS || exit 1
diff --git a/contrib/binutils/ld/configure.host b/contrib/binutils/ld/configure.host
index 883ce67..38ad347 100644
--- a/contrib/binutils/ld/configure.host
+++ b/contrib/binutils/ld/configure.host
@@ -11,14 +11,14 @@
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'
+HOSTING_LIBS='`if [ -f ../gcc/libgcc.a ] ; then echo ../gcc/libgcc.a ; else ${CC} -print-libgcc-file-name; fi` -lc'
NATIVE_LIB_DIRS=
case "${host}" in
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`'
+ HOSTING_CRT0='-dynamic-linker `egrep "ld[^ ]*\.so" \`${CC} --print-file-name=specs\` | sed -e "s,.*-dynamic-linker[ ][ ]*\(.*/ld[^ ]*.so..\).*,\1,"` `${CC} --print-file-name=crt1.o` `${CC} --print-file-name=crti.o` `if [ -f ../gcc/crtbegin.o ]; then echo ../gcc/crtbegin.o; else ${CC} --print-file-name=crtbegin.o; fi`'
+ HOSTING_LIBS='`if [ -f ../gcc/libgcc.a ] ; then echo ../gcc/libgcc.a ; else ${CC} -print-libgcc-file-name; fi` -L`dirname \`${CC} --print-file-name=libc.so\`` -lc `if [ -f ../gcc/libgcc.a ] ; then echo ../gcc/libgcc.a ; else ${CC} -print-libgcc-file-name; fi` `if [ -f ../gcc/crtend.o ]; then echo ../gcc/crtend.o; else ${CC} --print-file-name=crtend.o; fi` `${CC} --print-file-name=crtn.o`'
;;
alpha*-*-netbsd*)
@@ -35,6 +35,25 @@ alpha*-*-*)
NATIVE_LIB_DIRS=/usr/ccs/lib
;;
+arm*-*-linux-gnu*)
+ HOSTING_CRT0='-p -dynamic-linker `fgrep ld-linux.so \`${CC} --print-file-name=specs\` | sed -e "s,.*-dynamic-linker[ ][ ]*\(.*/ld-linux.so..\).*,\1,"` `${CC} --print-file-name=crt1.o` `${CC} --print-file-name=crti.o` `if [ -f ../gcc/crtbegin.o ]; then echo ../gcc/crtbegin.o; else ${CC} --print-file-name=crtbegin.o; fi`'
+ HOSTING_LIBS='`if [ -f ../gcc/libgcc.a ] ; then echo ../gcc/libgcc.a ; else ${CC} -print-libgcc-file-name; fi` -L`dirname \`${CC} --print-file-name=libc.so\`` -lc `if [ -f ../gcc/libgcc.a ] ; then echo ../gcc/libgcc.a ; else ${CC} -print-libgcc-file-name; fi` `if [ -f ../gcc/crtend.o ]; then echo ../gcc/crtend.o; else ${CC} --print-file-name=crtend.o; fi` `${CC} --print-file-name=crtn.o`'
+ ;;
+
+i[3456]86-*-freebsdelf*)
+ # 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
+ # Older versions of gcc do not use a specs file. In those cases,
+ # gcc -print-file-name=specs will simply print specs. We create a
+ # dummy specs files to handle this.
+ echo "-dynamic-linker /usr/libexec/ld-elf.so.1" > specs
+ HOSTING_CRT0='-dynamic-linker `egrep "ld[^ ]*\.so" \`${CC} --print-file-name=specs\` | sed -e "s,.*-dynamic-linker[ ][ ]*\(.*/ld[^ ]*.so..\).*,\1,"` `${CC} --print-file-name=crt1.o` `${CC} --print-file-name=crti.o` `if [ -f ../gcc/crtbegin.o ]; then echo ../gcc/crtbegin.o; else ${CC} --print-file-name=crtbegin.o; fi`'
+ HOSTING_LIBS='`if [ -f ../gcc/libgcc.a ] ; then echo ../gcc/libgcc.a ; else ${CC} -print-libgcc-file-name; fi` -L`dirname \`${CC} --print-file-name=libc.so\`` -lc `if [ -f ../gcc/libgcc.a ] ; then echo ../gcc/libgcc.a ; else ${CC} -print-libgcc-file-name; fi` `if [ -f ../gcc/crtend.o ]; then echo ../gcc/crtend.o; else ${CC} --print-file-name=crtend.o; fi` `${CC} --print-file-name=crtn.o`'
+ ;;
+
i[3456]86-*-bsd* | i[3456]86-*-freebsd* | i[3456]86-*-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
@@ -45,24 +64,24 @@ i[3456]86-*-bsd* | i[3456]86-*-freebsd* | i[3456]86-*-netbsd*)
;;
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'
+ 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 ${CC} -print-file-name=crtbegin.o; fi`'
+ HOSTING_LIBS='`if [ -f ../gcc/libgcc.a ] ; then echo ../gcc/libgcc.a ; else ${CC} -print-libgcc-file-name; fi` -lc `if [ -f ../gcc/crtend.o ]; then echo ../gcc/crtend.o; else ${CC} -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`'
+ HOSTING_CRT0='/lib/crt0.o `if [ -f ../gcc/crtbegin.o ]; then echo ../gcc/crtbegin.o; else ${CC} -print-file-name=crtbegin.o; fi`'
+ HOSTING_LIBS='`if [ -f ../gcc/libgcc.a ] ; then echo ../gcc/libgcc.a ; else ${CC} -print-libgcc-file-name; fi` -lc `if [ -f ../gcc/crtend.o ]; then echo ../gcc/crtend.o; else ${CC} -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'
+ HOSTING_LIBS='`if [ -f ../gcc/libgcc.a ] ; then echo ../gcc/libgcc.a ; else ${CC} -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`'
+ HOSTING_CRT0='`if [ -f ../gcc/crt1.o ]; then echo ../gcc/crt1.o; else ${CC} -print-file-name=crt1.o; fi` `if [ -f ../gcc/crti.o ]; then echo ../gcc/crti.o; else ${CC} -print-file-name=crti.o; fi` /usr/ccs/lib/values-Xa.o `if [ -f ../gcc/crtbegin.o ]; then echo ../gcc/crtbegin.o; else ${CC} -print-file-name=crtbegin.o; fi`'
+ HOSTING_LIBS='`if [ -f ../gcc/libgcc.a ] ; then echo ../gcc/libgcc.a ; else ${CC} -print-libgcc-file-name; fi` -lc `if [ -f ../gcc/crtend.o ]; then echo ../gcc/crtend.o; else ${CC} -print-file-name=crtend.o; fi` `if [ -f ../gcc/crtn.o ]; then echo ../gcc/crtn.o; else ${CC} -print-file-name=crtn.o; fi`'
NATIVE_LIB_DIRS=/usr/ccs/lib
;;
@@ -77,8 +96,8 @@ i[3456]86-*-sco* | i[3456]86-*-isc*)
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'
+ HOSTING_CRT0='/lib/crt1.o `if [ -f ../gcc/crtbegin.o ]; then echo ../gcc/crtbegin.o; else ${CC} -print-file-name=crtbegin.o; fi`'
+ HOSTING_LIBS='`if [ -f ../gcc/libgcc.a ] ; then echo ../gcc/libgcc.a ; else ${CC} -print-libgcc-file-name; fi` -lc `if [ -f ../gcc/crtend.o ]; then echo ../gcc/crtend.o; else ${CC} -print-file-name=crtend.o; fi` /lib/crtn.o'
;;
i[3456]86-*-linux*aout* | i[3456]86-*-linuxoldld)
@@ -86,18 +105,24 @@ i[3456]86-*-linux*aout* | i[3456]86-*-linuxoldld)
;;
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'
+ 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 ${CC} --print-file-name=crtbegin.o; fi`'
+ HOSTING_LIBS='`if [ -f ../gcc/libgcc.a ] ; then echo ../gcc/libgcc.a ; else ${CC} -print-libgcc-file-name; fi` -lc `if [ -f ../gcc/libgcc.a ] ; then echo ../gcc/libgcc.a ; else ${CC} -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 ${CC} --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`'
+ HOSTING_CRT0='-dynamic-linker `fgrep ld-linux.so \`${CC} --print-file-name=specs\` | sed -e "s,.*-dynamic-linker[ ][ ]*\(.*/ld-linux.so..\).*,\1,"` `${CC} --print-file-name=crt1.o` `${CC} --print-file-name=crti.o` `if [ -f ../gcc/crtbegin.o ]; then echo ../gcc/crtbegin.o; else ${CC} --print-file-name=crtbegin.o; fi`'
+ HOSTING_LIBS='`if [ -f ../gcc/libgcc.a ] ; then echo ../gcc/libgcc.a ; else ${CC} -print-libgcc-file-name; fi` -L`dirname \`${CC} --print-file-name=libc.so\`` -lc `if [ -f ../gcc/libgcc.a ] ; then echo ../gcc/libgcc.a ; else ${CC} -print-libgcc-file-name; fi` `if [ -f ../gcc/crtend.o ]; then echo ../gcc/crtend.o; else ${CC} --print-file-name=crtend.o; fi` `${CC} --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'
+ HOSTING_LIBS='`if [ -f ../gcc/libgcc.a ] ; then echo ../gcc/libgcc.a ; else ${CC} -print-libgcc-file-name; fi` -lc -lm /lib/initn.o'
+ ;;
+
+i[3456]86-pc-interix*)
+ HOSTING_CRT0='$$INTERIX_ROOT/usr/lib/crt0.o'
+ NATIVE_LIB_DIRS='$$INTERIX_ROOT/usr/lib/'
+ HOSTING_LIBS='`if [ -f ../gcc/libgcc.a ] ; then echo ../gcc/libgcc.a ; else ${CC} -print-libgcc-file-name; fi` -L $$X/local_bin -L $$INTERIX_ROOT/usr/lib -lc -lcpsx -lc -lcpsx $$INTERIX_ROOT/usr/lib/psxdll.a $$INTERIX_ROOT/usr/lib/psxdll2.a'
;;
mips*-dec-bsd*)
@@ -106,12 +131,22 @@ mips*-dec-bsd*)
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'
+ HOSTING_LIBS='`if [ -f ../gcc/libgcc.a ] ; then echo ../gcc/libgcc.a ; else ${CC} -print-libgcc-file-name; fi` -lc /usr/lib/crtn.o'
;;
-mips*-sgi-irix[56]*)
+mips*-sgi-irix5*)
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'
+ HOSTING_LIBS='`if [ -f ../gcc/libgcc.a ] ; then echo ../gcc/libgcc.a ; else ${CC} -print-libgcc-file-name; fi` -lc /usr/lib/crtn.o'
+ ;;
+
+mips*-sgi-irix6*)
+ HOSTING_CRT0='/usr/lib32/crt1.o `if [ -f ../gcc/crtbegin.o ]; then echo ../gcc/crtbegin.o ; else ${CC} -print-file-name=crtbegin.o; fi`'
+ HOSTING_LIBS='`if [ -f ../gcc/libgcc.a ] ; then echo ../gcc/libgcc.a ; else ${CC} -print-libgcc-file-name; fi` -L/usr/lib32 -lc `if [ -f ../gcc/crtend.o ]; then echo ../gcc/crtend.o ; else ${CC} -print-file-name=crtend.o; fi` /usr/lib32/crtn.o -init __do_global_ctors -fini __do_global_dtors'
+ ;;
+
+mips*-*-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 ${CC} --print-file-name=crtbegin.o; fi`'
+ HOSTING_LIBS='`if [ -f ../gcc/libgcc.a ] ; then echo ../gcc/libgcc.a ; else ${CC} -print-libgcc-file-name; fi` -lc `if [ -f ../gcc/libgcc.a ] ; then echo ../gcc/libgcc.a ; else ${CC} -print-libgcc-file-name; fi` `if [ -f ../gcc/crtend.o ]; then echo ../gcc/crtend.o; else ${CC} --print-file-name=crtend.o; fi` /usr/lib/crtn.o'
;;
m68*-*-linux*aout*)
@@ -119,23 +154,23 @@ m68*-*-linux*aout*)
;;
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'
+ 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 ${CC} --print-file-name=crtbegin.o; fi`'
+ HOSTING_LIBS='`if [ -f ../gcc/libgcc.a ] ; then echo ../gcc/libgcc.a ; else ${CC} -print-libgcc-file-name; fi` -lc `if [ -f ../gcc/libgcc.a ] ; then echo ../gcc/libgcc.a ; else ${CC} -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 ${CC} --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'
+ 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 ${CC} --print-file-name=crtbegin.o; fi`'
+ HOSTING_LIBS='`if [ -f ../gcc/libgcc.a ] ; then echo ../gcc/libgcc.a ; else ${CC} -print-libgcc-file-name; fi` -lc `if [ -f ../gcc/libgcc.a ] ; then echo ../gcc/libgcc.a ; else ${CC} -print-libgcc-file-name; fi` `if [ -f ../gcc/crtend.o ]; then echo ../gcc/crtend.o; else ${CC} --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'
+ HOSTING_LIBS='`if [ -f ../gcc/libgcc.a ] ; then echo ../gcc/libgcc.a ; else ${CC} -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`'
+ HOSTING_CRT0='`if [ -f ../gcc/crt0.o ]; then echo ../gcc/crt0.o; elif [ -f \`${CC} -print-file-name=\`crt0.o ]; then echo \`${CC} -print-file-name=\`crt0.o; else echo /lib/crt0.o; fi`'
+ HOSTING_LIBS='`if [ -f ../gcc/libgcc.a ] ; then echo ../gcc/libgcc.a ; else ${CC} -print-libgcc-file-name; fi` -lc881 `if [ -f ../gcc/libgcc.a ] ; then echo ../gcc/libgcc.a ; else ${CC} -print-libgcc-file-name; fi`'
;;
m68*-sun-*)
@@ -149,8 +184,13 @@ m88*-*-dgux*)
;;
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`'
+ HOSTING_CRT0='/lib/crt0.o `if [ -f ../gcc/crtbegin.o ]; then echo ../gcc/crtbegin.o; else ${CC} -print-file-name=crtbegin.o; fi`'
+ HOSTING_LIBS='`if [ -f ../gcc/libgcc.a ] ; then echo ../gcc/libgcc.a ; else ${CC} -print-libgcc-file-name; fi` -lc `if [ -f ../gcc/crtend.o ]; then echo ../gcc/crtend.o; else ${CC} -print-file-name=crtend.o; fi` `if [ -f ../gcc/libgcc.a ] ; then echo ../gcc/libgcc.a ; else ${CC} -print-libgcc-file-name; fi`'
+ ;;
+
+powerpc*-*-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 ${CC} --print-file-name=crtbegin.o; fi`'
+ HOSTING_LIBS='`if [ -f ../gcc/libgcc.a ] ; then echo ../gcc/libgcc.a ; else ${CC} -print-libgcc-file-name; fi` -lc `if [ -f ../gcc/libgcc.a ] ; then echo ../gcc/libgcc.a ; else ${CC} -print-libgcc-file-name; fi` `if [ -f ../gcc/crtend.o ]; then echo ../gcc/crtend.o; else ${CC} --print-file-name=crtend.o; fi` /usr/lib/crtn.o'
;;
romp-*-*)
@@ -158,9 +198,19 @@ romp-*-*)
;;
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`'
+ HOSTING_CRT0='`if [ -f ../gcc/crt1.o ]; then echo ../gcc/crt1.o; else ${CC} -print-file-name=crt1.o; fi` `if [ -f ../gcc/crti.o ]; then echo ../gcc/crti.o; else ${CC} -print-file-name=crti.o; fi` /usr/ccs/lib/values-Xa.o `if [ -f ../gcc/crtbegin.o ]; then echo ../gcc/crtbegin.o; else ${CC} -print-file-name=crtbegin.o; fi`'
+ HOSTING_LIBS='`if [ -f ../gcc/libgcc.a ] ; then echo ../gcc/libgcc.a ; else ${CC} -print-libgcc-file-name; fi` -lc `if [ -f ../gcc/crtend.o ]; then echo ../gcc/crtend.o; else ${CC} -print-file-name=crtend.o; fi` `if [ -f ../gcc/crtn.o ]; then echo ../gcc/crtn.o; else ${CC} -print-file-name=crtn.o; fi`'
NATIVE_LIB_DIRS=/usr/ccs/lib
;;
+sparc-*-linux-gnu*)
+ HOSTING_CRT0='-dynamic-linker /lib/ld-linux.so.2 `${CC} --print-file-name=crt1.o` `${CC} --print-file-name=crti.o` `if [ -f ../gcc/crtbegin.o ]; then echo ../gcc/crtbegin.o; else ${CC} --print-file-name=crtbegin.o; fi`'
+ HOSTING_LIBS='`if [ -f ../gcc/libgcc.a ] ; then echo ../gcc/libgcc.a ; else ${CC} -print-libgcc-file-name; fi` -L`dirname \`${CC} --print-file-name=libc.so\`` -lc `if [ -f ../gcc/libgcc.a ] ; then echo ../gcc/libgcc.a ; else ${CC} -print-libgcc-file-name; fi` `if [ -f ../gcc/crtend.o ]; then echo ../gcc/crtend.o; else ${CC} --print-file-name=crtend.o; fi` `${CC} --print-file-name=crtn.o`'
+ ;;
+
+sparc64-*-linux-gnu*)
+ HOSTING_CRT0='-dynamic-linker /lib64/ld-linux.so.2 `${CC} --print-file-name=crt1.o` `${CC} --print-file-name=crti.o` `if [ -f ../gcc/crtbegin.o ]; then echo ../gcc/crtbegin.o; else ${CC} --print-file-name=crtbegin.o; fi`'
+ HOSTING_LIBS='`if [ -f ../gcc/libgcc.a ] ; then echo ../gcc/libgcc.a ; else ${CC} -print-libgcc-file-name; fi` -L`dirname \`${CC} --print-file-name=libc.so\`` -lc `if [ -f ../gcc/libgcc.a ] ; then echo ../gcc/libgcc.a ; else ${CC} -print-libgcc-file-name; fi` `if [ -f ../gcc/crtend.o ]; then echo ../gcc/crtend.o; else ${CC} --print-file-name=crtend.o; fi` `${CC} --print-file-name=crtn.o`'
+ ;;
+
esac
diff --git a/contrib/binutils/ld/configure.in b/contrib/binutils/ld/configure.in
index dbadbe0..32fc5f6 100644
--- a/contrib/binutils/ld/configure.in
+++ b/contrib/binutils/ld/configure.in
@@ -1,11 +1,11 @@
dnl Process this file with autoconf to produce a configure script
dnl
-AC_PREREG(2.5)
+AC_PREREG(2.13)
AC_INIT(ldmain.c)
AC_CANONICAL_SYSTEM
-AM_INIT_AUTOMAKE(ld, 2.9.1)
+AM_INIT_AUTOMAKE(ld, 2.9.5)
AM_PROG_LIBTOOL
@@ -37,13 +37,15 @@ fi
# host-specific stuff:
AC_PROG_CC
-AM_PROG_INSTALL
-AM_CYGWIN32
-AM_EXEEXT
+AC_PROG_INSTALL
+
+ALL_LINGUAS=
+CY_GNU_GETTEXT
+
+AC_EXEEXT
AC_PROG_YACC
-AC_PROG_LEX
-AC_DECL_YYTEXT
+AM_PROG_LEX
AM_MAINTAINER_MODE
@@ -64,13 +66,40 @@ BFD_NEED_DECLARATION(strstr)
BFD_NEED_DECLARATION(free)
BFD_NEED_DECLARATION(sbrk)
BFD_NEED_DECLARATION(getenv)
+BFD_NEED_DECLARATION(environ)
+
+# When converting linker scripts into strings for use in emulation
+# files, use astring.sed if the compiler supports ANSI string
+# concatenation, or ostring.sed otherwise. This is to support the
+# broken Microsoft MSVC compiler, which limits the length of string
+# constants, while still supporting pre-ANSI compilers which do not
+# support string concatenation.
+AC_MSG_CHECKING([whether ANSI C string concatenation works])
+AC_CACHE_VAL(ld_cv_string_concatenation,
+[AC_TRY_COMPILE(,[char *a = "a" "a";],
+ [ld_cv_string_concatenation=yes],
+ [ld_cv_string_concatenation=no])])
+AC_MSG_RESULT($ld_cv_string_concatenation)
+if test "$ld_cv_string_concatenation" = "yes"; then
+ STRINGIFY=astring.sed
+else
+ STRINGIFY=ostring.sed
+fi
+AC_SUBST(STRINGIFY)
# target-specific stuff:
all_targets=
EMUL=
all_emuls=
-TDIRS=
+all_emul_extras=
+all_libpath=
+
+dnl We need to get an arbitrary number of tdir definitions into
+dnl Makefile. We can't do it using AC_SUBST, because autoconf does
+dnl not permit literal newlines in an AC_SUBST variables. So we use a
+dnl file.
+rm -f tdirs
for targ_alias in `echo $target_alias $enable_targets | sed 's/,/ /g'`
do
@@ -78,7 +107,7 @@ do
all_targets=true
else
# Canonicalize the secondary target names.
- result=`${CONFIG_SHELL-/bin/sh} $ac_config_sub $targ_alias 2>/dev/null`
+ result=`$ac_config_sub $targ_alias 2>/dev/null`
if test -n "$result"; then
targ=$result
else
@@ -91,15 +120,36 @@ do
EMUL=$targ_emul
fi
- for i in $targ_emul $targ_extra_emuls; do
+ for i in $targ_emul $targ_extra_emuls $targ_extra_libpath; 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"
+ echo tdir_$i=$result >> tdirs
+ ;;
+ esac
+ done
+
+ for i in $targ_emul $targ_extra_libpath; do
+ case " $all_libpath " in
+ *" ${i} "*) ;;
+ *)
+ if test -z "$all_libpath"; then
+ all_libpath=${i}
+ else
+ all_libpath="$all_libpath ${i}"
+ fi
+ ;;
+ esac
+ done
+
+ for i in $targ_extra_ofiles; do
+ case " $all_emul_extras " in
+ *" ${i} "*) ;;
+ *)
+ all_emul_extras="$all_emul_extras ${i}"
;;
esac
done
@@ -107,7 +157,9 @@ tdir_$i=$result"
done
AC_SUBST(EMUL)
-AC_SUBST(TDIRS)
+
+TDIRS=tdirs
+AC_SUBST_FILE(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
@@ -118,10 +170,16 @@ if test x${all_targets} = xtrue; then
else
EMULATION_OFILES='$(ALL_EMULATIONS)'
fi
+ EMUL_EXTRA_OFILES='$(ALL_EMUL_EXTRA_OFILES)'
else
EMULATION_OFILES=$all_emuls
+ EMUL_EXTRA_OFILES=$all_emul_extras
fi
AC_SUBST(EMULATION_OFILES)
+AC_SUBST(EMUL_EXTRA_OFILES)
+
+EMULATION_LIBPATH=$all_libpath
+AC_SUBST(EMULATION_LIBPATH)
if test x${enable_static} = xno; then
TESTBFDLIB="--rpath ../bfd/.libs ../bfd/.libs/libbfd.so"
@@ -130,4 +188,15 @@ else
fi
AC_SUBST(TESTBFDLIB)
-AC_OUTPUT(Makefile)
+target_vendor=${target_vendor=$host_vendor}
+case "$target_vendor" in
+ hp) EXTRA_SHLIB_EXTENSION=".sl" ;;
+ *) EXTRA_SHLIB_EXTENSION= ;;
+esac
+if test x${EXTRA_SHLIB_EXTENSION} != x ; then
+ AC_DEFINE_UNQUOTED(EXTRA_SHLIB_EXTENSION, "$EXTRA_SHLIB_EXTENSION",
+ [Additional extension a shared object might have.])
+fi
+
+AC_OUTPUT(Makefile po/Makefile.in:po/Make-in,
+[sed -e '/POTFILES =/r po/POTFILES' po/Makefile.in > po/Makefile])
diff --git a/contrib/binutils/ld/configure.tgt b/contrib/binutils/ld/configure.tgt
index 18c74c4..52715f4 100644
--- a/contrib/binutils/ld/configure.tgt
+++ b/contrib/binutils/ld/configure.tgt
@@ -7,13 +7,26 @@
# following shell variables:
# targ_emul name of linker emulation to use
# targ_extra_emuls additional linker emulations to provide
+# targ_extra_libpath additional linker emulations using LIB_PATH
+# targ_extra_ofiles additional objects needed by the emulation
targ_extra_emuls=
+targ_extra_ofiles=
case "${targ}" in
-arm-*-pe) targ_emul=armpe ;;
+arm-epoc-pe) targ_emul=arm_epoc_pe ;
+ targ_extra_ofiles="deffilep.o pe-dll.o" ;;
+arm-*-wince) targ_emul=armpe ;
+ targ_extra_ofiles="deffilep.o pe-dll.o" ;;
+arm-*-pe) targ_emul=armpe ;
+ targ_extra_ofiles="deffilep.o pe-dll.o" ;;
arc-*-elf*) targ_emul=arcelf ;;
+avr-*-*) targ_emul=avr85xx
+ targ_extra_emuls="avr1200 avr23xx avr44x4 avr4433 avrmega603 avrmega103 avrmega161" ;;
d10v-*-*) targ_emul=d10velf ;;
+d30v-*-*ext*) targ_emul=d30v_e; targ_extra_emuls="d30velf d30v_o" ;;
+d30v-*-*onchip*) targ_emul=d30v_o; targ_extra_emuls="d30velf d30v_e" ;;
+d30v-*-*) targ_emul=d30velf; targ_extra_emuls="d30v_e d30v_o" ;;
sparc64-*-aout*) targ_emul=sparcaout ;;
sparc64-*-elf*) targ_emul=elf64_sparc ;;
sparc-sun-sunos4*) targ_emul=sun4 ;;
@@ -36,12 +49,26 @@ sparc64-*-linux-gnu*) targ_emul=elf64_sparc
tdir_sun4=sparc-sun-sunos4
;;
sparc*-*-linux-gnu*) targ_emul=elf32_sparc
- targ_extra_emuls="sparclinux sun4"
+ targ_extra_emuls="sparclinux elf64_sparc sun4"
tdir_sparclinux=${targ_alias}aout
+ tdir_elf64_sparc=`echo ${targ_alias} | sed -e 's/32//'`
tdir_sun4=sparc-sun-sunos4
;;
sparc*-*-lynxos*) targ_emul=sparclynx ;;
sparc*-*-netbsd*) targ_emul=sparcnbsd ;;
+sparc-*-solaris2.[0-6] | sparc-*-solaris2.[0-6].*)
+ targ_emul=elf32_sparc ;;
+sparc-*-solaris2*) targ_emul=elf32_sparc
+ targ_extra_emuls="elf64_sparc"
+ targ_extra_libpath=$targ_extra_emuls
+ tdir_elf64_sparc=`echo ${targ_alias} | sed -e 's/32//'`
+ ;;
+sparcv9-*-solaris2* | sparc64-*-solaris2*)
+ targ_emul=elf64_sparc
+ targ_extra_emuls="elf32_sparc"
+ targ_extra_libpath=$targ_extra_emuls
+ tdir_elf32_sparc=`echo ${targ_alias} | sed -e 's/64//'`
+ ;;
sparc*-*-solaris2*) targ_emul=elf32_sparc ;;
sparc*-wrs-vxworks*) targ_emul=sparcaout ;;
sparc*-*-rtems*) targ_emul=sparcaout ;;
@@ -51,12 +78,15 @@ i960-wrs-vxworks*) targ_emul=gld960 ;;
i960-*-coff) targ_emul=gld960coff ;;
i960-intel-nindy) targ_emul=gld960 ;;
i960-*-rtems*) targ_emul=gld960coff ;;
+i960-*-elf*) targ_emul=elf32_i960 ;;
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 ;;
+i370-*-elf* | i370-*-linux-gnu*) targ_emul=elf32i370 ;;
+i370-*-mvs*) targ_emul=mvs ;;
i[3456]86-*-vsta) targ_emul=vsta ;;
i[3456]86-go32-rtems*) targ_emul=i386go32 ;;
i[3456]86-*-go32) targ_emul=i386go32 ;;
@@ -66,6 +96,7 @@ 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-*-rtemself*) targ_emul=elf_i386 ;;
i[3456]86-*-rtems*) targ_emul=i386coff ;;
i[3456]86-*-bsd) targ_emul=i386bsd ;;
i[3456]86-*-bsd386) targ_emul=i386bsd ;;
@@ -81,22 +112,34 @@ i[3456]86-*-linux-gnu*) targ_emul=elf_i386
tdir_i386linux=${targ_alias}aout
;;
i[3456]86-*-sysv4*) targ_emul=elf_i386 ;;
+i[3456]86-*-solaris2*) targ_emul=elf_i386 ;;
i[3456]86-*-unixware) targ_emul=elf_i386 ;;
+i[3456]86-*-solaris*) 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-*-freebsdaout* | i[3456]86-*-freebsd[12].* | i[3456]86-*-freebsd[12])
+ targ_emul=i386bsd ;;
+i[3456]86-*-freebsd*) targ_emul=elf_i386 ;;
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 ;;
+i[3456]86-*-winnt*) targ_emul=i386pe ;
+ targ_extra_ofiles="deffilep.o pe-dll.o" ;;
+i[3456]86-*-pe) targ_emul=i386pe ;
+ targ_extra_ofiles="deffilep.o pe-dll.o" ;;
+i[3456]86-*-cygwin*) targ_emul=i386pe ;
+ targ_extra_ofiles="deffilep.o pe-dll.o" ;;
+i[3456]86-*-mingw32*) targ_emul=i386pe ;
+ targ_extra_ofiles="deffilep.o pe-dll.o" ;;
+i[3456]86-*-interix*) targ_emul=i386pe_posix;
+ targ_extra_ofiles="deffilep.o pe-dll.o" ;;
+i[3456]86-*-beospe*) targ_emul=i386beos ;;
+i[3456]86-*-beos*) targ_emul=elf_i386_be ;;
+i[3456]86-*-vxworks*) targ_emul=i386aout ;;
m8*-*-*) targ_emul=m88kbcs ;;
a29k-*-udi) targ_emul=sa29200 ;;
a29k-*-ebmon) targ_emul=ebmon29k ;;
@@ -105,16 +148,35 @@ a29k-*-*) targ_emul=a29k ;;
arm-*-aout | armel-*-aout) targ_emul=armaoutl ;;
armeb-*-aout) targ_emul=armaoutb ;;
arm-*-coff) targ_emul=armcoff ;;
+arm-*-netbsd*) targ_emul=armnbsd ;;
+arm-*-elf) targ_emul=armelf ;;
+arm-*-oabi) targ_emul=armelf_oabi ;;
+arm*-*-linux-gnu*) targ_emul=armelf_linux; targ_extra_emuls="armelf_linux26 armelf" ;;
+arm*-*-uclinux*) targ_emul=armelf_linux; targ_extra_emuls=armelf ;;
+arm*-*-conix*) targ_emul=armelf ;;
+thumb-*-linux-gnu* | thumb-*-uclinux*) targ_emul=armelf_linux; targ_extra_emuls=armelf ;;
+strongarm-*-coff) targ_emul=armcoff ;;
+strongarm-*-elf) targ_emul=armelf ;;
thumb-*-coff) targ_emul=armcoff ;;
-thumb-*-pe) targ_emul=armpe ;;
-h8300-*-hms) targ_emul=h8300; targ_extra_emuls="h8300h h8300s"
+thumb-*-elf) targ_emul=armelf ;;
+thumb-*-oabi) targ_emul=armelf_oabi ;;
+thumb-epoc-pe) targ_emul=arm_epoc_pe ;
+ targ_extra_ofiles="deffilep.o pe-dll.o" ;;
+thumb-*-pe) targ_emul=armpe ;
+ targ_extra_ofiles="deffilep.o pe-dll.o" ;;
+h8300-*-hms* | h8300-*-coff*)
+ targ_emul=h8300; targ_extra_emuls="h8300h h8300s"
;;
-h8500-*-hms) targ_emul=h8500
+h8500-*-hms* | h8500-*-coff*)
+ targ_emul=h8500
targ_extra_emuls="h8500s h8500b h8500m h8500c"
;;
-sh-*-elf*) targ_emul=shelf
+sh-*-elf* | sh-*-rtemself*)
+ targ_emul=shelf
targ_extra_emuls="shlelf sh shl"
;;
+sh-*-pe) targ_emul=shpe ;
+ targ_extra_ofiles="deffilep.o pe-dll.o" ;;
sh-*-*|sh-*-rtems*) targ_emul=sh; targ_extra_emuls=shl ;;
m68k-sony-*) targ_emul=news ;;
m68k-hp-bsd*) targ_emul=hp300bsd ;;
@@ -131,18 +193,26 @@ m68k-*-linux-gnu*) targ_emul=m68kelf
targ_extra_emuls=m68klinux
tdir_m68klinux=`echo ${targ_alias} | sed -e 's/linux/linuxaout/'`
;;
+m68*-*-gnu*) targ_emul=m68kelf ;;
m68*-*-lynxos*) targ_emul=m68klynx ;;
m68*-hp*-netbsd*) targ_emul=m68k4knbsd ;;
m68*-*-netbsd*) targ_emul=m68knbsd ;;
m68*-*-psos*) targ_emul=m68kpsos ;;
m68*-*-rtems*) targ_emul=m68kcoff ;;
+hppa*w*-*) targ_emul=elf64hppa ;;
hppa*-*-*elf*) targ_emul=hppaelf ;;
+hppa*-*-linux-gnu*) targ_emul=hppaelf ;;
hppa*-*-lites*) targ_emul=hppaelf ;;
hppa*-*-rtems*) targ_emul=hppaelf ;;
vax-dec-ultrix* | vax-dec-bsd*) targ_emul=vax ;;
+mips*-*-pe) targ_emul=mipspe ;
+ targ_extra_ofiles="deffilep.o pe-dll.o" ;;
mips*-dec-ultrix*) targ_emul=mipslit ;;
mips*-dec-osf*) targ_emul=mipslit ;;
-mips*-sgi-irix[56]*) targ_emul=elf32bsmip ;;
+mips*-sgi-irix5*) targ_emul=elf32bsmip ;;
+mips*-sgi-irix6*) targ_emul=elf32bmipn32
+ targ_extra_emuls="elf32bsmip elf64bmip"
+ ;;
mips*-sgi-irix*) targ_emul=mipsbig ;;
mips*el-*-ecoff*) targ_emul=mipsidtl ;;
mips*-*-ecoff*) targ_emul=mipsidt ;;
@@ -157,7 +227,10 @@ mips*vr5000el-*-elf*) targ_emul=elf32l4300 ;;
mips*vr5000-*-elf*) targ_emul=elf32b4300 ;;
mips*el-*-elf*) targ_emul=elf32elmip ;;
mips*-*-elf*) targ_emul=elf32ebmip ;;
+mips*el-*-rtems*) targ_emul=elf32elmip ;;
mips*-*-rtems*) targ_emul=elf32ebmip ;;
+mips*el-*-vxworks*) targ_emul=elf32elmip ;;
+mips*-*-vxworks*) targ_emul=elf32ebmip ;;
mips*el-*-linux-gnu*) targ_emul=elf32lsmip
targ_extra_emuls="elf32bsmip mipslit mipsbig"
;;
@@ -180,26 +253,37 @@ 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*)
+powerpc-*-linux-gnu*) targ_emul=elf32ppclinux; targ_extra_emuls=elf32ppc;
+ targ_extra_libpath=elf32ppc ;;
+pjl*-*-*) targ_emul=pjlelf ; targ_extra_emuls="elf_i386" ;;
+pj*-*-*) targ_emul=pjelf ;;
+powerpc-*-elf* | powerpc-*-eabi* | powerpc-*-sysv* \
+ | powerpc-*-netbsd* | powerpc-*-vxworks*)
targ_emul=elf32ppc ;;
-powerpcle-*-elf* | powerpcle-*-eabi* | powerpcle-*-solaris* | powerpcle-*-sysv*) targ_emul=elf32lppc ;;
+powerpcle-*-elf* | powerpcle-*-eabi* | powerpcle-*-solaris* \
+ | powerpcle-*-sysv* | powerpcle-*-vxworks*)
+ targ_emul=elf32lppc ;;
+powerpcle-*-rtems*) targ_emul=elf32leppc ;;
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 ;;
+powerpcle-*-cygwin*) 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 ;;
+tic80-*-*) targ_emul=tic80coff ;;
v850-*-*) targ_emul=v850 ;;
+v850e-*-*) targ_emul=v850 ;;
+v850ea-*-*) 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 ;;
+fr30-*-*) targ_emul=elf32fr30 ;;
+mcore-*-pe) targ_emul=mcorepe ;
+ targ_extra_ofiles="deffilep.o pe-dll.o" ;;
+mcore-*-elf) targ_emul=elf32mcore ;;
*-*-ieee*) targ_emul=vanilla ;;
*)
diff --git a/contrib/binutils/ld/deffile.h b/contrib/binutils/ld/deffile.h
new file mode 100644
index 0000000..e2c710d
--- /dev/null
+++ b/contrib/binutils/ld/deffile.h
@@ -0,0 +1,128 @@
+/* deffile.h - header for .DEF file parser
+ Copyright (C) 1998, 1999 Free Software Foundation, Inc.
+ Written by DJ Delorie dj@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. */
+
+#ifndef DEFFILE_H
+#define DEFFILE_H
+
+#include "ansidecl.h"
+
+/* DEF storage definitions. Note that any ordinal may be zero, and
+ any pointer may be NULL, if not defined by the DEF file. */
+
+typedef struct def_file_section
+ {
+ char *name; /* always set */
+ char *class; /* may be NULL */
+ char flag_read, flag_write, flag_execute, flag_shared;
+ }
+def_file_section;
+
+typedef struct def_file_export
+ {
+ char *name; /* always set */
+ char *internal_name; /* always set, may == name */
+ int ordinal; /* -1 if not specified */
+ int hint;
+ char flag_private, flag_constant, flag_noname, flag_data;
+ }
+def_file_export;
+
+typedef struct def_file_module
+ {
+ struct def_file_module *next;
+ void *user_data;
+ char name[1]; /* extended via malloc */
+ }
+def_file_module;
+
+typedef struct def_file_import
+ {
+ char *internal_name; /* always set */
+ def_file_module *module; /* always set */
+ char *name; /* may be NULL; either this or ordinal will be set */
+ int ordinal; /* may be -1 */
+ }
+def_file_import;
+
+typedef struct def_file
+ {
+
+ /* from the NAME or LIBRARY command */
+ char *name;
+ int is_dll; /* -1 if NAME/LIBRARY not given */
+ bfd_vma base_address; /* (bfd_vma)(-1) if unspecified */
+
+ /* from the DESCRIPTION command */
+ char *description;
+
+ /* from the STACK/HEAP command, -1 if unspecified */
+ int stack_reserve, stack_commit;
+ int heap_reserve, heap_commit;
+
+ /* from the SECTION/SEGMENT commands */
+ int num_section_defs;
+ def_file_section *section_defs;
+
+ /* from the EXPORTS commands */
+ int num_exports;
+ def_file_export *exports;
+
+ /* used by imports for module names */
+ def_file_module *modules;
+
+ /* from the IMPORTS commands */
+ int num_imports;
+ def_file_import *imports;
+
+ /* from the VERSION command, -1 if not specified */
+ int version_major, version_minor;
+ }
+def_file;
+
+extern def_file *def_file_empty PARAMS ((void));
+
+/* add_to may be NULL. If not, this .def is appended to it */
+extern def_file *def_file_parse PARAMS ((const char *_filename,
+ def_file * _add_to));
+
+extern void def_file_free PARAMS ((def_file * _def));
+
+extern def_file_export *def_file_add_export PARAMS ((def_file * _def,
+ const char *_name,
+ const char *_internal_name,
+ int _ordinal));
+
+extern def_file_import *def_file_add_import PARAMS ((def_file * _def,
+ const char *_name,
+ const char *_from,
+ int _ordinal,
+ const char *_imported_name));
+
+extern void def_file_add_directive PARAMS ((def_file * _def,
+ const char *param,
+ int len));
+
+#ifdef DEF_FILE_PRINT
+extern void def_file_print PARAMS ((FILE * _file,
+ def_file * _def));
+#endif
+
+#endif /* DEFFILE_H */
diff --git a/contrib/binutils/ld/deffilep.y b/contrib/binutils/ld/deffilep.y
new file mode 100644
index 0000000..760167b
--- /dev/null
+++ b/contrib/binutils/ld/deffilep.y
@@ -0,0 +1,1024 @@
+%{ /* deffilep.y - parser for .def files */
+
+/* Copyright (C) 1995, 1997, 1998, 1999, 2000 Free Software Foundation, Inc.
+
+This file is part of GNU Binutils.
+
+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. */
+
+#include <stdio.h>
+#include <ctype.h>
+#include "libiberty.h"
+#include "bfd.h"
+#include "sysdep.h"
+#include "ld.h"
+#include "ldmisc.h"
+#include "deffile.h"
+
+#define TRACE 0
+
+#define ROUND_UP(a, b) (((a)+((b)-1))&~((b)-1))
+
+/* Remap normal yacc parser interface names (yyparse, yylex, yyerror, etc),
+ as well as gratuitiously global symbol names, so we can have multiple
+ yacc generated parsers in ld. Note that these are only the variables
+ produced by yacc. If other parser generators (bison, byacc, etc) produce
+ additional global names that conflict at link time, then those parser
+ generators need to be fixed instead of adding those names to this list. */
+
+#define yymaxdepth def_maxdepth
+#define yyparse def_parse
+#define yylex def_lex
+#define yyerror def_error
+#define yylval def_lval
+#define yychar def_char
+#define yydebug def_debug
+#define yypact def_pact
+#define yyr1 def_r1
+#define yyr2 def_r2
+#define yydef def_def
+#define yychk def_chk
+#define yypgo def_pgo
+#define yyact def_act
+#define yyexca def_exca
+#define yyerrflag def_errflag
+#define yynerrs def_nerrs
+#define yyps def_ps
+#define yypv def_pv
+#define yys def_s
+#define yy_yys def_yys
+#define yystate def_state
+#define yytmp def_tmp
+#define yyv def_v
+#define yy_yyv def_yyv
+#define yyval def_val
+#define yylloc def_lloc
+#define yyreds def_reds /* With YYDEBUG defined */
+#define yytoks def_toks /* With YYDEBUG defined */
+#define yylhs def_yylhs
+#define yylen def_yylen
+#define yydefred def_yydefred
+#define yydgoto def_yydgoto
+#define yysindex def_yysindex
+#define yyrindex def_yyrindex
+#define yygindex def_yygindex
+#define yytable def_yytable
+#define yycheck def_yycheck
+
+static int def_lex ();
+
+static void def_description PARAMS ((const char *));
+static void def_exports PARAMS ((const char *, const char *, int, int));
+static void def_heapsize PARAMS ((int, int));
+static void def_import
+ PARAMS ((const char *, const char *, const char *, const char *, int));
+static void def_library PARAMS ((const char *, int));
+static void def_name PARAMS ((const char *, int));
+static void def_section PARAMS ((const char *, int));
+static void def_section_alt PARAMS ((const char *, const char *));
+static void def_stacksize PARAMS ((int, int));
+static void def_version PARAMS ((int, int));
+static void def_directive PARAMS ((char *));
+static int def_parse PARAMS ((void));
+static int def_error PARAMS ((const char *));
+static int def_lex PARAMS ((void));
+
+static int lex_forced_token = 0;
+static const char *lex_parse_string = 0;
+static const char *lex_parse_string_end = 0;
+
+%}
+
+%union {
+ char *id;
+ int number;
+};
+
+%token NAME, LIBRARY, DESCRIPTION, STACKSIZE, HEAPSIZE, CODE, DATAU, DATAL
+%token SECTIONS, EXPORTS, IMPORTS, VERSIONK, BASE, CONSTANTU, CONSTANTL
+%token PRIVATEU, PRIVATEL
+%token READ WRITE EXECUTE SHARED NONAMEU NONAMEL DIRECTIVE
+%token <id> ID
+%token <number> NUMBER
+%type <number> opt_base opt_ordinal
+%type <number> attr attr_list opt_number exp_opt_list exp_opt
+%type <id> opt_name opt_equal_name
+
+%%
+
+start: start command
+ | command
+ ;
+
+command:
+ NAME opt_name opt_base { def_name ($2, $3); }
+ | LIBRARY opt_name opt_base { def_library ($2, $3); }
+ | DESCRIPTION ID { def_description ($2);}
+ | STACKSIZE NUMBER opt_number { def_stacksize ($2, $3);}
+ | HEAPSIZE NUMBER opt_number { def_heapsize ($2, $3);}
+ | CODE attr_list { def_section ("CODE", $2);}
+ | DATAU attr_list { def_section ("DATA", $2);}
+ | SECTIONS seclist
+ | EXPORTS explist
+ | IMPORTS implist
+ | VERSIONK NUMBER { def_version ($2, 0);}
+ | VERSIONK NUMBER '.' NUMBER { def_version ($2, $4);}
+ | DIRECTIVE ID { def_directive ($2);}
+ ;
+
+
+explist:
+ /* EMPTY */
+ | expline
+ | explist expline
+ ;
+
+expline:
+ /* The opt_comma is necessary to support both the usual
+ DEF file syntax as well as .drectve syntax which
+ mandates <expsym>,<expoptlist>. */
+ ID opt_equal_name opt_ordinal opt_comma exp_opt_list
+ { def_exports ($1, $2, $3, $5); }
+ ;
+exp_opt_list:
+ /* The opt_comma is necessary to support both the usual
+ DEF file syntax as well as .drectve syntax which
+ allows for comma separated opt list. */
+ exp_opt opt_comma exp_opt_list { $$ = $1 | $3; }
+ | { $$ = 0; }
+ ;
+exp_opt:
+ NONAMEU { $$ = 1; }
+ | NONAMEL { $$ = 1; }
+ | CONSTANTU { $$ = 2; }
+ | CONSTANTL { $$ = 2; }
+ | DATAU { $$ = 4; }
+ | DATAL { $$ = 4; }
+ | PRIVATEU { $$ = 8; }
+ | PRIVATEL { $$ = 8; }
+ ;
+implist:
+ implist impline
+ | impline
+ ;
+
+impline:
+ ID '=' ID '.' ID '.' ID { def_import ($1, $3, $5, $7, -1); }
+ | ID '=' ID '.' ID '.' NUMBER { def_import ($1, $3, $5, 0, $7); }
+ | ID '=' ID '.' ID { def_import ($1, $3, 0, $5, -1); }
+ | ID '=' ID '.' NUMBER { def_import ($1, $3, 0, 0, $5); }
+ | ID '.' ID '.' ID { def_import ( 0, $1, $3, $5, -1); }
+ | ID '.' ID { def_import ( 0, $1, 0, $3, -1); }
+;
+
+seclist:
+ seclist secline
+ | secline
+ ;
+
+secline:
+ ID attr_list { def_section ($1, $2);}
+ | ID ID { def_section_alt ($1, $2);}
+ ;
+
+attr_list:
+ attr_list opt_comma attr { $$ = $1 | $3; }
+ | attr { $$ = $1; }
+ ;
+
+opt_comma:
+ ','
+ |
+ ;
+opt_number: ',' NUMBER { $$=$2;}
+ | { $$=-1;}
+ ;
+
+attr:
+ READ { $$ = 1;}
+ | WRITE { $$ = 2;}
+ | EXECUTE { $$=4;}
+ | SHARED { $$=8;}
+ ;
+
+opt_name: ID { $$ = $1; }
+ | ID '.' ID
+ {
+ char * name = xmalloc (strlen ($1) + 1 + strlen ($3) + 1);
+ sprintf (name, "%s.%s", $1, $3);
+ $$ = name;
+ }
+ | { $$ = ""; }
+ ;
+
+opt_ordinal:
+ '@' NUMBER { $$ = $2;}
+ | { $$ = -1;}
+ ;
+
+opt_equal_name:
+ '=' ID { $$ = $2; }
+ | { $$ = 0; }
+ ;
+
+opt_base: BASE '=' NUMBER { $$ = $3;}
+ | { $$ = 0;}
+ ;
+
+
+
+%%
+
+/*****************************************************************************
+ API
+ *****************************************************************************/
+
+static FILE *the_file;
+static const char *def_filename;
+static int linenumber;
+static def_file *def;
+static int saw_newline;
+
+struct directive
+ {
+ struct directive *next;
+ char *name;
+ int len;
+ };
+
+static struct directive *directives = 0;
+
+def_file *
+def_file_empty ()
+{
+ def_file *rv = (def_file *) xmalloc (sizeof (def_file));
+ memset (rv, 0, sizeof (def_file));
+ rv->is_dll = -1;
+ rv->base_address = (bfd_vma) (-1);
+ rv->stack_reserve = rv->stack_commit = -1;
+ rv->heap_reserve = rv->heap_commit = -1;
+ rv->version_major = rv->version_minor = -1;
+ return rv;
+}
+
+def_file *
+def_file_parse (filename, add_to)
+ const char *filename;
+ def_file *add_to;
+{
+ struct directive *d;
+
+ the_file = fopen (filename, "r");
+ def_filename = filename;
+ linenumber = 1;
+ if (!the_file)
+ {
+ perror (filename);
+ return 0;
+ }
+ if (add_to)
+ {
+ def = add_to;
+ }
+ else
+ {
+ def = def_file_empty ();
+ }
+
+ saw_newline = 1;
+ if (def_parse ())
+ {
+ def_file_free (def);
+ fclose (the_file);
+ return 0;
+ }
+
+ fclose (the_file);
+
+ for (d = directives; d; d = d->next)
+ {
+#if TRACE
+ printf ("Adding directive %08x `%s'\n", d->name, d->name);
+#endif
+ def_file_add_directive (def, d->name, d->len);
+ }
+
+ return def;
+}
+
+void
+def_file_free (def)
+ def_file *def;
+{
+ int i;
+ if (!def)
+ return;
+ if (def->name)
+ free (def->name);
+ if (def->description)
+ free (def->description);
+
+ if (def->section_defs)
+ {
+ for (i = 0; i < def->num_section_defs; i++)
+ {
+ if (def->section_defs[i].name)
+ free (def->section_defs[i].name);
+ if (def->section_defs[i].class)
+ free (def->section_defs[i].class);
+ }
+ free (def->section_defs);
+ }
+
+ if (def->exports)
+ {
+ for (i = 0; i < def->num_exports; i++)
+ {
+ if (def->exports[i].internal_name
+ && def->exports[i].internal_name != def->exports[i].name)
+ free (def->exports[i].internal_name);
+ if (def->exports[i].name)
+ free (def->exports[i].name);
+ }
+ free (def->exports);
+ }
+
+ if (def->imports)
+ {
+ for (i = 0; i < def->num_imports; i++)
+ {
+ if (def->imports[i].internal_name
+ && def->imports[i].internal_name != def->imports[i].name)
+ free (def->imports[i].internal_name);
+ if (def->imports[i].name)
+ free (def->imports[i].name);
+ }
+ free (def->imports);
+ }
+
+ while (def->modules)
+ {
+ def_file_module *m = def->modules;
+ def->modules = def->modules->next;
+ free (m);
+ }
+
+ free (def);
+}
+
+#ifdef DEF_FILE_PRINT
+void
+def_file_print (file, def)
+ FILE *file;
+ def_file *def;
+{
+ int i;
+ fprintf (file, ">>>> def_file at 0x%08x\n", def);
+ if (def->name)
+ fprintf (file, " name: %s\n", def->name ? def->name : "(unspecified)");
+ if (def->is_dll != -1)
+ fprintf (file, " is dll: %s\n", def->is_dll ? "yes" : "no");
+ if (def->base_address != (bfd_vma) (-1))
+ fprintf (file, " base address: 0x%08x\n", def->base_address);
+ if (def->description)
+ fprintf (file, " description: `%s'\n", def->description);
+ if (def->stack_reserve != -1)
+ fprintf (file, " stack reserve: 0x%08x\n", def->stack_reserve);
+ if (def->stack_commit != -1)
+ fprintf (file, " stack commit: 0x%08x\n", def->stack_commit);
+ if (def->heap_reserve != -1)
+ fprintf (file, " heap reserve: 0x%08x\n", def->heap_reserve);
+ if (def->heap_commit != -1)
+ fprintf (file, " heap commit: 0x%08x\n", def->heap_commit);
+
+ if (def->num_section_defs > 0)
+ {
+ fprintf (file, " section defs:\n");
+ for (i = 0; i < def->num_section_defs; i++)
+ {
+ fprintf (file, " name: `%s', class: `%s', flags:",
+ def->section_defs[i].name, def->section_defs[i].class);
+ if (def->section_defs[i].flag_read)
+ fprintf (file, " R");
+ if (def->section_defs[i].flag_write)
+ fprintf (file, " W");
+ if (def->section_defs[i].flag_execute)
+ fprintf (file, " X");
+ if (def->section_defs[i].flag_shared)
+ fprintf (file, " S");
+ fprintf (file, "\n");
+ }
+ }
+
+ if (def->num_exports > 0)
+ {
+ fprintf (file, " exports:\n");
+ for (i = 0; i < def->num_exports; i++)
+ {
+ fprintf (file, " name: `%s', int: `%s', ordinal: %d, flags:",
+ def->exports[i].name, def->exports[i].internal_name,
+ def->exports[i].ordinal);
+ if (def->exports[i].flag_private)
+ fprintf (file, " P");
+ if (def->exports[i].flag_constant)
+ fprintf (file, " C");
+ if (def->exports[i].flag_noname)
+ fprintf (file, " N");
+ if (def->exports[i].flag_data)
+ fprintf (file, " D");
+ fprintf (file, "\n");
+ }
+ }
+
+ if (def->num_imports > 0)
+ {
+ fprintf (file, " imports:\n");
+ for (i = 0; i < def->num_imports; i++)
+ {
+ fprintf (file, " int: %s, from: `%s', name: `%s', ordinal: %d\n",
+ def->imports[i].internal_name,
+ def->imports[i].module,
+ def->imports[i].name,
+ def->imports[i].ordinal);
+ }
+ }
+ if (def->version_major != -1)
+ fprintf (file, " version: %d.%d\n", def->version_major, def->version_minor);
+ fprintf (file, "<<<< def_file at 0x%08x\n", def);
+}
+#endif
+
+def_file_export *
+def_file_add_export (def, external_name, internal_name, ordinal)
+ def_file *def;
+ const char *external_name;
+ const char *internal_name;
+ int ordinal;
+{
+ def_file_export *e;
+ int max_exports = ROUND_UP(def->num_exports, 32);
+ if (def->num_exports >= max_exports)
+ {
+ max_exports = ROUND_UP(def->num_exports+1, 32);
+ if (def->exports)
+ def->exports = (def_file_export *) xrealloc (def->exports, max_exports * sizeof (def_file_export));
+ else
+ def->exports = (def_file_export *) xmalloc (max_exports * sizeof (def_file_export));
+ }
+ e = def->exports + def->num_exports;
+ memset (e, 0, sizeof (def_file_export));
+ if (internal_name && !external_name)
+ external_name = internal_name;
+ if (external_name && !internal_name)
+ internal_name = external_name;
+ e->name = xstrdup (external_name);
+ e->internal_name = xstrdup (internal_name);
+ e->ordinal = ordinal;
+ def->num_exports++;
+ return e;
+}
+
+static def_file_module *
+def_stash_module (def, name)
+ def_file *def;
+ char *name;
+{
+ def_file_module *s;
+ for (s=def->modules; s; s=s->next)
+ if (strcmp (s->name, name) == 0)
+ return s;
+ s = (def_file_module *) xmalloc (sizeof (def_file_module) + strlen (name));
+ s->next = def->modules;
+ def->modules = s;
+ s->user_data = 0;
+ strcpy (s->name, name);
+ return s;
+}
+
+def_file_import *
+def_file_add_import (def, name, module, ordinal, internal_name)
+ def_file *def;
+ const char *name;
+ const char *module;
+ int ordinal;
+ const char *internal_name;
+{
+ def_file_import *i;
+ int max_imports = ROUND_UP(def->num_imports, 16);
+ if (def->num_imports >= max_imports)
+ {
+ max_imports = ROUND_UP(def->num_imports+1, 16);
+ if (def->imports)
+ def->imports = (def_file_import *) xrealloc (def->imports, max_imports * sizeof (def_file_import));
+ else
+ def->imports = (def_file_import *) xmalloc (max_imports * sizeof (def_file_import));
+ }
+ i = def->imports + def->num_imports;
+ memset (i, 0, sizeof (def_file_import));
+ if (name)
+ i->name = xstrdup (name);
+ if (module)
+ i->module = def_stash_module(def, module);
+ i->ordinal = ordinal;
+ if (internal_name)
+ i->internal_name = xstrdup (internal_name);
+ else
+ i->internal_name = i->name;
+ def->num_imports++;
+ return i;
+}
+
+struct
+{
+ char *param;
+ int token;
+}
+diropts[] =
+{
+ { "-heap", HEAPSIZE },
+ { "-stack", STACKSIZE },
+ { "-attr", SECTIONS },
+ { "-export", EXPORTS },
+ { 0, 0 }
+};
+
+void
+def_file_add_directive (my_def, param, len)
+ def_file *my_def;
+ const char *param;
+ int len;
+{
+ def_file *save_def = def;
+ const char *pend = param + len;
+ const char *tend = param;
+ int i;
+
+ def = my_def;
+
+ while (param < pend)
+ {
+ while (param < pend && isspace (*param))
+ param++;
+ for (tend = param + 1;
+ tend < pend && !(isspace (tend[-1]) && *tend == '-');
+ tend++);
+
+ for (i = 0; diropts[i].param; i++)
+ {
+ int len = strlen (diropts[i].param);
+ if (tend - param >= len
+ && strncmp (param, diropts[i].param, len) == 0
+ && (param[len] == ':' || param[len] == ' '))
+ {
+ lex_parse_string_end = tend;
+ lex_parse_string = param + len + 1;
+ lex_forced_token = diropts[i].token;
+ saw_newline = 0;
+ def_parse ();
+ break;
+ }
+ }
+
+ if (!diropts[i].param)
+ {
+ /* xgettext:c-format */
+ einfo (_("Warning: .drectve `%.*s' unrecognized\n"),
+ tend - param, param);
+ }
+ lex_parse_string = 0;
+ param = tend;
+ }
+
+ def = save_def;
+}
+
+/*****************************************************************************
+ Parser Callbacks
+ *****************************************************************************/
+
+static void
+def_name (name, base)
+ const char *name;
+ int base;
+{
+ if (def->name)
+ free (def->name);
+ def->name = xstrdup (name);
+ def->base_address = base;
+ def->is_dll = 0;
+}
+
+static void
+def_library (name, base)
+ const char *name;
+ int base;
+{
+ if (def->name)
+ free (def->name);
+ def->name = xstrdup (name);
+ def->base_address = base;
+ def->is_dll = 1;
+}
+
+static void
+def_description (text)
+ const char *text;
+{
+ int len = def->description ? strlen (def->description) : 0;
+ len += strlen (text) + 1;
+ if (def->description)
+ {
+ def->description = (char *) xrealloc (def->description, len);
+ strcat (def->description, text);
+ }
+ else
+ {
+ def->description = (char *) xmalloc (len);
+ strcpy (def->description, text);
+ }
+}
+
+static void
+def_stacksize (reserve, commit)
+ int reserve;
+ int commit;
+{
+ def->stack_reserve = reserve;
+ def->stack_commit = commit;
+}
+
+static void
+def_heapsize (reserve, commit)
+ int reserve;
+ int commit;
+{
+ def->heap_reserve = reserve;
+ def->heap_commit = commit;
+}
+
+static void
+def_section (name, attr)
+ const char *name;
+ int attr;
+{
+ def_file_section *s;
+ int max_sections = ROUND_UP(def->num_section_defs, 4);
+ if (def->num_section_defs >= max_sections)
+ {
+ max_sections = ROUND_UP(def->num_section_defs+1, 4);
+ if (def->section_defs)
+ def->section_defs = (def_file_section *) xrealloc (def->section_defs, max_sections * sizeof (def_file_import));
+ else
+ def->section_defs = (def_file_section *) xmalloc (max_sections * sizeof (def_file_import));
+ }
+ s = def->section_defs + def->num_section_defs;
+ memset (s, 0, sizeof (def_file_section));
+ s->name = xstrdup (name);
+ if (attr & 1)
+ s->flag_read = 1;
+ if (attr & 2)
+ s->flag_write = 1;
+ if (attr & 4)
+ s->flag_execute = 1;
+ if (attr & 8)
+ s->flag_shared = 1;
+
+ def->num_section_defs++;
+}
+
+static void
+def_section_alt (name, attr)
+ const char *name;
+ const char *attr;
+{
+ int aval = 0;
+ for (; *attr; attr++)
+ {
+ switch (*attr)
+ {
+ case 'R':
+ case 'r':
+ aval |= 1;
+ break;
+ case 'W':
+ case 'w':
+ aval |= 2;
+ break;
+ case 'X':
+ case 'x':
+ aval |= 4;
+ break;
+ case 'S':
+ case 's':
+ aval |= 8;
+ break;
+ }
+ }
+ def_section (name, aval);
+}
+
+static void
+def_exports (external_name, internal_name, ordinal, flags)
+ const char *external_name;
+ const char *internal_name;
+ int ordinal;
+ int flags;
+{
+ def_file_export *dfe;
+
+ if (!internal_name && external_name)
+ internal_name = external_name;
+#if TRACE
+ printf ("def_exports, ext=%s int=%s\n", external_name, internal_name);
+#endif
+
+ dfe = def_file_add_export (def, external_name, internal_name, ordinal);
+ if (flags & 1)
+ dfe->flag_noname = 1;
+ if (flags & 2)
+ dfe->flag_constant = 1;
+ if (flags & 4)
+ dfe->flag_data = 1;
+ if (flags & 8)
+ dfe->flag_private = 1;
+}
+
+static void
+def_import (internal_name, module, dllext, name, ordinal)
+ const char *internal_name;
+ const char *module;
+ const char *dllext;
+ const char *name;
+ int ordinal;
+{
+ char *buf = 0;
+
+ if (dllext != NULL)
+ {
+ buf = (char *) xmalloc (strlen (module) + strlen (dllext) + 2);
+ sprintf (buf, "%s.%s", module, dllext);
+ module = buf;
+ }
+
+ def_file_add_import (def, name, module, ordinal, internal_name);
+ if (buf)
+ free (buf);
+}
+
+static void
+def_version (major, minor)
+ int major;
+ int minor;
+{
+ def->version_major = major;
+ def->version_minor = minor;
+}
+
+static void
+def_directive (str)
+ char *str;
+{
+ struct directive *d = (struct directive *) xmalloc (sizeof (struct directive));
+ d->next = directives;
+ directives = d;
+ d->name = xstrdup (str);
+ d->len = strlen (str);
+}
+
+static int
+def_error (err)
+ const char *err;
+{
+ einfo ("%P: %s:%d: %s\n", def_filename, linenumber, err);
+
+ return 0;
+}
+
+
+/*****************************************************************************
+ Lexical Scanner
+ *****************************************************************************/
+
+#undef TRACE
+#define TRACE 0
+
+/* Never freed, but always reused as needed, so no real leak */
+static char *buffer = 0;
+static int buflen = 0;
+static int bufptr = 0;
+
+static void
+put_buf (c)
+ char c;
+{
+ if (bufptr == buflen)
+ {
+ buflen += 50; /* overly reasonable, eh? */
+ if (buffer)
+ buffer = (char *) xrealloc (buffer, buflen + 1);
+ else
+ buffer = (char *) xmalloc (buflen + 1);
+ }
+ buffer[bufptr++] = c;
+ buffer[bufptr] = 0; /* not optimal, but very convenient */
+}
+
+static struct
+{
+ char *name;
+ int token;
+}
+tokens[] =
+{
+ { "BASE", BASE },
+ { "CODE", CODE },
+ { "CONSTANT", CONSTANTU },
+ { "constant", CONSTANTL },
+ { "DATA", DATAU },
+ { "data", DATAL },
+ { "DESCRIPTION", DESCRIPTION },
+ { "DIRECTIVE", DIRECTIVE },
+ { "EXECUTE", EXECUTE },
+ { "EXPORTS", EXPORTS },
+ { "HEAPSIZE", HEAPSIZE },
+ { "IMPORTS", IMPORTS },
+ { "LIBRARY", LIBRARY },
+ { "NAME", NAME },
+ { "NONAME", NONAMEU },
+ { "noname", NONAMEL },
+ { "PRIVATE", PRIVATEU },
+ { "private", PRIVATEL },
+ { "READ", READ },
+ { "SECTIONS", SECTIONS },
+ { "SEGMENTS", SECTIONS },
+ { "SHARED", SHARED },
+ { "STACKSIZE", STACKSIZE },
+ { "VERSION", VERSIONK },
+ { "WRITE", WRITE },
+ { 0, 0 }
+};
+
+static int
+def_getc ()
+{
+ int rv;
+ if (lex_parse_string)
+ {
+ if (lex_parse_string >= lex_parse_string_end)
+ rv = EOF;
+ else
+ rv = *lex_parse_string++;
+ }
+ else
+ {
+ rv = fgetc (the_file);
+ }
+ if (rv == '\n')
+ saw_newline = 1;
+ return rv;
+}
+
+static int
+def_ungetc (c)
+ int c;
+{
+ if (lex_parse_string)
+ {
+ lex_parse_string--;
+ return c;
+ }
+ else
+ return ungetc (c, the_file);
+}
+
+static int
+def_lex ()
+{
+ int c, i, q;
+
+ if (lex_forced_token)
+ {
+ i = lex_forced_token;
+ lex_forced_token = 0;
+#if TRACE
+ printf ("lex: forcing token %d\n", i);
+#endif
+ return i;
+ }
+
+ c = def_getc ();
+
+ /* trim leading whitespace */
+ while (c != EOF && (c == ' ' || c == '\t') && saw_newline)
+ c = def_getc ();
+
+ if (c == EOF)
+ {
+#if TRACE
+ printf ("lex: EOF\n");
+#endif
+ return 0;
+ }
+
+ if (saw_newline && c == ';')
+ {
+ do
+ {
+ c = def_getc ();
+ }
+ while (c != EOF && c != '\n');
+ if (c == '\n')
+ return def_lex ();
+ return 0;
+ }
+ /* must be something else */
+ saw_newline = 0;
+
+ if (isdigit (c))
+ {
+ bufptr = 0;
+ while (c != EOF && (isxdigit (c) || (c == 'x')))
+ {
+ put_buf (c);
+ c = def_getc ();
+ }
+ if (c != EOF)
+ def_ungetc (c);
+ yylval.number = strtoul (buffer, 0, 0);
+#if TRACE
+ printf ("lex: `%s' returns NUMBER %d\n", buffer, yylval.number);
+#endif
+ return NUMBER;
+ }
+
+ if (isalpha (c) || strchr ("$:-_?", c))
+ {
+ bufptr = 0;
+ while (c != EOF && (isalnum (c) || strchr ("$:-_?/@", c)))
+ {
+ put_buf (c);
+ c = def_getc ();
+ }
+ if (c != EOF)
+ def_ungetc (c);
+ for (i = 0; tokens[i].name; i++)
+ if (strcmp (tokens[i].name, buffer) == 0)
+ {
+#if TRACE
+ printf ("lex: `%s' is a string token\n", buffer);
+#endif
+ return tokens[i].token;
+ }
+#if TRACE
+ printf ("lex: `%s' returns ID\n", buffer);
+#endif
+ yylval.id = xstrdup (buffer);
+ return ID;
+ }
+
+ if (c == '\'' || c == '"')
+ {
+ q = c;
+ c = def_getc ();
+ bufptr = 0;
+ while (c != EOF && c != q)
+ {
+ put_buf (c);
+ c = def_getc ();
+ }
+ yylval.id = xstrdup (buffer);
+#if TRACE
+ printf ("lex: `%s' returns ID\n", buffer);
+#endif
+ return ID;
+ }
+
+ if (c == '=' || c == '.' || c == '@' || c == ',')
+ {
+#if TRACE
+ printf ("lex: `%c' returns itself\n", c);
+#endif
+ return c;
+ }
+
+ if (c == '\n')
+ {
+ linenumber++;
+ saw_newline = 1;
+ }
+
+ /*printf ("lex: 0x%02x ignored\n", c); */
+ return def_lex ();
+}
diff --git a/contrib/binutils/ld/emulparams/armaoutb.sh b/contrib/binutils/ld/emulparams/armaoutb.sh
new file mode 100644
index 0000000..59ab6f1
--- /dev/null
+++ b/contrib/binutils/ld/emulparams/armaoutb.sh
@@ -0,0 +1,7 @@
+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/contrib/binutils/ld/emulparams/armaoutl.sh b/contrib/binutils/ld/emulparams/armaoutl.sh
new file mode 100644
index 0000000..9501f33
--- /dev/null
+++ b/contrib/binutils/ld/emulparams/armaoutl.sh
@@ -0,0 +1,7 @@
+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/contrib/binutils/ld/emulparams/armcoff.sh b/contrib/binutils/ld/emulparams/armcoff.sh
new file mode 100644
index 0000000..91df7d3
--- /dev/null
+++ b/contrib/binutils/ld/emulparams/armcoff.sh
@@ -0,0 +1,6 @@
+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/contrib/binutils/ld/emulparams/armelf.sh b/contrib/binutils/ld/emulparams/armelf.sh
new file mode 100644
index 0000000..8c79b64
--- /dev/null
+++ b/contrib/binutils/ld/emulparams/armelf.sh
@@ -0,0 +1,22 @@
+MACHINE=
+SCRIPT_NAME=elf
+OUTPUT_FORMAT="elf32-littlearm"
+BIG_OUTPUT_FORMAT="elf32-bigarm"
+LITTLE_OUTPUT_FORMAT="elf32-littlearm"
+TEXT_START_ADDR=0x8000
+TEMPLATE_NAME=armelf
+OTHER_TEXT_SECTIONS='*(.glue_7t) *(.glue_7)'
+OTHER_BSS_SYMBOLS='__bss_start__ = .;'
+OTHER_BSS_END_SYMBOLS='_bss_end__ = . ; __bss_end__ = . ; __end__ = . ;'
+
+GENERATE_SHLIB_SCRIPT=yes
+
+ARCH=arm
+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) }'
diff --git a/contrib/binutils/ld/emulparams/armelf_linux.sh b/contrib/binutils/ld/emulparams/armelf_linux.sh
new file mode 100644
index 0000000..a85e8bd
--- /dev/null
+++ b/contrib/binutils/ld/emulparams/armelf_linux.sh
@@ -0,0 +1,19 @@
+ARCH=arm
+SCRIPT_NAME=elf
+OUTPUT_FORMAT="elf32-littlearm"
+BIG_OUTPUT_FORMAT="elf32-bigarm"
+LITTLE_OUTPUT_FORMAT="elf32-littlearm"
+MAXPAGESIZE=0x8000
+TEMPLATE_NAME=armelf
+GENERATE_SHLIB_SCRIPT=yes
+
+DATA_START_SYMBOLS='__data_start = . ;';
+OTHER_TEXT_SECTIONS='*(.glue_7t) *(.glue_7)'
+OTHER_BSS_SYMBOLS='__bss_start__ = .;'
+OTHER_BSS_END_SYMBOLS='_bss_end__ = . ; __bss_end__ = . ; __end__ = . ;'
+
+# This needs to be high enough so that we can load ld.so below it,
+# yet low enough to stay away from the mmap area at 0x40000000.
+# Also, it is small enough so that relocs which are pointing
+# at absolute 0 will still be fixed up.
+TEXT_START_ADDR=0x02000000
diff --git a/contrib/binutils/ld/emulparams/armelf_linux26.sh b/contrib/binutils/ld/emulparams/armelf_linux26.sh
new file mode 100644
index 0000000..36d1b0e
--- /dev/null
+++ b/contrib/binutils/ld/emulparams/armelf_linux26.sh
@@ -0,0 +1,20 @@
+ARCH=arm
+SCRIPT_NAME=elf
+OUTPUT_FORMAT="elf32-littlearm"
+BIG_OUTPUT_FORMAT="elf32-bigarm"
+LITTLE_OUTPUT_FORMAT="elf32-littlearm"
+MAXPAGESIZE=0x8000
+TEMPLATE_NAME=armelf
+GENERATE_SHLIB_SCRIPT=yes
+
+DATA_START_SYMBOLS='__data_start = . ;';
+OTHER_BSS_SYMBOLS='__bss_start__ = .;'
+OTHER_BSS_END_SYMBOLS='_bss_end__ = . ; __bss_end__ = . ; __end__ = . ;'
+
+# This needs to be high enough so that we can load ld.so below it,
+# yet low enough to stay away from the mmap area at 0x01100000.
+# Also, it is small enough so that relocs which are pointing
+# at absolute 0 will still be fixed up.
+# These values give us about 0.5MB for ld.so, 16.5MB for user
+# programs, and 15MB for mmap which seems a reasonable compromise.
+TEXT_START_ADDR=0x00080000
diff --git a/contrib/binutils/ld/emulparams/armelf_oabi.sh b/contrib/binutils/ld/emulparams/armelf_oabi.sh
new file mode 100644
index 0000000..d568328
--- /dev/null
+++ b/contrib/binutils/ld/emulparams/armelf_oabi.sh
@@ -0,0 +1,21 @@
+MACHINE=
+SCRIPT_NAME=elf
+OUTPUT_FORMAT="elf32-littlearm-oabi"
+BIG_OUTPUT_FORMAT="elf32-bigarm-oabi"
+LITTLE_OUTPUT_FORMAT="elf32-littlearm-oabi"
+TEXT_START_ADDR=0x8000
+TEMPLATE_NAME=armelf_oabi
+OTHER_TEXT_SECTIONS='*(.glue_7t) *(.glue_7)'
+OTHER_BSS_SYMBOLS='__bss_start__ = .;'
+OTHER_BSS_END_SYMBOLS='_bss_end__ = . ; __bss_end__ = . ;'
+
+
+ARCH=arm
+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) }'
diff --git a/contrib/binutils/ld/emulparams/armnbsd.sh b/contrib/binutils/ld/emulparams/armnbsd.sh
new file mode 100644
index 0000000..fc27791
--- /dev/null
+++ b/contrib/binutils/ld/emulparams/armnbsd.sh
@@ -0,0 +1,7 @@
+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/contrib/binutils/ld/emulparams/armpe.sh b/contrib/binutils/ld/emulparams/armpe.sh
new file mode 100644
index 0000000..257c9de
--- /dev/null
+++ b/contrib/binutils/ld/emulparams/armpe.sh
@@ -0,0 +1,9 @@
+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
+ENTRY="_mainCRTStartup"
+SUBSYSTEM=PE_DEF_SUBSYSTEM
+INITIAL_SYMBOL_CHAR=\"_\"
diff --git a/contrib/binutils/ld/emulparams/coff_sparc.sh b/contrib/binutils/ld/emulparams/coff_sparc.sh
new file mode 100644
index 0000000..0cf852a
--- /dev/null
+++ b/contrib/binutils/ld/emulparams/coff_sparc.sh
@@ -0,0 +1,7 @@
+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/contrib/binutils/ld/emulparams/elf32_sparc.sh b/contrib/binutils/ld/emulparams/elf32_sparc.sh
index 3a1a7f2..74e2326 100644
--- a/contrib/binutils/ld/emulparams/elf32_sparc.sh
+++ b/contrib/binutils/ld/emulparams/elf32_sparc.sh
@@ -3,6 +3,7 @@ OUTPUT_FORMAT="elf32-sparc"
TEXT_START_ADDR=0x10000
MAXPAGESIZE=0x10000
NONPAGED_TEXT_START_ADDR=0x10000
+ALIGNMENT=8
ARCH=sparc
MACHINE=
TEMPLATE_NAME=elf32
diff --git a/contrib/binutils/ld/emulparams/elf32bmipn32.sh b/contrib/binutils/ld/emulparams/elf32bmipn32.sh
new file mode 100755
index 0000000..56f42a9
--- /dev/null
+++ b/contrib/binutils/ld/emulparams/elf32bmipn32.sh
@@ -0,0 +1,75 @@
+# This is an ELF platform.
+SCRIPT_NAME=elf
+
+# Handle both big- and little-ended 32-bit MIPS objects.
+ARCH=mips
+OUTPUT_FORMAT="elf32-bigmips"
+BIG_OUTPUT_FORMAT="elf32-bigmips"
+LITTLE_OUTPUT_FORMAT="elf32-littlemips"
+
+TEMPLATE_NAME=elf32
+
+TEXT_START_ADDR=0x10000000
+MAXPAGESIZE=0x100000
+ENTRY=__start
+
+# GOT-related settings.
+OTHER_GOT_SYMBOLS='
+ _gp = ALIGN(16) + 0x7ff0;
+'
+OTHER_GOT_SECTIONS='
+ .lit8 : { *(.lit8) }
+ .lit4 : { *(.lit4) }
+ .srdata : { *(.srdata) }
+'
+
+# Magic symbols.
+TEXT_START_SYMBOLS='_ftext = . ;'
+DATA_START_SYMBOLS='_fdata = . ;'
+OTHER_BSS_SYMBOLS='_fbss = .;'
+# IRIX6 defines these symbols. 0x34 is the size of the ELF header.
+EXECUTABLE_SYMBOLS="
+ __dso_displacement = 0;
+ __elf_header = ${TEXT_START_ADDR};
+ __program_header_table = ${TEXT_START_ADDR} + 0x34;
+"
+
+# There are often dynamic relocations against the .rodata section.
+# Setting DT_TEXTREL in the .dynamic section does not convince the
+# IRIX6 linker to permit relocations against the text segment.
+# Following the IRIX linker, we simply put .rodata in the data
+# segment.
+WRITABLE_RODATA=
+
+OTHER_RELOCATING_SECTIONS='
+ .MIPS.events.text :
+ {
+ *(.MIPS.events.text)
+ *(.MIPS.events.gnu.linkonce.t*)
+ }
+ .MIPS.content.text :
+ {
+ *(.MIPS.content.text)
+ *(.MIPS.content.gnu.linkonce.t*)
+ }
+ .MIPS.events.data :
+ {
+ *(.MIPS.events.data)
+ *(.MIPS.events.gnu.linkonce.d*)
+ }
+ .MIPS.content.data :
+ {
+ *(.MIPS.content.data)
+ *(.MIPS.content.gnu.linkonce.d*)
+ }
+ .MIPS.events.rodata :
+ {
+ *(.MIPS.events.rodata)
+ *(.MIPS.events.gnu.linkonce.r*)
+ }
+ .MIPS.content.rodata :
+ {
+ *(.MIPS.content.rodata)
+ *(.MIPS.content.gnu.linkonce.r*)
+ }
+'
diff --git a/contrib/binutils/ld/emulparams/elf32ebmip.sh b/contrib/binutils/ld/emulparams/elf32ebmip.sh
index a6b80a9..00ea8fd 100644
--- a/contrib/binutils/ld/emulparams/elf32ebmip.sh
+++ b/contrib/binutils/ld/emulparams/elf32ebmip.sh
@@ -6,7 +6,6 @@ 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;
diff --git a/contrib/binutils/ld/emulparams/elf32elmip.sh b/contrib/binutils/ld/emulparams/elf32elmip.sh
index 313d74a..cf008c8 100644
--- a/contrib/binutils/ld/emulparams/elf32elmip.sh
+++ b/contrib/binutils/ld/emulparams/elf32elmip.sh
@@ -6,7 +6,6 @@ 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;
diff --git a/contrib/binutils/ld/emulparams/elf32lppc.sh b/contrib/binutils/ld/emulparams/elf32lppc.sh
new file mode 100644
index 0000000..edffc61
--- /dev/null
+++ b/contrib/binutils/ld/emulparams/elf32lppc.sh
@@ -0,0 +1,8 @@
+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/contrib/binutils/ld/emulparams/elf32ppc.sh b/contrib/binutils/ld/emulparams/elf32ppc.sh
new file mode 100644
index 0000000..3e3880c
--- /dev/null
+++ b/contrib/binutils/ld/emulparams/elf32ppc.sh
@@ -0,0 +1,8 @@
+TEMPLATE_NAME=elf32
+GENERATE_SHLIB_SCRIPT=yes
+SCRIPT_NAME=elfppc
+OUTPUT_FORMAT="elf32-powerpc"
+TEXT_START_ADDR=0x01800000
+MAXPAGESIZE=0x10000
+ARCH=powerpc
+MACHINE=
diff --git a/contrib/binutils/ld/emulparams/elf32ppclinux.sh b/contrib/binutils/ld/emulparams/elf32ppclinux.sh
new file mode 100644
index 0000000..9996c7b
--- /dev/null
+++ b/contrib/binutils/ld/emulparams/elf32ppclinux.sh
@@ -0,0 +1,8 @@
+TEMPLATE_NAME=elf32
+GENERATE_SHLIB_SCRIPT=yes
+SCRIPT_NAME=elfppc
+OUTPUT_FORMAT="elf32-powerpc"
+TEXT_START_ADDR=0x10000000
+MAXPAGESIZE=0x10000
+ARCH=powerpc
+MACHINE=
diff --git a/contrib/binutils/ld/emulparams/elf64_sparc.sh b/contrib/binutils/ld/emulparams/elf64_sparc.sh
index d0fbdfd..2ab2e4f 100644
--- a/contrib/binutils/ld/emulparams/elf64_sparc.sh
+++ b/contrib/binutils/ld/emulparams/elf64_sparc.sh
@@ -10,3 +10,37 @@ MACHINE=
DATA_PLT=
GENERATE_SHLIB_SCRIPT=yes
NOP=0x01000000
+
+if [ "x${host}" = "x${target}" ]; then
+ case " $EMULATION_LIBPATH " in
+ *" ${EMULATION_NAME} "*)
+ # Native, and default or emulation requesting LIB_PATH.
+
+ # Linux and Solaris modify the default library search path
+ # to first include a 64-bit specific directory. It's put
+ # in slightly different places on the two systems.
+ case "$target" in
+ sparc*-linux*)
+ suffix=64 ;;
+ sparc*-solaris*)
+ suffix=/sparcv9 ;;
+ esac
+
+ if [ -n "${suffix}" ]; then
+
+ LIB_PATH=/lib${suffix}:/lib
+ LIB_PATH=${LIB_PATH}:/usr/lib${suffix}:/usr/lib
+ if [ -n "${NATIVE_LIB_DIRS}" ]; then
+ LIB_PATH=${LIB_PATH}:`echo ${NATIVE_LIB_DIRS} | sed s/:/${suffix}:/g`${suffix}:${NATIVE_LIB_DIRS}
+ fi
+ if [ "${libdir}" != /usr/lib ]; then
+ LIB_PATH=${LIB_PATH}:${libdir}${suffix}:${libdir}
+ fi
+ if [ "${libdir}" != /usr/local/lib ]; then
+ LIB_PATH=${LIB_PATH}:/usr/local/lib${suffix}:/usr/local/lib
+ fi
+
+ fi
+ ;;
+ esac
+fi
diff --git a/contrib/binutils/ld/emulparams/elf64bmip.sh b/contrib/binutils/ld/emulparams/elf64bmip.sh
new file mode 100755
index 0000000..a4852d5
--- /dev/null
+++ b/contrib/binutils/ld/emulparams/elf64bmip.sh
@@ -0,0 +1,79 @@
+# This is an ELF platform.
+SCRIPT_NAME=elf
+
+# Handle both big- and little-ended 32-bit MIPS objects.
+ARCH=mips
+OUTPUT_FORMAT="elf64-bigmips"
+BIG_OUTPUT_FORMAT="elf64-bigmips"
+LITTLE_OUTPUT_FORMAT="elf64-littlemips"
+
+# Note that the elf32 template is used for 64-bit emulations as well
+# as 32-bit emulations.
+ELFSIZE=64
+TEMPLATE_NAME=elf32
+
+TEXT_START_ADDR=0x10000000
+MAXPAGESIZE=0x100000
+ENTRY=__start
+
+# GOT-related settings.
+OTHER_GOT_SYMBOLS='
+ _gp = ALIGN(16) + 0x7ff0;
+'
+OTHER_GOT_SECTIONS='
+ .lit8 : { *(.lit8) }
+ .lit4 : { *(.lit4) }
+ .srdata : { *(.srdata) }
+'
+
+# Magic symbols.
+TEXT_START_SYMBOLS='_ftext = . ;'
+DATA_START_SYMBOLS='_fdata = . ;'
+OTHER_BSS_SYMBOLS='_fbss = .;'
+# IRIX6 defines these symbols. 0x40 is the size of the ELF header.
+EXECUTABLE_SYMBOLS="
+ __dso_displacement = 0;
+ __elf_header = ${TEXT_START_ADDR};
+ __program_header_table = ${TEXT_START_ADDR} + 0x40;
+"
+
+# There are often dynamic relocations against the .rodata section.
+# Setting DT_TEXTREL in the .dynamic section does not convince the
+# IRIX6 linker to permit relocations against the text segment.
+# Following the IRIX linker, we simply put .rodata in the data
+# segment.
+WRITABLE_RODATA=
+
+
+OTHER_RELOCATING_SECTIONS='
+ .MIPS.events.text :
+ {
+ *(.MIPS.events.text)
+ *(.MIPS.events.gnu.linkonce.t*)
+ }
+ .MIPS.content.text :
+ {
+ *(.MIPS.content.text)
+ *(.MIPS.content.gnu.linkonce.t*)
+ }
+ .MIPS.events.data :
+ {
+ *(.MIPS.events.data)
+ *(.MIPS.events.gnu.linkonce.d*)
+ }
+ .MIPS.content.data :
+ {
+ *(.MIPS.content.data)
+ *(.MIPS.content.gnu.linkonce.d*)
+ }
+ .MIPS.events.rodata :
+ {
+ *(.MIPS.events.rodata)
+ *(.MIPS.events.gnu.linkonce.r*)
+ }
+ .MIPS.content.rodata :
+ {
+ *(.MIPS.content.rodata)
+ *(.MIPS.content.gnu.linkonce.r*)
+ }
+'
diff --git a/contrib/binutils/ld/emulparams/i386pe.sh b/contrib/binutils/ld/emulparams/i386pe.sh
index 188a8ad..a8add23 100644
--- a/contrib/binutils/ld/emulparams/i386pe.sh
+++ b/contrib/binutils/ld/emulparams/i386pe.sh
@@ -3,3 +3,6 @@ SCRIPT_NAME=pe
OUTPUT_FORMAT="pei-i386"
RELOCATEABLE_OUTPUT_FORMAT="pe-i386"
TEMPLATE_NAME=pe
+ENTRY="_mainCRTStartup"
+SUBSYSTEM=PE_DEF_SUBSYSTEM
+INITIAL_SYMBOL_CHAR=\"_\"
diff --git a/contrib/binutils/ld/emulparams/i386pe_posix.sh b/contrib/binutils/ld/emulparams/i386pe_posix.sh
new file mode 100644
index 0000000..37f51b5
--- /dev/null
+++ b/contrib/binutils/ld/emulparams/i386pe_posix.sh
@@ -0,0 +1,9 @@
+ARCH=i386
+SCRIPT_NAME=pe
+OUTPUT_FORMAT="pei-i386"
+RELOCATEABLE_OUTPUT_FORMAT="pe-i386"
+TEMPLATE_NAME=pe
+ENTRY="___PosixProcessStartup"
+SUBSYSTEM=7
+EXECUTABLE_NAME=a.out
+INITIAL_SYMBOL_CHAR=\"_\"
diff --git a/contrib/binutils/ld/emulparams/ppcmacos.sh b/contrib/binutils/ld/emulparams/ppcmacos.sh
new file mode 100644
index 0000000..b6b800c
--- /dev/null
+++ b/contrib/binutils/ld/emulparams/ppcmacos.sh
@@ -0,0 +1,4 @@
+TEMPLATE_NAME=aix
+SCRIPT_NAME=aix
+OUTPUT_FORMAT="xcoff-powermac"
+ARCH=powerpc
diff --git a/contrib/binutils/ld/emulparams/ppcnw.sh b/contrib/binutils/ld/emulparams/ppcnw.sh
new file mode 100644
index 0000000..c3ead43
--- /dev/null
+++ b/contrib/binutils/ld/emulparams/ppcnw.sh
@@ -0,0 +1,7 @@
+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/contrib/binutils/ld/emulparams/ppcpe.sh b/contrib/binutils/ld/emulparams/ppcpe.sh
new file mode 100644
index 0000000..a2d09ef
--- /dev/null
+++ b/contrib/binutils/ld/emulparams/ppcpe.sh
@@ -0,0 +1,7 @@
+ARCH=powerpc
+SCRIPT_NAME=ppcpe
+OUTPUT_FORMAT="pei-powerpcle"
+TEMPLATE_NAME=pe
+ENTRY="_mainCRTStartup"
+SUBSYSTEM=PE_DEF_SUBSYSTEM
+INITIAL_SYMBOL_CHAR=\"_\"
diff --git a/contrib/binutils/ld/emulparams/sparcaout.sh b/contrib/binutils/ld/emulparams/sparcaout.sh
new file mode 100644
index 0000000..429b925
--- /dev/null
+++ b/contrib/binutils/ld/emulparams/sparcaout.sh
@@ -0,0 +1,8 @@
+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/contrib/binutils/ld/emulparams/sparclinux.sh b/contrib/binutils/ld/emulparams/sparclinux.sh
new file mode 100644
index 0000000..7ccb0be
--- /dev/null
+++ b/contrib/binutils/ld/emulparams/sparclinux.sh
@@ -0,0 +1,7 @@
+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/contrib/binutils/ld/emulparams/sparcnbsd.sh b/contrib/binutils/ld/emulparams/sparcnbsd.sh
new file mode 100644
index 0000000..f27daf3
--- /dev/null
+++ b/contrib/binutils/ld/emulparams/sparcnbsd.sh
@@ -0,0 +1,5 @@
+SCRIPT_NAME=aout
+TEXT_START_ADDR=0x1020
+OUTPUT_FORMAT="a.out-sparc-netbsd"
+TARGET_PAGE_SIZE=0x1000
+ARCH=sparc
diff --git a/contrib/binutils/ld/emultempl/armcoff.em b/contrib/binutils/ld/emultempl/armcoff.em
new file mode 100644
index 0000000..d73b3d1
--- /dev/null
+++ b/contrib/binutils/ld/emultempl/armcoff.em
@@ -0,0 +1,292 @@
+# This shell script emits a C file. -*- C -*-
+# It does some substitutions.
+cat >e${EMULATION_NAME}.c <<EOF
+/* This file is is generated by a shell script. DO NOT EDIT! */
+
+/* emulate the original gld for the given ${EMULATION_NAME}
+ Copyright (C) 1991, 93, 96, 97, 98, 1999 Free Software Foundation, Inc.
+ Written by Steve Chamberlain steve@cygnus.com
+
+This file is part of GLD, the Gnu Linker.
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 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 "getopt.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 void gld${EMULATION_NAME}_before_allocation PARAMS ((void));
+static char *gld${EMULATION_NAME}_get_script PARAMS ((int *isfile));
+static int gld${EMULATION_NAME}_parse_args PARAMS((int, char **));
+static void gld${EMULATION_NAME}_list_options PARAMS ((FILE *));
+static void gld${EMULATION_NAME}_finish PARAMS ((void));
+
+/* If true, then interworking stubs which support calls to old, non-interworking
+ aware ARM code should be generated. */
+
+static int support_old_code = 0;
+static char * thumb_entry_symbol = NULL;
+
+#define OPTION_SUPPORT_OLD_CODE 300
+#define OPTION_THUMB_ENTRY 301
+
+static struct option longopts[] =
+{
+ {"support-old-code", no_argument, NULL, OPTION_SUPPORT_OLD_CODE},
+ {"thumb-entry", required_argument, NULL, OPTION_THUMB_ENTRY},
+ {NULL, no_argument, NULL, 0}
+};
+
+static void
+gld${EMULATION_NAME}_list_options (file)
+ FILE * file;
+{
+ fprintf (file, _(" --support-old-code Support interworking with old code\n"));
+ fprintf (file, _(" --thumb-entry=<sym> Set the entry point to be Thumb symbol <sym>\n"));
+}
+
+static int
+gld${EMULATION_NAME}_parse_args (argc, argv)
+ int argc;
+ char ** argv;
+{
+ int longind;
+ int optc;
+ int prevoptind = optind;
+ int prevopterr = opterr;
+ int wanterror;
+ static int lastoptind = -1;
+
+ if (lastoptind != optind)
+ opterr = 0;
+
+ wanterror = opterr;
+ lastoptind = optind;
+
+ optc = getopt_long_only (argc, argv, "-", longopts, & longind);
+ opterr = prevopterr;
+
+ switch (optc)
+ {
+ default:
+ if (wanterror)
+ xexit (1);
+ optind = prevoptind;
+ return 0;
+
+ case OPTION_SUPPORT_OLD_CODE:
+ support_old_code = 1;
+ break;
+
+ case OPTION_THUMB_ENTRY:
+ thumb_entry_symbol = optarg;
+ break;
+ }
+
+ return 1;
+}
+
+static void
+gld${EMULATION_NAME}_before_parse ()
+{
+#ifndef TARGET_ /* I.e., if not generic. */
+ ldfile_set_output_arch ("`echo ${ARCH}`");
+#endif /* not TARGET_ */
+}
+
+/* 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 ()
+{
+ /* 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 (! bfd_arm_process_before_allocation
+ (is->the_bfd, & link_info, support_old_code))
+ {
+ /* xgettext:c-format */
+ einfo (_("Errors encountered processing file %s"), is->filename);
+ }
+ }
+ }
+
+ /* We have seen it all. Allocate it, and carry on */
+ bfd_arm_allocate_interworking_sections (& link_info);
+}
+
+static void
+gld${EMULATION_NAME}_after_open ()
+{
+ if (strstr (bfd_get_target (output_bfd), "arm") == NULL)
+ {
+ /* The arm backend needs special fields in the output hash structure.
+ These will only be created if the output format is an arm format,
+ hence we do not support linking and changing output formats at the
+ same time. Use a link followed by objcopy to change output formats. */
+ einfo ("%F%X%P: error: cannot change output format whilst linking ARM binaries\n");
+ return;
+ }
+
+ {
+ LANG_FOR_EACH_INPUT_STATEMENT (is)
+ {
+ if (bfd_arm_get_bfd_for_interworking (is->the_bfd, & link_info))
+ break;
+ }
+ }
+}
+
+static void
+gld${EMULATION_NAME}_finish PARAMS((void))
+{
+ struct bfd_link_hash_entry * h;
+
+ if (thumb_entry_symbol == NULL)
+ return;
+
+ h = bfd_link_hash_lookup (link_info.hash, thumb_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)
+ {
+ static char buffer[32];
+ bfd_vma val;
+
+ /* Special procesing is required for a Thumb entry symbol. The
+ bottom bit of its address must be set. */
+ val = (h->u.def.value
+ + bfd_get_section_vma (output_bfd,
+ h->u.def.section->output_section)
+ + h->u.def.section->output_offset);
+
+ val |= 1;
+
+ /* Now convert this value into a string and store it in entry_symbol
+ where the lang_finish() function will pick it up. */
+ buffer[0] = '0';
+ buffer[1] = 'x';
+
+ sprintf_vma (buffer + 2, val);
+
+ if (entry_symbol != NULL && entry_from_cmdline)
+ einfo (_("%P: warning: '--thumb-entry %s' is overriding '-e %s'\n"),
+ thumb_entry_symbol, entry_symbol);
+ entry_symbol = buffer;
+ }
+ else
+ einfo (_("%P: warning: connot find thumb start symbol %s\n"), thumb_entry_symbol);
+}
+
+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 stringify.sed"
+
+cat >>e${EMULATION_NAME}.c <<EOF
+{
+ *isfile = 0;
+
+ if (link_info.relocateable == true && config.build_constructors == true)
+ return
+EOF
+sed $sc ldscripts/${EMULATION_NAME}.xu >> 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 <<EOF
+{
+ *isfile = 1;
+
+ if (link_info.relocateable == true && config.build_constructors == true)
+ return "ldscripts/${EMULATION_NAME}.xu";
+ else if (link_info.relocateable == true)
+ return "ldscripts/${EMULATION_NAME}.xr";
+ else if (!config.text_read_only)
+ return "ldscripts/${EMULATION_NAME}.xbn";
+ else if (!config.magic_demand_paged)
+ return "ldscripts/${EMULATION_NAME}.xn";
+ else
+ return "ldscripts/${EMULATION_NAME}.x";
+}
+EOF
+
+fi
+
+cat >>e${EMULATION_NAME}.c <<EOF
+
+struct ld_emulation_xfer_struct ld_${EMULATION_NAME}_emulation =
+{
+ gld${EMULATION_NAME}_before_parse,
+ syslib_default,
+ hll_default,
+ after_parse_default,
+ gld${EMULATION_NAME}_after_open,
+ after_allocation_default,
+ set_output_arch_default,
+ ldemul_default_target,
+ gld${EMULATION_NAME}_before_allocation,
+ gld${EMULATION_NAME}_get_script,
+ "${EMULATION_NAME}",
+ "${OUTPUT_FORMAT}",
+ gld${EMULATION_NAME}_finish,
+ NULL, /* create output section statements */
+ NULL, /* open dynamic archive */
+ NULL, /* place orphan */
+ NULL, /* set symbols */
+ gld${EMULATION_NAME}_parse_args,
+ NULL, /* unrecognised file */
+ gld${EMULATION_NAME}_list_options,
+ NULL, /* recognized file */
+ NULL /* find_potential_libraries */
+};
+EOF
diff --git a/contrib/binutils/ld/emultempl/armelf.em b/contrib/binutils/ld/emultempl/armelf.em
new file mode 100644
index 0000000..9abf7f1
--- /dev/null
+++ b/contrib/binutils/ld/emultempl/armelf.em
@@ -0,0 +1,1293 @@
+# This shell script emits a C file. -*- C -*-
+# It does some substitutions.
+ELFSIZE=32
+cat >e${EMULATION_NAME}.c <<EOF
+/* This file is is generated by a shell script. DO NOT EDIT! */
+
+/* emulate the original gld for the given ${EMULATION_NAME}
+ Copyright (C) 1991, 93, 96, 97, 98, 1999 Free Software Foundation, Inc.
+ Written by Steve Chamberlain steve@cygnus.com
+
+This file is part of GLD, the Gnu Linker.
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
+
+#define TARGET_IS_${EMULATION_NAME}
+
+#include "bfd.h"
+#include "sysdep.h"
+
+#include <ctype.h>
+
+#include "bfdlink.h"
+#include "getopt.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 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}_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 void gld${EMULATION_NAME}_before_parse PARAMS ((void));
+static void gld${EMULATION_NAME}_before_allocation PARAMS ((void));
+static char *gld${EMULATION_NAME}_get_script PARAMS ((int *isfile));
+static int gld${EMULATION_NAME}_parse_args PARAMS((int, char **));
+static void gld${EMULATION_NAME}_list_options PARAMS ((FILE *));
+static void gld${EMULATION_NAME}_finish PARAMS ((void));
+
+
+static int no_pipeline_knowledge = 0;
+static char * thumb_entry_symbol = NULL;
+
+#define OPTION_THUMB_ENTRY 301
+
+static struct option longopts[] =
+{
+ { "no-pipeline-knowledge", no_argument, NULL, 'p'},
+ { "thumb-entry", required_argument, NULL, OPTION_THUMB_ENTRY},
+ { NULL, no_argument, NULL, 0 }
+};
+
+static void
+gld${EMULATION_NAME}_list_options (file)
+ FILE * file;
+{
+ fprintf (file, _(" -p --no-pipeline-knowledge Stop the linker knowing about the pipeline length\n"));
+ fprintf (file, _(" --thumb-entry=<sym> Set the entry point to be Thumb symbol <sym>\n"));
+}
+
+static int
+gld${EMULATION_NAME}_parse_args (argc, argv)
+ int argc;
+ char ** argv;
+{
+ int longind;
+ int optc;
+ int prevoptind = optind;
+ int prevopterr = opterr;
+ int wanterror;
+ static int lastoptind = -1;
+
+ if (lastoptind != optind)
+ opterr = 0;
+
+ wanterror = opterr;
+ lastoptind = optind;
+
+ optc = getopt_long_only (argc, argv, "-p", longopts, & longind);
+ opterr = prevopterr;
+
+ switch (optc)
+ {
+ default:
+ if (wanterror)
+ xexit (1);
+ optind = prevoptind;
+ return 0;
+
+ case 'p':
+ no_pipeline_knowledge = 1;
+ break;
+
+ case OPTION_THUMB_ENTRY:
+ thumb_entry_symbol = optarg;
+ break;
+ }
+
+ return 1;
+}
+
+
+static void
+gld${EMULATION_NAME}_before_parse ()
+{
+#ifndef TARGET_ /* I.e., if not generic. */
+ ldfile_set_output_arch ("`echo ${ARCH}`");
+#endif /* not TARGET_ */
+ config.dynamic_link = ${DYNAMIC_LINK-true};
+ config.has_shared = `if test -n "$GENERATE_SHLIB_SCRIPT" ; then echo true ; else echo false ; fi`;
+}
+
+/* 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
+ case " ${EMULATION_LIBPATH} " in
+ *" ${EMULATION_NAME} "*)
+cat >>e${EMULATION_NAME}.c <<EOF
+
+/* For a native linker, check the file /etc/ld.so.conf for directories
+ in which we may find shared libraries. /etc/ld.so.conf is really
+ only meaningful on Linux, but we check it on other systems anyhow. */
+
+static boolean gld${EMULATION_NAME}_check_ld_so_conf
+ PARAMS ((const char *, int));
+
+static boolean
+gld${EMULATION_NAME}_check_ld_so_conf (name, force)
+ const char *name;
+ int force;
+{
+ static boolean initialized;
+ static char *ld_so_conf;
+
+ if (! initialized)
+ {
+ FILE *f;
+
+ f = fopen ("/etc/ld.so.conf", FOPEN_RT);
+ if (f != NULL)
+ {
+ char *b;
+ size_t len, alloc;
+ int c;
+
+ len = 0;
+ alloc = 100;
+ b = (char *) xmalloc (alloc);
+
+ while ((c = getc (f)) != EOF)
+ {
+ if (len + 1 >= 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
+ ;;
+ esac
+fi
+cat >>e${EMULATION_NAME}.c <<EOF
+
+/* These variables are required to pass information back and forth
+ between after_open and check_needed and stat_needed and vercheck. */
+
+static struct bfd_link_needed_list *global_needed;
+static struct stat global_stat;
+static boolean global_found;
+static struct bfd_link_needed_list *global_vercheck_needed;
+static boolean global_vercheck_failed;
+
+static void
+gld${EMULATION_NAME}_after_open ()
+{
+ struct bfd_link_needed_list *needed, *l;
+
+ if (strstr (bfd_get_target (output_bfd), "arm") == NULL)
+ {
+ /* The arm backend needs special fields in the output hash structure.
+ These will only be created if the output format is an arm format,
+ hence we do not support linking and changing output formats at the
+ same time. Use a link followed by objcopy to change output formats. */
+ einfo ("%F%X%P: error: cannot change output format whilst linking ARM binaries\n");
+ return;
+ }
+
+ {
+ LANG_FOR_EACH_INPUT_STATEMENT (is)
+ {
+ /* The interworking bfd must be the last one to be processed */
+ if (!is->next)
+ bfd_elf32_arm_get_bfd_for_interworking (is->the_bfd, & link_info);
+ }
+ }
+
+ /* 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 DT_NEEDED entries in
+ dynamic objects included in the link (often there will be none).
+ 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_elf_get_needed_list (output_bfd, &link_info);
+ for (l = needed; l != NULL; l = l->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;
+
+ if (gld${EMULATION_NAME}_search_needed (command_line.rpath_link,
+ l->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
+ case " ${EMULATION_LIBPATH} " in
+ *" ${EMULATION_NAME} "*)
+cat >>e${EMULATION_NAME}.c <<EOF
+ lib_path = (const char *) getenv ("LD_LIBRARY_PATH");
+ if (gld${EMULATION_NAME}_search_needed (lib_path, l->name, force))
+ break;
+EOF
+ ;;
+ esac
+fi
+cat >>e${EMULATION_NAME}.c <<EOF
+ len = strlen (l->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
+ case " ${EMULATION_LIBPATH} " in
+ *" ${EMULATION_NAME} "*)
+cat >>e${EMULATION_NAME}.c <<EOF
+ if (gld${EMULATION_NAME}_check_ld_so_conf (l->name, force))
+ break;
+EOF
+ ;;
+ esac
+fi
+cat >>e${EMULATION_NAME}.c <<EOF
+ }
+
+ if (force < 2)
+ continue;
+
+ einfo ("%P: warning: %s, needed by %B, not found (try using --rpath)\n",
+ l->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 <<EOF
+ {
+ struct bfd_link_needed_list *l;
+
+ for (l = needed; l != NULL; l = l->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 <<EOF
+ }
+ }
+
+ /* We've found a dynamic object matching the DT_NEEDED entry. */
+
+ /* We have already checked that there is no other input file of the
+ same name. We must now check again that we are not including the
+ same file twice. We need to do this because on many systems
+ libc.so is a symlink to, e.g., libc.so.1. The SONAME entry will
+ reference libc.so.1. If we have already included libc.so, we
+ don't want to include libc.so.1 if they are the same file, and we
+ can only check that using stat. */
+
+ if (bfd_stat (abfd, &global_stat) != 0)
+ einfo ("%F%P:%B: bfd_stat failed: %E\n", abfd);
+ global_found = false;
+ lang_for_each_input_file (gld${EMULATION_NAME}_stat_needed);
+ if (global_found)
+ {
+ /* Return true to indicate that we found the file, even though
+ we aren't going to do anything with it. */
+ return true;
+ }
+
+ /* Tell the ELF backend that don't want the output file to have a
+ DT_NEEDED entry for this file. */
+ bfd_elf_set_dt_needed_name (abfd, "");
+
+ /* 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 an input file matches a DT_NEEDED entry by name. */
+
+static void
+gld${EMULATION_NAME}_check_needed (s)
+ lang_input_statement_type *s;
+{
+ if (global_found)
+ return;
+
+ if (s->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;
+ }
+ }
+}
+
+/* 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_EXCLUDE)
+ return false;
+ else 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,
+ "*default*");
+ 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;
+}
+
+/* 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;
+ }
+}
+
+/* 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);
+}
+
+/* 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;
+ }
+ }
+
+ /* 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 (!bfd_elf32_arm_process_before_allocation (is->the_bfd, & link_info,
+ no_pipeline_knowledge))
+ {
+ /* xgettext:c-format */
+ einfo (_("Errors encountered processing file %s"), is->filename);
+ }
+ }
+ }
+
+ /* We have seen it all. Allocate it, and carry on */
+ bfd_elf32_arm_allocate_interworking_sections (& link_info);
+}
+
+static void
+gld${EMULATION_NAME}_finish PARAMS((void))
+{
+ struct bfd_link_hash_entry * h;
+
+ if (thumb_entry_symbol == NULL)
+ return;
+
+ h = bfd_link_hash_lookup (link_info.hash, thumb_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)
+ {
+ static char buffer[32];
+ bfd_vma val;
+
+ /* Special procesing is required for a Thumb entry symbol. The
+ bottom bit of its address must be set. */
+ val = (h->u.def.value
+ + bfd_get_section_vma (output_bfd,
+ h->u.def.section->output_section)
+ + h->u.def.section->output_offset);
+
+ val |= 1;
+
+ /* Now convert this value into a string and store it in entry_symbol
+ where the lang_finish() function will pick it up. */
+ buffer[0] = '0';
+ buffer[1] = 'x';
+
+ sprintf_vma (buffer + 2, val);
+
+ if (entry_symbol != NULL && entry_from_cmdline)
+ einfo (_("%P: warning: '--thumb-entry %s' is overriding '-e %s'\n"),
+ thumb_entry_symbol, entry_symbol);
+ entry_symbol = buffer;
+ }
+ else
+ einfo (_("%P: warning: connot find thumb start symbol %s\n"), thumb_entry_symbol);
+}
+
+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 stringify.sed"
+
+cat >>e${EMULATION_NAME}.c <<EOF
+{
+ *isfile = 0;
+
+ if (link_info.relocateable == true && config.build_constructors == true)
+ return
+EOF
+sed $sc ldscripts/${EMULATION_NAME}.xu >> 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
+if test -n "$GENERATE_SHLIB_SCRIPT" ; then
+ echo ' ; else if (link_info.shared) return' >> e${EMULATION_NAME}.c
+ sed $sc ldscripts/${EMULATION_NAME}.xs >> e${EMULATION_NAME}.c
+fi
+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 <<EOF
+{
+ *isfile = 1;
+
+ if (link_info.relocateable == true && config.build_constructors == true)
+ return "ldscripts/${EMULATION_NAME}.xu";
+ else if (link_info.relocateable == true)
+ return "ldscripts/${EMULATION_NAME}.xr";
+ else if (!config.text_read_only)
+ return "ldscripts/${EMULATION_NAME}.xbn";
+ else if (!config.magic_demand_paged)
+ return "ldscripts/${EMULATION_NAME}.xn";
+ else if (link_info.shared)
+ return "ldscripts/${EMULATION_NAME}.xs";
+ else
+ return "ldscripts/${EMULATION_NAME}.x";
+}
+EOF
+
+fi
+
+cat >>e${EMULATION_NAME}.c <<EOF
+
+struct ld_emulation_xfer_struct ld_${EMULATION_NAME}_emulation =
+{
+ gld${EMULATION_NAME}_before_parse,
+ syslib_default,
+ hll_default,
+ after_parse_default,
+ gld${EMULATION_NAME}_after_open,
+ after_allocation_default,
+ set_output_arch_default,
+ ldemul_default_target,
+ gld${EMULATION_NAME}_before_allocation,
+ gld${EMULATION_NAME}_get_script,
+ "${EMULATION_NAME}",
+ "${OUTPUT_FORMAT}",
+ gld${EMULATION_NAME}_finish,
+ NULL, /* create output section statements */
+ gld${EMULATION_NAME}_open_dynamic_archive,
+ gld${EMULATION_NAME}_place_orphan,
+ NULL, /* set symbols */
+ gld${EMULATION_NAME}_parse_args,
+ NULL, /* unrecognized file */
+ gld${EMULATION_NAME}_list_options,
+ NULL, /* recognized file */
+ NULL /* find_potential_libraries */
+};
+EOF
diff --git a/contrib/binutils/ld/emultempl/armelf_oabi.em b/contrib/binutils/ld/emultempl/armelf_oabi.em
new file mode 100644
index 0000000..d8ca87a
--- /dev/null
+++ b/contrib/binutils/ld/emultempl/armelf_oabi.em
@@ -0,0 +1,177 @@
+# This shell script emits a C file. -*- C -*-
+# It does some substitutions.
+cat >e${EMULATION_NAME}.c <<EOF
+/* This file is is generated by a shell script. DO NOT EDIT! */
+
+/* emulate the original gld for the given ${EMULATION_NAME}
+ Copyright (C) 1991, 93, 96, 97, 98, 1999 Free Software Foundation, Inc.
+ Written by Steve Chamberlain steve@cygnus.com
+
+This file is part of GLD, the Gnu Linker.
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
+
+#define TARGET_IS_${EMULATION_NAME}
+
+#define bfd_elf32_arm_allocate_interworking_sections \
+ bfd_elf32_arm_oabi_allocate_interworking_sections
+#define bfd_elf32_arm_get_bfd_for_interworking \
+ bfd_elf32_arm_oabi_get_bfd_for_interworking
+#define bfd_elf32_arm_process_before_allocation \
+ bfd_elf32_arm_oabi_process_before_allocation
+
+#include "bfd.h"
+#include "sysdep.h"
+#include "bfdlink.h"
+#include "getopt.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 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 ()
+{
+#ifndef TARGET_ /* I.e., if not generic. */
+ ldfile_set_output_arch ("`echo ${ARCH}`");
+#endif /* not TARGET_ */
+}
+
+/* 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 ()
+{
+ /* 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 (!bfd_elf32_arm_process_before_allocation (is->the_bfd, &link_info, 0))
+ {
+ /* xgettext:c-format */
+ einfo (_("Errors encountered processing file %s"), is->filename);
+ }
+ }
+ }
+
+ /* We have seen it all. Allocate it, and carry on */
+ bfd_elf32_arm_allocate_interworking_sections (& link_info);
+}
+
+static void
+gld${EMULATION_NAME}_after_open ()
+{
+
+ LANG_FOR_EACH_INPUT_STATEMENT (is)
+ {
+ /* The interworking bfd must be the last one to be processed */
+ if (!is->next)
+ bfd_elf32_arm_get_bfd_for_interworking (is->the_bfd, & 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 stringify.sed"
+
+cat >>e${EMULATION_NAME}.c <<EOF
+{
+ *isfile = 0;
+
+ if (link_info.relocateable == true && config.build_constructors == true)
+ return
+EOF
+sed $sc ldscripts/${EMULATION_NAME}.xu >> 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 <<EOF
+{
+ *isfile = 1;
+
+ if (link_info.relocateable == true && config.build_constructors == true)
+ return "ldscripts/${EMULATION_NAME}.xu";
+ else if (link_info.relocateable == true)
+ return "ldscripts/${EMULATION_NAME}.xr";
+ else if (!config.text_read_only)
+ return "ldscripts/${EMULATION_NAME}.xbn";
+ else if (!config.magic_demand_paged)
+ return "ldscripts/${EMULATION_NAME}.xn";
+ else
+ return "ldscripts/${EMULATION_NAME}.x";
+}
+EOF
+
+fi
+
+cat >>e${EMULATION_NAME}.c <<EOF
+
+struct ld_emulation_xfer_struct ld_${EMULATION_NAME}_emulation =
+{
+ gld${EMULATION_NAME}_before_parse,
+ syslib_default,
+ hll_default,
+ after_parse_default,
+ gld${EMULATION_NAME}_after_open,
+ after_allocation_default,
+ set_output_arch_default,
+ ldemul_default_target,
+ gld${EMULATION_NAME}_before_allocation,
+ gld${EMULATION_NAME}_get_script,
+ "${EMULATION_NAME}",
+ "${OUTPUT_FORMAT}",
+ NULL, /* finish */
+ NULL, /* create output section statements */
+ NULL, /* open dynamic archive */
+ NULL, /* place orphan */
+ NULL, /* set symbols */
+ NULL, /* parse args */
+ NULL, /* unrecognized file */
+ NULL, /* list options */
+ NULL, /* recognized file */
+ NULL /* find_potential_libraries */
+};
+EOF
diff --git a/contrib/binutils/ld/emultempl/astring.sed b/contrib/binutils/ld/emultempl/astring.sed
new file mode 100644
index 0000000..08bd8a6
--- /dev/null
+++ b/contrib/binutils/ld/emultempl/astring.sed
@@ -0,0 +1,13 @@
+s/["\\]/\\&/g
+s/$/\\n\\/
+1 s/^/"/
+25s/\\$/"/
+26s/^/"/
+50s/\\$/"/
+51s/^/"/
+75s/\\$/"/
+76s/^/"/
+100s/\\$/"/
+101s/^/"/
+$ s/$/n"/
+$ s/\\n"n"$/\\n"/
diff --git a/contrib/binutils/ld/emultempl/elf32.em b/contrib/binutils/ld/emultempl/elf32.em
index c4debe2..2913ecf 100644
--- a/contrib/binutils/ld/emultempl/elf32.em
+++ b/contrib/binutils/ld/emultempl/elf32.em
@@ -7,7 +7,8 @@ cat >e${EMULATION_NAME}.c <<EOF
/* This file is is generated by a shell script. DO NOT EDIT! */
/* ${ELFSIZE} bit ELF emulation code for ${EMULATION_NAME}
- Copyright (C) 1991, 93, 94, 95, 96, 97, 1998 Free Software Foundation, Inc.
+ Copyright (C) 1991, 93, 94, 95, 96, 97, 98, 1999
+ Free Software Foundation, Inc.
Written by Steve Chamberlain <sac@cygnus.com>
ELF support by Ian Lance Taylor <ian@cygnus.com>
@@ -73,10 +74,12 @@ gld${EMULATION_NAME}_before_parse()
{
ldfile_output_architecture = bfd_arch_`echo ${ARCH} | sed -e 's/:.*//'`;
config.dynamic_link = ${DYNAMIC_LINK-true};
+ config.has_shared = `if test -n "$GENERATE_SHLIB_SCRIPT" ; then echo true ; else echo false ; fi`;
}
/* Try to open a dynamic archive. This is where we know that ELF
- dynamic libraries have an extension of .so. */
+ dynamic libraries have an extension of .so (or .sl on oddball systems
+ like hpux). */
static boolean
gld${EMULATION_NAME}_open_dynamic_archive (arch, search, entry)
@@ -92,13 +95,27 @@ gld${EMULATION_NAME}_open_dynamic_archive (arch, search, entry)
filename = entry->filename;
+ /* This allocates a few bytes too many when EXTRA_SHLIB_EXTENSION
+ is defined, but it does not seem worth the headache to optimize
+ away those two bytes of space. */
string = (char *) xmalloc (strlen (search->name)
+ strlen (filename)
+ strlen (arch)
+#ifdef EXTRA_SHLIB_EXTENSION
+ + strlen (EXTRA_SHLIB_EXTENSION)
+#endif
+ sizeof "/lib.so");
sprintf (string, "%s/lib%s%s.so", search->name, filename, arch);
+#ifdef EXTRA_SHLIB_EXTENSION
+ /* Try the .so extension first. If that fails build a new filename
+ using EXTRA_SHLIB_EXTENSION. */
+ if (! ldfile_try_open_bfd (string, entry))
+ sprintf (string, "%s/lib%s%s%s", search->name,
+ filename, arch, EXTRA_SHLIB_EXTENSION);
+#endif
+
if (! ldfile_try_open_bfd (string, entry))
{
free (string);
@@ -126,10 +143,16 @@ gld${EMULATION_NAME}_open_dynamic_archive (arch, search, entry)
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);
+
+ /* Rather than duplicating the logic above. Just use the
+ filename we recorded earlier.
+
+ First strip off everything before the last '/'. */
+ filename = strrchr (entry->filename, '/');
+ filename++;
+
+ needed_name = (char *) xmalloc (strlen (filename) + 1);
+ strcpy (needed_name, filename);
bfd_elf_set_dt_needed_name (entry->the_bfd, needed_name);
}
@@ -138,7 +161,8 @@ gld${EMULATION_NAME}_open_dynamic_archive (arch, search, entry)
EOF
if [ "x${host}" = "x${target}" ] ; then
- if [ "x${DEFAULT_EMULATION}" = "x${EMULATION_NAME}" ] ; then
+ case " ${EMULATION_LIBPATH} " in
+ *" ${EMULATION_NAME} "*)
cat >>e${EMULATION_NAME}.c <<EOF
/* For a native linker, check the file /etc/ld.so.conf for directories
@@ -223,7 +247,8 @@ gld${EMULATION_NAME}_check_ld_so_conf (name, force)
}
EOF
- fi
+ ;;
+ esac
fi
cat >>e${EMULATION_NAME}.c <<EOF
@@ -308,13 +333,15 @@ gld${EMULATION_NAME}_after_open ()
}
EOF
if [ "x${host}" = "x${target}" ] ; then
- if [ "x${DEFAULT_EMULATION}" = "x${EMULATION_NAME}" ] ; then
+ case " ${EMULATION_LIBPATH} " in
+ *" ${EMULATION_NAME} "*)
cat >>e${EMULATION_NAME}.c <<EOF
lib_path = (const char *) getenv ("LD_LIBRARY_PATH");
if (gld${EMULATION_NAME}_search_needed (lib_path, l->name, force))
break;
EOF
- fi
+ ;;
+ esac
fi
cat >>e${EMULATION_NAME}.c <<EOF
len = strlen (l->name);
@@ -334,12 +361,14 @@ cat >>e${EMULATION_NAME}.c <<EOF
break;
EOF
if [ "x${host}" = "x${target}" ] ; then
- if [ "x${DEFAULT_EMULATION}" = "x${EMULATION_NAME}" ] ; then
+ case " ${EMULATION_LIBPATH} " in
+ *" ${EMULATION_NAME} "*)
cat >>e${EMULATION_NAME}.c <<EOF
if (gld${EMULATION_NAME}_check_ld_so_conf (l->name, force))
break;
EOF
- fi
+ ;;
+ esac
fi
cat >>e${EMULATION_NAME}.c <<EOF
}
@@ -761,37 +790,6 @@ gld${EMULATION_NAME}_before_allocation ()
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
@@ -925,7 +923,9 @@ gld${EMULATION_NAME}_place_orphan (file, s)
stored right after the program headers where the OS can read it
in the first page. */
place = NULL;
- if ((s->flags & SEC_LOAD) != 0
+ if (s->flags & SEC_EXCLUDE)
+ return false;
+ else if ((s->flags & SEC_LOAD) != 0
&& strncmp (secname, ".note", 4) == 0
&& hold_interp != NULL)
place = hold_interp;
@@ -1024,7 +1024,8 @@ gld${EMULATION_NAME}_place_orphan (file, s)
wild_doit (&os->children, s, os, file);
lang_leave_output_section_statement
- ((bfd_vma) 0, "*default*", (struct lang_output_section_phdr_list *) NULL);
+ ((bfd_vma) 0, "*default*", (struct lang_output_section_phdr_list *) NULL,
+ "*default*");
stat_ptr = &add;
if (*ps == '\0' && config.build_constructors)
@@ -1090,30 +1091,31 @@ then
# Scripts compiled in.
# sed commands to quote an ld script as a C string.
-sc='s/["\\]/\\&/g
-s/$/\\n\\/
-1s/^/"/
-$s/$/n"/
-'
+sc="-f stringify.sed"
cat >>e${EMULATION_NAME}.c <<EOF
{
*isfile = 0;
if (link_info.relocateable == true && config.build_constructors == true)
- return `sed "$sc" ldscripts/${EMULATION_NAME}.xu`;
- else if (link_info.relocateable == true)
- return `sed "$sc" ldscripts/${EMULATION_NAME}.xr`;
- else if (!config.text_read_only)
- return `sed "$sc" ldscripts/${EMULATION_NAME}.xbn`;
- else if (!config.magic_demand_paged)
- return `sed "$sc" ldscripts/${EMULATION_NAME}.xn`;
- else if (link_info.shared)
- return `sed "$sc" ldscripts/${EMULATION_NAME}.xs`;
- else
- return `sed "$sc" ldscripts/${EMULATION_NAME}.x`;
-}
+ return
EOF
+sed $sc ldscripts/${EMULATION_NAME}.xu >> 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
+
+if test -n "$GENERATE_SHLIB_SCRIPT" ; then
+echo ' ; else if (link_info.shared) return' >> e${EMULATION_NAME}.c
+sed $sc ldscripts/${EMULATION_NAME}.xs >> e${EMULATION_NAME}.c
+fi
+
+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.
@@ -1139,6 +1141,22 @@ EOF
fi
+if test -n "$PARSE_AND_LIST_ARGS" ; then
+cat >>e${EMULATION_NAME}.c <<EOF
+static int gld_${EMULATION_NAME}_parse_args PARAMS ((int, char **));
+static void gld_${EMULATION_NAME}_list_options PARAMS ((FILE * file));
+
+ $PARSE_AND_LIST_ARGS
+EOF
+else
+
+cat >>e${EMULATION_NAME}.c <<EOF
+#define gld_${EMULATION_NAME}_parse_args NULL
+#define gld_${EMULATION_NAME}_list_options NULL
+EOF
+
+fi
+
cat >>e${EMULATION_NAME}.c <<EOF
struct ld_emulation_xfer_struct ld_${EMULATION_NAME}_emulation =
@@ -1155,9 +1173,15 @@ struct ld_emulation_xfer_struct ld_${EMULATION_NAME}_emulation =
gld${EMULATION_NAME}_get_script,
"${EMULATION_NAME}",
"${OUTPUT_FORMAT}",
- NULL,
- NULL,
+ NULL, /* finish */
+ NULL, /* create output section statements */
gld${EMULATION_NAME}_open_dynamic_archive,
- gld${EMULATION_NAME}_place_orphan
+ gld${EMULATION_NAME}_place_orphan,
+ NULL, /* set_symbols */
+ gld_${EMULATION_NAME}_parse_args,
+ NULL, /* unrecognized_file */
+ gld_${EMULATION_NAME}_list_options,
+ NULL, /* recognized_file */
+ NULL /* find_potential_libraries */
};
EOF
diff --git a/contrib/binutils/ld/emultempl/generic.em b/contrib/binutils/ld/emultempl/generic.em
index 1c0c8eb..6635e09 100644
--- a/contrib/binutils/ld/emultempl/generic.em
+++ b/contrib/binutils/ld/emultempl/generic.em
@@ -4,7 +4,7 @@ cat >e${EMULATION_NAME}.c <<EOF
/* This file is is generated by a shell script. DO NOT EDIT! */
/* emulate the original gld for the given ${EMULATION_NAME}
- Copyright (C) 1991, 1993 Free Software Foundation, Inc.
+ Copyright (C) 1991, 93, 94, 95, 96, 1999 Free Software Foundation, Inc.
Written by Steve Chamberlain steve@cygnus.com
This file is part of GLD, the Gnu Linker.
@@ -56,7 +56,7 @@ then
# Scripts compiled in.
# sed commands to quote an ld script as a C string.
-sc="-f ${srcdir}/emultempl/stringify.sed"
+sc="-f stringify.sed"
cat >>e${EMULATION_NAME}.c <<EOF
{
@@ -113,6 +113,16 @@ struct ld_emulation_xfer_struct ld_${EMULATION_NAME}_emulation =
before_allocation_default,
gld${EMULATION_NAME}_get_script,
"${EMULATION_NAME}",
- "${OUTPUT_FORMAT}"
+ "${OUTPUT_FORMAT}",
+ NULL, /* finish */
+ NULL, /* create output section statements */
+ NULL, /* open dynamic archive */
+ NULL, /* place orphan */
+ NULL, /* set symbols */
+ NULL, /* parse args */
+ NULL, /* unrecognized file */
+ NULL, /* list options */
+ NULL, /* recognized file */
+ NULL /* find_potential_libraries */
};
EOF
diff --git a/contrib/binutils/ld/emultempl/linux.em b/contrib/binutils/ld/emultempl/linux.em
index 6860c3f..dfa855e 100644
--- a/contrib/binutils/ld/emultempl/linux.em
+++ b/contrib/binutils/ld/emultempl/linux.em
@@ -4,7 +4,7 @@ cat >e${EMULATION_NAME}.c <<EOF
/* This file is is generated by a shell script. DO NOT EDIT! */
/* Linux a.out emulation code for ${EMULATION_NAME}
- Copyright (C) 1991, 1993, 1994, 1995, 1996 Free Software Foundation, Inc.
+ Copyright (C) 1991, 93, 94, 95, 96, 98, 1999 Free Software Foundation, Inc.
Written by Steve Chamberlain <sac@cygnus.com>
Linux support by Eric Youngdale <ericy@cais.cais.com>
@@ -53,6 +53,7 @@ gld${EMULATION_NAME}_before_parse()
{
ldfile_output_architecture = bfd_arch_${ARCH};
config.dynamic_link = true;
+ config.has_shared = true;
}
/* Try to open a dynamic archive. This is where we know that Linux
@@ -139,28 +140,25 @@ then
# Scripts compiled in.
# sed commands to quote an ld script as a C string.
-sc='s/["\\]/\\&/g
-s/$/\\n\\/
-1s/^/"/
-$s/$/n"/
-'
+sc="-f stringify.sed"
cat >>e${EMULATION_NAME}.c <<EOF
{
*isfile = 0;
if (link_info.relocateable == true && config.build_constructors == true)
- return `sed "$sc" ldscripts/${EMULATION_NAME}.xu`;
- else if (link_info.relocateable == true)
- return `sed "$sc" ldscripts/${EMULATION_NAME}.xr`;
- else if (!config.text_read_only)
- return `sed "$sc" ldscripts/${EMULATION_NAME}.xbn`;
- else if (!config.magic_demand_paged)
- return `sed "$sc" ldscripts/${EMULATION_NAME}.xn`;
- else
- return `sed "$sc" ldscripts/${EMULATION_NAME}.x`;
-}
+ return
EOF
+sed $sc ldscripts/${EMULATION_NAME}.xu >> 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.
@@ -200,8 +198,15 @@ struct ld_emulation_xfer_struct ld_${EMULATION_NAME}_emulation =
gld${EMULATION_NAME}_get_script,
"${EMULATION_NAME}",
"${OUTPUT_FORMAT}",
- NULL,
+ NULL, /* finish */
gld${EMULATION_NAME}_create_output_section_statements,
- gld${EMULATION_NAME}_open_dynamic_archive
+ gld${EMULATION_NAME}_open_dynamic_archive,
+ NULL, /* place orphan */
+ NULL, /* set symbols */
+ NULL, /* parse args */
+ NULL, /* unrecognized file */
+ NULL, /* list options */
+ NULL, /* recognized file */
+ NULL /* find_potential_libraries */
};
EOF
diff --git a/contrib/binutils/ld/emultempl/ostring.sed b/contrib/binutils/ld/emultempl/ostring.sed
new file mode 100644
index 0000000..a526d3f
--- /dev/null
+++ b/contrib/binutils/ld/emultempl/ostring.sed
@@ -0,0 +1,4 @@
+s/["\\]/\\&/g
+s/$/\\n\\/
+1 s/^/"/
+$ s/$/n"/
diff --git a/contrib/binutils/ld/emultempl/pe.em b/contrib/binutils/ld/emultempl/pe.em
index fcabcbd..d13bb40 100644
--- a/contrib/binutils/ld/emultempl/pe.em
+++ b/contrib/binutils/ld/emultempl/pe.em
@@ -1,8 +1,10 @@
# This shell script emits a C file. -*- C -*-
# It does some substitutions.
-cat >e${EMULATION_NAME}.c <<EOF
+rm -f e${EMULATION_NAME}.c
+(echo;echo;echo;echo;echo)>e${EMULATION_NAME}.c # there, now line numbers match ;-)
+cat >>e${EMULATION_NAME}.c <<EOF
/* This file is part of GLD, the Gnu Linker.
- Copyright 1995, 96, 97, 1998 Free Software Foundation, Inc.
+ Copyright 1995, 96, 97, 98, 99, 2000 Free Software Foundation, Inc.
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
@@ -41,38 +43,101 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#include "ldctor.h"
#include "ldfile.h"
#include "coff/internal.h"
+
+/* FIXME: This is a BFD internal header file, and we should not be
+ using it here. */
#include "../bfd/libcoff.h"
+#include "deffile.h"
+#include "pe-dll.h"
+
#define TARGET_IS_${EMULATION_NAME}
+/* Permit the emulation parameters to override the default section
+ alignment by setting OVERRIDE_SECTION_ALIGNMENT. FIXME: This makes
+ it seem that include/coff/internal.h should not define
+ PE_DEF_SECTION_ALIGNMENT. */
+#if PE_DEF_SECTION_ALIGNMENT != ${OVERRIDE_SECTION_ALIGNMENT:-PE_DEF_SECTION_ALIGNMENT}
+#undef PE_DEF_SECTION_ALIGNMENT
+#define PE_DEF_SECTION_ALIGNMENT ${OVERRIDE_SECTION_ALIGNMENT}
+#endif
+
+#if defined(TARGET_IS_i386pe)
+#define DLL_SUPPORT
+#endif
+#if defined(TARGET_IS_shpe) || defined(TARGET_IS_mipspe) || defined(TARGET_IS_armpe)
+#define DLL_SUPPORT
+#endif
+
+#if defined(TARGET_IS_i386pe) || ! defined(DLL_SUPPORT)
+#define PE_DEF_SUBSYSTEM 3
+#else
+#undef NT_EXE_IMAGE_BASE
+#undef PE_DEF_SECTION_ALIGNMENT
+#undef PE_DEF_FILE_ALIGNMENT
+#define NT_EXE_IMAGE_BASE 0x00010000
+#ifdef TARGET_IS_armpe
+#define PE_DEF_SECTION_ALIGNMENT 0x00001000
+#define PE_DEF_SUBSYSTEM 9
+#else
+#define PE_DEF_SECTION_ALIGNMENT 0x00000400
+#define PE_DEF_SUBSYSTEM 2
+#endif
+#define PE_DEF_FILE_ALIGNMENT 0x00000200
+#endif
+
+#ifdef TARGET_IS_arm_epoc_pe
+#define bfd_arm_pe_allocate_interworking_sections \
+ bfd_arm_epoc_pe_allocate_interworking_sections
+#define bfd_arm_pe_get_bfd_for_interworking \
+ bfd_arm_epoc_pe_get_bfd_for_interworking
+#define bfd_arm_pe_process_before_allocation \
+ bfd_arm_epoc_pe_process_before_allocation
+#endif
+
static void gld_${EMULATION_NAME}_set_symbols PARAMS ((void));
static void gld_${EMULATION_NAME}_after_open PARAMS ((void));
static void gld_${EMULATION_NAME}_before_parse PARAMS ((void));
+static void gld_${EMULATION_NAME}_after_parse PARAMS ((void));
static void gld_${EMULATION_NAME}_before_allocation PARAMS ((void));
-static boolean gld${EMULATION_NAME}_place_orphan
+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 *));
static int gld_${EMULATION_NAME}_parse_args PARAMS ((int, char **));
-
-#if 0 /* argument to qsort so don't prototype */
-static int sort_by_file_name PARAMS ((void *, void *));
-static int sort_by_section_name PARAMS ((void *, void *));
-#endif
-static lang_statement_union_type **sort_sections_1
- PARAMS ((lang_statement_union_type **, lang_statement_union_type *, int,
- int (*)()));
-static void sort_sections PARAMS ((lang_statement_union_type *));
+static void gld_${EMULATION_NAME}_finish PARAMS ((void));
static struct internal_extra_pe_aouthdr pe;
static int dll;
+static int support_old_code = 0;
+static char * thumb_entry_symbol = NULL;
+static lang_assignment_statement_type *image_base_statement = 0;
+
+static int pe_enable_stdcall_fixup = -1; /* 0=disable 1=enable */
+#ifdef DLL_SUPPORT
+static char *pe_out_def_filename = 0;
+static char *pe_implib_filename = 0;
+#endif
extern const char *output_filename;
static void
gld_${EMULATION_NAME}_before_parse()
{
- output_filename = "a.exe";
+ output_filename = "${EXECUTABLE_NAME:-a.exe}";
ldfile_output_architecture = bfd_arch_${ARCH};
+#ifdef DLL_SUPPORT
+ config.has_shared = 1;
+
+#if (PE_DEF_SUBSYSTEM == 9) || (PE_DEF_SUBSYSTEM == 2)
+#if defined TARGET_IS_mipspe || defined TARGET_IS_armpe
+ lang_add_entry ("WinMainCRTStartup", 1);
+#else
+ lang_add_entry ("_WinMainCRTStartup", 1);
+#endif
+#endif
+#endif
}
/* PE format extra command line options. */
@@ -92,31 +157,62 @@ gld_${EMULATION_NAME}_before_parse()
#define OPTION_STACK (OPTION_SECTION_ALIGNMENT + 1)
#define OPTION_SUBSYSTEM (OPTION_STACK + 1)
#define OPTION_HEAP (OPTION_SUBSYSTEM + 1)
-
-static struct option longopts[] = {
+#define OPTION_SUPPORT_OLD_CODE (OPTION_HEAP + 1)
+#define OPTION_OUT_DEF (OPTION_SUPPORT_OLD_CODE + 1)
+#define OPTION_EXPORT_ALL (OPTION_OUT_DEF + 1)
+#define OPTION_EXCLUDE_SYMBOLS (OPTION_EXPORT_ALL + 1)
+#define OPTION_KILL_ATS (OPTION_EXCLUDE_SYMBOLS + 1)
+#define OPTION_STDCALL_ALIASES (OPTION_KILL_ATS + 1)
+#define OPTION_ENABLE_STDCALL_FIXUP (OPTION_STDCALL_ALIASES + 1)
+#define OPTION_DISABLE_STDCALL_FIXUP (OPTION_ENABLE_STDCALL_FIXUP + 1)
+#define OPTION_IMPLIB_FILENAME (OPTION_DISABLE_STDCALL_FIXUP + 1)
+#define OPTION_THUMB_ENTRY (OPTION_IMPLIB_FILENAME + 1)
+#define OPTION_WARN_DUPLICATE_EXPORTS (OPTION_THUMB_ENTRY + 1)
+#define OPTION_IMP_COMPAT (OPTION_WARN_DUPLICATE_EXPORTS + 1)
+
+static struct option longopts[] =
+{
/* PE options */
- {"base-file", required_argument, NULL, OPTION_BASE_FILE},
- {"dll", no_argument, NULL, OPTION_DLL},
- {"file-alignment", required_argument, NULL, OPTION_FILE_ALIGNMENT},
- {"heap", required_argument, NULL, OPTION_HEAP},
- {"image-base", required_argument, NULL, OPTION_IMAGE_BASE},
- {"major-image-version", required_argument, NULL, OPTION_MAJOR_IMAGE_VERSION},
- {"major-os-version", required_argument, NULL, OPTION_MAJOR_OS_VERSION},
- {"major-subsystem-version", required_argument, NULL, OPTION_MAJOR_SUBSYSTEM_VERSION},
- {"minor-image-version", required_argument, NULL, OPTION_MINOR_IMAGE_VERSION},
- {"minor-os-version", required_argument, NULL, OPTION_MINOR_OS_VERSION},
- {"minor-subsystem-version", required_argument, NULL, OPTION_MINOR_SUBSYSTEM_VERSION},
- {"section-alignment", required_argument, NULL, OPTION_SECTION_ALIGNMENT},
- {"stack", required_argument, NULL, OPTION_STACK},
- {"subsystem", required_argument, NULL, OPTION_SUBSYSTEM},
- {NULL, no_argument, NULL, 0}
- };
+ {"base-file", required_argument, NULL, OPTION_BASE_FILE},
+ {"dll", no_argument, NULL, OPTION_DLL},
+ {"file-alignment", required_argument, NULL, OPTION_FILE_ALIGNMENT},
+ {"heap", required_argument, NULL, OPTION_HEAP},
+ {"image-base", required_argument, NULL, OPTION_IMAGE_BASE},
+ {"major-image-version", required_argument, NULL, OPTION_MAJOR_IMAGE_VERSION},
+ {"major-os-version", required_argument, NULL, OPTION_MAJOR_OS_VERSION},
+ {"major-subsystem-version", required_argument, NULL, OPTION_MAJOR_SUBSYSTEM_VERSION},
+ {"minor-image-version", required_argument, NULL, OPTION_MINOR_IMAGE_VERSION},
+ {"minor-os-version", required_argument, NULL, OPTION_MINOR_OS_VERSION},
+ {"minor-subsystem-version", required_argument, NULL, OPTION_MINOR_SUBSYSTEM_VERSION},
+ {"section-alignment", required_argument, NULL, OPTION_SECTION_ALIGNMENT},
+ {"stack", required_argument, NULL, OPTION_STACK},
+ {"subsystem", required_argument, NULL, OPTION_SUBSYSTEM},
+ {"support-old-code", no_argument, NULL, OPTION_SUPPORT_OLD_CODE},
+ {"thumb-entry", required_argument, NULL, OPTION_THUMB_ENTRY},
+#ifdef DLL_SUPPORT
+ /* getopt allows abbreviations, so we do this to stop it from treating -o
+ as an abbreviation for this option */
+ {"output-def", required_argument, NULL, OPTION_OUT_DEF},
+ {"output-def", required_argument, NULL, OPTION_OUT_DEF},
+ {"export-all-symbols", no_argument, NULL, OPTION_EXPORT_ALL},
+ {"exclude-symbols", required_argument, NULL, OPTION_EXCLUDE_SYMBOLS},
+ {"kill-at", no_argument, NULL, OPTION_KILL_ATS},
+ {"add-stdcall-alias", no_argument, NULL, OPTION_STDCALL_ALIASES},
+ {"enable-stdcall-fixup", no_argument, NULL, OPTION_ENABLE_STDCALL_FIXUP},
+ {"disable-stdcall-fixup", no_argument, NULL, OPTION_DISABLE_STDCALL_FIXUP},
+ {"out-implib", required_argument, NULL, OPTION_IMPLIB_FILENAME},
+ {"warn-duplicate-exports", no_argument, NULL, OPTION_WARN_DUPLICATE_EXPORTS},
+ {"compat-implib", no_argument, NULL, OPTION_IMP_COMPAT},
+#endif
+ {NULL, no_argument, NULL, 0}
+};
/* PE/WIN32; added routines to get the subsystem type, heap and/or stack
parameters which may be input from the command line */
-typedef struct {
+typedef struct
+{
void *ptr;
int size;
int value;
@@ -132,16 +228,20 @@ static definfo init[] =
#define IMAGEBASEOFF 0
D(ImageBase,"__image_base__", NT_EXE_IMAGE_BASE),
#define DLLOFF 1
- {&dll, sizeof(dll), 0, "__dll__"},
+ {&dll, sizeof(dll), 0, "__dll__", 0},
D(SectionAlignment,"__section_alignment__", PE_DEF_SECTION_ALIGNMENT),
D(FileAlignment,"__file_alignment__", PE_DEF_FILE_ALIGNMENT),
D(MajorOperatingSystemVersion,"__major_os_version__", 4),
D(MinorOperatingSystemVersion,"__minor_os_version__", 0),
D(MajorImageVersion,"__major_image_version__", 1),
D(MinorImageVersion,"__minor_image_version__", 0),
+#ifdef TARGET_IS_armpe
+ D(MajorSubsystemVersion,"__major_subsystem_version__", 2),
+#else
D(MajorSubsystemVersion,"__major_subsystem_version__", 4),
+#endif
D(MinorSubsystemVersion,"__minor_subsystem_version__", 0),
- D(Subsystem,"__subsystem__", 3),
+ D(Subsystem,"__subsystem__", ${SUBSYSTEM}),
D(SizeOfStackReserve,"__size_of_stack_reserve__", 0x2000000),
D(SizeOfStackCommit,"__size_of_stack_commit__", 0x1000),
D(SizeOfHeapReserve,"__size_of_heap_reserve__", 0x100000),
@@ -150,6 +250,40 @@ static definfo init[] =
{ NULL, 0, 0, NULL, 0 }
};
+static void
+gld_${EMULATION_NAME}_list_options (file)
+ FILE * file;
+{
+ fprintf (file, _(" --base_file <basefile> Generate a base file for relocatable DLLs\n"));
+ fprintf (file, _(" --dll Set image base to the default for DLLs\n"));
+ fprintf (file, _(" --file-alignment <size> Set file alignment\n"));
+ fprintf (file, _(" --heap <size> Set initial size of the heap\n"));
+ fprintf (file, _(" --image-base <address> Set start address of the executable\n"));
+ fprintf (file, _(" --major-image-version <number> Set version number of the executable\n"));
+ fprintf (file, _(" --major-os-version <number> Set minimum required OS version\n"));
+ fprintf (file, _(" --major-subsystem-version <number> Set minimum required OS subsystem version\n"));
+ fprintf (file, _(" --minor-image-version <number> Set revision number of the executable\n"));
+ fprintf (file, _(" --minor-os-version <number> Set minimum required OS revision\n"));
+ fprintf (file, _(" --minor-subsystem-version <number> Set minimum required OS subsystem revision\n"));
+ fprintf (file, _(" --section-alignment <size> Set section alignment\n"));
+ fprintf (file, _(" --stack <size> Set size of the initial stack\n"));
+ fprintf (file, _(" --subsystem <name>[:<version>] Set required OS subsystem [& version]\n"));
+ fprintf (file, _(" --support-old-code Support interworking with old code\n"));
+ fprintf (file, _(" --thumb-entry=<symbol> Set the entry point to be Thumb <symbol>\n"));
+#ifdef DLL_SUPPORT
+ fprintf (file, _(" --add-stdcall-alias Export symbols with and without @nn\n"));
+ fprintf (file, _(" --disable-stdcall-fixup Don't link _sym to _sym@nn\n"));
+ fprintf (file, _(" --enable-stdcall-fixup Link _sym to _sym@nn without warnings\n"));
+ fprintf (file, _(" --exclude-symbols sym,sym,... Exclude symbols from automatic export\n"));
+ fprintf (file, _(" --export-all-symbols Automatically export all globals to DLL\n"));
+ fprintf (file, _(" --kill-at Remove @nn from exported symbols\n"));
+ fprintf (file, _(" --out-implib <file> Generate import library\n"));
+ fprintf (file, _(" --output-def <file> Generate a .DEF file for the built DLL\n"));
+ fprintf (file, _(" --warn-duplicate-exports Warn about duplicate exports.\n"));
+ fprintf (file, _(" --compat-implib Create backward compatible import libs;\n"));
+ fprintf (file, _(" create __imp_<SYMBOL> as well.\n"));
+#endif
+}
static void
set_pe_name (name, val)
@@ -185,14 +319,19 @@ set_pe_subsystem ()
}
v[] =
{
- { "native", 1, "_NtProcessStartup" },
- { "windows", 2, "_WinMainCRTStartup" },
- { "console", 3, "_mainCRTStartup" },
+ { "native", 1, "NtProcessStartup" },
+#if defined TARGET_IS_mipspe || defined TARGET_IS_armpe
+ { "windows", 2, "WinMainCRTStartup" },
+#else
+ { "windows", 2, "WinMainCRTStartup" },
+#endif
+ { "console", 3, "mainCRTStartup" },
#if 0
/* The Microsoft linker does not recognize this. */
{ "os2", 5, "" },
#endif
- { "posix", 7, "___PosixProcessStartup"},
+ { "posix", 7, "__PosixProcessStartup"},
+ { "wince", 9, "_WinMainCRTStartup" },
{ 0, 0, 0 }
};
@@ -210,7 +349,7 @@ set_pe_subsystem ()
set_pe_name ("__minor_subsystem_version__",
strtoul (end + 1, &end, 0));
if (*end != '\0')
- einfo ("%P: warning: bad version number in -subsystem option\n");
+ einfo (_("%P: warning: bad version number in -subsystem option\n"));
}
for (i = 0; v[i].name; i++)
@@ -218,31 +357,35 @@ set_pe_subsystem ()
if (strncmp (optarg, v[i].name, len) == 0
&& v[i].name[len] == '\0')
{
+ const char *initial_symbol_char;
+ const char *entry;
+
set_pe_name ("__subsystem__", v[i].value);
- /* If the subsystem is windows, we use a different entry
- point. We also register the entry point as an undefined
- symbol. 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. */
- lang_add_entry (v[i].entry, 1);
- ldlang_add_undef (v[i].entry);
+ initial_symbol_char = ${INITIAL_SYMBOL_CHAR};
+ if (*initial_symbol_char == '\0')
+ entry = v[i].entry;
+ else
+ {
+ char *alc_entry;
+
+ /* lang_add_entry expects its argument to be permanently
+ allocated, so we don't free this string. */
+ alc_entry = xmalloc (strlen (initial_symbol_char)
+ + strlen (v[i].entry)
+ + 1);
+ strcpy (alc_entry, initial_symbol_char);
+ strcat (alc_entry, v[i].entry);
+ entry = alc_entry;
+ }
+
+ lang_add_entry (entry, 1);
return;
}
}
- einfo ("%P%F: invalid subsystem type %s\n", optarg);
+
+ einfo (_("%P%F: invalid subsystem type %s\n"), optarg);
}
@@ -253,11 +396,11 @@ set_pe_value (name)
{
char *end;
+
set_pe_name (name, strtoul (optarg, &end, 0));
+
if (end == optarg)
- {
- einfo ("%P%F: invalid hex number for PE parameter '%s'\n", optarg);
- }
+ einfo (_("%P%F: invalid hex number for PE parameter '%s'\n"), optarg);
optarg = end;
}
@@ -268,15 +411,14 @@ set_pe_stack_heap (resname, comname)
char *comname;
{
set_pe_value (resname);
+
if (*optarg == ',')
{
optarg++;
set_pe_value (comname);
}
else if (*optarg)
- {
- einfo ("%P%F: strange hex info for PE parameter '%s'\n", optarg);
- }
+ einfo (_("%P%F: strange hex info for PE parameter '%s'\n"), optarg);
}
@@ -314,7 +456,8 @@ gld_${EMULATION_NAME}_parse_args(argc, argv)
link_info.base_file = (PTR) fopen (optarg, FOPEN_WB);
if (link_info.base_file == NULL)
{
- fprintf (stderr, "%s: Can't open base file %s\n",
+ /* xgettext:c-format */
+ fprintf (stderr, _("%s: Can't open base file %s\n"),
program_name, optarg);
xexit (1);
}
@@ -360,6 +503,44 @@ gld_${EMULATION_NAME}_parse_args(argc, argv)
case OPTION_IMAGE_BASE:
set_pe_value ("__image_base__");
break;
+ case OPTION_SUPPORT_OLD_CODE:
+ support_old_code = 1;
+ break;
+ case OPTION_THUMB_ENTRY:
+ thumb_entry_symbol = optarg;
+ break;
+#ifdef DLL_SUPPORT
+ case OPTION_OUT_DEF:
+ pe_out_def_filename = xstrdup (optarg);
+ break;
+ case OPTION_EXPORT_ALL:
+ pe_dll_export_everything = 1;
+ break;
+ case OPTION_EXCLUDE_SYMBOLS:
+ pe_dll_add_excludes (optarg);
+ break;
+ case OPTION_KILL_ATS:
+ pe_dll_kill_ats = 1;
+ break;
+ case OPTION_STDCALL_ALIASES:
+ pe_dll_stdcall_aliases = 1;
+ break;
+ case OPTION_ENABLE_STDCALL_FIXUP:
+ pe_enable_stdcall_fixup = 1;
+ break;
+ case OPTION_DISABLE_STDCALL_FIXUP:
+ pe_enable_stdcall_fixup = 0;
+ break;
+ case OPTION_IMPLIB_FILENAME:
+ pe_implib_filename = xstrdup (optarg);
+ break;
+ case OPTION_WARN_DUPLICATE_EXPORTS:
+ pe_dll_warn_dup_exports = 1;
+ break;
+ case OPTION_IMP_COMPAT:
+ pe_dll_compat_implib = 1;
+ break;
+#endif
}
return 1;
}
@@ -368,7 +549,7 @@ gld_${EMULATION_NAME}_parse_args(argc, argv)
read. */
static void
-gld_${EMULATION_NAME}_set_symbols()
+gld_${EMULATION_NAME}_set_symbols ()
{
/* Run through and invent symbols for all the
names and insert the defaults. */
@@ -379,7 +560,7 @@ gld_${EMULATION_NAME}_set_symbols()
{
if (link_info.relocateable)
init[IMAGEBASEOFF].value = 0;
- else if (init[DLLOFF].value)
+ else if (init[DLLOFF].value || link_info.shared)
init[IMAGEBASEOFF].value = NT_DLL_IMAGE_BASE;
else
init[IMAGEBASEOFF].value = NT_EXE_IMAGE_BASE;
@@ -397,7 +578,8 @@ gld_${EMULATION_NAME}_set_symbols()
for (j = 0; init[j].ptr; j++)
{
long val = init[j].value;
- lang_add_assignment (exp_assop ('=' ,init[j].symbol, exp_intop (val)));
+ lang_assignment_statement_type *rv;
+ rv = 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))
@@ -408,6 +590,8 @@ gld_${EMULATION_NAME}_set_symbols()
else if (init[j].size == sizeof(bfd_vma))
*(bfd_vma *)init[j].ptr = val;
else abort();
+ if (j == IMAGEBASEOFF)
+ image_base_statement = rv;
}
/* Restore the pointer. */
stat_ptr = save;
@@ -415,209 +599,253 @@ gld_${EMULATION_NAME}_set_symbols()
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");
+ einfo (_("%P: warning, file alignment > section alignment.\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;
+/* This is called after the linker script and the command line options
+ have been read. */
- return strcmp ((*ra)->input_section.ifile->filename,
- (*rb)->input_section.ifile->filename);
-}
-
-static int
-sort_by_section_name (a, b)
- void *a;
- void *b;
+static void
+gld_${EMULATION_NAME}_after_parse ()
{
- lang_statement_union_type **ra = a;
- lang_statement_union_type **rb = b;
- return strcmp ((*ra)->input_section.section->name,
- (*rb)->input_section.section->name);
+ /* The Windows libraries are designed for the linker to treat the
+ entry point as an undefined symbol. Otherwise, the .obj that
+ defines mainCRTStartup is brought in because 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, we act as
+ though the user specified -u with the entry point symbol.
+
+ This function is called after the linker script and command line
+ options have been read, so at this point we know the right entry
+ point. This function is called before the input files are
+ opened, so registering the symbol as undefined will make a
+ difference. */
+
+ if (! link_info.relocateable && entry_symbol != NULL)
+ ldlang_add_undef (entry_symbol);
}
-/* 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 struct bfd_link_hash_entry *pe_undef_found_sym;
-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) ();
+static boolean
+pe_undef_cdecl_match (h, string)
+ struct bfd_link_hash_entry *h;
+ PTR string;
{
- 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;
+ int sl = strlen (string);
+ if (h->type == bfd_link_hash_defined
+ && strncmp (h->root.string, string, sl) == 0
+ && h->root.string[sl] == '@')
+ {
+ pe_undef_found_sym = h;
+ return false;
+ }
+ return true;
}
-/* 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. */
-
+#ifdef DLL_SUPPORT
static void
-sort_sections (s)
- lang_statement_union_type *s;
+pe_fixup_stdcalls ()
{
- for (; s ; s = s->next)
- switch (s->header.type)
+ static int gave_warning_message = 0;
+ struct bfd_link_hash_entry *undef, *sym;
+ char *at;
+ for (undef = link_info.hash->undefs; undef; undef=undef->next)
+ if (undef->type == bfd_link_hash_undefined)
+ {
+ at = strchr (undef->root.string, '@');
+ if (at)
{
- case lang_output_section_statement_enum:
- sort_sections (s->output_section_statement.children.head);
- break;
- case lang_wild_statement_enum:
+ /* The symbol is a stdcall symbol, so let's look for a cdecl
+ symbol with the same name and resolve to that */
+ char *cname = xstrdup (undef->root.string);
+ at = strchr (cname, '@');
+ *at = 0;
+ sym = bfd_link_hash_lookup (link_info.hash, cname, 0, 0, 1);
+ if (sym && sym->type == bfd_link_hash_defined)
{
- 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)
+ undef->type = bfd_link_hash_defined;
+ undef->u.def.value = sym->u.def.value;
+ undef->u.def.section = sym->u.def.section;
+ if (pe_enable_stdcall_fixup == -1)
{
- /* 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)
+ einfo (_("Warning: resolving %s by linking to %s\n"),
+ undef->root.string, cname);
+ if (! gave_warning_message)
{
- 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);
- }
+ gave_warning_message = 1;
+ einfo(_("Use --enable-stdcall-fixup to disable these warnings\n"));
+ einfo(_("Use --disable-stdcall-fixup to disable these fixups\n"));
}
- 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)
+ }
+ }
+ else
+ {
+ /* The symbol is a cdecl symbol, so we look for stdcall
+ symbols - which means scanning the whole symbol table */
+ pe_undef_found_sym = 0;
+ bfd_link_hash_traverse (link_info.hash, pe_undef_cdecl_match,
+ (PTR) undef->root.string);
+ sym = pe_undef_found_sym;
+ if (sym)
+ {
+ undef->type = bfd_link_hash_defined;
+ undef->u.def.value = sym->u.def.value;
+ undef->u.def.section = sym->u.def.section;
+ if (pe_enable_stdcall_fixup == -1)
{
- char *q = strchr (s->wild_statement.section_name, '\$');
-
- if (q != NULL
- && (q[1] == '\0'
- || (q[1] == '*' && q[2] == '\0')))
+ einfo (_("Warning: resolving %s by linking to %s\n"),
+ undef->root.string, sym->root.string);
+ if (! gave_warning_message)
{
- 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);
+ gave_warning_message = 1;
+ einfo(_("Use --enable-stdcall-fixup to disable these warnings\n"));
+ einfo(_("Use --disable-stdcall-fixup to disable these fixups\n"));
}
- break;
}
}
- break;
- default:
- break;
}
+ }
}
+#endif /* DLL_SUPPORT */
+
+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;
+
+#ifdef DLL_SUPPORT
+ if (pe_enable_stdcall_fixup) /* -1=warn or 1=disable */
+ pe_fixup_stdcalls ();
+
+ pe_process_import_defs(output_bfd, &link_info);
+ if (link_info.shared)
+ pe_dll_build_sections (output_bfd, &link_info);
+
+#ifndef TARGET_IS_i386pe
+#ifndef TARGET_IS_armpe
+ else
+ pe_exe_build_sections (output_bfd, &link_info);
+#endif
+#endif
+#endif
+
+#if defined(TARGET_IS_armpe) || defined(TARGET_IS_arm_epoc_pe)
+ if (strstr (bfd_get_target (output_bfd), "arm") == NULL)
+ {
+ /* The arm backend needs special fields in the output hash structure.
+ These will only be created if the output format is an arm format,
+ hence we do not support linking and changing output formats at the
+ same time. Use a link followed by objcopy to change output formats. */
+ einfo ("%F%X%P: error: cannot change output format whilst linking ARM binaries\n");
+ return;
+ }
+ {
+ /* Find a BFD that can hold the interworking stubs. */
+ LANG_FOR_EACH_INPUT_STATEMENT (is)
+ {
+ if (bfd_arm_pe_get_bfd_for_interworking (is->the_bfd, & link_info))
+ break;
+ }
+ }
+#endif
+
+ {
+ int is_ms_arch = 0;
+ bfd *cur_arch = 0;
+ lang_input_statement_type *is2;
+
+ /* Careful - this is a shell script. Watch those dollar signs! */
+ /* Microsoft import libraries have every member named the same,
+ and not in the right order for us to link them correctly. We
+ must detect these and rename the members so that they'll link
+ correctly. There are three types of objects: the head, the
+ thunks, and the sentinel(s). The head is easy; it's the one
+ with idata2. We assume that the sentinels won't have relocs,
+ and the thunks will. It's easier than checking the symbol
+ table for external references. */
+ LANG_FOR_EACH_INPUT_STATEMENT (is)
+ {
+ if (is->the_bfd->my_archive)
+ {
+ bfd *arch = is->the_bfd->my_archive;
+ if (cur_arch != arch)
+ {
+ cur_arch = arch;
+ is_ms_arch = 1;
+ for (is2 = is;
+ is2 && is2->the_bfd->my_archive == arch;
+ is2 = (lang_input_statement_type *)is2->next)
+ {
+ if (strcmp (is->the_bfd->filename, is2->the_bfd->filename))
+ is_ms_arch = 0;
+ }
+ }
+
+ if (is_ms_arch)
+ {
+ int idata2 = 0, reloc_count=0;
+ asection *sec;
+ char *new_name, seq;
+
+ for (sec = is->the_bfd->sections; sec; sec = sec->next)
+ {
+ if (strcmp (sec->name, ".idata\$2") == 0)
+ idata2 = 1;
+ reloc_count += sec->reloc_count;
+ }
+
+ if (idata2) /* .idata2 is the TOC */
+ seq = 'a';
+ else if (reloc_count > 0) /* thunks */
+ seq = 'b';
+ else /* sentinel */
+ seq = 'c';
+
+ new_name = xmalloc (strlen (is->the_bfd->filename) + 3);
+ sprintf (new_name, "%s.%c", is->the_bfd->filename, seq);
+ is->the_bfd->filename = new_name;
+
+ new_name = xmalloc (strlen(is->filename) + 3);
+ sprintf (new_name, "%s.%c", is->filename, seq);
+ is->filename = new_name;
+ }
+ }
+ }
+ }
+}
+
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))
+ if (!ppc_process_before_allocation (is->the_bfd, &link_info))
{
- einfo("Errors encountered processing file %s\n", is->filename);
+ /* xgettext:c-format */
+ 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
+#endif /* TARGET_IS_ppcpe */
+
+#if defined(TARGET_IS_armpe) || defined(TARGET_IS_arm_epoc_pe)
/* FIXME: we should be able to set the size of the interworking stub
section.
@@ -627,109 +855,458 @@ gld_${EMULATION_NAME}_before_allocation()
{
LANG_FOR_EACH_INPUT_STATEMENT (is)
{
- if (!arm_process_before_allocation (is->the_bfd, & link_info))
+ if (! bfd_arm_pe_process_before_allocation
+ (is->the_bfd, & link_info, support_old_code))
{
- einfo ("Errors encountered processing file %s", is->filename);
+ /* xgettext:c-format */
+ einfo (_("Errors encountered processing file %s for interworking"),
+ is->filename);
}
}
}
/* We have seen it all. Allocate it, and carry on */
- arm_allocate_interworking_sections (& link_info);
+ bfd_arm_pe_allocate_interworking_sections (& link_info);
#endif /* TARGET_IS_armpe */
-#endif /* TARGET_IS_ppcpe */
+}
+
+
+/* This is called when an input file isn't recognized as a BFD. We
+ check here for .DEF files and pull them in automatically. */
+#ifdef DLL_SUPPORT
+static int
+saw_option(char *option)
+{
+ int i;
+ for (i=0; init[i].ptr; i++)
+ if (strcmp (init[i].symbol, option) == 0)
+ return init[i].inited;
+ return 0;
+}
+#endif
+
+static boolean
+gld_${EMULATION_NAME}_unrecognized_file(entry)
+ lang_input_statement_type *entry ATTRIBUTE_UNUSED;
+{
+#ifdef DLL_SUPPORT
+ const char *ext = entry->filename + strlen (entry->filename) - 4;
+
+ if (strcmp (ext, ".def") == 0 || strcmp (ext, ".DEF") == 0)
+ {
+ if (pe_def_file == 0)
+ pe_def_file = def_file_empty ();
+ def_file_parse (entry->filename, pe_def_file);
+ if (pe_def_file)
+ {
+ int i, buflen=0, len;
+ char *buf;
+ for (i=0; i<pe_def_file->num_exports; i++)
+ {
+ len = strlen(pe_def_file->exports[i].internal_name);
+ if (buflen < len+2)
+ buflen = len+2;
+ }
+ buf = (char *) xmalloc (buflen);
+ for (i=0; i<pe_def_file->num_exports; i++)
+ {
+ struct bfd_link_hash_entry *h;
+ sprintf(buf, "_%s", pe_def_file->exports[i].internal_name);
+
+ h = bfd_link_hash_lookup (link_info.hash, buf, 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;
+ h->u.undef.abfd = NULL;
+ bfd_link_add_undef (link_info.hash, h);
+ }
+ }
+ free (buf);
+
+ /* def_file_print (stdout, pe_def_file); */
+ if (pe_def_file->is_dll == 1)
+ link_info.shared = 1;
+
+ if (pe_def_file->base_address != (bfd_vma)(-1))
+ {
+ pe.ImageBase =
+ pe_data (output_bfd)->pe_opthdr.ImageBase =
+ init[IMAGEBASEOFF].value = pe_def_file->base_address;
+ init[IMAGEBASEOFF].inited = 1;
+ if (image_base_statement)
+ image_base_statement->exp =
+ exp_assop ('=', "__image_base__", exp_intop (pe.ImageBase));
+ }
+
+#if 0
+ /* Not sure if these *should* be set */
+ if (pe_def_file->version_major != -1)
+ {
+ pe.MajorImageVersion = pe_def_file->version_major;
+ pe.MinorImageVersion = pe_def_file->version_minor;
+ }
+#endif
+ if (pe_def_file->stack_reserve != -1
+ && ! saw_option ("__size_of_stack_reserve__"))
+ {
+ pe.SizeOfStackReserve = pe_def_file->stack_reserve;
+ if (pe_def_file->stack_commit != -1)
+ pe.SizeOfStackCommit = pe_def_file->stack_commit;
+ }
+ if (pe_def_file->heap_reserve != -1
+ && ! saw_option ("__size_of_heap_reserve__"))
+ {
+ pe.SizeOfHeapReserve = pe_def_file->heap_reserve;
+ if (pe_def_file->heap_commit != -1)
+ pe.SizeOfHeapCommit = pe_def_file->heap_commit;
+ }
+ return true;
+ }
+ }
+#endif
+ return false;
+
+}
- sort_sections (stat_ptr->head);
+static boolean
+gld_${EMULATION_NAME}_recognized_file(entry)
+ lang_input_statement_type *entry ATTRIBUTE_UNUSED;
+{
+#ifdef DLL_SUPPORT
+#ifdef TARGET_IS_i386pe
+ pe_dll_id_target ("pei-i386");
+#endif
+#ifdef TARGET_IS_shpe
+ pe_dll_id_target ("pei-shl");
+#endif
+#ifdef TARGET_IS_mipspe
+ pe_dll_id_target ("pei-mips");
+#endif
+#ifdef TARGET_IS_armpe
+ pe_dll_id_target ("pei-arm-little");
+#endif
+ if (bfd_get_format (entry->the_bfd) == bfd_object)
+ {
+ const char *ext = entry->filename + strlen (entry->filename) - 4;
+ if (strcmp (ext, ".dll") == 0 || strcmp (ext, ".DLL") == 0)
+ return pe_implied_import_dll (entry->filename);
+ }
+#endif
+ return false;
+}
+
+static void
+gld_${EMULATION_NAME}_finish ()
+{
+#if defined(TARGET_IS_armpe) || defined(TARGET_IS_arm_epoc_pe)
+ struct bfd_link_hash_entry * h;
+
+ if (thumb_entry_symbol != NULL)
+ {
+ h = bfd_link_hash_lookup (link_info.hash, thumb_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)
+ {
+ static char buffer[32];
+ bfd_vma val;
+
+ /* Special procesing is required for a Thumb entry symbol. The
+ bottom bit of its address must be set. */
+ val = (h->u.def.value
+ + bfd_get_section_vma (output_bfd,
+ h->u.def.section->output_section)
+ + h->u.def.section->output_offset);
+
+ val |= 1;
+
+ /* Now convert this value into a string and store it in entry_symbol
+ where the lang_finish() function will pick it up. */
+ buffer[0] = '0';
+ buffer[1] = 'x';
+
+ sprintf_vma (buffer + 2, val);
+
+ if (entry_symbol != NULL && entry_from_cmdline)
+ einfo (_("%P: warning: '--thumb-entry %s' is overriding '-e %s'\n"),
+ thumb_entry_symbol, entry_symbol);
+ entry_symbol = buffer;
+ }
+ else
+ einfo (_("%P: warning: connot find thumb start symbol %s\n"), thumb_entry_symbol);
+ }
+#endif /* defined(TARGET_IS_armpe) || defined(TARGET_IS_arm_epoc_pe) */
+
+#ifdef DLL_SUPPORT
+ if (link_info.shared)
+ {
+ pe_dll_fill_sections (output_bfd, &link_info);
+ if (pe_implib_filename)
+ pe_dll_generate_implib (pe_def_file, pe_implib_filename);
+ }
+#if defined(TARGET_IS_shpe) || defined(TARGET_IS_mipspe)
+ else
+ {
+ pe_exe_fill_sections (output_bfd, &link_info);
+ }
+#endif
+
+ if (pe_out_def_filename)
+ pe_dll_generate_def_file (pe_out_def_filename);
+#endif
}
+
-/* 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.
+/* Place an orphan section.
+
+ We use this to put sections in a reasonable place in the file, and
+ to ensure that they are aligned as required.
+
+ We handle grouped sections here as well. A section named .foo$nn
+ goes into the output section .foo. All grouped sections are sorted
+ by name.
+
+ Grouped sections for the default sections are handled by the
+ default linker script using wildcards, and are sorted by
+ sort_sections. */
+
+static asection *hold_section;
+static char *hold_section_name;
+static lang_output_section_statement_type *hold_use;
+static lang_output_section_statement_type *hold_text;
+static lang_output_section_statement_type *hold_rdata;
+static lang_output_section_statement_type *hold_data;
+static lang_output_section_statement_type *hold_bss;
- 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. */
+/* Place an orphan section. We use this to put random SHF_ALLOC
+ sections in the right segment. */
/*ARGSUSED*/
static boolean
-gld${EMULATION_NAME}_place_orphan (file, s)
+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;
+ char *dollar = NULL;
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 through the script to see where to place this section. */
- /* 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)
+ hold_section = s;
+
+ hold_section_name = xstrdup (secname);
+ if (!link_info.relocateable)
{
- if (l->header.type == lang_wild_statement_enum
- && strcmp (l->wild_statement.section_name, output_secname) == 0)
- break;
+ dollar = strchr (hold_section_name, '$');
+ if (dollar != NULL)
+ *dollar = '\0';
+ }
+
+ hold_use = NULL;
+ lang_for_each_statement (gld${EMULATION_NAME}_place_section);
+
+ if (hold_use == NULL)
+ {
+ lang_output_section_statement_type *place;
+ char *outsecname;
+ asection *snew, **pps;
+ lang_statement_list_type *old;
+ lang_statement_list_type add;
+ etree_type *address;
+
+ /* Try to put the new output section in a reasonable place based
+ on the section name and section flags. */
+ place = NULL;
+ 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 ((s->flags & SEC_CODE) == 0
+ && (s->flags & SEC_READONLY) != 0
+ && hold_rdata != NULL)
+ place = hold_rdata;
+ else if ((s->flags & SEC_READONLY) != 0
+ && hold_text != NULL)
+ place = hold_text;
+
+ /* 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 = xstrdup (hold_section_name);
+ 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);
+
+ free (outsecname);
+ outsecname = newname;
+ }
+
+ /* We don't want to free OUTSECNAME, as it may get attached to
+ the output section statement. */
+
+ /* 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 != NULL && 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 (link_info.relocateable)
+ address = NULL;
+ else
+ {
+ /* All sections in an executable must be aligned to a page
+ boundary. */
+ address = exp_unop (ALIGN_K,
+ exp_nameop (NAME, "__section_alignment__"));
+ }
+
+ lang_enter_output_section_statement (outsecname, address, 0,
+ (bfd_vma) 0,
+ (etree_type *) NULL,
+ (etree_type *) NULL,
+ (etree_type *) NULL);
+
+ hold_use = lang_output_section_statement_lookup (outsecname);
+
+ lang_leave_output_section_statement
+ ((bfd_vma) 0, "*default*",
+ (struct lang_output_section_phdr_list *) NULL,
+ "*default*");
+
+ /* Now stick the new statement list right after PLACE. */
+ if (place != NULL)
+ {
+ *add.tail = place->header.next;
+ place->header.next = add.head;
+ }
+
+ stat_ptr = old;
}
- 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. */
+
+ if (dollar == NULL)
+ wild_doit (&hold_use->children, s, hold_use, file);
+ else
{
- 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;
+ lang_statement_union_type **pl;
+ boolean found_dollar;
+ lang_statement_list_type list;
+
+ /* The section name has a '$'. Sort it with the other '$'
+ sections. */
+
+ found_dollar = false;
+ for (pl = &hold_use->children.head; *pl != NULL; pl = &(*pl)->next)
+ {
+ lang_input_section_type *ls;
+ const char *lname;
+
+ if ((*pl)->header.type != lang_input_section_enum)
+ continue;
+
+ ls = &(*pl)->input_section;
+
+ lname = bfd_get_section_name (ls->ifile->the_bfd, ls->section);
+ if (strchr (lname, '$') == NULL)
+ {
+ if (found_dollar)
+ break;
+ }
+ else
+ {
+ found_dollar = true;
+ if (strcmp (secname, lname) < 0)
+ break;
+ }
+ }
+
+ lang_list_init (&list);
+ wild_doit (&list, s, hold_use, file);
+ if (list.head != NULL)
+ {
+ ASSERT (list.head->next == NULL);
+ list.head->next = *pl;
+ *pl = list.head;
+ }
}
-#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);
+ free (hold_section_name);
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, ".rdata") == 0)
+ hold_rdata = os;
+ else if (strcmp (os->name, ".data") == 0)
+ hold_data = os;
+ else if (strcmp (os->name, ".bss") == 0)
+ hold_bss = os;
+}
+
+static int
+gld_${EMULATION_NAME}_find_potential_libraries (name, entry)
+ char * name;
+ lang_input_statement_type * entry;
+{
+ return ldfile_open_file_search (name, entry, "", ".lib");
+}
static char *
gld_${EMULATION_NAME}_get_script(isfile)
@@ -737,7 +1314,7 @@ gld_${EMULATION_NAME}_get_script(isfile)
EOF
# Scripts compiled in.
# sed commands to quote an ld script as a C string.
-sc="-f ${srcdir}/emultempl/stringify.sed"
+sc="-f stringify.sed"
cat >>e${EMULATION_NAME}.c <<EOF
{
@@ -765,7 +1342,7 @@ struct ld_emulation_xfer_struct ld_${EMULATION_NAME}_emulation =
gld_${EMULATION_NAME}_before_parse,
syslib_default,
hll_default,
- after_parse_default,
+ gld_${EMULATION_NAME}_after_parse,
gld_${EMULATION_NAME}_after_open,
after_allocation_default,
set_output_arch_default,
@@ -774,11 +1351,15 @@ struct ld_emulation_xfer_struct ld_${EMULATION_NAME}_emulation =
gld_${EMULATION_NAME}_get_script,
"${EMULATION_NAME}",
"${OUTPUT_FORMAT}",
- NULL, /* finish */
+ gld_${EMULATION_NAME}_finish, /* finish */
NULL, /* create output section statements */
NULL, /* open dynamic archive */
- gld${EMULATION_NAME}_place_orphan,
+ gld_${EMULATION_NAME}_place_orphan,
gld_${EMULATION_NAME}_set_symbols,
- gld_${EMULATION_NAME}_parse_args
+ gld_${EMULATION_NAME}_parse_args,
+ gld_${EMULATION_NAME}_unrecognized_file,
+ gld_${EMULATION_NAME}_list_options,
+ gld_${EMULATION_NAME}_recognized_file,
+ gld_${EMULATION_NAME}_find_potential_libraries
};
EOF
diff --git a/contrib/binutils/ld/emultempl/vanilla.em b/contrib/binutils/ld/emultempl/vanilla.em
index 04e36fb..0a74abd 100644
--- a/contrib/binutils/ld/emultempl/vanilla.em
+++ b/contrib/binutils/ld/emultempl/vanilla.em
@@ -64,6 +64,16 @@ struct ld_emulation_xfer_struct ld_vanilla_emulation =
before_allocation_default,
vanilla_get_script,
"vanilla",
- "a.out-sunos-big"
+ "a.out-sunos-big",
+ NULL, /* finish */
+ NULL, /* create output section statements */
+ NULL, /* open dynamic archive */
+ NULL, /* place orphan */
+ NULL, /* set symbols */
+ NULL, /* parse args */
+ NULL, /* unrecognized file */
+ NULL, /* list options */
+ NULL, /* recognized file */
+ NULL /* find_potential_libraries */
};
EOF
diff --git a/contrib/binutils/ld/genscripts.sh b/contrib/binutils/ld/genscripts.sh
index eea5401..8294af7 100755
--- a/contrib/binutils/ld/genscripts.sh
+++ b/contrib/binutils/ld/genscripts.sh
@@ -14,7 +14,7 @@ libdir=$2
host=$3
target=$4
target_alias=$5
-DEFAULT_EMULATION=$6
+EMULATION_LIBPATH=$6
NATIVE_LIB_DIRS=$7
EMULATION_NAME=$8
tool_lib=`echo ${libdir} | sed -e 's|/lib$||'`/${9-$target_alias}/lib
@@ -36,26 +36,24 @@ fi
# To force a logically empty LIB_PATH, do LIBPATH=":".
if [ "x${LIB_PATH}" = "x" ] ; then
+ # Cross, or native non-default emulation not requesting LIB_PATH.
+ LIB_PATH=
+
if [ "x${host}" = "x${target}" ] ; then
- if [ "x${DEFAULT_EMULATION}" = "x${EMULATION_NAME}" ] ; then
- # Native.
- LIB_PATH=/lib:/usr/lib
- if [ -n "${NATIVE_LIB_DIRS}" ]; then
- LIB_PATH=${LIB_PATH}:${NATIVE_LIB_DIRS}
- fi
- if [ "${libdir}" != /usr/lib ]; then
- LIB_PATH=${LIB_PATH}:${libdir}
- fi
- if [ "${libdir}" != /usr/local/lib ] ; then
- LIB_PATH=${LIB_PATH}:/usr/local/lib
- fi
- else
- # Native, but not default emulation.
- LIB_PATH=
- fi
- else
- # Cross.
- LIB_PATH=
+ case " $EMULATION_LIBPATH " in
+ *" ${EMULATION_NAME} "*)
+ # Native, and default or emulation requesting LIB_PATH.
+ LIB_PATH=/lib:/usr/lib
+ if [ -n "${NATIVE_LIB_DIRS}" ]; then
+ LIB_PATH=${LIB_PATH}:${NATIVE_LIB_DIRS}
+ fi
+ if [ "${libdir}" != /usr/lib ]; then
+ LIB_PATH=${LIB_PATH}:${libdir}
+ fi
+ if [ "${libdir}" != /usr/local/lib ] ; then
+ LIB_PATH=${LIB_PATH}:/usr/local/lib
+ fi
+ esac
fi
fi
@@ -127,7 +125,9 @@ if test -n "$GENERATE_SHLIB_SCRIPT"; then
ldscripts/${EMULATION_NAME}.xs
fi
-test "$DEFAULT_EMULATION" = "$EMULATION_NAME" && COMPILE_IN=true
+for i in $EMULATION_LIBPATH ; do
+ test "$i" = "$EMULATION_NAME" && COMPILE_IN=true
+done
# Generate e${EMULATION_NAME}.c.
. ${srcdir}/emultempl/${TEMPLATE_NAME-generic}.em
diff --git a/contrib/binutils/ld/ld.1 b/contrib/binutils/ld/ld.1
index 79c9f10..58516b9 100644
--- a/contrib/binutils/ld/ld.1
+++ b/contrib/binutils/ld/ld.1
@@ -1,4 +1,4 @@
-.\" Copyright (c) 1991, 92, 93, 94, 95, 96, 1997 Free Software Foundation
+.\" Copyright (c) 1991, 92, 93, 94, 95, 96, 97, 98, 1999 Free Software Foundation
.\" See section COPYING for conditions for redistribution
.TH ld 1 "17 August 1992" "cygnus support" "GNU Development Tools"
.de BP
@@ -42,6 +42,8 @@ ld \- the GNU linker
\& = \c
.I expression\c
\&\|]
+.RB "[\|" \-\-demangle "\|]"
+.RB "[\|" \-\-no\-demangle "\|]"
.RB "[\|" "\-e\ "\c
.I entry\c
\&\|]
@@ -92,6 +94,9 @@ ld \- the GNU linker
.RB "[\|" \-noinhibit-exec "\|]"
.RB "[\|" \-no\-keep\-memory "\|]"
.RB "[\|" \-no\-warn\-mismatch "\|]"
+.RB "[\|" \-O\c
+.I level\c
+\&\|]
.RB "[\|" "\-oformat\ "\c
.I output-format\c
\&\|]
@@ -468,12 +473,29 @@ constants or symbols. If you need more elaborate expressions, consider
using the linker command language from a script.
.TP
+.B \-\-demangle
+.TP
+.B \-\-no\-demangle
+These options control whether to demangle symbol names in error
+messages and other output. When the linker is told to demangle, it
+tries to present symbol names in a readable fashion: it strips leading
+underscores if they are used by the object file format, and converts
+C++ mangled symbol names into user readable names. The linker will
+demangle by default unless the environment variable
+.B COLLECT_NO_DEMANGLE
+is set. These options may be used to override the default.
+
+.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. for a
+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.
@@ -690,6 +712,16 @@ script command \c
\& can also specify the output file name.
.TP
+.BI "\-O" "level"
+Generate optimized output files. This might use significantly more
+time and therefore probably should be enabled only for generating the
+final binary.
+\c
+.I level\c
+\& is supposed to be a numeric value. Any value greater than zero enables
+the optimizations.
+
+.TP
.BI "\-oformat " "output\-format"
Specify the binary format for the output object file.
You don't usually need to specify this, as
@@ -774,7 +806,7 @@ 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
+will form a runtime search path out of all the
.B \-L
options it is given. If a
.B \-rpath
@@ -874,7 +906,7 @@ Use \c
.B text\c
\& segment of the output file.
\c
-.I textorg\c
+.I org\c
\& must be a hexadecimal integer.
.TP
@@ -1065,7 +1097,7 @@ The GNU Binary Utilities\c
, Roland H. Pesch.
.SH COPYING
-Copyright (c) 1991, 1992 Free Software Foundation, Inc.
+Copyright (c) 1991, 92, 93, 94, 95, 96, 97, 1998 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
diff --git a/contrib/binutils/ld/ld.h b/contrib/binutils/ld/ld.h
index e0e2a4d..e2052a0 100644
--- a/contrib/binutils/ld/ld.h
+++ b/contrib/binutils/ld/ld.h
@@ -1,5 +1,6 @@
/* ld.h -- general linker header file
- Copyright (C) 1991, 93, 94, 95, 96, 1997 Free Software Foundation, Inc.
+ Copyright (C) 1991, 93, 94, 95, 96, 97, 98, 99, 2000
+ Free Software Foundation, Inc.
This file is part of GLD, the Gnu Linker.
@@ -21,6 +22,31 @@
#ifndef LD_H
#define LD_H
+#ifdef HAVE_LOCALE_H
+# include <locale.h>
+#endif
+
+#ifdef ENABLE_NLS
+# include <libintl.h>
+# define _(String) gettext (String)
+# ifdef gettext_noop
+# define N_(String) gettext_noop (String)
+# else
+# define N_(String) (String)
+# endif
+#else
+/* Stubs that do something close enough. */
+# define textdomain(String) (String)
+# define gettext(String) (String)
+# define dgettext(Domain,Message) (Message)
+# define dcgettext(Domain,Message,Type) (Message)
+# define bindtextdomain(Domain,Directory) (Domain)
+# define _(String) (String)
+# define N_(String) (String)
+#endif
+
+#include "bin-bugs.h"
+
/* Look in this environment name for the linker to pretend to be */
#define EMULATION_ENVIRON "LDEMULATION"
/* If in there look for the strings: */
@@ -32,6 +58,23 @@
discarded. */
#define DISCARD_SECTION_NAME "/DISCARD/"
+/* A file name list */
+typedef struct name_list
+{
+ const char *name;
+ struct name_list *next;
+} name_list;
+
+/* A wildcard specification. This is only used in ldgram.y, but it
+ winds up in ldgram.h, so we need to define it outside. */
+
+struct wildcard_spec
+{
+ const char *name;
+ struct name_list *exclude_name_list;
+ boolean sorted;
+};
+
/* Extra information we hold on sections */
typedef struct user_section_struct
{
@@ -95,6 +138,9 @@ typedef struct
files. */
boolean warn_mismatch;
+ /* Remove unreferenced sections? */
+ boolean gc_sections;
+
/* Name of shared object whose symbol table should be filtered with
this shared object. From the --filter option. */
char *filter_shlib;
@@ -102,6 +148,15 @@ typedef struct
/* Name of shared object for whose symbol table this shared object
is an auxiliary filter. From the --auxiliary option. */
char **auxiliary_filters;
+
+ /* A version symbol to be applied to the symbol names found in the
+ .exports sections. */
+ char *version_exports_section;
+
+ /* If true (the default) check section addresses, once compute,
+ fpor overlaps. */
+ boolean check_section_addresses;
+
} args_type;
extern args_type command_line;
@@ -117,6 +172,12 @@ typedef struct
/* If true, doing a dynamic link. */
boolean dynamic_link;
+ /* If true, -shared is supported. */
+ /* ??? A better way to do this is perhaps to define this in the
+ ld_emulation_xfer_struct since this is really a target dependent
+ parameter. */
+ boolean has_shared;
+
/* If true, build constructors. */
boolean build_constructors;
@@ -171,4 +232,15 @@ extern void add_cref PARAMS ((const char *, bfd *, asection *, bfd_vma));
extern void output_cref PARAMS ((FILE *));
extern void check_nocrossrefs PARAMS ((void));
+extern void ld_abort PARAMS ((const char *, int, const char *))
+ ATTRIBUTE_NORETURN;
+
+/* If gcc >= 2.6, we can give a function name, too. */
+#if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 6)
+#define __PRETTY_FUNCTION__ ((char*) NULL)
+#endif
+
+#undef abort
+#define abort() ld_abort (__FILE__, __LINE__, __PRETTY_FUNCTION__)
+
#endif
diff --git a/contrib/binutils/ld/ld.texinfo b/contrib/binutils/ld/ld.texinfo
index 05f3984..c9d0fc6 100644
--- a/contrib/binutils/ld/ld.texinfo
+++ b/contrib/binutils/ld/ld.texinfo
@@ -3,6 +3,7 @@
@syncodeindex ky cp
@include configdoc.texi
@c (configdoc.texi is generated by the Makefile)
+@include ldver.texi
@c @smallbook
@@ -15,9 +16,9 @@ END-INFO-DIR-ENTRY
@end ifinfo
@ifinfo
-This file documents the @sc{gnu} linker LD.
+This file documents the @sc{gnu} linker LD version @value{VERSION}.
-Copyright (C) 1991, 92, 93, 94, 95, 96, 97, 1998 Free Software Foundation, Inc.
+Copyright (C) 1991, 92, 93, 94, 95, 96, 97, 98, 99, 2000 Free Software Foundation, Inc.
Permission is granted to make and distribute verbatim copies of
this manual provided the copyright notice and this permission notice
@@ -48,15 +49,16 @@ notice identical to this one except for the removal of this paragraph
@subtitle The GNU linker
@sp 1
@subtitle @code{ld} version 2
-@subtitle January 1994
+@subtitle Version @value{VERSION}
@author Steve Chamberlain
-@author Cygnus Support
+@author Ian Lance Taylor
+@author Cygnus Solutions
@page
@tex
{\parskip=0pt
-\hfill Cygnus Support\par
-\hfill steve\@cygnus.com, doc\@cygnus.com\par
+\hfill Cygnus Solutions\par
+\hfill ian\@cygnus.com, doc\@cygnus.com\par
\hfill {\it Using LD, the GNU linker}\par
\hfill Edited by Jeffrey Osier (jeffrey\@cygnus.com)\par
}
@@ -64,7 +66,7 @@ notice identical to this one except for the removal of this paragraph
@end tex
@vskip 0pt plus 1filll
-Copyright @copyright{} 1991, 92, 93, 94, 95, 96, 97, 1998 Free Software Foundation, Inc.
+Copyright @copyright{} 1991, 92, 93, 94, 95, 96, 97, 98, 1999 Free Software Foundation, Inc.
Permission is granted to make and distribute verbatim copies of
this manual provided the copyright notice and this permission notice
@@ -84,12 +86,12 @@ into another language, under the above conditions for modified versions.
@ifinfo
@node Top
@top Using ld
-This file documents the @sc{gnu} linker ld.
+This file documents the @sc{gnu} linker ld version @value{VERSION}.
@menu
* Overview:: Overview
* Invocation:: Invocation
-* Commands:: Command Language
+* Scripts:: Linker Scripts
@ifset GENERIC
* Machine Dependent:: Machine Dependent Features
@end ifset
@@ -177,18 +179,21 @@ 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
+Some of the command-line options to @code{ld} may be specified at any
+point in the command line. However, options which refer to files, such
+as @samp{-l} or @samp{-T}, cause the file to be read at the point at
+which the option appears in the command line, relative to the object
+files and other file options. Repeating non-file 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.
+Non-option arguments are object files or archives 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},
@@ -207,7 +212,7 @@ 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}.
+@xref{Scripts}.
For options whose names are a single letter,
option arguments must either follow the option letter without intervening
@@ -223,6 +228,21 @@ requires them. For example, @samp{--oformat srec} and
@samp{--oformat=srec} are equivalent. Unique abbreviations of the names
of multiple-letter options are accepted.
+Note - if the linker is being invoked indirectly, via a compiler driver
+(eg @samp{gcc}) then all the linker command line options should be
+prefixed by @samp{-Wl,} (or whatever is appropriate for the particular
+compiler driver) like this:
+
+@smallexample
+ gcc -Wl,--startgroup foo.o bar.o -Wl,--endgroup
+@end smallexample
+
+This is important, because otherwise the compiler driver program may
+silently drop the linker options, resulting in a bad link.
+
+Here is a table of the generic command line switches accepted by the GNU
+linker:
+
@table @code
@kindex -a@var{keyword}
@item -a@var{keyword}
@@ -280,9 +300,8 @@ The default format is taken from the environment variable
@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}.
+You can also define the input format from a script, using the command
+@code{TARGET}; see @ref{Format Commands}.
@end ifclear
@kindex -c @var{MRI-cmdfile}
@@ -306,11 +325,10 @@ specified by any @samp{-L} options.
@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}.
+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{Miscellaneous Commands}.
@cindex entry point, from command line
@kindex -e @var{entry}
@@ -318,9 +336,12 @@ Commands}.
@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.
+program, rather than the default entry point. If there is no symbol
+named @var{entry}, the linker will try to parse @var{entry} as a number,
+and use that as the entry address (the number will be interpreted in
+base 10; you may use a leading @samp{0x} for base 16, or a leading
+@samp{0} for base 8). @xref{Entry Point}, for a discussion of defaults
+and other ways of specifying the entry point.
@cindex dynamic symbol table
@kindex -E
@@ -340,6 +361,17 @@ 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.
+@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.
+
@kindex -f
@kindex --auxiliary
@item -f
@@ -387,16 +419,13 @@ purpose: the @code{-b}, @code{--format}, @code{--oformat} options, the
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.
+@cindex finalization function
+@kindex -fini
+@item -fini @var{name}
+When creating an ELF executable or shared object, call NAME when the
+executable or shared object is unloaded, by setting DT_FINI to the
+address of the function. By default, the linker uses @code{_fini} as
+the function to call.
@kindex -g
@item -g
@@ -428,6 +457,14 @@ field rather than the using the file name given to the linker.
@item -i
Perform an incremental link (same as option @samp{-r}).
+@cindex initialization function
+@kindex -init
+@item -init @var{name}
+When creating an ELF executable or shared object, call NAME when the
+executable or shared object is loaded, by setting DT_INIT to the address
+of the function. By default, the linker uses @code{_init} as the
+function to call.
+
@cindex archive files, from cmd line
@kindex -l@var{archive}
@kindex --library=@var{archive}
@@ -522,8 +559,8 @@ which caused the archive member to be brought in.
@kindex --nmagic
@item -n
@itemx --nmagic
-Set the text segment to be read only, and mark the output as
-@code{NMAGIC} if possible.
+Turn off page alignment of sections, and mark the output as
+@code{NMAGIC} if possible.
@kindex -N
@kindex --omagic
@@ -544,6 +581,13 @@ 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.
+@kindex -O @var{level}
+@cindex generating optimized output
+@item -O @var{level}
+If @var{level} is a numeric values greater than zero @code{ld} optimizes
+the output. This might take significantly longer and therefore probably
+should only be enabled for the final binary.
+
@cindex partial link
@cindex relocatable output
@kindex -r
@@ -600,29 +644,40 @@ 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
+@item -T @var{scriptfile}
+@itemx --script=@var{scriptfile}
+Use @var{scriptfile} as the linker script. This script replaces
+@code{ld}'s default linker 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
+output file. 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.
+@code{SECTIONS} or @code{MEMORY} command. @xref{Scripts}. If
+@var{scriptfile} does not exist in the current directory, @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.
+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. This
+option is equivalent to the @code{EXTERN} linker script command.
+
+@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 -v
@kindex -V
@@ -730,6 +785,17 @@ 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.
+@kindex --check-sections
+@kindex --no-check-sections
+@item --check-sections
+@itemx --no-check-sections
+Asks the linker @emph{not} to check section addresses after they have
+been assigned to see if there any overlaps. Normally the linker will
+perform this check, and if it finds any overlaps it will produce
+suitable error messages. The linker does know about, and does make
+allowances for sections in overlays. The default behaviour can be
+restored by using the command line switch @samp{--check-sections}.
+
@cindex cross reference table
@kindex --cref
@item --cref
@@ -753,11 +819,24 @@ 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
+using the linker command language from a script (@pxref{Assignments,,
+Assignment: Symbol Definitions}). @emph{Note:} there should be no white
+space between @var{symbol}, the equals sign (``@key{=}''), and
@var{expression}.
+@cindex demangling, from command line
+@kindex --demangle
+@kindex --no-demangle
+@item --demangle
+@itemx --no-demangle
+These options control whether to demangle symbol names in error messages
+and other output. When the linker is told to demangle, it tries to
+present symbol names in a readable fashion: it strips leading
+underscores if they are used by the object file format, and converts C++
+mangled symbol names into user readable names. The linker will demangle
+by default unless the environment variable @samp{COLLECT_NO_DEMANGLE} is
+set. These options may be used to override the default.
+
@cindex dynamic linker, from command line
@kindex --dynamic-linker @var{file}
@item --dynamic-linker @var{file}
@@ -766,17 +845,6 @@ 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
@@ -786,6 +854,28 @@ 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.
+@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 --gc-sections
+@kindex --no-gc-sections
+@cindex garbage collection
+@item --no-gc-sections
+@itemx --gc-sections
+Enable garbage collection of unused input sections. It is ignored on
+targets that do not support this option. This option is not compatible
+with @samp{-r}, nor should it be used with dynamic linking. The default
+behaviour (of not performing this garbage collection) can be restored by
+specifying @samp{--no-gc-sections} on the command line.
+
@cindex help
@cindex usage
@kindex --help
@@ -806,6 +896,12 @@ 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-undefined
+@item --no-undefined
+Normally when creating a non-symbolic shared library, undefined symbols
+are allowed and left to be resolved by the runtime loader. This option
+disallows such undefined symbols.
+
@kindex --no-warn-mismatch
@item --no-warn-mismatch
Normally @code{ld} will give an error if you try to link together input
@@ -868,11 +964,19 @@ This option is only supported on a few targets.
@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.
+On some platforms these link time global optimizations may make symbolic
+debugging of the resulting executable impossible.
+@ifset GENERIC
+This is known to be
+the case for the Matsushita MN10200 and MN10300 family of processors.
+@end ifset
+
@ifset GENERIC
On platforms where this is not supported, @samp{--relax} is accepted,
but ignored.
@@ -933,7 +1037,7 @@ 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
+non-relocatable 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
@@ -964,6 +1068,9 @@ 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}.
+@item
+For a native linker on an ELF system, if the file @file{/etc/ld.so.conf}
+exists, the list of directories found in that file.
@end enumerate
If the required shared library is not found, the linker will issue a
@@ -1039,21 +1146,10 @@ Use @var{org} as the starting address for---respectively---the
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
+@item --dll-verbose
+@itemx --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.
@@ -1065,7 +1161,7 @@ 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}.
+@xref{VERSION}.
@kindex --warn-comon
@cindex warnings, on combining symbols
@@ -1235,12 +1331,169 @@ call before the linker has a chance to wrap it to @code{malloc}.
@end table
+@subsection Options specific to i386 PE targets
+
+The i386 PE linker supports the @code{-shared} option, which causes
+the output to be a dynamically linked library (DLL) instead of a
+normal executable. You should name the output @code{*.dll} when you
+use this option. In addition, the linker fully supports the standard
+@code{*.def} files, which may be specified on the linker command line
+like an object file (in fact, it should precede archives it exports
+symbols from, to ensure that they get linked in, just like a normal
+object file).
+
+In addition to the options common to all targets, the i386 PE linker
+support additional command line options that are specific to the i386
+PE target. Options that take values may be separated from their
+values by either a space or an equals sign.
+
+@table @code
+
+@kindex --add-stdcall-alias
+@item --add-stdcall-alias
+If given, symbols with a stdcall suffix (@@@var{nn}) will be exported
+as-is and also with the suffix stripped.
+
+@kindex --base-file
+@item --base-file @var{file}
+Use @var{file} as the name of a file in which to save the base
+addresses of all the relocations needed for generating DLLs with
+@file{dlltool}.
+
+@kindex --dll
+@item --dll
+Create a DLL instead of a regular executable. You may also use
+@code{-shared} or specify a @code{LIBRARY} in a given @code{.def}
+file.
+
+@kindex --enable-stdcall-fixup
+@kindex --disable-stdcall-fixup
+@item --enable-stdcall-fixup
+@itemx --disable-stdcall-fixup
+If the link finds a symbol that it cannot resolve, it will attempt to
+do "fuzzy linking" by looking for another defined symbol that differs
+only in the format of the symbol name (cdecl vs stdcall) and will
+resolve that symbol by linking to the match. For example, the
+undefined symbol @code{_foo} might be linked to the function
+@code{_foo@@12}, or the undefined symbol @code{_bar@@16} might be linked
+to the function @code{_bar}. When the linker does this, it prints a
+warning, since it normally should have failed to link, but sometimes
+import libraries generated from third-party dlls may need this feature
+to be usable. If you specify @code{--enable-stdcall-fixup}, this
+feature is fully enabled and warnings are not printed. If you specify
+@code{--disable-stdcall-fixup}, this feature is disabled and such
+mismatches are considered to be errors.
+
+@cindex DLLs, creating
+@kindex --export-all-symbols
+@item --export-all-symbols
+If given, all global symbols in the objects used to build a DLL will
+be exported by the DLL. Note that this is the default if there
+otherwise wouldn't be any exported symbols. When symbols are
+explicitly exported via DEF files or implicitly exported via function
+attributes, the default is to not export anything else unless this
+option is given. Note that the symbols @code{DllMain@@12},
+@code{DllEntryPoint@@0}, and @code{impure_ptr} will not be automatically
+exported.
+
+@kindex --exclude-symbols
+@item --exclude-symbols @var{symbol},@var{symbol},...
+Specifies a list of symbols which should not be automatically
+exported. The symbol names may be delimited by commas or colons.
+
+@kindex --file-alignment
+@item --file-alignment
+Specify the file alignment. Sections in the file will always begin at
+file offsets which are multiples of this number. This defaults to
+512.
+
+@cindex heap size
+@kindex --heap
+@item --heap @var{reserve}
+@itemx --heap @var{reserve},@var{commit}
+Specify the amount of memory to reserve (and optionally commit) to be
+used as heap for this program. The default is 1Mb reserved, 4K
+committed.
+
+@cindex image base
+@kindex --image-base
+@item --image-base @var{value}
+Use @var{value} as the base address of your program or dll. This is
+the lowest memory location that will be used when your program or dll
+is loaded. To reduce the need to relocate and improve performance of
+your dlls, each should have a unique base address and not overlap any
+other dlls. The default is 0x400000 for executables, and 0x10000000
+for dlls.
+
+@kindex --kill-at
+@item --kill-at
+If given, the stdcall suffixes (@@@var{nn}) will be stripped from
+symbols before they are exported.
+
+@kindex --major-image-version
+@item --major-image-version @var{value}
+Sets the major number of the "image version". Defaults to 1.
+
+@kindex --major-os-version
+@item --major-os-version @var{value}
+Sets the major number of the "os version". Defaults to 4.
+
+@kindex --major-subsystem-version
+@item --major-subsystem-version @var{value}
+Sets the major number of the "subsystem version". Defaults to 4.
+
+@kindex --minor-image-version
+@item --minor-image-version @var{value}
+Sets the minor number of the "image version". Defaults to 0.
+
+@kindex --minor-os-version
+@item --minor-os-version @var{value}
+Sets the minor number of the "os version". Defaults to 0.
+
+@kindex --minor-subsystem-version
+@item --minor-subsystem-version @var{value}
+Sets the minor number of the "subsystem version". Defaults to 0.
+
+@cindex DEF files, creating
+@cindex DLLs, creating
+@kindex --output-def
+@item --output-def @var{file}
+The linker will create the file @var{file} which will contain a DEF
+file corresponding to the DLL the linker is generating. This DEF file
+(which should be called @code{*.def}) may be used to create an import
+library with @code{dlltool} or may be used as a reference to
+automatically or implicitly exported symbols.
+
+@kindex --section-alignment
+@item --section-alignment
+Sets the section alignment. Sections in memory will always begin at
+addresses which are a multiple of this number. Defaults to 0x1000.
+
+@cindex stack size
+@kindex --stack
+@item --stack @var{reserve}
+@itemx --stack @var{reserve},@var{commit}
+Specify the amount of memory to reserve (and optionally commit) to be
+used as stack for this program. The default is 32Mb reserved, 4K
+committed.
+
+@kindex --subsystem
+@item --subsystem @var{which}
+@itemx --subsystem @var{which}:@var{major}
+@itemx --subsystem @var{which}:@var{major}.@var{minor}
+Specifies the subsystem under which your program will execute. The
+legal values for @var{which} are @code{native}, @code{windows},
+@code{console}, and @code{posix}. You may optionally set the
+subsystem version also.
+
+@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}.
+@code{GNUTARGET}, @code{LDEMULATION}, and @code{COLLECT_NO_DEMANGLE}.
@kindex GNUTARGET
@cindex default input format
@@ -1268,926 +1521,907 @@ variable is not defined, the default emulation depends upon how the
linker was configured.
@end ifset
-@node Commands
-@chapter Command Language
+@kindex COLLECT_NO_DEMANGLE
+@cindex demangling, default
+Normally, the linker will default to demangling symbols. However, if
+@code{COLLECT_NO_DEMANGLE} is set in the environment, then it will
+default to not demangling symbols. This environment variable is used in
+a similar fashion by the @code{gcc} linker wrapper program. The default
+may be overridden by the @samp{--demangle} and @samp{--no-demangle}
+options.
+
+@node Scripts
+@chapter Linker Scripts
+@cindex scripts
+@cindex linker scripts
@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
+Every link is controlled by a @dfn{linker script}. This script is
+written in the linker command language.
+
+The main purpose of the linker script is to describe how the sections in
+the input files should be mapped into the output file, and to control
+the memory layout of the output file. Most linker scripts do nothing
+more than this. However, when necessary, the linker script can also
+direct the linker to perform many other operations, using the commands
+described below.
+
+The linker always uses a linker script. If you do not supply one
+yourself, the linker will use a default script that is compiled into the
+linker executable. You can use the @samp{--verbose} command line option
+to display the default linker script. Certain command line options,
+such as @samp{-r} or @samp{-N}, will affect the default linker script.
+
+You may supply your own linker script by using the @samp{-T} command
+line option. When you do this, your linker script will replace the
+default linker script.
+
+You may also use linker scripts implicitly by naming them as input files
+to the linker, as though they were files to be linked. @xref{Implicit
+Linker Scripts}.
-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.
+@menu
+* Basic Script Concepts:: Basic Linker Script Concepts
+* Script Format:: Linker Script Format
+* Simple Example:: Simple Linker Script Example
+* Simple Commands:: Simple Linker Script Commands
+* Assignments:: Assigning Values to Symbols
+* SECTIONS:: SECTIONS Command
+* MEMORY:: MEMORY Command
+* PHDRS:: PHDRS Command
+* VERSION:: VERSION Command
+* Expressions:: Expressions in Linker Scripts
+* Implicit Linker Scripts:: Implicit Linker Scripts
+@end menu
-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.
+@node Basic Script Concepts
+@section Basic Linker Script Concepts
+@cindex linker script concepts
+We need to define some basic concepts and vocabulary in order to
+describe the linker script language.
+
+The linker combines input files into a single output file. The output
+file and each input file are in a special data format known as an
+@dfn{object file format}. Each file is called an @dfn{object file}.
+The output file is often called an @dfn{executable}, but for our
+purposes we will also call it an object file. Each object file has,
+among other things, a list of @dfn{sections}. We sometimes refer to a
+section in an input file as an @dfn{input section}; similarly, a section
+in the output file is an @dfn{output section}.
+
+Each section in an object file has a name and a size. Most sections
+also have an associated block of data, known as the @dfn{section
+contents}. A section may be marked as @dfn{loadable}, which mean that
+the contents should be loaded into memory when the output file is run.
+A section with no contents may be @dfn{allocatable}, which means that an
+area in memory should be set aside, but nothing in particular should be
+loaded there (in some cases this memory must be zeroed out). A section
+which is neither loadable nor allocatable typically contains some sort
+of debugging information.
+
+Every loadable or allocatable output section has two addresses. The
+first is the @dfn{VMA}, or virtual memory address. This is the address
+the section will have when the output file is run. The second is the
+@dfn{LMA}, or load memory address. This is the address at which the
+section will be loaded. In most cases the two addresses will be the
+same. An example of when they might be different is when a data section
+is loaded into ROM, and then copied into RAM when the program starts up
+(this technique is often used to initialize global variables in a ROM
+based system). In this case the ROM address would be the LMA, and the
+RAM address would be the VMA.
+
+You can see the sections in an object file by using the @code{objdump}
+program with the @samp{-h} option.
+
+Every object file also has a list of @dfn{symbols}, known as the
+@dfn{symbol table}. A symbol may be defined or undefined. Each symbol
+has a name, and each defined symbol has an address, among other
+information. If you compile a C or C++ program into an object file, you
+will get a defined symbol for every defined function and global or
+static variable. Every undefined function or global variable which is
+referenced in the input file will become an undefined symbol.
+
+You can see the symbols in an object file by using the @code{nm}
+program, or by using the @code{objdump} program with the @samp{-t}
+option.
+
+@node Script Format
+@section Linker Script Format
+@cindex linker script format
+Linker scripts are text files.
+
+You write a linker script as a series of commands. Each command is
+either a keyword, possibly followed by arguments, or an assignment to a
+symbol. You may separate commands using semicolons. Whitespace is
+generally ignored.
+
+Strings such as file or format names can normally be entered directly.
+If the file name contains a character such as a comma which would
+otherwise serve to separate file names, you may put the file name in
+double quotes. There is no way to use a double quote character in a
+file name.
+
+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 Simple Example
+@section Simple Linker Script Example
+@cindex linker script example
+@cindex example of linker script
+Many linker scripts are fairly simple.
+
+The simplest possible linker script has just one command:
+@samp{SECTIONS}. You use the @samp{SECTIONS} command to describe the
+memory layout of the output file.
+
+The @samp{SECTIONS} command is a powerful command. Here we will
+describe a simple use of it. Let's assume your program consists only of
+code, initialized data, and uninitialized data. These will be in the
+@samp{.text}, @samp{.data}, and @samp{.bss} sections, respectively.
+Let's assume further that these are the only sections which appear in
+your input files.
+
+For this example, let's say that the code should be loaded at address
+0x10000, and that the data should start at address 0x8000000. Here is a
+linker script which will do that:
+@smallexample
+SECTIONS
+@{
+ . = 0x10000;
+ .text : @{ *(.text) @}
+ . = 0x8000000;
+ .data : @{ *(.data) @}
+ .bss : @{ *(.bss) @}
+@}
+@end smallexample
+
+You write the @samp{SECTIONS} command as the keyword @samp{SECTIONS},
+followed by a series of symbol assignments and output section
+descriptions enclosed in curly braces.
+
+The first line inside the @samp{SECTIONS} command of the above example
+sets the value of the special symbol @samp{.}, which is the location
+counter. If you do not specify the address of an output section in some
+other way (other ways are described later), the address is set from the
+current value of the location counter. The location counter is then
+incremented by the size of the output section. At the start of the
+@samp{SECTIONS} command, the location counter has the value @samp{0}.
+
+The second line defines an output section, @samp{.text}. The colon is
+required syntax which may be ignored for now. Within the curly braces
+after the output section name, you list the names of the input sections
+which should be placed into this output section. The @samp{*} is a
+wildcard which matches any file name. The expression @samp{*(.text)}
+means all @samp{.text} input sections in all input files.
+
+Since the location counter is @samp{0x10000} when the output section
+@samp{.text} is defined, the linker will set the address of the
+@samp{.text} section in the output file to be @samp{0x10000}.
+
+The remaining lines define the @samp{.data} and @samp{.bss} sections in
+the output file. The linker will place the @samp{.data} output section
+at address @samp{0x8000000}. After the linker places the @samp{.data}
+output section, the value of the location counter will be
+@samp{0x8000000} plus the size of the @samp{.data} output section. The
+effect is that the linker will place the @samp{.bss} output section
+immediately after the @samp{.data} output section in memory
+
+The linker will ensure that each output section has the required
+alignment, by increasing the location counter if necessary. In this
+example, the specified addresses for the @samp{.text} and @samp{.data}
+sections will probably satisfy any alignment constraints, but the linker
+may have to create a small gap between the @samp{.data} and @samp{.bss}
+sections.
+
+That's it! That's a simple and complete linker script.
+
+@node Simple Commands
+@section Simple Linker Script Commands
+@cindex linker script simple commands
+In this section we describe the simple linker script commands.
@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
+* Entry Point:: Setting the entry point
+* File Commands:: Commands dealing with files
+@ifclear SingleFormat
+* Format Commands:: Commands dealing with object file formats
+@end ifclear
+
+* Miscellaneous Commands:: Other linker script 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 Entry Point
+@subsection Setting the entry point
+@kindex ENTRY(@var{symbol})
+@cindex start of execution
+@cindex first instruction
+@cindex entry point
+The first instruction to execute in a program is called the @dfn{entry
+point}. You can use the @code{ENTRY} linker script command to set the
+entry point. The argument is a symbol name:
+@smallexample
+ENTRY(@var{symbol})
+@end smallexample
-@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:
+There are several ways to set the entry point. The linker will set the
+entry point by trying each of the following methods in order, and
+stopping when one of them succeeds:
@itemize @bullet
@item
-All expressions evaluated as integers and
-are of ``long'' or ``unsigned long'' type.
+the @samp{-e} @var{entry} command-line option;
@item
-All constants are integers.
+the @code{ENTRY(@var{symbol})} command in a linker script;
@item
-All of the C arithmetic operators are provided.
+the value of the symbol @code{start}, if defined;
@item
-You may reference, define, and create global variables.
+the address of the first byte of the @samp{.text} section, if present;
@item
-You may call special purpose built-in functions.
+The address @code{0}.
@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 File Commands
+@subsection Commands dealing with files
+@cindex linker script file commands
+Several linker script commands deal with files.
-@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
+@table @code
+@item INCLUDE @var{filename}
+@kindex INCLUDE @var{filename}
+@cindex including a linker script
+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.
-@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
+@item INPUT(@var{file}, @var{file}, @dots{})
+@itemx INPUT(@var{file} @var{file} @dots{})
+@kindex INPUT(@var{files})
+@cindex input files in linker scripts
+@cindex input object files in linker scripts
+@cindex linker script input object files
+The @code{INPUT} command directs the linker to include the named files
+in the link, as though they were named on the command line.
+
+For example, if you always want to include @file{subr.o} any time you do
+a link, but you can't be bothered to put it on every link command line,
+then you can put @samp{INPUT (subr.o)} in your linker script.
+
+In fact, if you like, you can list all of your input files in the linker
+script, and then invoke the linker with nothing but a @samp{-T} option.
+
+The linker will first try to open the file in the current directory. If
+it is not found, the linker will search through the archive library
+search path. See the description of @samp{-L} in @ref{Options,,Command
+Line Options}.
+
+If you use @samp{INPUT (-l@var{file})}, @code{ld} will transform the
+name to @code{lib@var{file}.a}, as with the command line argument
+@samp{-l}.
+
+When you use the @code{INPUT} command in an implicit linker script, the
+files will be included in the link at the point at which the linker
+script file is included. This can affect archive searching.
+
+@item GROUP(@var{file}, @var{file}, @dots{})
+@itemx GROUP(@var{file} @var{file} @dots{})
+@kindex GROUP(@var{files})
+@cindex grouping input files
+The @code{GROUP} 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}.
+
+@item OUTPUT(@var{filename})
+@kindex OUTPUT(@var{filename})
+@cindex output file name in linker scripot
+The @code{OUTPUT} command names the output file. Using
+@code{OUTPUT(@var{filename})} in the linker script is exactly like using
+@samp{-o @var{filename}} on the command line (@pxref{Options,,Command
+Line Options}). If both are used, the command line option takes
+precedence.
+
+You can use the @code{OUTPUT} command to define a default name for the
+output file other than the usual default of @file{a.out}.
+
+@item SEARCH_DIR(@var{path})
+@kindex SEARCH_DIR(@var{path})
+@cindex library search path in linker script
+@cindex archive search path in linker script
+@cindex search path in linker script
+The @code{SEARCH_DIR} command adds @var{path} to the list of paths where
+@code{ld} looks for archive libraries. Using
+@code{SEARCH_DIR(@var{path})} is exactly like using @samp{-L @var{path}}
+on the command line (@pxref{Options,,Command Line Options}). If both
+are used, then the linker will search both paths. Paths specified using
+the command line option are searched first.
+
+@item STARTUP(@var{filename})
+@kindex STARTUP(@var{filename})
+@cindex first input file
+The @code{STARTUP} command is just like the @code{INPUT} command, except
+that @var{filename} will become the first input file to be linked, as
+though it were specified first on the command line. This may be useful
+when using a system in which the entry point is always the start of the
+first file.
+@end table
-@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
+@ifclear SingleFormat
+@node Format Commands
+@subsection Commands dealing with object file formats
+A couple of linker script commands deal with object file formats.
-@cindex negative integers
-To write a negative integer, use
-the prefix operator @samp{-} (@pxref{Operators}).
+@table @code
+@item OUTPUT_FORMAT(@var{bfdname})
+@itemx OUTPUT_FORMAT(@var{default}, @var{big}, @var{little})
+@kindex OUTPUT_FORMAT(@var{bfdname})
+@cindex output file format in linker script
+The @code{OUTPUT_FORMAT} command names the BFD format to use for the
+output file (@pxref{BFD}). Using @code{OUTPUT_FORMAT(@var{bfdname})} is
+exactly like using @samp{-oformat @var{bfdname}} on the command line
+(@pxref{Options,,Command Line Options}). If both are used, the command
+line option takes precedence.
+
+You can use @code{OUTPUT_FORMAT} with three arguments to use different
+formats based on the @samp{-EB} and @samp{-EL} command line options.
+This permits the linker script to set the output format based on the
+desired endianness.
+
+If neither @samp{-EB} nor @samp{-EL} are used, then the output format
+will be the first argument, @var{default}. If @samp{-EB} is used, the
+output format will be the second argument, @var{big}. If @samp{-EL} is
+used, the output format will be the third argument, @var{little}.
+
+For example, the default linker script for the MIPS ELF target uses this
+command:
@smallexample
-_as_neg = -57005;
+OUTPUT_FORMAT(elf32-bigmips, elf32-bigmips, elf32-littlemips)
@end smallexample
+This says that the default format for the output file is
+@samp{elf32-bigmips}, but if the user uses the @samp{-EL} command line
+option, the output file will be created in the @samp{elf32-littlemips}
+format.
+
+@item TARGET(@var{bfdname})
+@kindex TARGET(@var{bfdname})
+@cindex input file format in linker script
+The @code{TARGET} command names the BFD format to use when reading input
+files. It affects subsequent @code{INPUT} and @code{GROUP} commands.
+This command is like using @samp{-b @var{bfdname}} on the command line
+(@pxref{Options,,Command Line Options}). If the @code{TARGET} command
+is used but @code{OUTPUT_FORMAT} is not, then the last @code{TARGET}
+command is also used to set the format for the output file. @xref{BFD}.
+@end table
+@end ifclear
-@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 Miscellaneous Commands
+@subsection Other linker script commands
+There are a few other linker scripts commands.
-@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
+@table @code
+@item ASSERT(@var{exp}, @var{message})
+@kindex ASSERT
+@cindex assertion in linker script
+Ensure that @var{exp} is non-zero. If it is zero, then exit the linker
+with an error code, and print @var{message}.
+
+@item EXTERN(@var{symbol} @var{symbol} @dots{})
+@kindex EXTERN
+@cindex undefined symbol in linker script
+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. You may list several @var{symbol}s for
+each @code{EXTERN}, and you may use @code{EXTERN} multiple times. This
+command has the same effect as the @samp{-u} command-line option.
-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.
+@item FORCE_COMMON_ALLOCATION
+@kindex FORCE_COMMON_ALLOCATION
+@cindex common allocation in linker script
+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}).
-@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}).
+@item NOCROSSREFS(@var{section} @var{section} @dots{})
+@kindex NOCROSSREFS(@var{sections})
+@cindex cross references
+This command may be used to tell @code{ld} to issue an error about any
+references among certain output sections.
-@iftex
-@vfill
-@end iftex
+In certain types of programs, particularly on embedded systems when
+using overlays, 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.
-@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
+The @code{NOCROSSREFS} command takes a list of output section names. If
+@code{ld} detects any cross references between the sections, it reports
+an error and returns a non-zero exit status. Note that the
+@code{NOCROSSREFS} command uses output section names, not input section
+names.
-@node Evaluation
-@subsection Evaluation
+@ifclear SingleFormat
+@item OUTPUT_ARCH(@var{bfdarch})
+@kindex OUTPUT_ARCH(@var{bfdarch})
+@cindex machine architecture
+@cindex architecture
+Specify a particular output machine architecture. The argument is one
+of the names used by the BFD library (@pxref{BFD}). You can see the
+architecture of an object file by using the @code{objdump} program with
+the @samp{-f} option.
+@end ifclear
+@end table
-@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
+@node Assignments
+@section Assigning Values to 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:
+You may assign a value to a symbol in a linker script. This will define
+the symbol as a global symbol.
+
+@menu
+* Simple Assignments:: Simple Assignments
+* PROVIDE:: PROVIDE
+@end menu
+
+@node Simple Assignments
+@subsection Simple Assignments
+
+You may assign to a symbol using any of the C assignment operators:
@table @code
-@item @var{symbol} = @var{expression} ;
-@itemx @var{symbol} &= @var{expression} ;
+@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} ;
+@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.
+The first case will define @var{symbol} to the value of
+@var{expression}. In the other cases, @var{symbol} must already be
+defined, and the value will be adjusted accordingly.
-@kindex ;
-@cindex semicolon
-@item
-You must place a trailing semicolon (``@key{;}'') at the end of an
-assignment statement.
-@end itemize
+The special symbol name @samp{.} indicates the location counter. You
+may only use this within a @code{SECTIONS} command.
-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 semicolon after @var{expression} is required.
-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}).
+Expressions are defined below; see @ref{Expressions}.
-@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
+You may write symbol assignments as commands in their own right, or as
+statements within a @code{SECTIONS} command, or as part of an output
+section description in a @code{SECTIONS} command.
+
+The section of the symbol will be set from the section of the
+expression; for more information, see @ref{Expression Section}.
+
+Here is an example showing the three different places that symbol
+assignments may be used:
-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{}
+floating_point = 0;
+SECTIONS
+@{
+ .text :
+ @{
+ *(.text)
+ _etext = .;
@}
-@dots{} @}
+ _bdata = (. + 3) & ~ 4;
+ .data : @{ *(.data) @}
+@}
@end smallexample
-@kindex Non constant expression
@noindent
-will cause the error message ``@code{Non constant expression for initial
-address}''.
-
-@cindex provide
+In this example, the symbol @samp{floating_point} will be defined as
+zero. The symbol @samp{_etext} will be defined as the address following
+the last @samp{.text} input section. The symbol @samp{_bdata} will be
+defined as the address following the @samp{.text} output section aligned
+upward to a 4 byte boundary.
+
+@node PROVIDE
+@subsection PROVIDE
+@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
+only if it is referenced and 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:
+Here is an example of using @code{PROVIDE} to define @samp{etext}:
@smallexample
-@group
-SECTIONS@{ @dots{}
- .output1 :
- @{
- start_of_output_1 = ABSOLUTE(.);
- @dots{}
- @}
- .output :
+SECTIONS
+@{
+ .text :
@{
- symbol_1 = ADDR(.output1);
- symbol_2 = start_of_output_1;
+ *(.text)
+ _etext = .;
+ PROVIDE(etext = .);
@}
-@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:
+In this example, if the program defines @samp{_etext} (with a leading
+underscore), the linker will give a multiple definition error. If, on
+the other hand, the program defines @samp{etext} (with no leading
+underscore), the linker will silently use the definition in the program.
+If the program references @samp{etext} but does not define it, the
+linker will use the definition in the linker script.
-@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.
+@node SECTIONS
+@section SECTIONS command
+@kindex SECTIONS
+The @code{SECTIONS} command tells the linker how to map input sections
+into output sections, and how to place the output sections in memory.
-@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?
+The format of the @code{SECTIONS} command is:
@smallexample
-@group
-SECTIONS@{ @dots{}
- .output @{
- .start = . ;
- @dots{}
- .end = . ;
- @}
- symbol_1 = .end - .start ;
- symbol_2 = SIZEOF(.output);
-@dots{} @}
-@end group
+SECTIONS
+@{
+ @var{sections-command}
+ @var{sections-command}
+ @dots{}
+@}
@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}.
+Each @var{sections-command} may of be one of the following:
-@kindex MIN
-@item MIN(@var{exp1}, @var{exp2})
-Returns the minimum of @var{exp1} and @var{exp2}.
-
-@end table
+@itemize @bullet
+@item
+an @code{ENTRY} command (@pxref{Entry Point,,Entry command})
+@item
+a symbol assignment (@pxref{Assignments})
+@item
+an output section description
+@item
+an overlay description
+@end itemize
-@node Semicolons
-@subsection Semicolons
+The @code{ENTRY} command and symbol assignments are permitted inside the
+@code{SECTIONS} command for convenience in using the location counter in
+those commands. This can also make the linker script easier to
+understand because you can use those commands at meaningful points in
+the layout of the output file.
-Semicolons (``@key{;}'') are required in the following places. In all
-other places they can appear for aesthetic reasons but are otherwise ignored.
+Output section descriptions and overlay descriptions are described
+below.
-@table @code
-@item Assignment
-Semicolons must appear at the end of assignment expressions.
-@xref{Assignment}
+If you do not use a @code{SECTIONS} command in your linker script, the
+linker will place 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. The first section will be at address zero.
-@item PHDRS
-Semicolons must appear at the end of a @code{PHDRS} statement.
-@xref{PHDRS}
-@end table
+@menu
+* Output Section Description:: Output section description
+* Output Section Name:: Output section name
+* Output Section Address:: Output section address
+* Input Section:: Input section description
+* Output Section Data:: Output section data
+* Output Section Keywords:: Output section keywords
+* Output Section Discarding:: Output section discarding
+* Output Section Attributes:: Output section attributes
+* Overlay Description:: Overlay description
+@end menu
-@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:
-
+@node Output Section Description
+@subsection Output section description
+The full description of an output section looks like this:
@smallexample
-@group
-MEMORY
+@group
+@var{section} [@var{address}] [(@var{type})] : [AT(@var{lma})]
@{
- @var{name} (@var{attr}) : ORIGIN = @var{origin}, LENGTH = @var{len}
+ @var{output-section-command}
+ @var{output-section-command}
@dots{}
- @}
+ @} [>@var{region}] [AT>@var{lma_region}] [:@var{phdr} :@var{phdr} @dots{}] [=@var{fillexp}]
@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.
+Most output sections do not use most of the optional section attributes.
-@item @code{A}
-Allocated sections.
+The whitespace around @var{section} is required, so that the section
+name is unambiguous. The colon and the curly braces are also required.
+The line breaks and other white space are optional.
-@item @code{I}
-Initialized sections.
+Each @var{output-section-command} may be one of the following:
-@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.
+@itemize @bullet
+@item
+a symbol assignment (@pxref{Assignments})
+@item
+an input section description (@pxref{Input Section})
+@item
+data values to include directly (@pxref{Output Section Data})
+@item
+a special output section keyword (@pxref{Output Section Keywords})
+@end itemize
+@node Output Section Name
+@subsection Output section name
+@cindex name, section
+@cindex section name
+The name of the output section is @var{section}. @var{section} 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 @samp{.text}, @samp{.data} or @samp{.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 a name which contains any unusual characters such as
+commas must be quoted.
+
+The output section name @samp{/DISCARD/} is special; @ref{Output Section
+Discarding}.
+
+@node Output Section Address
+@subsection Output section address
+@cindex address, section
+@cindex section address
+The @var{address} is an expression for the VMA (the virtual memory
+address) of the output section. If you do not provide @var{address},
+the linker will set it based on @var{region} if present, or otherwise
+based on the current value of the location counter.
+
+If you provide @var{address}, the address of the output section will be
+set to precisely that. If you provide neither @var{address} nor
+@var{region}, then the address of the output section will be set to the
+current value of the location counter aligned to the alignment
+requirements of the output section. The alignment requirement of the
+output section is the strictest alignment of any input section contained
+within the output section.
+
+For example,
@smallexample
-@group
-MEMORY
- @{
- rom (rx) : ORIGIN = 0, LENGTH = 256K
- ram (!rx) : org = 0x40000000, l = 4M
- @}
-@end group
+.text . : @{ *(.text) @}
@end smallexample
+@noindent
+and
+@smallexample
+.text : @{ *(.text) @}
+@end smallexample
+@noindent
+are subtly different. The first will set the address of the
+@samp{.text} output section to the current value of the location
+counter. The second will set it to the current value of the location
+counter aligned to the strictest alignment of a @samp{.text} input
+section.
+
+The @var{address} may be an arbitrary expression; @ref{Expressions}.
+For example, if you want to align the section on a 0x10 byte boundary,
+so that the lowest four bits of the section address are zero, you could
+do something like this:
+@smallexample
+.text ALIGN(0x10) : @{ *(.text) @}
+@end smallexample
+@noindent
+This works because @code{ALIGN} returns the current location counter
+aligned upward to the specified value.
-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;
+Specifying @var{address} for a section will change the value of the
+location counter.
-@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.
+@node Input Section
+@subsection Input section description
+@cindex input sections
+@cindex mapping input sections to output sections
+The most common output section command is an input section description.
-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.
+The input section description is the most basic linker script operation.
+You use output sections to tell the linker how to lay out your program
+in memory. You use input section descriptions to tell the linker how to
+map the input files into your memory layout.
@menu
-* Section Definition:: Section Definitions
-* Section Placement:: Section Placement
-* Section Data Expressions:: Section Data Expressions
-* Section Options:: Optional Section Attributes
-* Overlays:: Overlays
+* Input Section Basics:: Input section basics
+* Input Section Wildcards:: Input section wildcard patterns
+* Input Section Common:: Input section for common symbols
+* Input Section Keep:: Input section and garbage collection
+* Input Section Example:: Input section example
@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
+@node Input Section Basics
+@subsubsection Input section basics
+@cindex input section basics
+An input section description consists of a file name optionally followed
+by a list of section names in parentheses.
+
+The file name and the section name may be wildcard patterns, which we
+describe further below (@pxref{Input Section Wildcards}).
+
+The most common input section description is to include all input
+sections with a particular name in the output section. For example, to
+include all input @samp{.text} sections, you would write:
@smallexample
-SECTIONS @{ @dots{}
- @var{secname} : @{
- @var{contents}
- @}
-@dots{} @}
+*(.text)
@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,
+Here the @samp{*} is a wildcard which matches any file name. To exclude a list
+of files from matching the file name wildcard, EXCLUDE_FILE may be used to
+match all files except the ones specified in the EXCLUDE_FILE list. For
+example:
@smallexample
-.foo @{ *(.foo) @}
+(*(EXCLUDE_FILE (*crtend.o *otherfile.o) .ctors))
@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.
+will cause all .ctors sections from all files except @file{crtend.o} and
+@file{otherfile.o} to be included.
-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:
+There are two ways to include more than one section:
@smallexample
-.data : @{ afile.o bfile.o cfile.o @}
+*(.text .rdata)
+*(.text) *(.rdata)
@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:
+The difference between these is the order in which the @samp{.text} and
+@samp{.rdata} input sections will appear in the output section. In the
+first example, they will be intermingled. In the second example, all
+@samp{.text} input sections will appear first, followed by all
+@samp{.rdata} input sections.
+
+You can specify a file name to include sections from a particular file.
+You would do this if one or more of your files contain special data that
+needs to be at a particular location in memory. For example:
@smallexample
-@group
-SECTIONS @{
- .text :@{
- *("1" "2" "3" "4")
- @}
-
- .data :@{
- *("13" "14")
- @}
-@}
-@end group
+data.o(.data)
@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
+If you use a file name without a list of sections, then all sections in
+the input file will be included in the output section. This is not
+commonly done, but it may by useful on occasion. For example:
+@smallexample
+data.o
+@end smallexample
+
+When you use a file name which does not contain any wild card
+characters, the linker will first see if you also specified the file
+name on the linker command line or in an @code{INPUT} command. If you
+did not, the linker will attempt to open the file as an input file, as
+though it appeared on the command line. Note that this differs from an
+@code{INPUT} command, because the linker will not search for the file in
+the archive search path.
-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.
+@node Input Section Wildcards
+@subsubsection Input section wildcard patterns
+@cindex input section wildcards
+@cindex wildcard file name patterns
+@cindex file name wildcard patterns
+@cindex section name wildcard patterns
+In an input section description, either the file name or the section
+name or both may be wildcard patterns.
+
+The file name of @samp{*} seen in many examples is a simple wildcard
+pattern for the file name.
+
+The wildcard patterns are like those used by the Unix shell.
+
+@table @samp
+@item *
+matches any number of characters
+@item ?
+matches any single character
+@item [@var{chars}]
+matches 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
+@item \
+quotes the following character
+@end table
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.
+exception; it will always match any file name, whether it contains a
+@samp{/} or not. In a section name, the wildcard characters will match
+a @samp{/} character.
+
+File name wildcard patterns only match files which are explicitly
+specified on the command line or in an @code{INPUT} command. The linker
+does not search directories to expand wildcards.
+
+If a file name matches more than one wildcard pattern, or if a file name
+appears explicitly and is also matched by a wildcard pattern, the linker
+will use the first match in the linker script. For example, this
+sequence of input section descriptions is probably in error, because the
+@file{data.o} rule will not be used:
+@smallexample
+.data : @{ *(.data) @}
+.data1 : @{ data.o(.data) @}
+@end smallexample
-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.
+@cindex SORT
+Normally, the linker will place files and sections matched by wildcards
+in the order in which they are seen during the link. You can change
+this by using the @code{SORT} keyword, which appears before a wildcard
+pattern in parentheses (e.g., @code{SORT(.text*)}). When the
+@code{SORT} keyword is used, the linker will sort the files or sections
+into ascending order by name before placing them in the output file.
-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:
+If you ever get confused about where input sections are going, use the
+@samp{-M} linker option to generate a map file. The map file shows
+precisely how input sections are mapped to output sections.
+This example shows how wildcard patterns might be used to partition
+files. This linker script directs the linker to place all @samp{.text}
+sections in @samp{.text} and all @samp{.bss} sections in @samp{.bss}.
+The linker will place the @samp{.data} section from all files beginning
+with an upper case character in @samp{.DATA}; for all other files, the
+linker will place the @samp{.data} section in @samp{.data}.
@smallexample
@group
-SECTIONS @{
+SECTIONS @{
.text : @{ *(.text) @}
- .data : @{ *(.data) @}
- .bss : @{ *(.bss) *(COMMON) @}
-@}
+ .DATA : @{ [A-Z]*(.data) @}
+ .data : @{ *(.data) @}
+ .bss : @{ *(.bss) @}
+@}
@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}.
+@node Input Section Common
+@subsubsection Input section for common symbols
+@cindex common symbol placement
+@cindex uninitialized data placement
+A special notation is needed for common symbols, because in many object
+file formats common symbols do not have a particular input section. The
+linker treats common symbols as though they are in an input section
+named @samp{COMMON}.
+
+You may use file names with the @samp{COMMON} section just as with any
+other input sections. You can use this to place common symbols from a
+particular input file in one section while common symbols from other
+input files are placed in another section.
+
+In most cases, common symbols in input files will be placed in the
+@samp{.bss} section in the output file. For example:
+@smallexample
+.bss @{ *(.bss) *(COMMON) @}
+@end smallexample
+
+@cindex scommon section
+@cindex small common symbols
+Some object file formats have more than one type of common symbol. For
+example, the MIPS ELF object file format distinguishes standard common
+symbols and small common symbols. In this case, the linker will use a
+different special section name for other types of common symbols. In
+the case of MIPS ELF, the linker uses @samp{COMMON} for standard common
+symbols and @samp{.scommon} for small common symbols. This permits you
+to map the different types of common symbols into memory at different
+locations.
+
+@cindex [COMMON]
+You will sometimes see @samp{[COMMON]} in old linker scripts. This
+notation is now considered obsolete. It is equivalent to
+@samp{*(COMMON)}.
+
+@node Input Section Keep
+@subsubsection Input section and garbage collection
+@cindex KEEP
+@cindex garbage collection
+When link-time garbage collection is in use (@samp{--gc-sections}),
+it is often useful to mark sections that should not be eliminated.
+This is accomplished by surrounding an input section's wildcard entry
+with @code{KEEP()}, as in @code{KEEP(*(.init))} or
+@code{KEEP(SORT(*)(.ctors))}.
+
+@node Input Section Example
+@subsubsection Input section example
+The following example is a complete linker script. It tells the linker
+to read all of the sections from file @file{all.o} and place them at the
+start of output section @samp{outputa} which starts at location
+@samp{0x10000}. All of section @samp{.input1} from file @file{foo.o}
+follows immediately, in the same output section. All of section
+@samp{.input2} from @file{foo.o} goes into output section
+@samp{outputb}, followed by section @samp{.input1} from @file{foo1.o}.
+All of the remaining @samp{.input1} and @samp{.input2} sections from any
+files are written to output section @samp{outputc}.
@smallexample
@group
@@ -2211,259 +2445,266 @@ SECTIONS @{
@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}.
+@node Output Section Data
+@subsection Output section data
+@cindex data
+@cindex section data
+@cindex output section data
+@kindex BYTE(@var{expression})
+@kindex SHORT(@var{expression})
+@kindex LONG(@var{expression})
+@kindex QUAD(@var{expression})
+@kindex SQUAD(@var{expression})
+You can include explicit bytes of data in an output section by using
+@code{BYTE}, @code{SHORT}, @code{LONG}, @code{QUAD}, or @code{SQUAD} as
+an output section command. Each keyword is followed by an expression in
+parentheses providing the value to store (@pxref{Expressions}). The
+value of the expression is stored at the current value of the location
+counter.
+
+The @code{BYTE}, @code{SHORT}, @code{LONG}, and @code{QUAD} commands
+store one, two, four, and eight bytes (respectively). After storing the
+bytes, the location counter is incremented by the number of bytes
+stored.
+
+For example, this will store the byte 1 followed by the four byte value
+of the symbol @samp{addr}:
+@smallexample
+BYTE(1)
+LONG(addr)
+@end smallexample
+
+When using a 64 bit host or target, @code{QUAD} and @code{SQUAD} are the
+same; they both store an 8 byte, or 64 bit, value. When both host and
+target are 32 bits, an expression is computed as 32 bits. In this case
+@code{QUAD} stores a 32 bit value zero extended to 64 bits, and
+@code{SQUAD} stores a 32 bit value sign extended to 64 bits.
+If the object file format of the output file has an explicit endianness,
+which is the normal case, the value will be stored in that endianness.
+When the object file format does not have an explicit endianness, as is
+true of, for example, S-records, the value will be stored in the
+endianness of the first input object file.
+
+@kindex FILL(@var{expression})
+@cindex holes, filling
+@cindex unspecified memory
+You may use the @code{FILL} command to set the fill pattern for the
+current section. It is followed by an expression in parentheses. Any
+otherwise unspecified regions of memory within the section (for example,
+gaps left due to the required alignment of input sections) are filled
+with the two least significant bytes of the expression, repeated as
+necessary. A @code{FILL} statement covers memory locations after the
+point at which 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.
+
+This example shows how to fill unspecified regions of memory with the
+value @samp{0x9090}:
@smallexample
-@group
-SECTIONS @{
- .text : @{ *(.text) @}
- .DATA : @{ [A-Z]*(.data) @}
- .data : @{ *(.data) @}
- .bss : @{ *(.bss) @}
-@}
-@end group
+FILL(0x9090)
@end smallexample
-@node Section Data Expressions
-@subsection Section Data Expressions
+The @code{FILL} command is similar to the @samp{=@var{fillexp}} output
+section attribute (@pxref{Output Section Fill}), but it only affects the
+part of the section following the @code{FILL} command, rather than the
+entire section. If both are used, the @code{FILL} command takes
+precedence.
-@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.
+@node Output Section Keywords
+@subsection Output section keywords
+There are a couple of keywords which can appear as output section
+commands.
@table @code
+@kindex CREATE_OBJECT_SYMBOLS
@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 */
+The command tells the linker to create a symbol for each input file.
+The name of each symbol will be the name of the corresponding input
+file. The section of each symbol will be the output section in which
+the @code{CREATE_OBJECT_SYMBOLS} command appears.
-afunction() @{ @}
-int adata=1;
-int abss;
-@end group
-@end smallexample
+This is conventional for the a.out object file format. It is not
+normally used for any other object file format.
-@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 CONSTRUCTORS
+@cindex C++ constructors, arranging in link
+@cindex constructors, arranging in link
+@item CONSTRUCTORS
+When linking using the 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 ECOFF and 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 to place constructor information in the output section where the
+@code{CONSTRUCTORS} command appears. The @code{CONSTRUCTORS} command is
+ignored for other object file formats.
-@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.
+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++ normally 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++ normally runs
+destructors either by using @code{atexit}, or directly from the function
+@code{exit}.
-@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
+For object file formats such as @code{COFF} or @code{ELF} which support
+arbitrary section names, @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
-@group
-SECTIONS @{
- abs = 14 ;
- @dots{}
- .data : @{ @dots{} rel = 14 ; @dots{} @}
- abs2 = 14 + ADDR(.data);
- @dots{}
-@}
-@end group
+ __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
-@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}.
+If you are using the @sc{gnu} C++ support for initialization priority,
+which provides some control over the order in which global constructors
+are run, you must sort the constructors at link time to ensure that they
+are executed in the correct order. When using the @code{CONSTRUCTORS}
+command, use @samp{SORT(CONSTRUCTORS)} instead. When using the
+@code{.ctors} and @code{.dtors} sections, use @samp{*(SORT(.ctors))} and
+@samp{*(SORT(.dtors))} instead of just @samp{*(.ctors)} and
+@samp{*(.dtors)}.
-@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
+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.
-@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:
-
+@node Output Section Discarding
+@subsection Output section discarding
+@cindex discarding sections
+@cindex sections, discarding
+@cindex removing sections
+The linker will not create output section which do not have any
+contents. This is for convenience when referring to input sections that
+may or may not be present in any of the input files. For example:
@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
+.foo @{ *(.foo) @}
@end smallexample
+@noindent
+will only create a @samp{.foo} section in the output file if there is a
+@samp{.foo} section in at least one input file.
-@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.
+If you use anything other than an input section description as an output
+section command, such as a symbol assignment, then the output section
+will always be created, even if there are no matching input sections.
-@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}:
+@cindex /DISCARD/
+The special output section name @samp{/DISCARD/} may be used to discard
+input sections. Any input sections which are assigned to an output
+section named @samp{/DISCARD/} are not included in the output file.
+@node Output Section Attributes
+@subsection Output section attributes
+@cindex output section attributes
+We showed above that the full description of an output section looked
+like this:
@smallexample
-@group
-SECTIONS @{
- @dots{}
- output 0x40000000: @{
+@group
+@var{section} [@var{address}] [(@var{type})] : [AT(@var{lma})]
+ @{
+ @var{output-section-command}
+ @var{output-section-command}
@dots{}
- @}
- @dots{}
-@}
+ @} [>@var{region}] [AT>@var{lma_region}] [:@var{phdr} :@var{phdr} @dots{}] [=@var{fillexp}]
@end group
@end smallexample
+We've already described @var{section}, @var{address}, and
+@var{output-section-command}. In this section we will describe the
+remaining section attributes.
+
+@menu
+* Output Section Type:: Output section type
+* Output Section LMA:: Output section LMA
+* Output Section Region:: Output section region
+* Output Section Phdr:: Output section phdr
+* Output Section Fill:: Output section fill
+@end menu
+
+@node Output Section Type
+@subsubsection Output section type
+Each output section may have a type. The type is a keyword in
+parentheses. The following types are defined:
-@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.
+@table @code
+@item NOLOAD
+The section should be marked as not loadable, so that it will not be
+loaded into memory when the program is run.
+@item DSECT
+@itemx COPY
+@itemx INFO
+@itemx OVERLAY
+These type names are supported for backward compatibility, and are
+rarely used. They all have the same effect: the section should be
+marked as not allocatable, so that no memory is allocated for the
+section when the program is run.
+@end table
@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.
-
+The linker normally sets the attributes of an output section based on
+the input sections which map into it. You can override this by using
+the section type. For example, in the script sample below, the
+@samp{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
+@samp{ROM} section will appear in the linker output file as usual.
@smallexample
@group
SECTIONS @{
- ROM 0 (NOLOAD) : @{ @dots{} @}
+ 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}:
+@node Output Section LMA
+@subsubsection Output section LMA
+@kindex AT>@var{lma_region}
+@kindex AT(@var{lma})
+@cindex load address
+@cindex section load address
+Every section has a virtual address (VMA) and a load address (LMA); see
+@ref{Basic Script Concepts}. The address expression which may appear in
+an output section description sets the VMA (@pxref{Output Section
+Address}).
+
+The linker will normally set the LMA equal to the VMA. You can change
+that by using the @code{AT} keyword. The expression @var{lma} that
+follows the @code{AT} keyword specifies the load address of the
+section. Alternatively, with @samp{AT>@var{lma_region}} expression,
+you may specify a memory region for the section's load address. @xref{MEMORY}.
+
+@cindex ROM initialized data
+@cindex initialized data in ROM
+This feature is designed to make it easy to build a ROM image. For
+example, the following linker script creates three output sections: one
+called @samp{.text}, which starts at @code{0x1000}, one called
+@samp{.mdata}, which is loaded at the end of the @samp{.text} section
+even though its VMA is @code{0x2000}, and one called @samp{.bss} to hold
+uninitialized data at address @code{0x3000}. The symbol @code{_data} is
+defined with the value @code{0x2000}, which shows that the location
+counter holds the VMA value, not the LMA value.
@smallexample
@group
@@ -2471,7 +2712,7 @@ SECTIONS
@{
.text 0x1000 : @{ *(.text) _etext = . ; @}
.mdata 0x2000 :
- AT ( ADDR(.text) + SIZEOF ( .text ) )
+ AT ( ADDR (.text) + SIZEOF (.text) )
@{ _data = . ; *(.data); _edata = . ; @}
.bss 0x3000 :
@{ _bstart = . ; *(.bss) *(COMMON) ; _bend = . ;@}
@@ -2479,82 +2720,121 @@ SECTIONS
@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:
+The run-time initialization code for use with a program generated with
+this linker script would include something like the following, to copy
+the initialized data from the ROM image to its runtime address. Notice
+how this code takes advantage of the symbols defined by the linker
+script.
@smallexample
@group
-char *src = _etext;
-char *dst = _data;
+extern char _etext, _data, _edata, _bstart, _bend;
+char *src = &_etext;
+char *dst = &_data;
/* ROM has data at end of text; copy it. */
-while (dst < _edata) @{
+while (dst < &_edata) @{
*dst++ = *src++;
@}
/* Zero bss */
-for (dst = _bstart; dst< _bend; dst++)
+for (dst = &_bstart; dst< &_bend; dst++)
*dst = 0;
@end group
@end smallexample
+@node Output Section Region
+@subsubsection Output section region
@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}.
+You can assign a section to a previously defined region of memory by
+using @samp{>@var{region}}. @xref{MEMORY}.
+
+Here is a simple example:
+@smallexample
+@group
+MEMORY @{ rom : ORIGIN = 0x1000, LENGTH = 0x1000 @}
+SECTIONS @{ ROM : @{ *(.text) @} >rom @}
+@end group
+@end smallexample
+@node Output Section Phdr
+@subsubsection Output section phdr
@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}
+You can assign a section to a previously defined program segment by
+using @samp{:@var{phdr}}. @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. You can use @code{:NONE} to tell the
+linker to not put the section in any segment at all.
+
+Here is a simple example:
+@smallexample
+@group
+PHDRS @{ text PT_LOAD ; @}
+SECTIONS @{ .text : @{ *(.text) @} :text @}
+@end group
+@end smallexample
+
+@node Output Section Fill
+@subsubsection Output section fill
+@kindex =@var{fillexp}
@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.
+You can set the fill pattern for an entire section by using
+@samp{=@var{fillexp}}. @var{fillexp} is an expression
+(@pxref{Expressions}). Any otherwise unspecified regions of memory
+within the output section (for example, gaps left due to the required
+alignment of input sections) will be filled with the two least
+significant bytes of the value, repeated as necessary.
-@end table
+You can also change the fill value with a @code{FILL} command in the
+output section commands; see @ref{Output Section Data}.
+
+Here is a simple example:
+@smallexample
+@group
+SECTIONS @{ .text : @{ *(.text) @} =0x9090 @}
+@end group
+@end smallexample
-@node Overlays
-@subsection Overlays
+@node Overlay Description
+@subsection Overlay description
@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:
+An overlay description 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.
+
+Overlays are described using the @code{OVERLAY} command. The
+@code{OVERLAY} command is used within a @code{SECTIONS} command, like an
+output section description. The full syntax of the @code{OVERLAY}
+command is 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}
+OVERLAY [@var{start}] : [NOCROSSREFS] [AT ( @var{ldaddr} )]
+ @{
+ @var{secname1}
+ @{
+ @var{output-section-command}
+ @var{output-section-command}
+ @dots{}
+ @} [:@var{phdr}@dots{}] [=@var{fill}]
+ @var{secname2}
+ @{
+ @var{output-section-command}
+ @var{output-section-command}
+ @dots{}
+ @} [:@var{phdr}@dots{}] [=@var{fill}]
+ @dots{}
+ @} [>@var{region}] [:@var{phdr}@dots{}] [=@var{fill}]
@end group
@end smallexample
@@ -2570,12 +2850,12 @@ 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{.}).
+and defaults to the current value of the location counter).
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,
+section to refer directly to another. @xref{Miscellaneous Commands,
NOCROSSREFS}.
For each section within the @code{OVERLAY}, the linker automatically
@@ -2586,12 +2866,11 @@ 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.
+At the end of the overlay, the value of the location counter 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)
@@ -2601,10 +2880,10 @@ Here is an example. Remember that this would appear inside a
@}
@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
+@noindent
+This will define both @samp{.text0} and @samp{.text1} to start at
+address 0x1000. @samp{.text0} will be loaded at address 0x4000, and
+@samp{.text1} will be loaded immediately after @samp{.text0}. The
following symbols will be defined: @code{__load_start_text0},
@code{__load_stop_text0}, @code{__load_start_text1},
@code{__load_stop_text1}.
@@ -2636,27 +2915,149 @@ example could have been written identically as follows.
@end group
@end smallexample
+@node MEMORY
+@section MEMORY command
+@kindex MEMORY
+@cindex memory regions
+@cindex regions of memory
+@cindex allocating memory
+@cindex discontinuous memory
+The linker's default configuration permits allocation of all available
+memory. You can override this by using the @code{MEMORY} command.
+
+The @code{MEMORY} command describes the location and size of blocks of
+memory in the target. You can use it to describe which memory regions
+may be used by the linker, and which memory regions it must avoid. You
+can then assign sections to particular memory regions. The linker will
+set section addresses based on the memory regions, and will warn about
+regions that become too full. The linker will not shuffle sections
+around to fit into the available regions.
+
+A linker script 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
+
+The @var{name} is a name used in the linker script to refer to the
+region. The region name has no meaning outside of the linker script.
+Region names are stored in a separate name space, and will not conflict
+with symbol names, file names, or section names. Each memory region
+must have a distinct name.
+
+@cindex memory region attributes
+The @var{attr} string is an optional list of attributes that specify
+whether to use a particular memory region for an input section which is
+not explicitly mapped in the linker script. As described in
+@ref{SECTIONS}, if you do not specify an output section for some input
+section, the linker will create an output section with the same name as
+the input section. If you define region attributes, the linker will use
+them to select the memory region for the output section that it creates.
+
+The @var{attr} string must consist only of the following characters:
+@table @samp
+@item R
+Read-only section
+@item W
+Read/write section
+@item X
+Executable section
+@item A
+Allocatable section
+@item I
+Initialized section
+@item L
+Same as @samp{I}
+@item !
+Invert the sense of any of the preceding attributes
+@end table
+
+If a unmapped section matches any of the listed attributes other than
+@samp{!}, it will be placed in the memory region. The @samp{!}
+attribute reverses this test, so that an unmapped section will be placed
+in the memory region only if it does not match any of the listed
+attributes.
+
+@kindex ORIGIN =
+@kindex o =
+@kindex org =
+The @var{origin} is an expression for the start address of the memory
+region. The expression must evaluate to a constant before memory
+allocation is performed, which means that you may not use any section
+relative symbols. The keyword @code{ORIGIN} may be abbreviated to
+@code{org} or @code{o} (but not, for example, @code{ORG}).
+
+@kindex LENGTH =
+@kindex len =
+@kindex l =
+The @var{len} is an expression for the size in bytes of the memory
+region. As with the @var{origin} expression, the expression must
+evaluate to a constant before memory allocation is performed. The
+keyword @code{LENGTH} may be abbreviated to @code{len} or @code{l}.
+
+In the following example, we specify that there are two memory regions
+available for allocation: one starting at @samp{0} for 256 kilobytes,
+and the other starting at @samp{0x40000000} for four megabytes. The
+linker will place into the @samp{rom} memory region every section which
+is not explicitly mapped into a memory region, and is either read-only
+or executable. The linker will place other sections which are not
+explicitly mapped into a memory region into the @samp{ram} memory
+region.
+
+@smallexample
+@group
+MEMORY
+ @{
+ rom (rx) : ORIGIN = 0, LENGTH = 256K
+ ram (!rx) : org = 0x40000000, l = 4M
+ @}
+@end group
+@end smallexample
+
+Once you define a memory region, you can direct the linker to place
+specific output sections into that memory region by using the
+@samp{>@var{region}} output section attribute. For example, if you have
+a memory region named @samp{mem}, you would use @samp{>mem} in the
+output section definition. @xref{Output Section Region}. If no address
+was specified for the output section, the linker will set the address to
+the next available address within the memory region. If the combined
+output sections directed to a memory region are too large for the
+region, the linker will issue an error message.
+
@node PHDRS
-@section ELF Program Headers
+@section PHDRS Command
@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.
+@cindex program segments
+@cindex segments, ELF
+The ELF object file format uses @dfn{program headers}, also knows as
+@dfn{segments}. The program headers describe how the program should be
+loaded into memory. You can print them out by using the @code{objdump}
+program with the @samp{-p} option.
+
+When you run an ELF program on a native ELF system, the system loader
+reads the program headers in order to figure out how to load the
+program. This will only work if the program headers are set correctly.
+This manual does not describe the details of how the system loader
+interprets program headers; for more information, see the ELF ABI.
+
+The linker will create reasonable program headers by default. However,
+in some cases, you may need to specify the program headers more
+precisely. You may use the @code{PHDRS} command for this purpose. When
+the linker sees the @code{PHDRS} command in the linker script, it will
+not create any program headers other than the ones specified.
+
+The linker only pays attention to the @code{PHDRS} command when
+generating an ELF output file. In other cases, the linker will simply
+ignore @code{PHDRS}.
This is the syntax of the @code{PHDRS} command. The words @code{PHDRS},
@code{FILEHDR}, @code{AT}, and @code{FLAGS} are keywords.
@@ -2672,30 +3073,35 @@ PHDRS
@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
+of the linker script. It is not put into the output file. Program
+header names are stored in a separate name space, and will not conflict
+with symbol names, file names, or section names. Each program header
+must have a distinct name.
+
+Certain program header types describe segments of memory which the
+system loader will load from the file. In the linker script, you
+specify the contents of these segments by placing allocatable output
+sections in the segments. You use the @samp{:@var{phdr}} output section
+attribute to place a section in a particular segment. @xref{Output
+Section Phdr}.
+
+It is normal to put certain sections in more than one segment. This
+merely implies that one segment of memory contains another. You may
+repeat @samp{:@var{phdr}}, using it once for each segment which should
+contain the section.
+
+If you place a section in one or more segments using @samp{:@var{phdr}},
+then the linker will place all subsequent allocatable sections which do
+not specify @samp{:@var{phdr}} 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}.
+placed in a single segment. You can use @code{:NONE} to override the
+default segment and tell the linker to not put the section in any
+segment at all.
-The @code{FILEHDR} and @code{PHDRS} keywords which may appear after the
-program header type also indicate contents of the segment of memory.
+@kindex FILEHDR
+@kindex PHDRS
+You may use the @code{FILEHDR} and @code{PHDRS} keywords appear after
+the program header type to further describe the contents of the segment.
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.
@@ -2733,20 +3139,20 @@ 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.
+You can specify that a segment should be loaded at a particular address
+in memory by using an @code{AT} expression. This is identical to the
+@code{AT} command used as an output section attribute (@pxref{Output
+Section LMA}). The @code{AT} command for a program header overrides the
+output section attribute.
-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.
+The linker will normally set the segment flags based on the sections
+which comprise the segment. You may use the @code{FLAGS} keyword 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.
+Here is an example of @code{PHDRS}. This shows a typical set of program
+headers used on a native ELF system.
@example
@group
@@ -2774,84 +3180,33 @@ SECTIONS
@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
+@node VERSION
+@section VERSION Command
@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:
+The linker supports symbol versions when using ELF. Symbol versions are
+only useful when using shared libraries. The dynamic linker can use
+symbol versions to select a specific version of a function when it runs
+a program that may have been linked against an earlier version of the
+shared library.
+
+You can include a version script directly in the main linker script, or
+you can supply the version script as an implicit linker script. You can
+also use the @samp{--version-script} linker option.
+
+The syntax of the @code{VERSION} command is simply
@smallexample
-VERSION @{ version script contents @}
+VERSION @{ version-script-commands @}
@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
+
+The format of the version script commands is identical to that used by
+Sun's linker in Solaris 2.5. The version script defines a tree of
+version nodes. You specify the node names and interdependencies in the
+version script. You can specify which symbols are bound to which
+version nodes, and you 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
@@ -2876,40 +3231,41 @@ VERS_2.0 @{
@} 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.
+This example version script defines three version nodes. The first
+version node defined is @samp{VERS_1.1}; it has no other dependencies.
+The script binds the symbol @samp{foo1} to @samp{VERS_1.1}. It reduces
+a number of symbols to local scope 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.
+Next, the version script defines node @samp{VERS_1.2}. This node
+depends upon @samp{VERS_1.1}. The script binds the symbol @samp{foo2}
+to the version node @samp{VERS_1.2}.
-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.
+Finally, the version script defines node @samp{VERS_2.0}. This node
+depends upon @samp{VERS_1.2}. The scripts binds the symbols @samp{bar1}
+and @samp{bar2} are bound to the version node @samp{VERS_2.0}.
-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.
+When the linker finds a symbol defined in a library which is not
+specifically bound to a version node, it will effectively bind it to an
+unspecified base version of the library. You can bind all otherwise
+unspecified symbols to a given version node by 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.
+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.
+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
@@ -2925,25 +3281,24 @@ 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:
-
+maintainer. You can do this 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
+@noindent
+in the C source file. This renames 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.
+The second GNU extension is to allow multiple versions of the same
+function to appear in a given shared library. In this way you can make
+an incompatible change to an interface 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:
+To do this, you must use multiple @samp{.symver} directives in the
+source file. Here is an example:
@smallexample
__asm__(".symver original_foo,foo@@");
@@ -2959,214 +3314,502 @@ example would define 4 C functions: @samp{original_foo}, @samp{old_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.
+this symbol will be bound. You can do this with the
+@samp{foo@@@@VERS_2.0} type of @samp{.symver} directive. You can only
+declare one version of a symbol as the 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.
+@node Expressions
+@section Expressions in Linker Scripts
+@cindex expressions
+@cindex arithmetic
+The syntax for expressions in the linker script language is identical to
+that of C expressions. All expressions are evaluated as integers. All
+expressions are evaluated in the same size, which is 32 bits if both the
+host and target are 32 bits, and is otherwise 64 bits.
-@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.
+You can use and set symbol values in expressions.
-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}.
+The linker defines several special purpose builtin functions for use in
+expressions.
-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.
+@menu
+* Constants:: Constants
+* Symbols:: Symbol Names
+* Location Counter:: The Location Counter
+* Operators:: Operators
+* Evaluation:: Evaluation
+* Expression Section:: The Section of an Expression
+* Builtin Functions:: Builtin Functions
+@end menu
+@node Constants
+@subsection Constants
+@cindex integer notation
+@cindex constants in linker scripts
+All constants are integers.
+
+As in C, the linker considers an integer beginning with @samp{0} to be
+octal, and an integer beginning with @samp{0x} or @samp{0X} to be
+hexadecimal. The linker considers other integers to be decimal.
+
+@cindex scaled integers
+@cindex K and M integer suffixes
+@cindex M and K integer suffixes
+@cindex suffixes for integers
+@cindex integer suffixes
+In addition, you can use the suffixes @code{K} and @code{M} 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
- __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__ = .;
+ _fourk_1 = 4K;
+ _fourk_2 = 4096;
+ _fourk_3 = 0x1000;
@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.
+@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 period
+and may include letters, digits, underscores, periods, 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
-@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.
+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.
-@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}).
+@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 may only appear in an expression
+within a @code{SECTIONS} command. The @code{.} symbol may appear
+anywhere that an ordinary symbol is allowed in an expression.
-@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.
+@cindex holes
+Assigning a value to @code{.} will cause the location counter to be
+moved. This may be used to create holes in the output section. The
+location counter may never be moved backwards.
-@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.
+@smallexample
+SECTIONS
+@{
+ output :
+ @{
+ file1(.text)
+ . = . + 1000;
+ file2(.text)
+ . += 1000;
+ file3(.text)
+ @} = 0x1234;
+@}
+@end smallexample
+@noindent
+In the previous example, the @samp{.text} section from @file{file1} is
+located at the beginning of the output section @samp{output}. It is
+followed by a 1000 byte gap. Then the @samp{.text} section from
+@file{file2} appears, also with a 1000 byte gap following before the
+@samp{.text} section from @file{file3}. The notation @samp{= 0x1234}
+specifies what data to write in the gaps (@pxref{Output Section Fill}).
+
+@cindex dot inside sections
+Note: @code{.} actually refers to the byte offset from the start of the
+current containing object. Normally this is the @code{SECTIONS}
+statement, whoes start address is 0, hence @code{.} can be used as an
+absolute address. If @code{.} is used inside a section description
+however, it refers to the byte offset from the start of that section,
+not an absolute address. Thus in a script like this:
-@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}.
+@smallexample
+SECTIONS
+@{
+ . = 0x100
+ .text: @{
+ *(.text)
+ . = 0x200
+ @}
+ . = 0x500
+ .data: @{
+ *(.data)
+ . += 0x600
+ @}
+@}
+@end smallexample
-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}.
+The @samp{.text} section will be assigned a starting address of 0x100
+and a size of exactly 0x200 bytes, even if there is not enough data in
+the @samp{.text} input sections to fill this area. (If there is too
+much data, an error will be produced because this would be an attempt to
+move @code{.} backwards). The @samp{.data} section will start at 0x500
+and it will have an extra 0x600 bytes worth of space after the end of
+the values from the @samp{.data} input sections and before the end of
+the @samp{.data} output section itself.
-@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}.
+@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{Assignments}.
+@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{Assignments}.
+}
+@end iftex
+@c END TEXI2ROFF-KILL
-@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
+@node Evaluation
+@subsection Evaluation
+@cindex lazy evaluation
+@cindex expression evaluation order
+The linker evaluates expressions lazily. It only computes the value of
+an expression when absolutely necessary.
-@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}.
+The linker needs some information, such as the value of the start
+address of the first section, and the origins and 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 linker script.
-@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
+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.
-@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.
+The sizes of sections cannot be known until after allocation, so
+assignments dependent upon these are not performed until after
+allocation.
-@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.
+Some expressions, such as those depending upon the location counter
+@samp{.}, must be evaluated during section allocation.
-@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}.
+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
+@group
+SECTIONS
+ @{
+ .text 9+this_isnt_constant :
+ @{ *(.text) @}
+ @}
+@end group
+@end smallexample
+@noindent
+will cause the error message @samp{non constant expression for initial
+address}.
+
+@node Expression Section
+@subsection The Section of an Expression
+@cindex expression sections
+@cindex absolute expressions
+@cindex relative expressions
+@cindex absolute and relocatable symbols
+@cindex relocatable and absolute symbols
+@cindex symbols, relocatable and absolute
+When the linker evaluates an expression, the result is either absolute
+or relative to some section. A relative expression is expressed as a
+fixed offset from the base of a section.
+
+The position of the expression within the linker script determines
+whether it is absolute or relative. An expression which appears within
+an output section definition is relative to the base of the output
+section. An expression which appears elsewhere will be absolute.
+
+A symbol set to a relative expression will be relocatable if you request
+relocatable output using the @samp{-r} option. That means that a
+further link operation may change the value of the symbol. The symbol's
+section will be the section of the relative expression.
+
+A symbol set to an absolute expression will retain the same value
+through any further link operation. The symbol will be absolute, and
+will not have any particular associated section.
+
+You can use the builtin function @code{ABSOLUTE} to force an expression
+to be absolute when it would otherwise be relative. For example, to
+create an absolute symbol set to the address of the end of the output
+section @samp{.data}:
+@smallexample
+SECTIONS
+ @{
+ .data : @{ *(.data) _edata = ABSOLUTE(.); @}
+ @}
+@end smallexample
+@noindent
+If @samp{ABSOLUTE} were not used, @samp{_edata} would be relative to the
+@samp{.data} section.
-@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
+@node Builtin Functions
+@subsection Builtin Functions
+@cindex functions in expressions
+The linker script language includes a number of builtin functions for
+use in linker script expressions.
-@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.
+@table @code
+@item ABSOLUTE(@var{exp})
+@kindex ABSOLUTE(@var{exp})
+@cindex expression, absolute
+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. @xref{Expression Section}.
+
+@item ADDR(@var{section})
+@kindex ADDR(@var{section})
+@cindex section address in expression
+Return the absolute address (the VMA) 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
-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.
+@item ALIGN(@var{exp})
+@kindex ALIGN(@var{exp})
+@cindex round up location counter
+@cindex align location counter
+Return the 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
-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.
+@code{ALIGN} doesn't change the value of the location counter---it just
+does arithmetic on it. Here is an example which aligns the output
+@code{.data} section to the next @code{0x2000} byte boundary after the
+preceding section and sets 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{address} attribute of
+a section definition (@pxref{Output Section Address}). The second use
+of @code{ALIGN} is used to defines the value of a symbol.
+
+The builtin function @code{NEXT} is closely related to @code{ALIGN}.
+
+@item BLOCK(@var{exp})
+@kindex BLOCK(@var{exp})
+This is a synonym for @code{ALIGN}, for compatibility with older linker
+scripts. It is most often seen when setting the address of an output
+section.
+
+@item DEFINED(@var{symbol})
+@kindex DEFINED(@var{symbol})
+@cindex symbol defaults
+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 script fragment
+shows how to set a global symbol @samp{begin} to the first location in
+the @samp{.text} section---but if a symbol called @samp{begin} already
+existed, its value is preserved:
+
+@smallexample
+@group
+SECTIONS @{ @dots{}
+ .text : @{
+ begin = DEFINED(begin) ? begin : . ;
+ @dots{}
+ @}
+ @dots{}
+@}
+@end group
+@end smallexample
+
+@item LOADADDR(@var{section})
+@kindex LOADADDR(@var{section})
+@cindex section load address in expression
+Return the absolute LMA of the named @var{section}. This is normally
+the same as @code{ADDR}, but it may be different if the @code{AT}
+attribute is used in the output section definition (@pxref{Output
+Section LMA}).
+
+@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}.
+
+@item NEXT(@var{exp})
+@kindex NEXT(@var{exp})
+@cindex unallocated address, next
+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.
+
+@item SIZEOF(@var{section})
+@kindex SIZEOF(@var{section})
+@cindex section size
+Return the size in bytes of the named @var{section}, if that section has
+been allocated. If the section has not been allocated when this is
+evaluated, the linker will report an error. In the following example,
+@code{symbol_1} and @code{symbol_2} are assigned identical values:
+@smallexample
+@group
+SECTIONS@{ @dots{}
+ .output @{
+ .start = . ;
+ @dots{}
+ .end = . ;
+ @}
+ symbol_1 = .end - .start ;
+ symbol_2 = SIZEOF(.output);
+@dots{} @}
+@end group
+@end smallexample
+
+@item SIZEOF_HEADERS
+@itemx sizeof_headers
+@kindex SIZEOF_HEADERS
+@cindex header size
+Return the size in bytes of the output file's headers. This is
+information which appears at the start of the output file. You can use
+this number when setting the start address of the first section, if you
+choose, to facilitate paging.
+
+@cindex not enough room for program headers
+@cindex program headers, not enough room
+When producing an ELF output file, if the linker script uses the
+@code{SIZEOF_HEADERS} builtin function, the linker must compute the
+number of program headers before it has determined all the section
+addresses and sizes. If the linker later discovers that it needs
+additional program headers, it will report an error @samp{not enough
+room for program headers}. To avoid this error, you must avoid using
+the @code{SIZEOF_HEADERS} function, or you must rework your linker
+script to avoid forcing the linker to use additional program headers, or
+you must define the program headers yourself using the @code{PHDRS}
+command (@pxref{PHDRS}).
@end table
+@node Implicit Linker Scripts
+@section Implicit Linker Scripts
+@cindex implicit linker scripts
+If you specify a linker input file which the linker can not recognize as
+an object file or an archive file, it will try to read the file as a
+linker script. If the file can not be parsed as a linker script, the
+linker will report an error.
+
+An implicit linker script will not replace the default linker script.
+
+Typically an implicit linker script would contain only symbol
+assignments, or the @code{INPUT}, @code{GROUP}, or @code{VERSION}
+commands.
+
+Any input files read because of an implicit linker script will be read
+at the position in the command line where the implicit linker script was
+read. This can affect archive searching.
+
@ifset GENERIC
@node Machine Dependent
@chapter Machine Dependent Features
@@ -3179,6 +3822,7 @@ functionality are not listed.
@menu
* H8/300:: @code{ld} and the H8/300
* i960:: @code{ld} and the Intel 960 family
+* ARM:: @code{ld} and the ARM family
@end menu
@end ifset
@@ -3188,6 +3832,7 @@ functionality are not listed.
@ifclear GENERIC
@raisesections
@end ifclear
+
@node H8/300
@section @code{ld} and the H8/300
@@ -3213,6 +3858,7 @@ page of memory, and changes them to use the eight-bit address form.
@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
@@ -3235,6 +3881,7 @@ these chips.
@ifclear GENERIC
@raisesections
@end ifclear
+
@node i960
@section @code{ld} and the Intel 960 family
@@ -3287,6 +3934,39 @@ not itself call any subroutines).
@end ifclear
@end ifset
+@ifclear GENERIC
+@raisesections
+@end ifclear
+
+@node ARM
+@section @code{ld}'s support for interworking between ARM and Thumb code
+
+@cindex ARM interworking support
+@kindex --support-old-code
+For the ARM, @code{ld} will generate code stubs to allow functions calls
+betweem ARM and Thumb code. These stubs only work with code that has
+been compiled and assembled with the @samp{-mthumb-interwork} command
+line option. If it is necessary to link with old ARM object files or
+libraries, which have not been compiled with the -mthumb-interwork
+option then the @samp{--support-old-code} command line switch should be
+given to the linker. This will make it generate larger stub functions
+which will work with non-interworking aware ARM code. Note, however,
+the linker does not support generating stubs for function calls to
+non-interworking aware Thumb code.
+
+@cindex thumb entry point
+@cindex entry point, thumb
+@kindex --thumb-entry=@var{entry}
+The @samp{--thumb-entry} switch is a duplicate of the generic
+@samp{--entry} switch, in that it sets the program's starting address.
+But it also sets the bottom bit of the address, so that it can be
+branched to using a BX instruction, and the program will start
+executing in Thumb mode straight away.
+
+@ifclear GENERIC
+@lowersections
+@end ifclear
+
@ifclear SingleFormat
@node BFD
@chapter BFD
@@ -3393,8 +4073,8 @@ 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}.
+Otherwise, 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
@@ -3546,10 +4226,10 @@ things without first using the debugger to find the facts.
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.
+described in @ref{Scripts}. 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
diff --git a/contrib/binutils/ld/ldcref.c b/contrib/binutils/ld/ldcref.c
index 7022daf..e208106 100644
--- a/contrib/binutils/ld/ldcref.c
+++ b/contrib/binutils/ld/ldcref.c
@@ -1,5 +1,5 @@
/* ldcref.c -- output a cross reference table
- Copyright (C) 1996, 1997, 1998 Free Software Foundation, Inc.
+ Copyright (C) 1996, 97, 98, 99, 2000 Free Software Foundation, Inc.
Written by Ian Lance Taylor <ian@cygnus.com>
This file is part of GLD, the Gnu Linker.
@@ -151,7 +151,7 @@ add_cref (name, abfd, section, value)
const char *name;
bfd *abfd;
asection *section;
- bfd_vma value;
+ bfd_vma value ATTRIBUTE_UNUSED;
{
struct cref_hash_entry *h;
struct cref_ref *r;
@@ -159,13 +159,13 @@ add_cref (name, abfd, section, value)
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");
+ 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");
+ einfo (_("%X%P: cref_hash_lookup failed: %E\n"));
for (r = h->refs; r != NULL; r = r->next)
if (r->abfd == abfd)
@@ -234,20 +234,22 @@ output_cref (fp)
{
int len;
struct cref_hash_entry **csyms, **csym_fill, **csym, **csym_end;
+ const char *msg;
- fprintf (fp, "\nCross Reference Table\n\n");
- fprintf (fp, "Symbol");
- len = sizeof "Symbol" - 1;
+ fprintf (fp, _("\nCross Reference Table\n\n"));
+ msg = _("Symbol");
+ fprintf (fp, "%s", msg);
+ len = strlen (msg);
while (len < FILECOL)
{
putc (' ' , fp);
++len;
}
- fprintf (fp, "File\n");
+ fprintf (fp, _("File\n"));
if (! cref_initialized)
{
- fprintf (fp, "No symbols\n");
+ fprintf (fp, _("No symbols\n"));
return;
}
@@ -352,7 +354,7 @@ check_nocrossrefs ()
static boolean
check_nocrossref (h, ignore)
struct cref_hash_entry *h;
- PTR ignore;
+ PTR ignore ATTRIBUTE_UNUSED;
{
struct bfd_link_hash_entry *hl;
asection *defsec;
@@ -364,7 +366,7 @@ check_nocrossref (h, ignore)
false, true);
if (hl == NULL)
{
- einfo ("%P: symbol `%T' missing from main hash table\n",
+ einfo (_("%P: symbol `%T' missing from main hash table\n"),
h->root.string);
return true;
}
@@ -436,11 +438,11 @@ check_refs (h, hl, ncrs)
symsize = bfd_get_symtab_upper_bound (ref->abfd);
if (symsize < 0)
- einfo ("%B%F: could not read symbols; %E\n", ref->abfd);
+ 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);
+ einfo (_("%B%F: could not read symbols: %E\n"), ref->abfd);
if (li != NULL)
{
li->asymbols = asymbols;
@@ -512,14 +514,14 @@ check_reloc_refs (abfd, sec, iarg)
relsize = bfd_get_reloc_upper_bound (abfd, sec);
if (relsize < 0)
- einfo ("%B%F: could not read relocs: %E\n", abfd);
+ 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);
+ einfo (_("%B%F: could not read relocs: %E\n"), abfd);
p = relpp;
pend = p + relcount;
@@ -537,7 +539,7 @@ check_reloc_refs (abfd, sec, iarg)
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",
+ 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);
}
diff --git a/contrib/binutils/ld/ldctor.c b/contrib/binutils/ld/ldctor.c
index 6e40938..0a434b8 100644
--- a/contrib/binutils/ld/ldctor.c
+++ b/contrib/binutils/ld/ldctor.c
@@ -1,5 +1,6 @@
/* ldctor.c -- constructor support routines
- Copyright (C) 1991, 92, 93, 94, 1995 Free Software Foundation, Inc.
+ Copyright (C) 1991, 92, 93, 94, 95, 96, 97, 1998
+ Free Software Foundation, Inc.
By Steve Chamberlain <sac@cygnus.com>
This file is part of GLD, the Gnu Linker.
@@ -15,13 +16,16 @@ 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. */
+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 <ctype.h>
+
#include "ld.h"
#include "ldexp.h"
#include "ldlang.h"
@@ -30,10 +34,18 @@ the Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307
#include "ldmain.h"
#include "ldctor.h"
+static int ctor_prio PARAMS ((const char *));
+static int ctor_cmp PARAMS ((const PTR, const PTR));
+
/* 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;
+/* Whether the constructors should be sorted. Note that this is
+ global for the entire link; we assume that there is only a single
+ CONSTRUCTORS command in the linker script. */
+boolean constructors_sorted;
+
/* The sets we have seen. */
struct set_info *sets;
@@ -74,7 +86,7 @@ ldctor_add_set_entry (h, reloc, name, section, value)
{
if (p->reloc != reloc)
{
- einfo ("%P%X: Different relocs used in set %s\n", h->root.string);
+ einfo (_("%P%X: Different relocs used in set %s\n"), h->root.string);
return;
}
@@ -91,7 +103,7 @@ ldctor_add_set_entry (h, reloc, name, section, value)
&& 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",
+ einfo (_("%P%X: Different object file formats composing set %s\n"),
h->root.string);
return;
}
@@ -110,6 +122,80 @@ ldctor_add_set_entry (h, reloc, name, section, value)
++p->count;
}
+/* Get the priority of a g++ global constructor or destructor from the
+ symbol name. */
+
+static int
+ctor_prio (name)
+ const char *name;
+{
+ /* The name will look something like _GLOBAL_$I$65535$test02__Fv.
+ There might be extra leading underscores, and the $ characters
+ might be something else. The I might be a D. */
+
+ while (*name == '_')
+ ++name;
+
+ if (strncmp (name, "GLOBAL_", sizeof "GLOBAL_" - 1) != 0)
+ return -1;
+
+ name += sizeof "GLOBAL_" - 1;
+
+ if (name[0] != name[2])
+ return -1;
+ if (name[1] != 'I' && name[1] != 'D')
+ return -1;
+ if (! isdigit ((unsigned char) name[3]))
+ return -1;
+
+ return atoi (name + 3);
+}
+
+/* This function is used to sort constructor elements by priority. It
+ is called via qsort. */
+
+static int
+ctor_cmp (p1, p2)
+ const PTR p1;
+ const PTR p2;
+{
+ const struct set_element **pe1 = (const struct set_element **) p1;
+ const struct set_element **pe2 = (const struct set_element **) p2;
+ const char *n1;
+ const char *n2;
+ int prio1;
+ int prio2;
+
+ n1 = (*pe1)->name;
+ if (n1 == NULL)
+ n1 = "";
+ n2 = (*pe2)->name;
+ if (n2 == NULL)
+ n2 = "";
+
+ /* We need to sort in reverse order by priority. When two
+ constructors have the same priority, we should maintain their
+ current relative position. */
+
+ prio1 = ctor_prio (n1);
+ prio2 = ctor_prio (n2);
+
+ /* We sort in reverse order because that is what g++ expects. */
+ if (prio1 < prio2)
+ return 1;
+ else if (prio1 > prio2)
+ return -1;
+
+ /* Force a stable sort. */
+
+ if (pe1 < pe2)
+ return -1;
+ else if (pe1 > pe2)
+ return 1;
+ else
+ return 0;
+}
+
/* 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
@@ -129,6 +215,42 @@ ldctor_build_sets ()
return;
called = true;
+ if (constructors_sorted)
+ {
+ for (p = sets; p != NULL; p = p->next)
+ {
+ int c, i;
+ struct set_element *e;
+ struct set_element **array;
+
+ if (p->elements == NULL)
+ continue;
+
+ c = 0;
+ for (e = p->elements; e != NULL; e = e->next)
+ ++c;
+
+ array = (struct set_element **) xmalloc (c * sizeof *array);
+
+ i = 0;
+ for (e = p->elements; e != NULL; e = e->next)
+ {
+ array[i] = e;
+ ++i;
+ }
+
+ qsort (array, c, sizeof *array, ctor_cmp);
+
+ e = array[0];
+ p->elements = e;
+ for (i = 0; i < c - 1; i++)
+ array[i]->next = array[i + 1];
+ array[i]->next = NULL;
+
+ free (array);
+ }
+ }
+
old = stat_ptr;
stat_ptr = &constructor_list;
@@ -163,7 +285,7 @@ ldctor_build_sets ()
{
if (link_info.relocateable)
{
- einfo ("%P%X: %s does not support reloc %s for set %s\n",
+ 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);
@@ -172,11 +294,12 @@ ldctor_build_sets ()
/* 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 (p->elements->section->owner != NULL)
+ 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",
+ 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);
@@ -197,7 +320,7 @@ ldctor_build_sets ()
size = QUAD;
break;
default:
- einfo ("%P%X: Unsupported size %d for set %s\n",
+ einfo (_("%P%X: Unsupported size %d for set %s\n"),
bfd_get_reloc_size (howto), p->h->root.string);
size = LONG;
break;
@@ -218,7 +341,7 @@ ldctor_build_sets ()
if (! header_printed)
{
- minfo ("\nSet Symbol\n\n");
+ minfo (_("\nSet Symbol\n\n"));
header_printed = true;
}
@@ -242,6 +365,10 @@ ldctor_build_sets ()
minfo ("%G\n", e->section->owner, e->section, e->value);
}
+ /* Need SEC_KEEP for --gc-sections */
+ if (! bfd_is_abs_section (e->section))
+ e->section->flags |= SEC_KEEP;
+
if (link_info.relocateable)
lang_add_reloc (p->reloc, howto, e->section, e->name,
exp_intop (e->value));
diff --git a/contrib/binutils/ld/ldctor.h b/contrib/binutils/ld/ldctor.h
index d87f0db..d873f77 100644
--- a/contrib/binutils/ld/ldctor.h
+++ b/contrib/binutils/ld/ldctor.h
@@ -1,5 +1,5 @@
/* ldctor.h - linker constructor support
- Copyright 1991, 1992, 1993 Free Software Foundation, Inc.
+ Copyright 1991, 92, 93, 94, 95, 1998 Free Software Foundation, Inc.
This file is part of GLD, the Gnu Linker.
@@ -14,8 +14,9 @@ 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. */
+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
@@ -23,6 +24,11 @@ the Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307
/* List of statements needed to handle constructors */
extern lang_statement_list_type constructor_list;
+/* Whether the constructors should be sorted. Note that this is
+ global for the entire link; we assume that there is only a single
+ CONSTRUCTORS command in the linker script. */
+extern boolean constructors_sorted;
+
/* We keep a list of these structures for each set we build. */
struct set_info
diff --git a/contrib/binutils/ld/ldemul.c b/contrib/binutils/ld/ldemul.c
index 41cc544..08a4e47 100644
--- a/contrib/binutils/ld/ldemul.c
+++ b/contrib/binutils/ld/ldemul.c
@@ -1,5 +1,6 @@
/* ldemul.c -- clearing house for ld emulation states
- Copyright (C) 1991, 92, 93, 94, 95, 96, 1997 Free Software Foundation, Inc.
+ Copyright (C) 1991, 92, 93, 94, 95, 96, 97, 98, 1999
+ Free Software Foundation, Inc.
This file is part of GLD, the Gnu Linker.
@@ -156,6 +157,17 @@ ldemul_unrecognized_file (entry)
return false;
}
+/* Let the emulation code handle a recognized file. */
+
+boolean
+ldemul_recognized_file (entry)
+ lang_input_statement_type *entry;
+{
+ if (ld_emulation->recognized_file)
+ return (*ld_emulation->recognized_file) (entry);
+ return false;
+}
+
char *
ldemul_choose_target()
{
@@ -207,17 +219,17 @@ set_output_arch_default()
/*ARGSUSED*/
void
syslib_default(ignore)
- char *ignore;
+ char *ignore ATTRIBUTE_UNUSED;
{
- info_msg ("%S SYSLIB ignored\n");
+ info_msg (_("%S SYSLIB ignored\n"));
}
/*ARGSUSED*/
void
hll_default(ignore)
- char *ignore;
+ char *ignore ATTRIBUTE_UNUSED;
{
- info_msg ("%S HLL ignored\n");
+ info_msg (_("%S HLL ignored\n"));
}
ld_emulation_xfer_type *ld_emulations[] = { EMULATION_LIST };
@@ -238,8 +250,8 @@ ldemul_choose_mode(target)
return;
}
}
- einfo ("%P: unrecognised emulation mode: %s\n", target);
- einfo ("Supported emulations: ");
+ einfo (_("%P: unrecognised emulation mode: %s\n"), target);
+ einfo (_("Supported emulations: "));
ldemul_list_emulations (stderr);
einfo ("%F\n");
}
@@ -260,3 +272,39 @@ ldemul_list_emulations (f)
fprintf (f, "%s", (*eptr)->emulation_name);
}
}
+
+void
+ldemul_list_emulation_options (f)
+ FILE * f;
+{
+ ld_emulation_xfer_type ** eptr;
+ int options_found = 0;
+
+ for (eptr = ld_emulations; * eptr; eptr ++)
+ {
+ ld_emulation_xfer_type * emul = * eptr;
+
+ if (emul->list_options)
+ {
+ fprintf (f, "%s: \n", emul->emulation_name);
+
+ emul->list_options (f);
+
+ options_found = 1;
+ }
+ }
+
+ if (! options_found)
+ fprintf (f, _(" no emulation specific options.\n"));
+}
+
+int
+ldemul_find_potential_libraries (name, entry)
+ char * name;
+ lang_input_statement_type * entry;
+{
+ if (ld_emulation->find_potential_libraries)
+ return ld_emulation->find_potential_libraries (name, entry);
+
+ return 0;
+}
diff --git a/contrib/binutils/ld/ldemul.h b/contrib/binutils/ld/ldemul.h
index f01f357..b2d9103 100644
--- a/contrib/binutils/ld/ldemul.h
+++ b/contrib/binutils/ld/ldemul.h
@@ -1,5 +1,5 @@
/* ld-emul.h - Linker emulation header file
- Copyright 1991, 92, 93, 94, 95, 96, 1997 Free Software Foundation, Inc.
+ Copyright 1991, 92, 93, 94, 95, 96, 97, 1998, 2000 Free Software Foundation, Inc.
This file is part of GLD, the Gnu Linker.
@@ -32,6 +32,7 @@ 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 void ldemul_list_emulation_options PARAMS ((FILE *));
extern char *ldemul_get_script PARAMS ((int *isfile));
extern void ldemul_finish PARAMS ((void));
extern void ldemul_set_symbols PARAMS ((void));
@@ -41,6 +42,8 @@ extern boolean ldemul_place_orphan
extern int ldemul_parse_args PARAMS ((int, char **));
extern boolean ldemul_unrecognized_file
PARAMS ((struct lang_input_statement_struct *));
+extern boolean ldemul_recognized_file
+ PARAMS ((struct lang_input_statement_struct *));
extern boolean ldemul_open_dynamic_archive
PARAMS ((const char *, struct search_dirs *,
struct lang_input_statement_struct *));
@@ -52,6 +55,8 @@ 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*));
+extern int ldemul_find_potential_libraries
+ PARAMS ((char *, struct lang_input_statement_struct *));
typedef struct ld_emulation_xfer_struct
{
@@ -124,6 +129,21 @@ typedef struct ld_emulation_xfer_struct
boolean (*unrecognized_file)
PARAMS ((struct lang_input_statement_struct *));
+ /* Run to list the command line options which parse_args handles. */
+ void (* list_options) PARAMS ((FILE *));
+
+ /* Run to specially handle files which *are* recognized as object
+ files or archives. Return true if the file was handled. */
+ boolean (*recognized_file)
+ PARAMS ((struct lang_input_statement_struct *));
+
+ /* Called when looking for libraries in a directory specified
+ via a linker command line option or linker script option.
+ Files that match the pattern "lib*.a" have already been scanned.
+ (For VMS files matching ":lib*.a" have also been scanned). */
+ int (* find_potential_libraries)
+ PARAMS ((char *, struct lang_input_statement_struct *));
+
} ld_emulation_xfer_type;
typedef enum
diff --git a/contrib/binutils/ld/ldexp.c b/contrib/binutils/ld/ldexp.c
index 3471621..0c38314 100644
--- a/contrib/binutils/ld/ldexp.c
+++ b/contrib/binutils/ld/ldexp.c
@@ -1,6 +1,7 @@
/* 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).
+ Copyright (C) 1991, 92, 93, 94, 95, 96, 97, 98, 1999
+ Free Software Foundation, Inc.
+ Written by Steve Chamberlain of Cygnus Support (sac@cygnus.com).
This file is part of GLD, the Gnu Linker.
@@ -140,7 +141,7 @@ new_abs (value)
bfd_vma value;
{
etree_value_type new;
- new.valid = true;
+ new.valid_p = true;
new.section = abs_output_section;
new.value = value;
return new;
@@ -153,9 +154,9 @@ check (os, name, op)
const char *op;
{
if (os == NULL)
- einfo ("%F%P: %s uses undefined section %s\n", op, name);
+ 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);
+ einfo (_("%F%P: %s forward reference of section %s\n"), op, name);
}
etree_type *
@@ -191,7 +192,7 @@ new_rel (value, section)
lang_output_section_statement_type *section;
{
etree_value_type new;
- new.valid = true;
+ new.valid_p = true;
new.value = value;
new.section = section;
return new;
@@ -203,7 +204,7 @@ new_rel_from_section (value, section)
lang_output_section_statement_type *section;
{
etree_value_type new;
- new.valid = true;
+ new.valid_p = true;
new.value = value;
new.section = section;
@@ -224,14 +225,14 @@ fold_binary (tree, current_section, allocation_done, dot, dotp)
result = exp_fold_tree (tree->binary.lhs, current_section,
allocation_done, dot, dotp);
- if (result.valid)
+ if (result.valid_p)
{
etree_value_type other;
other = exp_fold_tree (tree->binary.rhs,
current_section,
allocation_done, dot,dotp) ;
- if (other.valid)
+ if (other.valid_p)
{
/* If the values are from different sections, or this is an
absolute expression, make both the source arguments
@@ -267,14 +268,14 @@ fold_binary (tree, current_section, allocation_done, dot, dotp)
{
case '%':
if (other.value == 0)
- einfo ("%F%S %% by zero\n");
+ 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");
+ einfo (_("%F%S / by zero\n"));
result.value = ((bfd_signed_vma) result.value
/ (bfd_signed_vma) other.value);
break;
@@ -297,12 +298,12 @@ fold_binary (tree, current_section, allocation_done, dot, dotp)
BOP(ANDAND,&&);
BOP(OROR,||);
- case MAX:
+ case MAX_K:
if (result.value < other.value)
result = other;
break;
- case MIN:
+ case MIN_K:
if (result.value > other.value)
result = other;
break;
@@ -313,7 +314,7 @@ fold_binary (tree, current_section, allocation_done, dot, dotp)
}
else
{
- result.valid = false;
+ result.valid_p = false;
}
}
@@ -324,7 +325,7 @@ etree_value_type
invalid ()
{
etree_value_type new;
- new.valid = false;
+ new.valid_p = false;
return new;
}
@@ -347,12 +348,12 @@ fold_name (tree, current_section, allocation_done, dot)
}
else
{
- result.valid = false;
+ result.valid_p = false;
}
break;
case DEFINED:
if (allocation_done == lang_first_phase_enum)
- result.valid = false;
+ result.valid_p = false;
else
{
struct bfd_link_hash_entry *h;
@@ -365,11 +366,11 @@ fold_name (tree, current_section, allocation_done, dot)
|| h->type == bfd_link_hash_defweak
|| h->type == bfd_link_hash_common));
result.section = 0;
- result.valid = true;
+ result.valid_p = true;
}
break;
case NAME:
- result.valid = false;
+ result.valid_p = false;
if (tree->name.name[0] == '.' && tree->name.name[1] == 0)
{
if (allocation_done != lang_first_phase_enum)
@@ -397,7 +398,7 @@ fold_name (tree, current_section, allocation_done, dot)
output_section = h->u.def.section->output_section;
if (output_section == NULL)
- einfo ("%X%S: unresolvable symbol `%s' referenced in expression\n",
+ einfo (_("%X%S: unresolvable symbol `%s' referenced in expression\n"),
tree->name.name);
else
{
@@ -416,7 +417,7 @@ fold_name (tree, current_section, allocation_done, dot)
}
}
else if (allocation_done == lang_final_phase_enum)
- einfo ("%F%S: undefined symbol `%s' referenced in expression\n",
+ einfo (_("%F%S: undefined symbol `%s' referenced in expression\n"),
tree->name.name);
}
break;
@@ -455,11 +456,12 @@ fold_name (tree, current_section, allocation_done, dot)
case SIZEOF:
if (allocation_done != lang_first_phase_enum)
{
+ int opb = bfd_octets_per_byte (output_bfd);
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);
+ result = new_abs (os->bfd_section->_raw_size / opb);
}
else
result = invalid ();
@@ -484,7 +486,7 @@ exp_fold_tree (tree, current_section, allocation_done, dot, dotp)
if (tree == NULL)
{
- result.valid = false;
+ result.valid_p = false;
return result;
}
@@ -496,7 +498,7 @@ exp_fold_tree (tree, current_section, allocation_done, dot, dotp)
case etree_rel:
if (allocation_done != lang_final_phase_enum)
- result.valid = false;
+ result.valid_p = false;
else
result = new_rel ((tree->rel.value
+ tree->rel.section->output_section->vma
@@ -504,11 +506,23 @@ exp_fold_tree (tree, current_section, allocation_done, dot, dotp)
current_section);
break;
+ case etree_assert:
+ result = exp_fold_tree (tree->assert_s.child,
+ current_section,
+ allocation_done, dot, dotp);
+ if (result.valid_p)
+ {
+ if (! result.value)
+ einfo ("%F%P: %s\n", tree->assert_s.message);
+ return result;
+ }
+ break;
+
case etree_unary:
result = exp_fold_tree (tree->unary.child,
current_section,
allocation_done, dot, dotp);
- if (result.valid)
+ if (result.valid_p)
{
switch (tree->type.node_code)
{
@@ -517,17 +531,17 @@ exp_fold_tree (tree, current_section, allocation_done, dot, dotp)
result = new_rel_from_section (ALIGN_N (dot, result.value),
current_section);
else
- result.valid = false;
+ result.valid_p = false;
break;
case ABSOLUTE:
- if (allocation_done != lang_first_phase_enum && result.valid)
+ if (allocation_done != lang_first_phase_enum && result.valid_p)
{
result.value += result.section->bfd_section->vma;
result.section = abs_output_section;
}
else
- result.valid = false;
+ result.valid_p = false;
break;
case '~':
@@ -553,7 +567,7 @@ exp_fold_tree (tree, current_section, allocation_done, dot, dotp)
result.value = ALIGN_N (dot, result.value);
}
else
- result.valid = false;
+ result.valid_p = false;
break;
default:
@@ -566,7 +580,7 @@ exp_fold_tree (tree, current_section, allocation_done, dot, dotp)
case etree_trinary:
result = exp_fold_tree (tree->trinary.cond, current_section,
allocation_done, dot, dotp);
- if (result.valid)
+ if (result.valid_p)
result = exp_fold_tree ((result.value
? tree->trinary.lhs
: tree->trinary.rhs),
@@ -585,7 +599,7 @@ exp_fold_tree (tree, current_section, allocation_done, dot, dotp)
{
/* 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");
+ 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))
@@ -594,12 +608,12 @@ exp_fold_tree (tree, current_section, allocation_done, dot, dotp)
current_section,
lang_allocating_phase_enum, dot,
dotp);
- if (! result.valid)
- einfo ("%F%S invalid assignment to location counter\n");
+ if (! result.valid_p)
+ 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");
+ einfo (_("%F%S assignment to location counter invalid outside of SECTION\n"));
else
{
bfd_vma nextdot;
@@ -609,7 +623,7 @@ exp_fold_tree (tree, current_section, allocation_done, dot, dotp)
if (nextdot < dot
&& current_section != abs_output_section)
{
- einfo ("%F%S cannot move location counter backwards (from %V to %V)\n",
+ einfo (_("%F%S cannot move location counter backwards (from %V to %V)\n"),
dot, nextdot);
}
else
@@ -623,7 +637,7 @@ exp_fold_tree (tree, current_section, allocation_done, dot, dotp)
result = exp_fold_tree (tree->assign.src,
current_section, allocation_done,
dot, dotp);
- if (result.valid)
+ if (result.valid_p)
{
boolean create;
struct bfd_link_hash_entry *h;
@@ -637,7 +651,7 @@ exp_fold_tree (tree, current_section, allocation_done, dot, dotp)
if (h == (struct bfd_link_hash_entry *) NULL)
{
if (tree->type.node_class == etree_assign)
- einfo ("%P%F:%s: hash creation failed\n",
+ einfo (_("%P%F:%s: hash creation failed\n"),
tree->assign.dst);
}
else if (tree->type.node_class == etree_provide
@@ -697,7 +711,7 @@ exp_binop (code, lhs, rhs)
r = exp_fold_tree_no_dot(&value,
abs_output_section,
lang_first_phase_enum );
- if (r.valid)
+ if (r.valid_p)
{
return exp_intop(r.value);
}
@@ -722,7 +736,7 @@ exp_trinop (code, cond, lhs, 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) {
+ if (r.valid_p) {
return exp_intop(r.value);
}
new = (etree_type *) stat_alloc (sizeof (new->trinary));
@@ -744,7 +758,7 @@ exp_unop (code, 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) {
+ if (r.valid_p) {
return exp_intop(r.value);
}
new = (etree_type *) stat_alloc (sizeof (new->unary));
@@ -768,7 +782,7 @@ exp_nameop (code, name)
r = exp_fold_tree_no_dot(&value,
(lang_output_section_statement_type *)NULL,
lang_first_phase_enum);
- if (r.valid) {
+ if (r.valid_p) {
return exp_intop(r.value);
}
new = (etree_type *) stat_alloc (sizeof (new->name));
@@ -822,6 +836,23 @@ exp_provide (dst, src)
return n;
}
+/* Handle ASSERT. */
+
+etree_type *
+exp_assert (exp, message)
+ etree_type *exp;
+ const char *message;
+{
+ etree_type *n;
+
+ n = (etree_type *) stat_alloc (sizeof (n->assert_s));
+ n->assert_s.type.node_code = '!';
+ n->assert_s.type.node_class = etree_assert;
+ n->assert_s.child = exp;
+ n->assert_s.message = message;
+ return n;
+}
+
void
exp_print_tree (tree)
etree_type *tree;
@@ -872,13 +903,19 @@ exp_print_tree (tree)
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_assert:
+ fprintf (config.map_file, "ASSERT (");
+ exp_print_tree (tree->assert_s.child);
+ fprintf (config.map_file, ", %s)", tree->assert_s.message);
+ break;
+
case etree_undef:
fprintf(config.map_file,"????????");
break;
@@ -910,8 +947,8 @@ exp_get_vma (tree, def, name, allocation_done)
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);
+ if (! r.valid_p && name != NULL)
+ einfo (_("%F%S nonconstant expression for %s\n"), name);
return r.value;
}
else
@@ -932,19 +969,19 @@ exp_get_value_int (tree,def,name, allocation_done)
bfd_vma
exp_get_abs_int (tree, def, name, allocation_done)
etree_type *tree;
- int def;
+ int def ATTRIBUTE_UNUSED;
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)
+ if (res.valid_p)
{
res.value += res.section->bfd_section->vma;
}
else {
- einfo ("%F%S non constant expression for %s\n",name);
+ einfo (_("%F%S non constant expression for %s\n"),name);
}
return res.value;
}
diff --git a/contrib/binutils/ld/ldexp.h b/contrib/binutils/ld/ldexp.h
index 8726a01..b8e8ddf 100644
--- a/contrib/binutils/ld/ldexp.h
+++ b/contrib/binutils/ld/ldexp.h
@@ -1,5 +1,5 @@
/* ldexp.h -
- Copyright 1991, 1992, 1993 Free Software Foundation, Inc.
+ Copyright 1991, 92, 93, 94, 95, 1998 Free Software Foundation, Inc.
This file is part of GLD, the Gnu Linker.
@@ -14,8 +14,9 @@
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. */
+ 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
@@ -25,7 +26,7 @@ typedef struct
{
bfd_vma value;
struct lang_output_section_statement_struct *section;
- boolean valid;
+ boolean valid_p;
} etree_value_type;
@@ -42,6 +43,7 @@ typedef struct
etree_undef,
etree_unspec,
etree_value,
+ etree_assert,
etree_rel } node_class;
} node_type;
@@ -84,7 +86,11 @@ typedef union etree_union
asection *section;
bfd_vma value;
} rel;
-
+ struct {
+ node_type type;
+ union etree_union *child;
+ const char *message;
+ } assert_s;
} etree_type;
@@ -101,6 +107,7 @@ 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 *));
+etree_type *exp_assert PARAMS ((etree_type *, const char *));
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));
diff --git a/contrib/binutils/ld/ldfile.c b/contrib/binutils/ld/ldfile.c
index 3597c4e..9613c07 100644
--- a/contrib/binutils/ld/ldfile.c
+++ b/contrib/binutils/ld/ldfile.c
@@ -1,10 +1,12 @@
-/* Copyright (C) 1991, 92, 93, 94, 95, 1998 Free Software Foundation, Inc.
+/* Linker file opening and searching.
+ Copyright (C) 1991, 92, 93, 94, 95, 98, 99, 2000
+ 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)
+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,
@@ -74,9 +76,6 @@ typedef struct search_arch
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
@@ -104,23 +103,56 @@ ldfile_try_open_bfd (attempt, 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)
+ info_msg (_("attempt to open %s failed\n"), attempt);
+ else
+ info_msg (_("attempt to open %s succeeded\n"), attempt);
+ }
- if (entry->the_bfd != NULL)
- return true;
- else
+ if (entry->the_bfd == NULL)
{
if (bfd_get_error () == bfd_error_invalid_target)
- einfo ("%F%P: invalid BFD target `%s'\n", entry->target);
+ einfo (_("%F%P: invalid BFD target `%s'\n"), entry->target);
return false;
}
+
+ /* If we are searching for this file, see if the architecture is
+ compatible with the output file. If it isn't, keep searching.
+ If we can't open the file as an object file, stop the search
+ here. */
+
+ if (entry->search_dirs_flag)
+ {
+ bfd *check;
+
+ if (bfd_check_format (entry->the_bfd, bfd_archive))
+ check = bfd_openr_next_archived_file (entry->the_bfd, NULL);
+ else
+ check = entry->the_bfd;
+
+ if (check != NULL)
+ {
+ if (! bfd_check_format (check, bfd_object))
+ return true;
+ if (bfd_arch_get_compatible (check, output_bfd) == NULL)
+ {
+ einfo (_("%P: skipping incompatible %s when searching for %s"),
+ attempt, entry->local_sym_name);
+ bfd_close (entry->the_bfd);
+ entry->the_bfd = NULL;
+ return false;
+ }
+ }
+ }
+
+ return true;
}
/* 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
+boolean
ldfile_open_file_search (arch, entry, lib, suffix)
const char *arch;
lang_input_statement_type *entry;
@@ -196,6 +228,11 @@ ldfile_open_file (entry)
{
if (ldfile_try_open_bfd (entry->filename, entry))
return;
+ if (strcmp (entry->filename, entry->local_sym_name) != 0)
+ einfo (_("%F%P: cannot open %s for %s: %E\n"),
+ entry->filename, entry->local_sym_name);
+ else
+ einfo(_("%F%P: cannot open %s: %E\n"), entry->local_sym_name);
}
else
{
@@ -212,10 +249,11 @@ ldfile_open_file (entry)
if (ldfile_open_file_search (arch->name, entry, ":lib", ".a"))
return;
#endif
+ if (ldemul_find_potential_libraries (arch->name, entry))
+ return;
}
+ einfo (_("%F%P: cannot find %s\n"), entry->local_sym_name);
}
-
- 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. */
@@ -232,10 +270,9 @@ try_open (name, exten)
if (trace_file_tries)
{
if (result == NULL)
- info_msg ("cannot find script file ");
+ info_msg (_("cannot find script file %s\n"), name);
else
- info_msg ("opened script file ");
- info_msg ("%s\n",name);
+ info_msg (_("opened script file %s\n"), name);
}
if (result != NULL)
@@ -248,10 +285,9 @@ try_open (name, exten)
if (trace_file_tries)
{
if (result == NULL)
- info_msg ("cannot find script file ");
+ info_msg (_("cannot find script file %s\n"), buff);
else
- info_msg ("opened script file ");
- info_msg ("%s\n", buff);
+ info_msg (_("opened script file %s\n"), buff);
}
}
@@ -294,7 +330,7 @@ ldfile_open_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);
+ einfo(_("%P%F: cannot open linker script file %s: %E\n"),name);
}
lex_push_file(ldlex_input_stack, name);
@@ -335,7 +371,7 @@ char *name;
}
if ( tp->cmd_switch == NULL ){
- einfo("%P%F: unknown architecture: %s\n",name);
+ einfo(_("%P%F: unknown architecture: %s\n"),name);
}
return tp->arch;
}
@@ -352,7 +388,7 @@ char *name;
if (*name != '\0') {
if (ldfile_output_machine_name[0] != '\0') {
- einfo("%P%F: target architecture respecified\n");
+ einfo(_("%P%F: target architecture respecified\n"));
return;
}
ldfile_output_machine_name = name;
@@ -405,6 +441,6 @@ ldfile_set_output_arch (string)
ldfile_output_machine_name = arch->printable_name;
}
else {
- einfo("%P%F: cannot represent machine `%s'\n", string);
+ einfo(_("%P%F: cannot represent machine `%s'\n"), string);
}
}
diff --git a/contrib/binutils/ld/ldfile.h b/contrib/binutils/ld/ldfile.h
index f33c9ce..9c9a4d6 100644
--- a/contrib/binutils/ld/ldfile.h
+++ b/contrib/binutils/ld/ldfile.h
@@ -51,3 +51,6 @@ extern boolean ldfile_try_open_bfd
extern FILE *ldfile_find_command_file
PARAMS ((const char *name, const char *extend));
extern void ldfile_set_output_arch PARAMS ((CONST char *));
+extern boolean ldfile_open_file_search
+ PARAMS ((const char *arch, struct lang_input_statement_struct *,
+ const char *lib, const char *suffix));
diff --git a/contrib/binutils/ld/ldgram.y b/contrib/binutils/ld/ldgram.y
index 4023770..806ea1c 100644
--- a/contrib/binutils/ld/ldgram.y
+++ b/contrib/binutils/ld/ldgram.y
@@ -1,5 +1,6 @@
/* 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.
+ Copyright (C) 1991, 92, 93, 94, 95, 96, 97, 98, 99, 2000
+ Free Software Foundation, Inc.
Written by Steve Chamberlain of Cygnus Support (steve@cygnus.com).
This file is part of GNU ld.
@@ -37,6 +38,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#include "ldmisc.h"
#include "ldmain.h"
#include "mri.h"
+#include "ldctor.h"
#include "ldlex.h"
#ifndef YYDEBUG
@@ -47,15 +49,15 @@ static enum section_type sectype;
lang_memory_region_type *region;
-
-char *current_file;
+struct wildcard_spec 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;
-
+boolean ldgram_had_keep = false;
+char *ldgram_vers_current_lang = NULL;
#define ERROR_NAME_MAX 20
static char *error_names[ERROR_NAME_MAX];
@@ -66,6 +68,9 @@ static int error_index;
%union {
bfd_vma integer;
char *name;
+ const char *cname;
+ struct wildcard_spec wildcard;
+ struct name_list *name_list;
int token;
union etree_union *etree;
struct phdr_info
@@ -85,7 +90,11 @@ static int error_index;
%type <etree> exp opt_exp_with_type mustbe_exp opt_at phdr_type phdr_val
%type <etree> opt_exp_without_type
%type <integer> fill_opt
+%type <name_list> exclude_name_list
%type <name> memspec_opt casesymlist
+%type <name> memspec_at_opt
+%type <cname> wildcard_name
+%type <wildcard> wildcard_spec
%token <integer> INT
%token <name> NAME LNAME
%type <integer> length
@@ -112,7 +121,7 @@ static int error_index;
%token END
%left <token> '('
%token <token> ALIGN_K BLOCK BIND QUAD SQUAD LONG SHORT BYTE
-%token SECTIONS PHDRS
+%token SECTIONS PHDRS SORT
%token '{' '}'
%token SIZEOF_HEADERS OUTPUT_FORMAT FORCE_COMMON_ALLOCATION OUTPUT_ARCH
%token SIZEOF_HEADERS
@@ -121,18 +130,20 @@ static int error_index;
%token NOLOAD DSECT COPY INFO OVERLAY
%token NAME LNAME DEFINED TARGET_K SEARCH_DIR MAP ENTRY
%token <integer> NEXT
-%token SIZEOF ADDR LOADADDR MAX MIN
+%token SIZEOF ADDR LOADADDR MAX_K MIN_K
%token STARTUP HLL SYSLIB FLOAT NOFLOAT NOCROSSREFS
%token ORIGIN FILL
%token LENGTH CREATE_OBJECT_SYMBOLS INPUT GROUP OUTPUT CONSTRUCTORS
%token ALIGNMOD AT PROVIDE
-%type <token> assign_op atype
+%type <token> assign_op atype attributes_opt
%type <name> filename
-%token CHIP LIST SECT ABSOLUTE LOAD NEWLINE ENDWORD ORDER NAMEWORD
+%token CHIP LIST SECT ABSOLUTE LOAD NEWLINE ENDWORD ORDER NAMEWORD ASSERT_K
%token FORMAT PUBLIC DEFSYMEND BASE ALIAS TRUNCATE REL
%token INPUT_SCRIPT INPUT_MRI_SCRIPT INPUT_DEFSYM CASE EXTERN START
%token <name> VERS_TAG VERS_IDENTIFIER
%token GLOBAL LOCAL VERSIONK INPUT_VERSION_SCRIPT
+%token KEEP
+%token EXCLUDE_FILE
%type <versyms> vers_defns
%type <versnode> vers_tag
%type <deflist> verdep
@@ -162,7 +173,7 @@ defsym_expr:
mri_script_file:
{
ldlex_mri_script ();
- PUSH_ERROR ("MRI style script");
+ PUSH_ERROR (_("MRI style script"));
}
mri_script_lines
{
@@ -181,7 +192,7 @@ mri_script_command:
CHIP exp
| CHIP exp ',' exp
| NAME {
- einfo("%P%F: unrecognised keyword in MRI style script '%s'\n",$1);
+ einfo(_("%P%F: unrecognised keyword in MRI style script '%s'\n"),$1);
}
| LIST {
config.map_filename = "-";
@@ -259,6 +270,8 @@ casesymlist:
extern_name_list:
NAME
{ ldlang_add_undef ($1); }
+ | extern_name_list NAME
+ { ldlang_add_undef ($2); }
| extern_name_list ',' NAME
{ ldlang_add_undef ($3); }
;
@@ -320,6 +333,7 @@ ifile_p1:
{
lang_add_nocrossref ($3);
}
+ | EXTERN '(' extern_name_list ')'
;
input_list:
@@ -361,51 +375,117 @@ statement_anywhere:
/* The '*' and '?' cases are there because the lexer returns them as
separate tokens rather than as NAME. */
-file_NAME_list:
+wildcard_name:
NAME
- { lang_add_wild ($1, current_file); }
+ {
+ $$ = $1;
+ }
| '*'
- { 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);
- }
- | '['
+wildcard_spec:
+ wildcard_name
{
- current_file = (char *)NULL;
+ $$.name = $1;
+ $$.sorted = false;
+ $$.exclude_name_list = NULL;
}
- file_NAME_list
- ']'
- | NAME
+ | EXCLUDE_FILE '(' exclude_name_list ')' wildcard_name
{
- current_file = $1;
+ $$.name = $5;
+ $$.sorted = false;
+ $$.exclude_name_list = $3;
}
- '(' file_NAME_list ')'
- | '?'
- /* This case is needed because the lexer returns a
- single question mark as '?' rather than NAME. */
+ | SORT '(' wildcard_name ')'
{
- current_file = "?";
+ $$.name = $3;
+ $$.sorted = true;
+ $$.exclude_name_list = NULL;
}
- '(' file_NAME_list ')'
- | '*'
+ | SORT '(' EXCLUDE_FILE '(' exclude_name_list ')' wildcard_name ')'
{
- current_file = (char *)NULL;
+ $$.name = $7;
+ $$.sorted = true;
+ $$.exclude_name_list = $5;
+ }
+ ;
+
+
+
+exclude_name_list:
+ exclude_name_list wildcard_name
+ {
+ struct name_list *tmp;
+ tmp = (struct name_list *) xmalloc (sizeof *tmp);
+ tmp->name = $2;
+ tmp->next = $1;
+ $$ = tmp;
+ }
+ |
+ wildcard_name
+ {
+ struct name_list *tmp;
+ tmp = (struct name_list *) xmalloc (sizeof *tmp);
+ tmp->name = $1;
+ tmp->next = NULL;
+ $$ = tmp;
+ }
+ ;
+
+file_NAME_list:
+ wildcard_spec
+ {
+ lang_add_wild ($1.name, $1.sorted,
+ current_file.name,
+ current_file.sorted,
+ ldgram_had_keep, $1.exclude_name_list);
+ }
+ | file_NAME_list opt_comma wildcard_spec
+ {
+ lang_add_wild ($3.name, $3.sorted,
+ current_file.name,
+ current_file.sorted,
+ ldgram_had_keep, $3.exclude_name_list);
+ }
+ ;
+
+input_section_spec_no_keep:
+ NAME
+ {
+ lang_add_wild (NULL, false, $1, false,
+ ldgram_had_keep, NULL);
+ }
+ | '['
+ {
+ current_file.name = NULL;
+ current_file.sorted = false;
+ }
+ file_NAME_list ']'
+ | wildcard_spec
+ {
+ current_file = $1;
+ /* '*' matches any file name. */
+ if (strcmp (current_file.name, "*") == 0)
+ current_file.name = NULL;
}
'(' file_NAME_list ')'
;
+input_section_spec:
+ input_section_spec_no_keep
+ | KEEP '('
+ { ldgram_had_keep = true; }
+ input_section_spec_no_keep ')'
+ { ldgram_had_keep = false; }
+ ;
+
statement:
assignment end
| CREATE_OBJECT_SYMBOLS
@@ -418,6 +498,11 @@ statement:
lang_add_attribute(lang_constructors_statement_enum);
}
+ | SORT '(' CONSTRUCTORS ')'
+ {
+ constructors_sorted = true;
+ lang_add_attribute (lang_constructors_statement_enum);
+ }
| input_section_spec
| length '(' mustbe_exp ')'
{
@@ -549,15 +634,24 @@ length_spec:
"length",
lang_first_phase_enum);
}
-
+ ;
attributes_opt:
- '(' NAME ')'
- {
- lang_set_flags(region, $2);
- }
- |
-
+ /* empty */
+ { /* dummy action to avoid bison 1.25 error message */ }
+ | '(' attributes_list ')'
+ ;
+
+attributes_list:
+ attributes_string
+ | attributes_list attributes_string
+ ;
+
+attributes_string:
+ NAME
+ { lang_set_flags (region, $1, 0); }
+ | '!' NAME
+ { lang_set_flags (region, $2, 1); }
;
startup:
@@ -697,13 +791,20 @@ 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 ); }
+ | MAX_K '(' exp ',' exp ')'
+ { $$ = exp_binop (MAX_K, $3, $5 ); }
+ | MIN_K '(' exp ',' exp ')'
+ { $$ = exp_binop (MIN_K, $3, $5 ); }
+ | ASSERT_K '(' exp ',' NAME ')'
+ { $$ = exp_assert ($3, $5); }
;
+memspec_at_opt:
+ AT '>' NAME { $$ = $3; }
+ | { $$ = "*default*"; }
+ ;
+
opt_at:
AT '(' exp ')' { $$ = $3; }
| { $$ = 0; }
@@ -720,10 +821,10 @@ section: NAME { ldlex_expression(); }
}
statement_list_opt
'}' { ldlex_popstate (); ldlex_expression (); }
- memspec_opt phdr_opt fill_opt
+ memspec_opt memspec_at_opt phdr_opt fill_opt
{
ldlex_popstate ();
- lang_leave_output_section_statement ($13, $11, $12);
+ lang_leave_output_section_statement ($14, $11, $13, $12);
}
opt_comma
| OVERLAY
@@ -737,10 +838,10 @@ section: NAME { ldlex_expression(); }
overlay_section
'}'
{ ldlex_popstate (); ldlex_expression (); }
- memspec_opt phdr_opt fill_opt
+ memspec_opt memspec_at_opt phdr_opt fill_opt
{
ldlex_popstate ();
- lang_leave_overlay ($14, $12, $13);
+ lang_leave_overlay ($15, $12, $14, $13);
}
opt_comma
| /* The GROUP case is just enough to support the gcc
@@ -900,7 +1001,7 @@ phdr_qualifiers:
else if (strcmp ($1, "FLAGS") == 0 && $2 != NULL)
$$.flags = $2;
else
- einfo ("%X%P:%S: PHDRS syntax error at `%s'\n", $1);
+ einfo (_("%X%P:%S: PHDRS syntax error at `%s'\n"), $1);
}
| AT '(' exp ')' phdr_qualifiers
{
@@ -925,7 +1026,7 @@ phdr_val:
version_script_file:
{
ldlex_version_file ();
- PUSH_ERROR ("VERSION script");
+ PUSH_ERROR (_("VERSION script"));
}
vers_nodes
{
@@ -999,12 +1100,21 @@ vers_tag:
vers_defns:
VERS_IDENTIFIER
{
- $$ = lang_new_vers_regex (NULL, $1);
+ $$ = lang_new_vers_regex (NULL, $1, ldgram_vers_current_lang);
}
| vers_defns ';' VERS_IDENTIFIER
{
- $$ = lang_new_vers_regex ($1, $3);
+ $$ = lang_new_vers_regex ($1, $3, ldgram_vers_current_lang);
}
+ | EXTERN NAME '{'
+ {
+ $<name>$ = ldgram_vers_current_lang;
+ ldgram_vers_current_lang = $2;
+ }
+ vers_defns '}'
+ {
+ ldgram_vers_current_lang = $<name>4;
+ }
;
%%
@@ -1013,7 +1123,7 @@ yyerror(arg)
const char *arg;
{
if (ldfile_assumed_script)
- einfo ("%P:%s: file format not recognized; treating as linker script\n",
+ 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]);
diff --git a/contrib/binutils/ld/ldint.texinfo b/contrib/binutils/ld/ldint.texinfo
index 612fc2a..013e485 100644
--- a/contrib/binutils/ld/ldint.texinfo
+++ b/contrib/binutils/ld/ldint.texinfo
@@ -12,7 +12,7 @@ END-INFO-DIR-ENTRY
@ifinfo
This file documents the internals of the GNU linker ld.
-Copyright (C) 1992, 93, 94, 95, 1996 Free Software Foundation, Inc.
+Copyright (C) 1992, 93, 94, 95, 96, 97, 1998 Free Software Foundation, Inc.
Contributed by Cygnus Support.
Permission is granted to make and distribute verbatim copies of
@@ -37,13 +37,13 @@ regarded as a program in the language TeX).
@settitle GNU Linker Internals
@titlepage
@title{A guide to the internals of the GNU linker}
-@author Per Bothner, Steve Chamberlain, Ian Lance Taylor
+@author Per Bothner, Steve Chamberlain, Ian Lance Taylor, DJ Delorie
@author Cygnus Support
@page
@tex
\def\$#1${{#1}} % Kluge: collect RCS revision info without $...$
-\xdef\manvers{\$Revision: 1.10 $} % For use in headers, footers too
+\xdef\manvers{\$Revision: 1.1.1.1 $} % For use in headers, footers too
{\parskip=0pt
\hfill Cygnus Support\par
\hfill \manvers\par
@@ -52,7 +52,8 @@ regarded as a program in the language TeX).
@end tex
@vskip 0pt plus 1filll
-Copyright @copyright{} 1992, 93, 94, 95, 1996 Free Software Foundation, Inc.
+Copyright @copyright{} 1992, 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
@@ -72,6 +73,7 @@ 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
+* Emulation Walkthrough:: A Walkthrough of a Typical Emulation
@end menu
@node README
@@ -209,6 +211,10 @@ The @file{genscripts.sh} script uses this to set the default value of
@item TARGET_PAGE_SIZE
If @code{SEGMENT_SIZE} is not defined, the @file{genscripts.sh} script
uses this to define it.
+
+@item ALIGNMENT
+Some @file{scripttempl} scripts set this to a number to pass to
+@code{ALIGN} to set the required alignment for the @code{end} symbol.
@end table
@node linker scripts
@@ -408,5 +414,151 @@ the @code{get_scripts} entry point should just return a file name. See
At some point, the linker emulation entry points should be documented.
+@node Emulation Walkthrough
+@chapter A Walkthrough of a Typical Emulation
+
+This chapter is to help people who are new to the way emulations
+interact with the linker, or who are suddenly thrust into the position
+of having to work with existing emulations. It will discuss the files
+you need to be aware of. It will tell you when the given "hooks" in
+the emulation will be called. It will, hopefully, give you enough
+information about when and how things happen that you'll be able to
+get by. As always, the source is the definitive reference to this.
+
+The starting point for the linker is in @file{ldmain.c} where
+@code{main} is defined. The bulk of the code that's emulation
+specific will initially be in @code{emultempl/@var{emulation}.em} but
+will end up in @code{e@var{emulation}.c} when the build is done.
+Most of the work to select and interface with emulations is in
+@code{ldemul.h} and @code{ldemul.c}. Specifically, @code{ldemul.h}
+defines the @code{ld_emulation_xfer_struct} structure your emulation
+exports.
+
+Your emulation file exports a symbol
+@code{ld_@var{EMULATION_NAME}_emulation}. If your emulation is
+selected (it usually is, since usually there's only one),
+@code{ldemul.c} sets the variable @var{ld_emulation} to point to it.
+@code{ldemul.c} also defines a number of API functions that interface
+to your emulation, like @code{ldemul_after_parse} which simply calls
+your @code{ld_@var{EMULATION}_emulation.after_parse} function. For
+the rest of this section, the functions will be mentioned, but you
+should assume the indirect reference to your emulation also.
+
+We will also skip or gloss over parts of the link process that don't
+relate to emulations, like setting up internationalization.
+
+After initialization, @code{main} selects an emulation by pre-scanning
+the command line arguments. It calls @code{ldemul_choose_target} to
+choose a target. If you set @code{choose_target} to
+@code{ldemul_default_target}, it picks your @code{target_name} by
+default.
+
+@code{main} calls @code{ldemul_before_parse}, then @code{parse_args}.
+@code{parse_args} calls @code{ldemul_parse_args} for each arg, which
+must update the @code{getopt} globals if it recognizes the argument.
+If the emulation doesn't recognize it, then parse_args checks to see
+if it recognizes it.
+
+Now that the emulation has had access to all its command-line options,
+@code{main} calls @code{ldemul_set_symbols}. This can be used for any
+initialization that may be affected by options. It is also supposed
+to set up any variables needed by the emulation script.
+
+@code{main} now calls @code{ldemul_get_script} to get the emulation
+script to use (based on arguments, no doubt, @pxref{Emulations}) and
+runs it. While parsing, @code{ldgram.y} may call @code{ldemul_hll} or
+@code{ldemul_syslib} to handle the @code{HLL} or @code{SYSLIB}
+commands. It may call @code{ldemul_unrecognized_file} if you asked
+the linker to link a file it doesn't recognize. It will call
+@code{ldemul_recognized_file} for each file it does recognize, in case
+the emulation wants to handle some files specially. All the while,
+it's loading the files (possibly calling
+@code{ldemul_open_dynamic_archive}) and symbols and stuff. After it's
+done reading the script, @code{main} calls @code{ldemul_after_parse}.
+Use the after-parse hook to set up anything that depends on stuff the
+script might have set up, like the entry point.
+
+@code{main} next calls @code{lang_process} in @code{ldlang.c}. This
+appears to be the main core of the linking itself, as far as emulation
+hooks are concerned(*). It first opens the output file's BFD, calling
+@code{ldemul_set_output_arch}, and calls
+@code{ldemul_create_output_section_statements} in case you need to use
+other means to find or create object files (i.e. shared libraries
+found on a path, or fake stub objects). Despite the name, nobody
+creates output sections here.
+
+(*) In most cases, the BFD library does the bulk of the actual
+linking, handling symbol tables, symbol resolution, relocations, and
+building the final output file. See the BFD reference for all the
+details. Your emulation is usually concerned more with managing
+things at the file and section level, like "put this here, add this
+section", etc.
+
+Next, the objects to be linked are opened and BFDs created for them,
+and @code{ldemul_after_open} is called. At this point, you have all
+the objects and symbols loaded, but none of the data has been placed
+yet.
+
+Next comes the Big Linking Thingy (except for the parts BFD does).
+All input sections are mapped to output sections according to the
+script. If a section doesn't get mapped by default,
+@code{ldemul_place_orphan} will get called to figure out where it goes.
+Next it figures out the offsets for each section, calling
+@code{ldemul_before_allocation} before and
+@code{ldemul_after_allocation} after deciding where each input section
+ends up in the output sections.
+
+The last part of @code{lang_process} is to figure out all the symbols'
+values. After assigning final values to the symbols,
+@code{ldemul_finish} is called, and after that, any undefined symbols
+are turned into fatal errors.
+
+OK, back to @code{main}, which calls @code{ldwrite} in
+@file{ldwrite.c}. @code{ldwrite} calls BFD's final_link, which does
+all the relocation fixups and writes the output bfd to disk, and we're
+done.
+
+In summary,
+
+@itemize @bullet
+
+@item @code{main()} in @file{ldmain.c}
+@item @file{emultempl/@var{EMULATION}.em} has your code
+@item @code{ldemul_choose_target} (defaults to your @code{target_name})
+@item @code{ldemul_before_parse}
+@item Parse argv, calls @code{ldemul_parse_args} for each
+@item @code{ldemul_set_symbols}
+@item @code{ldemul_get_script}
+@item parse script
+
+@itemize @bullet
+@item may call @code{ldemul_hll} or @code{ldemul_syslib}
+@item may call @code{ldemul_open_dynamic_archive}
+@end itemize
+
+@item @code{ldemul_after_parse}
+@item @code{lang_process()} in @file{ldlang.c}
+
+@itemize @bullet
+@item create @code{output_bfd}
+@item @code{ldemul_set_output_arch}
+@item @code{ldemul_create_output_section_statements}
+@item read objects, create input bfds - all symbols exist, but have no values
+@item may call @code{ldemul_unrecognized_file}
+@item will call @code{ldemul_recognized_file}
+@item @code{ldemul_after_open}
+@item map input sections to output sections
+@item may call @code{ldemul_place_orphan} for remaining sections
+@item @code{ldemul_before_allocation}
+@item gives input sections offsets into output sections, places output sections
+@item @code{ldemul_after_allocation} - section addresses valid
+@item assigns values to symbols
+@item @code{ldemul_finish} - symbol values valid
+@end itemize
+
+@item output bfd is written to disk
+
+@end itemize
+
@contents
@bye
diff --git a/contrib/binutils/ld/ldlang.c b/contrib/binutils/ld/ldlang.c
index 6cdab2b..d40ff07 100644
--- a/contrib/binutils/ld/ldlang.c
+++ b/contrib/binutils/ld/ldlang.c
@@ -1,12 +1,12 @@
/* Linker command language support.
- Copyright (C) 1991, 92, 93, 94, 95, 96, 97, 1998
+ Copyright (C) 1991, 92, 93, 94, 95, 96, 97, 98, 99, 2000
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)
+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,
@@ -36,6 +36,7 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA
#include "ldctor.h"
#include "ldfile.h"
#include "fnmatch.h"
+#include "demangle.h"
#include <ctype.h>
@@ -72,17 +73,18 @@ static lang_input_statement_type *new_afile
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 struct bfd_hash_entry *already_linked_newfunc
+ PARAMS ((struct bfd_hash_entry *, struct bfd_hash_table *,
+ const char *string));
+static void already_linked_table_init PARAMS ((void));
+static void already_linked_table_free PARAMS ((void));
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_statement_union_type *wild_sort
+ PARAMS ((lang_wild_statement_type *, lang_input_statement_type *,
+ asection *));
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,
@@ -138,11 +140,34 @@ 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));
-
+static void lang_gc_wild
+ PARAMS ((lang_wild_statement_type *, const char *, const char *));
+static void lang_gc_sections_1 PARAMS ((lang_statement_union_type *));
+static void lang_gc_sections PARAMS ((void));
+static void lang_do_version_exports_section PARAMS ((void));
+static void lang_check_section_addresses PARAMS ((void));
+
+typedef void (*callback_t) PARAMS ((lang_wild_statement_type *,
+ asection *, lang_input_statement_type *,
+ void *));
+static void walk_wild_section
+ PARAMS ((lang_wild_statement_type *, const char *,
+ lang_input_statement_type *, callback_t, void *));
+static void walk_wild_file
+ PARAMS ((lang_wild_statement_type *, const char *,
+ lang_input_statement_type *, callback_t, void *));
+
+static int get_target PARAMS ((const bfd_target *, void *));
+static void stricpy PARAMS ((char *, char *));
+static void strcut PARAMS ((char *, char *));
+static int name_compare PARAMS ((char *, char *));
+static int closest_target_match PARAMS ((const bfd_target *, void *));
+static char * get_first_input_target 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 };
+lang_statement_list_type file_chain = { NULL, NULL };
const char *entry_symbol = NULL;
boolean entry_from_cmdline;
boolean lang_has_input_file = false;
@@ -176,6 +201,142 @@ stat_alloc (size)
}
/*----------------------------------------------------------------------
+ Generic traversal routines for finding matching sections.
+*/
+
+static void
+walk_wild_section (ptr, section, file, callback, data)
+ lang_wild_statement_type *ptr;
+ const char *section;
+ lang_input_statement_type *file;
+ callback_t callback;
+ void *data;
+{
+ /* Don't process sections from files which were excluded. */
+ if (ptr->exclude_filename_list != NULL)
+ {
+ struct name_list *list_tmp;
+ for (list_tmp = ptr->exclude_filename_list; list_tmp; list_tmp = list_tmp->next)
+ {
+ boolean match;
+
+ if (wildcardp (list_tmp->name))
+ match = fnmatch (list_tmp->name, file->filename, 0) == 0 ? true : false;
+ else
+ match = strcmp (list_tmp->name, file->filename) == 0 ? true : false;
+
+ if (match)
+ return;
+ }
+ }
+
+ 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;
+
+ 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)
+ (*callback) (ptr, s, file, data);
+ }
+ }
+}
+
+/* Handle a wild statement for a single file F. */
+
+static void
+walk_wild_file (s, section, f, callback, data)
+ lang_wild_statement_type *s;
+ const char *section;
+ lang_input_statement_type *f;
+ callback_t callback;
+ void *data;
+{
+ if (f->the_bfd == NULL
+ || ! bfd_check_format (f->the_bfd, bfd_archive))
+ walk_wild_section (s, section, f, callback, data);
+ 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)
+ {
+ walk_wild_section (s, section,
+ (lang_input_statement_type *) member->usrdata,
+ callback, data);
+ }
+
+ member = bfd_openr_next_archived_file (f->the_bfd, member);
+ }
+ }
+}
+
+static void
+walk_wild (s, section, file, callback, data)
+ lang_wild_statement_type *s;
+ const char *section;
+ const char *file;
+ callback_t callback;
+ void *data;
+{
+ if (file == (char *) NULL)
+ {
+ /* Perform the iteration over all files in the list. */
+ LANG_FOR_EACH_INPUT_STATEMENT (f)
+ {
+ walk_wild_file (s, section, f, callback, data);
+ }
+ }
+ else if (wildcardp (file))
+ {
+ LANG_FOR_EACH_INPUT_STATEMENT (f)
+ {
+ if (fnmatch (file, f->filename, FNM_FILE_NAME) == 0)
+ walk_wild_file (s, section, f, callback, data);
+ }
+ }
+ else
+ {
+ lang_input_statement_type *f;
+
+ /* Perform the iteration over a single file. */
+ f = lookup_name (file);
+ walk_wild_file (s, section, f, callback, data);
+ }
+}
+
+/*----------------------------------------------------------------------
lang_for_each_statement walks the parse tree and calls the provided
function for each node
*/
@@ -521,6 +682,7 @@ lang_output_section_statement_lookup (name)
lookup = (lang_output_section_statement_type *)
new_stat (lang_output_section_statement, stat_ptr);
lookup->region = (lang_memory_region_type *) NULL;
+ lookup->lma_region = (lang_memory_region_type *) NULL;
lookup->fill = 0;
lookup->block_value = 1;
lookup->name = name;
@@ -571,9 +733,9 @@ lang_map ()
{
lang_memory_region_type *m;
- minfo ("\nMemory Configuration\n\n");
+ minfo (_("\nMemory Configuration\n\n"));
fprintf (config.map_file, "%-16s %-18s %-18s %s\n",
- "Name", "Origin", "Length", "Attributes");
+ _("Name"), _("Origin"), _("Length"), _("Attributes"));
for (m = lang_memory_region_list;
m != (lang_memory_region_type *) NULL;
@@ -615,7 +777,7 @@ lang_map ()
print_nl ();
}
- fprintf (config.map_file, "\nLinker script and memory map\n\n");
+ fprintf (config.map_file, _("\nLinker script and memory map\n\n"));
print_statements ();
}
@@ -632,7 +794,7 @@ init_os (s)
return;
if (strcmp (s->name, DISCARD_SECTION_NAME) == 0)
- einfo ("%P%F: Illegal use of `%s' section", DISCARD_SECTION_NAME);
+ einfo (_("%P%F: Illegal use of `%s' section"), DISCARD_SECTION_NAME);
new = ((section_userdata_type *)
stat_alloc (sizeof (section_userdata_type)));
@@ -642,7 +804,7 @@ init_os (s)
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",
+ 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;
@@ -706,13 +868,36 @@ exp_init_os (exp)
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. */
+ once into the output. This routine checks each section, and
+ arrange to discard it if a section of the same name has already
+ been linked. If the section has COMDAT information, then it uses
+ that to decide whether the section should be included. 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.
+ section_already_linked is called via bfd_map_over_sections. */
+
+/* This is the shape of the elements inside the already_linked hash
+ table. It maps a name onto a list of already_linked elements with
+ the same name. It's possible to get more than one element in a
+ list if the COMDAT sections have different names. */
+
+struct already_linked_hash_entry
+{
+ struct bfd_hash_entry root;
+ struct already_linked *entry;
+};
+
+struct already_linked
+{
+ struct already_linked *next;
+ asection *sec;
+};
+
+/* The hash table. */
+
+static struct bfd_hash_table already_linked_table;
/*ARGSUSED*/
static void
@@ -722,15 +907,10 @@ section_already_linked (abfd, sec, data)
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;
+ struct already_linked *l;
+ struct already_linked_hash_entry *already_linked_list;
/* If we are only reading symbols from this object, then we want to
discard all sections. */
@@ -746,11 +926,34 @@ section_already_linked (abfd, sec, data)
if ((flags & SEC_LINK_ONCE) == 0)
return;
+ /* FIXME: When doing a relocateable link, we may have trouble
+ copying relocations in other sections that refer to local symbols
+ in the section being discarded. Those relocations will have to
+ be converted somehow; as of this writing I'm not sure that any of
+ the backends handle that correctly.
+
+ It is tempting to instead not discard link once sections when
+ doing a relocateable link (technically, they should be discarded
+ whenever we are building constructors). However, that fails,
+ because the linker winds up combining all the link once sections
+ into a single large link once section, which defeats the purpose
+ of having link once sections in the first place.
+
+ Also, not merging link once sections in a relocateable link
+ causes trouble for MIPS ELF, which relies in link once semantics
+ to handle the .reginfo section correctly. */
+
name = bfd_get_section_name (abfd, sec);
- for (l = sec_link_once_list; l != NULL; l = l->next)
+ already_linked_list =
+ ((struct already_linked_hash_entry *)
+ bfd_hash_lookup (&already_linked_table, name, true, false));
+
+ for (l = already_linked_list->entry; l != NULL; l = l->next)
{
- if (strcmp (name, bfd_get_section_name (l->sec->owner, l->sec)) == 0)
+ if (sec->comdat == NULL
+ || l->sec->comdat == NULL
+ || strcmp (sec->comdat->name, l->sec->comdat->name) == 0)
{
/* The section has already been linked. See if we should
issue a warning. */
@@ -763,8 +966,12 @@ section_already_linked (abfd, sec, data)
break;
case SEC_LINK_DUPLICATES_ONE_ONLY:
- einfo ("%P: %B: warning: ignoring duplicate section `%s'\n",
- abfd, name);
+ if (sec->comdat == NULL)
+ einfo (_("%P: %B: warning: ignoring duplicate section `%s'\n"),
+ abfd, name);
+ else
+ einfo (_("%P: %B: warning: ignoring duplicate `%s' section symbol `%s'\n"),
+ abfd, name, sec->comdat->name);
break;
case SEC_LINK_DUPLICATES_SAME_CONTENTS:
@@ -777,25 +984,65 @@ section_already_linked (abfd, sec, data)
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",
+ 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. */
+ create a lang_input_section structure for this section.
+ Since there might be a symbol in the section being
+ discarded, we must retain a pointer to the section which
+ we are really going to use. */
sec->output_section = bfd_abs_section_ptr;
+ if (sec->comdat != NULL)
+ sec->comdat->sec = l->sec;
return;
}
}
- /* This is the first section with this name. Record it. */
+ /* This is the first section with this name. Record it. Allocate
+ the memory from the same obstack as the hash table is kept in. */
+
+ l = ((struct already_linked *)
+ bfd_hash_allocate (&already_linked_table, sizeof *l));
- l = (struct sec_link_once *) xmalloc (sizeof *l);
l->sec = sec;
- l->next = sec_link_once_list;
- sec_link_once_list = l;
+ l->next = already_linked_list->entry;
+ already_linked_list->entry = l;
+}
+
+/* Support routines for the hash table used by section_already_linked,
+ initialize the table, fill in an entry and remove the table. */
+
+static struct bfd_hash_entry *
+already_linked_newfunc (entry, table, string)
+ struct bfd_hash_entry *entry ATTRIBUTE_UNUSED;
+ struct bfd_hash_table *table;
+ const char *string ATTRIBUTE_UNUSED;
+{
+ struct already_linked_hash_entry *ret =
+ bfd_hash_allocate (table, sizeof (struct already_linked_hash_entry));
+
+ ret->entry = NULL;
+
+ return (struct bfd_hash_entry *) ret;
+}
+
+static void
+already_linked_table_init ()
+{
+ if (! bfd_hash_table_init_n (&already_linked_table,
+ already_linked_newfunc,
+ 42))
+ einfo (_("%P%F: Failed to create hash table\n"));
+}
+
+static void
+already_linked_table_free ()
+{
+ bfd_hash_table_free (&already_linked_table);
}
/* The wild routines.
@@ -939,6 +1186,10 @@ wild_doit (ptr, section, output, file)
break;
}
+ /* Copy over SEC_SMALL_DATA. */
+ if (section->flags & SEC_SMALL_DATA)
+ section->output_section->flags |= SEC_SMALL_DATA;
+
if (section->alignment_power > output->bfd_section->alignment_power)
output->bfd_section->alignment_power = section->alignment_power;
@@ -948,52 +1199,158 @@ wild_doit (ptr, section, output, file)
}
}
-/* Expand a wild statement for a particular FILE. SECTION may be
- NULL, in which case it is a wild card. */
+/* Handle wildcard sorting. This returns the lang_input_section which
+ should follow the one we are going to create for SECTION and FILE,
+ based on the sorting requirements of WILD. It returns NULL if the
+ new section should just go at the end of the current list. */
-static void
-wild_section (ptr, section, file, output)
- lang_wild_statement_type *ptr;
- const char *section;
+static lang_statement_union_type *
+wild_sort (wild, file, section)
+ lang_wild_statement_type *wild;
lang_input_statement_type *file;
- lang_output_section_statement_type *output;
+ asection *section;
{
- if (file->just_syms_flag == false)
+ const char *section_name;
+ lang_statement_union_type *l;
+
+ if (! wild->filenames_sorted && ! wild->sections_sorted)
+ return NULL;
+
+ section_name = bfd_get_section_name (file->the_bfd, section);
+ for (l = wild->children.head; l != NULL; l = l->next)
{
- register asection *s;
- boolean wildcard;
+ lang_input_section_type *ls;
- if (section == NULL)
- wildcard = false;
- else
- wildcard = wildcardp (section);
+ if (l->header.type != lang_input_section_enum)
+ continue;
+ ls = &l->input_section;
- for (s = file->the_bfd->sections; s != NULL; s = s->next)
+ /* Sorting by filename takes precedence over sorting by section
+ name. */
+
+ if (wild->filenames_sorted)
{
- boolean match;
+ const char *fn, *ln;
+ boolean fa, la;
+ int i;
- /* Attach all sections named SECTION. If SECTION is NULL,
- then attach all sections.
+ /* The PE support for the .idata section as generated by
+ dlltool assumes that files will be sorted by the name of
+ the archive and then the name of the file within the
+ archive. */
- 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 (file->the_bfd != NULL
+ && bfd_my_archive (file->the_bfd) != NULL)
+ {
+ fn = bfd_get_filename (bfd_my_archive (file->the_bfd));
+ fa = true;
+ }
+ else
+ {
+ fn = file->filename;
+ fa = false;
+ }
- if (section == NULL)
- match = true;
+ if (ls->ifile->the_bfd != NULL
+ && bfd_my_archive (ls->ifile->the_bfd) != NULL)
+ {
+ ln = bfd_get_filename (bfd_my_archive (ls->ifile->the_bfd));
+ la = true;
+ }
else
{
- const char *name;
+ ln = ls->ifile->filename;
+ la = false;
+ }
- 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;
+ i = strcmp (fn, ln);
+ if (i > 0)
+ continue;
+ else if (i < 0)
+ break;
+
+ if (fa || la)
+ {
+ if (fa)
+ fn = file->filename;
+ if (la)
+ ln = ls->ifile->filename;
+
+ i = strcmp (fn, ln);
+ if (i > 0)
+ continue;
+ else if (i < 0)
+ break;
}
- if (match)
- wild_doit (&ptr->children, s, output, file);
+ }
+
+ /* Here either the files are not sorted by name, or we are
+ looking at the sections for this file. */
+
+ if (wild->sections_sorted)
+ {
+ if (strcmp (section_name,
+ bfd_get_section_name (ls->ifile->the_bfd,
+ ls->section))
+ < 0)
+ break;
+ }
+ }
+
+ return l;
+}
+
+/* Expand a wild statement for a particular FILE. SECTION may be
+ NULL, in which case it is a wild card. */
+
+static void
+output_section_callback (ptr, section, file, output)
+ lang_wild_statement_type *ptr;
+ asection *section;
+ lang_input_statement_type *file;
+ void *output;
+{
+ lang_statement_union_type *before;
+
+ /* If the wild pattern was marked KEEP, the member sections
+ should be as well. */
+ if (ptr->keep_sections)
+ section->flags |= SEC_KEEP;
+
+ before = wild_sort (ptr, file, section);
+
+ /* Here BEFORE points to the lang_input_section which
+ should follow the one we are about to add. If BEFORE
+ is NULL, then the section should just go at the end
+ of the current list. */
+
+ if (before == NULL)
+ wild_doit (&ptr->children, section,
+ (lang_output_section_statement_type *) output,
+ file);
+ else
+ {
+ lang_statement_list_type list;
+ lang_statement_union_type **pp;
+
+ lang_list_init (&list);
+ wild_doit (&list, section,
+ (lang_output_section_statement_type *) output,
+ file);
+
+ /* If we are discarding the section, LIST.HEAD will
+ be NULL. */
+ if (list.head != NULL)
+ {
+ ASSERT (list.head->next == NULL);
+
+ for (pp = &ptr->children.head;
+ *pp != before;
+ pp = &(*pp)->next)
+ ASSERT (*pp != NULL);
+
+ list.head->next = *pp;
+ *pp = list.head;
}
}
}
@@ -1062,15 +1419,15 @@ load_symbols (entry, place)
{
char **p;
- einfo ("%B: file not recognized: %E\n", entry->the_bfd);
- einfo ("%B: matching formats:", entry->the_bfd);
+ 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);
+ einfo (_("%F%B: file not recognized: %E\n"), entry->the_bfd);
bfd_close (entry->the_bfd);
entry->the_bfd = NULL;
@@ -1097,6 +1454,9 @@ load_symbols (entry, place)
return;
}
+ if (ldemul_recognized_file (entry))
+ 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
@@ -1120,13 +1480,13 @@ load_symbols (entry, place)
while (member != NULL)
{
if (! bfd_check_format (member, bfd_object))
- einfo ("%F%B: object %B in archive is not object\n",
+ 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);
+ einfo (_("%F%B: could not read symbols: %E\n"), member);
member = bfd_openr_next_archived_file (entry->the_bfd,
member);
}
@@ -1138,48 +1498,12 @@ load_symbols (entry, place)
}
if (! bfd_link_add_symbols (entry->the_bfd, &link_info))
- einfo ("%F%B: could not read symbols: %E\n", entry->the_bfd);
+ 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
@@ -1191,72 +1515,250 @@ wild (s, section, file, target, output)
lang_wild_statement_type *s;
const char *section;
const char *file;
- const char *target;
+ const char *target ATTRIBUTE_UNUSED;
lang_output_section_statement_type *output;
{
- lang_input_statement_type *f;
+ walk_wild (s, section, file, output_section_callback, (void *) output);
- if (file == (char *) NULL)
+ if (section != (char *) NULL
+ && strcmp (section, "COMMON") == 0
+ && default_common_section == 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);
- }
+ /* 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;
}
- else if (wildcardp (file))
+}
+
+/* Return true iff target is the sought target. */
+static int
+get_target (target, data)
+ const bfd_target * target;
+ void * data;
+{
+ const char * sought = (const char *) data;
+
+ return strcmp (target->name, sought) == 0;
+}
+
+/* Like strcpy() but convert to lower case as well. */
+static void
+stricpy (dest, src)
+ char * dest;
+ char * src;
+{
+ char c;
+
+ while ((c = * src ++) != 0)
{
- 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);
- }
+ if (isupper ((unsigned char) c))
+ c = tolower (c);
+
+ * dest ++ = c;
}
- else
+
+ * dest = 0;
+}
+
+/* Remove the first occurance of needle (if any) in haystack
+ from haystack. */
+static void
+strcut (haystack, needle)
+ char * haystack;
+ char * needle;
+{
+ haystack = strstr (haystack, needle);
+
+ if (haystack)
{
- /* Perform the iteration over a single file */
- f = lookup_name (file);
- wild_file (s, section, f, output);
+ char * src;
+
+ for (src = haystack + strlen (needle); * src;)
+ * haystack ++ = * src ++;
+
+ * haystack = 0;
}
+}
- if (section != (char *) NULL
- && strcmp (section, "COMMON") == 0
- && default_common_section == NULL)
+/* Compare two target format name strings.
+ Return a value indicating how "similar" they are. */
+static int
+name_compare (first, second)
+ char * first;
+ char * second;
+{
+ char * copy1;
+ char * copy2;
+ int result;
+
+ copy1 = xmalloc (strlen (first) + 1);
+ copy2 = xmalloc (strlen (second) + 1);
+
+ /* Convert the names to lower case. */
+ stricpy (copy1, first);
+ stricpy (copy2, second);
+
+ /* Remove and endian strings from the name. */
+ strcut (copy1, "big");
+ strcut (copy1, "little");
+ strcut (copy2, "big");
+ strcut (copy2, "little");
+
+ /* Return a value based on how many characters match,
+ starting from the beginning. If both strings are
+ the same then return 10 * their length. */
+ for (result = 0; copy1 [result] == copy2 [result]; result ++)
+ if (copy1 [result] == 0)
+ {
+ result *= 10;
+ break;
+ }
+
+ free (copy1);
+ free (copy2);
+
+ return result;
+}
+
+/* Set by closest_target_match() below. */
+static const bfd_target * winner;
+
+/* Scan all the valid bfd targets looking for one that has the endianness
+ requirement that was specified on the command line, and is the nearest
+ match to the original output target. */
+static int
+closest_target_match (target, data)
+ const bfd_target * target;
+ void * data;
+{
+ const bfd_target * original = (const bfd_target *) data;
+
+ if (command_line.endian == ENDIAN_BIG && target->byteorder != BFD_ENDIAN_BIG)
+ return 0;
+
+ if (command_line.endian == ENDIAN_LITTLE && target->byteorder != BFD_ENDIAN_LITTLE)
+ return 0;
+
+ /* Must be the same flavour. */
+ if (target->flavour != original->flavour)
+ return 0;
+
+ /* If we have not found a potential winner yet, then record this one. */
+ if (winner == 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;
+ winner = target;
+ return 0;
}
+
+ /* Oh dear, we now have two potential candidates for a successful match.
+ Compare their names and choose the better one. */
+ if (name_compare (target->name, original->name) > name_compare (winner->name, original->name))
+ winner = target;
+
+ /* Keep on searching until wqe have checked them all. */
+ return 0;
+}
+
+/* Return the BFD target format of the first input file. */
+static char *
+get_first_input_target ()
+{
+ char * target = NULL;
+
+ LANG_FOR_EACH_INPUT_STATEMENT (s)
+ {
+ if (s->header.type == lang_input_statement_enum
+ && s->real)
+ {
+ ldfile_open_file (s);
+
+ if (s->the_bfd != NULL
+ && bfd_check_format (s->the_bfd, bfd_object))
+ {
+ target = bfd_get_target (s->the_bfd);
+
+ if (target != NULL)
+ break;
+ }
+ }
+ }
+
+ return target;
}
/* Open the output file. */
static bfd *
open_output (name)
- const char *name;
+ const char * name;
{
- bfd *output;
+ bfd * output;
+ /* Has the user told us which output format to use ? */
if (output_target == (char *) NULL)
{
- if (current_target != (char *) NULL)
+ /* No - has the current target been set to something other than the default ? */
+ if (current_target != default_target)
output_target = current_target;
+
+ /* No - can we determine the format of the first input file ? */
+ else
+ {
+ output_target = get_first_input_target ();
+
+ /* Failed - use the default output target. */
+ if (output_target == NULL)
+ output_target = default_target;
+ }
+ }
+
+ /* Has the user requested a particular endianness on the command line ? */
+ if (command_line.endian != ENDIAN_UNSET)
+ {
+ const bfd_target * target;
+ enum bfd_endian desired_endian;
+
+ /* Get the chosen target. */
+ target = bfd_search_for_target (get_target, (void *) output_target);
+
+ if (command_line.endian == ENDIAN_BIG)
+ desired_endian = BFD_ENDIAN_BIG;
else
- output_target = default_target;
+ desired_endian = BFD_ENDIAN_LITTLE;
+
+ /* See if the target has the wrong endianness. This should not happen
+ if the linker script has provided big and little endian alternatives,
+ but some scrips don't do this. */
+ if (target->byteorder != desired_endian)
+ {
+ /* If it does, then see if the target provides
+ an alternative with the correct endianness. */
+ if (target->alternative_target != NULL
+ && (target->alternative_target->byteorder == desired_endian))
+ output_target = target->alternative_target->name;
+ else
+ {
+ /* Try to find a target as similar as possible to the default
+ target, but which has the desired endian characteristic. */
+ (void) bfd_search_for_target (closest_target_match, (void *) target);
+
+ /* Oh dear - we could not find any targets that satisfy our requirements. */
+ if (winner == NULL)
+ einfo (_("%P: warning: could not find any targets that match endianness requirement\n"));
+ else
+ output_target = winner->name;
+ }
+ }
}
+
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);
+ 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;
@@ -1264,23 +1766,20 @@ open_output (name)
/* output->flags |= D_PAGED;*/
if (! bfd_set_format (output, bfd_object))
- einfo ("%P%F:%s: can not make object file: %E\n", name);
+ 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);
+ 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");
+ 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;
@@ -1357,7 +1856,7 @@ open_input_bfds (s, force)
current_target = s->target_statement.target;
break;
case lang_input_statement_enum:
- if (s->input_statement.real == true)
+ if (s->input_statement.real)
{
lang_statement_list_type add;
@@ -1459,7 +1958,7 @@ lang_place_undefineds ()
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");
+ einfo (_("%P%F: bfd_link_hash_lookup failed: %E\n"));
if (h->type == bfd_link_hash_new)
{
h->type = bfd_link_hash_undefined;
@@ -1582,7 +2081,7 @@ print_output_section_statement (output_section_statement)
addr = exp_get_abs_int (output_section_statement->load_base, 0,
"load base", lang_final_phase_enum);
- minfo (" load address 0x%V", addr);
+ minfo (_(" load address 0x%V"), addr);
}
}
@@ -1606,7 +2105,7 @@ print_assignment (assignment, output_section)
result = exp_fold_tree (assignment->exp->assign.src, output_section,
lang_final_phase_enum, print_dot, &print_dot);
- if (result.valid)
+ if (result.valid_p)
minfo ("0x%V", result.value + result.section->bfd_section->vma);
else
{
@@ -1670,7 +2169,8 @@ print_input_section (in)
{
asection *i = in->section;
bfd_size_type size = i->_cooked_size != 0 ? i->_cooked_size : i->_raw_size;
-
+ unsigned opb = bfd_arch_mach_octets_per_byte (ldfile_output_architecture,
+ ldfile_output_machine);
if (size != 0)
{
print_space ();
@@ -1694,7 +2194,7 @@ print_input_section (in)
}
minfo ("0x%V %W %B\n",
- i->output_section->vma + i->output_offset, size,
+ i->output_section->vma + i->output_offset, size / opb,
i->owner);
if (i->_cooked_size != 0 && i->_cooked_size != i->_raw_size)
@@ -1711,12 +2211,12 @@ print_input_section (in)
--len;
}
- minfo ("%W (size before relaxing)\n", i->_raw_size);
+ 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;
+ print_dot = i->output_section->vma + i->output_offset + size / opb;
}
}
}
@@ -1736,6 +2236,8 @@ print_data_statement (data)
bfd_vma addr;
bfd_size_type size;
const char *name;
+ unsigned opb = bfd_arch_mach_octets_per_byte (ldfile_output_architecture,
+ ldfile_output_machine);
for (i = 0; i < SECTION_NAME_MAP_LENGTH; i++)
print_space ();
@@ -1780,7 +2282,8 @@ print_data_statement (data)
print_nl ();
- print_dot = addr + size;
+ print_dot = addr + size / opb;
+
}
/* Print an address statement. These are generated by options like
@@ -1790,7 +2293,7 @@ static void
print_address_statement (address)
lang_address_statement_type *address;
{
- minfo ("Address of section %s set to ", address->section_name);
+ minfo (_("Address of section %s set to "), address->section_name);
exp_print_tree (address->address);
print_nl ();
}
@@ -1804,6 +2307,8 @@ print_reloc_statement (reloc)
int i;
bfd_vma addr;
bfd_size_type size;
+ unsigned opb = bfd_arch_mach_octets_per_byte (ldfile_output_architecture,
+ ldfile_output_machine);
for (i = 0; i < SECTION_NAME_MAP_LENGTH; i++)
print_space ();
@@ -1825,7 +2330,7 @@ print_reloc_statement (reloc)
print_nl ();
- print_dot = addr + size;
+ print_dot = addr + size / opb;
}
static void
@@ -1834,6 +2339,8 @@ print_padding_statement (s)
{
int len;
bfd_vma addr;
+ unsigned opb = bfd_arch_mach_octets_per_byte (ldfile_output_architecture,
+ ldfile_output_machine);
minfo (" *fill*");
@@ -1854,7 +2361,7 @@ print_padding_statement (s)
print_nl ();
- print_dot = addr + s->size;
+ print_dot = addr + s->size / opb;
}
static void
@@ -1864,15 +2371,33 @@ print_wild_statement (w, os)
{
print_space ();
- if (w->filename != NULL)
+ if (w->filenames_sorted)
+ minfo ("SORT(");
+ if (w->exclude_filename_list != NULL)
+ {
+ name_list *tmp;
+ minfo ("EXCLUDE_FILE ( %s", w->exclude_filename_list->name);
+ for (tmp=w->exclude_filename_list->next; tmp; tmp = tmp->next)
+ minfo (", %s", tmp->name);
+ minfo (")");
+ }
+ if (w->filename != NULL)
minfo ("%s", w->filename);
else
minfo ("*");
+ if (w->filenames_sorted)
+ minfo (")");
+ minfo ("(");
+ if (w->sections_sorted)
+ minfo ("SORT(");
if (w->section_name != NULL)
- minfo ("(%s)", w->section_name);
+ minfo ("%s", w->section_name);
else
- minfo ("(*)");
+ minfo ("*");
+ if (w->sections_sorted)
+ minfo (")");
+ minfo (")");
print_nl ();
@@ -1917,13 +2442,16 @@ print_statement (s, os)
switch (s->header.type)
{
default:
- fprintf (config.map_file, "Fail with %d\n", s->header.type);
+ 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");
+ if (constructors_sorted)
+ minfo (" SORT (CONSTRUCTORS)\n");
+ else
+ minfo (" CONSTRUCTORS\n");
print_statement_list (constructor_list.head, os);
}
break;
@@ -2028,6 +2556,8 @@ insert_pad (this_ptr, fill, power, output_section_statement, dot)
inserting a magic 'padding' statement.
*/
+ unsigned opb = bfd_arch_mach_octets_per_byte (ldfile_output_architecture,
+ ldfile_output_machine);
unsigned int alignment_needed = align_power (dot, power) - dot;
if (alignment_needed != 0)
@@ -2044,7 +2574,7 @@ insert_pad (this_ptr, fill, power, output_section_statement, dot)
new->padding_statement.output_offset =
dot - output_section_statement->vma;
new->padding_statement.fill = fill;
- new->padding_statement.size = alignment_needed;
+ new->padding_statement.size = alignment_needed * opb;
}
@@ -2053,9 +2583,9 @@ insert_pad (this_ptr, fill, power, output_section_statement, dot)
{
output_section_statement->alignment_power = power;
}
- output_section_statement->_raw_size += alignment_needed;
- return alignment_needed + dot;
+ output_section_statement->_raw_size += alignment_needed * opb;
+ return dot + alignment_needed;
}
/* Work out how much this section will move the dot point */
@@ -2065,10 +2595,12 @@ size_input_section (this_ptr, output_section_statement, fill, dot, relax)
lang_output_section_statement_type * output_section_statement;
fill_type fill;
bfd_vma dot;
- boolean relax;
+ boolean relax ATTRIBUTE_UNUSED;
{
lang_input_section_type *is = &((*this_ptr)->input_section);
asection *i = is->section;
+ unsigned opb = bfd_arch_mach_octets_per_byte (ldfile_output_architecture,
+ ldfile_output_machine);
if (is->ifile->just_syms_flag == false)
{
@@ -2086,10 +2618,11 @@ size_input_section (this_ptr, output_section_statement, fill, dot, relax)
/* Mark how big the output section must be to contain this now
*/
if (i->_cooked_size != 0)
- dot += i->_cooked_size;
+ dot += i->_cooked_size / opb;
else
- dot += i->_raw_size;
- output_section_statement->bfd_section->_raw_size = dot - output_section_statement->bfd_section->vma;
+ dot += i->_raw_size / opb;
+ output_section_statement->bfd_section->_raw_size =
+ (dot - output_section_statement->bfd_section->vma) * opb;
}
else
{
@@ -2099,11 +2632,107 @@ size_input_section (this_ptr, output_section_statement, fill, dot, relax)
return dot;
}
+#define IGNORE_SECTION(bfd, s) \
+ (((bfd_get_section_flags (bfd, s) & (SEC_ALLOC | SEC_LOAD)) != (SEC_ALLOC | SEC_LOAD)) \
+ || bfd_section_size (bfd, s) == 0)
+
+/* Check to see if any allocated sections overlap with other allocated
+ sections. This can happen when the linker script specifically specifies
+ the output section addresses of the two sections. */
+static void
+lang_check_section_addresses ()
+{
+ asection * s;
+ unsigned opb = bfd_octets_per_byte (output_bfd);
+
+ /* Scan all sections in the output list. */
+ for (s = output_bfd->sections; s != NULL; s = s->next)
+ {
+ asection * os;
+
+ /* Ignore sections which are not loaded or which have no contents. */
+ if (IGNORE_SECTION (output_bfd, s))
+ continue;
+
+ /* Once we reach section 's' stop our seach. This prevents two
+ warning messages from being produced, one for 'section A overlaps
+ section B' and one for 'section B overlaps section A'. */
+ for (os = output_bfd->sections; os != s; os = os->next)
+ {
+ bfd_vma s_start;
+ bfd_vma s_end;
+ bfd_vma os_start;
+ bfd_vma os_end;
+
+ /* Only consider loadable sections with real contents. */
+ if (IGNORE_SECTION (output_bfd, os))
+ continue;
+
+ /* We must check the sections' LMA addresses not their
+ VMA addresses because overlay sections can have
+ overlapping VMAs but they must have distinct LMAs. */
+ s_start = bfd_section_lma (output_bfd, s);
+ os_start = bfd_section_lma (output_bfd, os);
+ s_end = s_start + bfd_section_size (output_bfd, s) / opb - 1;
+ os_end = os_start + bfd_section_size (output_bfd, os) / opb - 1;
+
+ /* Look for an overlap. */
+ if ((s_end < os_start) || (s_start > os_end))
+ continue;
+
+ einfo (
+_("%X%P: section %s [%V -> %V] overlaps section %s [%V -> %V]\n"),
+ s->name, s_start, s_end, os->name, os_start, os_end);
+
+ /* Once we have found one overlap for this section,
+ stop looking for others. */
+ break;
+ }
+ }
+}
+
/* This variable indicates whether bfd_relax_section should be called
again. */
static boolean relax_again;
+/* Make sure the new address is within the region. We explicitly permit the
+ current address to be at the exact end of the region when the address is
+ non-zero, in case the region is at the end of addressable memory and the
+ calculation wraps around. */
+
+static void
+os_region_check (os, region, tree, base)
+ lang_output_section_statement_type *os;
+ struct memory_region_struct *region;
+ etree_type *tree;
+ bfd_vma base;
+{
+ if ((region->current < region->origin
+ || (region->current - region->origin > region->length))
+ && ((region->current != region->origin + region->length)
+ || base == 0))
+ {
+ if (tree != (etree_type *) NULL)
+ {
+ einfo (_("%X%P: address 0x%v of %B section %s is not within region %s\n"),
+ region->current,
+ os->bfd_section->owner,
+ os->bfd_section->name,
+ region->name);
+ }
+ else
+ {
+ einfo (_("%X%P: region %s is full (%B section %s)\n"),
+ region->name,
+ os->bfd_section->owner,
+ os->bfd_section->name);
+ }
+ /* Reset the region pointer. */
+ region->current = region->origin;
+ }
+}
+
/* Set the sizes for all the output sections. */
bfd_vma
@@ -2115,347 +2744,371 @@ lang_size_sections (s, output_section_statement, prev, fill, dot, relax)
bfd_vma dot;
boolean relax;
{
- /* Size up the sections from their constituent parts */
+ unsigned opb = bfd_arch_mach_octets_per_byte (ldfile_output_architecture,
+ ldfile_output_machine);
+
+ /* Size up the sections from their constituent parts. */
for (; s != (lang_statement_union_type *) NULL; s = s->next)
- {
- switch (s->header.type)
{
+ switch (s->header.type)
+ {
+ case lang_output_section_statement_enum:
+ {
+ bfd_vma after;
+ lang_output_section_statement_type *os = &s->output_section_statement;
- 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;
+ if (os->bfd_section == NULL)
+ /* This section was never actually created. */
+ 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;
+ /* 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;
+ }
- 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:
+ 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_p == 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. */
- dot = lang_size_sections (s->wild_statement.children.head,
- output_section_statement,
- &s->wild_statement.children.head,
+ if (os->section_alignment != -1)
+ dot = align_power (dot, os->section_alignment);
- fill, dot, relax);
+ bfd_set_section_vma (0, os->bfd_section, dot);
+
+ os->bfd_section->output_offset = 0;
+ }
- break;
+ (void) lang_size_sections (os->children.head, os, &os->children.head,
+ os->fill, dot, relax);
+
+ /* put the section within the requested block size, or align at
+ the block boundary */
+ after = ALIGN_N (os->bfd_section->vma
+ + os->bfd_section->_raw_size / opb,
+ /* 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) * opb;
+ dot = os->bfd_section->vma + os->bfd_section->_raw_size / opb;
+ os->processed = true;
+
+ /* Update dot in the region ?
+ We only do this if the section is going to be allocated,
+ since unallocated sections do not contribute to the region's
+ overall size in memory.
+
+ If the SEC_NEVER_LOAD bit is not set, it will affect the
+ addresses of sections after it. We have to update
+ dot. */
+ if (os->region != (lang_memory_region_type *) NULL
+ && ((bfd_get_section_flags (output_bfd, os->bfd_section)
+ & SEC_NEVER_LOAD) == 0
+ || (bfd_get_section_flags (output_bfd, os->bfd_section)
+ & (SEC_ALLOC | SEC_LOAD))))
+ {
+ os->region->current = dot;
+
+ /* Make sure the new address is within the region. */
+ os_region_check (os, os->region, os->addr_tree,
+ os->bfd_section->vma);
+
+ /* if there's no load address specified, use the run region as
+ the load region */
+ if (os->lma_region == NULL && os->load_base == NULL)
+ os->lma_region = os->region;
+
+ if (os->lma_region != NULL)
+ {
+ if (os->load_base != NULL)
+ {
+ einfo (_("%X%P: use an absolute load address or a load memory region, not both\n"));
+ }
+ else
+ {
+ /* don't allocate twice */
+ if (os->lma_region != os->region)
+ {
+ /* set load_base, which will be handled later */
+ os->load_base = exp_intop (os->lma_region->current);
+ os->lma_region->current +=
+ os->bfd_section->_raw_size / opb;
+ os_region_check (os, os->lma_region, NULL,
+ os->bfd_section->lma);
+ }
+ }
+ }
+ }
+ }
+ 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;
+ case lang_constructors_statement_enum:
+ dot = lang_size_sections (constructor_list.head,
+ output_section_statement,
+ &s->wild_statement.children.head,
+ fill,
+ dot, relax);
+ break;
- i = (*prev)->input_section.section;
- if (! relax)
+ case lang_data_statement_enum:
{
- if (i->_cooked_size == 0)
- i->_cooked_size = i->_raw_size;
+ 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)
+ {
+ default:
+ abort();
+ 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;
+ }
+ if (size < opb)
+ size = opb;
+ dot += size / opb;
+ 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;
+ }
}
- else
+ break;
+
+ case lang_reloc_statement_enum:
{
- boolean again;
+ 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 / opb;
+ 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);
- if (! bfd_relax_section (i->owner, i, &link_info, &again))
- einfo ("%P%F: can't relax section: %E\n");
- if (again)
- relax_again = true;
+ 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);
}
- 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;
+ 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;
+ fill = s->fill_statement.fill;
+ break;
+ case lang_assignment_statement_enum:
+ {
+ bfd_vma newdot = dot;
- /* This can only get here when relaxing is turned on */
+ exp_fold_tree (s->assignment_statement.exp,
+ output_section_statement,
+ lang_allocating_phase_enum,
+ dot,
+ &newdot);
- case lang_address_statement_enum:
- break;
+ if (newdot != dot)
+ {
+ /* 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 if (!relax)
+ {
+ 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) * opb;
+ 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 / opb;
+ 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;
}
- prev = &s->header.next;
- }
return dot;
}
@@ -2466,6 +3119,9 @@ lang_do_assignments (s, output_section_statement, fill, dot)
fill_type fill;
bfd_vma dot;
{
+ unsigned opb = bfd_arch_mach_octets_per_byte (ldfile_output_architecture,
+ ldfile_output_machine);
+
for (; s != (lang_statement_union_type *) NULL; s = s->next)
{
switch (s->header.type)
@@ -2487,7 +3143,8 @@ lang_do_assignments (s, output_section_statement, fill, dot)
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;
+ dot = os->bfd_section->vma + os->bfd_section->_raw_size / opb;
+
}
if (os->load_base)
{
@@ -2524,25 +3181,33 @@ lang_do_assignments (s, output_section_statement, fill, dot)
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");
+ if (value.valid_p == 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;
- }
+ {
+ unsigned int size;
+ switch (s->data_statement.type)
+ {
+ default:
+ abort();
+ 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;
+ }
+ if (size < opb)
+ size = opb;
+ dot += size / opb;
+ }
break;
case lang_reloc_statement_enum:
@@ -2553,10 +3218,10 @@ lang_do_assignments (s, output_section_statement, fill, dot)
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");
+ if (value.valid_p == false)
+ einfo (_("%F%P: invalid reloc statement\n"));
}
- dot += bfd_get_reloc_size (s->reloc_statement.howto);
+ dot += bfd_get_reloc_size (s->reloc_statement.howto) / opb;
break;
case lang_input_section_enum:
@@ -2564,9 +3229,9 @@ lang_do_assignments (s, output_section_statement, fill, dot)
asection *in = s->input_section.section;
if (in->_cooked_size != 0)
- dot += in->_cooked_size;
+ dot += in->_cooked_size / opb;
else
- dot += in->_raw_size;
+ dot += in->_raw_size / opb;
}
break;
@@ -2586,7 +3251,7 @@ lang_do_assignments (s, output_section_statement, fill, dot)
break;
case lang_padding_statement_enum:
- dot += s->padding_statement.size;
+ dot += s->padding_statement.size / opb;
break;
case lang_group_statement_enum:
@@ -2644,11 +3309,13 @@ lang_set_startof ()
h = bfd_link_hash_lookup (link_info.hash, buf, false, false, true);
if (h != NULL && h->type == bfd_link_hash_undefined)
{
+ unsigned opb = bfd_arch_mach_octets_per_byte (ldfile_output_architecture,
+ ldfile_output_machine);
h->type = bfd_link_hash_defined;
if (s->_cooked_size != 0)
- h->u.def.value = s->_cooked_size;
+ h->u.def.value = s->_cooked_size / opb;
else
- h->u.def.value = s->_raw_size;
+ h->u.def.value = s->_raw_size / opb;
h->u.def.section = bfd_abs_section_ptr;
}
@@ -2688,29 +3355,44 @@ lang_finish ()
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);
+ einfo (_("%P%F:%s: can't set start address\n"), entry_symbol);
}
else
{
- asection *ts;
+ bfd_vma val;
+ CONST char *send;
- /* 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)
+ /* We couldn't find the entry symbol. Try parsing it as a
+ number. */
+ val = bfd_scan_vma (entry_symbol, &send, 0);
+ if (*send == '\0')
{
- 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");
+ if (! bfd_set_start_address (output_bfd, val))
+ 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);
+ asection *ts;
+
+ /* Can't find the entry symbol, and it's not a number. 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);
+ }
}
}
}
@@ -2720,10 +3402,10 @@ lang_finish ()
static void
#ifdef ANSI_PROTOTYPES
-ignore_bfd_errors (const char *s, ...)
+ignore_bfd_errors (const char *s ATTRIBUTE_UNUSED, ...)
#else
ignore_bfd_errors (s)
- const char *s;
+ const char *s ATTRIBUTE_UNUSED;
#endif
{
/* Don't do anything. */
@@ -2750,7 +3432,7 @@ lang_check ()
if (compatible == NULL)
{
if (command_line.warn_mismatch)
- einfo ("%P: warning: %s architecture of input file `%B' is incompatible with %s output\n",
+ 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));
}
@@ -2768,7 +3450,7 @@ lang_check ()
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",
+ einfo (_("%E%X: failed to merge target specific data of file %B\n"),
input_bfd);
}
if (! command_line.warn_mismatch)
@@ -2810,6 +3492,8 @@ lang_one_common (h, info)
unsigned int power_of_two;
bfd_vma size;
asection *section;
+ unsigned opb = bfd_arch_mach_octets_per_byte (ldfile_output_architecture,
+ ldfile_output_machine);
if (h->type != bfd_link_hash_common)
return true;
@@ -2824,8 +3508,8 @@ lang_one_common (h, info)
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));
+ section->_cooked_size = ALIGN_N ((section->_cooked_size + opb - 1) / opb,
+ (bfd_size_type) (1 << power_of_two)) * opb;
/* Adjust the alignment if necessary. */
if (power_of_two > section->alignment_power)
@@ -2834,10 +3518,10 @@ lang_one_common (h, info)
/* 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;
+ h->u.def.value = section->_cooked_size;
/* Increase the size of the section. */
- section->_raw_size += size;
+ section->_cooked_size += size;
/* Make sure the section is allocated in memory, and make sure that
it is no longer a common section. */
@@ -2853,8 +3537,8 @@ lang_one_common (h, info)
if (! header_printed)
{
- minfo ("\nAllocating common symbols\n");
- minfo ("Common symbol size file\n\n");
+ minfo (_("\nAllocating common symbols\n"));
+ minfo (_("Common symbol size file\n\n"));
header_printed = true;
}
@@ -2904,11 +3588,7 @@ 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)
+ LANG_FOR_EACH_INPUT_STATEMENT (file)
{
asection *s;
@@ -2943,7 +3623,7 @@ lang_place_orphans ()
/* 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");
+ info_msg (_("%P: no [COMMON] command, defaulting to .bss\n"));
#endif
default_common_section =
lang_output_section_statement_lookup (".bss");
@@ -2969,21 +3649,18 @@ lang_place_orphans ()
void
-lang_set_flags (ptr, flags)
+lang_set_flags (ptr, flags, invert)
lang_memory_region_type *ptr;
CONST char *flags;
+ int invert;
{
- flagword *ptr_flags = &ptr->flags;
+ flagword *ptr_flags;
- ptr->flags = ptr->not_flags = 0;
+ ptr_flags = invert ? &ptr->not_flags : &ptr->flags;
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;
@@ -3006,7 +3683,7 @@ lang_set_flags (ptr, flags)
break;
default:
- einfo ("%P%F: invalid syntax in flags\n");
+ einfo (_("%P%F: invalid syntax in flags\n"));
break;
}
flags++;
@@ -3036,11 +3713,7 @@ 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)
+ LANG_FOR_EACH_INPUT_STATEMENT (f)
{
func (f);
}
@@ -3054,13 +3727,9 @@ 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)
+ LANG_FOR_EACH_INPUT_STATEMENT (f)
{
- asection *s;
+ asection * s;
for (s = f->the_bfd->sections;
s != (asection *) NULL;
@@ -3219,6 +3888,103 @@ reset_memory_regions ()
}
}
+/* Expand a wild statement for a particular FILE, marking its sections KEEP
+ as needed. SECTION may be NULL, in which case it is a wild card. */
+
+static void
+gc_section_callback (ptr, section, file, data)
+ lang_wild_statement_type *ptr;
+ asection *section;
+ lang_input_statement_type *file ATTRIBUTE_UNUSED;
+ void *data ATTRIBUTE_UNUSED;
+{
+ /* If the wild pattern was marked KEEP, the member sections
+ should be as well. */
+ if (ptr->keep_sections)
+ section->flags |= SEC_KEEP;
+}
+
+/* Handle a wild statement, marking it against GC. SECTION or FILE or both
+ may be NULL, indicating that it is a wildcard. */
+
+static void
+lang_gc_wild (s, section, file)
+ lang_wild_statement_type *s;
+ const char *section;
+ const char *file;
+{
+ walk_wild (s, section, file, gc_section_callback, NULL);
+}
+
+/* Iterate over sections marking them against GC. */
+
+static void
+lang_gc_sections_1 (s)
+ lang_statement_union_type * s;
+{
+ for (; s != (lang_statement_union_type *) NULL; s = s->next)
+ {
+ switch (s->header.type)
+ {
+ case lang_wild_statement_enum:
+ lang_gc_wild (&s->wild_statement,
+ s->wild_statement.section_name,
+ s->wild_statement.filename);
+ break;
+ case lang_constructors_statement_enum:
+ lang_gc_sections_1 (constructor_list.head);
+ break;
+ case lang_output_section_statement_enum:
+ lang_gc_sections_1 (s->output_section_statement.children.head);
+ break;
+ case lang_group_statement_enum:
+ lang_gc_sections_1 (s->group_statement.children.head);
+ break;
+ default:
+ break;
+ }
+ }
+}
+
+static void
+lang_gc_sections ()
+{
+ struct bfd_link_hash_entry *h;
+ ldlang_undef_chain_list_type *ulist, fake_list_start;
+
+ /* Keep all sections so marked in the link script. */
+
+ lang_gc_sections_1 (statement_list.head);
+
+ /* Keep all sections containing symbols undefined on the command-line.
+ Handle the entry symbol at the same time. */
+
+ if (entry_symbol != NULL)
+ {
+ fake_list_start.next = ldlang_undef_chain_list_head;
+ fake_list_start.name = (char *) entry_symbol;
+ ulist = &fake_list_start;
+ }
+ else
+ ulist = ldlang_undef_chain_list_head;
+
+ for (; ulist; ulist = ulist->next)
+ {
+ h = bfd_link_hash_lookup (link_info.hash, ulist->name,
+ false, false, false);
+
+ if (h != (struct bfd_link_hash_entry *) NULL
+ && (h->type == bfd_link_hash_defined
+ || h->type == bfd_link_hash_defweak)
+ && ! bfd_is_abs_section (h->u.def.section))
+ {
+ h->u.def.section->flags |= SEC_KEEP;
+ }
+ }
+
+ bfd_gc_sections (output_bfd, &link_info);
+}
+
void
lang_process ()
{
@@ -3232,12 +3998,16 @@ lang_process ()
/* Add to the hash table all undefineds on the command line */
lang_place_undefineds ();
+ already_linked_table_init ();
+
/* Create a bfd for each input file */
current_target = default_target;
open_input_bfds (statement_list.head, false);
ldemul_after_open ();
+ already_linked_table_free ();
+
/* 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
@@ -3245,10 +4015,18 @@ lang_process ()
link. */
lang_check ();
+ /* Handle .exports instead of a version script if we're told to do so. */
+ if (command_line.version_exports_section)
+ lang_do_version_exports_section ();
+
/* Build all sets based on the information gathered from the input
files. */
ldctor_build_sets ();
+ /* Remove unreferenced sections if asked to. */
+ if (command_line.gc_sections)
+ lang_gc_sections ();
+
/* Size up the common data */
lang_common ();
@@ -3284,6 +4062,10 @@ lang_process ()
relax_again = false;
+ /* Note: pe-dll.c does something like this also. If you find
+ you need to change this code, you probably need to change
+ pe-dll.c also. DJ */
+
/* Do all the assignments with our current guesses as to
section sizes. */
lang_do_assignments (statement_list.head,
@@ -3320,6 +4102,11 @@ lang_process ()
abs_output_section,
(fill_type) 0, (bfd_vma) 0);
+ /* Make sure that the section addresses make sense. */
+ if (! link_info.relocateable
+ && command_line.check_section_addresses)
+ lang_check_section_addresses ();
+
/* Final stuffs */
ldemul_finish ();
@@ -3329,9 +4116,14 @@ lang_process ()
/* EXPORTED TO YACC */
void
-lang_add_wild (section_name, filename)
- CONST char *CONST section_name;
- CONST char *CONST filename;
+lang_add_wild (section_name, sections_sorted, filename, filenames_sorted,
+ keep_sections, exclude_filename_list)
+ const char *const section_name;
+ boolean sections_sorted;
+ const char *const filename;
+ boolean filenames_sorted;
+ boolean keep_sections;
+ struct name_list *exclude_filename_list;
{
lang_wild_statement_type *new = new_stat (lang_wild_statement,
stat_ptr);
@@ -3340,12 +4132,16 @@ lang_add_wild (section_name, filename)
{
placed_commons = true;
}
- if (filename != (char *) NULL)
+ if (filename != NULL && ! wildcardp (filename))
{
lang_has_input_file = true;
}
new->section_name = section_name;
+ new->sections_sorted = sections_sorted;
new->filename = filename;
+ new->filenames_sorted = filenames_sorted;
+ new->keep_sections = keep_sections;
+ new->exclude_filename_list = exclude_filename_list;
lang_list_init (&new->children);
}
@@ -3365,21 +4161,6 @@ lang_section_start (name, address)
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;
@@ -3392,14 +4173,6 @@ lang_add_entry (name, 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
@@ -3481,7 +4254,7 @@ lang_add_reloc (reloc, howto, section, name, addend)
p->output_vma = 0;
}
-void
+lang_assignment_statement_type *
lang_add_assignment (exp)
etree_type * exp;
{
@@ -3489,6 +4262,7 @@ lang_add_assignment (exp)
stat_ptr);
new->exp = exp;
+ return new;
}
void
@@ -3504,7 +4278,7 @@ lang_startup (name)
{
if (startup_file != (char *) NULL)
{
- einfo ("%P%Fmultiple STARTUP files\n");
+ einfo (_("%P%Fmultiple STARTUP files\n"));
}
first_file->filename = name;
first_file->local_sym_name = name;
@@ -3521,13 +4295,22 @@ lang_float (maybe)
}
void
-lang_leave_output_section_statement (fill, memspec, phdrs)
+lang_leave_output_section_statement (fill, memspec, phdrs, lma_memspec)
bfd_vma fill;
const char *memspec;
struct lang_output_section_phdr_list *phdrs;
+ const char *lma_memspec;
{
current_section->fill = fill;
current_section->region = lang_memory_region_lookup (memspec);
+ if (strcmp (lma_memspec, "*default*") != 0)
+ {
+ current_section->lma_region = lang_memory_region_lookup (lma_memspec);
+ /* if no runtime region has been given, but the load region has been,
+ use the load region */
+ if (strcmp (memspec, "*default*") == 0)
+ current_section->region = lang_memory_region_lookup (lma_memspec);
+ }
current_section->phdrs = phdrs;
stat_ptr = &statement_list;
}
@@ -3547,7 +4330,7 @@ lang_abs_symbol_at_beginning_of (secname, name)
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");
+ einfo (_("%P%F: bfd_link_hash_lookup failed: %E\n"));
if (h->type == bfd_link_hash_new
|| h->type == bfd_link_hash_undefined)
@@ -3581,7 +4364,7 @@ lang_abs_symbol_at_end_of (secname, name)
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");
+ einfo (_("%P%F: bfd_link_hash_lookup failed: %E\n"));
if (h->type == bfd_link_hash_new
|| h->type == bfd_link_hash_undefined)
@@ -3595,7 +4378,8 @@ lang_abs_symbol_at_end_of (secname, name)
h->u.def.value = 0;
else
h->u.def.value = (bfd_get_section_vma (output_bfd, sec)
- + bfd_section_size (output_bfd, sec));
+ + bfd_section_size (output_bfd, sec) /
+ bfd_octets_per_byte (output_bfd));
h->u.def.section = bfd_abs_section_ptr;
}
@@ -3766,7 +4550,7 @@ lang_record_phdrs ()
flags,
l->at == NULL ? false : true,
at, l->filehdr, l->phdrs, c, secs))
- einfo ("%F%P: bfd_record_phdr failed: %E\n");
+ einfo (_("%F%P: bfd_record_phdr failed: %E\n"));
}
free (secs);
@@ -3785,7 +4569,7 @@ lang_record_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",
+ einfo (_("%X%P: section `%s' assigned to non-existent phdr `%s'\n"),
u->output_section_statement.name, pl->name);
}
}
@@ -3887,7 +4671,7 @@ lang_enter_overlay_section (name)
if (overlay_max == NULL)
overlay_max = size;
else
- overlay_max = exp_binop (MAX, overlay_max, size);
+ overlay_max = exp_binop (MAX_K, overlay_max, size);
}
/* Finish a section in an overlay. There isn't any special to do
@@ -3905,7 +4689,8 @@ lang_leave_overlay_section (fill, phdrs)
name = current_section->name;
- lang_leave_output_section_statement (fill, "*default*", phdrs);
+ lang_leave_output_section_statement (fill, "*default*",
+ phdrs, "*default*");
/* Define the magic symbols. */
@@ -3935,12 +4720,14 @@ lang_leave_overlay_section (fill, phdrs)
looks through all the sections in the overlay and sets them. */
void
-lang_leave_overlay (fill, memspec, phdrs)
+lang_leave_overlay (fill, memspec, phdrs, lma_memspec)
bfd_vma fill;
const char *memspec;
struct lang_output_section_phdr_list *phdrs;
+ const char *lma_memspec;
{
lang_memory_region_type *region;
+ lang_memory_region_type *lma_region;
struct overlay_list *l;
struct lang_nocrossref *nocrossref;
@@ -3949,6 +4736,11 @@ lang_leave_overlay (fill, memspec, phdrs)
else
region = lang_memory_region_lookup (memspec);
+ if (lma_memspec == NULL)
+ lma_region = NULL;
+ else
+ lma_region = lang_memory_region_lookup (lma_memspec);
+
nocrossref = NULL;
l = overlay_list;
@@ -3960,6 +4752,8 @@ lang_leave_overlay (fill, memspec, phdrs)
l->os->fill = fill;
if (region != NULL && l->os->region == NULL)
l->os->region = region;
+ if (lma_region != NULL && l->os->lma_region == NULL)
+ l->os->lma_region = lma_region;
if (phdrs != NULL && l->os->phdrs == NULL)
l->os->phdrs = phdrs;
@@ -3998,18 +4792,97 @@ lang_leave_overlay (fill, memspec, phdrs)
struct bfd_elf_version_tree *lang_elf_version_info;
+static int
+lang_vers_match_lang_c (expr, sym)
+ struct bfd_elf_version_expr *expr;
+ const char *sym;
+{
+ if (expr->pattern[0] == '*' && expr->pattern[1] == '\0')
+ return 1;
+ return fnmatch (expr->pattern, sym, 0) == 0;
+}
+
+static int
+lang_vers_match_lang_cplusplus (expr, sym)
+ struct bfd_elf_version_expr *expr;
+ const char *sym;
+{
+ char *alt_sym;
+ int result;
+
+ if (expr->pattern[0] == '*' && expr->pattern[1] == '\0')
+ return 1;
+
+ alt_sym = cplus_demangle(sym, /* DMGL_NO_TPARAMS */ 0);
+ if (!alt_sym)
+ {
+ /* cplus_demangle (also) returns NULL when it is not a C++ symbol.
+ Should we early out false in this case? */
+ result = fnmatch (expr->pattern, sym, 0) == 0;
+ }
+ else
+ {
+ result = fnmatch (expr->pattern, alt_sym, 0) == 0;
+ free (alt_sym);
+ }
+
+ return result;
+}
+
+static int
+lang_vers_match_lang_java (expr, sym)
+ struct bfd_elf_version_expr *expr;
+ const char *sym;
+{
+ char *alt_sym;
+ int result;
+
+ if (expr->pattern[0] == '*' && expr->pattern[1] == '\0')
+ return 1;
+
+ alt_sym = cplus_demangle(sym, DMGL_JAVA);
+ if (!alt_sym)
+ {
+ /* cplus_demangle (also) returns NULL when it is not a Java symbol.
+ Should we early out false in this case? */
+ result = fnmatch (expr->pattern, sym, 0) == 0;
+ }
+ else
+ {
+ result = fnmatch (expr->pattern, alt_sym, 0) == 0;
+ free (alt_sym);
+ }
+
+ return result;
+}
+
/* This is called for each variable name or match expression. */
struct bfd_elf_version_expr *
-lang_new_vers_regex (orig, new)
+lang_new_vers_regex (orig, new, lang)
struct bfd_elf_version_expr *orig;
const char *new;
+ const char *lang;
{
struct bfd_elf_version_expr *ret;
ret = (struct bfd_elf_version_expr *) xmalloc (sizeof *ret);
ret->next = orig;
- ret->match = new;
+ ret->pattern = new;
+
+ if (lang == NULL || strcasecmp (lang, "C") == 0)
+ ret->match = lang_vers_match_lang_c;
+ else if (strcasecmp (lang, "C++") == 0)
+ ret->match = lang_vers_match_lang_cplusplus;
+ else if (strcasecmp (lang, "Java") == 0)
+ ret->match = lang_vers_match_lang_java;
+ else
+ {
+ einfo (_("%X%P: unknown language `%s' in version information\n"),
+ lang);
+ ret->match = lang_vers_match_lang_c;
+ }
+
return ret;
}
@@ -4054,7 +4927,7 @@ lang_register_vers_node (name, version, deps)
/* 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);
+ einfo (_("%X%P: duplicate version tag `%s'\n"), name);
/* Check the global and local match names, and make sure there
aren't any duplicates. */
@@ -4066,9 +4939,9 @@ lang_register_vers_node (name, version, deps)
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);
+ if (strcmp (e1->pattern, e2->pattern) == 0)
+ einfo (_("%X%P: duplicate expression `%s' in version information\n"),
+ e1->pattern);
}
}
@@ -4079,9 +4952,9 @@ lang_register_vers_node (name, version, deps)
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);
+ if (strcmp (e1->pattern, e2->pattern) == 0)
+ einfo (_("%X%P: duplicate expression `%s' in version information\n"),
+ e1->pattern);
}
}
@@ -4117,7 +4990,45 @@ lang_add_vers_depend (list, name)
}
}
- einfo ("%X%P: unable to find version dependency `%s'\n", name);
+ einfo (_("%X%P: unable to find version dependency `%s'\n"), name);
return ret;
}
+
+static void
+lang_do_version_exports_section ()
+{
+ struct bfd_elf_version_expr *greg = NULL, *lreg;
+
+ LANG_FOR_EACH_INPUT_STATEMENT (is)
+ {
+ asection *sec = bfd_get_section_by_name (is->the_bfd, ".exports");
+ char *contents, *p;
+ bfd_size_type len;
+
+ if (sec == NULL)
+ continue;
+
+ len = bfd_section_size (is->the_bfd, sec);
+ contents = xmalloc (len);
+ if (!bfd_get_section_contents (is->the_bfd, sec, contents, 0, len))
+ einfo (_("%X%P: unable to read .exports section contents"), sec);
+
+ p = contents;
+ while (p < contents+len)
+ {
+ greg = lang_new_vers_regex (greg, p, NULL);
+ p = strchr (p, '\0') + 1;
+ }
+
+ /* Do not free the contents, as we used them creating the regex. */
+
+ /* Do not include this section in the link. */
+ bfd_set_section_flags (is->the_bfd, sec,
+ bfd_get_section_flags (is->the_bfd, sec) | SEC_EXCLUDE);
+ }
+
+ lreg = lang_new_vers_regex (NULL, "*", NULL);
+ lang_register_vers_node (command_line.version_exports_section,
+ lang_new_vers_node (greg, lreg), NULL);
+}
diff --git a/contrib/binutils/ld/ldlang.h b/contrib/binutils/ld/ldlang.h
index 60edc0f..068cd96 100644
--- a/contrib/binutils/ld/ldlang.h
+++ b/contrib/binutils/ld/ldlang.h
@@ -1,5 +1,6 @@
/* ldlang.h - linker command language support
- Copyright 1991, 92, 93, 94, 95, 96, 1997 Free Software Foundation, Inc.
+ Copyright 1991, 92, 93, 94, 95, 96, 97, 98, 99, 2000
+ Free Software Foundation, Inc.
This file is part of GLD, the Gnu Linker.
@@ -135,6 +136,7 @@ typedef struct lang_output_section_statement_struct
flagword flags; /* Or together of all input sections */
enum section_type sectype;
struct memory_region_struct *region;
+ struct memory_region_struct *lma_region;
size_t block_value;
fill_type fill;
@@ -278,7 +280,11 @@ typedef struct lang_wild_statement_struct
{
lang_statement_header_type header;
const char *section_name;
+ boolean sections_sorted;
const char *filename;
+ boolean filenames_sorted;
+ boolean keep_sections;
+ struct name_list *exclude_filename_list;
lang_statement_list_type children;
} lang_wild_statement_type;
@@ -379,7 +385,8 @@ extern struct memory_region_struct *lang_memory_region_lookup
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_set_flags PARAMS ((lang_memory_region_type *, const char *,
+ int));
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,
@@ -394,15 +401,17 @@ 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_wild
+ PARAMS ((const char *, boolean, const char *, boolean, boolean, name_list *));
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 lang_assignment_statement_type * 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 *));
+ PARAMS ((bfd_vma, const char *, struct lang_output_section_phdr_list *,
+ const char *));
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 *));
@@ -468,12 +477,13 @@ 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 *));
+ PARAMS ((bfd_vma, const char *, struct lang_output_section_phdr_list *,
+ const char *));
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 *));
+ PARAMS ((struct bfd_elf_version_expr *, const char *, 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
diff --git a/contrib/binutils/ld/ldlex.l b/contrib/binutils/ld/ldlex.l
index dfdf737..2eef80f 100644
--- a/contrib/binutils/ld/ldlex.l
+++ b/contrib/binutils/ld/ldlex.l
@@ -1,6 +1,6 @@
%{
-/* Copyright (C) 1991, 92, 93, 94, 95, 96, 97, 1998
+/* Copyright (C) 1991, 92, 93, 94, 95, 96, 97, 98, 1999
Free Software Foundation, Inc.
This file is part of GLD, the Gnu Linker.
@@ -74,6 +74,7 @@ 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 int vers_node_nesting = 0;
static YY_BUFFER_STATE yy_create_string_buffer PARAMS ((const char *string,
size_t size));
@@ -114,7 +115,7 @@ 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]*
+V_IDENTIFIER [*?.$_a-zA-Z][*?.$_a-zA-Z0-9]*
%s SCRIPT
%s EXPRESSION
@@ -239,9 +240,11 @@ V_IDENTIFIER [*?.$_a-zA-Z][*?_a-zA-Z0-9]*
<EXPRESSION,BOTH,SCRIPT>"ALIGN" { RTOKEN(ALIGN_K);}
<EXPRESSION,BOTH,SCRIPT>"ADDR" { RTOKEN(ADDR);}
<EXPRESSION,BOTH,SCRIPT>"LOADADDR" { RTOKEN(LOADADDR);}
-<EXPRESSION,BOTH>"MAX" { RTOKEN(MAX); }
-<EXPRESSION,BOTH>"MIN" { RTOKEN(MIN); }
+<EXPRESSION,BOTH>"MAX" { RTOKEN(MAX_K); }
+<EXPRESSION,BOTH>"MIN" { RTOKEN(MIN_K); }
+<EXPRESSION,BOTH>"ASSERT" { RTOKEN(ASSERT_K); }
<BOTH,SCRIPT>"ENTRY" { RTOKEN(ENTRY);}
+<BOTH,SCRIPT,MRI>"EXTERN" { RTOKEN(EXTERN);}
<EXPRESSION,BOTH,SCRIPT>"NEXT" { RTOKEN(NEXT);}
<EXPRESSION,BOTH,SCRIPT>"sizeof_headers" { RTOKEN(SIZEOF_HEADERS);}
<EXPRESSION,BOTH,SCRIPT>"SIZEOF_HEADERS" { RTOKEN(SIZEOF_HEADERS);}
@@ -272,6 +275,7 @@ V_IDENTIFIER [*?.$_a-zA-Z][*?_a-zA-Z0-9]*
<BOTH,SCRIPT>"NOFLOAT" { RTOKEN(NOFLOAT);}
<EXPRESSION,BOTH,SCRIPT>"NOCROSSREFS" { RTOKEN(NOCROSSREFS);}
<BOTH,SCRIPT>"OVERLAY" { RTOKEN(OVERLAY); }
+<BOTH,SCRIPT>"SORT" { RTOKEN(SORT); }
<EXPRESSION,BOTH,SCRIPT>"NOLOAD" { RTOKEN(NOLOAD);}
<EXPRESSION,BOTH,SCRIPT>"DSECT" { RTOKEN(DSECT);}
<EXPRESSION,BOTH,SCRIPT>"COPY" { RTOKEN(COPY);}
@@ -285,6 +289,8 @@ V_IDENTIFIER [*?.$_a-zA-Z][*?_a-zA-Z0-9]*
<BOTH,SCRIPT>"PHDRS" { RTOKEN (PHDRS); }
<EXPRESSION,BOTH,SCRIPT>"AT" { RTOKEN(AT);}
<EXPRESSION,BOTH,SCRIPT>"PROVIDE" { RTOKEN(PROVIDE); }
+<EXPRESSION,BOTH,SCRIPT>"KEEP" { RTOKEN(KEEP); }
+<EXPRESSION,BOTH,SCRIPT>"EXCLUDE_FILE" { RTOKEN(EXCLUDE_FILE); }
<MRI>"#".*\n? { ++ lineno; }
<MRI>"\n" { ++ lineno; RTOKEN(NEWLINE); }
<MRI>"*".* { /* Mri comment line */ }
@@ -302,7 +308,6 @@ V_IDENTIFIER [*?.$_a-zA-Z][*?_a-zA-Z0-9]*
<MRI>"NAME" { RTOKEN(NAMEWORD); }
<MRI>"FORMAT" { RTOKEN(FORMAT); }
<MRI>"CASE" { RTOKEN(CASE); }
-<MRI>"EXTERN" { RTOKEN(EXTERN); }
<MRI>"START" { RTOKEN(START); }
<MRI>"LIST".* { RTOKEN(LIST); /* LIST and ignore to end of line */ }
<MRI>"SECT" { RTOKEN(SECT); }
@@ -358,7 +363,7 @@ V_IDENTIFIER [*?.$_a-zA-Z][*?_a-zA-Z0-9]*
}
}
-<EXPRESSION,BOTH,SCRIPT>"\""[^\"]*"\"" {
+<EXPRESSION,BOTH,SCRIPT,VERS_NODE>"\""[^\"]*"\"" {
/* No matter the state, quotes
give what's inside */
yylval.name = buystring(yytext+1);
@@ -374,6 +379,8 @@ V_IDENTIFIER [*?.$_a-zA-Z][*?_a-zA-Z0-9]*
<VERS_NODE>local { RTOKEN(LOCAL); }
+<VERS_NODE>extern { RTOKEN(EXTERN); }
+
<VERS_NODE>{V_IDENTIFIER} { yylval.name = buystring (yytext);
return VERS_IDENTIFIER; }
@@ -382,8 +389,16 @@ V_IDENTIFIER [*?.$_a-zA-Z][*?_a-zA-Z0-9]*
<VERS_START>"{" { BEGIN(VERS_SCRIPT); return *yytext; }
-<VERS_SCRIPT>"{" { BEGIN(VERS_NODE); return *yytext; }
-<VERS_SCRIPT,VERS_NODE>"}" { BEGIN(VERS_SCRIPT); return *yytext; }
+<VERS_SCRIPT>"{" { BEGIN(VERS_NODE);
+ vers_node_nesting = 0;
+ return *yytext;
+ }
+<VERS_SCRIPT>"}" { return *yytext; }
+<VERS_NODE>"{" { vers_node_nesting++; return *yytext; }
+<VERS_NODE>"}" { if (--vers_node_nesting < 0)
+ BEGIN(VERS_SCRIPT);
+ return *yytext;
+ }
<VERS_START,VERS_NODE,VERS_SCRIPT>[\n] { lineno++; }
diff --git a/contrib/binutils/ld/ldmain.c b/contrib/binutils/ld/ldmain.c
index 97fed9d..ba2a592 100644
--- a/contrib/binutils/ld/ldmain.c
+++ b/contrib/binutils/ld/ldmain.c
@@ -1,5 +1,6 @@
/* Main program of GNU linker.
- Copyright (C) 1991, 92, 93, 94, 95, 96, 1997 Free Software Foundation, Inc.
+ Copyright (C) 1991, 92, 93, 94, 95, 96, 97, 98, 1999
+ Free Software Foundation, Inc.
Written by Steve Chamberlain steve@cygnus.com
This file is part of GLD, the Gnu Linker.
@@ -82,6 +83,9 @@ boolean version_printed;
/* Nonzero means link in every member of an archive. */
boolean whole_archive;
+/* True if we should demangle symbol names. */
+boolean demangling;
+
args_type command_line;
ld_config_type config;
@@ -113,7 +117,7 @@ static boolean warning_callback PARAMS ((struct bfd_link_info *,
static void warning_find_reloc PARAMS ((bfd *, asection *, PTR));
static boolean undefined_symbol PARAMS ((struct bfd_link_info *,
const char *, bfd *,
- asection *, bfd_vma));
+ asection *, bfd_vma, boolean));
static boolean reloc_overflow PARAMS ((struct bfd_link_info *, const char *,
const char *, bfd_vma,
bfd *, asection *, bfd_vma));
@@ -162,6 +166,12 @@ main (argc, argv)
char *emulation;
long start_time = get_run_time ();
+#if defined (HAVE_SETLOCALE) && defined (HAVE_LC_MESSAGES)
+ setlocale (LC_MESSAGES, "");
+#endif
+ bindtextdomain (PACKAGE, LOCALEDIR);
+ textdomain (PACKAGE);
+
program_name = argv[0];
xmalloc_set_program_name (program_name);
@@ -179,7 +189,7 @@ main (argc, argv)
a different target. The macro TARGET is defined by Makefile. */
if (! bfd_set_default_target (TARGET))
{
- einfo ("%X%P: can't set BFD default target to `%s': %E\n", TARGET);
+ einfo (_("%X%P: can't set BFD default target to `%s': %E\n"), TARGET);
xexit (1);
}
@@ -188,10 +198,19 @@ main (argc, argv)
whole_archive = false;
config.build_constructors = true;
config.dynamic_link = false;
+ config.has_shared = false;
command_line.force_common_definition = false;
command_line.interpreter = NULL;
command_line.rpath = NULL;
command_line.warn_mismatch = true;
+ command_line.check_section_addresses = true;
+
+ /* We initialize DEMANGLING based on the environment variable
+ COLLECT_NO_DEMANGLE. The gcc collect2 program will demangle the
+ output of the linker, unless COLLECT_NO_DEMANGLE is set in the
+ environment. Acting the same way here lets us provide the same
+ interface by default. */
+ demangling = getenv ("COLLECT_NO_DEMANGLE") == NULL;
link_info.callbacks = &link_callbacks;
link_info.relocateable = false;
@@ -199,6 +218,8 @@ main (argc, argv)
link_info.symbolic = false;
link_info.static_link = false;
link_info.traditional_format = false;
+ link_info.optimize = false;
+ link_info.no_undefined = false;
link_info.strip = strip_none;
link_info.discard = discard_none;
link_info.keep_memory = true;
@@ -209,7 +230,12 @@ main (argc, argv)
link_info.notice_all = false;
link_info.notice_hash = NULL;
link_info.wrap_hash = NULL;
-
+ link_info.mpc860c0 = 0;
+ /* SVR4 linkers seem to set DT_INIT and DT_FINI based on magic _init
+ and _fini symbols. We are compatible. */
+ link_info.init_function = "_init";
+ link_info.fini_function = "_fini";
+
ldfile_add_arch ("");
config.make_executable = true;
@@ -230,10 +256,14 @@ main (argc, argv)
if (link_info.relocateable)
{
- if (command_line.relax)
- einfo ("%P%F: -relax and -r may not be used together\n");
+ if (command_line.gc_sections)
+ einfo ("%P%F: --gc-sections and -r may not be used together\n");
+ if (link_info.mpc860c0)
+ einfo (_("%P%F: -r and --mpc860c0 may not be used together\n"));
+ else if (command_line.relax)
+ einfo (_("%P%F: --relax and -r may not be used together\n"));
if (link_info.shared)
- einfo ("%P%F: -r and -shared may not be used together\n");
+ einfo (_("%P%F: -r and -shared may not be used together\n"));
}
/* Treat ld -r -s as ld -r -S -x (i.e., strip all local symbols). I
@@ -262,7 +292,7 @@ main (argc, argv)
{
if (trace_file_tries)
{
- info_msg ("using internal linker script:\n");
+ info_msg (_("using internal linker script:\n"));
info_msg ("==================================================\n");
info_msg (s);
info_msg ("\n==================================================\n");
@@ -281,12 +311,12 @@ main (argc, argv)
{
if (version_printed)
xexit (0);
- einfo ("%P%F: no input files\n");
+ einfo (_("%P%F: no input files\n"));
}
if (trace_files)
{
- info_msg ("%P: mode %s\n", emulation);
+ info_msg (_("%P: mode %s\n"), emulation);
}
ldemul_after_parse ();
@@ -304,7 +334,7 @@ main (argc, argv)
if (config.map_file == (FILE *) NULL)
{
bfd_set_error (bfd_error_system_call);
- einfo ("%P%F: cannot open map file %s: %E\n",
+ einfo (_("%P%F: cannot open map file %s: %E\n"),
config.map_filename);
}
}
@@ -350,7 +380,7 @@ main (argc, argv)
{
if (trace_files == true)
{
- einfo ("%P: link errors found, deleting executable `%s'\n",
+ einfo (_("%P: link errors found, deleting executable `%s'\n"),
output_filename);
}
@@ -361,7 +391,7 @@ main (argc, argv)
else
{
if (! bfd_close (output_bfd))
- einfo ("%F%B: final close failed: %E\n", output_bfd);
+ einfo (_("%F%B: final close failed: %E\n"), output_bfd);
/* If the --force-exe-suffix is enabled, and we're making an
executable file and it doesn't end in .exe, copy it to one which does. */
@@ -385,21 +415,21 @@ main (argc, argv)
dst = fopen (dst_name, FOPEN_WB);
if (!src)
- einfo ("%X%P: unable to open for source of copy `%s'\n", output_filename);
+ einfo (_("%X%P: unable to open for source of copy `%s'\n"), output_filename);
if (!dst)
- einfo ("%X%P: unable to open for destination of copy `%s'\n", dst_name);
+ einfo (_("%X%P: unable to open for destination of copy `%s'\n"), dst_name);
while ((l = fread (buf, 1, bsize, src)) > 0)
{
int done = fwrite (buf, 1, l, dst);
if (done != l)
{
- einfo ("%P: Error writing file `%s'\n", dst_name);
+ einfo (_("%P: Error writing file `%s'\n"), dst_name);
}
}
fclose (src);
if (fclose (dst) == EOF)
{
- einfo ("%P: Error closing file `%s'\n", dst_name);
+ einfo (_("%P: Error closing file `%s'\n"), dst_name);
}
free (dst_name);
free (buf);
@@ -411,16 +441,15 @@ main (argc, argv)
if (config.stats)
{
- extern char **environ;
#ifdef HAVE_SBRK
char *lim = (char *) sbrk (0);
#endif
long run_time = get_run_time () - start_time;
- fprintf (stderr, "%s: total time in link: %ld.%06ld\n",
+ fprintf (stderr, _("%s: total time in link: %ld.%06ld\n"),
program_name, run_time / 1000000, run_time % 1000000);
#ifdef HAVE_SBRK
- fprintf (stderr, "%s: data size %ld\n", program_name,
+ fprintf (stderr, _("%s: data size %ld\n"), program_name,
(long) (lim - (char *) &environ));
#endif
}
@@ -461,7 +490,7 @@ get_emulation (argc, argv)
}
else
{
- einfo("%P%F: missing argument to -m\n");
+ einfo(_("%P%F: missing argument to -m\n"));
}
}
else if (strcmp (argv[i], "-mips1") == 0
@@ -575,12 +604,12 @@ add_ysym (name)
if (! bfd_hash_table_init_n (link_info.notice_hash,
bfd_hash_newfunc,
61))
- einfo ("%P%F: bfd_hash_table_init failed: %E\n");
+ einfo (_("%P%F: bfd_hash_table_init failed: %E\n"));
}
if (bfd_hash_lookup (link_info.notice_hash, name, true, true)
== (struct bfd_hash_entry *) NULL)
- einfo ("%P%F: bfd_hash_lookup failed: %E\n");
+ einfo (_("%P%F: bfd_hash_lookup failed: %E\n"));
}
/* Record a symbol to be wrapped, from the --wrap option. */
@@ -596,10 +625,10 @@ add_wrap (name)
if (! bfd_hash_table_init_n (link_info.wrap_hash,
bfd_hash_newfunc,
61))
- einfo ("%P%F: bfd_hash_table_init failed: %E\n");
+ einfo (_("%P%F: bfd_hash_table_init failed: %E\n"));
}
if (bfd_hash_lookup (link_info.wrap_hash, name, true, true) == NULL)
- einfo ("%P%F: bfd_hash_lookup failed: %E\n");
+ einfo (_("%P%F: bfd_hash_lookup failed: %E\n"));
}
/* Handle the -retain-symbols-file option. */
@@ -614,7 +643,7 @@ add_keepsyms_file (filename)
int c;
if (link_info.strip == strip_some)
- einfo ("%X%P: error: duplicate retain-symbols-file\n");
+ einfo (_("%X%P: error: duplicate retain-symbols-file\n"));
file = fopen (filename, "r");
if (file == (FILE *) NULL)
@@ -627,7 +656,7 @@ add_keepsyms_file (filename)
link_info.keep_hash = ((struct bfd_hash_table *)
xmalloc (sizeof (struct bfd_hash_table)));
if (! bfd_hash_table_init (link_info.keep_hash, bfd_hash_newfunc))
- einfo ("%P%F: bfd_hash_table_init failed: %E\n");
+ einfo (_("%P%F: bfd_hash_table_init failed: %E\n"));
bufsize = 100;
buf = (char *) xmalloc (bufsize);
@@ -658,12 +687,12 @@ add_keepsyms_file (filename)
if (bfd_hash_lookup (link_info.keep_hash, buf, true, true)
== (struct bfd_hash_entry *) NULL)
- einfo ("%P%F: bfd_hash_lookup for insertion failed: %E\n");
+ einfo (_("%P%F: bfd_hash_lookup for insertion failed: %E\n"));
}
}
if (link_info.strip != strip_none)
- einfo ("%P: `-retain-symbols-file' overrides `-s' and `-S'\n");
+ einfo (_("%P: `-retain-symbols-file' overrides `-s' and `-S'\n"));
link_info.strip = strip_some;
}
@@ -676,7 +705,7 @@ add_keepsyms_file (filename)
/*ARGSUSED*/
static boolean
add_archive_element (info, abfd, name)
- struct bfd_link_info *info;
+ struct bfd_link_info *info ATTRIBUTE_UNUSED;
bfd *abfd;
const char *name;
{
@@ -740,8 +769,8 @@ add_archive_element (info, abfd, name)
{
char buf[100];
- sprintf (buf, "%-29s %s\n\n", "Archive member included",
- "because of file (symbol)");
+ sprintf (buf, "%-29s %s\n\n", _("Archive member included"),
+ _("because of file (symbol)"));
minfo ("%s", buf);
header_printed = true;
}
@@ -791,7 +820,7 @@ add_archive_element (info, abfd, name)
/*ARGSUSED*/
static boolean
multiple_definition (info, name, obfd, osec, oval, nbfd, nsec, nval)
- struct bfd_link_info *info;
+ struct bfd_link_info *info ATTRIBUTE_UNUSED;
const char *name;
bfd *obfd;
asection *osec;
@@ -813,10 +842,10 @@ multiple_definition (info, name, obfd, osec, oval, nbfd, nsec, nval)
&& bfd_is_abs_section (nsec->output_section)))
return true;
- einfo ("%X%C: multiple definition of `%T'\n",
+ einfo (_("%X%C: multiple definition of `%T'\n"),
nbfd, nsec, nval, name);
if (obfd != (bfd *) NULL)
- einfo ("%D: first defined here\n", obfd, osec, oval);
+ einfo (_("%D: first defined here\n"), obfd, osec, oval);
return true;
}
@@ -828,7 +857,7 @@ multiple_definition (info, name, obfd, osec, oval, nbfd, nsec, nval)
/*ARGSUSED*/
static boolean
multiple_common (info, name, obfd, otype, osize, nbfd, ntype, nsize)
- struct bfd_link_info *info;
+ struct bfd_link_info *info ATTRIBUTE_UNUSED;
const char *name;
bfd *obfd;
enum bfd_link_hash_type otype;
@@ -845,43 +874,43 @@ multiple_common (info, name, obfd, otype, osize, nbfd, ntype, nsize)
|| ntype == bfd_link_hash_indirect)
{
ASSERT (otype == bfd_link_hash_common);
- einfo ("%B: warning: definition of `%T' overriding common\n",
+ einfo (_("%B: warning: definition of `%T' overriding common\n"),
nbfd, name);
if (obfd != NULL)
- einfo ("%B: warning: common is here\n", obfd);
+ einfo (_("%B: warning: common is here\n"), obfd);
}
else if (otype == bfd_link_hash_defined
|| otype == bfd_link_hash_defweak
|| otype == bfd_link_hash_indirect)
{
ASSERT (ntype == bfd_link_hash_common);
- einfo ("%B: warning: common of `%T' overridden by definition\n",
+ einfo (_("%B: warning: common of `%T' overridden by definition\n"),
nbfd, name);
if (obfd != NULL)
- einfo ("%B: warning: defined here\n", obfd);
+ einfo (_("%B: warning: defined here\n"), obfd);
}
else
{
ASSERT (otype == bfd_link_hash_common && ntype == bfd_link_hash_common);
if (osize > nsize)
{
- einfo ("%B: warning: common of `%T' overridden by larger common\n",
+ einfo (_("%B: warning: common of `%T' overridden by larger common\n"),
nbfd, name);
if (obfd != NULL)
- einfo ("%B: warning: larger common is here\n", obfd);
+ einfo (_("%B: warning: larger common is here\n"), obfd);
}
else if (nsize > osize)
{
- einfo ("%B: warning: common of `%T' overriding smaller common\n",
+ einfo (_("%B: warning: common of `%T' overriding smaller common\n"),
nbfd, name);
if (obfd != NULL)
- einfo ("%B: warning: smaller common is here\n", obfd);
+ einfo (_("%B: warning: smaller common is here\n"), obfd);
}
else
{
- einfo ("%B: warning: multiple common of `%T'\n", nbfd, name);
+ einfo (_("%B: warning: multiple common of `%T'\n"), nbfd, name);
if (obfd != NULL)
- einfo ("%B: warning: previous common is here\n", obfd);
+ einfo (_("%B: warning: previous common is here\n"), obfd);
}
}
@@ -895,7 +924,7 @@ multiple_common (info, name, obfd, otype, osize, nbfd, ntype, nsize)
/*ARGSUSED*/
static boolean
add_to_set (info, h, reloc, abfd, section, value)
- struct bfd_link_info *info;
+ struct bfd_link_info *info ATTRIBUTE_UNUSED;
struct bfd_link_hash_entry *h;
bfd_reloc_code_real_type reloc;
bfd *abfd;
@@ -903,7 +932,7 @@ add_to_set (info, h, reloc, abfd, section, value)
bfd_vma value;
{
if (config.warn_constructors)
- einfo ("%P: warning: global constructor %s used\n",
+ einfo (_("%P: warning: global constructor %s used\n"),
h->root.string);
if (! config.build_constructors)
@@ -942,7 +971,7 @@ constructor_callback (info, constructor, name, abfd, section, value)
char set_name[1 + sizeof "__CTOR_LIST__"];
if (config.warn_constructors)
- einfo ("%P: warning: global constructor %s used\n", name);
+ einfo (_("%P: warning: global constructor %s used\n"), name);
if (! config.build_constructors)
return true;
@@ -952,7 +981,7 @@ constructor_callback (info, constructor, name, abfd, section, value)
if (bfd_reloc_type_lookup (output_bfd, BFD_RELOC_CTOR) == NULL
&& (link_info.relocateable
|| bfd_reloc_type_lookup (abfd, BFD_RELOC_CTOR) == NULL))
- einfo ("%P%F: BFD backend error: BFD_RELOC_CTOR unsupported\n");
+ einfo (_("%P%F: BFD backend error: BFD_RELOC_CTOR unsupported\n"));
s = set_name;
if (bfd_get_symbol_leading_char (abfd) != '\0')
@@ -964,7 +993,7 @@ constructor_callback (info, constructor, name, abfd, section, value)
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");
+ einfo (_("%P%F: bfd_link_hash_lookup failed: %E\n"));
if (h->type == bfd_link_hash_new)
{
h->type = bfd_link_hash_undefined;
@@ -994,7 +1023,7 @@ struct warning_callback_info
/*ARGSUSED*/
static boolean
warning_callback (info, warning, symbol, abfd, section, address)
- struct bfd_link_info *info;
+ struct bfd_link_info *info ATTRIBUTE_UNUSED;
const char *warning;
const char *symbol;
bfd *abfd;
@@ -1032,11 +1061,11 @@ warning_callback (info, warning, symbol, abfd, section, address)
symsize = bfd_get_symtab_upper_bound (abfd);
if (symsize < 0)
- einfo ("%B%F: could not read symbols: %E\n", abfd);
+ einfo (_("%B%F: could not read symbols: %E\n"), abfd);
asymbols = (asymbol **) xmalloc (symsize);
symbol_count = bfd_canonicalize_symtab (abfd, asymbols);
if (symbol_count < 0)
- einfo ("%B%F: could not read symbols: %E\n", abfd);
+ einfo (_("%B%F: could not read symbols: %E\n"), abfd);
if (entry != NULL)
{
entry->asymbols = asymbols;
@@ -1082,14 +1111,14 @@ warning_find_reloc (abfd, sec, iarg)
relsize = bfd_get_reloc_upper_bound (abfd, sec);
if (relsize < 0)
- einfo ("%B%F: could not read relocs: %E\n", abfd);
+ 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);
+ einfo (_("%B%F: could not read relocs: %E\n"), abfd);
p = relpp;
pend = p + relcount;
@@ -1115,12 +1144,13 @@ warning_find_reloc (abfd, sec, iarg)
/*ARGSUSED*/
static boolean
-undefined_symbol (info, name, abfd, section, address)
- struct bfd_link_info *info;
+undefined_symbol (info, name, abfd, section, address, fatal)
+ struct bfd_link_info *info ATTRIBUTE_UNUSED;
const char *name;
bfd *abfd;
asection *section;
bfd_vma address;
+ boolean fatal;
{
static char *error_name;
static unsigned int error_count;
@@ -1138,14 +1168,14 @@ undefined_symbol (info, name, abfd, section, address)
hash = ((struct bfd_hash_table *)
xmalloc (sizeof (struct bfd_hash_table)));
if (! bfd_hash_table_init (hash, bfd_hash_newfunc))
- einfo ("%F%P: bfd_hash_table_init failed: %E\n");
+ einfo (_("%F%P: bfd_hash_table_init failed: %E\n"));
}
if (bfd_hash_lookup (hash, name, false, false) != NULL)
return true;
if (bfd_hash_lookup (hash, name, true, true) == NULL)
- einfo ("%F%P: bfd_hash_lookup failed: %E\n");
+ einfo (_("%F%P: bfd_hash_lookup failed: %E\n"));
}
/* We never print more than a reasonable number of errors in a row
@@ -1164,19 +1194,27 @@ undefined_symbol (info, name, abfd, section, address)
if (section != NULL)
{
if (error_count < MAX_ERRORS_IN_A_ROW)
- einfo ("%X%C: undefined reference to `%T'\n",
- abfd, section, address, name);
+ {
+ einfo (_("%C: undefined reference to `%T'\n"),
+ abfd, section, address, name);
+ if (fatal)
+ einfo ("%X");
+ }
else if (error_count == MAX_ERRORS_IN_A_ROW)
- einfo ("%D: more undefined references to `%T' follow\n",
+ einfo (_("%D: more undefined references to `%T' follow\n"),
abfd, section, address, name);
}
else
{
if (error_count < MAX_ERRORS_IN_A_ROW)
- einfo ("%X%B: undefined reference to `%T'\n",
- abfd, name);
+ {
+ einfo (_("%B: undefined reference to `%T'\n"),
+ abfd, name);
+ if (fatal)
+ einfo ("%X");
+ }
else if (error_count == MAX_ERRORS_IN_A_ROW)
- einfo ("%B: more undefined references to `%T' follow\n",
+ einfo (_("%B: more undefined references to `%T' follow\n"),
abfd, name);
}
@@ -1188,7 +1226,7 @@ undefined_symbol (info, name, abfd, section, address)
/*ARGSUSED*/
static boolean
reloc_overflow (info, name, reloc_name, addend, abfd, section, address)
- struct bfd_link_info *info;
+ struct bfd_link_info *info ATTRIBUTE_UNUSED;
const char *name;
const char *reloc_name;
bfd_vma addend;
@@ -1197,10 +1235,10 @@ reloc_overflow (info, name, reloc_name, addend, abfd, section, address)
bfd_vma address;
{
if (abfd == (bfd *) NULL)
- einfo ("%P%X: generated");
+ einfo (_("%P%X: generated"));
else
einfo ("%X%C:", abfd, section, address);
- einfo (" relocation truncated to fit: %s %T", reloc_name, name);
+ einfo (_(" relocation truncated to fit: %s %T"), reloc_name, name);
if (addend != 0)
einfo ("+%v", addend);
einfo ("\n");
@@ -1212,17 +1250,17 @@ reloc_overflow (info, name, reloc_name, addend, abfd, section, address)
/*ARGSUSED*/
static boolean
reloc_dangerous (info, message, abfd, section, address)
- struct bfd_link_info *info;
+ struct bfd_link_info *info ATTRIBUTE_UNUSED;
const char *message;
bfd *abfd;
asection *section;
bfd_vma address;
{
if (abfd == (bfd *) NULL)
- einfo ("%P%X: generated");
+ einfo (_("%P%X: generated"));
else
einfo ("%X%C:", abfd, section, address);
- einfo ("dangerous relocation: %s\n", message);
+ einfo (_("dangerous relocation: %s\n"), message);
return true;
}
@@ -1232,17 +1270,17 @@ reloc_dangerous (info, message, abfd, section, address)
/*ARGSUSED*/
static boolean
unattached_reloc (info, name, abfd, section, address)
- struct bfd_link_info *info;
+ struct bfd_link_info *info ATTRIBUTE_UNUSED;
const char *name;
bfd *abfd;
asection *section;
bfd_vma address;
{
if (abfd == (bfd *) NULL)
- einfo ("%P%X: generated");
+ einfo (_("%P%X: generated"));
else
einfo ("%X%C:", abfd, section, address);
- einfo (" reloc refers to symbol `%T' which is not being output\n", name);
+ einfo (_(" reloc refers to symbol `%T' which is not being output\n"), name);
return true;
}
@@ -1261,9 +1299,12 @@ notice (info, name, abfd, section, value)
if (! info->notice_all
|| (info->notice_hash != NULL
&& bfd_hash_lookup (info->notice_hash, name, false, false) != NULL))
- einfo ("%B: %s %s\n", abfd,
- bfd_is_und_section (section) ? "reference to" : "definition of",
- name);
+ {
+ if (bfd_is_und_section (section))
+ einfo ("%B: reference to %s\n", abfd, name);
+ else
+ einfo ("%B: definition of %s\n", abfd, name);
+ }
if (command_line.cref || nocrossref_list != NULL)
add_cref (name, abfd, section, value);
diff --git a/contrib/binutils/ld/ldmain.h b/contrib/binutils/ld/ldmain.h
index 5c5f38b..041bf3d 100644
--- a/contrib/binutils/ld/ldmain.h
+++ b/contrib/binutils/ld/ldmain.h
@@ -1,5 +1,5 @@
/* ldmain.h -
- Copyright 1991, 1992, 1993 Free Software Foundation, Inc.
+ Copyright 1991, 92, 93, 94, 95, 96, 1999 Free Software Foundation, Inc.
This file is part of GLD, the Gnu Linker.
@@ -14,8 +14,9 @@
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. */
+ 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 LDMAIN_H
#define LDMAIN_H
@@ -27,6 +28,7 @@ extern boolean trace_files;
extern boolean trace_file_tries;
extern boolean version_printed;
extern boolean whole_archive;
+extern boolean demangling;
extern int g_switch_value;
extern const char *output_filename;
extern struct bfd_link_info link_info;
diff --git a/contrib/binutils/ld/ldmisc.c b/contrib/binutils/ld/ldmisc.c
index a292d40..e343944 100644
--- a/contrib/binutils/ld/ldmisc.c
+++ b/contrib/binutils/ld/ldmisc.c
@@ -1,5 +1,6 @@
/* ldmisc.c
- Copyright (C) 1991, 92, 93, 94, 95, 96, 1997 Free Software Foundation, Inc.
+ Copyright (C) 1991, 92, 93, 94, 95, 96, 97, 98, 99, 2000
+ Free Software Foundation, Inc.
Written by Steve Chamberlain of Cygnus Support.
This file is part of GLD, the Gnu Linker.
@@ -173,8 +174,10 @@ vfinfo (fp, fmt, arg)
{
const char *name = va_arg (arg, const char *);
- if (name == (const char *) NULL)
- fprintf (fp, "no symbol");
+ if (name == (const char *) NULL || *name == 0)
+ fprintf (fp, _("no symbol"));
+ else if (! demangling)
+ fprintf (fp, "%s", name);
else
{
char *demangled;
@@ -210,7 +213,7 @@ vfinfo (fp, fmt, arg)
case 'E':
/* current bfd error or errno */
- fprintf (fp, bfd_errmsg (bfd_get_error ()));
+ fprintf (fp, "%s", bfd_errmsg (bfd_get_error ()));
break;
case 'I':
@@ -236,7 +239,7 @@ vfinfo (fp, fmt, arg)
else if (ldfile_input_filename != NULL)
fprintf (fp, "%s:%u", ldfile_input_filename, lineno);
else
- fprintf (fp, "built in linker script:%u", lineno);
+ fprintf (fp, _("built in linker script:%u"), lineno);
break;
case 'R':
@@ -286,11 +289,11 @@ vfinfo (fp, fmt, arg)
symsize = bfd_get_symtab_upper_bound (abfd);
if (symsize < 0)
- einfo ("%B%F: could not read symbols\n", abfd);
+ einfo (_("%B%F: could not read symbols\n"), abfd);
asymbols = (asymbol **) xmalloc (symsize);
symbol_count = bfd_canonicalize_symtab (abfd, asymbols);
if (symbol_count < 0)
- einfo ("%B%F: could not read symbols\n", abfd);
+ einfo (_("%B%F: could not read symbols\n"), abfd);
if (entry != (lang_input_statement_type *) NULL)
{
entry->asymbols = asymbols;
@@ -326,7 +329,7 @@ vfinfo (fp, fmt, arg)
/* We use abfd->filename in this initial line,
in case filename is a .h file or something
similarly unhelpful. */
- lfinfo (fp, "%B: In function `%T':\n",
+ lfinfo (fp, _("%B: In function `%T':\n"),
abfd, functionname);
last_bfd = abfd;
@@ -458,7 +461,7 @@ info_assert (file, line)
const char *file;
unsigned int line;
{
- einfo ("%F%P: internal error %s %d\n", file, line);
+ einfo (_("%F%P: internal error %s %d\n"), file, line);
}
char *
@@ -533,3 +536,22 @@ print_nl ()
{
fprintf (config.map_file, "\n");
}
+
+/* A more or less friendly abort message. In ld.h abort is defined to
+ call this function. */
+
+void
+ld_abort (file, line, fn)
+ const char *file;
+ int line;
+ const char *fn;
+{
+ if (fn != NULL)
+ einfo (_("%P: internal error: aborting at %s line %d in %s\n"),
+ file, line, fn);
+ else
+ einfo (_("%P: internal error: aborting at %s line %d\n"),
+ file, line);
+ einfo (_("%P%F: please report this bug\n"));
+ xexit (1);
+}
diff --git a/contrib/binutils/ld/ldver.c b/contrib/binutils/ld/ldver.c
index 6a5137b..5b600a2 100644
--- a/contrib/binutils/ld/ldver.c
+++ b/contrib/binutils/ld/ldver.c
@@ -1,5 +1,5 @@
/* ldver.c -- Print linker version.
- Copyright (C) 1991, 92, 93, 94, 95, 1996 Free Software Foundation, Inc.
+ Copyright (C) 1991, 92, 93, 94, 95, 1996, 1998 Free Software Foundation, Inc.
This file is part of GLD, the Gnu Linker.
@@ -32,14 +32,14 @@ void
ldversion (noisy)
int noisy;
{
- fprintf (stdout, "GNU ld version %s (with BFD %s)\n",
+ fprintf (stdout, _("GNU ld version %s (with BFD %s)\n"),
ld_program_version, BFD_VERSION);
if (noisy)
{
ld_emulation_xfer_type **ptr = ld_emulations;
- printf (" Supported emulations:\n");
+ printf (_(" Supported emulations:\n"));
while (*ptr)
{
printf (" %s\n", (*ptr)->emulation_name);
diff --git a/contrib/binutils/ld/ldwrite.c b/contrib/binutils/ld/ldwrite.c
index 0a18476..b56119a 100644
--- a/contrib/binutils/ld/ldwrite.c
+++ b/contrib/binutils/ld/ldwrite.c
@@ -56,7 +56,7 @@ build_link_order (statement)
link_order = bfd_new_link_order (output_bfd, output_section);
if (link_order == NULL)
- einfo ("%P%F: bfd_new_link_order failed\n");
+ einfo (_("%P%F: bfd_new_link_order failed\n"));
link_order->type = bfd_data_link_order;
link_order->offset = statement->data_statement.output_vma;
@@ -192,7 +192,7 @@ build_link_order (statement)
link_order = bfd_new_link_order (output_bfd, output_section);
if (link_order == NULL)
- einfo ("%P%F: bfd_new_link_order failed\n");
+ einfo (_("%P%F: bfd_new_link_order failed\n"));
link_order->offset = rs->output_vma;
link_order->size = bfd_get_reloc_size (rs->howto);
@@ -362,7 +362,7 @@ ds (s)
}
else
{
- printf ("%8x something else\n", l->offset);
+ printf (_("%8x something else\n"), l->offset);
}
l = l->next;
}
@@ -523,7 +523,7 @@ ldwrite ()
out. */
if (bfd_get_error () != bfd_error_no_error)
- einfo ("%F%P: final link failed: %E\n", output_bfd);
+ einfo (_("%F%P: final link failed: %E\n"), output_bfd);
else
xexit(1);
}
diff --git a/contrib/binutils/ld/lexsup.c b/contrib/binutils/ld/lexsup.c
index 257c2f8..7b5e89c 100644
--- a/contrib/binutils/ld/lexsup.c
+++ b/contrib/binutils/ld/lexsup.c
@@ -1,5 +1,5 @@
/* Parse options for the GNU linker.
- Copyright (C) 1991, 92, 93, 94, 95, 96, 97, 1998
+ Copyright (C) 1991, 92, 93, 94, 95, 96, 97, 98, 99, 2000
Free Software Foundation, Inc.
This file is part of GLD, the Gnu Linker.
@@ -55,6 +55,7 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA
that might disagree about consts. */
unsigned long strtoul ();
+static int is_num PARAMS ((const char *, int, int, int));
static void set_default_dirlist PARAMS ((char *dirlist_ptr));
static void set_section_start PARAMS ((char *sect, char *valstr));
static void help PARAMS ((void));
@@ -69,7 +70,8 @@ int parsing_defsym = 0;
#define OPTION_CALL_SHARED (OPTION_ASSERT + 1)
#define OPTION_CREF (OPTION_CALL_SHARED + 1)
#define OPTION_DEFSYM (OPTION_CREF + 1)
-#define OPTION_DYNAMIC_LINKER (OPTION_DEFSYM + 1)
+#define OPTION_DEMANGLE (OPTION_DEFSYM + 1)
+#define OPTION_DYNAMIC_LINKER (OPTION_DEMANGLE + 1)
#define OPTION_EB (OPTION_DYNAMIC_LINKER + 1)
#define OPTION_EL (OPTION_EB + 1)
#define OPTION_EMBEDDED_RELOCS (OPTION_EL + 1)
@@ -77,7 +79,8 @@ int parsing_defsym = 0;
#define OPTION_HELP (OPTION_EXPORT_DYNAMIC + 1)
#define OPTION_IGNORE (OPTION_HELP + 1)
#define OPTION_MAP (OPTION_IGNORE + 1)
-#define OPTION_NO_KEEP_MEMORY (OPTION_MAP + 1)
+#define OPTION_NO_DEMANGLE (OPTION_MAP + 1)
+#define OPTION_NO_KEEP_MEMORY (OPTION_NO_DEMANGLE + 1)
#define OPTION_NO_WARN_MISMATCH (OPTION_NO_KEEP_MEMORY + 1)
#define OPTION_NOINHIBIT_EXEC (OPTION_NO_WARN_MISMATCH + 1)
#define OPTION_NON_SHARED (OPTION_NOINHIBIT_EXEC + 1)
@@ -101,7 +104,8 @@ int parsing_defsym = 0;
#define OPTION_VERBOSE (OPTION_UR + 1)
#define OPTION_VERSION (OPTION_VERBOSE + 1)
#define OPTION_VERSION_SCRIPT (OPTION_VERSION + 1)
-#define OPTION_WARN_COMMON (OPTION_VERSION_SCRIPT + 1)
+#define OPTION_VERSION_EXPORTS_SECTION (OPTION_VERSION_SCRIPT + 1)
+#define OPTION_WARN_COMMON (OPTION_VERSION_EXPORTS_SECTION + 1)
#define OPTION_WARN_CONSTRUCTORS (OPTION_WARN_COMMON + 1)
#define OPTION_WARN_MULTIPLE_GP (OPTION_WARN_CONSTRUCTORS + 1)
#define OPTION_WARN_ONCE (OPTION_WARN_MULTIPLE_GP + 1)
@@ -111,6 +115,14 @@ int parsing_defsym = 0;
#define OPTION_WHOLE_ARCHIVE (OPTION_SPLIT_BY_FILE + 1)
#define OPTION_WRAP (OPTION_WHOLE_ARCHIVE + 1)
#define OPTION_FORCE_EXE_SUFFIX (OPTION_WRAP + 1)
+#define OPTION_GC_SECTIONS (OPTION_FORCE_EXE_SUFFIX + 1)
+#define OPTION_NO_GC_SECTIONS (OPTION_GC_SECTIONS + 1)
+#define OPTION_CHECK_SECTIONS (OPTION_NO_GC_SECTIONS + 1)
+#define OPTION_NO_CHECK_SECTIONS (OPTION_CHECK_SECTIONS + 1)
+#define OPTION_MPC860C0 (OPTION_NO_CHECK_SECTIONS + 1)
+#define OPTION_NO_UNDEFINED (OPTION_MPC860C0 + 1)
+#define OPTION_INIT (OPTION_NO_UNDEFINED + 1)
+#define OPTION_FINI (OPTION_INIT + 1)
/* The long options. This structure is used for both the option
parsing and the help text. */
@@ -140,96 +152,104 @@ struct ld_option
static const struct ld_option ld_options[] =
{
{ {NULL, required_argument, NULL, '\0'},
- 'a', "KEYWORD", "Shared library control for HP/UX compatibility",
+ 'a', N_("KEYWORD"), N_("Shared library control for HP/UX compatibility"),
ONE_DASH },
{ {"architecture", required_argument, NULL, 'A'},
- 'A', "ARCH", "Set architecture" , TWO_DASHES },
+ 'A', N_("ARCH"), N_("Set architecture") , TWO_DASHES },
{ {"format", required_argument, NULL, 'b'},
- 'b', "TARGET", "Specify target for following input files", TWO_DASHES },
+ 'b', N_("TARGET"), N_("Specify target for following input files"), TWO_DASHES },
{ {"mri-script", required_argument, NULL, 'c'},
- 'c', "FILE", "Read MRI format linker script", TWO_DASHES },
+ 'c', N_("FILE"), N_("Read MRI format linker script"), TWO_DASHES },
{ {"dc", no_argument, NULL, 'd'},
- 'd', NULL, "Force common symbols to be defined", ONE_DASH },
+ 'd', NULL, N_("Force common symbols to be defined"), ONE_DASH },
{ {"dp", no_argument, NULL, 'd'},
'\0', NULL, NULL, ONE_DASH },
{ {"entry", required_argument, NULL, 'e'},
- 'e', "ADDRESS", "Set start address", TWO_DASHES },
+ 'e', N_("ADDRESS"), N_("Set start address"), TWO_DASHES },
{ {"export-dynamic", no_argument, NULL, OPTION_EXPORT_DYNAMIC},
- 'E', NULL, "Export all dynamic symbols", TWO_DASHES },
+ 'E', NULL, N_("Export all dynamic symbols"), TWO_DASHES },
+ { {"EB", no_argument, NULL, OPTION_EB},
+ '\0', NULL, N_("Link big-endian objects"), ONE_DASH },
+ { {"EL", no_argument, NULL, OPTION_EL},
+ '\0', NULL, N_("Link little-endian objects"), ONE_DASH },
{ {"auxiliary", required_argument, NULL, 'f'},
- 'f', "SHLIB", "Auxiliary filter for shared object symbol table",
+ 'f', N_("SHLIB"), N_("Auxiliary filter for shared object symbol table"),
TWO_DASHES },
{ {"filter", required_argument, NULL, 'F'},
- 'F', "SHLIB", "Filter for shared object symbol table", TWO_DASHES },
+ 'F', N_("SHLIB"), N_("Filter for shared object symbol table"), TWO_DASHES },
{ {NULL, no_argument, NULL, '\0'},
- 'g', NULL, "Ignored", ONE_DASH },
+ 'g', NULL, N_("Ignored"), ONE_DASH },
{ {"gpsize", required_argument, NULL, 'G'},
- 'G', "SIZE", "Small data size (if no size, same as --shared)",
+ 'G', N_("SIZE"), N_("Small data size (if no size, same as --shared)"),
TWO_DASHES },
{ {"soname", required_argument, NULL, OPTION_SONAME},
- 'h', "FILENAME", "Set internal name of shared library", ONE_DASH },
+ 'h', N_("FILENAME"), N_("Set internal name of shared library"), ONE_DASH },
{ {"library", required_argument, NULL, 'l'},
- 'l', "LIBNAME", "Search for library LIBNAME", TWO_DASHES },
+ 'l', N_("LIBNAME"), N_("Search for library LIBNAME"), TWO_DASHES },
{ {"library-path", required_argument, NULL, 'L'},
- 'L', "DIRECTORY", "Add DIRECTORY to library search path", TWO_DASHES },
+ 'L', N_("DIRECTORY"), N_("Add DIRECTORY to library search path"), TWO_DASHES },
{ {NULL, required_argument, NULL, '\0'},
- 'm', "EMULATION", "Set emulation", ONE_DASH },
+ 'm', N_("EMULATION"), N_("Set emulation"), ONE_DASH },
{ {"print-map", no_argument, NULL, 'M'},
- 'M', NULL, "Print map file on standard output", TWO_DASHES },
+ 'M', NULL, N_("Print map file on standard output"), TWO_DASHES },
{ {"nmagic", no_argument, NULL, 'n'},
- 'n', NULL, "Do not page align data", TWO_DASHES },
+ 'n', NULL, N_("Do not page align data"), TWO_DASHES },
{ {"omagic", no_argument, NULL, 'N'},
- 'N', NULL, "Do not page align data, do not make text readonly",
+ 'N', NULL, N_("Do not page align data, do not make text readonly"),
TWO_DASHES },
{ {"output", required_argument, NULL, 'o'},
- 'o', "FILE", "Set output file name", TWO_DASHES },
+ 'o', N_("FILE"), N_("Set output file name"), TWO_DASHES },
{ {NULL, required_argument, NULL, '\0'},
- 'O', NULL, "Ignored", ONE_DASH },
+ 'O', NULL, N_("Optimize output file"), ONE_DASH },
+ { {"Qy", no_argument, NULL, OPTION_IGNORE},
+ '\0', NULL, N_("Ignored for SVR4 compatibility"), ONE_DASH },
{ {"relocateable", no_argument, NULL, 'r'},
- 'r', NULL, "Generate relocateable output", TWO_DASHES },
+ 'r', NULL, N_("Generate relocateable output"), TWO_DASHES },
{ {NULL, no_argument, NULL, '\0'},
'i', NULL, NULL, ONE_DASH },
{ {"just-symbols", required_argument, NULL, 'R'},
- 'R', "FILE", "Just link symbols (if directory, same as --rpath)",
+ 'R', N_("FILE"), N_("Just link symbols (if directory, same as --rpath)"),
TWO_DASHES },
{ {"strip-all", no_argument, NULL, 's'},
- 's', NULL, "Strip all symbols", TWO_DASHES },
+ 's', NULL, N_("Strip all symbols"), TWO_DASHES },
{ {"strip-debug", no_argument, NULL, 'S'},
- 'S', NULL, "Strip debugging symbols", TWO_DASHES },
+ 'S', NULL, N_("Strip debugging symbols"), TWO_DASHES },
{ {"trace", no_argument, NULL, 't'},
- 't', NULL, "Trace file opens", TWO_DASHES },
+ 't', NULL, N_("Trace file opens"), TWO_DASHES },
{ {"script", required_argument, NULL, 'T'},
- 'T', "FILE", "Read linker script", TWO_DASHES },
+ 'T', N_("FILE"), N_("Read linker script"), TWO_DASHES },
{ {"undefined", required_argument, NULL, 'u'},
- 'u', "SYMBOL", "Start with undefined reference to SYMBOL", TWO_DASHES },
+ 'u', N_("SYMBOL"), N_("Start with undefined reference to SYMBOL"), TWO_DASHES },
+ { {"Ur", no_argument, NULL, OPTION_UR},
+ '\0', NULL, N_("Build global constructor/destructor tables"), ONE_DASH },
{ {"version", no_argument, NULL, OPTION_VERSION},
- 'v', NULL, "Print version information", TWO_DASHES },
+ 'v', NULL, N_("Print version information"), TWO_DASHES },
{ {NULL, no_argument, NULL, '\0'},
- 'V', NULL, "Print version and emulation information", ONE_DASH },
+ 'V', NULL, N_("Print version and emulation information"), ONE_DASH },
{ {"discard-all", no_argument, NULL, 'x'},
- 'x', NULL, "Discard all local symbols", TWO_DASHES },
+ 'x', NULL, N_("Discard all local symbols"), TWO_DASHES },
{ {"discard-locals", no_argument, NULL, 'X'},
- 'X', NULL, "Discard temporary local symbols", TWO_DASHES },
+ 'X', NULL, N_("Discard temporary local symbols"), TWO_DASHES },
{ {"trace-symbol", required_argument, NULL, 'y'},
- 'y', "SYMBOL", "Trace mentions of SYMBOL", TWO_DASHES },
+ 'y', N_("SYMBOL"), N_("Trace mentions of SYMBOL"), TWO_DASHES },
{ {NULL, required_argument, NULL, '\0'},
- 'Y', "PATH", "Default search path for Solaris compatibility", ONE_DASH },
+ 'Y', N_("PATH"), N_("Default search path for Solaris compatibility"), ONE_DASH },
{ {NULL, required_argument, NULL, '\0'},
- 'z', "KEYWORD", "Ignored for Solaris compatibility", ONE_DASH },
+ 'z', N_("KEYWORD"), N_("Ignored for Solaris compatibility"), ONE_DASH },
{ {"start-group", no_argument, NULL, '('},
- '(', NULL, "Start a group", TWO_DASHES },
+ '(', NULL, N_("Start a group"), TWO_DASHES },
{ {"end-group", no_argument, NULL, ')'},
- ')', NULL, "End a group", TWO_DASHES },
+ ')', NULL, N_("End a group"), TWO_DASHES },
{ {"assert", required_argument, NULL, OPTION_ASSERT},
- '\0', "KEYWORD", "Ignored for SunOS compatibility", ONE_DASH },
+ '\0', N_("KEYWORD"), N_("Ignored for SunOS compatibility"), ONE_DASH },
{ {"Bdynamic", no_argument, NULL, OPTION_CALL_SHARED},
- '\0', NULL, "Link against shared libraries", ONE_DASH },
+ '\0', NULL, N_("Link against shared libraries"), ONE_DASH },
{ {"dy", no_argument, NULL, OPTION_CALL_SHARED},
'\0', NULL, NULL, ONE_DASH },
{ {"call_shared", no_argument, NULL, OPTION_CALL_SHARED},
'\0', NULL, NULL, ONE_DASH },
{ {"Bstatic", no_argument, NULL, OPTION_NON_SHARED},
- '\0', NULL, "Do not link against shared libraries", ONE_DASH },
+ '\0', NULL, N_("Do not link against shared libraries"), ONE_DASH },
{ {"dn", no_argument, NULL, OPTION_NON_SHARED},
'\0', NULL, NULL, ONE_DASH },
{ {"non_shared", no_argument, NULL, OPTION_NON_SHARED},
@@ -237,102 +257,148 @@ static const struct ld_option ld_options[] =
{ {"static", no_argument, NULL, OPTION_NON_SHARED},
'\0', NULL, NULL, ONE_DASH },
{ {"Bsymbolic", no_argument, NULL, OPTION_SYMBOLIC},
- '\0', NULL, "Bind global references locally", ONE_DASH },
+ '\0', NULL, N_("Bind global references locally"), ONE_DASH },
+ { {"check-sections", no_argument, NULL, OPTION_CHECK_SECTIONS},
+ '\0', NULL, N_("Check section addresses for overlaps (default)"), TWO_DASHES },
+ { {"no-check-sections", no_argument, NULL, OPTION_NO_CHECK_SECTIONS},
+ '\0', NULL, N_("Do not check section addresses for overlaps"),
+ TWO_DASHES },
{ {"cref", no_argument, NULL, OPTION_CREF},
- '\0', NULL, "Output cross reference table", TWO_DASHES },
+ '\0', NULL, N_("Output cross reference table"), TWO_DASHES },
{ {"defsym", required_argument, NULL, OPTION_DEFSYM},
- '\0', "SYMBOL=EXPRESSION", "Define a symbol", TWO_DASHES },
+ '\0', N_("SYMBOL=EXPRESSION"), N_("Define a symbol"), TWO_DASHES },
+ { {"demangle", no_argument, NULL, OPTION_DEMANGLE},
+ '\0', NULL, N_("Demangle symbol names"), TWO_DASHES },
{ {"dynamic-linker", required_argument, NULL, OPTION_DYNAMIC_LINKER},
- '\0', "PROGRAM", "Set the dynamic linker to use", TWO_DASHES },
- { {"EB", no_argument, NULL, OPTION_EB},
- '\0', NULL, "Link big-endian objects", ONE_DASH },
- { {"EL", no_argument, NULL, OPTION_EL},
- '\0', NULL, "Link little-endian objects", ONE_DASH },
+ '\0', N_("PROGRAM"), N_("Set the dynamic linker to use"), TWO_DASHES },
{ {"embedded-relocs", no_argument, NULL, OPTION_EMBEDDED_RELOCS},
- '\0', NULL, "Generate embedded relocs", TWO_DASHES},
+ '\0', NULL, N_("Generate embedded relocs"), TWO_DASHES},
+ { {"fini", required_argument, NULL, OPTION_FINI},
+ '\0', N_("SYMBOL"), N_("Call SYMBOL at unload-time"), ONE_DASH },
{ {"force-exe-suffix", no_argument, NULL, OPTION_FORCE_EXE_SUFFIX},
- '\0', NULL, "Force generation of file with .exe suffix", TWO_DASHES},
+ '\0', NULL, N_("Force generation of file with .exe suffix"), TWO_DASHES},
+ { {"gc-sections", no_argument, NULL, OPTION_GC_SECTIONS},
+ '\0', NULL, N_("Remove unused sections (on some targets)"),
+ TWO_DASHES },
+ { {"no-gc-sections", no_argument, NULL, OPTION_NO_GC_SECTIONS},
+ '\0', NULL, N_("Don't remove unused sections (default)"),
+ TWO_DASHES },
{ {"help", no_argument, NULL, OPTION_HELP},
- '\0', NULL, "Print option help", TWO_DASHES },
+ '\0', NULL, N_("Print option help"), TWO_DASHES },
+ { {"init", required_argument, NULL, OPTION_INIT},
+ '\0', N_("SYMBOL"), N_("Call SYMBOL at load-time"), ONE_DASH },
{ {"Map", required_argument, NULL, OPTION_MAP},
- '\0', "FILE", "Write a map file", ONE_DASH },
+ '\0', N_("FILE"), N_("Write a map file"), ONE_DASH },
+ { {"no-demangle", no_argument, NULL, OPTION_NO_DEMANGLE },
+ '\0', NULL, N_("Do not demangle symbol names"), TWO_DASHES },
{ {"no-keep-memory", no_argument, NULL, OPTION_NO_KEEP_MEMORY},
- '\0', NULL, "Use less memory and more disk I/O", TWO_DASHES },
+ '\0', NULL, N_("Use less memory and more disk I/O"), TWO_DASHES },
+ { {"no-undefined", no_argument, NULL, OPTION_NO_UNDEFINED},
+ '\0', NULL, N_("Allow no undefined symbols"), TWO_DASHES },
{ {"no-warn-mismatch", no_argument, NULL, OPTION_NO_WARN_MISMATCH},
- '\0', NULL, "Don't warn about mismatched input files", TWO_DASHES},
+ '\0', NULL, N_("Don't warn about mismatched input files"), TWO_DASHES},
{ {"no-whole-archive", no_argument, NULL, OPTION_NO_WHOLE_ARCHIVE},
- '\0', NULL, "Turn off --whole-archive", TWO_DASHES },
+ '\0', NULL, N_("Turn off --whole-archive"), TWO_DASHES },
{ {"noinhibit-exec", no_argument, NULL, OPTION_NOINHIBIT_EXEC},
- '\0', NULL, "Create an output file even if errors occur", TWO_DASHES },
+ '\0', NULL, N_("Create an output file even if errors occur"), TWO_DASHES },
{ {"noinhibit_exec", no_argument, NULL, OPTION_NOINHIBIT_EXEC},
'\0', NULL, NULL, NO_HELP },
{ {"oformat", required_argument, NULL, OPTION_OFORMAT},
- '\0', "TARGET", "Specify target of output file", TWO_DASHES },
+ '\0', N_("TARGET"), N_("Specify target of output file"), TWO_DASHES },
{ {"qmagic", no_argument, NULL, OPTION_IGNORE},
- '\0', NULL, "Ignored for Linux compatibility", ONE_DASH },
- { {"Qy", no_argument, NULL, OPTION_IGNORE},
- '\0', NULL, "Ignored for SVR4 compatibility", ONE_DASH },
+ '\0', NULL, N_("Ignored for Linux compatibility"), ONE_DASH },
{ {"relax", no_argument, NULL, OPTION_RELAX},
- '\0', NULL, "Relax branches on certain targets", TWO_DASHES },
+ '\0', NULL, N_("Relax branches on certain targets"), TWO_DASHES },
{ {"retain-symbols-file", required_argument, NULL,
OPTION_RETAIN_SYMBOLS_FILE},
- '\0', "FILE", "Keep only symbols listed in FILE", TWO_DASHES },
+ '\0', N_("FILE"), N_("Keep only symbols listed in FILE"), TWO_DASHES },
{ {"rpath", required_argument, NULL, OPTION_RPATH},
- '\0', "PATH", "Set runtime shared library search path", ONE_DASH },
+ '\0', N_("PATH"), N_("Set runtime shared library search path"), ONE_DASH },
{ {"rpath-link", required_argument, NULL, OPTION_RPATH_LINK},
- '\0', "PATH", "Set link time shared library search path", ONE_DASH },
+ '\0', N_("PATH"), N_("Set link time shared library search path"), ONE_DASH },
{ {"shared", no_argument, NULL, OPTION_SHARED},
- '\0', NULL, "Create a shared library", ONE_DASH },
+ '\0', NULL, N_("Create a shared library"), ONE_DASH },
{ {"Bshareable", no_argument, NULL, OPTION_SHARED }, /* FreeBSD. */
'\0', NULL, NULL, ONE_DASH },
{ {"sort-common", no_argument, NULL, OPTION_SORT_COMMON},
- '\0', NULL, "Sort common symbols by size", TWO_DASHES },
+ '\0', NULL, N_("Sort common symbols by size"), TWO_DASHES },
{ {"sort_common", no_argument, NULL, OPTION_SORT_COMMON},
'\0', NULL, NULL, NO_HELP },
{ {"split-by-file", no_argument, NULL, OPTION_SPLIT_BY_FILE},
- '\0', NULL, "Split output sections for each file", TWO_DASHES },
+ '\0', NULL, N_("Split output sections for each file"), TWO_DASHES },
{ {"split-by-reloc", required_argument, NULL, OPTION_SPLIT_BY_RELOC},
- '\0', "COUNT", "Split output sections every COUNT relocs", TWO_DASHES },
+ '\0', N_("COUNT"), N_("Split output sections every COUNT relocs"), TWO_DASHES },
{ {"stats", no_argument, NULL, OPTION_STATS},
- '\0', NULL, "Print memory usage statistics", TWO_DASHES },
+ '\0', NULL, N_("Print memory usage statistics"), TWO_DASHES },
{ {"task-link", required_argument, NULL, OPTION_TASK_LINK},
- '\0', "SYMBOL", "Do task level linking", TWO_DASHES },
+ '\0', N_("SYMBOL"), N_("Do task level linking"), TWO_DASHES },
{ {"traditional-format", no_argument, NULL, OPTION_TRADITIONAL_FORMAT},
- '\0', NULL, "Use same format as native linker", TWO_DASHES },
+ '\0', NULL, N_("Use same format as native linker"), TWO_DASHES },
{ {"Tbss", required_argument, NULL, OPTION_TBSS},
- '\0', "ADDRESS", "Set address of .bss section", ONE_DASH },
+ '\0', N_("ADDRESS"), N_("Set address of .bss section"), ONE_DASH },
{ {"Tdata", required_argument, NULL, OPTION_TDATA},
- '\0', "ADDRESS", "Set address of .data section", ONE_DASH },
+ '\0', N_("ADDRESS"), N_("Set address of .data section"), ONE_DASH },
{ {"Ttext", required_argument, NULL, OPTION_TTEXT},
- '\0', "ADDRESS", "Set address of .text section", ONE_DASH },
- { {"Ur", no_argument, NULL, OPTION_UR},
- '\0', NULL, "Build global constructor/destructor tables", ONE_DASH },
+ '\0', N_("ADDRESS"), N_("Set address of .text section"), ONE_DASH },
{ {"verbose", no_argument, NULL, OPTION_VERBOSE},
- '\0', NULL, "Output lots of information during link", TWO_DASHES },
+ '\0', NULL, N_("Output lots of information during link"), TWO_DASHES },
{ {"dll-verbose", no_argument, NULL, OPTION_VERBOSE}, /* Linux. */
'\0', NULL, NULL, NO_HELP },
{ {"version-script", required_argument, NULL, OPTION_VERSION_SCRIPT },
- '\0', "FILE", "Read version information script", TWO_DASHES },
+ '\0', N_("FILE"), N_("Read version information script"), TWO_DASHES },
+ { {"version-exports-section", required_argument, NULL,
+ OPTION_VERSION_EXPORTS_SECTION },
+ '\0', N_("SYMBOL"), N_("Take export symbols list from .exports, using\n\t\t\t\tSYMBOL as the version."),
+ TWO_DASHES },
{ {"warn-common", no_argument, NULL, OPTION_WARN_COMMON},
- '\0', NULL, "Warn about duplicate common symbols", TWO_DASHES },
+ '\0', NULL, N_("Warn about duplicate common symbols"), TWO_DASHES },
{ {"warn-constructors", no_argument, NULL, OPTION_WARN_CONSTRUCTORS},
- '\0', NULL, "Warn if global constructors/destructors are seen",
+ '\0', NULL, N_("Warn if global constructors/destructors are seen"),
TWO_DASHES },
{ {"warn-multiple-gp", no_argument, NULL, OPTION_WARN_MULTIPLE_GP},
- '\0', NULL, "Warn if the multiple GP values are used", TWO_DASHES },
+ '\0', NULL, N_("Warn if the multiple GP values are used"), TWO_DASHES },
{ {"warn-once", no_argument, NULL, OPTION_WARN_ONCE},
- '\0', NULL, "Warn only once per undefined symbol", TWO_DASHES },
+ '\0', NULL, N_("Warn only once per undefined symbol"), TWO_DASHES },
{ {"warn-section-align", no_argument, NULL, OPTION_WARN_SECTION_ALIGN},
- '\0', NULL, "Warn if start of section changes due to alignment",
+ '\0', NULL, N_("Warn if start of section changes due to alignment"),
TWO_DASHES },
{ {"whole-archive", no_argument, NULL, OPTION_WHOLE_ARCHIVE},
- '\0', NULL, "Include all objects from following archives", TWO_DASHES },
+ '\0', NULL, N_("Include all objects from following archives"), TWO_DASHES },
{ {"wrap", required_argument, NULL, OPTION_WRAP},
- '\0', "SYMBOL", "Use wrapper functions for SYMBOL", TWO_DASHES }
+ '\0', N_("SYMBOL"), N_("Use wrapper functions for SYMBOL"), TWO_DASHES },
+ { {"mpc860c0", optional_argument, NULL, OPTION_MPC860C0},
+ '\0', N_("[=WORDS]"), N_("Modify problematic branches in last WORDS (1-10,\n\t\t\t\tdefault 5) words of a page"), TWO_DASHES }
};
#define OPTION_COUNT ((int) (sizeof ld_options / sizeof ld_options[0]))
+/* Test STRING for containing a string of digits that form a number
+ between MIN and MAX. The return value is the number or ERR. */
+
+static int
+is_num (string, min, max, err)
+ const char *string;
+ int min;
+ int max;
+ int err;
+{
+ int result = 0;
+
+ for (; *string; ++string)
+ {
+ if (! isdigit (*string))
+ {
+ result = err;
+ break;
+ }
+ result = result * 10 + (*string - '0');
+ }
+ if (result < min || result > max)
+ result = err;
+
+ return result;
+}
+
void
parse_args (argc, argv)
int argc;
@@ -396,11 +462,35 @@ parse_args (argc, argv)
|| ! isdigit ((unsigned char) argv[i + 1][0])))
argv[i] = (char *) "--shared";
+ /* Because we permit long options to start with a single dash, and
+ we have a --library option, and the -l option is conventionally
+ used with an immediately following argument, we can have bad
+ results if somebody tries to use -l with a library whose name
+ happens to start with "ibrary", as in -li. We avoid problems by
+ simply turning -l into --library. This means that users will
+ have to use two dashes in order to use --library, which is OK
+ since that's how it is documented.
+
+ FIXME: It's possible that this problem can arise for other short
+ options as well, although the user does always have the recourse
+ of adding a space between the option and the argument. */
+ for (i = 1; i < argc; i++)
+ {
+ if (argv[i][0] == '-'
+ && argv[i][1] == 'l'
+ && argv[i][2] != '\0')
+ {
+ char *n;
+
+ n = (char *) xmalloc (strlen (argv[i]) + 20);
+ sprintf (n, "--library=%s", argv[i] + 2);
+ argv[i] = n;
+ }
+ }
+
last_optind = -1;
while (1)
{
- /* getopt_long_only is like getopt_long, but '-' as well as '--' can
- indicate a long option. */
int longind;
int optc;
@@ -417,6 +507,8 @@ parse_args (argc, argv)
last_optind = optind;
}
+ /* getopt_long_only is like getopt_long, but '-' as well as '--'
+ can indicate a long option. */
optc = getopt_long_only (argc, argv, shortopts, longopts, &longind);
if (optc == -1)
@@ -424,6 +516,9 @@ parse_args (argc, argv)
switch (optc)
{
default:
+ fprintf (stderr,
+ _("%s: use the --help option for usage information\n"),
+ program_name);
xexit (1);
case 1: /* File name. */
lang_add_input_file (optarg, lang_input_file_is_file_enum,
@@ -442,7 +537,7 @@ parse_args (argc, argv)
|| strcmp (optarg, "default") == 0)
config.dynamic_link = true;
else
- einfo ("%P%F: unrecognized -a option `%s'\n", optarg);
+ einfo (_("%P%F: unrecognized -a option `%s'\n"), optarg);
break;
case OPTION_ASSERT:
/* FIXME: We just ignore these, but we should handle them. */
@@ -455,7 +550,7 @@ parse_args (argc, argv)
else if (strcmp (optarg, "pure-text") == 0)
;
else
- einfo ("%P%F: unrecognized -assert option `%s'\n", optarg);
+ einfo (_("%P%F: unrecognized -assert option `%s'\n"), optarg);
break;
case 'A':
ldfile_add_arch (optarg);
@@ -490,6 +585,9 @@ parse_args (argc, argv)
parsing_defsym = 0;
lex_string = NULL;
break;
+ case OPTION_DEMANGLE:
+ demangling = true;
+ break;
case OPTION_DYNAMIC_LINKER:
command_line.interpreter = optarg;
break;
@@ -543,12 +641,15 @@ parse_args (argc, argv)
char *end;
g_switch_value = strtoul (optarg, &end, 0);
if (*end)
- einfo ("%P%F: invalid number `%s'\n", optarg);
+ einfo (_("%P%F: invalid number `%s'\n"), optarg);
}
break;
case 'g':
/* Ignore. */
break;
+ case OPTION_GC_SECTIONS:
+ command_line.gc_sections = true;
+ break;
case OPTION_HELP:
help ();
xexit (0);
@@ -578,9 +679,18 @@ parse_args (argc, argv)
config.magic_demand_paged = false;
config.dynamic_link = false;
break;
+ case OPTION_NO_DEMANGLE:
+ demangling = false;
+ break;
+ case OPTION_NO_GC_SECTIONS:
+ command_line.gc_sections = false;
+ break;
case OPTION_NO_KEEP_MEMORY:
link_info.keep_memory = false;
break;
+ case OPTION_NO_UNDEFINED:
+ link_info.no_undefined = true;
+ break;
case OPTION_NO_WARN_MISMATCH:
command_line.warn_mismatch = false;
break;
@@ -596,6 +706,9 @@ parse_args (argc, argv)
something, or can we create a new option to do that
(with a syntax similar to -defsym)?
getopt can't handle two args to an option without kludges. */
+
+ /* Enable optimizations of output files. */
+ link_info.optimize = strtoul (optarg, NULL, 0) ? true : false;
break;
case 'o':
lang_add_output (optarg, 0);
@@ -637,14 +750,36 @@ parse_args (argc, argv)
command_line.rpath = buystring (optarg);
else
{
+ size_t rpath_len = strlen (command_line.rpath);
+ size_t optarg_len = strlen (optarg);
char *buf;
+ char *cp = command_line.rpath;
- buf = xmalloc (strlen (command_line.rpath)
- + strlen (optarg)
- + 2);
- sprintf (buf, "%s:%s", command_line.rpath, optarg);
- free (command_line.rpath);
- command_line.rpath = buf;
+ /* First see whether OPTARG is already in the path. */
+ do
+ {
+ size_t idx = 0;
+ while (optarg[idx] != '\0' && optarg[idx] == cp[idx])
+ ++idx;
+ if (optarg[idx] == '\0'
+ && (cp[idx] == '\0' || cp[idx] == ':'))
+ /* We found it. */
+ break;
+
+ /* Not yet found. */
+ cp = strchr (cp, ':');
+ if (cp != NULL)
+ ++cp;
+ }
+ while (cp != NULL);
+
+ if (cp == NULL)
+ {
+ buf = xmalloc (rpath_len + optarg_len + 2);
+ sprintf (buf, "%s:%s", command_line.rpath, optarg);
+ free (command_line.rpath);
+ command_line.rpath = buf;
+ }
}
break;
case OPTION_RPATH_LINK:
@@ -675,7 +810,10 @@ parse_args (argc, argv)
link_info.strip = strip_all;
break;
case OPTION_SHARED:
- link_info.shared = true;
+ if (config.has_shared)
+ link_info.shared = true;
+ else
+ einfo (_("%P%F: -shared not supported\n"));
break;
case 'h': /* Used on Solaris. */
case OPTION_SONAME:
@@ -739,14 +877,14 @@ parse_args (argc, argv)
case OPTION_VERSION:
/* This output is intended to follow the GNU standards document. */
printf ("GNU ld %s\n", ld_program_version);
- printf ("Copyright 1997 Free Software Foundation, Inc.\n");
- printf ("\
+ printf (_("Copyright 1997 Free Software Foundation, Inc.\n"));
+ printf (_("\
This program is free software; you may redistribute it under the terms of\n\
-the GNU General Public License. This program has absolutely no warranty.\n");
+the GNU General Public License. This program has absolutely no warranty.\n"));
{
ld_emulation_xfer_type **ptr = ld_emulations;
- printf (" Supported emulations:\n");
+ printf (_(" Supported emulations:\n"));
while (*ptr)
{
printf (" %s\n", (*ptr)->emulation_name);
@@ -769,6 +907,12 @@ the GNU General Public License. This program has absolutely no warranty.\n");
yyparse ();
}
break;
+ case OPTION_VERSION_EXPORTS_SECTION:
+ /* This option records a version symbol to be applied to the
+ symbols listed for export to be found in the object files
+ .exports sections. */
+ command_line.version_exports_section = optarg;
+ break;
case OPTION_WARN_COMMON:
config.warn_common = true;
break;
@@ -810,16 +954,22 @@ the GNU General Public License. This program has absolutely no warranty.\n");
ignored. Someday we should handle it correctly. FIXME. */
break;
case OPTION_SPLIT_BY_RELOC:
- config.split_by_reloc = atoi (optarg);
+ config.split_by_reloc = strtoul (optarg, NULL, 0);
break;
case OPTION_SPLIT_BY_FILE:
config.split_by_file = true;
break;
+ case OPTION_CHECK_SECTIONS:
+ command_line.check_section_addresses = true;
+ break;
+ case OPTION_NO_CHECK_SECTIONS:
+ command_line.check_section_addresses = false;
+ break;
case '(':
if (ingroup)
{
fprintf (stderr,
- "%s: may not nest groups (--help for usage)\n",
+ _("%s: may not nest groups (--help for usage)\n"),
program_name);
xexit (1);
}
@@ -830,14 +980,39 @@ the GNU General Public License. This program has absolutely no warranty.\n");
if (! ingroup)
{
fprintf (stderr,
- "%s: group ended before it began (--help for usage)\n",
+ _("%s: group ended before it began (--help for usage)\n"),
program_name);
xexit (1);
}
lang_leave_group ();
ingroup = 0;
break;
+ case OPTION_MPC860C0:
+ link_info.mpc860c0 = 20; /* default value (in bytes) */
+ if (optarg)
+ {
+ unsigned words;
+ words = is_num (optarg, 1, 10, 0);
+ if (words == 0)
+ {
+ fprintf (stderr,
+ _("%s: Invalid argument to option \"mpc860c0\"\n"),
+ program_name);
+ xexit (1);
+ }
+ link_info.mpc860c0 = words * 4; /* convert words to bytes */
+ }
+ command_line.relax = true;
+ break;
+
+ case OPTION_INIT:
+ link_info.init_function = optarg;
+ break;
+
+ case OPTION_FINI:
+ link_info.fini_function = optarg;
+ break;
}
}
@@ -875,10 +1050,10 @@ static void
set_section_start (sect, valstr)
char *sect, *valstr;
{
- char *end;
- unsigned long val = strtoul (valstr, &end, 16);
+ const char *end;
+ bfd_vma val = bfd_scan_vma (valstr, &end, 16);
if (*end)
- einfo ("%P%F: invalid hex number `%s'\n", valstr);
+ einfo (_("%P%F: invalid hex number `%s'\n"), valstr);
lang_section_start (sect, exp_intop (val));
}
@@ -890,9 +1065,9 @@ help ()
int i;
const char **targets, **pp;
- printf ("Usage: %s [options] file...\n", program_name);
+ printf (_("Usage: %s [options] file...\n"), program_name);
- printf ("Options:\n");
+ printf (_("Options:\n"));
for (i = 0; i < OPTION_COUNT; i++)
{
if (ld_options[i].doc != NULL)
@@ -921,8 +1096,8 @@ help ()
printf (" ");
++len;
}
- printf ("%s", ld_options[j].arg);
- len += strlen (ld_options[j].arg);
+ printf ("%s", _(ld_options[j].arg));
+ len += strlen (_(ld_options[j].arg));
}
comma = true;
}
@@ -946,8 +1121,8 @@ help ()
+ strlen (ld_options[j].opt.name));
if (ld_options[j].arg != NULL)
{
- printf (" %s", ld_options[j].arg);
- len += 1 + strlen (ld_options[j].arg);
+ printf (" %s", _(ld_options[j].arg));
+ len += 1 + strlen (_(ld_options[j].arg));
}
comma = true;
}
@@ -964,19 +1139,29 @@ help ()
for (; len < 30; len++)
putchar (' ');
- printf ("%s\n", ld_options[i].doc);
+ printf ("%s\n", _(ld_options[i].doc));
}
}
- printf ("%s: supported targets:", program_name);
+ /* Note: Various tools (such as libtool) depend upon the
+ format of the listings below - do not change them. */
+ /* xgettext:c-format */
+ printf (_("%s: supported targets:"), program_name);
targets = bfd_target_list ();
for (pp = targets; *pp != NULL; pp++)
printf (" %s", *pp);
free (targets);
printf ("\n");
- printf ("%s: supported emulations: ", program_name);
+ /* xgettext:c-format */
+ printf (_("%s: supported emulations: "), program_name);
ldemul_list_emulations (stdout);
printf ("\n");
- printf ("\nReport bugs to bug-gnu-utils@gnu.org\n");
+
+ /* xgettext:c-format */
+ printf (_("%s: emulation specific options:\n"), program_name);
+ ldemul_list_emulation_options (stdout);
+ printf ("\n");
+
+ printf (_("Report bugs to %s\n"), REPORT_BUGS_TO);
}
diff --git a/contrib/binutils/ld/mri.c b/contrib/binutils/ld/mri.c
index d07622a..d39186c 100644
--- a/contrib/binutils/ld/mri.c
+++ b/contrib/binutils/ld/mri.c
@@ -1,11 +1,11 @@
/* mri.c -- handle MRI style linker scripts
- Copyright (C) 1991, 92, 93, 94, 95, 96, 1997 Free Software Foundation, Inc.
+ Copyright (C) 1991, 92, 93, 94, 95, 96, 1997, 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)
+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,
@@ -256,17 +256,18 @@ mri_draw_tree ()
1, align, subalign,
(etree_type *) NULL);
base = 0;
- lang_add_wild(p->name, (char *)NULL);
+ lang_add_wild (p->name, false, (char *)NULL, false, false, NULL);
/* If there is an alias for this section, add it too */
for (aptr = alias; aptr; aptr = aptr->next) {
if (strcmp(aptr->alias, p->name)== 0) {
- lang_add_wild(aptr->name, (char *)NULL);
+ lang_add_wild (aptr->name, false, (char *)NULL, false, false, NULL);
}
}
lang_leave_output_section_statement
- (0, "*default*", (struct lang_output_section_phdr_list *) NULL);
+ (0, "*default*", (struct lang_output_section_phdr_list *) NULL,
+ "*default*");
p = p->next;
}
@@ -339,7 +340,7 @@ mri_format (name)
lang_add_output_format("coff-m68k", (char *) NULL, (char *) NULL, 1);
}
else {
- einfo("%P%F: unknown format type %s\n", name);
+ einfo(_("%P%F: unknown format type %s\n"), name);
}
}
diff --git a/contrib/binutils/ld/pe-dll.c b/contrib/binutils/ld/pe-dll.c
new file mode 100644
index 0000000..6b8b1af
--- /dev/null
+++ b/contrib/binutils/ld/pe-dll.c
@@ -0,0 +1,1924 @@
+/* Routines to help build PEI-format DLLs (Win32 etc)
+ Copyright (C) 1998, 1999, 2000 Free Software Foundation, Inc.
+ Written by DJ Delorie <dj@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. */
+
+#include "bfd.h"
+#include "sysdep.h"
+#include "bfdlink.h"
+#include "libiberty.h"
+
+#include <time.h>
+#include <ctype.h>
+
+#include "ld.h"
+#include "ldexp.h"
+#include "ldlang.h"
+#include "ldwrite.h"
+#include "ldmisc.h"
+#include "ldgram.h"
+#include "ldmain.h"
+#include "ldemul.h"
+#include "coff/internal.h"
+#include "../bfd/libcoff.h"
+#include "deffile.h"
+#include "pe-dll.h"
+
+/************************************************************************
+
+ This file turns a regular Windows PE image into a DLL. Because of
+ the complexity of this operation, it has been broken down into a
+ number of separate modules which are all called by the main function
+ at the end of this file. This function is not re-entrant and is
+ normally only called once, so static variables are used to reduce
+ the number of parameters and return values required.
+
+ See also: ld/emultempl/pe.em
+
+ ************************************************************************/
+
+/* for emultempl/pe.em */
+
+def_file *pe_def_file = 0;
+int pe_dll_export_everything = 0;
+int pe_dll_do_default_excludes = 1;
+int pe_dll_kill_ats = 0;
+int pe_dll_stdcall_aliases = 0;
+int pe_dll_warn_dup_exports = 0;
+int pe_dll_compat_implib = 0;
+
+/************************************************************************
+
+ static variables and types
+
+ ************************************************************************/
+
+static bfd_vma image_base;
+
+static bfd *filler_bfd;
+static struct sec *edata_s, *reloc_s;
+static unsigned char *edata_d, *reloc_d;
+static size_t edata_sz, reloc_sz;
+
+typedef struct {
+ char *target_name;
+ char *object_target;
+ unsigned int imagebase_reloc;
+ int pe_arch;
+ int bfd_arch;
+ int underscored;
+} pe_details_type;
+
+#define PE_ARCH_i386 1
+#define PE_ARCH_sh 2
+#define PE_ARCH_mips 3
+#define PE_ARCH_arm 4
+
+static pe_details_type pe_detail_list[] = {
+ {
+ "pei-i386",
+ "pe-i386",
+ 7 /* R_IMAGEBASE */,
+ PE_ARCH_i386,
+ bfd_arch_i386,
+ 1
+ },
+ {
+ "pei-shl",
+ "pe-shl",
+ 16 /* R_SH_IMAGEBASE */,
+ PE_ARCH_sh,
+ bfd_arch_sh,
+ 1
+ },
+ {
+ "pei-mips",
+ "pe-mips",
+ 34 /* MIPS_R_RVA */,
+ PE_ARCH_mips,
+ bfd_arch_mips,
+ 0
+ },
+ {
+ "pei-arm-little",
+ "pe-arm-little",
+ 11 /* ARM_RVA32 */,
+ PE_ARCH_arm,
+ bfd_arch_arm,
+ 0
+ },
+ { NULL, NULL, 0, 0, 0, 0 }
+};
+
+static pe_details_type *pe_details;
+
+#define U(str) (pe_details->underscored ? "_" str : str)
+
+void
+pe_dll_id_target (target)
+ const char *target;
+{
+ int i;
+ for (i=0; pe_detail_list[i].target_name; i++)
+ if (strcmp (pe_detail_list[i].target_name, target) == 0)
+ {
+ pe_details = pe_detail_list+i;
+ return;
+ }
+ einfo (_("%XUnsupported PEI architecture: %s\n"), target);
+ exit (1);
+}
+
+/************************************************************************
+
+ Helper functions for qsort. Relocs must be sorted so that we can write
+ them out by pages.
+
+ ************************************************************************/
+
+typedef struct {
+ bfd_vma vma;
+ char type;
+ short extra;
+} reloc_data_type;
+
+static int
+reloc_sort (va, vb)
+ const void *va, *vb;
+{
+ bfd_vma a = ((reloc_data_type *) va)->vma;
+ bfd_vma b = ((reloc_data_type *) vb)->vma;
+ return (a > b) ? 1 : ((a < b) ? -1 : 0);
+}
+
+static int
+pe_export_sort (va, vb)
+ const void *va, *vb;
+{
+ def_file_export *a = (def_file_export *) va;
+ def_file_export *b = (def_file_export *) vb;
+ return strcmp (a->name, b->name);
+}
+
+/************************************************************************
+
+ Read and process the .DEF file
+
+ ************************************************************************/
+
+/* These correspond to the entries in pe_def_file->exports[]. I use
+ exported_symbol_sections[i] to tag whether or not the symbol was
+ defined, since we can't export symbols we don't have. */
+
+static bfd_vma *exported_symbol_offsets;
+static struct sec **exported_symbol_sections;
+
+static int export_table_size;
+static int count_exported;
+static int count_exported_byname;
+static int count_with_ordinals;
+static const char *dll_name;
+static int min_ordinal, max_ordinal;
+static int *exported_symbols;
+
+typedef struct exclude_list_struct
+ {
+ char *string;
+ struct exclude_list_struct *next;
+ }
+exclude_list_struct;
+static struct exclude_list_struct *excludes = 0;
+
+void
+pe_dll_add_excludes (new_excludes)
+ const char *new_excludes;
+{
+ char *local_copy;
+ char *exclude_string;
+
+ local_copy = xstrdup (new_excludes);
+
+ exclude_string = strtok (local_copy, ",:");
+ for (; exclude_string; exclude_string = strtok (NULL, ",:"))
+ {
+ struct exclude_list_struct *new_exclude;
+
+ new_exclude = ((struct exclude_list_struct *)
+ xmalloc (sizeof (struct exclude_list_struct)));
+ new_exclude->string = (char *) xmalloc (strlen (exclude_string) + 1);
+ strcpy (new_exclude->string, exclude_string);
+ new_exclude->next = excludes;
+ excludes = new_exclude;
+ }
+
+ free (local_copy);
+}
+
+static int
+auto_export (d, n)
+ def_file *d;
+ const char *n;
+{
+ int i;
+ struct exclude_list_struct *ex;
+ for (i = 0; i < d->num_exports; i++)
+ if (strcmp (d->exports[i].name, n) == 0)
+ return 0;
+ if (pe_dll_do_default_excludes)
+ {
+ if (strcmp (n, "DllMain@12") == 0)
+ return 0;
+ if (strcmp (n, "DllEntryPoint@0") == 0)
+ return 0;
+ if (strcmp (n, "impure_ptr") == 0)
+ return 0;
+ }
+ for (ex = excludes; ex; ex = ex->next)
+ if (strcmp (n, ex->string) == 0)
+ return 0;
+ return 1;
+}
+
+static void
+process_def_file (abfd, info)
+ bfd *abfd ATTRIBUTE_UNUSED;
+ struct bfd_link_info *info;
+{
+ int i, j;
+ struct bfd_link_hash_entry *blhe;
+ bfd *b;
+ struct sec *s;
+ def_file_export *e=0;
+
+ if (!pe_def_file)
+ pe_def_file = def_file_empty ();
+
+ /* First, run around to all the objects looking for the .drectve
+ sections, and push those into the def file too */
+
+ for (b = info->input_bfds; b; b = b->link_next)
+ {
+ s = bfd_get_section_by_name (b, ".drectve");
+ if (s)
+ {
+ int size = bfd_get_section_size_before_reloc (s);
+ char *buf = xmalloc (size);
+ bfd_get_section_contents (b, s, buf, 0, size);
+ def_file_add_directive (pe_def_file, buf, size);
+ free (buf);
+ }
+ }
+
+ /* Now, maybe export everything else the default way */
+
+ if (pe_dll_export_everything || pe_def_file->num_exports == 0)
+ {
+ for (b = info->input_bfds; b; b = b->link_next)
+ {
+ asymbol **symbols;
+ int nsyms, symsize;
+
+ symsize = bfd_get_symtab_upper_bound (b);
+ symbols = (asymbol **) xmalloc (symsize);
+ nsyms = bfd_canonicalize_symtab (b, symbols);
+
+ for (j = 0; j < nsyms; j++)
+ {
+ if ((symbols[j]->flags & (BSF_FUNCTION | BSF_GLOBAL))
+ == (BSF_FUNCTION | BSF_GLOBAL))
+ {
+ const char *sn = symbols[j]->name;
+ if (*sn == '_')
+ sn++;
+ if (auto_export (pe_def_file, sn))
+ def_file_add_export (pe_def_file, sn, 0, -1);
+ }
+ }
+ }
+ }
+
+#undef NE
+#define NE pe_def_file->num_exports
+
+ /* Canonicalize the export list */
+
+ if (pe_dll_kill_ats)
+ {
+ for (i = 0; i < NE; i++)
+ {
+ if (strchr (pe_def_file->exports[i].name, '@'))
+ {
+ /* This will preserve internal_name, which may have been pointing
+ to the same memory as name, or might not have */
+ char *tmp = xstrdup (pe_def_file->exports[i].name);
+ *(strchr (tmp, '@')) = 0;
+ pe_def_file->exports[i].name = tmp;
+ }
+ }
+ }
+
+ if (pe_dll_stdcall_aliases)
+ {
+ for (i = 0; i < NE; i++)
+ {
+ if (strchr (pe_def_file->exports[i].name, '@'))
+ {
+ char *tmp = xstrdup (pe_def_file->exports[i].name);
+ *(strchr (tmp, '@')) = 0;
+ if (auto_export (pe_def_file, tmp))
+ def_file_add_export (pe_def_file, tmp,
+ pe_def_file->exports[i].internal_name, -1);
+ else
+ free (tmp);
+ }
+ }
+ }
+
+ e = pe_def_file->exports; /* convenience, but watch out for it changing */
+
+ exported_symbol_offsets = (bfd_vma *) xmalloc (NE * sizeof (bfd_vma));
+ exported_symbol_sections = (struct sec **) xmalloc (NE * sizeof (struct sec *));
+
+ memset (exported_symbol_sections, 0, NE * sizeof (struct sec *));
+ max_ordinal = 0;
+ min_ordinal = 65536;
+ count_exported = 0;
+ count_exported_byname = 0;
+ count_with_ordinals = 0;
+
+ qsort (pe_def_file->exports, NE, sizeof (pe_def_file->exports[0]), pe_export_sort);
+ for (i = 0, j = 0; i < NE; i++)
+ {
+ if (i > 0 && strcmp (e[i].name, e[i - 1].name) == 0)
+ {
+ /* This is a duplicate. */
+ if (e[j - 1].ordinal != -1
+ && e[i].ordinal != -1
+ && e[j - 1].ordinal != e[i].ordinal)
+ {
+ if (pe_dll_warn_dup_exports)
+ /* xgettext:c-format */
+ einfo (_("%XError, duplicate EXPORT with oridinals: %s (%d vs %d)\n"),
+ e[j - 1].name, e[j - 1].ordinal, e[i].ordinal);
+ }
+ else
+ {
+ if (pe_dll_warn_dup_exports)
+ /* xgettext:c-format */
+ einfo (_("Warning, duplicate EXPORT: %s\n"),
+ e[j - 1].name);
+ }
+ if (e[i].ordinal)
+ e[j - 1].ordinal = e[i].ordinal;
+ e[j - 1].flag_private |= e[i].flag_private;
+ e[j - 1].flag_constant |= e[i].flag_constant;
+ e[j - 1].flag_noname |= e[i].flag_noname;
+ e[j - 1].flag_data |= e[i].flag_data;
+ }
+ else
+ {
+ if (i != j)
+ e[j] = e[i];
+ j++;
+ }
+ }
+ pe_def_file->num_exports = j; /* == NE */
+
+ for (i = 0; i < NE; i++)
+ {
+ char *name = (char *) xmalloc (strlen (pe_def_file->exports[i].internal_name) + 2);
+ if (pe_details->underscored)
+ {
+ *name = '_';
+ strcpy (name + 1, pe_def_file->exports[i].internal_name);
+ }
+ else
+ strcpy (name, pe_def_file->exports[i].internal_name);
+
+ blhe = bfd_link_hash_lookup (info->hash,
+ name,
+ false, false, true);
+
+ if (blhe
+ && (blhe->type == bfd_link_hash_defined
+ || (blhe->type == bfd_link_hash_common)))
+ {
+ count_exported++;
+ if (!pe_def_file->exports[i].flag_noname)
+ count_exported_byname++;
+
+ /* Only fill in the sections. The actual offsets are computed
+ in fill_exported_offsets() after common symbols are laid
+ out. */
+ if (blhe->type == bfd_link_hash_defined)
+ exported_symbol_sections[i] = blhe->u.def.section;
+ else
+ exported_symbol_sections[i] = blhe->u.c.p->section;
+
+ if (pe_def_file->exports[i].ordinal != -1)
+ {
+ if (max_ordinal < pe_def_file->exports[i].ordinal)
+ max_ordinal = pe_def_file->exports[i].ordinal;
+ if (min_ordinal > pe_def_file->exports[i].ordinal)
+ min_ordinal = pe_def_file->exports[i].ordinal;
+ count_with_ordinals++;
+ }
+ }
+ else if (blhe && blhe->type == bfd_link_hash_undefined)
+ {
+ /* xgettext:c-format */
+ einfo (_("%XCannot export %s: symbol not defined\n"),
+ pe_def_file->exports[i].internal_name);
+ }
+ else if (blhe)
+ {
+ /* xgettext:c-format */
+ einfo (_("%XCannot export %s: symbol wrong type (%d vs %d)\n"),
+ pe_def_file->exports[i].internal_name,
+ blhe->type, bfd_link_hash_defined);
+ }
+ else
+ {
+ /* xgettext:c-format */
+ einfo (_("%XCannot export %s: symbol not found\n"),
+ pe_def_file->exports[i].internal_name);
+ }
+ free (name);
+ }
+}
+
+/************************************************************************
+
+ Build the bfd that will contain .edata and .reloc sections
+
+ ************************************************************************/
+
+static void
+build_filler_bfd (include_edata)
+ int include_edata;
+{
+ lang_input_statement_type *filler_file;
+ filler_file = lang_add_input_file ("dll stuff",
+ lang_input_file_is_fake_enum,
+ NULL);
+ filler_file->the_bfd = filler_bfd = bfd_create ("dll stuff", output_bfd);
+ if (filler_bfd == NULL
+ || !bfd_set_arch_mach (filler_bfd,
+ bfd_get_arch (output_bfd),
+ bfd_get_mach (output_bfd)))
+ {
+ einfo ("%X%P: can not create BFD %E\n");
+ return;
+ }
+
+ if (include_edata)
+ {
+ edata_s = bfd_make_section_old_way (filler_bfd, ".edata");
+ if (edata_s == NULL
+ || !bfd_set_section_flags (filler_bfd, edata_s,
+ (SEC_HAS_CONTENTS
+ | SEC_ALLOC
+ | SEC_LOAD
+ | SEC_KEEP
+ | SEC_IN_MEMORY)))
+ {
+ einfo ("%X%P: can not create .edata section: %E\n");
+ return;
+ }
+ bfd_set_section_size (filler_bfd, edata_s, edata_sz);
+ }
+
+ reloc_s = bfd_make_section_old_way (filler_bfd, ".reloc");
+ if (reloc_s == NULL
+ || !bfd_set_section_flags (filler_bfd, reloc_s,
+ (SEC_HAS_CONTENTS
+ | SEC_ALLOC
+ | SEC_LOAD
+ | SEC_KEEP
+ | SEC_IN_MEMORY)))
+ {
+ einfo ("%X%P: can not create .reloc section: %E\n");
+ return;
+ }
+ bfd_set_section_size (filler_bfd, reloc_s, 0);
+
+ ldlang_add_file (filler_file);
+}
+
+/************************************************************************
+
+ Gather all the exported symbols and build the .edata section
+
+ ************************************************************************/
+
+static void
+generate_edata (abfd, info)
+ bfd *abfd;
+ struct bfd_link_info *info ATTRIBUTE_UNUSED;
+{
+ int i, next_ordinal;
+ int name_table_size = 0;
+ const char *dlnp;
+
+ /* First, we need to know how many exported symbols there are,
+ and what the range of ordinals is. */
+
+ if (pe_def_file->name)
+ {
+ dll_name = pe_def_file->name;
+ }
+ else
+ {
+ dll_name = abfd->filename;
+ for (dlnp = dll_name; *dlnp; dlnp++)
+ {
+ if (*dlnp == '\\' || *dlnp == '/' || *dlnp == ':')
+ dll_name = dlnp + 1;
+ }
+ }
+
+ if (count_with_ordinals && max_ordinal > count_exported)
+ {
+ if (min_ordinal > max_ordinal - count_exported + 1)
+ min_ordinal = max_ordinal - count_exported + 1;
+ }
+ else
+ {
+ min_ordinal = 1;
+ max_ordinal = count_exported;
+ }
+ export_table_size = max_ordinal - min_ordinal + 1;
+
+ exported_symbols = (int *) xmalloc (export_table_size * sizeof (int));
+ for (i = 0; i < export_table_size; i++)
+ exported_symbols[i] = -1;
+
+ /* Now we need to assign ordinals to those that don't have them */
+ for (i = 0; i < NE; i++)
+ {
+ if (exported_symbol_sections[i])
+ {
+ if (pe_def_file->exports[i].ordinal != -1)
+ {
+ int ei = pe_def_file->exports[i].ordinal - min_ordinal;
+ int pi = exported_symbols[ei];
+ if (pi != -1)
+ {
+ /* xgettext:c-format */
+ einfo (_("%XError, oridinal used twice: %d (%s vs %s)\n"),
+ pe_def_file->exports[i].ordinal,
+ pe_def_file->exports[i].name,
+ pe_def_file->exports[pi].name);
+ }
+ exported_symbols[ei] = i;
+ }
+ name_table_size += strlen (pe_def_file->exports[i].name) + 1;
+ }
+ }
+
+ next_ordinal = min_ordinal;
+ for (i = 0; i < NE; i++)
+ if (exported_symbol_sections[i])
+ if (pe_def_file->exports[i].ordinal == -1)
+ {
+ while (exported_symbols[next_ordinal - min_ordinal] != -1)
+ next_ordinal++;
+ exported_symbols[next_ordinal - min_ordinal] = i;
+ pe_def_file->exports[i].ordinal = next_ordinal;
+ }
+
+ /* OK, now we can allocate some memory */
+
+ edata_sz = (40 /* directory */
+ + 4 * export_table_size /* addresses */
+ + 4 * count_exported_byname /* name ptrs */
+ + 2 * count_exported_byname /* ordinals */
+ + name_table_size + strlen (dll_name) + 1);
+}
+
+/* Fill the exported symbol offsets. The preliminary work has already
+ been done in process_def_file(). */
+
+static void
+fill_exported_offsets (abfd, info)
+ bfd *abfd ATTRIBUTE_UNUSED;
+ struct bfd_link_info *info;
+{
+ int i;
+ struct bfd_link_hash_entry *blhe;
+
+ for (i = 0; i < pe_def_file->num_exports; i++)
+ {
+ char *name = (char *) xmalloc (strlen (pe_def_file->exports[i].internal_name) + 2);
+ if (pe_details->underscored)
+ {
+ *name = '_';
+ strcpy (name + 1, pe_def_file->exports[i].internal_name);
+ }
+ else
+ strcpy (name, pe_def_file->exports[i].internal_name);
+
+ blhe = bfd_link_hash_lookup (info->hash,
+ name,
+ false, false, true);
+
+ if (blhe && (blhe->type == bfd_link_hash_defined))
+ {
+ exported_symbol_offsets[i] = blhe->u.def.value;
+ }
+ free (name);
+ }
+}
+
+static void
+fill_edata (abfd, info)
+ bfd *abfd;
+ struct bfd_link_info *info ATTRIBUTE_UNUSED;
+{
+ int i, hint;
+ unsigned char *edirectory;
+ unsigned long *eaddresses;
+ unsigned long *enameptrs;
+ unsigned short *eordinals;
+ unsigned char *enamestr;
+ time_t now;
+
+ time (&now);
+
+ edata_d = (unsigned char *) xmalloc (edata_sz);
+
+ /* Note use of array pointer math here */
+ edirectory = edata_d;
+ eaddresses = (unsigned long *) (edata_d + 40);
+ enameptrs = eaddresses + export_table_size;
+ eordinals = (unsigned short *) (enameptrs + count_exported_byname);
+ enamestr = (char *) (eordinals + count_exported_byname);
+
+#define ERVA(ptr) (((unsigned char *)(ptr) - edata_d) + edata_s->output_section->vma - image_base)
+
+ memset (edata_d, 0, 40);
+ bfd_put_32 (abfd, now, edata_d + 4);
+ if (pe_def_file->version_major != -1)
+ {
+ bfd_put_16 (abfd, pe_def_file->version_major, edata_d + 8);
+ bfd_put_16 (abfd, pe_def_file->version_minor, edata_d + 10);
+ }
+ bfd_put_32 (abfd, ERVA (enamestr), edata_d + 12);
+ strcpy (enamestr, dll_name);
+ enamestr += strlen (enamestr) + 1;
+ bfd_put_32 (abfd, min_ordinal, edata_d + 16);
+ bfd_put_32 (abfd, export_table_size, edata_d + 20);
+ bfd_put_32 (abfd, count_exported_byname, edata_d + 24);
+ bfd_put_32 (abfd, ERVA (eaddresses), edata_d + 28);
+ bfd_put_32 (abfd, ERVA (enameptrs), edata_d + 32);
+ bfd_put_32 (abfd, ERVA (eordinals), edata_d + 36);
+
+ fill_exported_offsets (abfd, info);
+
+ /* Ok, now for the filling in part */
+ hint = 0;
+ for (i = 0; i < export_table_size; i++)
+ {
+ int s = exported_symbols[i];
+ if (s != -1)
+ {
+ struct sec *ssec = exported_symbol_sections[s];
+ unsigned long srva = (exported_symbol_offsets[s]
+ + ssec->output_section->vma
+ + ssec->output_offset);
+
+ bfd_put_32 (abfd, srva - image_base, (void *) (eaddresses + i));
+ if (!pe_def_file->exports[s].flag_noname)
+ {
+ char *ename = pe_def_file->exports[s].name;
+ bfd_put_32 (abfd, ERVA (enamestr), (void *) enameptrs);
+ strcpy (enamestr, ename);
+ enamestr += strlen (enamestr) + 1;
+ bfd_put_16 (abfd, i, (void *) eordinals);
+ enameptrs++;
+ pe_def_file->exports[s].hint = hint++;
+ }
+ eordinals++;
+ }
+ }
+}
+
+/************************************************************************
+
+ Gather all the relocations and build the .reloc section
+
+ ************************************************************************/
+
+static void
+generate_reloc (abfd, info)
+ bfd *abfd;
+ struct bfd_link_info *info;
+{
+
+ /* for .reloc stuff */
+ reloc_data_type *reloc_data;
+ int total_relocs = 0;
+ int i;
+ unsigned long sec_page = (unsigned long) (-1);
+ unsigned long page_ptr, page_count;
+ int bi;
+ bfd *b;
+ struct sec *s;
+
+ total_relocs = 0;
+ for (b = info->input_bfds; b; b = b->link_next)
+ for (s = b->sections; s; s = s->next)
+ total_relocs += s->reloc_count;
+
+ reloc_data = (reloc_data_type *) xmalloc (total_relocs * sizeof (reloc_data_type));
+
+ total_relocs = 0;
+ bi = 0;
+ for (bi = 0, b = info->input_bfds; b; bi++, b = b->link_next)
+ {
+ arelent **relocs;
+ int relsize, nrelocs, i;
+
+ for (s = b->sections; s; s = s->next)
+ {
+ unsigned long sec_vma = s->output_section->vma + s->output_offset;
+ asymbol **symbols;
+ int nsyms, symsize;
+
+ /* if it's not loaded, we don't need to relocate it this way */
+ if (!(s->output_section->flags & SEC_LOAD))
+ continue;
+
+ /* I don't know why there would be a reloc for these, but I've
+ seen it happen - DJ */
+ if (s->output_section == &bfd_abs_section)
+ continue;
+
+ if (s->output_section->vma == 0)
+ {
+ /* Huh? Shouldn't happen, but punt if it does */
+ einfo ("DJ: zero vma section reloc detected: `%s' #%d f=%d\n",
+ s->output_section->name, s->output_section->index,
+ s->output_section->flags);
+ continue;
+ }
+
+ symsize = bfd_get_symtab_upper_bound (b);
+ symbols = (asymbol **) xmalloc (symsize);
+ nsyms = bfd_canonicalize_symtab (b, symbols);
+
+ relsize = bfd_get_reloc_upper_bound (b, s);
+ relocs = (arelent **) xmalloc ((size_t) relsize);
+ nrelocs = bfd_canonicalize_reloc (b, s, relocs, symbols);
+
+ for (i = 0; i < nrelocs; i++)
+ {
+ if (!relocs[i]->howto->pc_relative
+ && relocs[i]->howto->type != pe_details->imagebase_reloc)
+ {
+ bfd_vma sym_vma;
+ struct symbol_cache_entry *sym = *relocs[i]->sym_ptr_ptr;
+ sym_vma = (relocs[i]->addend
+ + sym->value
+ + sym->section->vma
+ + sym->section->output_offset
+ + sym->section->output_section->vma);
+ reloc_data[total_relocs].vma = sec_vma + relocs[i]->address;
+
+#define BITS_AND_SHIFT(bits, shift) (bits * 1000 | shift)
+
+ switch BITS_AND_SHIFT (relocs[i]->howto->bitsize,
+ relocs[i]->howto->rightshift)
+ {
+ case BITS_AND_SHIFT (32, 0):
+ reloc_data[total_relocs].type = 3;
+ total_relocs++;
+ break;
+ case BITS_AND_SHIFT (16, 0):
+ reloc_data[total_relocs].type = 2;
+ total_relocs++;
+ break;
+ case BITS_AND_SHIFT (16, 16):
+ reloc_data[total_relocs].type = 4;
+ /* FIXME: we can't know the symbol's right value yet,
+ but we probably can safely assume that CE will relocate
+ us in 64k blocks, so leaving it zero is safe. */
+ reloc_data[total_relocs].extra = 0;
+ total_relocs++;
+ break;
+ case BITS_AND_SHIFT (26, 2):
+ reloc_data[total_relocs].type = 5;
+ total_relocs++;
+ break;
+ default:
+ /* xgettext:c-format */
+ einfo (_("%XError: %d-bit reloc in dll\n"),
+ relocs[i]->howto->bitsize);
+ break;
+ }
+ }
+ }
+ free (relocs);
+ /* Warning: the allocated symbols are remembered in BFD and reused
+ later, so don't free them! */
+ /* free (symbols); */
+ }
+ }
+
+ /* At this point, we have total_relocs relocation addresses in
+ reloc_addresses, which are all suitable for the .reloc section.
+ We must now create the new sections. */
+
+ qsort (reloc_data, total_relocs, sizeof (*reloc_data), reloc_sort);
+
+ for (i = 0; i < total_relocs; i++)
+ {
+ unsigned long this_page = (reloc_data[i].vma >> 12);
+
+ if (this_page != sec_page)
+ {
+ reloc_sz = (reloc_sz + 3) & ~3; /* 4-byte align */
+ reloc_sz += 8;
+ sec_page = this_page;
+ }
+
+ reloc_sz += 2;
+
+ if (reloc_data[i].type == 4)
+ reloc_sz += 2;
+ }
+ reloc_sz = (reloc_sz + 3) & ~3; /* 4-byte align */
+
+ reloc_d = (unsigned char *) xmalloc (reloc_sz);
+
+ sec_page = (unsigned long) (-1);
+ reloc_sz = 0;
+ page_ptr = (unsigned long) (-1);
+ page_count = 0;
+ for (i = 0; i < total_relocs; i++)
+ {
+ unsigned long rva = reloc_data[i].vma - image_base;
+ unsigned long this_page = (rva & ~0xfff);
+ if (this_page != sec_page)
+ {
+ while (reloc_sz & 3)
+ reloc_d[reloc_sz++] = 0;
+ if (page_ptr != (unsigned long) (-1))
+ bfd_put_32 (abfd, reloc_sz - page_ptr, reloc_d + page_ptr + 4);
+ bfd_put_32 (abfd, this_page, reloc_d + reloc_sz);
+ page_ptr = reloc_sz;
+ reloc_sz += 8;
+ sec_page = this_page;
+ page_count = 0;
+ }
+ bfd_put_16 (abfd, (rva & 0xfff) + (reloc_data[i].type<<12),
+ reloc_d + reloc_sz);
+ reloc_sz += 2;
+ if (reloc_data[i].type == 4)
+ {
+ bfd_put_16 (abfd, reloc_data[i].extra, reloc_d + reloc_sz);
+ reloc_sz += 2;
+ }
+ page_count++;
+ }
+ while (reloc_sz & 3)
+ reloc_d[reloc_sz++] = 0;
+ if (page_ptr != (unsigned long) (-1))
+ bfd_put_32 (abfd, reloc_sz - page_ptr, reloc_d + page_ptr + 4);
+ while (reloc_sz < reloc_s->_raw_size)
+ reloc_d[reloc_sz++] = 0;
+}
+
+/************************************************************************
+
+ Given the exiting def_file structure, print out a .DEF file that
+ corresponds to it.
+
+ ************************************************************************/
+
+static void
+quoteput (s, f, needs_quotes)
+ char *s;
+ FILE * f;
+ int needs_quotes;
+{
+ char *cp;
+ for (cp = s; *cp; cp++)
+ if (*cp == '\''
+ || *cp == '"'
+ || *cp == '\\'
+ || isspace ((unsigned char) *cp)
+ || *cp == ','
+ || *cp == ';')
+ needs_quotes = 1;
+ if (needs_quotes)
+ {
+ putc ('"', f);
+ while (*s)
+ {
+ if (*s == '"' || *s == '\\')
+ putc ('\\', f);
+ putc (*s, f);
+ s++;
+ }
+ putc ('"', f);
+ }
+ else
+ fputs (s, f);
+}
+
+void
+pe_dll_generate_def_file (pe_out_def_filename)
+ const char *pe_out_def_filename;
+{
+ int i;
+ FILE *out = fopen (pe_out_def_filename, "w");
+ if (out == NULL)
+ {
+ /* xgettext:c-format */
+ einfo (_("%s: Can't open output def file %s\n"),
+ program_name, pe_out_def_filename);
+ }
+
+ if (pe_def_file)
+ {
+ if (pe_def_file->name)
+ {
+ if (pe_def_file->is_dll)
+ fprintf (out, "LIBRARY ");
+ else
+ fprintf (out, "NAME ");
+ quoteput (pe_def_file->name, out, 1);
+ if (pe_data (output_bfd)->pe_opthdr.ImageBase)
+ fprintf (out, " BASE=0x%lx",
+ (unsigned long) pe_data (output_bfd)->pe_opthdr.ImageBase);
+ fprintf (out, "\n");
+ }
+
+ if (pe_def_file->description)
+ {
+ fprintf (out, "DESCRIPTION ");
+ quoteput (pe_def_file->description, out, 1);
+ fprintf (out, "\n");
+ }
+
+ if (pe_def_file->version_minor != -1)
+ fprintf (out, "VERSION %d.%d\n", pe_def_file->version_major,
+ pe_def_file->version_minor);
+ else if (pe_def_file->version_major != -1)
+ fprintf (out, "VERSION %d\n", pe_def_file->version_major);
+
+ if (pe_def_file->stack_reserve != -1 || pe_def_file->heap_reserve != -1)
+ fprintf (out, "\n");
+
+ if (pe_def_file->stack_commit != -1)
+ fprintf (out, "STACKSIZE 0x%x,0x%x\n",
+ pe_def_file->stack_reserve, pe_def_file->stack_commit);
+ else if (pe_def_file->stack_reserve != -1)
+ fprintf (out, "STACKSIZE 0x%x\n", pe_def_file->stack_reserve);
+ if (pe_def_file->heap_commit != -1)
+ fprintf (out, "HEAPSIZE 0x%x,0x%x\n",
+ pe_def_file->heap_reserve, pe_def_file->heap_commit);
+ else if (pe_def_file->heap_reserve != -1)
+ fprintf (out, "HEAPSIZE 0x%x\n", pe_def_file->heap_reserve);
+
+ if (pe_def_file->num_section_defs > 0)
+ {
+ fprintf (out, "\nSECTIONS\n\n");
+ for (i = 0; i < pe_def_file->num_section_defs; i++)
+ {
+ fprintf (out, " ");
+ quoteput (pe_def_file->section_defs[i].name, out, 0);
+ if (pe_def_file->section_defs[i].class)
+ {
+ fprintf (out, " CLASS ");
+ quoteput (pe_def_file->section_defs[i].class, out, 0);
+ }
+ if (pe_def_file->section_defs[i].flag_read)
+ fprintf (out, " READ");
+ if (pe_def_file->section_defs[i].flag_write)
+ fprintf (out, " WRITE");
+ if (pe_def_file->section_defs[i].flag_execute)
+ fprintf (out, " EXECUTE");
+ if (pe_def_file->section_defs[i].flag_shared)
+ fprintf (out, " SHARED");
+ fprintf (out, "\n");
+ }
+ }
+
+ if (pe_def_file->num_exports > 0)
+ {
+ fprintf (out, "\nEXPORTS\n\n");
+ for (i = 0; i < pe_def_file->num_exports; i++)
+ {
+ def_file_export *e = pe_def_file->exports + i;
+ fprintf (out, " ");
+ quoteput (e->name, out, 0);
+ if (e->internal_name && strcmp (e->internal_name, e->name))
+ {
+ fprintf (out, " = ");
+ quoteput (e->internal_name, out, 0);
+ }
+ if (e->ordinal != -1)
+ fprintf (out, " @%d", e->ordinal);
+ if (e->flag_private)
+ fprintf (out, " PRIVATE");
+ if (e->flag_constant)
+ fprintf (out, " CONSTANT");
+ if (e->flag_noname)
+ fprintf (out, " NONAME");
+ if (e->flag_data)
+ fprintf (out, " DATA");
+
+ fprintf (out, "\n");
+ }
+ }
+
+ if (pe_def_file->num_imports > 0)
+ {
+ fprintf (out, "\nIMPORTS\n\n");
+ for (i = 0; i < pe_def_file->num_imports; i++)
+ {
+ def_file_import *im = pe_def_file->imports + i;
+ fprintf (out, " ");
+ if (im->internal_name
+ && (!im->name || strcmp (im->internal_name, im->name)))
+ {
+ quoteput (im->internal_name, out, 0);
+ fprintf (out, " = ");
+ }
+ quoteput (im->module->name, out, 0);
+ fprintf (out, ".");
+ if (im->name)
+ quoteput (im->name, out, 0);
+ else
+ fprintf (out, "%d", im->ordinal);
+ fprintf (out, "\n");
+ }
+ }
+ }
+ else
+ fprintf (out, _("; no contents available\n"));
+
+ if (fclose (out) == EOF)
+ {
+ /* xgettext:c-format */
+ einfo (_("%P: Error closing file `%s'\n"), pe_out_def_filename);
+ }
+}
+
+/************************************************************************
+
+ Generate the import library
+
+ ************************************************************************/
+
+static asymbol **symtab;
+static int symptr;
+static int tmp_seq;
+static const char *dll_filename;
+static char *dll_symname;
+
+#define UNDSEC (asection *) &bfd_und_section
+
+static asection *
+quick_section(abfd, name, flags, align)
+ bfd *abfd;
+ const char *name;
+ int flags;
+ int align;
+{
+ asection *sec;
+ asymbol *sym;
+
+ sec = bfd_make_section_old_way (abfd, name);
+ bfd_set_section_flags (abfd, sec, flags
+ | SEC_ALLOC
+ | SEC_LOAD
+ | SEC_KEEP
+ );
+ bfd_set_section_alignment (abfd, sec, align);
+ /* remember to undo this before trying to link internally! */
+ sec->output_section = sec;
+
+ sym = bfd_make_empty_symbol (abfd);
+ symtab[symptr++] = sym;
+ sym->name = sec->name;
+ sym->section = sec;
+ sym->flags = BSF_LOCAL;
+ sym->value = 0;
+
+ return sec;
+}
+
+static void
+quick_symbol (abfd, n1, n2, n3, sec, flags, addr)
+ bfd *abfd;
+ char *n1;
+ char *n2;
+ char *n3;
+ asection *sec;
+ int flags;
+ int addr;
+{
+ asymbol *sym;
+ char *name = (char *) xmalloc (strlen (n1) + strlen (n2) + strlen (n3) + 1);
+ strcpy (name, n1);
+ strcat (name, n2);
+ strcat (name, n3);
+ sym = bfd_make_empty_symbol (abfd);
+ sym->name = name;
+ sym->section = sec;
+ sym->flags = flags;
+ sym->value = addr;
+ symtab[symptr++] = sym;
+}
+
+static arelent *reltab = 0;
+static int relcount = 0, relsize = 0;
+
+static void
+quick_reloc (abfd, address, which_howto, symidx)
+ bfd *abfd;
+ int address;
+ int which_howto;
+ int symidx;
+{
+ if (relcount >= (relsize-1))
+ {
+ relsize += 10;
+ if (reltab)
+ reltab = (arelent *) xrealloc (reltab, relsize * sizeof (arelent));
+ else
+ reltab = (arelent *) xmalloc (relsize * sizeof (arelent));
+ }
+ reltab[relcount].address = address;
+ reltab[relcount].addend = 0;
+ reltab[relcount].howto = bfd_reloc_type_lookup (abfd, which_howto);
+ reltab[relcount].sym_ptr_ptr = symtab + symidx;
+ relcount++;
+}
+
+static void
+save_relocs (asection *sec)
+{
+ int i;
+ sec->relocation = reltab;
+ sec->reloc_count = relcount;
+ sec->orelocation = (arelent **) xmalloc ((relcount+1) * sizeof (arelent *));
+ for (i=0; i<relcount; i++)
+ sec->orelocation[i] = sec->relocation + i;
+ sec->orelocation[relcount] = 0;
+ sec->flags |= SEC_RELOC;
+ reltab = 0;
+ relcount = relsize = 0;
+}
+
+/*
+ * .section .idata$2
+ * .global __head_my_dll
+ * __head_my_dll:
+ * .rva hname
+ * .long 0
+ * .long 0
+ * .rva __my_dll_iname
+ * .rva fthunk
+ *
+ * .section .idata$5
+ * .long 0
+ * fthunk:
+ *
+ * .section .idata$4
+ * .long 0
+ * hname:
+ */
+
+static bfd *
+make_head (parent)
+ bfd *parent;
+{
+ asection *id2, *id5, *id4;
+ unsigned char *d2, *d5, *d4;
+ char *oname;
+ bfd *abfd;
+
+ oname = (char *) xmalloc (20);
+ sprintf (oname, "d%06d.o", tmp_seq);
+ tmp_seq++;
+
+ abfd = bfd_create (oname, parent);
+ bfd_find_target (pe_details->object_target, abfd);
+ bfd_make_writable (abfd);
+
+ bfd_set_format (abfd, bfd_object);
+ bfd_set_arch_mach (abfd, pe_details->bfd_arch, 0);
+
+ symptr = 0;
+ symtab = (asymbol **) xmalloc (6 * sizeof (asymbol *));
+ id2 = quick_section (abfd, ".idata$2", SEC_HAS_CONTENTS, 2);
+ id5 = quick_section (abfd, ".idata$5", SEC_HAS_CONTENTS, 2);
+ id4 = quick_section (abfd, ".idata$4", SEC_HAS_CONTENTS, 2);
+ quick_symbol (abfd, U("_head_"), dll_symname, "", id2, BSF_GLOBAL, 0);
+ quick_symbol (abfd, U(""), dll_symname, "_iname", UNDSEC, BSF_GLOBAL, 0);
+
+ /* OK, pay attention here. I got confused myself looking back at
+ it. We create a four-byte section to mark the beginning of the
+ list, and we include an offset of 4 in the section, so that the
+ pointer to the list points to the *end* of this section, which is
+ the start of the list of sections from other objects. */
+
+ bfd_set_section_size (abfd, id2, 20);
+ d2 = (unsigned char *) xmalloc (20);
+ id2->contents = d2;
+ memset (d2, 0, 20);
+ d2[0] = d2[16] = 4; /* reloc addend */
+ quick_reloc (abfd, 0, BFD_RELOC_RVA, 2);
+ quick_reloc (abfd, 12, BFD_RELOC_RVA, 4);
+ quick_reloc (abfd, 16, BFD_RELOC_RVA, 1);
+ save_relocs (id2);
+
+ bfd_set_section_size (abfd, id5, 4);
+ d5 = (unsigned char *) xmalloc (4);
+ id5->contents = d5;
+ memset (d5, 0, 4);
+
+ bfd_set_section_size (abfd, id4, 4);
+ d4 = (unsigned char *) xmalloc (4);
+ id4->contents = d4;
+ memset (d4, 0, 4);
+
+ bfd_set_symtab (abfd, symtab, symptr);
+
+ bfd_set_section_contents (abfd, id2, d2, 0, 20);
+ bfd_set_section_contents (abfd, id5, d5, 0, 4);
+ bfd_set_section_contents (abfd, id4, d4, 0, 4);
+
+ bfd_make_readable (abfd);
+ return abfd;
+}
+
+/*
+ * .section .idata$4
+ * .long 0
+ * .section .idata$5
+ * .long 0
+ * .section idata$7
+ * .global __my_dll_iname
+ *__my_dll_iname:
+ * .asciz "my.dll"
+ */
+
+static bfd *
+make_tail (parent)
+ bfd *parent;
+{
+ asection *id4, *id5, *id7;
+ unsigned char *d4, *d5, *d7;
+ int len;
+ char *oname;
+ bfd *abfd;
+
+ oname = (char *) xmalloc (20);
+ sprintf (oname, "d%06d.o", tmp_seq);
+ tmp_seq++;
+
+ abfd = bfd_create (oname, parent);
+ bfd_find_target (pe_details->object_target, abfd);
+ bfd_make_writable (abfd);
+
+ bfd_set_format (abfd, bfd_object);
+ bfd_set_arch_mach (abfd, pe_details->bfd_arch, 0);
+
+ symptr = 0;
+ symtab = (asymbol **) xmalloc (5 * sizeof (asymbol *));
+ id4 = quick_section (abfd, ".idata$4", SEC_HAS_CONTENTS, 2);
+ id5 = quick_section (abfd, ".idata$5", SEC_HAS_CONTENTS, 2);
+ id7 = quick_section (abfd, ".idata$7", SEC_HAS_CONTENTS, 2);
+ quick_symbol (abfd, U(""), dll_symname, "_iname", id7, BSF_GLOBAL, 0);
+
+ bfd_set_section_size (abfd, id4, 4);
+ d4 = (unsigned char *) xmalloc (4);
+ id4->contents = d4;
+ memset (d4, 0, 4);
+
+ bfd_set_section_size (abfd, id5, 4);
+ d5 = (unsigned char *) xmalloc (4);
+ id5->contents = d5;
+ memset (d5, 0, 4);
+
+ len = strlen (dll_filename)+1;
+ if (len & 1)
+ len ++;
+ bfd_set_section_size (abfd, id7, len);
+ d7 = (unsigned char *) xmalloc (len);
+ id7->contents = d7;
+ strcpy (d7, dll_filename);
+
+ bfd_set_symtab (abfd, symtab, symptr);
+
+ bfd_set_section_contents (abfd, id4, d4, 0, 4);
+ bfd_set_section_contents (abfd, id5, d5, 0, 4);
+ bfd_set_section_contents (abfd, id7, d7, 0, len);
+
+ bfd_make_readable (abfd);
+ return abfd;
+}
+
+/*
+ * .text
+ * .global _function
+ * .global ___imp_function
+ * .global __imp__function
+ *_function:
+ * jmp *__imp__function:
+ *
+ * .section idata$7
+ * .long __head_my_dll
+ *
+ * .section .idata$5
+ *___imp_function:
+ *__imp__function:
+ *iat?
+ * .section .idata$4
+ *iat?
+ * .section .idata$6
+ *ID<ordinal>:
+ * .short <hint>
+ * .asciz "function" xlate? (add underscore, kill at)
+ */
+
+static unsigned char jmp_ix86_bytes[] = {
+ 0xff, 0x25, 0x00, 0x00, 0x00, 0x00, 0x90, 0x90
+};
+
+/*
+ *_function:
+ * mov.l ip+8,r0
+ * mov.l @r0,r0
+ * jmp @r0
+ * nop
+ * .dw __imp_function
+ */
+
+static unsigned char jmp_sh_bytes[] = {
+ 0x01, 0xd0, 0x02, 0x60, 0x2b, 0x40, 0x09, 0x00, 0x00, 0x00, 0x00, 0x00
+};
+
+/*
+ *_function:
+ * lui $t0,<high:__imp_function>
+ * lw $t0,<low:__imp_function>
+ * jr $t0
+ * nop
+ */
+
+static unsigned char jmp_mips_bytes[] = {
+ 0x00, 0x00, 0x08, 0x3c, 0x00, 0x00, 0x08, 0x8d,
+ 0x08, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00
+};
+
+static bfd *
+make_one (exp, parent)
+ def_file_export *exp;
+ bfd *parent;
+{
+ asection *tx, *id7, *id5, *id4, *id6;
+ unsigned char *td, *d7, *d5, *d4, *d6 = NULL;
+ int len;
+ char *oname;
+ bfd *abfd;
+ unsigned char *jmp_bytes = NULL;
+ int jmp_byte_count = 0;
+
+ switch (pe_details->pe_arch)
+ {
+ case PE_ARCH_i386:
+ jmp_bytes = jmp_ix86_bytes;
+ jmp_byte_count = sizeof (jmp_ix86_bytes);
+ break;
+ case PE_ARCH_sh:
+ jmp_bytes = jmp_sh_bytes;
+ jmp_byte_count = sizeof (jmp_sh_bytes);
+ break;
+ case PE_ARCH_mips:
+ jmp_bytes = jmp_mips_bytes;
+ jmp_byte_count = sizeof (jmp_mips_bytes);
+ break;
+ }
+
+ oname = (char *) xmalloc (20);
+ sprintf (oname, "d%06d.o", tmp_seq);
+ tmp_seq++;
+
+ abfd = bfd_create (oname, parent);
+ bfd_find_target (pe_details->object_target, abfd);
+ bfd_make_writable (abfd);
+
+ bfd_set_format (abfd, bfd_object);
+ bfd_set_arch_mach (abfd, pe_details->bfd_arch, 0);
+
+ symptr = 0;
+ symtab = (asymbol **) xmalloc (10 * sizeof (asymbol *));
+ tx = quick_section (abfd, ".text", SEC_CODE|SEC_HAS_CONTENTS, 2);
+ id7 = quick_section (abfd, ".idata$7", SEC_HAS_CONTENTS, 2);
+ id5 = quick_section (abfd, ".idata$5", SEC_HAS_CONTENTS, 2);
+ id4 = quick_section (abfd, ".idata$4", SEC_HAS_CONTENTS, 2);
+ id6 = quick_section (abfd, ".idata$6", SEC_HAS_CONTENTS, 2);
+ if (! exp->flag_data)
+ quick_symbol (abfd, U(""), exp->internal_name, "", tx, BSF_GLOBAL, 0);
+ quick_symbol (abfd, U("_head_"), dll_symname, "", UNDSEC, BSF_GLOBAL, 0);
+ quick_symbol (abfd, U("__imp_"), exp->internal_name, "", id5, BSF_GLOBAL, 0);
+ if (pe_dll_compat_implib)
+ quick_symbol (abfd, U("__imp_"), exp->internal_name, "",
+ id5, BSF_GLOBAL, 0);
+
+ bfd_set_section_size (abfd, tx, jmp_byte_count);
+ td = (unsigned char *) xmalloc (jmp_byte_count);
+ tx->contents = td;
+ memcpy (td, jmp_bytes, jmp_byte_count);
+ switch (pe_details->pe_arch)
+ {
+ case PE_ARCH_i386:
+ quick_reloc (abfd, 2, BFD_RELOC_32, 2);
+ break;
+ case PE_ARCH_sh:
+ quick_reloc (abfd, 8, BFD_RELOC_32, 2);
+ break;
+ case PE_ARCH_mips:
+ quick_reloc (abfd, 0, BFD_RELOC_HI16_S, 2);
+ quick_reloc (abfd, 0, BFD_RELOC_LO16, 0); /* MIPS_R_PAIR */
+ quick_reloc (abfd, 4, BFD_RELOC_LO16, 2);
+ break;
+ }
+ save_relocs (tx);
+
+ bfd_set_section_size (abfd, id7, 4);
+ d7 = (unsigned char *) xmalloc (4);
+ id7->contents = d7;
+ memset (d7, 0, 4);
+ quick_reloc (abfd, 0, BFD_RELOC_RVA, 6);
+ save_relocs (id7);
+
+ bfd_set_section_size (abfd, id5, 4);
+ d5 = (unsigned char *) xmalloc (4);
+ id5->contents = d5;
+ memset (d5, 0, 4);
+ if (exp->flag_noname)
+ {
+ d5[0] = exp->ordinal;
+ d5[1] = exp->ordinal >> 8;
+ d5[3] = 0x80;
+ }
+ else
+ {
+ quick_reloc (abfd, 0, BFD_RELOC_RVA, 4);
+ save_relocs (id5);
+ }
+
+ bfd_set_section_size (abfd, id4, 4);
+ d4 = (unsigned char *) xmalloc (4);
+ id4->contents = d4;
+ memset (d4, 0, 4);
+ if (exp->flag_noname)
+ {
+ d5[0] = exp->ordinal;
+ d5[1] = exp->ordinal >> 8;
+ d5[3] = 0x80;
+ }
+ else
+ {
+ quick_reloc (abfd, 0, BFD_RELOC_RVA, 4);
+ save_relocs (id4);
+ }
+
+ if (exp->flag_noname)
+ {
+ len = 0;
+ bfd_set_section_size (abfd, id6, 0);
+ }
+ else
+ {
+ len = strlen (exp->name) + 3;
+ if (len & 1)
+ len++;
+ bfd_set_section_size (abfd, id6, len);
+ d6 = (unsigned char *) xmalloc (len);
+ id6->contents = d6;
+ memset (d6, 0, len);
+ d6[0] = exp->hint & 0xff;
+ d6[1] = exp->hint >> 8;
+ strcpy (d6+2, exp->name);
+ }
+
+ bfd_set_symtab (abfd, symtab, symptr);
+
+ bfd_set_section_contents (abfd, tx, td, 0, jmp_byte_count);
+ bfd_set_section_contents (abfd, id7, d7, 0, 4);
+ bfd_set_section_contents (abfd, id5, d5, 0, 4);
+ bfd_set_section_contents (abfd, id4, d4, 0, 4);
+ if (!exp->flag_noname)
+ bfd_set_section_contents (abfd, id6, d6, 0, len);
+
+ bfd_make_readable (abfd);
+ return abfd;
+}
+
+void
+pe_dll_generate_implib (def, impfilename)
+ def_file *def;
+ const char *impfilename;
+{
+ int i;
+ bfd *ar_head;
+ bfd *ar_tail;
+ bfd *outarch;
+ bfd *head = 0;
+
+ dll_filename = (def->name) ? def->name : dll_name;
+ dll_symname = xstrdup (dll_filename);
+ for (i=0; dll_symname[i]; i++)
+ if (!isalnum ((unsigned char) dll_symname[i]))
+ dll_symname[i] = '_';
+
+ unlink (impfilename);
+
+ outarch = bfd_openw (impfilename, 0);
+
+ if (!outarch)
+ {
+ /* xgettext:c-format */
+ einfo (_("%XCan't open .lib file: %s\n"), impfilename);
+ return;
+ }
+
+ /* xgettext:c-format */
+ einfo (_("Creating library file: %s\n"), impfilename);
+
+ bfd_set_format (outarch, bfd_archive);
+ outarch->has_armap = 1;
+
+ /* Work out a reasonable size of things to put onto one line. */
+
+ ar_head = make_head (outarch);
+
+ for (i = 0; i<def->num_exports; i++)
+ {
+ /* The import library doesn't know about the internal name */
+ char *internal = def->exports[i].internal_name;
+ bfd *n;
+ def->exports[i].internal_name = def->exports[i].name;
+ n = make_one (def->exports+i, outarch);
+ n->next = head;
+ head = n;
+ def->exports[i].internal_name = internal;
+ }
+
+ ar_tail = make_tail (outarch);
+
+ if (ar_head == NULL || ar_tail == NULL)
+ return;
+
+ /* Now stick them all into the archive */
+
+ ar_head->next = head;
+ ar_tail->next = ar_head;
+ head = ar_tail;
+
+ if (! bfd_set_archive_head (outarch, head))
+ einfo ("%Xbfd_set_archive_head: %s\n", bfd_errmsg (bfd_get_error ()));
+
+ if (! bfd_close (outarch))
+ einfo ("%Xbfd_close %s: %s\n", impfilename, bfd_errmsg (bfd_get_error ()));
+
+ while (head != NULL)
+ {
+ bfd *n = head->next;
+ bfd_close (head);
+ head = n;
+ }
+}
+
+static void
+add_bfd_to_link (abfd, name, link_info)
+ bfd *abfd;
+ char *name;
+ struct bfd_link_info *link_info;
+{
+ lang_input_statement_type *fake_file;
+ fake_file = lang_add_input_file (name,
+ lang_input_file_is_fake_enum,
+ NULL);
+ fake_file->the_bfd = abfd;
+ ldlang_add_file (fake_file);
+ if (!bfd_link_add_symbols (abfd, link_info))
+ einfo ("%Xaddsym %s: %s\n", name, bfd_errmsg (bfd_get_error ()));
+}
+
+void
+pe_process_import_defs (output_bfd, link_info)
+ bfd *output_bfd;
+ struct bfd_link_info *link_info;
+{
+ def_file_module *module;
+ pe_dll_id_target(bfd_get_target (output_bfd));
+
+ if (!pe_def_file)
+ return;
+
+ for (module = pe_def_file->modules; module; module = module->next)
+ {
+ int i, do_this_dll;
+
+ dll_filename = module->name;
+ dll_symname = xstrdup (module->name);
+ for (i=0; dll_symname[i]; i++)
+ if (!isalnum (dll_symname[i]))
+ dll_symname[i] = '_';
+
+ do_this_dll = 0;
+
+ for (i=0; i<pe_def_file->num_imports; i++)
+ if (pe_def_file->imports[i].module == module)
+ {
+ def_file_export exp;
+ struct bfd_link_hash_entry *blhe;
+
+ /* see if we need this import */
+ char *name = (char *) xmalloc (strlen (pe_def_file->imports[i].internal_name) + 2);
+ sprintf (name, "%s%s", U(""), pe_def_file->imports[i].internal_name);
+ blhe = bfd_link_hash_lookup (link_info->hash, name,
+ false, false, false);
+ free (name);
+ if (blhe && blhe->type == bfd_link_hash_undefined)
+ {
+ bfd *one;
+ /* we do */
+ if (!do_this_dll)
+ {
+ bfd *ar_head = make_head (output_bfd);
+ add_bfd_to_link (ar_head, ar_head->filename, link_info);
+ do_this_dll = 1;
+ }
+ exp.internal_name = pe_def_file->imports[i].internal_name;
+ exp.name = pe_def_file->imports[i].name;
+ exp.ordinal = pe_def_file->imports[i].ordinal;
+ exp.hint = exp.ordinal >= 0 ? exp.ordinal : 0;
+ exp.flag_private = 0;
+ exp.flag_constant = 0;
+ exp.flag_data = 0;
+ exp.flag_noname = exp.name ? 0 : 1;
+ one = make_one (&exp, output_bfd);
+ add_bfd_to_link (one, one->filename, link_info);
+ }
+ }
+ if (do_this_dll)
+ {
+ bfd *ar_tail = make_tail (output_bfd);
+ add_bfd_to_link (ar_tail, ar_tail->filename, link_info);
+ }
+
+ free (dll_symname);
+ }
+}
+
+/************************************************************************
+
+ We were handed a *.DLL file. Parse it and turn it into a set of
+ IMPORTS directives in the def file. Return true if the file was
+ handled, false if not.
+
+ ************************************************************************/
+
+static unsigned int
+pe_get16 (abfd, where)
+ bfd *abfd;
+ int where;
+{
+ unsigned char b[2];
+ bfd_seek (abfd, where, SEEK_SET);
+ bfd_read (b, 1, 2, abfd);
+ return b[0] + (b[1]<<8);
+}
+
+static unsigned int
+pe_get32 (abfd, where)
+ bfd *abfd;
+ int where;
+{
+ unsigned char b[4];
+ bfd_seek (abfd, where, SEEK_SET);
+ bfd_read (b, 1, 4, abfd);
+ return b[0] + (b[1]<<8) + (b[2]<<16) + (b[3]<<24);
+}
+
+#if 0 /* This is not currently used. */
+
+static unsigned int
+pe_as16 (ptr)
+ void *ptr;
+{
+ unsigned char *b = ptr;
+ return b[0] + (b[1]<<8);
+}
+
+#endif
+
+static unsigned int
+pe_as32 (ptr)
+ void *ptr;
+{
+ unsigned char *b = ptr;
+ return b[0] + (b[1]<<8) + (b[2]<<16) + (b[3]<<24);
+}
+
+boolean
+pe_implied_import_dll (filename)
+ const char *filename;
+{
+ bfd *dll;
+ unsigned long pe_header_offset, opthdr_ofs, num_entries, i;
+ unsigned long export_rva, export_size, nsections, secptr, expptr;
+ unsigned char *expdata, *erva;
+ unsigned long name_rvas, ordinals, nexp, ordbase;
+ const char *dll_name;
+
+ /* No, I can't use bfd here. kernel32.dll puts its export table in
+ the middle of the .rdata section. */
+
+ dll = bfd_openr (filename, pe_details->target_name);
+ if (!dll)
+ {
+ einfo ("%Xopen %s: %s\n", filename, bfd_errmsg (bfd_get_error ()));
+ return false;
+ }
+ /* PEI dlls seem to be bfd_objects */
+ if (!bfd_check_format (dll, bfd_object))
+ {
+ einfo ("%X%s: this doesn't appear to be a DLL\n", filename);
+ return false;
+ }
+
+ dll_name = filename;
+ for (i=0; filename[i]; i++)
+ if (filename[i] == '/' || filename[i] == '\\' || filename[i] == ':')
+ dll_name = filename + i + 1;
+
+ pe_header_offset = pe_get32 (dll, 0x3c);
+ opthdr_ofs = pe_header_offset + 4 + 20;
+ num_entries = pe_get32 (dll, opthdr_ofs + 92);
+ if (num_entries < 1) /* no exports */
+ return false;
+ export_rva = pe_get32 (dll, opthdr_ofs + 96);
+ export_size = pe_get32 (dll, opthdr_ofs + 100);
+ nsections = pe_get16 (dll, pe_header_offset + 4 + 2);
+ secptr = (pe_header_offset + 4 + 20 +
+ pe_get16 (dll, pe_header_offset + 4 + 16));
+ expptr = 0;
+ for (i=0; i<nsections; i++)
+ {
+ char sname[8];
+ unsigned long secptr1 = secptr + 40 * i;
+ unsigned long vaddr = pe_get32 (dll, secptr1 + 12);
+ unsigned long vsize = pe_get32 (dll, secptr1 + 16);
+ unsigned long fptr = pe_get32 (dll, secptr1 + 20);
+ bfd_seek(dll, secptr1, SEEK_SET);
+ bfd_read(sname, 1, 8, dll);
+ if (vaddr <= export_rva && vaddr+vsize > export_rva)
+ {
+ expptr = fptr + (export_rva - vaddr);
+ if (export_rva + export_size > vaddr + vsize)
+ export_size = vsize - (export_rva - vaddr);
+ break;
+ }
+ }
+
+ expdata = (unsigned char *) xmalloc (export_size);
+ bfd_seek (dll, expptr, SEEK_SET);
+ bfd_read (expdata, 1, export_size, dll);
+ erva = expdata - export_rva;
+
+ if (pe_def_file == 0)
+ pe_def_file = def_file_empty();
+
+ nexp = pe_as32 (expdata+24);
+ name_rvas = pe_as32 (expdata+32);
+ ordinals = pe_as32 (expdata+36);
+ ordbase = pe_as32 (expdata+16);
+ for (i=0; i<nexp; i++)
+ {
+ unsigned long name_rva = pe_as32 (erva+name_rvas+i*4);
+ def_file_import *imp;
+ imp = def_file_add_import (pe_def_file, erva+name_rva, dll_name,
+ i, 0);
+ }
+
+ return true;
+}
+
+/************************************************************************
+
+ These are the main functions, called from the emulation. The first
+ is called after the bfds are read, so we can guess at how much space
+ we need. The second is called after everything is placed, so we
+ can put the right values in place.
+
+ ************************************************************************/
+
+void
+pe_dll_build_sections (abfd, info)
+ bfd *abfd;
+ struct bfd_link_info *info;
+{
+ pe_dll_id_target (bfd_get_target (abfd));
+ process_def_file (abfd, info);
+
+ generate_edata (abfd, info);
+ build_filler_bfd (1);
+}
+
+void
+pe_exe_build_sections (abfd, info)
+ bfd *abfd;
+ struct bfd_link_info *info ATTRIBUTE_UNUSED;
+{
+ pe_dll_id_target (bfd_get_target (abfd));
+ build_filler_bfd (0);
+}
+
+void
+pe_dll_fill_sections (abfd, info)
+ bfd *abfd;
+ struct bfd_link_info *info;
+{
+ pe_dll_id_target (bfd_get_target (abfd));
+ image_base = pe_data (abfd)->pe_opthdr.ImageBase;
+
+ generate_reloc (abfd, info);
+ if (reloc_sz > 0)
+ {
+ bfd_set_section_size (filler_bfd, reloc_s, reloc_sz);
+
+ /* 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);
+ }
+
+ fill_edata (abfd, info);
+
+ pe_data (abfd)->dll = 1;
+
+ edata_s->contents = edata_d;
+ reloc_s->contents = reloc_d;
+}
+
+void
+pe_exe_fill_sections (abfd, info)
+ bfd *abfd;
+ struct bfd_link_info *info;
+{
+ pe_dll_id_target (bfd_get_target (abfd));
+ image_base = pe_data (abfd)->pe_opthdr.ImageBase;
+
+ generate_reloc (abfd, info);
+ if (reloc_sz > 0)
+ {
+ bfd_set_section_size (filler_bfd, reloc_s, reloc_sz);
+
+ /* 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);
+ }
+ reloc_s->contents = reloc_d;
+}
diff --git a/contrib/binutils/ld/pe-dll.h b/contrib/binutils/ld/pe-dll.h
new file mode 100644
index 0000000..cf9e84a
--- /dev/null
+++ b/contrib/binutils/ld/pe-dll.h
@@ -0,0 +1,48 @@
+/* pe-dll.h: Header file for routines used to build Windows DLLs.
+ Copyright (C) 1999, 2000 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 PE_DLL_H
+#define PE_DLL_H
+
+#include "bfd.h"
+#include "sysdep.h"
+#include "bfdlink.h"
+#include "deffile.h"
+
+extern def_file *pe_def_file;
+extern int pe_dll_export_everything;
+extern int pe_dll_do_default_excludes;
+extern int pe_dll_kill_ats;
+extern int pe_dll_stdcall_aliases;
+extern int pe_dll_warn_dup_exports;
+extern int pe_dll_compat_implib;
+
+extern void pe_dll_id_target PARAMS ((const char *));
+extern void pe_dll_add_excludes PARAMS ((const char *));
+extern void pe_dll_generate_def_file PARAMS ((const char *));
+extern void pe_dll_generate_implib PARAMS ((def_file *, const char *));
+extern void pe_process_import_defs PARAMS ((bfd *, struct bfd_link_info *));
+extern boolean pe_implied_import_dll PARAMS ((const char *));
+extern void pe_dll_build_sections PARAMS ((bfd *, struct bfd_link_info *));
+extern void pe_exe_build_sections PARAMS ((bfd *, struct bfd_link_info *));
+extern void pe_dll_fill_sections PARAMS ((bfd *, struct bfd_link_info *));
+extern void pe_exe_fill_sections PARAMS ((bfd *, struct bfd_link_info *));
+
+#endif /* PE_DLL_H */
diff --git a/contrib/binutils/ld/po/Make-in b/contrib/binutils/ld/po/Make-in
new file mode 100644
index 0000000..4291090
--- /dev/null
+++ b/contrib/binutils/ld/po/Make-in
@@ -0,0 +1,251 @@
+# Makefile for program source directory in GNU NLS utilities package.
+# Copyright (C) 1995, 1996, 1997 by Ulrich Drepper <drepper@gnu.ai.mit.edu>
+#
+# This file file be copied and used freely without restrictions. It can
+# be used in projects which are not available under the GNU Public License
+# but which still want to provide support for the GNU gettext functionality.
+# Please note that the actual code is *not* freely available.
+
+PACKAGE = @PACKAGE@
+VERSION = @VERSION@
+
+SHELL = /bin/sh
+@SET_MAKE@
+
+srcdir = @srcdir@
+top_srcdir = @top_srcdir@
+VPATH = @srcdir@
+
+prefix = @prefix@
+exec_prefix = @exec_prefix@
+datadir = $(prefix)/@DATADIRNAME@
+localedir = $(datadir)/locale
+gnulocaledir = $(prefix)/share/locale
+gettextsrcdir = $(prefix)/share/gettext/po
+subdir = po
+
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+MKINSTALLDIRS = @MKINSTALLDIRS@
+
+CC = @CC@
+GENCAT = @GENCAT@
+GMSGFMT = PATH=../src:$$PATH @GMSGFMT@
+MSGFMT = @MSGFMT@
+XGETTEXT = PATH=../src:$$PATH @XGETTEXT@
+MSGMERGE = PATH=../src:$$PATH msgmerge
+
+DEFS = @DEFS@
+CFLAGS = @CFLAGS@
+CPPFLAGS = @CPPFLAGS@
+
+INCLUDES = -I.. -I$(top_srcdir)/intl
+
+COMPILE = $(CC) -c $(DEFS) $(INCLUDES) $(CPPFLAGS) $(CFLAGS) $(XCFLAGS)
+
+SOURCES = cat-id-tbl.c
+POFILES = @POFILES@
+GMOFILES = @GMOFILES@
+DISTFILES = ChangeLog Makefile.in.in POTFILES.in $(PACKAGE).pot \
+stamp-cat-id $(POFILES) $(GMOFILES) $(SOURCES)
+
+POTFILES = \
+
+CATALOGS = @CATALOGS@
+CATOBJEXT = @CATOBJEXT@
+INSTOBJEXT = @INSTOBJEXT@
+
+.SUFFIXES:
+.SUFFIXES: .c .o .po .pox .gmo .mo .msg .cat
+
+.c.o:
+ $(COMPILE) $<
+
+.po.pox:
+ $(MAKE) $(PACKAGE).pot
+ $(MSGMERGE) $< $(srcdir)/$(PACKAGE).pot -o $*.pox
+
+.po.mo:
+ $(MSGFMT) -o $@ $<
+
+.po.gmo:
+ file=$(srcdir)/`echo $* | sed 's,.*/,,'`.gmo \
+ && rm -f $$file && $(GMSGFMT) -o $$file $<
+
+.po.cat:
+ sed -f ../intl/po2msg.sed < $< > $*.msg \
+ && rm -f $@ && $(GENCAT) $@ $*.msg
+
+
+all: all-@USE_NLS@
+
+all-yes: $(CATALOGS) @MAINT@ $(PACKAGE).pot
+all-no:
+
+$(srcdir)/$(PACKAGE).pot: $(POTFILES)
+ $(XGETTEXT) --default-domain=$(PACKAGE) --directory=$(top_srcdir) \
+ --add-comments -C --keyword=_ --keyword=N_ \
+ --files-from=$(srcdir)/POTFILES.in
+ rm -f $(srcdir)/$(PACKAGE).pot
+ mv $(PACKAGE).po $(srcdir)/$(PACKAGE).pot
+
+$(srcdir)/cat-id-tbl.c: stamp-cat-id; @:
+$(srcdir)/stamp-cat-id: $(PACKAGE).pot
+ rm -f cat-id-tbl.tmp
+ sed -f ../intl/po2tbl.sed $(srcdir)/$(PACKAGE).pot \
+ | sed -e "s/@PACKAGE NAME@/$(PACKAGE)/" > cat-id-tbl.tmp
+ if cmp -s cat-id-tbl.tmp $(srcdir)/cat-id-tbl.c; then \
+ rm cat-id-tbl.tmp; \
+ else \
+ echo cat-id-tbl.c changed; \
+ rm -f $(srcdir)/cat-id-tbl.c; \
+ mv cat-id-tbl.tmp $(srcdir)/cat-id-tbl.c; \
+ fi
+ cd $(srcdir) && rm -f stamp-cat-id && echo timestamp > stamp-cat-id
+
+
+install: install-exec install-data
+install-exec:
+install-info:
+install-data: install-data-@USE_NLS@
+install-data-no: all
+install-data-yes: all
+ if test -r $(MKINSTALLDIRS); then \
+ $(MKINSTALLDIRS) $(datadir); \
+ else \
+ $(top_srcdir)/mkinstalldirs $(datadir); \
+ fi
+ @catalogs='$(CATALOGS)'; \
+ for cat in $$catalogs; do \
+ cat=`basename $$cat`; \
+ case "$$cat" in \
+ *.gmo) destdir=$(gnulocaledir);; \
+ *) destdir=$(localedir);; \
+ esac; \
+ lang=`echo $$cat | sed 's/\$(CATOBJEXT)$$//'`; \
+ dir=$$destdir/$$lang/LC_MESSAGES; \
+ if test -r $(MKINSTALLDIRS); then \
+ $(MKINSTALLDIRS) $$dir; \
+ else \
+ $(top_srcdir)/mkinstalldirs $$dir; \
+ fi; \
+ if test -r $$cat; then \
+ $(INSTALL_DATA) $$cat $$dir/$(PACKAGE)$(INSTOBJEXT); \
+ echo "installing $$cat as $$dir/$(PACKAGE)$(INSTOBJEXT)"; \
+ else \
+ $(INSTALL_DATA) $(srcdir)/$$cat $$dir/$(PACKAGE)$(INSTOBJEXT); \
+ echo "installing $(srcdir)/$$cat as" \
+ "$$dir/$(PACKAGE)$(INSTOBJEXT)"; \
+ fi; \
+ if test -r $$cat.m; then \
+ $(INSTALL_DATA) $$cat.m $$dir/$(PACKAGE)$(INSTOBJEXT).m; \
+ echo "installing $$cat.m as $$dir/$(PACKAGE)$(INSTOBJEXT).m"; \
+ else \
+ if test -r $(srcdir)/$$cat.m ; then \
+ $(INSTALL_DATA) $(srcdir)/$$cat.m \
+ $$dir/$(PACKAGE)$(INSTOBJEXT).m; \
+ echo "installing $(srcdir)/$$cat as" \
+ "$$dir/$(PACKAGE)$(INSTOBJEXT).m"; \
+ else \
+ true; \
+ fi; \
+ fi; \
+ done
+ if test "$(PACKAGE)" = "gettext"; then \
+ if test -r $(MKINSTALLDIRS); then \
+ $(MKINSTALLDIRS) $(gettextsrcdir); \
+ else \
+ $(top_srcdir)/mkinstalldirs $(gettextsrcdir); \
+ fi; \
+ $(INSTALL_DATA) $(srcdir)/Makefile.in.in \
+ $(gettextsrcdir)/Makefile.in.in; \
+ else \
+ : ; \
+ fi
+
+# Define this as empty until I found a useful application.
+installcheck:
+
+uninstall:
+ catalogs='$(CATALOGS)'; \
+ for cat in $$catalogs; do \
+ cat=`basename $$cat`; \
+ lang=`echo $$cat | sed 's/\$(CATOBJEXT)$$//'`; \
+ rm -f $(localedir)/$$lang/LC_MESSAGES/$(PACKAGE)$(INSTOBJEXT); \
+ rm -f $(localedir)/$$lang/LC_MESSAGES/$(PACKAGE)$(INSTOBJEXT).m; \
+ rm -f $(gnulocaledir)/$$lang/LC_MESSAGES/$(PACKAGE)$(INSTOBJEXT); \
+ rm -f $(gnulocaledir)/$$lang/LC_MESSAGES/$(PACKAGE)$(INSTOBJEXT).m; \
+ done
+ rm -f $(gettextsrcdir)/po-Makefile.in.in
+
+check: all
+
+cat-id-tbl.o: ../intl/libgettext.h
+
+dvi info tags TAGS ID:
+
+mostlyclean:
+ rm -f core core.* *.pox $(PACKAGE).po *.old.po cat-id-tbl.tmp
+ rm -fr *.o
+
+clean: mostlyclean
+
+distclean: clean
+ rm -f Makefile Makefile.in POTFILES *.mo *.msg *.cat *.cat.m
+
+maintainer-clean: distclean
+ @echo "This command is intended for maintainers to use;"
+ @echo "it deletes files that may require special tools to rebuild."
+ rm -f $(GMOFILES)
+
+distdir = ../$(PACKAGE)-$(VERSION)/$(subdir)
+dist distdir: update-po $(DISTFILES)
+ dists="$(DISTFILES)"; \
+ for file in $$dists; do \
+ ln $(srcdir)/$$file $(distdir) 2> /dev/null \
+ || cp -p $(srcdir)/$$file $(distdir); \
+ done
+
+update-po: Makefile
+ $(MAKE) $(PACKAGE).pot
+ PATH=`pwd`/../src:$$PATH; \
+ cd $(srcdir); \
+ catalogs='$(CATALOGS)'; \
+ for cat in $$catalogs; do \
+ cat=`basename $$cat`; \
+ lang=`echo $$cat | sed 's/\$(CATOBJEXT)$$//'`; \
+ mv $$lang.po $$lang.old.po; \
+ echo "$$lang:"; \
+ if $(MSGMERGE) $$lang.old.po $(PACKAGE).pot -o $$lang.po; then \
+ rm -f $$lang.old.po; \
+ else \
+ echo "msgmerge for $$cat failed!"; \
+ rm -f $$lang.po; \
+ mv $$lang.old.po $$lang.po; \
+ fi; \
+ done
+
+POTFILES: POTFILES.in
+ ( if test 'x$(srcdir)' != 'x.'; then \
+ posrcprefix='$(top_srcdir)/'; \
+ else \
+ posrcprefix="../"; \
+ fi; \
+ rm -f $@-t $@ \
+ && (sed -e '/^#/d' -e '/^[ ]*$$/d' \
+ -e "s@.*@ $$posrcprefix& \\\\@" < $(srcdir)/$@.in \
+ | sed -e '$$s/\\$$//') > $@-t \
+ && chmod a-w $@-t \
+ && mv $@-t $@ )
+
+POTFILES.in: @MAINT@ ../Makefile
+ cd .. && $(MAKE) po/POTFILES.in
+
+Makefile: Make-in ../config.status POTFILES
+ cd .. \
+ && CONFIG_FILES=$(subdir)/Makefile.in:$(subdir)/Make-in \
+ CONFIG_HEADERS= $(SHELL) ./config.status
+
+# Tell versions [3.59,3.63) of GNU make not to export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/contrib/binutils/ld/po/POTFILES.in b/contrib/binutils/ld/po/POTFILES.in
new file mode 100644
index 0000000..55ae6ff
--- /dev/null
+++ b/contrib/binutils/ld/po/POTFILES.in
@@ -0,0 +1,29 @@
+deffile.h
+emultempl/armcoff.em
+emultempl/pe.em
+ldcref.c
+ldctor.c
+ldctor.h
+ldemul.c
+ldemul.h
+ldexp.c
+ldexp.h
+ldfile.c
+ldfile.h
+ld.h
+ldlang.c
+ldlang.h
+ldlex.h
+ldmain.c
+ldmain.h
+ldmisc.c
+ldmisc.h
+ldver.c
+ldver.h
+ldwrite.c
+ldwrite.h
+lexsup.c
+mri.c
+mri.h
+pe-dll.c
+pe-dll.h
diff --git a/contrib/binutils/ld/po/ld.pot b/contrib/binutils/ld/po/ld.pot
new file mode 100644
index 0000000..6efdf65
--- /dev/null
+++ b/contrib/binutils/ld/po/ld.pot
@@ -0,0 +1,1502 @@
+# SOME DESCRIPTIVE TITLE.
+# Copyright (C) YEAR Free Software Foundation, Inc.
+# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
+#
+#, fuzzy
+msgid ""
+msgstr ""
+"Project-Id-Version: PACKAGE VERSION\n"
+"POT-Creation-Date: 2000-04-05 14:09+0930\n"
+"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
+"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
+"Language-Team: LANGUAGE <LL@li.org>\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=CHARSET\n"
+"Content-Transfer-Encoding: ENCODING\n"
+
+#: emultempl/armcoff.em:69
+msgid " --support-old-code Support interworking with old code\n"
+msgstr ""
+
+#: emultempl/armcoff.em:70
+msgid " --thumb-entry=<sym> Set the entry point to be Thumb symbol <sym>\n"
+msgstr ""
+
+#: emultempl/armcoff.em:139
+#, c-format
+msgid "Errors encountered processing file %s"
+msgstr ""
+
+#: emultempl/armcoff.em:205 emultempl/pe.em:1035
+msgid "%P: warning: '--thumb-entry %s' is overriding '-e %s'\n"
+msgstr ""
+
+#: emultempl/armcoff.em:210 emultempl/pe.em:1040
+msgid "%P: warning: connot find thumb start symbol %s\n"
+msgstr ""
+
+#: emultempl/pe.em:257
+msgid ""
+" --base_file <basefile> Generate a base file for relocatable "
+"DLLs\n"
+msgstr ""
+
+#: emultempl/pe.em:258
+msgid ""
+" --dll Set image base to the default for DLLs\n"
+msgstr ""
+
+#: emultempl/pe.em:259
+msgid " --file-alignment <size> Set file alignment\n"
+msgstr ""
+
+#: emultempl/pe.em:260
+msgid " --heap <size> Set initial size of the heap\n"
+msgstr ""
+
+#: emultempl/pe.em:261
+msgid ""
+" --image-base <address> Set start address of the executable\n"
+msgstr ""
+
+#: emultempl/pe.em:262
+msgid ""
+" --major-image-version <number> Set version number of the executable\n"
+msgstr ""
+
+#: emultempl/pe.em:263
+msgid " --major-os-version <number> Set minimum required OS version\n"
+msgstr ""
+
+#: emultempl/pe.em:264
+msgid ""
+" --major-subsystem-version <number> Set minimum required OS subsystem "
+"version\n"
+msgstr ""
+
+#: emultempl/pe.em:265
+msgid ""
+" --minor-image-version <number> Set revision number of the executable\n"
+msgstr ""
+
+#: emultempl/pe.em:266
+msgid " --minor-os-version <number> Set minimum required OS revision\n"
+msgstr ""
+
+#: emultempl/pe.em:267
+msgid ""
+" --minor-subsystem-version <number> Set minimum required OS subsystem "
+"revision\n"
+msgstr ""
+
+#: emultempl/pe.em:268
+msgid " --section-alignment <size> Set section alignment\n"
+msgstr ""
+
+#: emultempl/pe.em:269
+msgid " --stack <size> Set size of the initial stack\n"
+msgstr ""
+
+#: emultempl/pe.em:270
+msgid ""
+" --subsystem <name>[:<version>] Set required OS subsystem [& version]\n"
+msgstr ""
+
+#: emultempl/pe.em:271
+msgid ""
+" --support-old-code Support interworking with old code\n"
+msgstr ""
+
+#: emultempl/pe.em:272
+msgid ""
+" --thumb-entry=<symbol> Set the entry point to be Thumb "
+"<symbol>\n"
+msgstr ""
+
+#: emultempl/pe.em:274
+msgid ""
+" --add-stdcall-alias Export symbols with and without @nn\n"
+msgstr ""
+
+#: emultempl/pe.em:275
+msgid " --disable-stdcall-fixup Don't link _sym to _sym@nn\n"
+msgstr ""
+
+#: emultempl/pe.em:276
+msgid ""
+" --enable-stdcall-fixup Link _sym to _sym@nn without warnings\n"
+msgstr ""
+
+#: emultempl/pe.em:277
+msgid ""
+" --exclude-symbols sym,sym,... Exclude symbols from automatic export\n"
+msgstr ""
+
+#: emultempl/pe.em:278
+msgid ""
+" --export-all-symbols Automatically export all globals to "
+"DLL\n"
+msgstr ""
+
+#: emultempl/pe.em:279
+msgid " --kill-at Remove @nn from exported symbols\n"
+msgstr ""
+
+#: emultempl/pe.em:280
+msgid " --out-implib <file> Generate import library\n"
+msgstr ""
+
+#: emultempl/pe.em:281
+msgid ""
+" --output-def <file> Generate a .DEF file for the built DLL\n"
+msgstr ""
+
+#: emultempl/pe.em:282
+msgid " --warn-duplicate-exports Warn about duplicate exports.\n"
+msgstr ""
+
+#: emultempl/pe.em:283
+msgid ""
+" --compat-implib Create backward compatible import "
+"libs;\n"
+msgstr ""
+
+#: emultempl/pe.em:284
+msgid " create __imp_<SYMBOL> as well.\n"
+msgstr ""
+
+#: emultempl/pe.em:352
+msgid "%P: warning: bad version number in -subsystem option\n"
+msgstr ""
+
+#: emultempl/pe.em:388
+msgid "%P%F: invalid subsystem type %s\n"
+msgstr ""
+
+#: emultempl/pe.em:403
+msgid "%P%F: invalid hex number for PE parameter '%s'\n"
+msgstr ""
+
+#: emultempl/pe.em:421
+msgid "%P%F: strange hex info for PE parameter '%s'\n"
+msgstr ""
+
+#: emultempl/pe.em:460
+#, c-format
+msgid "%s: Can't open base file %s\n"
+msgstr ""
+
+#: emultempl/pe.em:602
+msgid "%P: warning, file alignment > section alignment.\n"
+msgstr ""
+
+#: emultempl/pe.em:673 emultempl/pe.em:699
+#, c-format
+msgid "Warning: resolving %s by linking to %s\n"
+msgstr ""
+
+#: emultempl/pe.em:678 emultempl/pe.em:704
+msgid "Use --enable-stdcall-fixup to disable these warnings\n"
+msgstr ""
+
+#: emultempl/pe.em:679 emultempl/pe.em:705
+msgid "Use --disable-stdcall-fixup to disable these fixups\n"
+msgstr ""
+
+#: emultempl/pe.em:722
+msgid "%F%P: PE operations on non PE file.\n"
+msgstr ""
+
+#: emultempl/pe.em:839
+#, c-format
+msgid "Errors encountered processing file %s\n"
+msgstr ""
+
+#: emultempl/pe.em:862
+#, c-format
+msgid "Errors encountered processing file %s for interworking"
+msgstr ""
+
+#: emultempl/pe.em:918 ldlang.c:1961 ldlang.c:4333 ldlang.c:4367 ldmain.c:996
+msgid "%P%F: bfd_link_hash_lookup failed: %E\n"
+msgstr ""
+
+#: ldcref.c:162
+msgid "%X%P: bfd_hash_table_init of cref table failed: %E\n"
+msgstr ""
+
+#: ldcref.c:168
+msgid "%X%P: cref_hash_lookup failed: %E\n"
+msgstr ""
+
+#: ldcref.c:239
+msgid ""
+"\n"
+"Cross Reference Table\n"
+"\n"
+msgstr ""
+
+#: ldcref.c:240
+msgid "Symbol"
+msgstr ""
+
+#: ldcref.c:248
+msgid "File\n"
+msgstr ""
+
+#: ldcref.c:252
+msgid "No symbols\n"
+msgstr ""
+
+#: ldcref.c:369
+msgid "%P: symbol `%T' missing from main hash table\n"
+msgstr ""
+
+#: ldcref.c:441
+msgid "%B%F: could not read symbols; %E\n"
+msgstr ""
+
+#: ldcref.c:445 ldmain.c:1064 ldmain.c:1068
+msgid "%B%F: could not read symbols: %E\n"
+msgstr ""
+
+#: ldcref.c:517 ldcref.c:524 ldmain.c:1114 ldmain.c:1121
+msgid "%B%F: could not read relocs: %E\n"
+msgstr ""
+
+#. 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.
+#: ldcref.c:542
+msgid "%X%C: prohibited cross reference from %s to `%T' in %s\n"
+msgstr ""
+
+#: ldctor.c:89
+msgid "%P%X: Different relocs used in set %s\n"
+msgstr ""
+
+#: ldctor.c:106
+msgid "%P%X: Different object file formats composing set %s\n"
+msgstr ""
+
+#: ldctor.c:288 ldctor.c:302
+msgid "%P%X: %s does not support reloc %s for set %s\n"
+msgstr ""
+
+#: ldctor.c:323
+msgid "%P%X: Unsupported size %d for set %s\n"
+msgstr ""
+
+#: ldctor.c:344
+msgid ""
+"\n"
+"Set Symbol\n"
+"\n"
+msgstr ""
+
+#: ldemul.c:224
+msgid "%S SYSLIB ignored\n"
+msgstr ""
+
+#: ldemul.c:232
+msgid "%S HLL ignored\n"
+msgstr ""
+
+#: ldemul.c:253
+msgid "%P: unrecognised emulation mode: %s\n"
+msgstr ""
+
+#: ldemul.c:254
+msgid "Supported emulations: "
+msgstr ""
+
+#: ldemul.c:298
+msgid " no emulation specific options.\n"
+msgstr ""
+
+#: ldexp.c:157
+msgid "%F%P: %s uses undefined section %s\n"
+msgstr ""
+
+#: ldexp.c:159
+msgid "%F%P: %s forward reference of section %s\n"
+msgstr ""
+
+#: ldexp.c:271
+msgid "%F%S %% by zero\n"
+msgstr ""
+
+#: ldexp.c:278
+msgid "%F%S / by zero\n"
+msgstr ""
+
+#: ldexp.c:401
+msgid "%X%S: unresolvable symbol `%s' referenced in expression\n"
+msgstr ""
+
+#: ldexp.c:420
+msgid "%F%S: undefined symbol `%s' referenced in expression\n"
+msgstr ""
+
+#: ldexp.c:602
+msgid "%F%S can not PROVIDE assignment to location counter\n"
+msgstr ""
+
+#: ldexp.c:612
+msgid "%F%S invalid assignment to location counter\n"
+msgstr ""
+
+#: ldexp.c:616
+msgid "%F%S assignment to location counter invalid outside of SECTION\n"
+msgstr ""
+
+#: ldexp.c:626
+msgid "%F%S cannot move location counter backwards (from %V to %V)\n"
+msgstr ""
+
+#: ldexp.c:654
+msgid "%P%F:%s: hash creation failed\n"
+msgstr ""
+
+#: ldexp.c:951
+msgid "%F%S nonconstant expression for %s\n"
+msgstr ""
+
+#: ldexp.c:984
+msgid "%F%S non constant expression for %s\n"
+msgstr ""
+
+#: ldfile.c:108
+#, c-format
+msgid "attempt to open %s failed\n"
+msgstr ""
+
+#: ldfile.c:110
+#, c-format
+msgid "attempt to open %s succeeded\n"
+msgstr ""
+
+#: ldfile.c:116
+msgid "%F%P: invalid BFD target `%s'\n"
+msgstr ""
+
+#: ldfile.c:140
+msgid "%P: skipping incompatible %s when searching for %s"
+msgstr ""
+
+#: ldfile.c:232
+msgid "%F%P: cannot open %s for %s: %E\n"
+msgstr ""
+
+#: ldfile.c:235
+msgid "%F%P: cannot open %s: %E\n"
+msgstr ""
+
+#: ldfile.c:255
+msgid "%F%P: cannot find %s\n"
+msgstr ""
+
+#: ldfile.c:273 ldfile.c:288
+#, c-format
+msgid "cannot find script file %s\n"
+msgstr ""
+
+#: ldfile.c:275 ldfile.c:290
+#, c-format
+msgid "opened script file %s\n"
+msgstr ""
+
+#: ldfile.c:333
+msgid "%P%F: cannot open linker script file %s: %E\n"
+msgstr ""
+
+#: ldfile.c:374
+msgid "%P%F: unknown architecture: %s\n"
+msgstr ""
+
+#: ldfile.c:391
+msgid "%P%F: target architecture respecified\n"
+msgstr ""
+
+#: ldfile.c:444
+msgid "%P%F: cannot represent machine `%s'\n"
+msgstr ""
+
+#: ldlang.c:736
+msgid ""
+"\n"
+"Memory Configuration\n"
+"\n"
+msgstr ""
+
+#: ldlang.c:738
+msgid "Name"
+msgstr ""
+
+#: ldlang.c:738
+msgid "Origin"
+msgstr ""
+
+#: ldlang.c:738
+msgid "Length"
+msgstr ""
+
+#: ldlang.c:738
+msgid "Attributes"
+msgstr ""
+
+#: ldlang.c:780
+msgid ""
+"\n"
+"Linker script and memory map\n"
+"\n"
+msgstr ""
+
+#: ldlang.c:797
+msgid "%P%F: Illegal use of `%s' section"
+msgstr ""
+
+#: ldlang.c:807
+msgid "%P%F: output format %s cannot represent section called %s\n"
+msgstr ""
+
+#: ldlang.c:970
+msgid "%P: %B: warning: ignoring duplicate section `%s'\n"
+msgstr ""
+
+#: ldlang.c:973
+msgid "%P: %B: warning: ignoring duplicate `%s' section symbol `%s'\n"
+msgstr ""
+
+#: ldlang.c:987
+msgid "%P: %B: warning: duplicate section `%s' has different size\n"
+msgstr ""
+
+#: ldlang.c:1039
+msgid "%P%F: Failed to create hash table\n"
+msgstr ""
+
+#: ldlang.c:1422
+msgid "%B: file not recognized: %E\n"
+msgstr ""
+
+#: ldlang.c:1423
+msgid "%B: matching formats:"
+msgstr ""
+
+#: ldlang.c:1430
+msgid "%F%B: file not recognized: %E\n"
+msgstr ""
+
+#: ldlang.c:1483
+msgid "%F%B: object %B in archive is not object\n"
+msgstr ""
+
+#: ldlang.c:1489 ldlang.c:1501
+msgid "%F%B: could not read symbols: %E\n"
+msgstr ""
+
+#: ldlang.c:1747
+msgid ""
+"%P: warning: could not find any targets that match endianness requirement\n"
+msgstr ""
+
+#: ldlang.c:1759
+msgid "%P%F: target %s not found\n"
+msgstr ""
+
+#: ldlang.c:1761
+msgid "%P%F: cannot open output file %s: %E\n"
+msgstr ""
+
+#: ldlang.c:1769
+msgid "%P%F:%s: can not make object file: %E\n"
+msgstr ""
+
+#: ldlang.c:1773
+msgid "%P%F:%s: can not set architecture: %E\n"
+msgstr ""
+
+#: ldlang.c:1777
+msgid "%P%F: can not create link hash table: %E\n"
+msgstr ""
+
+#: ldlang.c:2084
+msgid " load address 0x%V"
+msgstr ""
+
+#: ldlang.c:2214
+msgid "%W (size before relaxing)\n"
+msgstr ""
+
+#: ldlang.c:2296
+#, c-format
+msgid "Address of section %s set to "
+msgstr ""
+
+#: ldlang.c:2445
+#, c-format
+msgid "Fail with %d\n"
+msgstr ""
+
+#: ldlang.c:2684
+msgid "%X%P: section %s [%V -> %V] overlaps section %s [%V -> %V]\n"
+msgstr ""
+
+#: ldlang.c:2718
+msgid "%X%P: address 0x%v of %B section %s is not within region %s\n"
+msgstr ""
+
+#: ldlang.c:2726
+msgid "%X%P: region %s is full (%B section %s)\n"
+msgstr ""
+
+#: ldlang.c:2775
+msgid "%P%X: Internal error on COFF shared library section %s\n"
+msgstr ""
+
+#: ldlang.c:2816
+msgid "%P: warning: no memory region specified for section `%s'\n"
+msgstr ""
+
+#: ldlang.c:2829
+msgid "%P: warning: changing start of section %s by %u bytes\n"
+msgstr ""
+
+#: ldlang.c:2843
+msgid "%F%S: non constant address expression for section %s\n"
+msgstr ""
+
+#: ldlang.c:2907
+msgid "%X%P: use an absolute load address or a load memory region, not both\n"
+msgstr ""
+
+#: ldlang.c:3020
+msgid "%P%F: can't relax section: %E\n"
+msgstr ""
+
+#: ldlang.c:3185
+msgid "%F%P: invalid data statement\n"
+msgstr ""
+
+#: ldlang.c:3222
+msgid "%F%P: invalid reloc statement\n"
+msgstr ""
+
+#: ldlang.c:3358
+msgid "%P%F:%s: can't set start address\n"
+msgstr ""
+
+#: ldlang.c:3371 ldlang.c:3388
+msgid "%P%F: can't set start address\n"
+msgstr ""
+
+#: ldlang.c:3383
+msgid "%P: warning: cannot find entry symbol %s; defaulting to %V\n"
+msgstr ""
+
+#: ldlang.c:3393
+msgid "%P: warning: cannot find entry symbol %s; not setting start address\n"
+msgstr ""
+
+#: ldlang.c:3435
+msgid ""
+"%P: warning: %s architecture of input file `%B' is incompatible with %s "
+"output\n"
+msgstr ""
+
+#: ldlang.c:3453
+msgid "%E%X: failed to merge target specific data of file %B\n"
+msgstr ""
+
+#: ldlang.c:3540
+msgid ""
+"\n"
+"Allocating common symbols\n"
+msgstr ""
+
+#: ldlang.c:3541
+msgid ""
+"Common symbol size file\n"
+"\n"
+msgstr ""
+
+#. This message happens when using the
+#. svr3.ifile linker script, so I have
+#. disabled it.
+#: ldlang.c:3626
+msgid "%P: no [COMMON] command, defaulting to .bss\n"
+msgstr ""
+
+#: ldlang.c:3686
+msgid "%P%F: invalid syntax in flags\n"
+msgstr ""
+
+#: ldlang.c:4281
+msgid "%P%Fmultiple STARTUP files\n"
+msgstr ""
+
+#: ldlang.c:4553
+msgid "%F%P: bfd_record_phdr failed: %E\n"
+msgstr ""
+
+#: ldlang.c:4572
+msgid "%X%P: section `%s' assigned to non-existent phdr `%s'\n"
+msgstr ""
+
+#: ldlang.c:4881
+msgid "%X%P: unknown language `%s' in version information\n"
+msgstr ""
+
+#: ldlang.c:4930
+msgid "%X%P: duplicate version tag `%s'\n"
+msgstr ""
+
+#: ldlang.c:4943 ldlang.c:4956
+msgid "%X%P: duplicate expression `%s' in version information\n"
+msgstr ""
+
+#: ldlang.c:4993
+msgid "%X%P: unable to find version dependency `%s'\n"
+msgstr ""
+
+#: ldlang.c:5015
+msgid "%X%P: unable to read .exports section contents"
+msgstr ""
+
+#: ldmain.c:192
+msgid "%X%P: can't set BFD default target to `%s': %E\n"
+msgstr ""
+
+#: ldmain.c:262
+msgid "%P%F: -r and --mpc860c0 may not be used together\n"
+msgstr ""
+
+#: ldmain.c:264
+msgid "%P%F: --relax and -r may not be used together\n"
+msgstr ""
+
+#: ldmain.c:266
+msgid "%P%F: -r and -shared may not be used together\n"
+msgstr ""
+
+#: ldmain.c:295
+msgid "using internal linker script:\n"
+msgstr ""
+
+#: ldmain.c:314
+msgid "%P%F: no input files\n"
+msgstr ""
+
+#: ldmain.c:319
+msgid "%P: mode %s\n"
+msgstr ""
+
+#: ldmain.c:337
+msgid "%P%F: cannot open map file %s: %E\n"
+msgstr ""
+
+#: ldmain.c:383
+msgid "%P: link errors found, deleting executable `%s'\n"
+msgstr ""
+
+#: ldmain.c:394
+msgid "%F%B: final close failed: %E\n"
+msgstr ""
+
+#: ldmain.c:418
+msgid "%X%P: unable to open for source of copy `%s'\n"
+msgstr ""
+
+#: ldmain.c:420
+msgid "%X%P: unable to open for destination of copy `%s'\n"
+msgstr ""
+
+#: ldmain.c:426
+msgid "%P: Error writing file `%s'\n"
+msgstr ""
+
+#: ldmain.c:432 pe-dll.c:1082
+#, c-format
+msgid "%P: Error closing file `%s'\n"
+msgstr ""
+
+#: ldmain.c:449
+#, c-format
+msgid "%s: total time in link: %ld.%06ld\n"
+msgstr ""
+
+#: ldmain.c:452
+#, c-format
+msgid "%s: data size %ld\n"
+msgstr ""
+
+#: ldmain.c:493
+msgid "%P%F: missing argument to -m\n"
+msgstr ""
+
+#: ldmain.c:607 ldmain.c:628 ldmain.c:659
+msgid "%P%F: bfd_hash_table_init failed: %E\n"
+msgstr ""
+
+#: ldmain.c:612 ldmain.c:631
+msgid "%P%F: bfd_hash_lookup failed: %E\n"
+msgstr ""
+
+#: ldmain.c:646
+msgid "%X%P: error: duplicate retain-symbols-file\n"
+msgstr ""
+
+#: ldmain.c:690
+msgid "%P%F: bfd_hash_lookup for insertion failed: %E\n"
+msgstr ""
+
+#: ldmain.c:695
+msgid "%P: `-retain-symbols-file' overrides `-s' and `-S'\n"
+msgstr ""
+
+#: ldmain.c:772
+msgid "Archive member included"
+msgstr ""
+
+#: ldmain.c:773
+msgid "because of file (symbol)"
+msgstr ""
+
+#: ldmain.c:845
+msgid "%X%C: multiple definition of `%T'\n"
+msgstr ""
+
+#: ldmain.c:848
+msgid "%D: first defined here\n"
+msgstr ""
+
+#: ldmain.c:877
+msgid "%B: warning: definition of `%T' overriding common\n"
+msgstr ""
+
+#: ldmain.c:880
+msgid "%B: warning: common is here\n"
+msgstr ""
+
+#: ldmain.c:887
+msgid "%B: warning: common of `%T' overridden by definition\n"
+msgstr ""
+
+#: ldmain.c:890
+msgid "%B: warning: defined here\n"
+msgstr ""
+
+#: ldmain.c:897
+msgid "%B: warning: common of `%T' overridden by larger common\n"
+msgstr ""
+
+#: ldmain.c:900
+msgid "%B: warning: larger common is here\n"
+msgstr ""
+
+#: ldmain.c:904
+msgid "%B: warning: common of `%T' overriding smaller common\n"
+msgstr ""
+
+#: ldmain.c:907
+msgid "%B: warning: smaller common is here\n"
+msgstr ""
+
+#: ldmain.c:911
+msgid "%B: warning: multiple common of `%T'\n"
+msgstr ""
+
+#: ldmain.c:913
+msgid "%B: warning: previous common is here\n"
+msgstr ""
+
+#: ldmain.c:935 ldmain.c:974
+msgid "%P: warning: global constructor %s used\n"
+msgstr ""
+
+#: ldmain.c:984
+msgid "%P%F: BFD backend error: BFD_RELOC_CTOR unsupported\n"
+msgstr ""
+
+#: ldmain.c:1171
+msgid "%F%P: bfd_hash_table_init failed: %E\n"
+msgstr ""
+
+#: ldmain.c:1178
+msgid "%F%P: bfd_hash_lookup failed: %E\n"
+msgstr ""
+
+#: ldmain.c:1198
+msgid "%C: undefined reference to `%T'\n"
+msgstr ""
+
+#: ldmain.c:1204
+msgid "%D: more undefined references to `%T' follow\n"
+msgstr ""
+
+#: ldmain.c:1211
+msgid "%B: undefined reference to `%T'\n"
+msgstr ""
+
+#: ldmain.c:1217
+msgid "%B: more undefined references to `%T' follow\n"
+msgstr ""
+
+#: ldmain.c:1238 ldmain.c:1260 ldmain.c:1280
+msgid "%P%X: generated"
+msgstr ""
+
+#: ldmain.c:1241
+msgid " relocation truncated to fit: %s %T"
+msgstr ""
+
+#: ldmain.c:1263
+#, c-format
+msgid "dangerous relocation: %s\n"
+msgstr ""
+
+#: ldmain.c:1283
+msgid " reloc refers to symbol `%T' which is not being output\n"
+msgstr ""
+
+#: ldmisc.c:178
+msgid "no symbol"
+msgstr ""
+
+#: ldmisc.c:242
+#, c-format
+msgid "built in linker script:%u"
+msgstr ""
+
+#: ldmisc.c:292 ldmisc.c:296
+msgid "%B%F: could not read symbols\n"
+msgstr ""
+
+#. We use abfd->filename in this initial line,
+#. in case filename is a .h file or something
+#. similarly unhelpful.
+#: ldmisc.c:332
+msgid "%B: In function `%T':\n"
+msgstr ""
+
+#: ldmisc.c:464
+msgid "%F%P: internal error %s %d\n"
+msgstr ""
+
+#: ldmisc.c:550
+msgid "%P: internal error: aborting at %s line %d in %s\n"
+msgstr ""
+
+#: ldmisc.c:553
+msgid "%P: internal error: aborting at %s line %d\n"
+msgstr ""
+
+#: ldmisc.c:555
+msgid "%P%F: please report this bug\n"
+msgstr ""
+
+#: ldver.c:35
+#, c-format
+msgid "GNU ld version %s (with BFD %s)\n"
+msgstr ""
+
+#: ldver.c:42 lexsup.c:887
+msgid " Supported emulations:\n"
+msgstr ""
+
+#: ldwrite.c:59 ldwrite.c:195
+msgid "%P%F: bfd_new_link_order failed\n"
+msgstr ""
+
+#: ldwrite.c:365
+#, c-format
+msgid "%8x something else\n"
+msgstr ""
+
+#: ldwrite.c:526
+msgid "%F%P: final link failed: %E\n"
+msgstr ""
+
+#: lexsup.c:155 lexsup.c:238 lexsup.c:244
+msgid "KEYWORD"
+msgstr ""
+
+#: lexsup.c:155
+msgid "Shared library control for HP/UX compatibility"
+msgstr ""
+
+#: lexsup.c:158
+msgid "ARCH"
+msgstr ""
+
+#: lexsup.c:158
+msgid "Set architecture"
+msgstr ""
+
+#: lexsup.c:160 lexsup.c:307
+msgid "TARGET"
+msgstr ""
+
+#: lexsup.c:160
+msgid "Specify target for following input files"
+msgstr ""
+
+#: lexsup.c:162 lexsup.c:201 lexsup.c:211 lexsup.c:220 lexsup.c:291
+#: lexsup.c:314 lexsup.c:348
+msgid "FILE"
+msgstr ""
+
+#: lexsup.c:162
+msgid "Read MRI format linker script"
+msgstr ""
+
+#: lexsup.c:164
+msgid "Force common symbols to be defined"
+msgstr ""
+
+#: lexsup.c:168 lexsup.c:338 lexsup.c:340 lexsup.c:342
+msgid "ADDRESS"
+msgstr ""
+
+#: lexsup.c:168
+msgid "Set start address"
+msgstr ""
+
+#: lexsup.c:170
+msgid "Export all dynamic symbols"
+msgstr ""
+
+#: lexsup.c:172
+msgid "Link big-endian objects"
+msgstr ""
+
+#: lexsup.c:174
+msgid "Link little-endian objects"
+msgstr ""
+
+#: lexsup.c:176 lexsup.c:179
+msgid "SHLIB"
+msgstr ""
+
+#: lexsup.c:176
+msgid "Auxiliary filter for shared object symbol table"
+msgstr ""
+
+#: lexsup.c:179
+msgid "Filter for shared object symbol table"
+msgstr ""
+
+#: lexsup.c:181
+msgid "Ignored"
+msgstr ""
+
+#: lexsup.c:183
+msgid "SIZE"
+msgstr ""
+
+#: lexsup.c:183
+msgid "Small data size (if no size, same as --shared)"
+msgstr ""
+
+#: lexsup.c:186
+msgid "FILENAME"
+msgstr ""
+
+#: lexsup.c:186
+msgid "Set internal name of shared library"
+msgstr ""
+
+#: lexsup.c:188
+msgid "LIBNAME"
+msgstr ""
+
+#: lexsup.c:188
+msgid "Search for library LIBNAME"
+msgstr ""
+
+#: lexsup.c:190
+msgid "DIRECTORY"
+msgstr ""
+
+#: lexsup.c:190
+msgid "Add DIRECTORY to library search path"
+msgstr ""
+
+#: lexsup.c:192
+msgid "EMULATION"
+msgstr ""
+
+#: lexsup.c:192
+msgid "Set emulation"
+msgstr ""
+
+#: lexsup.c:194
+msgid "Print map file on standard output"
+msgstr ""
+
+#: lexsup.c:196
+msgid "Do not page align data"
+msgstr ""
+
+#: lexsup.c:198
+msgid "Do not page align data, do not make text readonly"
+msgstr ""
+
+#: lexsup.c:201
+msgid "Set output file name"
+msgstr ""
+
+#: lexsup.c:203
+msgid "Optimize output file"
+msgstr ""
+
+#: lexsup.c:205
+msgid "Ignored for SVR4 compatibility"
+msgstr ""
+
+#: lexsup.c:207
+msgid "Generate relocateable output"
+msgstr ""
+
+#: lexsup.c:211
+msgid "Just link symbols (if directory, same as --rpath)"
+msgstr ""
+
+#: lexsup.c:214
+msgid "Strip all symbols"
+msgstr ""
+
+#: lexsup.c:216
+msgid "Strip debugging symbols"
+msgstr ""
+
+#: lexsup.c:218
+msgid "Trace file opens"
+msgstr ""
+
+#: lexsup.c:220
+msgid "Read linker script"
+msgstr ""
+
+#: lexsup.c:222 lexsup.c:234 lexsup.c:277 lexsup.c:289 lexsup.c:334
+#: lexsup.c:351 lexsup.c:368
+msgid "SYMBOL"
+msgstr ""
+
+#: lexsup.c:222
+msgid "Start with undefined reference to SYMBOL"
+msgstr ""
+
+#: lexsup.c:224
+msgid "Build global constructor/destructor tables"
+msgstr ""
+
+#: lexsup.c:226
+msgid "Print version information"
+msgstr ""
+
+#: lexsup.c:228
+msgid "Print version and emulation information"
+msgstr ""
+
+#: lexsup.c:230
+msgid "Discard all local symbols"
+msgstr ""
+
+#: lexsup.c:232
+msgid "Discard temporary local symbols"
+msgstr ""
+
+#: lexsup.c:234
+msgid "Trace mentions of SYMBOL"
+msgstr ""
+
+#: lexsup.c:236 lexsup.c:316 lexsup.c:318
+msgid "PATH"
+msgstr ""
+
+#: lexsup.c:236
+msgid "Default search path for Solaris compatibility"
+msgstr ""
+
+#: lexsup.c:238
+msgid "Ignored for Solaris compatibility"
+msgstr ""
+
+#: lexsup.c:240
+msgid "Start a group"
+msgstr ""
+
+#: lexsup.c:242
+msgid "End a group"
+msgstr ""
+
+#: lexsup.c:244
+msgid "Ignored for SunOS compatibility"
+msgstr ""
+
+#: lexsup.c:246
+msgid "Link against shared libraries"
+msgstr ""
+
+#: lexsup.c:252
+msgid "Do not link against shared libraries"
+msgstr ""
+
+#: lexsup.c:260
+msgid "Bind global references locally"
+msgstr ""
+
+#: lexsup.c:262
+msgid "Check section addresses for overlaps (default)"
+msgstr ""
+
+#: lexsup.c:264
+msgid "Do not check section addresses for overlaps"
+msgstr ""
+
+#: lexsup.c:267
+msgid "Output cross reference table"
+msgstr ""
+
+#: lexsup.c:269
+msgid "SYMBOL=EXPRESSION"
+msgstr ""
+
+#: lexsup.c:269
+msgid "Define a symbol"
+msgstr ""
+
+#: lexsup.c:271
+msgid "Demangle symbol names"
+msgstr ""
+
+#: lexsup.c:273
+msgid "PROGRAM"
+msgstr ""
+
+#: lexsup.c:273
+msgid "Set the dynamic linker to use"
+msgstr ""
+
+#: lexsup.c:275
+msgid "Generate embedded relocs"
+msgstr ""
+
+#: lexsup.c:277
+msgid "Call SYMBOL at unload-time"
+msgstr ""
+
+#: lexsup.c:279
+msgid "Force generation of file with .exe suffix"
+msgstr ""
+
+#: lexsup.c:281
+msgid "Remove unused sections (on some targets)"
+msgstr ""
+
+#: lexsup.c:284
+msgid "Don't remove unused sections (default)"
+msgstr ""
+
+#: lexsup.c:287
+msgid "Print option help"
+msgstr ""
+
+#: lexsup.c:289
+msgid "Call SYMBOL at load-time"
+msgstr ""
+
+#: lexsup.c:291
+msgid "Write a map file"
+msgstr ""
+
+#: lexsup.c:293
+msgid "Do not demangle symbol names"
+msgstr ""
+
+#: lexsup.c:295
+msgid "Use less memory and more disk I/O"
+msgstr ""
+
+#: lexsup.c:297
+msgid "Allow no undefined symbols"
+msgstr ""
+
+#: lexsup.c:299
+msgid "Don't warn about mismatched input files"
+msgstr ""
+
+#: lexsup.c:301
+msgid "Turn off --whole-archive"
+msgstr ""
+
+#: lexsup.c:303
+msgid "Create an output file even if errors occur"
+msgstr ""
+
+#: lexsup.c:307
+msgid "Specify target of output file"
+msgstr ""
+
+#: lexsup.c:309
+msgid "Ignored for Linux compatibility"
+msgstr ""
+
+#: lexsup.c:311
+msgid "Relax branches on certain targets"
+msgstr ""
+
+#: lexsup.c:314
+msgid "Keep only symbols listed in FILE"
+msgstr ""
+
+#: lexsup.c:316
+msgid "Set runtime shared library search path"
+msgstr ""
+
+#: lexsup.c:318
+msgid "Set link time shared library search path"
+msgstr ""
+
+#: lexsup.c:320
+msgid "Create a shared library"
+msgstr ""
+
+#: lexsup.c:324
+msgid "Sort common symbols by size"
+msgstr ""
+
+#: lexsup.c:328
+msgid "Split output sections for each file"
+msgstr ""
+
+#: lexsup.c:330
+msgid "COUNT"
+msgstr ""
+
+#: lexsup.c:330
+msgid "Split output sections every COUNT relocs"
+msgstr ""
+
+#: lexsup.c:332
+msgid "Print memory usage statistics"
+msgstr ""
+
+#: lexsup.c:334
+msgid "Do task level linking"
+msgstr ""
+
+#: lexsup.c:336
+msgid "Use same format as native linker"
+msgstr ""
+
+#: lexsup.c:338
+msgid "Set address of .bss section"
+msgstr ""
+
+#: lexsup.c:340
+msgid "Set address of .data section"
+msgstr ""
+
+#: lexsup.c:342
+msgid "Set address of .text section"
+msgstr ""
+
+#: lexsup.c:344
+msgid "Output lots of information during link"
+msgstr ""
+
+#: lexsup.c:348
+msgid "Read version information script"
+msgstr ""
+
+#: lexsup.c:351
+msgid ""
+"Take export symbols list from .exports, using\n"
+"\t\t\t\tSYMBOL as the version."
+msgstr ""
+
+#: lexsup.c:354
+msgid "Warn about duplicate common symbols"
+msgstr ""
+
+#: lexsup.c:356
+msgid "Warn if global constructors/destructors are seen"
+msgstr ""
+
+#: lexsup.c:359
+msgid "Warn if the multiple GP values are used"
+msgstr ""
+
+#: lexsup.c:361
+msgid "Warn only once per undefined symbol"
+msgstr ""
+
+#: lexsup.c:363
+msgid "Warn if start of section changes due to alignment"
+msgstr ""
+
+#: lexsup.c:366
+msgid "Include all objects from following archives"
+msgstr ""
+
+#: lexsup.c:368
+msgid "Use wrapper functions for SYMBOL"
+msgstr ""
+
+#: lexsup.c:370
+msgid "[=WORDS]"
+msgstr ""
+
+#: lexsup.c:370
+msgid ""
+"Modify problematic branches in last WORDS (1-10,\n"
+"\t\t\t\tdefault 5) words of a page"
+msgstr ""
+
+#: lexsup.c:520
+#, c-format
+msgid "%s: use the --help option for usage information\n"
+msgstr ""
+
+#: lexsup.c:540
+msgid "%P%F: unrecognized -a option `%s'\n"
+msgstr ""
+
+#: lexsup.c:553
+msgid "%P%F: unrecognized -assert option `%s'\n"
+msgstr ""
+
+#: lexsup.c:644
+msgid "%P%F: invalid number `%s'\n"
+msgstr ""
+
+#: lexsup.c:816
+msgid "%P%F: -shared not supported\n"
+msgstr ""
+
+#: lexsup.c:880
+msgid "Copyright 1997 Free Software Foundation, Inc.\n"
+msgstr ""
+
+#: lexsup.c:881
+msgid ""
+"This program is free software; you may redistribute it under the terms of\n"
+"the GNU General Public License. This program has absolutely no warranty.\n"
+msgstr ""
+
+#: lexsup.c:972
+#, c-format
+msgid "%s: may not nest groups (--help for usage)\n"
+msgstr ""
+
+#: lexsup.c:983
+#, c-format
+msgid "%s: group ended before it began (--help for usage)\n"
+msgstr ""
+
+#: lexsup.c:1000
+#, c-format
+msgid "%s: Invalid argument to option \"mpc860c0\"\n"
+msgstr ""
+
+#: lexsup.c:1056
+msgid "%P%F: invalid hex number `%s'\n"
+msgstr ""
+
+#: lexsup.c:1068
+#, c-format
+msgid "Usage: %s [options] file...\n"
+msgstr ""
+
+#: lexsup.c:1070
+msgid "Options:\n"
+msgstr ""
+
+#. Note: Various tools (such as libtool) depend upon the
+#. format of the listings below - do not change them.
+#: lexsup.c:1149
+#, c-format
+msgid "%s: supported targets:"
+msgstr ""
+
+#: lexsup.c:1157
+#, c-format
+msgid "%s: supported emulations: "
+msgstr ""
+
+#: lexsup.c:1162
+#, c-format
+msgid "%s: emulation specific options:\n"
+msgstr ""
+
+#: lexsup.c:1166
+#, c-format
+msgid "Report bugs to %s\n"
+msgstr ""
+
+#: mri.c:343
+msgid "%P%F: unknown format type %s\n"
+msgstr ""
+
+#: pe-dll.c:144
+#, c-format
+msgid "%XUnsupported PEI architecture: %s\n"
+msgstr ""
+
+#: pe-dll.c:377
+#, c-format
+msgid "%XError, duplicate EXPORT with oridinals: %s (%d vs %d)\n"
+msgstr ""
+
+#: pe-dll.c:384
+#, c-format
+msgid "Warning, duplicate EXPORT: %s\n"
+msgstr ""
+
+#: pe-dll.c:446
+#, c-format
+msgid "%XCannot export %s: symbol not defined\n"
+msgstr ""
+
+#: pe-dll.c:452
+#, c-format
+msgid "%XCannot export %s: symbol wrong type (%d vs %d)\n"
+msgstr ""
+
+#: pe-dll.c:459
+#, c-format
+msgid "%XCannot export %s: symbol not found\n"
+msgstr ""
+
+#: pe-dll.c:584
+#, c-format
+msgid "%XError, oridinal used twice: %d (%s vs %s)\n"
+msgstr ""
+
+#: pe-dll.c:831
+#, c-format
+msgid "%XError: %d-bit reloc in dll\n"
+msgstr ""
+
+#: pe-dll.c:955
+#, c-format
+msgid "%s: Can't open output def file %s\n"
+msgstr ""
+
+#: pe-dll.c:1077
+msgid "; no contents available\n"
+msgstr ""
+
+#: pe-dll.c:1566
+#, c-format
+msgid "%XCan't open .lib file: %s\n"
+msgstr ""
+
+#: pe-dll.c:1571
+#, c-format
+msgid "Creating library file: %s\n"
+msgstr ""
diff --git a/contrib/binutils/ld/scripttempl/aout.sc b/contrib/binutils/ld/scripttempl/aout.sc
index 66cc42d..80dbb37 100644
--- a/contrib/binutils/ld/scripttempl/aout.sc
+++ b/contrib/binutils/ld/scripttempl/aout.sc
@@ -1,5 +1,6 @@
test -z "${BIG_OUTPUT_FORMAT}" && BIG_OUTPUT_FORMAT=${OUTPUT_FORMAT}
test -z "${LITTLE_OUTPUT_FORMAT}" && LITTLE_OUTPUT_FORMAT=${OUTPUT_FORMAT}
+test -z "${ALIGNMENT}" && ALIGNMENT="4"
cat <<EOF
OUTPUT_FORMAT("${OUTPUT_FORMAT}", "${BIG_OUTPUT_FORMAT}",
@@ -48,8 +49,9 @@ SECTIONS
${RELOCATING+ __bss_start = .};
*(.bss)
*(COMMON)
- ${RELOCATING+_end = ALIGN(4) };
- ${RELOCATING+__end = ALIGN(4) };
+ ${RELOCATING+. = ALIGN(${ALIGNMENT});}
+ ${RELOCATING+_end = . };
+ ${RELOCATING+__end = . };
}
}
EOF
diff --git a/contrib/binutils/ld/scripttempl/armaout.sc b/contrib/binutils/ld/scripttempl/armaout.sc
new file mode 100644
index 0000000..e9276a8
--- /dev/null
+++ b/contrib/binutils/ld/scripttempl/armaout.sc
@@ -0,0 +1,35 @@
+cat <<EOF
+OUTPUT_FORMAT("${OUTPUT_FORMAT}")
+OUTPUT_ARCH(${ARCH})
+
+${RELOCATING+${LIB_SEARCH_DIRS}}
+${STACKZERO+${RELOCATING+${STACKZERO}}}
+SECTIONS
+{
+ .text ${RELOCATING+${TEXT_START_ADDR}} :
+ {
+ CREATE_OBJECT_SYMBOLS
+ ${RELOCATING+__stext_ = .;}
+ *(.text)
+ ${PAD_TEXT+${RELOCATING+. = ${DATA_ALIGNMENT};}}
+ ${RELOCATING+_etext = ${DATA_ALIGNMENT};}
+ ${RELOCATING+__etext = ${DATA_ALIGNMENT};}
+ }
+ .data ${RELOCATING+${DATA_ALIGNMENT}} :
+ {
+ ${RELOCATING+__sdata_ = .;}
+ *(.data)
+ ${CONSTRUCTING+CONSTRUCTORS}
+ ${RELOCATING+_edata = .;}
+ ${RELOCATING+__edata = .;}
+ }
+ .bss ${RELOCATING+ SIZEOF(.data) + ADDR (.data)} :
+ {
+ ${RELOCATING+ __bss_start = .};
+ *(.bss)
+ *(COMMON)
+ ${RELOCATING+_end = ALIGN(4) };
+ ${RELOCATING+__end = ALIGN(4) };
+ }
+}
+EOF
diff --git a/contrib/binutils/ld/scripttempl/armcoff.sc b/contrib/binutils/ld/scripttempl/armcoff.sc
new file mode 100644
index 0000000..9f9cd7c
--- /dev/null
+++ b/contrib/binutils/ld/scripttempl/armcoff.sc
@@ -0,0 +1,62 @@
+# Linker script for ARM COFF.
+# Based on i386coff.sc by Ian Taylor <ian@cygnus.com>.
+test -z "$ENTRY" && ENTRY=_start
+if test -z "${DATA_ADDR}"; then
+ if test "$LD_FLAG" = "N" || test "$LD_FLAG" = "n"; then
+ DATA_ADDR=.
+ fi
+fi
+cat <<EOF
+OUTPUT_FORMAT("${OUTPUT_FORMAT}", "${BIG_OUTPUT_FORMAT}", "${LITTLE_OUTPUT_FORMAT}")
+${LIB_SEARCH_DIRS}
+
+ENTRY(${ENTRY})
+
+SECTIONS
+{
+ /* We start at 0x8000 because gdb assumes it (see FRAME_CHAIN).
+ This is an artifact of the ARM Demon monitor using the bottom 32k
+ as workspace (shared with the FP instruction emulator if
+ present): */
+ .text ${RELOCATING+ 0x8000} : {
+ *(.init)
+ *(.text)
+ *(.glue_7t)
+ *(.glue_7)
+ *(.rdata)
+ ${CONSTRUCTING+ ___CTOR_LIST__ = .; __CTOR_LIST__ = . ;
+ LONG (-1); *(.ctors); *(.ctor); LONG (0); }
+ ${CONSTRUCTING+ ___DTOR_LIST__ = .; __DTOR_LIST__ = . ;
+ LONG (-1); *(.dtors); *(.dtor); LONG (0); }
+ *(.fini)
+ ${RELOCATING+ etext = .;}
+ }
+ .data ${RELOCATING+${DATA_ADDR-0x40000 + (. & 0xfffc0fff)}} : {
+ ${RELOCATING+ __data_start__ = . ;}
+ *(.data)
+ ${RELOCATING+ __data_end__ = . ;}
+ ${RELOCATING+ edata = .;}
+ ${RELOCATING+ _edata = .;}
+ }
+ .bss ${RELOCATING+ SIZEOF(.data) + ADDR(.data)} :
+ {
+ ${RELOCATING+ __bss_start__ = . ;}
+ *(.bss)
+ *(COMMON)
+ ${RELOCATING+ __bss_end__ = . ;}
+ }
+
+ ${RELOCATING+ end = .;}
+ ${RELOCATING+ _end = .;}
+ ${RELOCATING+ __end__ = .;}
+
+ .stab 0 ${RELOCATING+(NOLOAD)} :
+ {
+ [ .stab ]
+ }
+ .stabstr 0 ${RELOCATING+(NOLOAD)} :
+ {
+ [ .stabstr ]
+ }
+}
+EOF
diff --git a/contrib/binutils/ld/scripttempl/elf.sc b/contrib/binutils/ld/scripttempl/elf.sc
index 83e589a..ccc4b91 100644
--- a/contrib/binutils/ld/scripttempl/elf.sc
+++ b/contrib/binutils/ld/scripttempl/elf.sc
@@ -8,6 +8,7 @@
# OTHER_TEXT_SECTIONS - these get put in .text when relocating
# OTHER_READWRITE_SECTIONS - other than .data .bss .ctors .sdata ...
# (e.g., .PARISC.global)
+# OTHER_BSS_SECTIONS - other than .bss .sbss ...
# OTHER_SECTIONS - at the end
# EXECUTABLE_SYMBOLS - symbols that must be defined for an
# executable (e.g., _DYNAMIC_LINK)
@@ -24,6 +25,12 @@
# EMBEDDED - whether this is for an embedded system.
# SHLIB_TEXT_START_ADDR - if set, add to SIZEOF_HEADERS to set
# start address of shared library.
+# INPUT_FILES - INPUT command of files to always include
+# WRITABLE_RODATA - if set, the .rodata section should be writable
+# INIT_START, INIT_END - statements just before and just after
+# combination of .init sections.
+# FINI_START, FINI_END - statements just before and just after
+# combination of .fini sections.
#
# When adding sections, do note that the names of some sections are used
# when specifying the start address of the next.
@@ -34,10 +41,47 @@ test -z "${BIG_OUTPUT_FORMAT}" && BIG_OUTPUT_FORMAT=${OUTPUT_FORMAT}
test -z "${LITTLE_OUTPUT_FORMAT}" && LITTLE_OUTPUT_FORMAT=${OUTPUT_FORMAT}
if [ -z "$MACHINE" ]; then OUTPUT_ARCH=${ARCH}; else OUTPUT_ARCH=${ARCH}:${MACHINE}; fi
test -z "${ELFSIZE}" && ELFSIZE=32
+test -z "${ALIGNMENT}" && ALIGNMENT="${ELFSIZE} / 8"
test "$LD_FLAG" = "N" && DATA_ADDR=.
INTERP=".interp ${RELOCATING-0} : { *(.interp) }"
PLT=".plt ${RELOCATING-0} : { *(.plt) }"
DYNAMIC=".dynamic ${RELOCATING-0} : { *(.dynamic) }"
+RODATA=".rodata ${RELOCATING-0} : { *(.rodata) ${RELOCATING+*(.rodata.*)} ${RELOCATING+*(.gnu.linkonce.r*)} }"
+CTOR=".ctors ${CONSTRUCTING-0} :
+ {
+ ${CONSTRUCTING+${CTOR_START}}
+ /* gcc uses crtbegin.o to find the start of
+ the constructors, so we make sure it is
+ first. Because this is a wildcard, it
+ doesn't matter if the user does not
+ actually link against crtbegin.o; the
+ linker won't look for a file to match a
+ wildcard. The wildcard also means that it
+ doesn't matter which directory crtbegin.o
+ is in. */
+
+ KEEP (*crtbegin.o(.ctors))
+
+ /* We don't want to include the .ctor section from
+ from the crtend.o file until after the sorted ctors.
+ The .ctor section from the crtend file contains the
+ end of ctors marker and it must be last */
+
+ KEEP (*(EXCLUDE_FILE (*crtend.o $OTHER_EXCLUDE_FILES) .ctors))
+ KEEP (*(SORT(.ctors.*)))
+ KEEP (*(.ctors))
+ ${CONSTRUCTING+${CTOR_END}}
+ }"
+
+DTOR=" .dtors ${CONSTRUCTING-0} :
+ {
+ ${CONSTRUCTING+${DTOR_START}}
+ KEEP (*crtbegin.o(.dtors))
+ KEEP (*(EXCLUDE_FILE (*crtend.o $OTHER_EXCLUDE_FILES) .dtors))
+ KEEP (*(SORT(.dtors.*)))
+ KEEP (*(.dtors))
+ ${CONSTRUCTING+${DTOR_END}}
+ }"
# if this is for an embedded system, don't add SIZEOF_HEADERS.
if [ -z "$EMBEDDED" ]; then
@@ -56,10 +100,12 @@ ${RELOCATING+${LIB_SEARCH_DIRS}}
${RELOCATING+/* Do we need any of these for elf?
__DYNAMIC = 0; ${STACKZERO+${STACKZERO}} ${SHLIB_PATH+${SHLIB_PATH}} */}
${RELOCATING+${EXECUTABLE_SYMBOLS}}
+${RELOCATING+${INPUT_FILES}}
${RELOCATING- /* For some reason, the Solaris linker makes bad executables
if gld -r is used and the intermediate file has sections starting
at non-zero addresses. Could be a Solaris ld bug, could be a GNU ld
bug. But for now assigning the zero vmas works. */}
+
SECTIONS
{
/* Read-only sections, merged into text segment: */
@@ -74,38 +120,88 @@ SECTIONS
.gnu.version ${RELOCATING-0} : { *(.gnu.version) }
.gnu.version_d ${RELOCATING-0} : { *(.gnu.version_d) }
.gnu.version_r ${RELOCATING-0} : { *(.gnu.version_r) }
+
+ .rel.init ${RELOCATING-0} : { *(.rel.init) }
+ .rela.init ${RELOCATING-0} : { *(.rela.init) }
.rel.text ${RELOCATING-0} :
- { *(.rel.text) ${RELOCATING+*(.rel.gnu.linkonce.t*)} }
+ {
+ *(.rel.text)
+ ${RELOCATING+*(.rel.text.*)}
+ ${RELOCATING+*(.rel.gnu.linkonce.t*)}
+ }
.rela.text ${RELOCATING-0} :
- { *(.rela.text) ${RELOCATING+*(.rela.gnu.linkonce.t*)} }
- .rel.data ${RELOCATING-0} :
- { *(.rel.data) ${RELOCATING+*(.rel.gnu.linkonce.d*)} }
- .rela.data ${RELOCATING-0} :
- { *(.rela.data) ${RELOCATING+*(.rela.gnu.linkonce.d*)} }
+ {
+ *(.rela.text)
+ ${RELOCATING+*(.rela.text.*)}
+ ${RELOCATING+*(.rela.gnu.linkonce.t*)}
+ }
+ .rel.fini ${RELOCATING-0} : { *(.rel.fini) }
+ .rela.fini ${RELOCATING-0} : { *(.rela.fini) }
.rel.rodata ${RELOCATING-0} :
- { *(.rel.rodata) ${RELOCATING+*(.rel.gnu.linkonce.r*)} }
+ {
+ *(.rel.rodata)
+ ${RELOCATING+*(.rel.rodata.*)}
+ ${RELOCATING+*(.rel.gnu.linkonce.r*)}
+ }
.rela.rodata ${RELOCATING-0} :
- { *(.rela.rodata) ${RELOCATING+*(.rela.gnu.linkonce.r*)} }
- .rel.got ${RELOCATING-0} : { *(.rel.got) }
- .rela.got ${RELOCATING-0} : { *(.rela.got) }
+ {
+ *(.rela.rodata)
+ ${RELOCATING+*(.rela.rodata.*)}
+ ${RELOCATING+*(.rela.gnu.linkonce.r*)}
+ }
+ ${OTHER_READONLY_RELOC_SECTIONS}
+ .rel.data ${RELOCATING-0} :
+ {
+ *(.rel.data)
+ ${RELOCATING+*(.rel.data.*)}
+ ${RELOCATING+*(.rel.gnu.linkonce.d*)}
+ }
+ .rela.data ${RELOCATING-0} :
+ {
+ *(.rela.data)
+ ${RELOCATING+*(.rela.data.*)}
+ ${RELOCATING+*(.rela.gnu.linkonce.d*)}
+ }
.rel.ctors ${RELOCATING-0} : { *(.rel.ctors) }
.rela.ctors ${RELOCATING-0} : { *(.rela.ctors) }
.rel.dtors ${RELOCATING-0} : { *(.rel.dtors) }
.rela.dtors ${RELOCATING-0} : { *(.rela.dtors) }
- .rel.init ${RELOCATING-0} : { *(.rel.init) }
- .rela.init ${RELOCATING-0} : { *(.rela.init) }
- .rel.fini ${RELOCATING-0} : { *(.rel.fini) }
- .rela.fini ${RELOCATING-0} : { *(.rela.fini) }
+ .rel.got ${RELOCATING-0} : { *(.rel.got) }
+ .rela.got ${RELOCATING-0} : { *(.rela.got) }
+ ${OTHER_GOT_RELOC_SECTIONS}
+ .rel.sdata ${RELOCATING-0} :
+ {
+ *(.rel.sdata)
+ ${RELOCATING+*(.rel.sdata.*)}
+ ${RELOCATING+*(.rel.gnu.linkonce.s*)}
+ }
+ .rela.sdata ${RELOCATING-0} :
+ {
+ *(.rela.sdata)
+ ${RELOCATING+*(.rela.sdata.*)}
+ ${RELOCATING+*(.rela.gnu.linkonce.s*)}
+ }
+ .rel.sbss ${RELOCATING-0} : { *(.rel.sbss) }
+ .rela.sbss ${RELOCATING-0} : { *(.rela.sbss) }
.rel.bss ${RELOCATING-0} : { *(.rel.bss) }
.rela.bss ${RELOCATING-0} : { *(.rela.bss) }
.rel.plt ${RELOCATING-0} : { *(.rel.plt) }
.rela.plt ${RELOCATING-0} : { *(.rela.plt) }
- .init ${RELOCATING-0} : { *(.init) } =${NOP-0}
+ ${OTHER_PLT_RELOC_SECTIONS}
+
+ .init ${RELOCATING-0} :
+ {
+ ${INIT_START}
+ KEEP (*(.init))
+ ${INIT_END}
+ } =${NOP-0}
+
${DATA_PLT-${PLT}}
.text ${RELOCATING-0} :
{
${RELOCATING+${TEXT_START_SYMBOLS}}
*(.text)
+ ${RELOCATING+*(.text.*)}
*(.stub)
/* .gnu.warning sections are handled specially by elf32.em. */
*(.gnu.warning)
@@ -114,8 +210,13 @@ SECTIONS
} =${NOP-0}
${RELOCATING+_etext = .;}
${RELOCATING+PROVIDE (etext = .);}
- .fini ${RELOCATING-0} : { *(.fini) } =${NOP-0}
- .rodata ${RELOCATING-0} : { *(.rodata) ${RELOCATING+*(.gnu.linkonce.r*)} }
+ .fini ${RELOCATING-0} :
+ {
+ ${FINI_START}
+ KEEP (*(.fini))
+ ${FINI_END}
+ } =${NOP-0}
+ ${WRITABLE_RODATA-${RODATA}}
.rodata1 ${RELOCATING-0} : { *(.rodata1) }
${RELOCATING+${OTHER_READONLY_SECTIONS}}
@@ -128,23 +229,17 @@ SECTIONS
{
${RELOCATING+${DATA_START_SYMBOLS}}
*(.data)
+ ${RELOCATING+*(.data.*)}
${RELOCATING+*(.gnu.linkonce.d*)}
- ${CONSTRUCTING+CONSTRUCTORS}
+ ${CONSTRUCTING+SORT(CONSTRUCTORS)}
}
.data1 ${RELOCATING-0} : { *(.data1) }
+ .eh_frame : { *(.eh_frame) }
+ .gcc_except_table : { *(.gcc_except_table) }
+ ${WRITABLE_RODATA+${RODATA}}
${RELOCATING+${OTHER_READWRITE_SECTIONS}}
- .ctors ${RELOCATING-0} :
- {
- ${CONSTRUCTING+${CTOR_START}}
- *(.ctors)
- ${CONSTRUCTING+${CTOR_END}}
- }
- .dtors ${RELOCATING-0} :
- {
- ${CONSTRUCTING+${DTOR_START}}
- *(.dtors)
- ${CONSTRUCTING+${DTOR_END}}
- }
+ ${RELOCATING+${CTOR}}
+ ${RELOCATING+${DTOR}}
${DATA_PLT+${PLT}}
${RELOCATING+${OTHER_GOT_SYMBOLS}}
.got ${RELOCATING-0} : { *(.got.plt) *(.got) }
@@ -152,21 +247,40 @@ SECTIONS
/* We want the small data sections together, so single-instruction offsets
can access them all, and initialized data all before uninitialized, so
we can shorten the on-disk segment size. */
- .sdata ${RELOCATING-0} : { *(.sdata) }
+ .sdata ${RELOCATING-0} :
+ {
+ ${RELOCATING+${SDATA_START_SYMBOLS}}
+ *(.sdata)
+ ${RELOCATING+*(.sdata.*)}
+ ${RELOCATING+*(.gnu.linkonce.s.*)}
+ }
${RELOCATING+${OTHER_GOT_SECTIONS}}
- ${RELOCATING+_edata = .;}
+ ${RELOCATING+_edata = .;}
${RELOCATING+PROVIDE (edata = .);}
${RELOCATING+__bss_start = .;}
${RELOCATING+${OTHER_BSS_SYMBOLS}}
- .sbss ${RELOCATING-0} : { *(.sbss) *(.scommon) }
+ .sbss ${RELOCATING-0} :
+ {
+ *(.dynsbss)
+ *(.sbss)
+ ${RELOCATING+*(.sbss.*)}
+ *(.scommon)
+ }
.bss ${RELOCATING-0} :
{
*(.dynbss)
*(.bss)
+ ${RELOCATING+*(.bss.*)}
*(COMMON)
+ /* Align here to ensure that the .bss section occupies space up to
+ _end. Align after .bss to ensure correct alignment even if the
+ .bss section disappears because there are no input sections. */
+ ${RELOCATING+. = ALIGN(${ALIGNMENT});}
}
- ${RELOCATING+. = ALIGN(${ELFSIZE} / 8);}
- ${RELOCATING+_end = . ;}
+ ${RELOCATING+${OTHER_BSS_SECTIONS}}
+ ${RELOCATING+. = ALIGN(${ALIGNMENT});}
+ ${RELOCATING+_end = .;}
+ ${RELOCATING+${OTHER_BSS_END_SYMBOLS}}
${RELOCATING+PROVIDE (end = .);}
/* Stabs debugging sections. */
diff --git a/contrib/binutils/ld/scripttempl/elfppc.sc b/contrib/binutils/ld/scripttempl/elfppc.sc
new file mode 100644
index 0000000..ddab8f8
--- /dev/null
+++ b/contrib/binutils/ld/scripttempl/elfppc.sc
@@ -0,0 +1,288 @@
+#
+# Unusual variables checked by this code:
+# NOP - two byte opcode for no-op (defaults to 0)
+# DATA_ADDR - if end-of-text-plus-one-page isn't right for data start
+# OTHER_READONLY_SECTIONS - other than .text .init .rodata ...
+# (e.g., .PARISC.milli)
+# OTHER_READWRITE_SECTIONS - other than .data .bss .ctors .sdata ...
+# (e.g., .PARISC.global)
+# OTHER_SECTIONS - at the end
+# EXECUTABLE_SYMBOLS - symbols that must be defined for an
+# executable (e.g., _DYNAMIC_LINK)
+# TEXT_START_SYMBOLS - symbols that appear at the start of the
+# .text section.
+# DATA_START_SYMBOLS - symbols that appear at the start of the
+# .data section.
+# OTHER_BSS_SYMBOLS - symbols that appear at the start of the
+# .bss section besides __bss_start.
+#
+# When adding sections, do note that the names of some sections are used
+# when specifying the start address of the next.
+#
+test -z "$ENTRY" && ENTRY=_start
+test -z "${BIG_OUTPUT_FORMAT}" && BIG_OUTPUT_FORMAT=${OUTPUT_FORMAT}
+test -z "${LITTLE_OUTPUT_FORMAT}" && LITTLE_OUTPUT_FORMAT=${OUTPUT_FORMAT}
+test "$LD_FLAG" = "N" && DATA_ADDR=.
+SBSS2=".sbss2 ${RELOCATING-0} : { *(.sbss2) }"
+SDATA2=".sdata2 ${RELOCATING-0} : { *(.sdata2) }"
+INTERP=".interp ${RELOCATING-0} : { *(.interp) }"
+PLT=".plt ${RELOCATING-0} : { *(.plt) }"
+CTOR=".ctors ${CONSTRUCTING-0} :
+ {
+ ${CONSTRUCTING+${CTOR_START}}
+ /* gcc uses crtbegin.o to find the start of
+ the constructors, so we make sure it is
+ first. Because this is a wildcard, it
+ doesn't matter if the user does not
+ actually link against crtbegin.o; the
+ linker won't look for a file to match a
+ wildcard. The wildcard also means that it
+ doesn't matter which directory crtbegin.o
+ is in. */
+
+ KEEP (*crtbegin.o(.ctors))
+
+ /* We don't want to include the .ctor section from
+ from the crtend.o file until after the sorted ctors.
+ The .ctor section from the crtend file contains the
+ end of ctors marker and it must be last */
+
+ KEEP (*(EXCLUDE_FILE (*crtend.o) .ctors))
+ KEEP (*(SORT(.ctors.*)))
+ KEEP (*(.ctors))
+ ${CONSTRUCTING+${CTOR_END}}
+ }"
+
+DTOR=" .dtors ${CONSTRUCTING-0} :
+ {
+ ${CONSTRUCTING+${DTOR_START}}
+ KEEP (*crtbegin.o(.dtors))
+ KEEP (*(EXCLUDE_FILE (*crtend.o) .dtors))
+ KEEP (*(SORT(.dtors.*)))
+ KEEP (*(.dtors))
+ ${CONSTRUCTING+${DTOR_END}}
+ }"
+
+cat <<EOF
+OUTPUT_FORMAT("${OUTPUT_FORMAT}", "${BIG_OUTPUT_FORMAT}",
+ "${LITTLE_OUTPUT_FORMAT}")
+OUTPUT_ARCH(${ARCH})
+ENTRY(${ENTRY})
+
+${RELOCATING+${LIB_SEARCH_DIRS}}
+${RELOCATING+/* Do we need any of these for elf?
+ __DYNAMIC = 0; ${STACKZERO+${STACKZERO}} ${SHLIB_PATH+${SHLIB_PATH}} */}
+${RELOCATING+${EXECUTABLE_SYMBOLS}}
+${RELOCATING- /* For some reason, the Solaris linker makes bad executables
+ if gld -r is used and the intermediate file has sections starting
+ at non-zero addresses. Could be a Solaris ld bug, could be a GNU ld
+ bug. But for now assigning the zero vmas works. */}
+
+${RELOCATING+PROVIDE (__stack = 0);}
+${RELOCATING+PROVIDE (___stack = 0);}
+SECTIONS
+{
+ /* Read-only sections, merged into text segment: */
+ ${CREATE_SHLIB-${RELOCATING+. = ${TEXT_START_ADDR} + SIZEOF_HEADERS;}}
+ ${CREATE_SHLIB+${RELOCATING+. = SIZEOF_HEADERS;}}
+ ${CREATE_SHLIB-${INTERP}}
+ .hash ${RELOCATING-0} : { *(.hash) }
+ .dynsym ${RELOCATING-0} : { *(.dynsym) }
+ .dynstr ${RELOCATING-0} : { *(.dynstr) }
+ .gnu.version ${RELOCATING-0} : { *(.gnu.version) }
+ .gnu.version_d ${RELOCATING-0} : { *(.gnu.version_d) }
+ .gnu.version_r ${RELOCATING-0} : { *(.gnu.version_r) }
+ .rela.text ${RELOCATING-0} :
+ {
+ *(.rela.text)
+ ${RELOCATING+*(.rela.text.*)}
+ ${RELOCATING+*(.rela.gnu.linkonce.t*)}
+ }
+ .rela.data ${RELOCATING-0} :
+ {
+ *(.rela.data)
+ ${RELOCATING+*(.rela.data.*)}
+ ${RELOCATING+*(.rela.gnu.linkonce.d*)}
+ }
+ .rela.rodata ${RELOCATING-0} :
+ {
+ *(.rela.rodata)
+ ${RELOCATING+*(.rela.rodata.*)}
+ ${RELOCATING+*(.rela.gnu.linkonce.r*)}
+ }
+ .rela.got ${RELOCATING-0} : { *(.rela.got) }
+ .rela.got1 ${RELOCATING-0} : { *(.rela.got1) }
+ .rela.got2 ${RELOCATING-0} : { *(.rela.got2) }
+ .rela.ctors ${RELOCATING-0} : { *(.rela.ctors) }
+ .rela.dtors ${RELOCATING-0} : { *(.rela.dtors) }
+ .rela.init ${RELOCATING-0} : { *(.rela.init) }
+ .rela.fini ${RELOCATING-0} : { *(.rela.fini) }
+ .rela.bss ${RELOCATING-0} : { *(.rela.bss) }
+ .rela.plt ${RELOCATING-0} : { *(.rela.plt) }
+ .rela.sdata ${RELOCATING-0} : { *(.rela.sdata) }
+ .rela.sbss ${RELOCATING-0} : { *(.rela.sbss) }
+ .rela.sdata2 ${RELOCATING-0} : { *(.rela.sdata2) }
+ .rela.sbss2 ${RELOCATING-0} : { *(.rela.sbss2) }
+ .text ${RELOCATING-0} :
+ {
+ ${RELOCATING+${TEXT_START_SYMBOLS}}
+ *(.text)
+ ${RELOCATING+*(.text.*)}
+ /* .gnu.warning sections are handled specially by elf32.em. */
+ *(.gnu.warning)
+ ${RELOCATING+*(.gnu.linkonce.t*)}
+ } =${NOP-0}
+ .init ${RELOCATING-0} : { KEEP (*(.init)) } =${NOP-0}
+ .fini ${RELOCATING-0} : { KEEP (*(.fini)) } =${NOP-0}
+ .rodata ${RELOCATING-0} :
+ {
+ *(.rodata)
+ ${RELOCATING+*(.rodata.*)}
+ ${RELOCATING+*(.gnu.linkonce.r*)}
+ }
+ .rodata1 ${RELOCATING-0} : { *(.rodata1) }
+ ${RELOCATING+_etext = .;}
+ ${RELOCATING+PROVIDE (etext = .);}
+ ${RELOCATING+PROVIDE (__etext = .);}
+ ${CREATE_SHLIB-${SDATA2}}
+ ${CREATE_SHLIB-${SBSS2}}
+ ${RELOCATING+${OTHER_READONLY_SECTIONS}}
+
+ /* Adjust the address for the data segment. We want to adjust up to
+ the same address within the page on the next page up. It would
+ be more correct to do this:
+ ${RELOCATING+. = ${DATA_ADDR-ALIGN(${MAXPAGESIZE}) + (ALIGN(8) & (${MAXPAGESIZE} - 1))};}
+ The current expression does not correctly handle the case of a
+ text segment ending precisely at the end of a page; it causes the
+ data segment to skip a page. The above expression does not have
+ this problem, but it will currently (2/95) cause BFD to allocate
+ a single segment, combining both text and data, for this case.
+ This will prevent the text segment from being shared among
+ multiple executions of the program; I think that is more
+ important than losing a page of the virtual address space (note
+ that no actual memory is lost; the page which is skipped can not
+ be referenced). */
+ ${RELOCATING+. = ${DATA_ADDR- ALIGN(8) + ${MAXPAGESIZE}};}
+
+ .data ${RELOCATING-0} :
+ {
+ ${RELOCATING+${DATA_START_SYMBOLS}}
+ *(.data)
+ ${RELOCATING+*(.data.*)}
+ ${RELOCATING+*(.gnu.linkonce.d*)}
+ ${CONSTRUCTING+CONSTRUCTORS}
+ }
+ .data1 ${RELOCATING-0} : { *(.data1) }
+ ${RELOCATING+${OTHER_READWRITE_SECTIONS}}
+
+ .got1 ${RELOCATING-0} : { *(.got1) }
+ .dynamic ${RELOCATING-0} : { *(.dynamic) }
+
+ /* Put .ctors and .dtors next to the .got2 section, so that the pointers
+ get relocated with -mrelocatable. Also put in the .fixup pointers.
+ The current compiler no longer needs this, but keep it around for 2.7.2 */
+
+ ${RELOCATING+PROVIDE (_GOT2_START_ = .);}
+ ${RELOCATING+PROVIDE (__GOT2_START_ = .);}
+ .got2 ${RELOCATING-0} : { *(.got2) }
+
+ ${RELOCATING+PROVIDE (__CTOR_LIST__ = .);}
+ ${RELOCATING+PROVIDE (___CTOR_LIST__ = .);}
+ ${RELOCATING+${CTOR}}
+ ${RELOCATING+PROVIDE (__CTOR_END__ = .);}
+ ${RELOCATING+PROVIDE (___CTOR_END__ = .);}
+
+ ${RELOCATING+PROVIDE (__DTOR_LIST__ = .);}
+ ${RELOCATING+PROVIDE (___DTOR_LIST__ = .);}
+ ${RELOCATING+${DTOR}}
+ ${RELOCATING+PROVIDE (__DTOR_END__ = .);}
+ ${RELOCATING+PROVIDE (___DTOR_END__ = .);}
+
+ ${RELOCATING+PROVIDE (_FIXUP_START_ = .);}
+ ${RELOCATING+PROVIDE (__FIXUP_START_ = .);}
+ .fixup ${RELOCATING-0} : { *(.fixup) }
+ ${RELOCATING+PROVIDE (_FIXUP_END_ = .);}
+ ${RELOCATING+PROVIDE (__FIXUP_END_ = .);}
+ ${RELOCATING+PROVIDE (_GOT2_END_ = .);}
+ ${RELOCATING+PROVIDE (__GOT2_END_ = .);}
+
+ ${RELOCATING+PROVIDE (_GOT_START_ = .);}
+ ${RELOCATING+PROVIDE (__GOT_START_ = .);}
+ .got ${RELOCATING-0} : { *(.got) }
+ .got.plt ${RELOCATING-0} : { *(.got.plt) }
+ ${CREATE_SHLIB+${SDATA2}}
+ ${CREATE_SHLIB+${SBSS2}}
+ ${RELOCATING+PROVIDE (_GOT_END_ = .);}
+ ${RELOCATING+PROVIDE (__GOT_END_ = .);}
+
+ /* We want the small data sections together, so single-instruction offsets
+ can access them all, and initialized data all before uninitialized, so
+ we can shorten the on-disk segment size. */
+ .sdata ${RELOCATING-0} : { *(.sdata) }
+ ${RELOCATING+_edata = .;}
+ ${RELOCATING+PROVIDE (edata = .);}
+ ${RELOCATING+PROVIDE (__edata = .);}
+ .sbss ${RELOCATING-0} :
+ {
+ ${RELOCATING+PROVIDE (__sbss_start = .);}
+ ${RELOCATING+PROVIDE (___sbss_start = .);}
+ *(.sbss)
+ *(.scommon)
+ *(.dynsbss)
+ ${RELOCATING+PROVIDE (__sbss_end = .);}
+ ${RELOCATING+PROVIDE (___sbss_end = .);}
+ }
+ ${PLT}
+ .bss ${RELOCATING-0} :
+ {
+ ${RELOCATING+${OTHER_BSS_SYMBOLS}}
+ ${RELOCATING+PROVIDE (__bss_start = .);}
+ ${RELOCATING+PROVIDE (___bss_start = .);}
+ *(.dynbss)
+ *(.bss)
+ *(COMMON)
+ }
+ ${RELOCATING+_end = . ;}
+ ${RELOCATING+PROVIDE (end = .);}
+ ${RELOCATING+PROVIDE (__end = .);}
+
+ /* These are needed for ELF backends which have not yet been
+ converted to the new style linker. */
+ .stab 0 : { *(.stab) }
+ .stabstr 0 : { *(.stabstr) }
+
+ /* DWARF debug sections.
+ Symbols in the DWARF debugging sections are relative to the beginning
+ of the section so we begin them at 0. */
+
+ /* DWARF 1 */
+ .debug 0 : { *(.debug) }
+ .line 0 : { *(.line) }
+
+ /* GNU DWARF 1 extensions */
+ .debug_srcinfo 0 : { *(.debug_srcinfo) }
+ .debug_sfnames 0 : { *(.debug_sfnames) }
+
+ /* DWARF 1.1 and DWARF 2 */
+ .debug_aranges 0 : { *(.debug_aranges) }
+ .debug_pubnames 0 : { *(.debug_pubnames) }
+
+ /* DWARF 2 */
+ .debug_info 0 : { *(.debug_info) }
+ .debug_abbrev 0 : { *(.debug_abbrev) }
+ .debug_line 0 : { *(.debug_line) }
+ .debug_frame 0 : { *(.debug_frame) }
+ .debug_str 0 : { *(.debug_str) }
+ .debug_loc 0 : { *(.debug_loc) }
+ .debug_macinfo 0 : { *(.debug_macinfo) }
+
+ /* SGI/MIPS DWARF 2 extensions */
+ .debug_weaknames 0 : { *(.debug_weaknames) }
+ .debug_funcnames 0 : { *(.debug_funcnames) }
+ .debug_typenames 0 : { *(.debug_typenames) }
+ .debug_varnames 0 : { *(.debug_varnames) }
+
+ /* These must appear regardless of ${RELOCATING}. */
+ ${OTHER_SECTIONS}
+}
+EOF
diff --git a/contrib/binutils/ld/scripttempl/pe.sc b/contrib/binutils/ld/scripttempl/pe.sc
index f5cfc70..ce1a502 100644
--- a/contrib/binutils/ld/scripttempl/pe.sc
+++ b/contrib/binutils/ld/scripttempl/pe.sc
@@ -6,21 +6,26 @@ fi
# We can't easily and portably get an unquoted $ in a shell
# substitution, so we do this instead.
+# Sorting of the .foo$* sections is required by the definition of
+# grouped sections in PE.
+# Sorting of the file names in R_IDATA is required by the
+# current implementation of dlltool (this could probably be changed to
+# use grouped sections instead).
if test "${RELOCATING}"; then
- R_TEXT='*(.text$*)'
- R_DATA='*(.data$*)'
- R_RDATA='*(.rdata$*)'
+ R_TEXT='*(SORT(.text$*))'
+ R_DATA='*(SORT(.data$*))'
+ R_RDATA='*(SORT(.rdata$*))'
R_IDATA='
- *(.idata$2)
- *(.idata$3)
+ SORT(*)(.idata$2)
+ SORT(*)(.idata$3)
/* These zeroes mark the end of the import list. */
LONG (0); LONG (0); LONG (0); LONG (0); LONG (0);
- *(.idata$4)
- *(.idata$5)
- *(.idata$6)
- *(.idata$7)'
- R_CRT='*(.CRT$*)'
- R_RSRC='*(.rsrc$*)'
+ SORT(*)(.idata$4)
+ SORT(*)(.idata$5)
+ SORT(*)(.idata$6)
+ SORT(*)(.idata$7)'
+ R_CRT='*(SORT(.CRT$*))'
+ R_RSRC='*(SORT(.rsrc$*))'
else
R_TEXT=
R_DATA=
@@ -33,10 +38,11 @@ fi
cat <<EOF
${RELOCATING+OUTPUT_FORMAT(${OUTPUT_FORMAT})}
${RELOCATING-OUTPUT_FORMAT(${RELOCATEABLE_OUTPUT_FORMAT})}
+${OUTPUT_ARCH+OUTPUT_ARCH(${OUTPUT_ARCH})}
${LIB_SEARCH_DIRS}
-ENTRY(_mainCRTStartup)
+ENTRY(${ENTRY})
SECTIONS
{
@@ -74,6 +80,18 @@ SECTIONS
${RELOCATING+*(.data_cygwin_nocopy)}
}
+ .rdata ${RELOCATING+BLOCK(__section_alignment__)} :
+ {
+ *(.rdata)
+ ${R_RDATA}
+ *(.eh_frame)
+ }
+
+ .pdata ${RELOCATING+BLOCK(__section_alignment__)} :
+ {
+ *(.pdata)
+ }
+
.bss ${RELOCATING+BLOCK(__section_alignment__)} :
{
${RELOCATING+__bss_start__ = . ;}
@@ -82,13 +100,6 @@ SECTIONS
${RELOCATING+__bss_end__ = . ;}
}
- .rdata ${RELOCATING+BLOCK(__section_alignment__)} :
- {
- *(.rdata)
- ${R_RDATA}
- *(.eh_frame)
- }
-
.edata ${RELOCATING+BLOCK(__section_alignment__)} :
{
*(.edata)
@@ -117,20 +128,21 @@ SECTIONS
{
/* end is deprecated, don't use it */
${RELOCATING+ end = .;}
+ ${RELOCATING+ _end = .;}
${RELOCATING+ __end__ = .;}
}
- .reloc ${RELOCATING+BLOCK(__section_alignment__)} :
- {
- *(.reloc)
- }
-
.rsrc ${RELOCATING+BLOCK(__section_alignment__)} :
{
*(.rsrc)
${R_RSRC}
}
+ .reloc ${RELOCATING+BLOCK(__section_alignment__)} :
+ {
+ *(.reloc)
+ }
+
.stab ${RELOCATING+BLOCK(__section_alignment__)} ${RELOCATING+(NOLOAD)} :
{
[ .stab ]
diff --git a/contrib/binutils/ld/scripttempl/ppcpe.sc b/contrib/binutils/ld/scripttempl/ppcpe.sc
new file mode 100644
index 0000000..40fbe33
--- /dev/null
+++ b/contrib/binutils/ld/scripttempl/ppcpe.sc
@@ -0,0 +1,198 @@
+# A PE linker script for PowerPC.
+# Loosely based on Steve Chamberlain's pe.sc.
+# All new mistakes should be credited to Kim Knuttila (krk@cygnus.com)
+#
+# These are substituted in as variables in order to get '}' in a shell
+# conditional expansion.
+INIT='.init : { *(.init) }'
+FINI='.fini : { *(.fini) }'
+cat <<EOF
+OUTPUT_FORMAT(${OUTPUT_FORMAT})
+${LIB_SEARCH_DIRS}
+
+/* Much of this layout was determined by delving into .exe files for
+ the box generated by other compilers/linkers/etc. This means that
+ if a particular feature did not happen to appear in one of the
+ subject files, then it may not be yet supported.
+*/
+
+/* It's "mainCRTStartup", not "_mainCRTStartup", and it's located in
+ one of the two .lib files (libc.lib and kernel32.lib) that currently
+ must be present on the link line. This means that you must use
+ "-u mainCRTStartup" to make sure it gets included in the link.
+*/
+
+ENTRY(mainCRTStartup)
+
+SECTIONS
+{
+
+ /* text - the usual meaning */
+ .text ${RELOCATING+ __image_base__ + __section_alignment__ } :
+ {
+ ${RELOCATING+ *(.init);}
+ *(.text)
+ *(.gcc_except_table)
+ ${CONSTRUCTING+ ___CTOR_LIST__ = .; __CTOR_LIST__ = . ;
+ LONG (-1); *(.ctors); *(.ctor); LONG (0); }
+ ${CONSTRUCTING+ ___DTOR_LIST__ = .; __DTOR_LIST__ = . ;
+ LONG (-1); *(.dtors); *(.dtor); LONG (0); }
+ ${RELOCATING+ *(.fini);}
+ ${RELOCATING+ etext = .};
+ }
+
+ /* rdata - Read Only Runtime Data
+ CTR sections: All of the CRT (read only C runtime data) sections
+ appear at the start of the .rdata (read only runtime data)
+ section, in the following order. Don't know if it matters or not.
+ Not all sections are always present either.
+ .rdata: compiler generated read only data
+ .xdata: compiler generated exception handling table. (Most docs
+ seem to suggest that this section is now deprecated infavor
+ of the ydata section)
+ .edata: The exported names table.
+ */
+ .rdata BLOCK(__section_alignment__) :
+ {
+ *(.CRT\$XCA);
+ *(.CRT\$XCC);
+ *(.CRT\$XCZ);
+ *(.CRT\$XIA);
+ *(.CRT\$XIC);
+ *(.CRT\$XIZ);
+ *(.CRT\$XLA);
+ *(.CRT\$XLZ);
+ *(.CRT\$XPA);
+ *(.CRT\$XPX);
+ *(.CRT\$XPZ);
+ *(.CRT\$XTA);
+ *(.CRT\$XTZ);
+ *(.rdata);
+ *(.xdata);
+ }
+
+ .edata BLOCK(__section_alignment__) :
+ {
+ *(.edata);
+ }
+
+ /* data - initialized data
+ .ydata: exception handling information.
+ .data: the usual meaning.
+ .data2: more of the same.
+ .bss: For some reason, bss appears to be included in the data
+ section, as opposed to being given a section of it's own.
+ COMMON:
+ */
+ .data BLOCK(__section_alignment__) :
+ {
+ __data_start__ = . ;
+ *(.ydata);
+ *(.data);
+ *(.data2);
+ __bss_start__ = . ;
+ *(.bss) ;
+ *(COMMON);
+ __bss_end__ = . ;
+ ${RELOCATING+ end = .};
+ __data_end__ = . ;
+ }
+
+ /* The exception handling table. A sequence of 5 word entries. Section
+ address and extent are placed in the DataDirectory.
+ */
+ .pdata BLOCK(__section_alignment__) :
+ {
+ *(.pdata)
+ ;
+ }
+
+ /* The idata section is chock full of magic bits.
+ 1. Boundaries around various idata parts are used to initialize
+ some of the fields of the DataDirectory. In particular, the
+ magic for 2, 4 and 5 are known to be used. Some compilers
+ appear to generate magic section symbols for this purpose.
+ Where we can, we catch such symbols and use our own. This of
+ course is something less than a perfect strategy.
+ 2. The table of contents is placed immediately after idata4.
+ The ".private.toc" sections are generated by the ppc bfd. The
+ .toc variable is generated by gas, and resolved here. It is
+ used to initialized function descriptors (and anyone else who
+ needs the address of the module's toc). The only thing
+ interesting about it at all? Most ppc instructions using it
+ have a 16bit displacement field. The convention for addressing
+ is to initialize the .toc value to 32K past the start of the
+ actual toc, and subtract 32K from all references, thus using
+ the entire 64K range. Naturally, the reloc code must agree
+ on this number or you get pretty stupid results.
+ */
+ .idata BLOCK(__section_alignment__) :
+ {
+ __idata2_magic__ = .;
+ *(.idata\$2);
+ __idata3_magic__ = .;
+ *(.idata\$3);
+ __idata4_magic__ = .;
+ *(.idata\$4);
+ . = ALIGN(4);
+ .toc = . + 32768;
+ *(.private.toc);
+ __idata5_magic__ = .;
+ *(.idata\$5);
+ __idata6_magic__ = .;
+ *(.idata\$6);
+ __idata7_magic__ = .;
+ *(.idata\$7);
+ ;
+ }
+
+ /* reldata -- data that requires relocation
+ */
+ .reldata BLOCK(__section_alignment__) :
+ {
+ *(.reldata)
+ ;
+ }
+
+
+ /* Resources */
+ .rsrc BLOCK(__section_alignment__) :
+ {
+ *(.rsrc\$01)
+ *(.rsrc\$02)
+ ;
+ }
+
+ .stab BLOCK(__section_alignment__) ${RELOCATING+(NOLOAD)} :
+ {
+ [ .stab ]
+ }
+
+ .stabstr BLOCK(__section_alignment__) ${RELOCATING+(NOLOAD)} :
+ {
+ [ .stabstr ]
+ }
+
+ /* The .reloc section is currently generated by the dlltool from Steve
+ Chamberlain in a second pass of linking. Section address and extent
+ are placed in the DataDirectory.
+ */
+ .reloc BLOCK(__section_alignment__) :
+ {
+ *(.reloc)
+ ;
+ }
+
+ /* We don't do anything useful with codeview debugger support or the
+ directive section (yet). Hopefully, we junk them correctly.
+ */
+ /DISCARD/ BLOCK(__section_alignment__) :
+ {
+ *(.debug\$S)
+ *(.debug\$T)
+ *(.debug\$F)
+ *(.drectve)
+ ;
+ }
+}
+EOF
diff --git a/contrib/binutils/ld/scripttempl/sparccoff.sc b/contrib/binutils/ld/scripttempl/sparccoff.sc
new file mode 100644
index 0000000..6bbb7ad
--- /dev/null
+++ b/contrib/binutils/ld/scripttempl/sparccoff.sc
@@ -0,0 +1,48 @@
+# Linker script for Sparc COFF.
+# Based on i386coff.sc by Ian Taylor <ian@cygnus.com>.
+test -z "$ENTRY" && ENTRY=_start
+cat <<EOF
+OUTPUT_FORMAT("${OUTPUT_FORMAT}")
+${LIB_SEARCH_DIRS}
+
+ENTRY(${ENTRY})
+
+SECTIONS
+{
+ .text ${RELOCATING+ SIZEOF_HEADERS} : {
+ *(.init)
+ *(.text)
+ ${RELOCATING+ etext = .;}
+ ${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__ = .;}
+ *(.fini)
+ ${RELOCATING+ etext = .};
+ }
+ .data ${RELOCATING+ 0x400000 + (. & 0xffc00fff)} : {
+ *(.data)
+ ${RELOCATING+ edata = .};
+ }
+ .bss ${RELOCATING+ SIZEOF(.data) + ADDR(.data)} :
+ {
+ *(.bss)
+ *(COMMON)
+ ${RELOCATING+ end = .};
+ }
+ .stab 0 ${RELOCATING+(NOLOAD)} :
+ {
+ [ .stab ]
+ }
+ .stabstr 0 ${RELOCATING+(NOLOAD)} :
+ {
+ [ .stabstr ]
+ }
+}
+EOF
diff --git a/contrib/binutils/ld/scripttempl/v850.sc b/contrib/binutils/ld/scripttempl/v850.sc
index 6f3844e..0a20954 100644
--- a/contrib/binutils/ld/scripttempl/v850.sc
+++ b/contrib/binutils/ld/scripttempl/v850.sc
@@ -55,11 +55,12 @@ SECTIONS
.rela.bss : { *(.rela.bss) }
.rel.plt : { *(.rel.plt) }
.rela.plt : { *(.rela.plt) }
- .init : { *(.init) } =0
+ .init : { KEEP (*(.init)) } =0
.plt : { *(.plt) }
.text : {
*(.text)
+ ${RELOCATING+*(.text.*)}
/* .gnu.warning sections are handled specially by elf32.em. */
*(.gnu.warning)
*(.gnu.linkonce.t*)
@@ -68,26 +69,42 @@ SECTIONS
${RELOCATING+_etext = .;}
${RELOCATING+PROVIDE (etext = .);}
+ /* This is special code area at the end of the normal text section.
+ It contains a small lookup table at the start followed by the
+ code pointed to by entries in the lookup table. */
- .fini : { *(.fini) } =0
- .rodata : { *(.rodata) *(.gnu.linkonce.r*) }
+ .call_table_data ${CALL_TABLE_START_ADDR} : {
+ ${RELOCATING+PROVIDE(__ctbp = .);}
+ *(.call_table_data)
+ } = 0xff /* fill gaps with 0xff */
+ .call_table_text : {
+ *(.call_table_text)
+ }
+
+ .fini : { KEEP (*(.fini)) } =0
+ .rodata : { *(.rodata) ${RELOCATING+*(.rodata.*)} *(.gnu.linkonce.r*) }
.rodata1 : { *(.rodata1) }
.data : {
*(.data)
+ ${RELOCATING+*(.data.*)}
*(.gnu.linkonce.d*)
CONSTRUCTORS
}
.data1 : { *(.data1) }
.ctors : {
${RELOCATING+___ctors = .;}
- *(.ctors)
+ KEEP (*(EXCLUDE_FILE (*crtend.o) .ctors))
+ KEEP (*(SORT(.ctors.*)))
+ KEEP (*crtend(.ctors))
${RELOCATING+___ctors_end = .;}
}
.dtors : {
${RELOCATING+___dtors = .;}
- *(.dtors)
+ KEEP (*(EXCLUDE_FILE (*crtend.o) .dtors))
+ KEEP (*(SORT(.dtors.*)))
+ KEEP (*crtend.o(.dtors))
${RELOCATING+___dtors_end = .;}
}
@@ -109,22 +126,30 @@ SECTIONS
.sdata ${SDATA_START_ADDR} : {
${RELOCATING+PROVIDE (__gp = . + 0x8000);}
*(.sdata)
- ${RELOCATING+__sbss_start = .;}
- *(.sbss)
- *(.scommon)
- }
+ }
- /* See comment about .rozdata */
+ /* See comment about .rozdata. */
.rosdata ${ROSDATA_START_ADDR} : {
*(.rosdata)
}
+ /* We place the .sbss data section AFTER the .rosdata section, so that
+ it can directly preceed the .bss section. This allows runtime startup
+ code to initialise all the zero-data sections by simply taking the
+ value of '_edata' and zeroing until it reaches '_end' */
+ .sbss : {
+ ${RELOCATING+__sbss_start = .;}
+ *(.sbss)
+ *(.scommon)
+ }
+
${RELOCATING+_edata = DEFINED (__sbss_start) ? __sbss_start : . ;}
${RELOCATING+PROVIDE (edata = _edata);}
.bss :
{
${RELOCATING+__bss_start = DEFINED (__sbss_start) ? __sbss_start : . ;}
+ ${RELOCATING+__real_bss_start = . ;}
*(.dynbss)
*(.bss)
*(COMMON)
diff --git a/contrib/binutils/ld/sysdep.h b/contrib/binutils/ld/sysdep.h
index a018436..2ccc122 100644
--- a/contrib/binutils/ld/sysdep.h
+++ b/contrib/binutils/ld/sysdep.h
@@ -66,4 +66,8 @@ extern void free ();
extern char *getenv ();
#endif
+#ifdef NEED_DECLARATION_ENVIRON
+extern char **environ;
+#endif
+
#endif /* ! defined (LD_SYSDEP_H) */
OpenPOWER on IntegriCloud