diff options
author | Niklas Hallqvist <niklas@cvs.openbsd.org> | 1996-06-10 10:55:58 +0000 |
---|---|---|
committer | Niklas Hallqvist <niklas@cvs.openbsd.org> | 1996-06-10 10:55:58 +0000 |
commit | a7e831079363e3bb45f3172f6e59ba48e335682b (patch) | |
tree | ee4324eac9a9d66f189fab60498ec42b8226b7fc /gnu/usr.bin/binutils/ld | |
parent | 467cb0a471d13c5186a6ee166e60b47c30da64e9 (diff) |
Bring Cygnus versions into the trunk, keeping our local patches
Diffstat (limited to 'gnu/usr.bin/binutils/ld')
78 files changed, 5637 insertions, 11128 deletions
diff --git a/gnu/usr.bin/binutils/ld/ChangeLog b/gnu/usr.bin/binutils/ld/ChangeLog index 7292ee104fe..61b3e27062c 100644 --- a/gnu/usr.bin/binutils/ld/ChangeLog +++ b/gnu/usr.bin/binutils/ld/ChangeLog @@ -1,7 +1,938 @@ +Fri Jun 7 11:27:42 1996 Ian Lance Taylor <ian@cygnus.com> + + * emultempl/sunos.em: Include libiberty.h. + (gld${EMULATION_NAME}_set_symbols): New static function to add + LD_LIBRARY_PATH to the list of search directories. + (ld_${EMULATION_NAME}_emulation): Add new set_symbols routine. + +Thu Jun 6 11:50:31 1996 Ian Lance Taylor <ian@cygnus.com> + + * emulparams/elf32bmip.sh (OTHER_GOT_SYMBOLS): Use ALIGN(16) + rather than . when computing _gp value. From Per Fogelstrom. + * emulparams/elf32lmip.sh (OTHER_GOT_SYMBOLS): Likewise. + + * ldmain.c (main): Don't close and unlink the file on error, since + remove_output will do it anyhow. + * ldlang.c (open_output): Set boolean variable to true, not 1. + +Wed Jun 5 18:34:14 1996 James G. Smith <jsmith@cygnus.co.uk> + + * emulparams/{elf32b4300.sh,elf32l4300.sh} (SCRIPT_NAME): Use + elfmips instead of elf. + +Tue Jun 4 18:43:07 1996 Ian Lance Taylor <ian@cygnus.com> + + * ldcref.c: New file. + * ld.h (add_cref, output_cref): Declare. + * ldmain.c (main): Initialize notice_all field. If it is set at + end of link, call output_cref. + (notice): Rename from notice_ysym. Check notice_all. + * ldmisc.c (finfo): Make globally visible. + * ldmisc.h (finfo): Declare. + * lexsup.c (OPTION_CREF): Define. + (ld_options): Add "cref". + (parse_args): Handle OPTION_CREF. + * Makefile.in: Rebuild dependencies. + (CFILES): Add ldcref.c. + (OFILES): Add ldcref.o. + * ld.texinfo, ld.1: Document --cref. + +Tue Jun 4 12:12:25 1996 Tom Tromey <tromey@csk3.cygnus.com> + + * Makefile.in (install): Make $(tooldir) and $(tooldir)/bin. + +Fri May 31 12:40:55 1996 Ian Lance Taylor <ian@cygnus.com> + + * emultempl/pe.em (sort_sections): Don't assume that a + wild_statement has a section name. + +Wed May 29 13:13:35 1996 Ian Lance Taylor <ian@cygnus.com> + + * scripttempl/elfmips.sc: Quote test -z argument. + + * ld.texinfo: Clarify the CONSTRUCTORS command. + +Thu May 23 16:07:44 1996 Ian Lance Taylor <ian@cygnus.com> + + * emultempl/aix.em (gld${EMULATION_NAME}_read_file): Initialize + file, not impfile. + +Wed May 22 11:31:30 1996 Doug Evans <dje@seba.cygnus.com> + + * ldlang.c (wild_doit): Don't copy over SEC_LINK_{ONCE,DUPLICATES} + if final link. + * emultempl/pe.em (sfunc): Renamed to sort_by_file_name. + (sort_by_section_name, sort_sections_1): New functions. + (sort_sections): Only sort by file name sections in .idata. + Add "Grouped Sections" support. + (gld${EMULATION_NAME}_place_orphan): Rewrite to support Grouped + Sections. + (gld${EMULATION_NAME}_place_section): Delete. + * scripttempl/pe.sc (.text,.data,.rdata): Add *(.foo\$). + (.CRT,.rsrc): Rewrite to use Grouped Section support. + +Tue May 21 14:31:48 1996 Stan Shebs <shebs@andros.cygnus.com> + + * mpw-eppcmac.c: Update to reflect changes to aix.em. + +Sun May 19 16:59:44 1996 Doug Evans <dje@seba.cygnus.com> + + * ldlang.c (dprint_statement): Stop printing at end of list. + +Sat May 18 13:12:05 1996 Steve Chamberlain <sac@slash.cygnus.com> + + Support for --force-exe-suffix + * ld.h (args_type): Add force_exe_suffix. + * ld.texinfo: Add documentation. + * ldmain.c (main): Add support for option. + * lexsup.c (OPTION_FORCE_EXE_SUFFIX): New. + (ld_options, parse_args): Add support for option. + +Wed May 15 12:50:25 1996 Jim Wilson <wilson@chestnut.cygnus.com> + + * emultempl/pe.em (set_pe_value): Pass 0 not 16 to strtoul call. + +Fri May 10 16:28:44 1996 Michael Meissner <meissner@tiktok.cygnus.com> + + * scripttempl/elfppc.sc (__stack): Make __stack 0 if it was + referenced but not defined. + +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. + * scripttempl/{mips.sc,elfmips.sc}: Don't add SIZEOF_HEADERS to + .text for an embedded system. + +Tue May 7 10:56:11 1996 Doug Evans <dje@canuck.cygnus.com> + + * scripttempl/pe.em (gld${EMULATION_NAME}_place_orphan): New function. + (gld${EMULATION_NAME}_place_section): New function. + (hold_{section,use,text,rdata,data}): New static locals. + (ld_${EMULATION_NAME}_emulation): Update orphan field. + * scripttempl/pe.sc: Whitespace cleanup. Semicolon usage cleanup. + (INIT,FINI): Delete, unused. + (.text): Document orphan .text.foo sections. + (.rdata): Document orphan .rdata.foo sections. + (.data): Document orphan .data.foo sections. + +Tue May 7 11:35:46 1996 Jeffrey A Law (law@cygnus.com) + + * scripttempl/h8300.sc: Place ".tiny" sections right + after ".data" sections. + * scripttempl/h8300h.sc: Place ".tiny" sections into + the "tiny" memory region, 0xff8000 through 0xffff00. + + * scripttempl/h8300.sc: Set the entry point to the value of + "_start" rather than the start of the text segment. + * scripttempl/h8300h.sc: Likewise. + + * scripttempl/h8300.sc: Place .rodata sections before .text + sections in main ram. + * scripttempl/h8300h.sc: Likewise. + +Mon May 6 23:32:30 1996 Jeffrey A Law (law@cygnus.com) + + * scripttempl/h8300h.sc: Use "eight", not "eightbit" for the + 8-bit region and 8-bit sections. + +Wed May 1 17:50:06 1996 Doug Evans <dje@canuck.cygnus.com> + + * ldlang.c (section_already_linked): Fix typos. + +Mon Apr 29 20:31:06 1996 Doug Evans <dje@canuck.cygnus.com> + + * scripttempl/pe.sc (.endjunk): Define __end__. + +Mon Apr 29 17:05:13 1996 Ian Lance Taylor <ian@cygnus.com> + + * ldlang.c (longest_section_name): Remove. + (SECTION_NAME_MAP_LENGTH): Define. + (print_size, print_alignment, print_fill, print_section): Remove. + (print_flags): Remove. + (lang_map): Rewrite. + (print_output_section_statement): Rewrite. + (print_assignment): Rewrite. + (print_one_symbol): Rewrite. + (print_input_section): Rewrite. + (print_fill_statement): Rewrite. + (print_data_statement): Rewrite. + (print_address_statement): New static function. + (print_reloc_statement): Rewrite. + (print_padding_statement): Rewrite. + (print_wild_statement): Rewrite. + (print_statement_list): Clean up. + (print_statement): Clean up. Some minor output changes. + (print_statements): Clean up. + (load_symbols): Put another - before -whole-archive. + * ldexp.c (exp_print_tree): Change etree_value and etree_rel to + print 0x and to omit leading zeroes. For etree_rel, use %B to + print the BFD. For etree_assign, remove the space after the + destination name. + * ldwrite.c: Include "libiberty.h". + (clone_section): Call xstrdup, not strdup. + (ldwrite): Don't print any map information. + (print_symbol_table, print_file_stuff, print_symbol): Remove. + * ldmain.c (main): Call lang_map when appropriate. + * ldmisc.c (vfinfo): Add support for %W. + (print_address): Remove. + * ldmisc.h (print_address): Don't declare. + * Makefile.in: Rebuild dependencies. + +Mon Apr 29 10:29:07 1996 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de> + + * configure.host (m68*-*-linux*): Add -dynamic-linker to + HOSTING_CRT0. Search -lgcc both before and after -lc in + HOSTING_LIBS. Look for crt{begin,end}.o in the compiler directory + at first. + (i[345]86-*-linux*): Look for crt{begin,end}.o in the compiler + directory at first. + +Fri Apr 26 14:42:27 1996 Ian Lance Taylor <ian@cygnus.com> + + * ldmisc.h (demangle): Declare. + * ldmisc.c: Include "libiberty.h". Include demangle.h with "", + not <>. + (demangle): Make non-static. Remove remove_underscore paramter. + Always return an allocated string. + (vfinfo): Free result of demangle. Add case 'G'. Use %T to print + functionname, rather than calling demangle. Print a colon between + the BFD(section+offset) and the line number. + * ldmain.c (add_archive_element): Improve format of archive + information in map file. + (constructor_callback): Don't print anything to the map file. + * ldlang.c (lang_one_common): Improve format of common symbol + information in map file. + * ldctor.c (ldctor_build_sets): If producing a map file, print set + information. + * ldwrite.c (print_symbol_table): Print a newline before the + header in the map file. + * Makefile.in: Rebuild dependencies. + + * ldmisc.c (vfinfo): Reindent. + +Mon Apr 22 12:07:32 1996 Ian Lance Taylor <ian@cygnus.com> + + * ldlang.c (lang_size_sections): If _cooked_size is not 0, then + don't clobber it when not relaxing. + + * ld.h (ld_config_type): Remove traditional_format field. + * ldmain.c (main): Use link_info.traditional_format rather than + config.traditional_format. + * ldlang.c (ldlang_open_output): Likewise. + * lexsup.c (parse_args): Likewise. + * emultempl/aix.em (gld${EMULATION_NAME}_parse_args): Likewise. + * mpw-eppcmac.c (gldppcmacos_parse_args): Likewise. + + * ldlang.c (wild_doit): Discard debugging sections if we are + stripping debugging information. + + * emulparams/z8002.sh (ARCH): Set to z8002, not z8k. + +Tue Apr 16 16:38:32 1996 Ian Lance Taylor <ian@cygnus.com> + + * ldexp.c (fold_binary): Correct handling of subtraction with + absolute values. + (fold_name): Permit symbols in lang_allocating_phase_enum. + + * scripttempl/aout.sc: Only PROVIDE __stack when RELOCATING. Undo + accidental changes in last patch. + +Tue Apr 16 10:25:42 1996 Michael Meissner <meissner@tiktok.cygnus.com> + + * configure.tgt (powerpc*-*-{sysv,linux}): Add aliases. + (powerpcle*-*-{sysv,solaris}): Ditto. + +Mon Apr 15 14:50:56 1996 Rob Savoye <rob@chinadoll.cygnus.com> + + * scripttempl/aout.sc: Add PROVIDE (__stack = 0) so I can use it + in m68k/crt0.S without things blowing up. + +Fri Apr 12 16:40:56 1996 Rob Savoye <rob@chinadoll.cygnus.com> + + * scripttempl/m68kcoff.sc: Remove default address for .data so + .text, .data, and .bss are all sequential. + +Thu Apr 11 12:05:35 1996 Ian Lance Taylor <ian@cygnus.com> + + * scripttempl/m68kcoff.sc: Remove regions and simplify. + +Wed Apr 10 14:41:53 1996 Jeffrey A Law (law@cygnus.com) + + * scripttempl/h8300.sc: Add the "8-bit area" in the upper 256 + bytes of the address space. Put data from the ".eight" sections + into the 8-bit area. + * scripttempl/h8300h.sc: Likewise. + +Tue Apr 9 14:10:42 1996 Doug Evans <dje@canuck.cygnus.com> + + * emultempl/generic.em (gld${EMULATION_NAME}_before_parse): + Pass $ARCH to ldfile_set_output_arch instead of setting + ldfile_output_architecture directly. + +Tue Apr 9 14:22:15 1996 Michael Meissner <meissner@tiktok.cygnus.com> + + * scripttempl/elfppc.sc (.init,.fini): Put .init, .fini section + next to .text. Put _etext after .text, .init, .fini, and + .rodata{,2} sections. + +Tue Apr 9 12:18:57 1996 Ian Lance Taylor <ian@cygnus.com> + + * ld.texinfo: Rearrange option documentation. + + * lexsup.c (ld_options): New static array. + (parse_args): Build shortopts and longopts from ld_options array. + (help): New static function. + * ldver.h (help): Don't declare. + * ldver.c (ldversion): Reindent. + (help): Remove. + + * ld.texinfo, ld.1: Mention -E as a synonym for -export-dynamic. + +Mon Apr 8 11:56:23 1996 Ian Lance Taylor <ian@cygnus.com> + + * emultempl/elf32.em: When checking for a native emulation, check + that the current emulation is the default emulation. + * emultempl/sunos.em: Likewise. + + * configure.in: Permit --enable-shared to specify a list of + directories. + * configure: Rebuild. + + * lexsup.c (parse_args): Add -E as a synonym for -export-dynamic, + for HP/UX compatibility. + +Fri Apr 5 14:30:14 1996 Ian Lance Taylor <ian@cygnus.com> + + * emultempl/elf32.em (gld${EMULATION_NAME}_check_ld_so_conf): New + static function, if ${host} = ${target}. + (gld${EMULATION_NAME}_after_open): Call check_ld_so_conf to find a + needed shared library if ${host} = $[target}. + + * configure.host (i[345]86-*-linux*): Add -dynamic-linker to + HOSTING_CRT0. Search -lgcc both before and after -lc in + HOSTING_LIBS. + + * configure.tgt: Add i[345]86-*-freebsdelf* target; from John + Polstra <jdp@polstra.com>. + +Fri Apr 5 18:11:25 1996 James G. Smith <jsmith@cygnus.co.uk> + + * emulparams/elf32{b,l}4300.sh (MACHINE): Add explicit + architecture number. + * scripttempl/elf.sc: Use $MACHINE definition if present. + * configure.tgt (targ_extra_emuls): Force 4100 build to use same + template as 4300. + +Mon Apr 1 17:35:40 1996 Ian Lance Taylor <ian@cygnus.com> + + * ldlang.c (lang_size_sections): Change region check to handle + regions which end at the highest possible address correctly. + From Roland Weber <roweber@ira.uka.de>. + + * ldlang.c (section_already_linked): New static function. + (wild_doit): Discard sections with SEC_EXCLUDE set if not doing a + relocateable link. Don't worry about section being NULL, since it + never should be. Don't call init_os unless the section is going + to be added. + (ldlang_add_file): Call section_already_linked for each section. + * ldmain.c (multiple_definition): Don't warn about multiple + definitions in sections which are being discarded. + +Sun Mar 31 00:30:47 1996 steve chamberlain <sac@slash.cygnus.com> + + * scripttempl/{ppcpe.sc, pe.sc} (.junk): Remove and use /DISCARD/. + * emultempl/pe.em (init): Remove special case PPC code. + +Fri Mar 29 00:01:29 1996 Jeffrey A Law (law@cygnus.com) + + * scripttempl/h8300.sc: Make vectors section 0xc4 bytes long + so as not to overwrite the magic syscall entry at 0xc4. + * scripttempl/h8300h.sc: Likewise. + +Thu Mar 28 11:05:47 1996 Doug Evans <dje@canuck.cygnus.com> + + * configure.tgt (sparc64-*-solaris2*): Delete. + Stick with sparc-*-solaris2*. + +Wed Mar 27 12:33:24 1996 Ian Lance Taylor <ian@cygnus.com> + + * ld.h (DISCARD_SECTION_NAME): Define to "/DISCARD/". + * ldlang.c (init_os): Fail on an attempt to initialize any section + named DISCARD_SECTION_NAME. + (wild_doit): Discard input sections assigned to an output section + named DISCARD_SECTION_NAME. + * ld.texinfo: Document use of /DISCARD/. + + * ldlang.c: Fix some indentation and comments. + +Tue Mar 26 18:14:49 1996 Ian Lance Taylor <ian@cygnus.com> + + * ldmain.c (main): Call bfd_set_error_program_name. + +Thu Mar 21 13:17:34 1996 Ian Lance Taylor <ian@cygnus.com> + + * ld.texinfo: Fix a couple of indexing entries. Mention that + --verbose displays builtin linker scripts. + + * ldmisc.c (vfinfo): case 'I': If the file is not in an archive, + and the local symbol name does not match the filename, print the + filename as well. + + Patches from John Polstra <jdp@polstra.com> for FreeBSD ELF: + * lexsup.c (parse_args): -Bshareable is a synonym for -shared. + * emulparams/elf_i386.sh (NONPAGED_TEXT_START_ADDR): Make the same + as TEXT_START_ADDR. + +Wed Mar 20 18:18:25 1996 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de> + + * ld.texinfo: Fix typos. Use @pxref only inside parentheses. + +Wed Mar 20 16:56:15 1996 Ian Lance Taylor <ian@cygnus.com> + + * ldmain.c (add_wrap): New function. + * ldmain.h (add_wrap): Declare. + * lexsup.c (parse_args): Call add_wrap. + +Tue Mar 19 16:44:20 1996 Doug Evans <dje@canuck.cygnus.com> + + * configure.host (sparc*-*-solaris2* host): Accept any sparc variant. + +Wed Mar 13 17:47:31 1996 Jeffrey A Law (law@cygnus.com) + + * scripttempl/h8300.sc: Change name of page zero memory + from "null" to "vectors". Create an output section for + vectors. Add comments on how to explicitly place items + in the vector table. + * scripttempl/h8300h.sc: Likewise. + +Wed Mar 13 12:40:18 1996 Ian Lance Taylor <ian@cygnus.com> + + * emultempl/lnk960.em (machine_table): Add jx and hx. + + * genscripts.sh: Don't use ${9:-xx}, since Ultrix /bin/sh doesn't + support it. + +Tue Mar 12 12:43:59 1996 David Mosberger-Tang <davidm@koala.azstarnet.com> + + * ld.h (ld_config_type): Add warn_multiple_gp field. + * lexsup.c (parse_args): Handle --warn-multiple-gp. + * ldmain.c (warning_callback): Suppress multiple gp values warning + if --warn_multiple_gp was not used. + * ld.texinfo, ld.1: Document --warn-multiple-gp. + +Tue Mar 12 12:02:21 1996 Ian Lance Taylor <ian@cygnus.com> + + * lexsup.c (parse_args): Handle --wrap. + * ldmain.c (main): Initialize link_info.wrap_hash. + * ldexp.c (fold_name): Use bfd_wrapped_link_hash_lookup in DEFINED + and NAME cases. + * ld.texinfo, ld.1: Document --wrap. + + * configure: Rebuild with autoconf 2.8. + + Don't do SunOS style dynamic linking for sparc-aout: + * configure.tgt (sparc64-*-aout*): Use sparcaout, not sun4. + (sparclite*-fujitsu-*, sparc*-*-aout): Likewise. + (sparc*-wrs-vxworks*): Likewise. + * emulparams/sparcaout.sh: New file. + * Makefile.in (ALL_EMULATIONS): Add esparcaout.o. + (esparcaout.c): New target. + +Wed Mar 6 16:06:52 1996 J.T. Conklin <jtc@rtl.cygnus.com> + + * scripttempl/elfppc.sc (.sdata2, .sbss2): Implement Feb 2 change + in a different manner to work around differences in shell variable + expansion. + +Wed Mar 6 18:08:18 1996 Ian Lance Taylor <ian@cygnus.com> + + * ldemul.h (ldemul_unrecognized_file): Declare. + (ldemulation_xfer_type): Add unrecognized_file field. + * ldemul.c (ldemul_unrecognized_file): New function. + * ldlang.c (load_symbols): If a file can not be recognized, call + ldemul_unrecognized_file before trying it as a linker script. + * aix.em (gld${EMULATION_NAME}_unrecognized_file): New static + function. + (gld${EMULATION_NAME}_read_file): Use FOPEN_RT, not "r". + (ld_${EMULATION_NAME}_emulation): Initialize unrecognized_file. + +Mon Mar 4 14:11:17 1996 Ian Lance Taylor <ian@cygnus.com> + + * ldlang.c (wild): Handle foo.a(.text) by mapping each included + member of foo.a separately. From Jouke Numan <jnuman@bazis.nl>. + +Fri Mar 1 10:24:59 1996 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de> + + * emultempl/elf32.em (gld${EMULATION_NAME}_find_exp_assignment): + Search trinary.cond rather than searching trinary.lhs twice. + +Tue Feb 27 15:08:43 1996 Stan Shebs <shebs@andros.cygnus.com> + + * mpw-make.sed: Edit out shared library support. + (@TDIRS@): Edit out, can't use genscripts. + +Tue Feb 27 15:09:21 1996 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de> + + * configure.tgt (m68k-*-linuxaout*, m68k-*-linux*): New targets. + * emulparams/m68klinux.sh: New file. + * emultempl/linux.em (gld${EMULATION_NAME}_before_allocation): + Call bfd_${EMULATION_NAME}_size_dynamic_sections instead of + bfd_linux_size_dynamic_sections. + * Makefile.in (ALL_EMULATIONS): Add em68klinux.o. + (em68klinux.c): New target. + * configure.host (m68*-*-linuxaout*, m68*-*-linux*): New hosts. + +Tue Feb 27 12:55:46 1996 Ian Lance Taylor <ian@cygnus.com> + + * Makefile.in (ALL_EMULATIONS): Sort into alphabetical order. + Fill in missing entries. + + * lexsup.c (parse_args): Recognize --no-whole-archive. + * ldlang.h (lang_input_statement_type): Add whole_archive field. + * ldlang.c (new_afile): Set whole_archive field. + (load_symbols): Check input file specific whole_archive field + rather than global variable. + * ld.texinfo, ld.1: Document --no-whole-archive. + +Tue Feb 20 16:07:00 1996 Ian Lance Taylor <ian@cygnus.com> + + * configure.tgt: Correct gldi960 to gld960. + +Mon Feb 19 11:16:44 1996 Ian Lance Taylor <ian@cygnus.com> + + * emultempl/elf32.em (gld${EMULATION_NAME}_check_needed): Check + the SONAME if it is available. + (gld${EMULATION_NAME}_stat_needed): Use the SONAME, not the + filename, when checking for conflicting library versions. Don't + assume that the suffix is only numbers and dots. + + * ld.texinfo: Mention that -R can be used for -rpath. + +Sun Feb 18 15:05:17 1996 Ian Lance Taylor <ian@cygnus.com> + + * configure.host: Check for 'do not mix' from native linker before + trying to use -rpath. + +Thu Feb 15 13:58:06 1996 Ian Lance Taylor <ian@cygnus.com> + + * configure.in: Remove explicit substitution of CFLAGS; autoconf + does it anyhow. + * configure: Rebuild. + * Makefile.in (LDFLAGS): Set to @LDFLAGS@. + + * configure.in: Call AC_PROG_CC before configure.host. + * configure: Rebuild. + * configure.host: Remove go32 host, since it should no longer be + necessary. Don't set CC for romp host. + + * scripttempl/elf.sc: Don't skip a page in virtual memory space if + the text segment ends exactly on a page boundary. + + * configure.in: Substitute RPATH_ENVVAR. + * configure: Rebuild. + * configure.host: Set RPATH_ENVVAR. + * Makefile.in (RPATH_ENVVAR): New variable. + (check): Use $(RPATH_ENVVAR) rather than LD_LIBRARY_PATH. + +Wed Feb 14 18:49:01 1996 Alan Modra <alan@spri.levels.unisa.edu.au> + + * configure.in: Redo emulation handling so that each emulation + searches the correct tool directory, based on the target alias. + For example, "configure --enable-targets=m68k-coff i386-linux" + will search /usr/local/i386-linux/lib for linux and + /usr/local/m68k-coff/lib for m68k-coff. + * configure: Rebuild. + * configure.tgt: Add special tdir settings for Linux. + * Makefile.in: Add @TDIRS@. Pass "$(tdir_EMUL)" to ${GENSCRIPTS} + for each eEMUL.c target. + * genscripts.sh: Accept specific alias as 9th argument, and use it + in LIB_PATH. + +Wed Feb 14 16:38:36 1996 Martin Anantharaman <martin@mail.imech.uni-duisburg.de> + + * ldlang.c (lang_set_startof): Don't do anything for a + relocateable link. + + * ldgram.y (mri_script_file): Call mri_draw_tree. + * mri.c (mri_draw_tree): Make globally visible. Don't bother to + create memory regions. + (mri_load): Don't call mri_draw_tree. + * mri.h (mri_draw_tree): Declare. + + * configure.tgt (m68*-*-psos): New target. + * emulparams/m68kpsos.sh: New file. + * scripttempl/psos.sc: New file. + * Makefile.in (ALL_EMULATIONS): Add em68kpsos.o. + (em68kpsos.c): New target. + +Wed Feb 14 11:09:25 1996 Ian Lance Taylor <ian@cygnus.com> + + * configure.tgt (*-*-ieee*): New target; use vanilla. + + * emultempl/elf32.em (gld${EMULATION_NAME}_before_parse): Strip + `:foo' from ${ARCH}. + +Tue Feb 13 15:58:58 1996 Bryan Ford <baford@snake.cs.utah.edu> + + * scripttempl/i386msdos.sc: Don't pad the .text section. Put + .rodata in .data. + +Tue Feb 13 14:04:19 1996 Ian Lance Taylor <ian@cygnus.com> + + * configure.host: Set HDLFLAGS for *-*-hpux with --enable-shared. + + * emultempl/elf32.em (gld${EMULATION_NAME}_stat_needed): Warn if + it looks like we might be linking in two different versions of the + same shared library. Based on a patch from H J Lu <hjl@zoom.com>. + +Thu Feb 8 19:25:54 1996 Ian Lance Taylor <ian@cygnus.com> + + * ldlang.c (lang_size_sections): Increment the section size when a + padding statement is encountered. + +Wed Feb 7 14:01:33 1996 Ian Lance Taylor <ian@cygnus.com> + + * configure.in: Look for --enable-shared. Change the value of + BFDLIB when linking against a shared library on SunOS. + * configure: Rebuild. + * configure.host: If using a shared BFD library, try to pass a + reasonable -rpath option when linking. + * Makefile.in (BFDLIB): Set to @BFDLIB@. + +Tue Feb 6 12:29:14 1996 Doug Evans <dje@charmed.cygnus.com> + + * emulparams/elf64_sparc.sh (ARCH): Change to `sparc:v9'. + * emultempl/generic.em: Strip `:foo' from ${ARCH}. + +Mon Feb 5 16:25:30 1996 Ian Lance Taylor <ian@cygnus.com> + + Support for building bfd and opcodes as shared libraries, based on + patches from Alan Modra <alan@spri.levels.unisa.edu.au>: + * configure.in (HLDFLAGS): New substitution. + * configure: Rebuild. + * configure.host: Set HLDFLAGS on SunOS. + * Makefile.in (HLDFLAGS): New variable. + (BFDDEP): New variable. + (BFDLIB): Change to -L../bfd -lbfd. + ($(LD_PROG)): Depend upon $(BFDDEP) rathern than $(BFDLIB). Use + $(HLDFLAGS) in link. + (check): Set LD_LIBRARY_PATH in the environment. + +Fri Feb 2 19:26:25 1996 Michael Meissner <meissner@wogglebug.tiac.net> + + * scripttempl/elfppc.sc (.sdata2, .sbss2): Put .sdata2 and .sbss + in the read-only section, not read/write unless we are making a + shared library. + (.debug*): Add dwarf debug sections. + (.rela.{sdata*,sbss*}): Add sections. + +Fri Feb 2 16:50:21 1996 Ian Lance Taylor <ian@cygnus.com> + + * configure: Regenerate. + +Thu Feb 1 10:50:46 1996 Ian Lance Taylor <ian@cygnus.com> + + * emulparams/elf_i386.sh (TEXT_START_ADDR): Change to 0x8048000, + for SVR4 compatibility. + + * ldexp.c (exp_fold_tree): Correct handling of ABSOLUTE. + +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. + * emulparams/m68kaux.sh: New file. + * scripttempl/m68kaux.sc: New file. + * Makefile.in (ALL_EMULATIONS): Add em68kaux.o. + (em68kaux.c): New target. + +Tue Jan 30 13:18:56 1996 Ian Lance Taylor <ian@cygnus.com> + + * emultempl/aix.em (gld${EMULATION_NAME}_parse_args): Ignore + -bnoentry, since the right thing tends to happen anyhow. + +Mon Jan 29 12:29:26 1996 Ian Lance Taylor <ian@cygnus.com> + + * ld.texinfo, ld.1: Document -export-dynamic. + +Fri Jan 26 11:11:55 1996 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de> + + * emultempl/sunos.em: Check for native compile by comparing + ${target} and ${host}. + +Thu Jan 25 16:46:58 1996 James G. Smith <jsmith@cygnus.co.uk> + + * emulparams/{elf32b4300.sh, elf32l4300.sh}: Changed + TEXT_START_ADDR to allow use on IDT and PMON systems. + +Wed Jan 24 20:59:40 1996 Steve Chamberlain <sac@slash.cygnus.com> + + * emultempl/pe.em (gld_${EMULATION_NAME}_parse_args): + correct spelling. + +Wed Jan 24 16:59:19 1996 Doug Evans <dje@charmed.cygnus.com> + + * configure.tgt (sparc64-*-solaris2*): New configuration. + (sparc64-*-aout*): Renamed from sparc64*. + +Mon Jan 22 13:01:35 1996 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de> + + * Makefile.in (GENSCRIPTS): Pass @host@ @target@ @target_alias@. + * genscripts.sh: Set host, target and target_alias variables. + Check for native compile by comparing ${target} and ${host}. + * emultempl/elf32.em: Likewise. + * scripttempl/elfmips.sc: Test ${target}, not ${target_alias}. + +Mon Jan 22 11:03:23 1996 Michael Meissner <meissner@tiktok.cygnus.com> + + * scripttempl/elfppc.sc: Refine eabi support to better support + .sdata, .sdata2, .sbss, etc. sections. + +Tue Jan 16 15:16:58 1996 Ian Lance Taylor <ian@cygnus.com> + + * ldgram.y (%union): Add phdr field. + (phdr): Use phdr_qualifiers rather than opt_hdrs and opt_at. + (phdr_qualifiers): New nonterminal. Add support for FLAGS. + (opt_hdrs, hdr): Remove. + (phdr_val): New nonterminal. + * ldlang.c (lang_new_phdr): Replace hdrs parameter with filehdr + and phdrs parameters. Add flags parameter. + (lang_record_phdrs): Update for changes to lang_phdr. Pass flags + to bfd_record_phdr. + * ldlang.h (struct lang_phdr): Replace hdrs field with filehdr and + phdrs fields. Add flags field. + (LANG_PHDR_FILEHDR, LANG_PHDR_PHDRS): Remove. + (lang_new_phdr): Update declaration. + * ld.texinfo: Document FLAGS. + +Mon Jan 15 15:07:19 1996 Ian Lance Taylor <ian@cygnus.com> + + * emultempl/sunos.em (gld${EMULATION_NAME}_before_allocation): + Don't make a shared library because of an undefined reference to + __GLOBAL_OFFSET_TABLE_. + + Add some Irix 5 support, mostly from Kazumoto Kojima + <kkojima@info.kanagawa-u.ac.jp>: + * emulparams/elf32bmip.sh (SCRIPT_NAME): Change to elfmips. + (SHLIB_TEXT_START_ADDR): Define. + (OTHER_GOT_SYMBOLS): Define. + (OTHER_READWRITE_SECTIONS): Remove initialization of _gp. + (EXECUTABLE_SYMBOLS): Don't define. + (DYNAMIC_LINK): Don't define. + * emulparams/elf32lmip.sh: Same changes as elf32bmip.sh. + * scripttempl/elfmips.sc: New file. + * configure.host (mips*-dec-bsd*): Change mips to mips*. + (mips*-sgi-irix4*): Likewise. + (mips*-sgi-irix5*): New entry. + * Makefile.in (eelf32bmip.c): Depend upon elfmips.sc rather than + elf.sc. + (eelf32lmip.c): Likewise. + +Sat Jan 13 09:41:43 1996 Michael Meissner <meissner@tiktok.cygnus.com> + + * scripttempl/elfppc.sc: Remove support for .rel.* sections. Add + .rela.got.neg section. + +Fri Jan 12 14:56:19 1996 Ian Lance Taylor <ian@cygnus.com> + + * scripttempl/sh.sc: Only build constructors when CONSTRUCTING. + + * ldmisc.c: Include <stdarg.h> rather than <varargs.h> if + ANSI_PROTOTYPES is defined. Remove special handling of + WINDOWS_NT. Various indendation fixes. + (vfinfo): Change fmt parameter to const char *. + (info_msg): Write <stdarg.h> version. + (einfo, minfo, finfo): Likewise. + (info_assert): Change file parameter to const char *. + * ldmisc.h (einfo, minfo, info_msg): If ANSI_PROTOTYPES is + defined, use a real prototype. + (info_assert): Change first parameter to be const char *. + +Fri Jan 12 13:29:55 1996 Michael Meissner <meissner@tiktok.cygnus.com> + + * scripttempl/elfppc.sc: Add support for .sdata2/.sbss2, etc. Add + in old support that 2.7.2 needs, but the current compiler does + not. + + * Makefile.in (eelf32{,l}ppc.c): Fix up dependencies to use the + correct Linker script template. + + * emulparams/elf32{,l}ppc.sh (TEXT_START_ADDR): Set to 0x40000, + not 0x400000. + (DATA_ADDR,NONPAGED_TEXT_START_ADDR): Delete. + +Tue Jan 9 15:53:02 1996 Ian Lance Taylor <ian@cygnus.com> + + * scripttempl/alpha.sc: Put .rconst right after .rdata. + +Fri Jan 5 14:07:45 1996 Steve Chamberlain <sac@slash.cygnus.com> + + * emultempl/pe.em (gld_${EMULATION_NAME}_before_allocation): + sort using right pointer. + +Fri Jan 5 12:25:47 1996 Michael Meissner <meissner@tiktok.cygnus.com> + + * scripttempl/elfppc.sc: Remove support for creating special + labels for eabi section begin/end here. The compiler now uses + crt{i,n}.o to create these symbols. + +Thu Jan 4 17:08:58 1996 Ian Lance Taylor <ian@cygnus.com> + + * configure.host: Change existing Linux HOSTING_CRT0 to be used + for a.out only, and put in appropriate HOSTING_CRT0 and + HOSTING_LIBS values for Linux ELF. + +Thu Jan 4 12:02:05 1996 Doug Evans <dje@canuck.cygnus.com> + + * scripttempl/h8300.sc: Use all 64K for ram. + * scripttempl/h8300h.sc: Define 256K ram size. + +Thu Dec 21 15:57:18 1995 Ian Lance Taylor <ian@cygnus.com> + + * emultempl/aix.em (gld${EMULATION_NAME}_before_allocation): Pass + export_defines as true to bfd_xcoff_size_dynamic_sections if -unix + was used, regardless of whether -bE was used. + +Tue Dec 19 17:35:38 1995 Ian Lance Taylor <ian@cygnus.com> + + * emultempl/aix.em (gld${EMULATION_NAME}_after_open): Only set + relocateable before calling ldctor_build_sets if the output file + is in an XCOFF format. + +Fri Dec 15 16:34:36 1995 Ian Lance Taylor <ian@cygnus.com> + + * ldwrite.c (build_link_order): When handling a data statement, if + the endianness of the output file is unknown, use the endianness + of the input file. + +Tue Dec 12 13:55:41 1995 Stan Shebs <shebs@andros.cygnus.com> + + * mpw-config.in: Recognize mips-*-* as equivalent to + mips-idt-ecoff. + * mpw-eppcmacos.c: Rename to shorter mpw-eppcmac.c. + * mpw-ld.r: Add version resources. + (cfrg): Use symbolic instead of literal name for executable. + +Mon Dec 11 15:13:41 1995 Kim Knuttila <krk@cygnus.com> + + * scripttempl/ppcpe.sc (FINI): Moved the .reloc section. + +Wed Dec 6 14:33:50 1995 Doug Evans <dje@canuck.cygnus.com> + + * ldlang.c (print_statement{,s}): Delete duplicate prototype. + (print_statement_list): Renamed from print_statement. All callers + updated. + (print_statement): New function to print just one statement. + (print_{data,reloc,padding}_statement): Don't crash if + output_section == NULL. + (dprint_statement): New function. + + * emultempl/pe.em (gld_${EMULATION_NAME}_before_allocation): Fix + call to sort_sections. + +Wed Dec 6 14:59:06 1995 Ian Lance Taylor <ian@cygnus.com> + + * emultempl/aix.em (unix_ld): New static variable. + (gld${EMULATION_NAME}_parse_args): Handle -unix. + (gld${EMULATION_NAME}_before_allocation): If unix_ld, pass + gc as false and export_defineds as true to size_dynamic_sections. + + * ldexp.c (exp_fold_tree): Permit assignments to dot in the final + phase if the current section is abs_output_section. + + +Tue Dec 5 09:49:39 1995 Doug Evans <dje@canuck.cygnus.com> + + * emultempl/pe.em (gld_${EMULATION_NAME}_before_allocation): Fix call + to sort_sections. + +Fri Dec 1 16:48:36 1995 Ian Lance Taylor <ian@cygnus.com> + + * ldgram.y (PHDRS): New token. + (ifile_p1): Accept phdrs. + (section): Accept phdr_opt at the end of the section definition. + (phdr_op): New nonterminal. + (phdrs, phdr_list, phdr, phdr_type, opt_hdrs, hdr): Likewise. + * ldlex.l: Accept PHDRS. + * ldlang.h (struct lang_output_section_phdr_list): Define. + (lang_output_section_statement_type): Add phdrs field. + (struct lang_phdr): Define. + (LANG_PHDR_FILEHDR, LANG_PHDR_PHDRS): Define. + (lang_new_phdr): Declare. + * ldlang.c (lang_phdr_list): New static variable. + (lang_output_section_statement_lookup): Initialize phdrs field. + (lang_process): Call lang_record_phdrs. + (lang_new_phdr): New function. + (lang_section_in_phdr): New function. + (lang_record_phdrs): New static function. + * ld.texinfo: Document PHDRS. + +Thu Nov 30 13:14:30 1995 Kim Knuttila <krk@cygnus.com> + + * scripttempl/ppcpe.sc: Moved .edata into its own section to + expose it. + +Thu Nov 30 11:32:34 1995 Manfred Hollstein KS/EF4A 60/1F/110 #40283 <manfred@lts.sel.alcatel.de> + + * configure.host (m68*-motorola-sysv): Define HOSTING_CRT0 and + HOSTING_LIBS for testing. + (m88*-motorola-sysv3): Define HOSTING_CRT0 and HOSTING_LIBS for + testing. + +Tue Nov 28 12:14:53 1995 Ian Lance Taylor <ian@cygnus.com> + + * lexsup.c (parse_args): Set config.dynamic_link to false for -N + and -n. + +Mon Nov 27 13:12:09 1995 Ian Lance Taylor <ian@cygnus.com> + + * configure: Rebuild with autoconf 2.7. + +Fri Nov 24 18:35:35 1995 Doug Evans <dje@canuck.cygnus.com> + + * scripttempl/pe.sc: Two .junk's is too much junk. + +Tue Nov 21 16:14:32 1995 Ian Lance Taylor <ian@cygnus.com> + + * configure.in: Use BFD_NEED_DECLARATION. + * acconfig.h: Put NEED_DECLARATION_FREE in @TOP@ section. + * configure, config.in: Rebuild with autoconf 2.6. + + * ldmain.c (constructor_callback): Don't warn about BFD_RELOC_CTOR + being unsupported if this is not a relocateable link and the input + BFD supports it, since ldctor_build_sets can cope with that case. + +Fri Nov 17 16:23:15 1995 Stan Shebs <shebs@andros.cygnus.com> + + * configure.tgt (powerpc-*-macos*): New target. + * emulparams/ppcmacos.sh: New file, PowerMac emulation. + * Makefile.in (ALL_EMULATIONS): Add eppcmacos.o. + (eppcmacos.c): New target. + * mpw-eppcmacos.c: Update. + * mpw-make.sed: Edit out attempts to use {GENSCRIPTS}. + +Fri Nov 17 10:37:27 1995 Ian Lance Taylor <ian@cygnus.com> + + * Makefile.in (CC_FOR_TARGET): Use @host@ and @target@, not + $(host_canonical) and $(target_canonical). + (CXX_FOR_TARGET): Likewise. + +Thu Nov 16 11:23:42 1995 Doug Evans <dje@canuck.cygnus.com> + + * scripttempl/pe.sc (.endjunk): Move definition of `end' to here + so the malloc heap begins at a sane place. + Thu Nov 16 03:09:32 1995 Ken Raeburn <raeburn@cygnus.com> Version 2.6 released. - * ldver.c (ldversion): Updated to 2.6. + * ldver.c (ldversion): Update to 2.6. * Makefile.in (mostlyclean): Delete ldemul-list.h here, but not $(GENERATED_*FILES), since they need to be retained by distclean. @@ -139,7 +1070,7 @@ Fri Oct 27 18:03:17 1995 Niklas Hallqvist <niklas@appli.se> hp300bsd,hp3hpux,hppaelf.sh,i386aout,i386bsd,i386coff,i386go32, i386linux,i386lynx,i386nbsd,lnk960,m68kaout,m68kcoff,m68klynx, m88kbcs,mipsbig,mipsbsd,mipsidt,mipsidtl,mipslit,news,ns32knbsd, - pc532machaout,rce,riscix,sa29200,sh,shl,sparclynx,sparcnbsd, + pc532machaout,riscix,sa29200,sh,shl,sparclynx,sparcnbsd, st2000,sun3,sun4,vanilla,vax,vsta,w65,z8001,z8002}.sh: Changed PAGE_SIZE to TARGET_PAGE_SIZE. diff --git a/gnu/usr.bin/binutils/ld/Makefile.in b/gnu/usr.bin/binutils/ld/Makefile.in index 175752de119..d08afa99f95 100644 --- a/gnu/usr.bin/binutils/ld/Makefile.in +++ b/gnu/usr.bin/binutils/ld/Makefile.in @@ -1,5 +1,6 @@ # Makefile for the GNU linker ld (version 2) -# Copyright (C) 1989, 90, 91, 92, 93, 1994 Free Software Foundation, Inc. +# Copyright (C) 1989, 90, 91, 92, 93, 94, 95, 1996 +# Free Software Foundation, Inc. # This file is part of GNU ld. @@ -61,6 +62,9 @@ AR = ar AR_FLAGS = qv CC = @CC@ CFLAGS = @CFLAGS@ +LDFLAGS = @LDFLAGS@ +HLDFLAGS = @HLDFLAGS@ +RPATH_ENVVAR = @RPATH_ENVVAR@ MAKEINFO = makeinfo TEXI2DVI = texi2dvi RANLIB = ranlib @@ -70,7 +74,7 @@ LEX = `if [ -f ../flex/flex ] ; then echo ../flex/flex ; else echo flex ; fi` EMUL = @EMUL@ EMULATION_OFILES = @EMULATION_OFILES@ -# Seach path to override the default search path for -lfoo libraries. +# Search path to override the default search path for -lfoo libraries. # If LIB_PATH is empty, the ones in the script (if any) are left alone. # (The default is usually /lib:/usr/lib:/usr/local/lib, unless building # a cross-linker, in which case the default is empty. See genscripts.sh.) @@ -138,7 +142,7 @@ CC_FOR_TARGET = ` \ echo $$r/../gcc/xgcc -B$$r/../gcc/; \ fi; \ else \ - if [ "$(host_canonical)" = "$(target_canonical)" ] ; then \ + if [ "@host@" = "@target@" ] ; then \ echo $(CC); \ else \ echo gcc | sed '$(program_transform_name)'; \ @@ -154,7 +158,7 @@ CXX_FOR_TARGET = ` \ echo $$r/../gcc/xgcc -B$$r/../gcc/; \ fi; \ else \ - if [ "$(host_canonical)" = "$(target_canonical)" ] ; then \ + if [ "@host@" = "@target@" ] ; then \ echo $(CXX); \ else \ echo gcc | sed '$(program_transform_name)'; \ @@ -186,28 +190,98 @@ ALL_CFLAGS = $(INCLUDES) @HDEFINES@ $(CFLAGS) .c.o: $(CC) -c $(ALL_CFLAGS) $< -# for self hosting -BFDLIB = ../bfd/libbfd.a +BFDDEP = ../bfd/libbfd.a +BFDLIB = @BFDLIB@ LIBIBERTY = ../libiberty/libiberty.a -ALL_EMULATIONS = ea29k.o ealpha.o earmaoutl.o earmaoutb.o \ - ecoff_sparc.o eebmon29k.o \ - eelf32_sparc.o eelf32bmip.o eelf32lmip.o eelf32ppc.o eelf32lppc.o \ - eelf64_sparc.o eelf_i386.o egld960.o ego32.o eh8300.o \ - eh8300h.o eh8500.o eh8500b.o eh8500c.o eh8500m.o eh8500s.o \ - ehp300bsd.o ehp3hpux.o ehppaelf.o ei386aout.o ei386bsd.o \ - ei386coff.o ei386go32.o ei386linux.o ei386lynx.o ei386mach.o \ - ei386nbsd.o ei386nw.o elnk960.o em68k4knbsd.o em68kaout.o em68kcoff.o \ - em68kelf.o em68klynx.o em68knbsd.o em88kbcs.o emipsbig.o emipsbsd.o \ - emipsidt.o emipsidtl.o emipslit.o enews.o ens32knbsd.o eppcnw.o \ - eriscix.o esa29200.o eshl.o esh.o esparclynx.o esparcnbsd.o \ - est2000.o esun3.o esun4.o evanilla.o evax.o evsta.o \ - ez8001.o ez8002.o ei386pe.o earmpe.o eelf32b4300.o eelf32l4300.o \ - eaixppc.o eaixrs6.o edelta68.o eppcpe.o +ALL_EMULATIONS = \ + ea29k.o \ + eaixppc.o \ + eaixrs6.o \ + ealpha.o \ + earmaoutb.o \ + earmaoutl.o \ + earmcoff.o \ + earmpe.o \ + ecoff_sparc.o \ + edelta68.o \ + eebmon29k.o \ + eelf32_sparc.o \ + eelf32b4300.o \ + eelf32bmip.o \ + eelf32l4300.o \ + eelf32lmip.o \ + eelf32lppc.o \ + eelf32ppc.o \ + eelf64_sparc.o \ + eelf_i386.o \ + egld960.o \ + egld960coff.o \ + ego32.o \ + eh8300.o \ + eh8300h.o \ + eh8500.o \ + eh8500b.o \ + eh8500c.o \ + eh8500m.o \ + eh8500s.o \ + ehp300bsd.o \ + ehp3hpux.o \ + ehppaelf.o \ + ei386aout.o \ + ei386bsd.o \ + ei386coff.o \ + ei386go32.o \ + ei386linux.o \ + ei386lynx.o \ + ei386mach.o \ + ei386moss.o \ + ei386msdos.o \ + ei386nbsd.o \ + ei386nw.o \ + ei386pe.o \ + elnk960.o \ + em68k4knbsd.o \ + em68kaout.o \ + em68kaux.o \ + em68kcoff.o \ + em68kelf.o \ + em68klinux.o \ + em68klynx.o \ + em68knbsd.o \ + em68kpsos.o \ + em88kbcs.o \ + emipsbig.o \ + emipsbsd.o \ + emipsidt.o \ + emipsidtl.o \ + emipslit.o \ + enews.o \ + ens32knbsd.o \ + epc532machaout.o \ + eppcmacos.o \ + eppcnw.o \ + eppcpe.o \ + eriscix.o \ + esa29200.o \ + esh.o \ + eshl.o \ + esparcaout.o \ + esparclynx.o \ + esparcnbsd.o \ + est2000.o \ + esun3.o \ + esun4.o \ + evanilla.o \ + evax.o \ + evsta.o \ + ew65.o \ + ez8001.o \ + ez8002.o CFILES = ldctor.c ldemul.c ldexp.c ldfile.c ldlang.c \ ldmain.c ldmisc.c ldver.c ldwrite.c lexsup.c \ - mri.c + mri.c ldcref.c HFILES = config.h ld.h ldctor.h ldemul.h ldexp.h ldfile.h \ ldlang.h ldlex.h ldmain.h ldmisc.h ldver.h \ @@ -218,7 +292,7 @@ GENERATED_HFILES = ldgram.h ldemul-list.h OFILES = ldgram.o ldlex.o lexsup.o ldlang.o mri.o ldctor.o ldmain.o \ ldwrite.o ldexp.o ldemul.o ldver.o ldmisc.o \ - ldfile.o ${EMULATION_OFILES} + ldfile.o ldcref.o ${EMULATION_OFILES} LINTSOURCES = $(CFILES) $(GENERATED_CFILES) e*.c @@ -265,135 +339,178 @@ ldlex.c: ldlex.l # These all start with e so 'make clean' can find them. -GENSCRIPTS = $(SHELL) $(srcdir)/genscripts.sh ${srcdir} ${libdir} @host_alias@ @target_alias@ ${EMUL} "@NATIVE_LIB_DIRS@" +GENSCRIPTS = $(SHELL) $(srcdir)/genscripts.sh ${srcdir} ${libdir} @host@ @target@ @target_alias@ ${EMUL} "@NATIVE_LIB_DIRS@" GEN_DEPENDS = $(srcdir)/genscripts.sh $(srcdir)/emultempl/stringify.sed +@TDIRS@ -esun4.c: $(srcdir)/emulparams/sun4.sh \ - $(srcdir)/emultempl/sunos.em $(srcdir)/scripttempl/aout.sc ${GEN_DEPENDS} - ${GENSCRIPTS} sun4 -esun3.c: $(srcdir)/emulparams/sun3.sh \ - $(srcdir)/emultempl/sunos.em $(srcdir)/scripttempl/aout.sc ${GEN_DEPENDS} - ${GENSCRIPTS} sun3 +ea29k.c: $(srcdir)/emulparams/a29k.sh \ + $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/a29k.sc ${GEN_DEPENDS} + ${GENSCRIPTS} a29k "$(tdir_a29k)" +eaixppc.c: $(srcdir)/emulparams/aixppc.sh \ + $(srcdir)/emultempl/aix.em $(srcdir)/scripttempl/aix.sc ${GEN_DEPENDS} + ${GENSCRIPTS} aixppc "$(tdir_aixppc)" +eaixrs6.c: $(srcdir)/emulparams/aixrs6.sh \ + $(srcdir)/emultempl/aix.em $(srcdir)/scripttempl/aix.sc ${GEN_DEPENDS} + ${GENSCRIPTS} aixrs6 "$(tdir_aixrs6)" +ealpha.c: $(srcdir)/emulparams/alpha.sh \ + $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/alpha.sc ${GEN_DEPENDS} + ${GENSCRIPTS} alpha "$(tdir_alpha)" +earmaoutb.c: $(srcdir)/emulparams/armaoutb.sh \ + $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/armaout.sc ${GEN_DEPENDS} + ${GENSCRIPTS} armaoutb "$(tdir_armaoutb)" +earmaoutl.c: $(srcdir)/emulparams/armaoutl.sh \ + $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/armaout.sc ${GEN_DEPENDS} + ${GENSCRIPTS} armaoutl "$(tdir_armaoutl)" +earmcoff.c: $(srcdir)/emulparams/armcoff.sh \ + $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/armcoff.sc ${GEN_DEPENDS} + ${GENSCRIPTS} armcoff "$(tdir_armcoff)" earmpe.c: $(srcdir)/emulparams/armpe.sh \ $(srcdir)/emultempl/pe.em $(srcdir)/scripttempl/pe.sc ${GEN_DEPENDS} - ${GENSCRIPTS} armpe -evsta.c: $(srcdir)/emulparams/vsta.sh \ - $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/aout.sc ${GEN_DEPENDS} - ${GENSCRIPTS} vsta + ${GENSCRIPTS} armpe "$(tdir_armpe)" +ecoff_sparc.c: $(srcdir)/emulparams/coff_sparc.sh \ + $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/sparccoff.sc ${GEN_DEPENDS} + ${GENSCRIPTS} coff_sparc "$(tdir_coff_sparc)" +edelta68.c: $(srcdir)/emulparams/delta68.sh \ + $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/delta68.sc ${GEN_DEPENDS} + ${GENSCRIPTS} delta68 "$(tdir_delta68)" +eebmon29k.c: $(srcdir)/emulparams/ebmon29k.sh \ + $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/ebmon29k.sc ${GEN_DEPENDS} + ${GENSCRIPTS} ebmon29k "$(tdir_ebmon29k)" +eelf32_sparc.c: $(srcdir)/emulparams/elf32_sparc.sh \ + $(srcdir)/emultempl/elf32.em $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS} + ${GENSCRIPTS} elf32_sparc "$(tdir_elf32_sparc)" +eelf32b4300.c: $(srcdir)/emulparams/elf32b4300.sh \ + $(srcdir)/emultempl/elf32.em $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS} + ${GENSCRIPTS} elf32b4300 "$(tdir_elf32b4300)" +eelf32bmip.c: $(srcdir)/emulparams/elf32bmip.sh \ + $(srcdir)/emultempl/elf32.em $(srcdir)/scripttempl/elfmips.sc ${GEN_DEPENDS} + ${GENSCRIPTS} elf32bmip "$(tdir_elf32bmip)" +eelf32l4300.c: $(srcdir)/emulparams/elf32l4300.sh \ + $(srcdir)/emultempl/elf32.em $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS} + ${GENSCRIPTS} elf32l4300 "$(tdir_elf32l4300)" +eelf32lmip.c: $(srcdir)/emulparams/elf32lmip.sh \ + $(srcdir)/emultempl/elf32.em $(srcdir)/scripttempl/elfmips.sc ${GEN_DEPENDS} + ${GENSCRIPTS} elf32lmip "$(tdir_elf32lmip)" +eelf32lppc.c: $(srcdir)/emulparams/elf32lppc.sh \ + $(srcdir)/emultempl/elf32.em $(srcdir)/scripttempl/elfppc.sc ${GEN_DEPENDS} + ${GENSCRIPTS} elf32lppc "$(tdir_elf32lppc)" +eelf32ppc.c: $(srcdir)/emulparams/elf32ppc.sh \ + $(srcdir)/emultempl/elf32.em $(srcdir)/scripttempl/elfppc.sc ${GEN_DEPENDS} + ${GENSCRIPTS} elf32ppc "$(tdir_elf32ppc)" +eelf64_sparc.c: $(srcdir)/emulparams/elf64_sparc.sh \ + $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS} + ${GENSCRIPTS} elf64_sparc "$(tdir_elf64_sparc)" +eelf_i386.c: $(srcdir)/emulparams/elf_i386.sh \ + $(srcdir)/emultempl/elf32.em $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS} + ${GENSCRIPTS} elf_i386 "$(tdir_elf_i386)" +egld960.c: $(srcdir)/emulparams/gld960.sh \ + $(srcdir)/emultempl/gld960.em $(srcdir)/scripttempl/i960.sc ${GEN_DEPENDS} + ${GENSCRIPTS} gld960 "$(tdir_gld960)" +egld960coff.c: $(srcdir)/emulparams/gld960coff.sh \ + $(srcdir)/emultempl/gld960c.em $(srcdir)/scripttempl/i960.sc ${GEN_DEPENDS} + ${GENSCRIPTS} gld960coff "$(tdir_gld960coff)" ego32.c: $(srcdir)/emulparams/go32.sh \ $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/aout.sc ${GEN_DEPENDS} - ${GENSCRIPTS} go32 -enews.c: $(srcdir)/emulparams/news.sh \ - $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/aout.sc ${GEN_DEPENDS} - ${GENSCRIPTS} news -evax.c: $(srcdir)/emulparams/vax.sh \ - $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/aout.sc ${GEN_DEPENDS} - ${GENSCRIPTS} vax + ${GENSCRIPTS} go32 "$(tdir_go32)" +eh8300.c: $(srcdir)/emulparams/h8300.sh \ + $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/h8300.sc ${GEN_DEPENDS} + ${GENSCRIPTS} h8300 "$(tdir_h8300)" +eh8300h.c: $(srcdir)/emulparams/h8300h.sh \ + $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/h8300h.sc ${GEN_DEPENDS} + ${GENSCRIPTS} h8300h "$(tdir_h8300h)" +eh8500.c: $(srcdir)/emulparams/h8500.sh \ + $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/h8500.sc ${GEN_DEPENDS} + ${GENSCRIPTS} h8500 "$(tdir_h8500)" +eh8500b.c: $(srcdir)/emulparams/h8500b.sh \ + $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/h8500b.sc ${GEN_DEPENDS} + ${GENSCRIPTS} h8500b "$(tdir_h8500b)" +eh8500c.c: $(srcdir)/emulparams/h8500c.sh \ + $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/h8500c.sc ${GEN_DEPENDS} + ${GENSCRIPTS} h8500c "$(tdir_h8500c)" +eh8500m.c: $(srcdir)/emulparams/h8500m.sh \ + $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/h8500m.sc ${GEN_DEPENDS} + ${GENSCRIPTS} h8500m "$(tdir_h8500m)" +eh8500s.c: $(srcdir)/emulparams/h8500s.sh \ + $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/h8500s.sc ${GEN_DEPENDS} + ${GENSCRIPTS} h8500s "$(tdir_h8500s)" ehp300bsd.c: $(srcdir)/emulparams/hp300bsd.sh \ $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/aout.sc ${GEN_DEPENDS} - ${GENSCRIPTS} hp300bsd + ${GENSCRIPTS} hp300bsd "$(tdir_hp300bsd)" ehp3hpux.c: $(srcdir)/emulparams/hp3hpux.sh \ $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/aout.sc ${GEN_DEPENDS} - ${GENSCRIPTS} hp3hpux -ei386pe.c: $(srcdir)/emulparams/i386pe.sh \ - $(srcdir)/emultempl/pe.em $(srcdir)/scripttempl/pe.sc ${GEN_DEPENDS} - ${GENSCRIPTS} i386pe -eppcpe.c: $(srcdir)/emulparams/ppcpe.sh \ - $(srcdir)/emultempl/pe.em $(srcdir)/scripttempl/ppcpe.sc ${GEN_DEPENDS} - ${GENSCRIPTS} ppcpe + ${GENSCRIPTS} hp3hpux "$(tdir_hp3hpux)" ehppaelf.c: $(srcdir)/emulparams/hppaelf.sh \ $(srcdir)/emultempl/hppaelf.em $(srcdir)/scripttempl/hppaelf.sc ${GEN_DEPENDS} - ${GENSCRIPTS} hppaelf + ${GENSCRIPTS} hppaelf "$(tdir_hppaelf)" ei386aout.c: $(srcdir)/emulparams/i386aout.sh \ $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/aout.sc ${GEN_DEPENDS} - ${GENSCRIPTS} i386aout + ${GENSCRIPTS} i386aout "$(tdir_i386aout)" +ei386bsd.c: $(srcdir)/emulparams/i386bsd.sh \ + $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/aout.sc ${GEN_DEPENDS} + ${GENSCRIPTS} i386bsd "$(tdir_i386bsd)" +ei386coff.c: $(srcdir)/emulparams/i386coff.sh \ + $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/i386coff.sc ${GEN_DEPENDS} + ${GENSCRIPTS} i386coff "$(tdir_i386coff)" ei386go32.c: $(srcdir)/emulparams/i386go32.sh \ $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/i386go32.sc ${GEN_DEPENDS} - ${GENSCRIPTS} i386go32 + ${GENSCRIPTS} i386go32 "$(tdir_i386go32)" +ei386linux.c: $(srcdir)/emulparams/i386linux.sh \ + $(srcdir)/emultempl/linux.em $(srcdir)/scripttempl/aout.sc ${GEN_DEPENDS} + ${GENSCRIPTS} i386linux "$(tdir_i386linux)" +ei386lynx.c: $(srcdir)/emulparams/i386lynx.sh \ + $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/i386lynx.sc ${GEN_DEPENDS} + ${GENSCRIPTS} i386lynx "$(tdir_i386lynx)" ei386mach.c: $(srcdir)/emulparams/i386mach.sh \ $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/aout.sc ${GEN_DEPENDS} - ${GENSCRIPTS} i386mach + ${GENSCRIPTS} i386mach "$(tdir_i386mach)" ei386moss.c: $(srcdir)/emulparams/i386moss.sh \ $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS} - ${GENSCRIPTS} i386moss + ${GENSCRIPTS} i386moss "$(tdir_i386moss)" ei386msdos.c: $(srcdir)/emulparams/i386msdos.sh \ $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/i386msdos.sc ${GEN_DEPENDS} - ${GENSCRIPTS} i386msdos -eebmon29k.c: $(srcdir)/emulparams/ebmon29k.sh \ - $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/ebmon29k.sc ${GEN_DEPENDS} - ${GENSCRIPTS} ebmon29k -esa29200.c: $(srcdir)/emulparams/sa29200.sh \ - $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/sa29200.sc ${GEN_DEPENDS} - ${GENSCRIPTS} sa29200 -ea29k.c: $(srcdir)/emulparams/a29k.sh \ - $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/a29k.sc ${GEN_DEPENDS} - ${GENSCRIPTS} a29k -em88kbcs.c: $(srcdir)/emulparams/m88kbcs.sh \ - $(srcdir)/emultempl/m88kbcs.em $(srcdir)/scripttempl/m88kbcs.sc ${GEN_DEPENDS} - ${GENSCRIPTS} m88kbcs -eh8300.c: $(srcdir)/emulparams/h8300.sh \ - $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/h8300.sc ${GEN_DEPENDS} - ${GENSCRIPTS} h8300 -eh8300h.c: $(srcdir)/emulparams/h8300h.sh \ - $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/h8300h.sc ${GEN_DEPENDS} - ${GENSCRIPTS} h8300h -eh8500.c: $(srcdir)/emulparams/h8500.sh \ - $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/h8500.sc ${GEN_DEPENDS} - ${GENSCRIPTS} h8500 -eh8500b.c: $(srcdir)/emulparams/h8500b.sh \ - $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/h8500b.sc ${GEN_DEPENDS} - ${GENSCRIPTS} h8500b -eh8500c.c: $(srcdir)/emulparams/h8500c.sh \ - $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/h8500c.sc ${GEN_DEPENDS} - ${GENSCRIPTS} h8500c -eh8500m.c: $(srcdir)/emulparams/h8500m.sh \ - $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/h8500m.sc ${GEN_DEPENDS} - ${GENSCRIPTS} h8500m -eh8500s.c: $(srcdir)/emulparams/h8500s.sh \ - $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/h8500s.sc ${GEN_DEPENDS} - ${GENSCRIPTS} h8500s -esh.c: $(srcdir)/emulparams/sh.sh \ - $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/sh.sc ${GEN_DEPENDS} - ${GENSCRIPTS} sh -eshl.c: $(srcdir)/emulparams/shl.sh \ - $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/sh.sc ${GEN_DEPENDS} - ${GENSCRIPTS} shl -est2000.c: $(srcdir)/emulparams/st2000.sh \ - $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/st2000.sc ${GEN_DEPENDS} - ${GENSCRIPTS} st2000 -evanilla.c: $(srcdir)/emulparams/vanilla.sh \ - $(srcdir)/emultempl/vanilla.em $(srcdir)/scripttempl/vanilla.sc ${GEN_DEPENDS} - ${GENSCRIPTS} vanilla + ${GENSCRIPTS} i386msdos "$(tdir_i386msdos)" +ei386nbsd.c: $(srcdir)/emulparams/i386nbsd.sh \ + $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/aout.sc ${GEN_DEPENDS} + ${GENSCRIPTS} i386nbsd "$(tdir_i386nbsd)" +ei386nw.c: $(srcdir)/emulparams/i386nw.sh \ + $(srcdir)/emultempl/elf32.em $(srcdir)/scripttempl/nw.sc ${GEN_DEPENDS} + ${GENSCRIPTS} i386nw "$(tdir_i386nw)" +ei386pe.c: $(srcdir)/emulparams/i386pe.sh \ + $(srcdir)/emultempl/pe.em $(srcdir)/scripttempl/pe.sc ${GEN_DEPENDS} + ${GENSCRIPTS} i386pe "$(tdir_i386pe)" elnk960.c: $(srcdir)/emulparams/lnk960.sh \ $(srcdir)/emultempl/lnk960.em $(srcdir)/scripttempl/i960.sc ${GEN_DEPENDS} - ${GENSCRIPTS} lnk960 -egld960.c: $(srcdir)/emulparams/gld960.sh \ - $(srcdir)/emultempl/gld960.em $(srcdir)/scripttempl/i960.sc ${GEN_DEPENDS} - ${GENSCRIPTS} gld960 -egld960coff.c: $(srcdir)/emulparams/gld960coff.sh \ - $(srcdir)/emultempl/gld960c.em $(srcdir)/scripttempl/i960.sc ${GEN_DEPENDS} - ${GENSCRIPTS} gld960coff + ${GENSCRIPTS} lnk960 "$(tdir_lnk960)" +em68k4knbsd.c: $(srcdir)/emulparams/m68k4knbsd.sh \ + $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/aout.sc ${GEN_DEPENDS} + ${GENSCRIPTS} m68k4knbsd "$(tdir_m68k4knbsd)" +em68kaout.c: $(srcdir)/emulparams/m68kaout.sh \ + $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/aout.sc ${GEN_DEPENDS} + ${GENSCRIPTS} m68kaout "$(tdir_m68kaout)" +em68kaux.c: $(srcdir)/emulparams/m68kaux.sh \ + $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/m68kaux.sc ${GEN_DEPENDS} + ${GENSCRIPTS} m68kaux "$(tdir_m68kaux)" em68kcoff.c: $(srcdir)/emulparams/m68kcoff.sh \ $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/m68kcoff.sc ${GEN_DEPENDS} - ${GENSCRIPTS} m68kcoff + ${GENSCRIPTS} m68kcoff "$(tdir_m68kcoff)" em68kelf.c: $(srcdir)/emulparams/m68kelf.sh \ $(srcdir)/emultempl/elf32.em $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS} - ${GENSCRIPTS} m68kelf + ${GENSCRIPTS} m68kelf "$(tdir_m68kelf)" +em68klinux.c: $(srcdir)/emulparams/m68klinux.sh \ + $(srcdir)/emultempl/linux.em $(srcdir)/scripttempl/aout.sc ${GEN_DEPENDS} + ${GENSCRIPTS} m68klinux "$(tdir_m68klinux)" em68klynx.c: $(srcdir)/emulparams/m68klynx.sh \ $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/m68klynx.sc ${GEN_DEPENDS} - ${GENSCRIPTS} m68klynx -ei386coff.c: $(srcdir)/emulparams/i386coff.sh \ - $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/i386coff.sc ${GEN_DEPENDS} - ${GENSCRIPTS} i386coff -ei386lynx.c: $(srcdir)/emulparams/i386lynx.sh \ - $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/i386lynx.sc ${GEN_DEPENDS} - ${GENSCRIPTS} i386lynx -emipslit.c: $(srcdir)/emulparams/mipslit.sh \ - $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/mips.sc ${GEN_DEPENDS} - ${GENSCRIPTS} mipslit -ei386bsd.c: $(srcdir)/emulparams/i386bsd.sh \ + ${GENSCRIPTS} m68klynx "$(tdir_m68klynx)" +em68knbsd.c: $(srcdir)/emulparams/m68knbsd.sh \ $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/aout.sc ${GEN_DEPENDS} - ${GENSCRIPTS} i386bsd + ${GENSCRIPTS} m68knbsd "$(tdir_m68knbsd)" +em68kpsos.c: $(srcdir)/emulparams/m68kpsos.sh \ + $(srcdir)/emultempl/elf32.em $(srcdir)/scripttempl/psos.sc ${GEN_DEPENDS} + ${GENSCRIPTS} m68kpsos "$(tdir_m68kpsos)" +em88kbcs.c: $(srcdir)/emulparams/m88kbcs.sh \ + $(srcdir)/emultempl/m88kbcs.em $(srcdir)/scripttempl/m88kbcs.sc ${GEN_DEPENDS} + ${GENSCRIPTS} m88kbcs "$(tdir_m88kbcs)" emipsbig.c: $(srcdir)/emulparams/mipsbig.sh \ $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/mips.sc ${GEN_DEPENDS} ${GENSCRIPTS} mipsbig @@ -402,113 +519,82 @@ emipsbsd.c: $(srcdir)/emulparams/mipsbsd.sh \ ${GENSCRIPTS} mipsbsd emipsidt.c: $(srcdir)/emulparams/mipsidt.sh \ $(srcdir)/emultempl/mipsecoff.em $(srcdir)/scripttempl/mips.sc ${GEN_DEPENDS} - ${GENSCRIPTS} mipsidt + ${GENSCRIPTS} mipsidt "$(tdir_mipsidt)" emipsidtl.c: $(srcdir)/emulparams/mipsidtl.sh \ $(srcdir)/emultempl/mipsecoff.em $(srcdir)/scripttempl/mips.sc ${GEN_DEPENDS} - ${GENSCRIPTS} mipsidtl -eelf_i386.c: $(srcdir)/emulparams/elf_i386.sh \ - $(srcdir)/emultempl/elf32.em $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS} - ${GENSCRIPTS} elf_i386 -eelf32bmip.c: $(srcdir)/emulparams/elf32bmip.sh \ - $(srcdir)/emultempl/elf32.em $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS} - ${GENSCRIPTS} elf32bmip -eelf32lmip.c: $(srcdir)/emulparams/elf32lmip.sh \ - $(srcdir)/emultempl/elf32.em $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS} - ${GENSCRIPTS} elf32lmip -eelf32b4300.c: $(srcdir)/emulparams/elf32b4300.sh \ - $(srcdir)/emultempl/elf32.em $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS} - ${GENSCRIPTS} elf32b4300 -eelf32l4300.c: $(srcdir)/emulparams/elf32l4300.sh \ - $(srcdir)/emultempl/elf32.em $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS} - ${GENSCRIPTS} elf32l4300 -ealpha.c: $(srcdir)/emulparams/alpha.sh \ - $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/alpha.sc ${GEN_DEPENDS} - ${GENSCRIPTS} alpha -ecoff_sparc.c: $(srcdir)/emulparams/coff_sparc.sh \ - $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/sparccoff.sc ${GEN_DEPENDS} - ${GENSCRIPTS} coff_sparc -esparclynx.c: $(srcdir)/emulparams/sparclynx.sh \ - $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/sparclynx.sc ${GEN_DEPENDS} - ${GENSCRIPTS} sparclynx -eelf32ppc.c: $(srcdir)/emulparams/elf32ppc.sh \ - $(srcdir)/emultempl/elf32.em $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS} - ${GENSCRIPTS} elf32ppc -eelf32lppc.c: $(srcdir)/emulparams/elf32lppc.sh \ - $(srcdir)/emultempl/elf32.em $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS} - ${GENSCRIPTS} elf32lppc -eriscix.c: $(srcdir)/emulparams/riscix.sh \ + ${GENSCRIPTS} mipsidtl "$(tdir_mipsidtl)" +emipslit.c: $(srcdir)/emulparams/mipslit.sh \ + $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/mips.sc ${GEN_DEPENDS} + ${GENSCRIPTS} mipslit "$(tdir_mipslit)" +enews.c: $(srcdir)/emulparams/news.sh \ $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/aout.sc ${GEN_DEPENDS} - ${GENSCRIPTS} riscix -em68kaout.c: $(srcdir)/emulparams/m68kaout.sh \ + ${GENSCRIPTS} news "$(tdir_news)" +ens32knbsd.c: $(srcdir)/emulparams/ns32knbsd.sh \ $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/aout.sc ${GEN_DEPENDS} - ${GENSCRIPTS} m68kaout -ei386linux.c: $(srcdir)/emulparams/i386linux.sh \ - $(srcdir)/emultempl/linux.em $(srcdir)/scripttempl/aout.sc ${GEN_DEPENDS} - ${GENSCRIPTS} i386linux -eelf32_sparc.c: $(srcdir)/emulparams/elf32_sparc.sh \ - $(srcdir)/emultempl/elf32.em $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS} - ${GENSCRIPTS} elf32_sparc -eelf64_sparc.c: $(srcdir)/emulparams/elf64_sparc.sh \ - $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS} - ${GENSCRIPTS} elf64_sparc - + ${GENSCRIPTS} ns32knbsd "$(tdir_ns32knbsd)" epc532machaout.c: $(srcdir)/emulparams/pc532machaout.sh \ $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/aout.sc ${GEN_DEPENDS} - ${GENSCRIPTS} pc532machaout - -ew65.c: $(srcdir)/emulparams/w65.sh \ - $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/w65.sc ${GEN_DEPENDS} - ${GENSCRIPTS} w65 - -ei386nw.c: $(srcdir)/emulparams/i386nw.sh \ - $(srcdir)/emultempl/elf32.em $(srcdir)/scripttempl/nw.sc ${GEN_DEPENDS} - ${GENSCRIPTS} i386nw + ${GENSCRIPTS} pc532machaout "$(tdir_pc532machaout)" +eppcmacos.c: $(srcdir)/emulparams/ppcmacos.sh \ + $(srcdir)/emultempl/aix.em $(srcdir)/scripttempl/aix.sc ${GEN_DEPENDS} + ${GENSCRIPTS} ppcmacos "$(tdir_ppcmacos)" eppcnw.c: $(srcdir)/emulparams/ppcnw.sh \ $(srcdir)/emultempl/elf32.em $(srcdir)/scripttempl/nw.sc ${GEN_DEPENDS} - ${GENSCRIPTS} ppcnw - -ei386nbsd.c: $(srcdir)/emulparams/i386nbsd.sh \ + ${GENSCRIPTS} ppcnw "$(tdir_ppcnw)" +eppcpe.c: $(srcdir)/emulparams/ppcpe.sh \ + $(srcdir)/emultempl/pe.em $(srcdir)/scripttempl/ppcpe.sc ${GEN_DEPENDS} + ${GENSCRIPTS} ppcpe "$(tdir_ppcpe)" +eriscix.c: $(srcdir)/emulparams/riscix.sh \ $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/aout.sc ${GEN_DEPENDS} - ${GENSCRIPTS} i386nbsd -em68k4knbsd.c: $(srcdir)/emulparams/m68k4knbsd.sh \ + ${GENSCRIPTS} riscix "$(tdir_riscix)" +esa29200.c: $(srcdir)/emulparams/sa29200.sh \ + $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/sa29200.sc ${GEN_DEPENDS} + ${GENSCRIPTS} sa29200 "$(tdir_sa29200)" +esh.c: $(srcdir)/emulparams/sh.sh \ + $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/sh.sc ${GEN_DEPENDS} + ${GENSCRIPTS} sh "$(tdir_sh)" +eshl.c: $(srcdir)/emulparams/shl.sh \ + $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/sh.sc ${GEN_DEPENDS} + ${GENSCRIPTS} shl "$(tdir_shl)" +esparcaout.c: $(srcdir)/emulparams/sparcaout.sh \ $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/aout.sc ${GEN_DEPENDS} - ${GENSCRIPTS} m68k4knbsd -em68knbsd.c: $(srcdir)/emulparams/m68knbsd.sh \ + ${GENSCRIPTS} sparcaout "$(tdir_sparcaout)" +esparclynx.c: $(srcdir)/emulparams/sparclynx.sh \ + $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/sparclynx.sc ${GEN_DEPENDS} + ${GENSCRIPTS} sparclynx "$(tdir_sparclynx)" +esparcnbsd.c: $(srcdir)/emulparams/sparcnbsd.sh \ $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/aout.sc ${GEN_DEPENDS} - ${GENSCRIPTS} m68knbsd -ens32knbsd.c: $(srcdir)/emulparams/ns32knbsd.sh \ + ${GENSCRIPTS} sparcnbsd "$(tdir_sparcnbsd)" +est2000.c: $(srcdir)/emulparams/st2000.sh \ + $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/st2000.sc ${GEN_DEPENDS} + ${GENSCRIPTS} st2000 "$(tdir_st2000)" +esun3.c: $(srcdir)/emulparams/sun3.sh \ + $(srcdir)/emultempl/sunos.em $(srcdir)/scripttempl/aout.sc ${GEN_DEPENDS} + ${GENSCRIPTS} sun3 "$(tdir_sun3)" +esun4.c: $(srcdir)/emulparams/sun4.sh \ + $(srcdir)/emultempl/sunos.em $(srcdir)/scripttempl/aout.sc ${GEN_DEPENDS} + ${GENSCRIPTS} sun4 "$(tdir_sun4)" +evanilla.c: $(srcdir)/emulparams/vanilla.sh \ + $(srcdir)/emultempl/vanilla.em $(srcdir)/scripttempl/vanilla.sc ${GEN_DEPENDS} + ${GENSCRIPTS} vanilla "$(tdir_vanilla)" +evax.c: $(srcdir)/emulparams/vax.sh \ $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/aout.sc ${GEN_DEPENDS} - ${GENSCRIPTS} ns32knbsd -esparcnbsd.c: $(srcdir)/emulparams/sparcnbsd.sh \ + ${GENSCRIPTS} vax "$(tdir_vax)" +evsta.c: $(srcdir)/emulparams/vsta.sh \ $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/aout.sc ${GEN_DEPENDS} - ${GENSCRIPTS} sparcnbsd -earmaoutl.c: $(srcdir)/emulparams/armaoutl.sh \ - $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/armaout.sc ${GEN_DEPENDS} - ${GENSCRIPTS} armaoutl -earmaoutb.c: $(srcdir)/emulparams/armaoutb.sh \ - $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/armaout.sc ${GEN_DEPENDS} - ${GENSCRIPTS} armaoutb -earmcoff.c: $(srcdir)/emulparams/armcoff.sh \ - $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/armcoff.sc ${GEN_DEPENDS} - ${GENSCRIPTS} armcoff + ${GENSCRIPTS} vsta "$(tdir_vsta)" +ew65.c: $(srcdir)/emulparams/w65.sh \ + $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/w65.sc ${GEN_DEPENDS} + ${GENSCRIPTS} w65 "$(tdir_w65)" ez8001.c: $(srcdir)/emulparams/z8001.sh \ $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/z8000.sc ${GEN_DEPENDS} - ${GENSCRIPTS} z8001 + ${GENSCRIPTS} z8001 "$(tdir_z8001)" ez8002.c: $(srcdir)/emulparams/z8002.sh \ $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/z8000.sc ${GEN_DEPENDS} - ${GENSCRIPTS} z8002 -eaixppc.c: $(srcdir)/emulparams/aixppc.sh \ - $(srcdir)/emultempl/aix.em $(srcdir)/scripttempl/aix.sc ${GEN_DEPENDS} - ${GENSCRIPTS} aixppc -eaixrs6.c: $(srcdir)/emulparams/aixrs6.sh \ - $(srcdir)/emultempl/aix.em $(srcdir)/scripttempl/aix.sc ${GEN_DEPENDS} - ${GENSCRIPTS} aixrs6 -edelta68.c: $(srcdir)/emulparams/delta68.sh \ - $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/delta68.sc ${GEN_DEPENDS} - ${GENSCRIPTS} delta68 + ${GENSCRIPTS} z8002 "$(tdir_z8002)" -$(LD_PROG): $(OFILES) $(BFDLIB) $(LIBIBERTY) - $(CC) $(CFLAGS) $(LDFLAGS) -o $(LD_PROG) $(OFILES) $(BFDLIB) $(LIBIBERTY) $(EXTRALIBS) +$(LD_PROG): $(OFILES) $(BFDDEP) $(LIBIBERTY) + $(CC) $(HLDFLAGS) $(CFLAGS) $(LDFLAGS) -o $(LD_PROG) $(OFILES) $(BFDLIB) $(LIBIBERTY) $(EXTRALIBS) # The generated emulation files mostly have the same dependencies. $(EMULATION_OFILES): ../bfd/bfd.h sysdep.h config.h $(INCDIR)/bfdlink.h \ @@ -558,6 +644,8 @@ check: site.exp r=`pwd`; export r; \ srcroot=`cd ${srcdir}; pwd` ; export srcroot ; \ EXPECT=${EXPECT} ; export EXPECT ; \ + $(RPATH_ENVVAR)=$$r/../bfd:$$r/../opcodes:$$$(RPATH_ENVVAR); \ + export $(RPATH_ENVVAR); \ if [ -f $$r/../expect/expect ] ; then \ TCL_LIBRARY=$${srcroot}/../tcl/library ; \ export TCL_LIBRARY ; \ @@ -807,6 +895,8 @@ install: for f in ldscripts/*; do \ $(INSTALL_DATA) $$f $(scriptdir)/$$f ; \ done + test -d $(tooldir) || mkdir $(tooldir) + test -d $(tooldir)/bin || mkdir $(tooldir)/bin -n=`echo ld | sed '$(program_transform_name)'`; \ rm -f $(tooldir)/bin/ld; \ ln $(bindir)/$$n $(tooldir)/bin/ld >/dev/null 2>/dev/null \ @@ -907,15 +997,15 @@ ldmain.o: ldmain.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \ ldemul.h ldlex.h ldfile.h ldctor.h ldmisc.o: ldmisc.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \ $(INCDIR)/obstack.h sysdep.h config.h $(INCDIR)/fopen-same.h \ - ld.h ldmisc.h ldexp.h ldlang.h ldgram.h ldlex.h ldmain.h \ - ldfile.h + $(INCDIR)/libiberty.h $(INCDIR)/demangle.h ld.h ldmisc.h \ + ldexp.h ldlang.h ldgram.h ldlex.h ldmain.h ldfile.h ldver.o: ldver.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \ $(INCDIR)/obstack.h sysdep.h config.h $(INCDIR)/fopen-same.h \ ld.h ldver.h ldemul.h ldmain.h ldwrite.o: ldwrite.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \ $(INCDIR)/obstack.h sysdep.h config.h $(INCDIR)/fopen-same.h \ - $(INCDIR)/bfdlink.h ld.h ldexp.h ldlang.h ldwrite.h \ - ldmisc.h ldgram.h ldmain.h + $(INCDIR)/bfdlink.h $(INCDIR)/libiberty.h ld.h ldexp.h \ + ldlang.h ldwrite.h ldmisc.h ldgram.h ldmain.h lexsup.o: lexsup.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \ $(INCDIR)/obstack.h sysdep.h config.h $(INCDIR)/fopen-same.h \ $(INCDIR)/getopt.h $(INCDIR)/bfdlink.h ld.h ldmain.h \ @@ -924,6 +1014,10 @@ lexsup.o: lexsup.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \ mri.o: mri.c ../bfd/bfd.h $(INCDIR)/ansidecl.h $(INCDIR)/obstack.h \ sysdep.h config.h $(INCDIR)/fopen-same.h ld.h ldexp.h \ ldlang.h ldmisc.h mri.h ldgram.h +ldcref.o: ldcref.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \ + $(INCDIR)/obstack.h sysdep.h config.h $(INCDIR)/fopen-same.h \ + $(INCDIR)/bfdlink.h $(INCDIR)/libiberty.h ld.h ldmain.h \ + ldmisc.h ldgram.o: ldgram.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \ $(INCDIR)/obstack.h sysdep.h config.h $(INCDIR)/fopen-same.h \ $(INCDIR)/bfdlink.h ld.h ldexp.h ldver.h ldlang.h ldemul.h \ diff --git a/gnu/usr.bin/binutils/ld/NEWS b/gnu/usr.bin/binutils/ld/NEWS index 7cc3a59b9a3..7d367b8bc12 100644 --- a/gnu/usr.bin/binutils/ld/NEWS +++ b/gnu/usr.bin/binutils/ld/NEWS @@ -1,5 +1,20 @@ -*- text -*- +Changes since version 2.6: + +* New option --cref to print out a cross reference table. + +* New option --wrap SYMBOL. + +* New option --no-whole-archive, to turn off the effect of --whole-archive. + +* Input sections assigned to the output section /DISCARD/ in the linker script + are not included in the output file. + +* The SunOS and ELF linkers now merge stabs debugging information which uses + the N_BINCL and N_EINCL stab types. This reduces the amount of debugging + information generated. + Changes since version 2.5: * When an ELF section name is representable as a C identifier (this is not true diff --git a/gnu/usr.bin/binutils/ld/TODO b/gnu/usr.bin/binutils/ld/TODO index cd4a59b028f..31cd98ba236 100644 --- a/gnu/usr.bin/binutils/ld/TODO +++ b/gnu/usr.bin/binutils/ld/TODO @@ -4,8 +4,6 @@ Support the "traditional" BSD -A flag (incremental loading). (There is a -A flag in ld now, but it is used to specify the architecture. That should probably be changed.) -Shared library support is missing. - Support for dynamic loading (a la dld, but bfd-based) would be nice. Avoid re-open (and re-seeking) output bfd and archives. diff --git a/gnu/usr.bin/binutils/ld/acconfig.h b/gnu/usr.bin/binutils/ld/acconfig.h index 930d663d2c6..75c00ffbc06 100644 --- a/gnu/usr.bin/binutils/ld/acconfig.h +++ b/gnu/usr.bin/binutils/ld/acconfig.h @@ -1,5 +1,7 @@ -/* Do we need to use the b modifier when opening binary files? */ -#undef USE_BINARY_FOPEN /* Whether free must be declared even if <stdlib.h> is included. */ #undef NEED_DECLARATION_FREE +@TOP@ + +/* Do we need to use the b modifier when opening binary files? */ +#undef USE_BINARY_FOPEN diff --git a/gnu/usr.bin/binutils/ld/config.in b/gnu/usr.bin/binutils/ld/config.in index b4cf7292a1a..d4446c47c61 100644 --- a/gnu/usr.bin/binutils/ld/config.in +++ b/gnu/usr.bin/binutils/ld/config.in @@ -1,11 +1,11 @@ /* config.in. Generated automatically from configure.in by autoheader. */ -/* Do we need to use the b modifier when opening binary files? */ -#undef USE_BINARY_FOPEN - /* Whether free must be declared even if <stdlib.h> is included. */ #undef NEED_DECLARATION_FREE +/* Do we need to use the b modifier when opening binary files? */ +#undef USE_BINARY_FOPEN + /* Define if you have the sbrk function. */ #undef HAVE_SBRK diff --git a/gnu/usr.bin/binutils/ld/configure b/gnu/usr.bin/binutils/ld/configure index f94a854f9a1..027e210c96b 100644 --- a/gnu/usr.bin/binutils/ld/configure +++ b/gnu/usr.bin/binutils/ld/configure @@ -1,7 +1,7 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated automatically using autoconf version 2.4 +# Generated automatically using autoconf version 2.8 # Copyright (C) 1992, 1993, 1994 Free Software Foundation, Inc. # # This configure script is free software; the Free Software Foundation @@ -13,6 +13,8 @@ ac_default_prefix=/usr/local # Any additions from configure.in: ac_help="$ac_help --enable-targets alternative target configurations" +ac_help="$ac_help + --enable-shared build shared BFD library" # Initialize some variables set by options. # The variables have the same names as the options, with @@ -35,9 +37,22 @@ target=NONE verbose= x_includes=NONE x_libraries=NONE +bindir='${exec_prefix}/bin' +sbindir='${exec_prefix}/sbin' +libexecdir='${exec_prefix}/libexec' +datadir='${prefix}/share' +sysconfdir='${prefix}/etc' +sharedstatedir='${prefix}/com' +localstatedir='${prefix}/var' +libdir='${exec_prefix}/lib' +includedir='${prefix}/include' +oldincludedir='/usr/include' +infodir='${prefix}/info' +mandir='${prefix}/man' # Initialize some other variables. subdirs= +MFLAGS= MAKEFLAGS= ac_prev= for ac_option @@ -59,9 +74,14 @@ do case "$ac_option" in - -build | --build | --buil | --bui | --bu | --b) + -bindir | --bindir | --bindi | --bind | --bin | --bi) + ac_prev=bindir ;; + -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*) + bindir="$ac_optarg" ;; + + -build | --build | --buil | --bui | --bu) ac_prev=build ;; - -build=* | --build=* | --buil=* | --bui=* | --bu=* | --b=*) + -build=* | --build=* | --buil=* | --bui=* | --bu=*) build="$ac_optarg" ;; -cache-file | --cache-file | --cache-fil | --cache-fi \ @@ -71,6 +91,12 @@ do | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*) cache_file="$ac_optarg" ;; + -datadir | --datadir | --datadi | --datad | --data | --dat | --da) + ac_prev=datadir ;; + -datadir=* | --datadir=* | --datadi=* | --datad=* | --data=* | --dat=* \ + | --da=*) + datadir="$ac_optarg" ;; + -disable-* | --disable-*) ac_feature=`echo $ac_option|sed -e 's/-*disable-//'` # Reject names that are not valid shell variable names. @@ -121,12 +147,29 @@ Configuration: Directory and file names: --prefix=PREFIX install architecture-independent files in PREFIX [$ac_default_prefix] - --exec-prefix=PREFIX install architecture-dependent files in PREFIX + --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX [same as prefix] + --bindir=DIR user executables in DIR [EPREFIX/bin] + --sbindir=DIR system admin executables in DIR [EPREFIX/sbin] + --libexecdir=DIR program executables in DIR [EPREFIX/libexec] + --datadir=DIR read-only architecture-independent data in DIR + [PREFIX/share] + --sysconfdir=DIR read-only single-machine data in DIR [PREFIX/etc] + --sharedstatedir=DIR modifiable architecture-independent data in DIR + [PREFIX/com] + --localstatedir=DIR modifiable single-machine data in DIR [PREFIX/var] + --libdir=DIR object code libraries in DIR [EPREFIX/lib] + --includedir=DIR C header files in DIR [PREFIX/include] + --oldincludedir=DIR C header files for non-gcc in DIR [/usr/include] + --infodir=DIR info documentation in DIR [PREFIX/info] + --mandir=DIR man documentation in DIR [PREFIX/man] --srcdir=DIR find the sources in DIR [configure dir or ..] --program-prefix=PREFIX prepend PREFIX to installed program names --program-suffix=SUFFIX append SUFFIX to installed program names - --program-transform-name=PROGRAM run sed PROGRAM on installed program names + --program-transform-name=PROGRAM + run sed PROGRAM on installed program names +EOF + cat << EOF Host type: --build=BUILD configure for building on BUILD [BUILD=HOST] --host=HOST configure for HOST [guessed] @@ -138,8 +181,10 @@ Features and packages: --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) --x-includes=DIR X include files are in DIR --x-libraries=DIR X library files are in DIR ---enable and --with options recognized:$ac_help EOF + if test -n "$ac_help"; then + echo "--enable and --with options recognized:$ac_help" + fi exit 0 ;; -host | --host | --hos | --ho) @@ -147,6 +192,44 @@ EOF -host=* | --host=* | --hos=* | --ho=*) host="$ac_optarg" ;; + -includedir | --includedir | --includedi | --included | --include \ + | --includ | --inclu | --incl | --inc) + ac_prev=includedir ;; + -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \ + | --includ=* | --inclu=* | --incl=* | --inc=*) + includedir="$ac_optarg" ;; + + -infodir | --infodir | --infodi | --infod | --info | --inf) + ac_prev=infodir ;; + -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*) + infodir="$ac_optarg" ;; + + -libdir | --libdir | --libdi | --libd) + ac_prev=libdir ;; + -libdir=* | --libdir=* | --libdi=* | --libd=*) + libdir="$ac_optarg" ;; + + -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \ + | --libexe | --libex | --libe) + ac_prev=libexecdir ;; + -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \ + | --libexe=* | --libex=* | --libe=*) + libexecdir="$ac_optarg" ;; + + -localstatedir | --localstatedir | --localstatedi | --localstated \ + | --localstate | --localstat | --localsta | --localst \ + | --locals | --local | --loca | --loc | --lo) + ac_prev=localstatedir ;; + -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ + | --localstate=* | --localstat=* | --localsta=* | --localst=* \ + | --locals=* | --local=* | --loca=* | --loc=* | --lo=*) + localstatedir="$ac_optarg" ;; + + -mandir | --mandir | --mandi | --mand | --man | --ma | --m) + ac_prev=mandir ;; + -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*) + mandir="$ac_optarg" ;; + -nfp | --nfp | --nf) # Obsolete; use --without-fp. with_fp=no ;; @@ -159,6 +242,15 @@ EOF | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) no_recursion=yes ;; + -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \ + | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \ + | --oldin | --oldi | --old | --ol | --o) + ac_prev=oldincludedir ;; + -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \ + | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \ + | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*) + oldincludedir="$ac_optarg" ;; + -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) ac_prev=prefix ;; -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) @@ -199,6 +291,23 @@ EOF | -silent | --silent | --silen | --sile | --sil) silent=yes ;; + -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) + ac_prev=sbindir ;; + -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ + | --sbi=* | --sb=*) + sbindir="$ac_optarg" ;; + + -sharedstatedir | --sharedstatedir | --sharedstatedi \ + | --sharedstated | --sharedstate | --sharedstat | --sharedsta \ + | --sharedst | --shareds | --shared | --share | --shar \ + | --sha | --sh) + ac_prev=sharedstatedir ;; + -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \ + | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \ + | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \ + | --sha=* | --sh=*) + sharedstatedir="$ac_optarg" ;; + -site | --site | --sit) ac_prev=site ;; -site=* | --site=* | --sit=*) @@ -209,6 +318,13 @@ EOF -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) srcdir="$ac_optarg" ;; + -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \ + | --syscon | --sysco | --sysc | --sys | --sy) + ac_prev=sysconfdir ;; + -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \ + | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*) + sysconfdir="$ac_optarg" ;; + -target | --target | --targe | --targ | --tar | --ta | --t) ac_prev=target ;; -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*) @@ -218,7 +334,7 @@ EOF verbose=yes ;; -version | --version | --versio | --versi | --vers) - echo "configure generated by autoconf version 2.4" + echo "configure generated by autoconf version 2.8" exit 0 ;; -with-* | --with-*) @@ -264,7 +380,7 @@ EOF -*) { echo "configure: error: $ac_option: invalid option; use --help to show usage" 1>&2; exit 1; } ;; - *) + *) if test -n "`echo $ac_option| sed 's/[-a-z0-9.]//g'`"; then echo "configure: warning: $ac_option: invalid host type" 1>&2 fi @@ -384,8 +500,8 @@ fi ac_ext=c # CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. ac_cpp='$CPP $CPPFLAGS' -ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5 2>&5' -ac_link='${CC-cc} -o conftest $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5 2>&5' +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' if (echo "testing\c"; echo 1,2,3) | grep c >/dev/null; then # Stardent Vistra SVR4 grep lacks -e, says ghazi@caip.rutgers.edu. @@ -402,8 +518,8 @@ fi # Check whether --enable-targets or --disable-targets was given. -enableval="$enable_targets" -if test -n "$enableval"; then +if test "${enable_targets+set}" = set; then + enableval="$enable_targets" case "${enableval}" in yes | "") { echo "configure: error: enable-targets option must specify target names or 'all'" 1>&2; exit 1; } ;; @@ -411,6 +527,16 @@ if test -n "$enableval"; then *) enable_targets=$enableval ;; esac fi +# Check whether --enable-shared or --disable-shared was given. +if test "${enable_shared+set}" = set; then + enableval="$enable_shared" + case "${enableval}" in + yes) shared=true ;; + no) shared=false ;; + *bfd*) shared=true ;; + *) shared=false ;; +esac +fi @@ -440,7 +566,7 @@ ac_configure=$ac_aux_dir/configure # This should be Cygnus configure. # # The rules are: # 1. You are not allowed to specify --host, --target, and nonopt at the -# same time. +# same time. # 2. Host defaults to nonopt. # 3. If nonopt is not specified, then host defaults to the current host, # as determined by config.guess. @@ -528,8 +654,10 @@ fi if test "$program_transform_name" = s,x,x,; then program_transform_name= else - # Double any \ or $. - echo 's,\\,\\\\,g; s,\$,$$,g' > conftestsed + # Double any \ or $. echo might interpret backslashes. + cat <<\EOF_SED > conftestsed +s,\\,\\\\,g; s,\$,$$,g +EOF_SED program_transform_name="`echo $program_transform_name|sed -f conftestsed`" rm -f conftestsed fi @@ -545,23 +673,119 @@ test "$program_transform_name" = "" && program_transform_name="s,x,x," # host-specific stuff: -. ${srcdir}/configure.host +# 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 +if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:" + for ac_dir in $PATH; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + ac_cv_prog_CC="gcc" + break + fi + done + IFS="$ac_save_ifs" +fi +fi +CC="$ac_cv_prog_CC" +if test -n "$CC"; then + echo "$ac_t""$CC" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + +if test -z "$CC"; then + # Extract the first word of "cc", so it can be a program name with args. +set dummy cc; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:" + ac_prog_rejected=no + for ac_dir in $PATH; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + if test "$ac_dir/$ac_word" = "/usr/ucb/cc"; then + ac_prog_rejected=yes + continue + fi + ac_cv_prog_CC="cc" + break + fi + done + IFS="$ac_save_ifs" +if test $ac_prog_rejected = yes; then + # We found a bogon in the path, so make sure we never use it. + set dummy $ac_cv_prog_CC + shift + if test $# -gt 0; then + # We chose a different compiler from the bogus one. + # However, it has the same basename, so the bogon will be chosen + # first if we set CC to just the basename; use the full file name. + shift + set dummy "$ac_dir/$ac_word" "$@" + shift + ac_cv_prog_CC="$@" + fi +fi +fi +fi +CC="$ac_cv_prog_CC" +if test -n "$CC"; then + echo "$ac_t""$CC" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi -echo $ac_n "checking for CC""... $ac_c" 1>&6 -test -z "$CC" && test -r ../Makefile && CC=`egrep '^CC *=' ../Makefile | tail -1 | sed 's/^CC *= *//'` -test -z "$CC" && CC=cc -echo "$ac_t""setting CC to $CC" 1>&6 + test -z "$CC" && { echo "configure: error: no acceptable cc found in \$PATH" 1>&2; exit 1; } +fi -cat > conftest.c <<EOF +echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6 +if eval "test \"`echo '$''{'ac_cv_prog_gcc'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.c <<EOF #ifdef __GNUC__ yes; #endif EOF -if ${CC-cc} -E conftest.c 2>&5 | egrep yes >/dev/null 2>&1; then +if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:763: \"$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 +fi +fi + +echo "$ac_t""$ac_cv_prog_gcc" 1>&6 +if test $ac_cv_prog_gcc = yes; then GCC=yes if test "${CFLAGS+set}" != set; then - echo 'void f(){}' > conftest.c - if test -z "`${CC-cc} -g -c conftest.c 2>&1`"; then + echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6 +if eval "test \"`echo '$''{'ac_cv_prog_gcc_g'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + echo 'void f(){}' > conftest.c +if test -z "`${CC-cc} -g -c conftest.c 2>&1`"; then + ac_cv_prog_gcc_g=yes +else + ac_cv_prog_gcc_g=no +fi +rm -f conftest* + +fi + +echo "$ac_t""$ac_cv_prog_gcc_g" 1>&6 + if test $ac_cv_prog_gcc_g = yes; then CFLAGS="-g -O" else CFLAGS="-O" @@ -571,7 +795,10 @@ else GCC= test "${CFLAGS+set}" = set || CFLAGS="-g" fi -rm -f conftest* + + +. ${srcdir}/configure.host + @@ -579,6 +806,21 @@ rm -f conftest* +# For most hosts we can use a simple definition to pick up the BFD and +# opcodes libraries. However, if we are building shared libraries, we +# need to handle some hosts specially. +BFDLIB='-L../bfd -lbfd' +if test "${shared}" = "true"; then + case "${host}" in + *-*-sunos*) + # On SunOS, we must link against the name we are going to install, + # not -lbfd, since SunOS does not support SONAME. + BFDLIB='-L../bfd -l`echo bfd | sed '"'"'$(program_transform_name)'"'"'`' + ;; + esac +fi + + echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6 # On Suns, sometimes $CPP names a directory. if test -n "$CPP" && test -d "$CPP"; then @@ -594,12 +836,13 @@ else # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. cat > conftest.$ac_ext <<EOF -#line 598 "configure" +#line 840 "configure" #include "confdefs.h" #include <assert.h> Syntax Error EOF -eval "$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" +ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" +{ (eval echo configure:846: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out` if test -z "$ac_err"; then : @@ -608,12 +851,13 @@ else rm -rf conftest* CPP="${CC-cc} -E -traditional-cpp" cat > conftest.$ac_ext <<EOF -#line 612 "configure" +#line 855 "configure" #include "confdefs.h" #include <assert.h> Syntax Error EOF -eval "$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" +ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" +{ (eval echo configure:861: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out` if test -z "$ac_err"; then : @@ -641,11 +885,12 @@ if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 645 "configure" +#line 889 "configure" #include "confdefs.h" #include <$ac_hdr> EOF -eval "$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" +ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" +{ (eval echo configure:894: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out` if test -z "$ac_err"; then rm -rf conftest* @@ -659,7 +904,7 @@ 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 | tr '[a-z]./\055' '[A-Z]___'` + ac_tr_hdr=HAVE_`echo $ac_hdr | tr 'abcdefghijklmnopqrstuvwxyz./\055' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ___'` cat >> confdefs.h <<EOF #define $ac_tr_hdr 1 EOF @@ -676,13 +921,13 @@ if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 680 "configure" +#line 925 "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. */ -char $ac_func(); +char $ac_func(); int main() { return 0; } int t() { @@ -698,7 +943,7 @@ $ac_func(); ; return 0; } EOF -if eval $ac_link; then +if { (eval echo configure:947: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -710,7 +955,7 @@ 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 '[a-z]' '[A-Z]'` + ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'` cat >> confdefs.h <<EOF #define $ac_tr_func 1 EOF @@ -729,7 +974,7 @@ if eval "test \"`echo '$''{'ac_cv_header_dirent_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 733 "configure" +#line 978 "configure" #include "confdefs.h" #include <sys/types.h> #include <$ac_hdr> @@ -738,7 +983,7 @@ int t() { DIR *dirp = 0; ; return 0; } EOF -if eval $ac_compile; then +if { (eval echo configure:987: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* eval "ac_cv_header_dirent_$ac_safe=yes" else @@ -750,7 +995,7 @@ rm -f conftest* fi if eval "test \"`echo '$ac_cv_header_dirent_'$ac_safe`\" = yes"; then echo "$ac_t""yes" 1>&6 - ac_tr_hdr=HAVE_`echo $ac_hdr | tr '[a-z]./\055' '[A-Z]___'` + ac_tr_hdr=HAVE_`echo $ac_hdr | tr 'abcdedfghijklmnopqrstuvwxyz./\055' 'ABCDEDFGHIJKLMNOPQRSTUVWXYZ___'` cat >> confdefs.h <<EOF #define $ac_tr_hdr 1 EOF @@ -762,13 +1007,14 @@ 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 -ldir""... $ac_c" 1>&6 -if eval "test \"`echo '$''{'ac_cv_lib_dir'+set}'`\" = set"; then +ac_lib_var=`echo dir_opendir | tr '.-/+' '___p'` +if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else ac_save_LIBS="$LIBS" LIBS="-ldir $LIBS" cat > conftest.$ac_ext <<EOF -#line 772 "configure" +#line 1018 "configure" #include "confdefs.h" int main() { return 0; } @@ -776,18 +1022,18 @@ int t() { opendir() ; return 0; } EOF -if eval $ac_link; then +if { (eval echo configure:1026: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then rm -rf conftest* - eval "ac_cv_lib_dir=yes" + eval "ac_cv_lib_$ac_lib_var=yes" else rm -rf conftest* - eval "ac_cv_lib_dir=no" + eval "ac_cv_lib_$ac_lib_var=no" fi rm -f conftest* LIBS="$ac_save_LIBS" fi -if eval "test \"`echo '$ac_cv_lib_'dir`\" = yes"; then +if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then echo "$ac_t""yes" 1>&6 LIBS="$LIBS -ldir" else @@ -796,13 +1042,14 @@ fi else echo $ac_n "checking for -lx""... $ac_c" 1>&6 -if eval "test \"`echo '$''{'ac_cv_lib_x'+set}'`\" = set"; then +ac_lib_var=`echo x_opendir | tr '.-/+' '___p'` +if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else ac_save_LIBS="$LIBS" LIBS="-lx $LIBS" cat > conftest.$ac_ext <<EOF -#line 806 "configure" +#line 1053 "configure" #include "confdefs.h" int main() { return 0; } @@ -810,18 +1057,18 @@ int t() { opendir() ; return 0; } EOF -if eval $ac_link; then +if { (eval echo configure:1061: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then rm -rf conftest* - eval "ac_cv_lib_x=yes" + eval "ac_cv_lib_$ac_lib_var=yes" else rm -rf conftest* - eval "ac_cv_lib_x=no" + eval "ac_cv_lib_$ac_lib_var=no" fi rm -f conftest* LIBS="$ac_save_LIBS" fi -if eval "test \"`echo '$ac_cv_lib_'x`\" = yes"; then +if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then echo "$ac_t""yes" 1>&6 LIBS="$LIBS -lx" else @@ -831,8 +1078,9 @@ fi fi + case "${host}" in -i[345]86-*-msdos* | i[345]86-*-go32* | i[345]86-*-win32) +i[345]86-*-msdos* | i[345]86-*-go32* | *-*-cygwin32) cat >> confdefs.h <<\EOF #define USE_BINARY_FOPEN 1 EOF @@ -844,7 +1092,7 @@ if eval "test \"`echo '$''{'bfd_cv_decl_needed_free'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 848 "configure" +#line 1096 "configure" #include "confdefs.h" #include <stdio.h> @@ -856,10 +1104,10 @@ else #endif int main() { return 0; } int t() { -int (*pfn) = (int (*)) free +char *(*pfn) = (char *(*)) free ; return 0; } EOF -if eval $ac_compile; then +if { (eval echo configure:1111: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* bfd_cv_decl_needed_free=no else @@ -872,66 +1120,64 @@ fi echo "$ac_t""$bfd_cv_decl_needed_free" 1>&6 if test $bfd_cv_decl_needed_free = yes; then - cat >> confdefs.h <<\EOF -#define NEED_DECLARATION_FREE 1 + bfd_tr_decl=NEED_DECLARATION_`echo free | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'` + cat >> confdefs.h <<EOF +#define $bfd_tr_decl 1 EOF fi -# target-specific stuff: -# Canonicalize the secondary target names. -if test -n "$enable_targets"; then - for targ in `echo $enable_targets | sed 's/,/ /g'` - do - result=`$ac_config_sub $targ 2>/dev/null` - if test -n "$result"; then - canon_targets="$canon_targets $result" - else - # Allow targets that config.sub doesn't recognize, like "all". - canon_targets="$canon_targets $targ" - fi - done -fi +# target-specific stuff: -all_targets=false +all_targets= EMUL= all_emuls= +TDIRS= -for targ in $target $canon_targets +for targ_alias in `echo $target_alias $enable_targets | sed 's/,/ /g'` do - if test "x$targ" = "xall"; then - all_targets=true + if test "$targ_alias" = "all"; then + all_targets=true + else + # Canonicalize the secondary target names. + result=`$ac_config_sub $targ_alias 2>/dev/null` + if test -n "$result"; then + targ=$result else - . ${srcdir}/configure.tgt - - if test "x$targ" = "x$target"; then - EMUL=${targ_emul} - fi - - all_emuls="${all_emuls} ${targ_emul} ${targ_extra_emuls}" + targ=$targ_alias fi -done + . ${srcdir}/configure.tgt + if test "$targ" = "$target"; then + EMUL=$targ_emul + fi -if test x${all_targets} = xfalse; then - # uniq the list. - f="" - for i in $all_emuls ; do - case " $f " in - *" e$i.o "*) ;; - *) f="$f e$i.o" ;; + for i in $targ_emul $targ_extra_emuls; do + case " $all_emuls " in + *" e${i}.o "*) ;; + *) + all_emuls="$all_emuls e${i}.o" + eval result=\$tdir_$i + test -z "$result" && result=$targ_alias + TDIRS="$TDIRS\\ +tdir_$i=$result" + ;; esac done + fi +done - EMULATION_OFILES="$f" -else # all_targets is true - EMULATION_OFILES='$(ALL_EMULATIONS)' -fi # all_targets is true +if test x${all_targets} = xtrue; then + EMULATION_OFILES='$(ALL_EMULATIONS)' +else + EMULATION_OFILES=$all_emuls +fi + trap '' 1 2 15 cat > confcache <<\EOF @@ -1009,7 +1255,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.4" + echo "$CONFIG_STATUS generated by autoconf version 2.8" exit 0 ;; -help | --help | --hel | --he | --h) echo "\$ac_cs_usage"; exit 0 ;; @@ -1020,10 +1266,12 @@ done ac_given_srcdir=$srcdir trap 'rm -fr `echo "Makefile config.h:config.in" | sed "s/:[^ ]*//g"` conftest*; exit 1' 1 2 15 +EOF +cat >> $CONFIG_STATUS <<EOF -# Protect against being on the right side of a sed subst in config.status. -sed 's/%@/@@/; s/@%/@@/; s/%g$/@g/; /@g$/s/[\\\\&%]/\\\\&/g; - s/@@/%@/; s/@@/@%/; s/@g$/%g/' > conftest.subs <<\CEOF +# Protect against being on the right side of a sed subst in config.status. +sed 's/%@/@@/; s/@%/@@/; s/%g\$/@g/; /@g\$/s/[\\\\&%]/\\\\&/g; + s/@@/%@/; s/@@/@%/; s/@g\$/%g/' > conftest.subs <<\\CEOF $ac_vpsub $extrasub s%@CFLAGS@%$CFLAGS%g @@ -1035,6 +1283,18 @@ s%@LIBS@%$LIBS%g s%@exec_prefix@%$exec_prefix%g s%@prefix@%$prefix%g s%@program_transform_name@%$program_transform_name%g +s%@bindir@%$bindir%g +s%@sbindir@%$sbindir%g +s%@libexecdir@%$libexecdir%g +s%@datadir@%$datadir%g +s%@sysconfdir@%$sysconfdir%g +s%@sharedstatedir@%$sharedstatedir%g +s%@localstatedir@%$localstatedir%g +s%@libdir@%$libdir%g +s%@includedir@%$includedir%g +s%@oldincludedir@%$oldincludedir%g +s%@infodir@%$infodir%g +s%@mandir@%$mandir%g s%@host@%$host%g s%@host_alias@%$host_alias%g s%@host_cpu@%$host_cpu%g @@ -1051,12 +1311,16 @@ s%@build_cpu@%$build_cpu%g s%@build_vendor@%$build_vendor%g s%@build_os@%$build_os%g s%@CC@%$CC%g +s%@HLDFLAGS@%$HLDFLAGS%g +s%@RPATH_ENVVAR@%$RPATH_ENVVAR%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%@BFDLIB@%$BFDLIB%g s%@CPP@%$CPP%g s%@EMUL@%$EMUL%g +s%@TDIRS@%$TDIRS%g s%@EMULATION_OFILES@%$EMULATION_OFILES%g CEOF @@ -1151,7 +1415,7 @@ EOF # Transform confdefs.h into a sed script conftest.vals that substitutes # the proper values into config.h.in to produce config.h. And first: -# Protect against being on the right side of a sed subst in config.status. +# Protect against being on the right side of a sed subst in config.status. # Protect against being in an unquoted here document in config.status. rm -f conftest.vals cat > conftest.hdr <<\EOF diff --git a/gnu/usr.bin/binutils/ld/configure.in b/gnu/usr.bin/binutils/ld/configure.in index eebefd384a2..5cb26ed6d8f 100644 --- a/gnu/usr.bin/binutils/ld/configure.in +++ b/gnu/usr.bin/binutils/ld/configure.in @@ -11,6 +11,14 @@ AC_ARG_ENABLE(targets, no) enable_targets= ;; *) enable_targets=$enableval ;; esac])dnl +AC_ARG_ENABLE(shared, +[ --enable-shared build shared BFD library], +[case "${enableval}" in + yes) shared=true ;; + no) shared=false ;; + *bfd*) shared=true ;; + *) shared=false ;; +esac])dnl AC_CONFIG_HEADER(config.h:config.in) @@ -26,91 +34,89 @@ AC_ARG_PROGRAM # host-specific stuff: +AC_PROG_CC + . ${srcdir}/configure.host -AC_PROG_CC -AC_SUBST(CFLAGS) +AC_SUBST(HLDFLAGS) +AC_SUBST(RPATH_ENVVAR) AC_SUBST(HDEFINES) AC_SUBST(HOSTING_CRT0) AC_SUBST(HOSTING_LIBS) AC_SUBST(NATIVE_LIB_DIRS) +# For most hosts we can use a simple definition to pick up the BFD and +# opcodes libraries. However, if we are building shared libraries, we +# need to handle some hosts specially. +BFDLIB='-L../bfd -lbfd' +if test "${shared}" = "true"; then + case "${host}" in + *-*-sunos*) + # On SunOS, we must link against the name we are going to install, + # not -lbfd, since SunOS does not support SONAME. + BFDLIB='-L../bfd -l`echo bfd | sed '"'"'$(program_transform_name)'"'"'`' + ;; + esac +fi +AC_SUBST(BFDLIB) + AC_CHECK_HEADERS(string.h strings.h stdlib.h unistd.h) AC_CHECK_FUNCS(sbrk) AC_HEADER_DIRENT BFD_BINARY_FOPEN -AC_MSG_CHECKING([whether free must be declared]) -AC_CACHE_VAL(bfd_cv_decl_needed_free, -[AC_TRY_COMPILE([ -#include <stdio.h> -#ifdef HAVE_STDLIB_H -#include <stdlib.h> -#endif -#ifdef HAVE_UNISTD_H -#include <unistd.h> -#endif], -[int (*pfn) = (int (*)) free], -bfd_cv_decl_needed_free=no, bfd_cv_decl_needed_free=yes)]) -AC_MSG_RESULT($bfd_cv_decl_needed_free) -if test $bfd_cv_decl_needed_free = yes; then - AC_DEFINE(NEED_DECLARATION_FREE) -fi +BFD_NEED_DECLARATION(free) # target-specific stuff: -# Canonicalize the secondary target names. -if test -n "$enable_targets"; then - for targ in `echo $enable_targets | sed 's/,/ /g'` - do - result=`$ac_config_sub $targ 2>/dev/null` - if test -n "$result"; then - canon_targets="$canon_targets $result" - else - # Allow targets that config.sub doesn't recognize, like "all". - canon_targets="$canon_targets $targ" - fi - done -fi - -all_targets=false +all_targets= EMUL= all_emuls= +TDIRS= -for targ in $target $canon_targets +for targ_alias in `echo $target_alias $enable_targets | sed 's/,/ /g'` do - if test "x$targ" = "xall"; then - all_targets=true + if test "$targ_alias" = "all"; then + all_targets=true + else + # Canonicalize the secondary target names. + result=`$ac_config_sub $targ_alias 2>/dev/null` + if test -n "$result"; then + targ=$result else - . ${srcdir}/configure.tgt + targ=$targ_alias + fi - if test "x$targ" = "x$target"; then - EMUL=${targ_emul} - fi + . ${srcdir}/configure.tgt - all_emuls="${all_emuls} ${targ_emul} ${targ_extra_emuls}" + if test "$targ" = "$target"; then + EMUL=$targ_emul fi -done - -AC_SUBST(EMUL) -if test x${all_targets} = xfalse; then - # uniq the list. - f="" - for i in $all_emuls ; do - case " $f " in - *" e$i.o "*) ;; - *) f="$f e$i.o" ;; + for i in $targ_emul $targ_extra_emuls; do + case " $all_emuls " in + *" e${i}.o "*) ;; + *) + all_emuls="$all_emuls e${i}.o" + eval result=\$tdir_$i + test -z "$result" && result=$targ_alias + TDIRS="$TDIRS\\ +tdir_$i=$result" + ;; esac done + fi +done - EMULATION_OFILES="$f" - -else # all_targets is true - EMULATION_OFILES='$(ALL_EMULATIONS)' -fi # all_targets is true +AC_SUBST(EMUL) +AC_SUBST(TDIRS) +if test x${all_targets} = xtrue; then + EMULATION_OFILES='$(ALL_EMULATIONS)' +else + EMULATION_OFILES=$all_emuls +fi AC_SUBST(EMULATION_OFILES) AC_OUTPUT(Makefile, diff --git a/gnu/usr.bin/binutils/ld/emulparams/elf32b4300.sh b/gnu/usr.bin/binutils/ld/emulparams/elf32b4300.sh index b8755889d1f..3ccdad39d04 100644 --- a/gnu/usr.bin/binutils/ld/emulparams/elf32b4300.sh +++ b/gnu/usr.bin/binutils/ld/emulparams/elf32b4300.sh @@ -1,8 +1,8 @@ -SCRIPT_NAME=elf +SCRIPT_NAME=elfmips OUTPUT_FORMAT="elf32-bigmips" BIG_OUTPUT_FORMAT="elf32-bigmips" LITTLE_OUTPUT_FORMAT="elf32-littlemips" -TEXT_START_ADDR=0xa001af20 +TEXT_START_ADDR=0xa0020000 DATA_ADDR=. MAXPAGESIZE=0x40000 OTHER_READONLY_SECTIONS='.reginfo : { *(.reginfo) }' @@ -20,6 +20,7 @@ OTHER_SECTIONS=' .gptab.sbss : { *(.gptab.bss) *(.gptab.sbss) } ' ARCH=mips +MACHINE=4000 TEMPLATE_NAME=elf32 GENERATE_SHLIB_SCRIPT=yes DYNAMIC_LINK=false diff --git a/gnu/usr.bin/binutils/ld/emulparams/elf32bmip.sh b/gnu/usr.bin/binutils/ld/emulparams/elf32bmip.sh index 470497d8fc6..3bc284e6d0c 100644 --- a/gnu/usr.bin/binutils/ld/emulparams/elf32bmip.sh +++ b/gnu/usr.bin/binutils/ld/emulparams/elf32bmip.sh @@ -1,4 +1,4 @@ -SCRIPT_NAME=elf +SCRIPT_NAME=elfmips OUTPUT_FORMAT="elf32-bigmips" BIG_OUTPUT_FORMAT="elf32-bigmips" LITTLE_OUTPUT_FORMAT="elf32-littlemips" @@ -6,16 +6,18 @@ TEXT_START_ADDR=0x0400000 DATA_ADDR=0x10000000 MAXPAGESIZE=0x40000 NONPAGED_TEXT_START_ADDR=0x0400000 +SHLIB_TEXT_START_ADDR=0x5ffe0000 OTHER_READONLY_SECTIONS='.reginfo : { *(.reginfo) }' +OTHER_GOT_SYMBOLS=' + _gp = ALIGN(16) + 0x7ff0; +' OTHER_READWRITE_SECTIONS=' - _gp = . + 0x8000; .lit8 : { *(.lit8) } .lit4 : { *(.lit4) } ' TEXT_START_SYMBOLS='_ftext = . ;' DATA_START_SYMBOLS='_fdata = . ;' OTHER_BSS_SYMBOLS='_fbss = .;' -EXECUTABLE_SYMBOLS='_DYNAMIC_LINK = 0;' OTHER_SECTIONS=' .gptab.sdata : { *(.gptab.data) *(.gptab.sdata) } .gptab.sbss : { *(.gptab.bss) *(.gptab.sbss) } @@ -23,4 +25,4 @@ OTHER_SECTIONS=' ARCH=mips TEMPLATE_NAME=elf32 GENERATE_SHLIB_SCRIPT=yes -DYNAMIC_LINK=false +EMBEDDED=yes diff --git a/gnu/usr.bin/binutils/ld/emulparams/elf32l4300.sh b/gnu/usr.bin/binutils/ld/emulparams/elf32l4300.sh index aeac8a88efb..f3cd085a577 100644 --- a/gnu/usr.bin/binutils/ld/emulparams/elf32l4300.sh +++ b/gnu/usr.bin/binutils/ld/emulparams/elf32l4300.sh @@ -1,8 +1,8 @@ -SCRIPT_NAME=elf +SCRIPT_NAME=elfmips OUTPUT_FORMAT="elf32-littlemips" BIG_OUTPUT_FORMAT="elf32-bigmips" LITTLE_OUTPUT_FORMAT="elf32-littlemips" -TEXT_START_ADDR=0xa001af20 +TEXT_START_ADDR=0xa0020000 DATA_ADDR=. MAXPAGESIZE=0x40000 OTHER_READONLY_SECTIONS='.reginfo : { *(.reginfo) }' @@ -20,6 +20,7 @@ OTHER_SECTIONS=' .gptab.sbss : { *(.gptab.bss) *(.gptab.sbss) } ' ARCH=mips +MACHINE=4000 TEMPLATE_NAME=elf32 GENERATE_SHLIB_SCRIPT=yes DYNAMIC_LINK=false diff --git a/gnu/usr.bin/binutils/ld/emulparams/elf32lmip.sh b/gnu/usr.bin/binutils/ld/emulparams/elf32lmip.sh index bb91f350cce..c892dc17cbb 100644 --- a/gnu/usr.bin/binutils/ld/emulparams/elf32lmip.sh +++ b/gnu/usr.bin/binutils/ld/emulparams/elf32lmip.sh @@ -1,4 +1,4 @@ -SCRIPT_NAME=elf +SCRIPT_NAME=elfmips OUTPUT_FORMAT="elf32-littlemips" BIG_OUTPUT_FORMAT="elf32-bigmips" LITTLE_OUTPUT_FORMAT="elf32-littlemips" @@ -6,16 +6,18 @@ TEXT_START_ADDR=0x0400000 DATA_ADDR=0x10000000 MAXPAGESIZE=0x40000 NONPAGED_TEXT_START_ADDR=0x0400000 +SHLIB_TEXT_START_ADDR=0x5ffe0000 OTHER_READONLY_SECTIONS='.reginfo : { *(.reginfo) }' +OTHER_GOT_SYMBOLS=' + _gp = ALIGN(16) + 0x7ff0; +' OTHER_READWRITE_SECTIONS=' - _gp = . + 0x8000; .lit8 : { *(.lit8) } .lit4 : { *(.lit4) } ' TEXT_START_SYMBOLS='_ftext = . ;' DATA_START_SYMBOLS='_fdata = . ;' OTHER_BSS_SYMBOLS='_fbss = .;' -EXECUTABLE_SYMBOLS='_DYNAMIC_LINK = 0;' OTHER_SECTIONS=' .gptab.sdata : { *(.gptab.data) *(.gptab.sdata) } .gptab.sbss : { *(.gptab.bss) *(.gptab.sbss) } @@ -23,4 +25,4 @@ OTHER_SECTIONS=' ARCH=mips TEMPLATE_NAME=elf32 GENERATE_SHLIB_SCRIPT=yes -DYNAMIC_LINK=false +EMBEDDED=yes diff --git a/gnu/usr.bin/binutils/ld/emulparams/elf32lppc.sh b/gnu/usr.bin/binutils/ld/emulparams/elf32lppc.sh index 50a34af9d5b..65daf8c9eee 100644 --- a/gnu/usr.bin/binutils/ld/emulparams/elf32lppc.sh +++ b/gnu/usr.bin/binutils/ld/emulparams/elf32lppc.sh @@ -2,8 +2,6 @@ TEMPLATE_NAME=elf32 GENERATE_SHLIB_SCRIPT=yes SCRIPT_NAME=elfppc OUTPUT_FORMAT="elf32-powerpcle" -TEXT_START_ADDR=0x0400000 -DATA_ADDR=0x10000000 +TEXT_START_ADDR=0x40000 MAXPAGESIZE=0x40000 -NONPAGED_TEXT_START_ADDR=0x0400000 ARCH=powerpc diff --git a/gnu/usr.bin/binutils/ld/emulparams/elf32ppc.sh b/gnu/usr.bin/binutils/ld/emulparams/elf32ppc.sh index f2b44849fcb..4c1e7b31949 100644 --- a/gnu/usr.bin/binutils/ld/emulparams/elf32ppc.sh +++ b/gnu/usr.bin/binutils/ld/emulparams/elf32ppc.sh @@ -2,8 +2,6 @@ TEMPLATE_NAME=elf32 GENERATE_SHLIB_SCRIPT=yes SCRIPT_NAME=elfppc OUTPUT_FORMAT="elf32-powerpc" -TEXT_START_ADDR=0x0400000 -DATA_ADDR=0x10000000 +TEXT_START_ADDR=0x40000 MAXPAGESIZE=0x40000 -NONPAGED_TEXT_START_ADDR=0x0400000 ARCH=powerpc diff --git a/gnu/usr.bin/binutils/ld/emulparams/elf64_sparc.sh b/gnu/usr.bin/binutils/ld/emulparams/elf64_sparc.sh index 668809bdd50..4a9dc0b767a 100644 --- a/gnu/usr.bin/binutils/ld/emulparams/elf64_sparc.sh +++ b/gnu/usr.bin/binutils/ld/emulparams/elf64_sparc.sh @@ -3,4 +3,4 @@ OUTPUT_FORMAT="elf64-sparc" TEXT_START_ADDR=0x100200 MAXPAGESIZE=0x100000 NONPAGED_TEXT_START_ADDR=0x100200 -ARCH=sparc +ARCH="sparc:v9" diff --git a/gnu/usr.bin/binutils/ld/emulparams/elf_i386.sh b/gnu/usr.bin/binutils/ld/emulparams/elf_i386.sh index b841d9cd189..b11b7d71886 100644 --- a/gnu/usr.bin/binutils/ld/emulparams/elf_i386.sh +++ b/gnu/usr.bin/binutils/ld/emulparams/elf_i386.sh @@ -1,8 +1,8 @@ SCRIPT_NAME=elf OUTPUT_FORMAT="elf32-i386" -TEXT_START_ADDR=0x08000000 +TEXT_START_ADDR=0x08048000 MAXPAGESIZE=0x1000 -NONPAGED_TEXT_START_ADDR=0x08000000 +NONPAGED_TEXT_START_ADDR=0x08048000 ARCH=i386 NOP=0x9090 TEMPLATE_NAME=elf32 diff --git a/gnu/usr.bin/binutils/ld/emulparams/mipsidt.sh b/gnu/usr.bin/binutils/ld/emulparams/mipsidt.sh index cb2d87d3322..63176f5fdea 100644 --- a/gnu/usr.bin/binutils/ld/emulparams/mipsidt.sh +++ b/gnu/usr.bin/binutils/ld/emulparams/mipsidt.sh @@ -8,3 +8,4 @@ ENTRY=start TEXT_START_ADDR=0xa0012000 DATA_ADDR=. TEMPLATE_NAME=mipsecoff +EMBEDDED=yes diff --git a/gnu/usr.bin/binutils/ld/emulparams/mipsidtl.sh b/gnu/usr.bin/binutils/ld/emulparams/mipsidtl.sh index 57e00261df8..02279ded635 100644 --- a/gnu/usr.bin/binutils/ld/emulparams/mipsidtl.sh +++ b/gnu/usr.bin/binutils/ld/emulparams/mipsidtl.sh @@ -8,3 +8,4 @@ ENTRY=start TEXT_START_ADDR=0xa0012000 DATA_ADDR=. TEMPLATE_NAME=mipsecoff +EMBEDDED=yes diff --git a/gnu/usr.bin/binutils/ld/emulparams/z8002.sh b/gnu/usr.bin/binutils/ld/emulparams/z8002.sh index 711b8f38727..299b5f5a45d 100644 --- a/gnu/usr.bin/binutils/ld/emulparams/z8002.sh +++ b/gnu/usr.bin/binutils/ld/emulparams/z8002.sh @@ -3,4 +3,4 @@ OUTPUT_FORMAT="coff-z8k" OUTPUT_ARCH="z8002" TEXT_START_ADDR=0x0 TARGET_PAGE_SIZE=128 -ARCH=z8k +ARCH=z8002 diff --git a/gnu/usr.bin/binutils/ld/emultempl/aix.em b/gnu/usr.bin/binutils/ld/emultempl/aix.em index c40b86c2953..42aa1e162e0 100644 --- a/gnu/usr.bin/binutils/ld/emultempl/aix.em +++ b/gnu/usr.bin/binutils/ld/emultempl/aix.em @@ -75,6 +75,9 @@ static unsigned short modtype = ('1' << 8) | 'L'; permitted). */ static int textro; +/* Whether to implement Unix like linker semantics. */ +static int unix_ld; + /* Structure used to hold import file list. */ struct filelist @@ -137,6 +140,7 @@ gld${EMULATION_NAME}_parse_args (argc, argv) #define OPTION_PD (OPTION_NOSTRCMPCT + 1) #define OPTION_PT (OPTION_PD + 1) #define OPTION_STRCMPCT (OPTION_PT + 1) +#define OPTION_UNIX (OPTION_STRCMPCT + 1) static struct option longopts[] = { {"basis", no_argument, NULL, OPTION_IGNORE}, @@ -164,6 +168,7 @@ gld${EMULATION_NAME}_parse_args (argc, argv) {"bmodtype", required_argument, NULL, OPTION_MODTYPE}, {"bnoautoimp", no_argument, NULL, OPTION_NOAUTOIMP}, {"bnodelcsect", no_argument, NULL, OPTION_IGNORE}, + {"bnoentry", no_argument, NULL, OPTION_IGNORE}, {"bnogc", no_argument, &gc, 0}, {"bnso", no_argument, NULL, OPTION_NOAUTOIMP}, {"bnostrcmpct", no_argument, NULL, OPTION_NOSTRCMPCT}, @@ -177,6 +182,7 @@ gld${EMULATION_NAME}_parse_args (argc, argv) {"bstrcmpct", no_argument, NULL, OPTION_STRCMPCT}, {"btextro", no_argument, &textro, 1}, {"static", no_argument, NULL, OPTION_NOAUTOIMP}, + {"unix", no_argument, NULL, OPTION_UNIX}, {NULL, no_argument, NULL, 0} }; @@ -333,7 +339,7 @@ gld${EMULATION_NAME}_parse_args (argc, argv) break; case OPTION_NOSTRCMPCT: - config.traditional_format = true; + link_info.traditional_format = true; break; case OPTION_PD: @@ -382,13 +388,56 @@ gld${EMULATION_NAME}_parse_args (argc, argv) break; case OPTION_STRCMPCT: - config.traditional_format = false; + link_info.traditional_format = false; + break; + + case OPTION_UNIX: + unix_ld = true; break; } return 1; } +/* This is called when an input file can not be recognized as a BFD + object or an archive. If the file starts with #!, we must treat it + as an import file. This is for AIX compatibility. */ + +static boolean +gld${EMULATION_NAME}_unrecognized_file (entry) + lang_input_statement_type *entry; +{ + FILE *e; + boolean ret; + + e = fopen (entry->filename, FOPEN_RT); + if (e == NULL) + return false; + + ret = false; + + if (getc (e) == '#' && getc (e) == '!') + { + struct filelist *n; + struct filelist **flpp; + + n = (struct filelist *) xmalloc (sizeof (struct filelist)); + n->next = NULL; + n->name = entry->filename; + flpp = &import_files; + while (*flpp != NULL) + flpp = &(*flpp)->next; + *flpp = n; + + ret = true; + entry->loaded = true; + } + + fclose (e); + + return ret; +} + /* This is called after the input files have been opened. */ static void @@ -400,9 +449,11 @@ gld${EMULATION_NAME}_after_open () /* Call ldctor_build_sets, after pretending that this is a relocateable link. We do this because AIX requires relocation entries for all references to symbols, even in a final - executable. */ + executable. Of course, we only want to do this if we are + producing an XCOFF output file. */ r = link_info.relocateable; - link_info.relocateable = true; + if (strstr (bfd_get_target (output_bfd), "xcoff") != NULL) + link_info.relocateable = true; ldctor_build_sets (); link_info.relocateable = r; @@ -494,9 +545,10 @@ gld${EMULATION_NAME}_before_allocation () if (! bfd_xcoff_size_dynamic_sections (output_bfd, &link_info, libpath, entry_symbol, file_align, maxstack, maxdata, - gc ? true : false, + gc && ! unix_ld ? true : false, modtype, textro ? true : false, + unix_ld, special_sections)) einfo ("%P%F: failed to set dynamic section sizes: %E\n"); @@ -626,7 +678,7 @@ gld${EMULATION_NAME}_read_file (filename, import) o = (struct obstack *) xmalloc (sizeof (struct obstack)); obstack_specify_allocation (o, 0, 0, xmalloc, gld${EMULATION_NAME}_free); - f = fopen (filename, "r"); + f = fopen (filename, FOPEN_RT); if (f == NULL) { bfd_set_error (bfd_error_system_call); @@ -692,7 +744,7 @@ gld${EMULATION_NAME}_read_file (filename, import) (void) obstack_finish (o); keep = true; imppath = s; - impfile = NULL; + file = NULL; while (! isspace ((unsigned char) *s) && *s != '(' && *s != '\0') { if (*s == '/') @@ -986,5 +1038,6 @@ struct ld_emulation_xfer_struct ld_${EMULATION_NAME}_emulation = 0, /* place_orphan */ 0, /* set_symbols */ gld${EMULATION_NAME}_parse_args, + gld${EMULATION_NAME}_unrecognized_file }; EOF diff --git a/gnu/usr.bin/binutils/ld/emultempl/elf32.em b/gnu/usr.bin/binutils/ld/emultempl/elf32.em index 8b2f6259748..45cab9ffb99 100644 --- a/gnu/usr.bin/binutils/ld/emultempl/elf32.em +++ b/gnu/usr.bin/binutils/ld/emultempl/elf32.em @@ -4,7 +4,7 @@ cat >e${EMULATION_NAME}.c <<EOF /* This file is is generated by a shell script. DO NOT EDIT! */ /* 32 bit ELF emulation code for ${EMULATION_NAME} - Copyright (C) 1991, 1993, 1994, 1995 Free Software Foundation, Inc. + Copyright (C) 1991, 93, 94, 95, 1996 Free Software Foundation, Inc. Written by Steve Chamberlain <sac@cygnus.com> ELF support by Ian Lance Taylor <ian@cygnus.com> @@ -66,7 +66,7 @@ static char *gld${EMULATION_NAME}_get_script PARAMS ((int *isfile)); static void gld${EMULATION_NAME}_before_parse() { - ldfile_output_architecture = bfd_arch_${ARCH}; + ldfile_output_architecture = bfd_arch_`echo ${ARCH} | sed -e 's/:.*//'`; config.dynamic_link = ${DYNAMIC_LINK-true}; } @@ -131,6 +131,95 @@ gld${EMULATION_NAME}_open_dynamic_archive (arch, search, entry) return true; } +EOF +if [ "x${host}" = "x${target}" ] ; then + if [ "x${DEFAULT_EMULATION}" = "x${EMULATION_NAME}" ] ; then +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 *)); + +static boolean +gld${EMULATION_NAME}_check_ld_so_conf (name) + const char *name; +{ + 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); +} + +EOF + fi +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. */ @@ -199,12 +288,14 @@ gld${EMULATION_NAME}_after_open () continue; } EOF -if [ "x${host_alias}" = "x${target_alias}" ] ; then +if [ "x${host}" = "x${target}" ] ; then + if [ "x${DEFAULT_EMULATION}" = "x${EMULATION_NAME}" ] ; then cat >>e${EMULATION_NAME}.c <<EOF lib_path = (const char *) getenv ("LD_LIBRARY_PATH"); if (gld${EMULATION_NAME}_search_needed (lib_path, l->name)) continue; EOF + fi fi cat >>e${EMULATION_NAME}.c <<EOF len = strlen (l->name); @@ -222,6 +313,16 @@ cat >>e${EMULATION_NAME}.c <<EOF } if (search != NULL) continue; +EOF +if [ "x${host}" = "x${target}" ] ; then + if [ "x${DEFAULT_EMULATION}" = "x${EMULATION_NAME}" ] ; then +cat >>e${EMULATION_NAME}.c <<EOF + if (gld${EMULATION_NAME}_check_ld_so_conf (l->name)) + continue; +EOF + fi +fi +cat >>e${EMULATION_NAME}.c <<EOF einfo ("%P: warning: %s, needed by %B, not found\n", l->name, l->by); @@ -334,19 +435,42 @@ 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; - else if (s->search_dirs_flag - && s->filename != NULL - && strchr (global_needed->name, '/') == NULL) + { + 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; + { + global_found = true; + return; + } } } @@ -357,21 +481,58 @@ 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) + if (s->the_bfd == NULL) + return; + + if (bfd_stat (s->the_bfd, &st) != 0) { - struct stat st; + einfo ("%P:%B: bfd_stat failed: %E\n", s->the_bfd); + return; + } - if (bfd_stat (s->the_bfd, &st) != 0) - einfo ("%P:%B: bfd_stat failed: %E\n", s->the_bfd); - else - { - if (st.st_dev == global_stat.st_dev - && st.st_ino == global_stat.st_ino) - global_found = true; - } + 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); } /* This is called after the sections have been attached to output @@ -536,7 +697,7 @@ gld${EMULATION_NAME}_find_exp_assignment (exp) break; case etree_trinary: - gld${EMULATION_NAME}_find_exp_assignment (exp->trinary.lhs); + 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; diff --git a/gnu/usr.bin/binutils/ld/emultempl/generic.em b/gnu/usr.bin/binutils/ld/emultempl/generic.em index 6b8e6758e31..1c0c8eb214d 100644 --- a/gnu/usr.bin/binutils/ld/emultempl/generic.em +++ b/gnu/usr.bin/binutils/ld/emultempl/generic.em @@ -42,7 +42,7 @@ static void gld${EMULATION_NAME}_before_parse() { #ifndef TARGET_ /* I.e., if not generic. */ - ldfile_output_architecture = bfd_arch_${ARCH}; + ldfile_set_output_arch ("`echo ${ARCH}`"); #endif /* not TARGET_ */ } diff --git a/gnu/usr.bin/binutils/ld/emultempl/linux.em b/gnu/usr.bin/binutils/ld/emultempl/linux.em index 1f9d37eec2b..6860c3ffaf2 100644 --- a/gnu/usr.bin/binutils/ld/emultempl/linux.em +++ b/gnu/usr.bin/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 Free Software Foundation, Inc. + Copyright (C) 1991, 1993, 1994, 1995, 1996 Free Software Foundation, Inc. Written by Steve Chamberlain <sac@cygnus.com> Linux support by Eric Youngdale <ericy@cais.cais.com> @@ -125,7 +125,7 @@ gld${EMULATION_NAME}_before_allocation () /* Let the backend work out the sizes of any sections required by dynamic linking. */ - if (! bfd_linux_size_dynamic_sections (output_bfd, &link_info)) + if (! bfd_${EMULATION_NAME}_size_dynamic_sections (output_bfd, &link_info)) einfo ("%P%F: failed to set dynamic section sizes: %E\n"); } diff --git a/gnu/usr.bin/binutils/ld/emultempl/lnk960.em b/gnu/usr.bin/binutils/ld/emultempl/lnk960.em index 8f6ad40c6c9..066d46bb328 100644 --- a/gnu/usr.bin/binutils/ld/emultempl/lnk960.em +++ b/gnu/usr.bin/binutils/ld/emultempl/lnk960.em @@ -200,6 +200,8 @@ machine_table[] = { bfd_mach_i960_ca ,"CA" }, { bfd_mach_i960_ka_sa ,"KA" }, { bfd_mach_i960_ka_sa ,"SA" }, + { bfd_mach_i960_jx ,"JX" }, + { bfd_mach_i960_hx ,"HX" }, { bfd_mach_i960_core ,"core" }, { bfd_mach_i960_kb_sb ,"kb" }, @@ -209,6 +211,8 @@ machine_table[] = { bfd_mach_i960_ca ,"ca" }, { bfd_mach_i960_ka_sa ,"ka" }, { bfd_mach_i960_ka_sa ,"sa" }, + { bfd_mach_i960_jx ,"jx" }, + { bfd_mach_i960_hx ,"hx" }, { 0, (char *) NULL } }; diff --git a/gnu/usr.bin/binutils/ld/emultempl/pe.em b/gnu/usr.bin/binutils/ld/emultempl/pe.em index 3e40d78ddb0..55257390890 100644 --- a/gnu/usr.bin/binutils/ld/emultempl/pe.em +++ b/gnu/usr.bin/binutils/ld/emultempl/pe.em @@ -25,7 +25,6 @@ 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 "bfd.h" #include "sysdep.h" #include "bfdlink.h" @@ -46,9 +45,23 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #define TARGET_IS_${EMULATION_NAME} +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 char *gld_${EMULATION_NAME}_get_script PARAMS ((int *isfile)); - +static void gld_${EMULATION_NAME}_before_allocation PARAMS ((void)); +static boolean gld${EMULATION_NAME}_place_orphan + PARAMS ((lang_input_statement_type *, asection *)); +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 struct internal_extra_pe_aouthdr pe; static int dll; @@ -58,7 +71,8 @@ gld_${EMULATION_NAME}_before_parse() { ldfile_output_architecture = bfd_arch_${ARCH}; } - + +/* PE format extra command line options. */ /* Used for setting flags in the PE header. */ #define OPTION_BASE_FILE (300 + 1) @@ -76,7 +90,7 @@ gld_${EMULATION_NAME}_before_parse() #define OPTION_SUBSYSTEM (OPTION_STACK + 1) #define OPTION_HEAP (OPTION_SUBSYSTEM + 1) - static struct option longopts[] = { +static struct option longopts[] = { /* PE options */ {"base-file", required_argument, NULL, OPTION_BASE_FILE}, {"dll", no_argument, NULL, OPTION_DLL}, @@ -99,8 +113,6 @@ gld_${EMULATION_NAME}_before_parse() /* PE/WIN32; added routines to get the subsystem type, heap and/or stack parameters which may be input from the command line */ - - typedef struct { void *ptr; int size; @@ -194,7 +206,7 @@ set_pe_value (name) { char *end; - set_pe_name (name, strtoul (optarg, &end, 16)); + set_pe_name (name, strtoul (optarg, &end, 0)); if (end == optarg) { einfo ("%P%F: invalid hex number for PE parameter '%s'\n", optarg); @@ -266,10 +278,10 @@ gld_${EMULATION_NAME}_parse_args(argc, argv) /* PE options */ case OPTION_HEAP: - set_pe_stack_heap ("__heap_reserve__", "__heap_commit__"); + set_pe_stack_heap ("__size_of_heap_reserve__", "__size_of_heap_commit__"); break; case OPTION_STACK: - set_pe_stack_heap ("__stack_reserve__", "__stack_commit__"); + set_pe_stack_heap ("__size_of_stack_reserve__", "__size_of_stack_commit__"); break; case OPTION_SUBSYSTEM: set_pe_subsystem (); @@ -307,9 +319,9 @@ gld_${EMULATION_NAME}_parse_args(argc, argv) } return 1; } - + 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. */ @@ -321,9 +333,10 @@ gld_${EMULATION_NAME}_set_symbols() ? NT_DLL_IMAGE_BASE : NT_EXE_IMAGE_BASE; /* Glue the assignments into the abs section */ - save=stat_ptr; + save = stat_ptr; stat_ptr = &(abs_output_section->children); + for (j = 0; init[j].ptr; j++) { long val = init[j].value; @@ -360,12 +373,13 @@ gld_${EMULATION_NAME}_after_open() pe_data(output_bfd)->dll = init[DLLOFF].value; } + +/* Callback functions for qsort in sort_sections. */ -/* Callback function for qsort in sort_sections. */ - -static int sfunc (a, b) -void *a; -void *b; +static int +sort_by_file_name (a, b) + void *a; + void *b; { lang_statement_union_type **ra = a; lang_statement_union_type **rb = b; @@ -373,8 +387,64 @@ void *b; (*rb)->input_section.ifile->filename); } -/* Sort the input sections of archives into filename order. */ - +static int +sort_by_section_name (a, b) + void *a; + void *b; +{ + lang_statement_union_type **ra = a; + lang_statement_union_type **rb = b; + return strcmp ((*ra)->input_section.section->name, + (*rb)->input_section.section->name); +} + +/* Subroutine of sort_sections to a contiguous subset of a list of sections. + NEXT_AFTER is the element after the last one to sort. + The result is a pointer to the last element's "next" pointer. */ + +static lang_statement_union_type ** +sort_sections_1 (startptr, next_after, count, sort_func) + lang_statement_union_type **startptr,*next_after; + int count; + int (*sort_func) (); +{ + lang_statement_union_type **vec; + lang_statement_union_type *p; + int i; + + if (count == 0) + return startptr; + + vec = (lang_statement_union_type **) + alloca (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; + return &(vec[i]->header.next); +} + +/* Sort the .idata\$foo input sections of archives into filename order. + The reason is so dlltool can arrange to have the pe dll import information + generated correctly - the head of the list goes into dh.o, the tail into + dt.o, and the guts into ds[nnnn].o. Note that this is only needed for the + .idata section. + FIXME: This may no longer be necessary with grouped sections. Instead of + sorting on dh.o, ds[nnnn].o, dt.o, one could, for example, have dh.o use + .idata\$4h, have ds[nnnn].o use .idata\$4s[nnnn], and have dt.o use .idata\$4t. + This would have to be elaborated upon to handle multiple dll's + [assuming such an eloboration is possible of course]. + + We also sort sections in '\$' wild statements. These are created by the + place_orphans routine to implement grouped sections. */ + static void sort_sections (s) lang_statement_union_type *s; @@ -389,51 +459,64 @@ sort_sections (s) { lang_statement_union_type **p = &s->wild_statement.children.head; - /* Sort any children in the same archive. Run through all - the children of this wild statement, when an - input_section in an archive is found, scan forward to - find all input_sections which are in the same archive. - Sort them by their filename and then re-thread the - pointer chain. */ + /* Is this the .idata section? */ + if (s->wild_statement.section_name != NULL + && strncmp (s->wild_statement.section_name, ".idata", 6) == 0) + { + /* Sort any children in the same archive. Run through all + the children of this wild statement, when an + input_section in an archive is found, scan forward to + find all input_sections which are in the same archive. + Sort them by their filename and then re-thread the + pointer chain. */ + + while (*p) + { + lang_statement_union_type *start = *p; + if (start->header.type != lang_input_section_enum + || !start->input_section.ifile->the_bfd->my_archive) + p = &(start->header.next); + else + { + lang_statement_union_type *end; + int count; + + for (end = start, count = 0; + end && end->header.type == lang_input_section_enum + && (end->input_section.ifile->the_bfd->my_archive + == start->input_section.ifile->the_bfd->my_archive); + end = end->next) + count++; + + p = sort_sections_1 (p, end, count, sort_by_file_name); + } + } + break; + } - while (*p) + /* If this is a collection of grouped sections, sort them. + The linker script must explicitly mention "*(.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) { - 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 + char *q = strchr (s->wild_statement.section_name, '\$'); + + if (q && q[1] == 0) { - lang_statement_union_type **vec; lang_statement_union_type *end; - lang_statement_union_type *np; int count; - int i; - - for (end = start, count = 0; - end && end->header.type == lang_input_section_enum - && (end->input_section.ifile->the_bfd->my_archive - == start->input_section.ifile->the_bfd->my_archive); - end = end->next) - count++; - - np = end; - - vec = (lang_statement_union_type **) - alloca (count * sizeof (lang_statement_union_type *)); - - for (end = start, i = 0; i < count; i++, end = end->next) - vec[i] = end; - - qsort (vec, count, sizeof (vec[0]), sfunc); - /* Fill in the next pointers again. */ - *p = vec[0]; - for (i = 0; i < count - 1; i++) - vec[i]->header.next = vec[i + 1]; - vec[i]->header.next = np; - p = &(vec[i]->header.next); + for (end = *p, count = 0; end; end = end->next) + { + if (end->header.type != lang_input_section_enum) + abort (); + count++; + } + (void) sort_sections_1 (p, end, count, sort_by_section_name); } + break; } } break; @@ -460,9 +543,95 @@ gld_${EMULATION_NAME}_before_allocation() ppc_allocate_toc_section (&link_info); #endif - sort_sections (*stat_ptr); + sort_sections (stat_ptr->head); } + +/* Place an orphan section. We use this to put sections with a '\$' in them + into the right place. Any section with a '\$' in them (e.g. .text\$foo) + gets mapped to the output section with everything from the '\$' on stripped + (e.g. .text). + See the Microsoft Portable Executable and Common Object File Format + Specification 4.1, section 4.2, Grouped Sections. */ + +/*ARGSUSED*/ +static boolean +gld${EMULATION_NAME}_place_orphan (file, s) + lang_input_statement_type *file; + asection *s; +{ + const char *secname; + char *output_secname, *ps; + lang_output_section_statement_type *os; + lang_statement_list_type *ptr; + lang_statement_union_type *l; + + if ((s->flags & SEC_ALLOC) == 0) + return false; + + /* Don't process grouped sections unless doing a final link. + If they're marked as COMDAT sections, we don't want .text\$foo to + end up in .text and then have .text disappear because it's marked + link-once-discard. */ + if (link_info.relocateable) + return false; + + secname = bfd_get_section_name (s->owner, s); + + /* Everything from the '\$' on gets deleted so don't allow '\$' as the + first character. */ + if (*secname == '\$') + einfo ("%P%F: section %s has '\$' as first character\n", secname); + if (strchr (secname + 1, '\$') == NULL) + return false; + + /* Look up the output section. The Microsoft specs say sections names in + image files never contain a '\$'. Fortunately, lang_..._lookup creates + the section if it doesn't exist. */ + output_secname = buystring (secname); + ps = strchr (output_secname + 1, '\$'); + *ps = 0; + os = lang_output_section_statement_lookup (output_secname); + + /* Find the '\$' wild statement for this section. We currently require the + linker script to explicitly mention "*(.foo\$)". + FIXME: ppcpe.sc has .CRT\$foo in the .rdata section. According to the + Microsoft docs this isn't correct so it's not (currently) handled. */ + + ps[0] = '\$'; + ps[1] = 0; + for (l = os->children.head; l; l = l->next) + { + if (l->header.type == lang_wild_statement_enum + && strcmp (l->wild_statement.section_name, output_secname) == 0) + break; + } + ps[0] = 0; + if (l == NULL) +#if 1 + einfo ("%P%F: *(%s\$) missing from linker script\n", output_secname); +#else /* FIXME: This block is untried. It exists to convey the intent, + should one decide to not require *(.foo\$) to appear in the linker + script. */ + { + lang_wild_statement_type *new = new_stat (lang_wild_statement, + &os->children); + new->section_name = xmalloc (strlen (output_secname) + 2); + sprintf (new->section_name, "%s\$", output_secname); + new->filename = NULL; + lang_list_init (&new->children); + l = new; + } +#endif + + /* Link the input section in and we're done for now. + The sections still have to be sorted, but that has to wait until + all such sections have been processed by us. The sorting is done by + sort_sections. */ + wild_doit (&l->wild_statement.children, s, os, file); + return true; +} + static char * gld_${EMULATION_NAME}_get_script(isfile) int *isfile; @@ -492,7 +661,6 @@ echo '; }' >> e${EMULATION_NAME} cat >>e${EMULATION_NAME}.c <<EOF - struct ld_emulation_xfer_struct ld_${EMULATION_NAME}_emulation = { gld_${EMULATION_NAME}_before_parse, @@ -510,9 +678,8 @@ struct ld_emulation_xfer_struct ld_${EMULATION_NAME}_emulation = NULL, /* finish */ NULL, /* create output section statements */ NULL, /* open dynamic archive */ - NULL, /* place orphan */ + gld${EMULATION_NAME}_place_orphan, gld_${EMULATION_NAME}_set_symbols, gld_${EMULATION_NAME}_parse_args }; EOF - diff --git a/gnu/usr.bin/binutils/ld/emultempl/sunos.em b/gnu/usr.bin/binutils/ld/emultempl/sunos.em index abcc9739279..5f36bd1ae37 100644 --- a/gnu/usr.bin/binutils/ld/emultempl/sunos.em +++ b/gnu/usr.bin/binutils/ld/emultempl/sunos.em @@ -32,6 +32,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include "bfd.h" #include "sysdep.h" #include "bfdlink.h" +#include "libiberty.h" #include "ld.h" #include "ldmain.h" @@ -57,6 +58,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #endif static void gld${EMULATION_NAME}_before_parse PARAMS ((void)); +static void gld${EMULATION_NAME}_set_symbols PARAMS ((void)); static void gld${EMULATION_NAME}_create_output_section_statements PARAMS ((void)); static void gld${EMULATION_NAME}_find_so @@ -87,6 +89,46 @@ gld${EMULATION_NAME}_before_parse() config.dynamic_link = true; } +/* This is called after the command line arguments have been parsed, + but before the linker script has been read. If this is a native + linker, we add the directories in LD_LIBRARY_PATH to the search + list. */ + +static void +gld${EMULATION_NAME}_set_symbols () +{ +EOF +if [ "x${host}" = "x${target}" ] ; then + if [ "x${DEFAULT_EMULATION}" = "x${EMULATION_NAME}" ] ; then +cat >>e${EMULATION_NAME}.c <<EOF + const char *env; + + env = (const char *) getenv ("LD_LIBRARY_PATH"); + if (env != NULL) + { + char *l; + + l = xstrdup (env); + while (1) + { + char *c; + + c = strchr (l, ':'); + if (c != NULL) + *c++ = '\0'; + if (*l != '\0') + ldfile_add_library_path (l, false); + if (c == NULL) + break; + l = c; + } + } +EOF + fi +fi +cat >>e${EMULATION_NAME}.c <<EOF +} + /* Despite the name, we use this routine to search for dynamic libraries. On SunOS this requires a directory search. We need to find the .so file with the highest version number. The user may @@ -404,12 +446,14 @@ gld${EMULATION_NAME}_after_open () continue; } EOF -if [ "x${host_alias}" = "x${target_alias}" ] ; then +if [ "x${host}" = "x${target}" ] ; then + if [ "x${DEFAULT_EMULATION}" = "x${EMULATION_NAME}" ] ; then cat >>e${EMULATION_NAME}.c <<EOF lib_path = (const char *) getenv ("LD_LIBRARY_PATH"); if (gld${EMULATION_NAME}_search_needed (lib_path, lname)) continue; EOF + fi fi cat >>e${EMULATION_NAME}.c <<EOF if (command_line.rpath != NULL) @@ -617,7 +661,8 @@ gld${EMULATION_NAME}_before_allocation () if (h->type == bfd_link_hash_undefined && h->u.undef.abfd != NULL && (h->u.undef.abfd->flags & DYNAMIC) == 0 - && strcmp (h->root.string, "__DYNAMIC") != 0) + && strcmp (h->root.string, "__DYNAMIC") != 0 + && strcmp (h->root.string, "__GLOBAL_OFFSET_TABLE_") != 0) { find_assign = h->root.string; found_assign = false; @@ -964,6 +1009,8 @@ struct ld_emulation_xfer_struct ld_${EMULATION_NAME}_emulation = "${OUTPUT_FORMAT}", NULL, /* finish */ gld${EMULATION_NAME}_create_output_section_statements, - NULL /* open_dynamic_library */ + NULL, /* open_dynamic_library */ + NULL, /* place_orphan */ + gld${EMULATION_NAME}_set_symbols }; EOF diff --git a/gnu/usr.bin/binutils/ld/genscripts.sh b/gnu/usr.bin/binutils/ld/genscripts.sh index 1d2b8660b28..eea99cf6184 100644 --- a/gnu/usr.bin/binutils/ld/genscripts.sh +++ b/gnu/usr.bin/binutils/ld/genscripts.sh @@ -1,21 +1,23 @@ #!/bin/sh # genscripts.sh - generate the ld-emulation-target specific files # -# Usage: genscripts.sh srcdir libdir host_alias target_alias \ -# default_emulation this_emulation +# Usage: genscripts.sh srcdir libdir host target target_alias \ +# default_emulation native_lib_dirs this_emulation tool_dir # # Sample usage: # genscripts.sh /djm/ld-devo/devo/ld /usr/local/lib sparc-sun-sunos4.1.3 \ -# sparc-sun-sunos4.1.3 sun4 sun3 +# sparc-sun-sunos4.1.3 sparc-sun-sunos4.1.3 sun4 "" sun3 sparc-sun-sunos4.1.3 # produces sun3.x sun3.xbn sun3.xn sun3.xr sun3.xu em_sun3.c srcdir=$1 libdir=$2 -host_alias=$3 -target_alias=$4 -DEFAULT_EMULATION=$5 -NATIVE_LIB_DIRS=$6 -EMULATION_NAME=$7 +host=$3 +target=$4 +target_alias=$5 +DEFAULT_EMULATION=$6 +NATIVE_LIB_DIRS=$7 +EMULATION_NAME=$8 +tool_lib=`echo ${libdir} | sed -e 's|/lib$||'`/${9-$target_alias}/lib # Include the emulation-specific parameters: . ${srcdir}/emulparams/${EMULATION_NAME}.sh @@ -34,7 +36,7 @@ fi # To force a logically empty LIB_PATH, do LIBPATH=":". if [ "x${LIB_PATH}" = "x" ] ; then - if [ "x${host_alias}" = "x${target_alias}" ] ; then + if [ "x${host}" = "x${target}" ] ; then if [ "x${DEFAULT_EMULATION}" = "x${EMULATION_NAME}" ] ; then # Native. LIB_PATH=/lib:/usr/lib @@ -58,7 +60,7 @@ if [ "x${LIB_PATH}" = "x" ] ; then fi # Always search $(tooldir)/lib, aka /usr/local/TARGET/lib. -LIB_PATH=${LIB_PATH}:`echo ${libdir} | sed -e s'|/lib$||'`/${target_alias}/lib +LIB_PATH=${LIB_PATH}:${tool_lib} LIB_SEARCH_DIRS=`echo ${LIB_PATH} | tr ':' ' ' | sed -e 's/\([^ ][^ ]*\)/SEARCH_DIR(\1);/g'` diff --git a/gnu/usr.bin/binutils/ld/ld.1 b/gnu/usr.bin/binutils/ld/ld.1 index a12596e2230..ef3633ee5fc 100644 --- a/gnu/usr.bin/binutils/ld/ld.1 +++ b/gnu/usr.bin/binutils/ld/ld.1 @@ -1,4 +1,4 @@ -.\" Copyright (c) 1991, 92, 93, 94, 1995 Free Software Foundation +.\" Copyright (c) 1991, 92, 93, 94, 95, 1996 Free Software Foundation .\" See section COPYING for conditions for redistribution .TH ld 1 "17 August 1992" "cygnus support" "GNU Development Tools" .de BP @@ -33,6 +33,7 @@ ld \- the GNU linker .RB "[\|" "\-c\ "\c .I commandfile\c \&\|] +.RB "[\|" \-\-cref "\|]" .RB "[\|" \-d | \-dc | \-dp\c \|] .br @@ -45,6 +46,8 @@ ld \- the GNU linker .I entry\c \&\|] .RB "[\|" \-embedded\-relocs "\|]" +.RB "[\|" \-E "\|]" +.RB "[\|" \-export\-dynamic "\|]" .RB "[\|" \-F "\|]" .RB "[\|" "\-F\ "\c .I format\c @@ -118,8 +121,13 @@ ld \- the GNU linker .RB "[\|" \-\-version "\|]" .RB "[\|" \-warn\-common "\|]" .RB "[\|" \-warn\-constructors "\|]" +.RB "[\|" \-warn\-multiple\-gp "\|]" .RB "[\|" \-warn\-once "\|]" .RB "[\|" \-\-whole\-archive "\|]" +.RB "[\|" \-\-no\-whole\-archive "\|]" +.RB "[\|" "\-\-wrap\ "\c +.I symbol\c +\&\|] .RB "[\|" \-X "\|]" .RB "[\|" \-x "\|]" .ad b @@ -402,6 +410,12 @@ line by bracketing it between `\|\c \|' characters. .TP +.B \-\-cref +Output a cross reference table. If a linker map file is being +generated, the cross reference table is printed to the map file. +Otherwise, it is printed on the standard output. + +.TP .B \-d .TP .B \-dc @@ -458,6 +472,15 @@ was statically initialized to pointer values. See the code in testsuite/ld-empic for details. .TP +.B \-E +.TP +.B \-export\-dynamic +When creating an ELF file, add all symbols to the dynamic symbol table. +Normally, the dynamic symbol table contains only symbols which are used +by a dynamic object. This option is needed for some uses of +.I dlopen. + +.TP .B \-F .TP .BI "-F" "format" @@ -722,8 +745,9 @@ option may also be used on SunOS. By default, on SunOS, the linker will form a runtime search patch out of all the .B \-L options it is given. If a -.B \-rpath option is used, the runtime search path -will be formed exclusively using the +.B \-rpath +option is used, the runtime search path will be formed exclusively +using the .B \-rpath options, ignoring the @@ -898,17 +922,42 @@ few object file formats. For formats like COFF or ELF, the linker can not detect the use of global constructors. .TP +.B \-warn\-multiple\-gp +Warn if the output file requires multiple global-pointer values. This +option is only meaningful for certain processors, such as the Alpha. + +.TP .B \-warn\-once Only warn once for each undefined symbol, rather than once per module which refers to it. .TP .B \-\-whole\-archive -For each archive mentioned on the command line, include every object -file in the archive in the link, rather than searching the archive for -the required object files. This is normally used to turn an archive -file into a shared library, forcing every object to be included in the -resulting shared library. +For each archive mentioned on the command line after the +.B \-\-whole\-archive +option, include every object file in the archive in the link, rather +than searching the archive for the required object files. This is +normally used to turn an archive file into a shared library, forcing +every object to be included in the resulting shared library. + +.TP +.B \-\-no\-whole\-archive +Turn off the effect of the +.B \-\-whole\-archive +option for archives which appear later on the command line. + +.TP +.BI "--wrap " "symbol" +Use a wrapper function for +.I symbol. +Any undefined reference to +.I symbol +will be resolved to +.BI "__wrap_" "symbol". +Any undefined reference to +.BI "__real_" "symbol" +will be resolved to +.I symbol. .TP .B \-X diff --git a/gnu/usr.bin/binutils/ld/ld.h b/gnu/usr.bin/binutils/ld/ld.h index 855b673fd68..1a06d2baecf 100644 --- a/gnu/usr.bin/binutils/ld/ld.h +++ b/gnu/usr.bin/binutils/ld/ld.h @@ -28,6 +28,10 @@ /* Look in this variable for a target format */ #define TARGET_ENVIRON "GNUTARGET" +/* Input sections which are put in a section of this name are actually + discarded. */ +#define DISCARD_SECTION_NAME "/DISCARD/" + /* Extra information we hold on sections */ typedef struct user_section_struct { @@ -80,6 +84,9 @@ typedef struct /* If true, build MIPS embedded PIC relocation tables in the output file. */ boolean embedded_relocs; + + /* If true, force generation of a file with a .exe file. */ + boolean force_exe_suffix; } args_type; extern args_type command_line; @@ -92,9 +99,6 @@ typedef struct boolean magic_demand_paged; boolean make_executable; - /* If true, request BFD to use the traditional format. */ - boolean traditional_format; - /* If true, doing a dynamic link. */ boolean dynamic_link; @@ -110,6 +114,10 @@ typedef struct /* If true, only warn once about a particular undefined symbol. */ boolean warn_once; + /* If true, warn if multiple global-pointers are needed (Alpha + only). */ + boolean warn_multiple_gp; + boolean sort_common; boolean text_read_only; @@ -140,4 +148,7 @@ extern int parsing_defsym; extern int yyparse PARAMS ((void)); +extern void add_cref PARAMS ((const char *, bfd *, asection *, bfd_vma)); +extern void output_cref PARAMS ((FILE *)); + #endif diff --git a/gnu/usr.bin/binutils/ld/ld.info b/gnu/usr.bin/binutils/ld/ld.info deleted file mode 100644 index 657cb438d34..00000000000 --- a/gnu/usr.bin/binutils/ld/ld.info +++ /dev/null @@ -1,66 +0,0 @@ -This is Info file ld.info, produced by Makeinfo-1.55 from the input -file ./ld.texinfo. - -START-INFO-DIR-ENTRY -* Ld: (ld). The GNU linker. -END-INFO-DIR-ENTRY - - This file documents the GNU linker LD. - - Copyright (C) 1991, 92, 93, 94, 1995 Free Software Foundation, Inc. - - Permission is granted to make and distribute verbatim copies of this -manual provided the copyright notice and this permission notice are -preserved on all copies. - - Permission is granted to copy and distribute modified versions of -this manual under the conditions for verbatim copying, provided also -that the entire resulting derived work is distributed under the terms -of a permission notice identical to this one. - - Permission is granted to copy and distribute translations of this -manual into another language, under the above conditions for modified -versions. - - -Indirect: -ld.info-1: 865 -ld.info-2: 50745 -ld.info-3: 87906 - -Tag Table: -(Indirect) -Node: Top865 -Node: Overview1338 -Node: Invocation2451 -Node: Options2859 -Node: Environment31228 -Node: Commands32173 -Node: Scripts33167 -Node: Expressions34265 -Node: Integers35192 -Node: Symbols36031 -Node: Location Counter36777 -Node: Operators37925 -Node: Evaluation38835 -Node: Assignment39530 -Node: Arithmetic Functions43059 -Node: MEMORY46594 -Node: SECTIONS49143 -Node: Section Definition50745 -Node: Section Placement52480 -Node: Section Data Expressions56964 -Node: Section Options60825 -Node: Entry Point64497 -Node: Option Commands66042 -Node: Machine Dependent70838 -Node: H8/30071258 -Node: i96072053 -Node: BFD73719 -Node: BFD outline75162 -Node: BFD information loss76447 -Node: Canonical format78955 -Node: MRI83301 -Node: Index87906 - -End Tag Table diff --git a/gnu/usr.bin/binutils/ld/ld.info-1 b/gnu/usr.bin/binutils/ld/ld.info-1 deleted file mode 100644 index 8062e684daf..00000000000 --- a/gnu/usr.bin/binutils/ld/ld.info-1 +++ /dev/null @@ -1,1239 +0,0 @@ -This is Info file ld.info, produced by Makeinfo-1.55 from the input -file ./ld.texinfo. - -START-INFO-DIR-ENTRY -* Ld: (ld). The GNU linker. -END-INFO-DIR-ENTRY - - This file documents the GNU linker LD. - - Copyright (C) 1991, 92, 93, 94, 1995 Free Software Foundation, Inc. - - Permission is granted to make and distribute verbatim copies of this -manual provided the copyright notice and this permission notice are -preserved on all copies. - - Permission is granted to copy and distribute modified versions of -this manual under the conditions for verbatim copying, provided also -that the entire resulting derived work is distributed under the terms -of a permission notice identical to this one. - - Permission is granted to copy and distribute translations of this -manual into another language, under the above conditions for modified -versions. - - -File: ld.info, Node: Top, Next: Overview, Prev: (DIR), Up: (DIR) - -Using ld -******** - - This file documents the GNU linker ld. - -* Menu: - -* Overview:: Overview -* Invocation:: Invocation -* Commands:: Command Language - -* Machine Dependent:: Machine Dependent Features - -* BFD:: BFD - -* MRI:: MRI Compatible Script Files -* Index:: Index - - -File: ld.info, Node: Overview, Next: Invocation, Prev: Top, Up: Top - -Overview -******** - - `ld' combines a number of object and archive files, relocates their -data and ties up symbol references. Usually the last step in compiling -a program is to run `ld'. - - `ld' accepts Linker Command Language files written in a superset of -AT&T's Link Editor Command Language syntax, to provide explicit and -total control over the linking process. - - This version of `ld' uses the general purpose BFD libraries to -operate on object files. This allows `ld' to read, combine, and write -object files in many different formats--for example, COFF or `a.out'. -Different formats may be linked together to produce any available kind -of object file. *Note BFD::, for more information. - - Aside from its flexibility, the GNU linker is more helpful than other -linkers in providing diagnostic information. Many linkers abandon -execution immediately upon encountering an error; whenever possible, -`ld' continues executing, allowing you to identify other errors (or, in -some cases, to get an output file in spite of the error). - - -File: ld.info, Node: Invocation, Next: Commands, Prev: Overview, Up: Top - -Invocation -********** - - The GNU linker `ld' is meant to cover a broad range of situations, -and to be as compatible as possible with other linkers. As a result, -you have many choices to control its behavior. - -* Menu: - -* Options:: Command Line Options -* Environment:: Environment Variables - - -File: ld.info, Node: Options, Next: Environment, Up: Invocation - -Command Line Options -==================== - - Here is a summary of the options you can use on the `ld' command -line: - - ld [ -o OUTPUT ] OBJFILE... - [ -AARCHITECTURE ] [ -b INPUT-FORMAT ] - [ -Bstatic ] [ -Bdynamic ] [ -Bsymbolic ] - [ -c MRI-COMMANDFILE ] [ -d | -dc | -dp ] - [ -defsym SYMBOL=EXPRESSION ] - [ -dynamic-linker FILE ] [ -embedded-relocs ] - [ -e ENTRY ] [ -F ] [ -F FORMAT ] - [ -format INPUT-FORMAT ] [ -g ] [ -G SIZE ] - [ -help ] [ -i ] [ -lARCHIVE ] [ -LSEARCHDIR ] - [ -M ] [ -Map MAPFILE ] [ -m EMULATION ] - [ -N | -n ] [ -noinhibit-exec ] [ -no-keep-memory ] - [ -oformat OUTPUT-FORMAT ] [ -R FILENAME ] - [ -relax ] [ -retain-symbols-file FILENAME ] - [ -r | -Ur ] [ -rpath DIR ] [-rpath-link DIR ] - [ -S ] [ -s ] [ -soname NAME ] [ -shared ] - [ -sort-common ] [ -stats ] [ -T COMMANDFILE ] - [ -Ttext ORG ] [ -Tdata ORG ] - [ -Tbss ORG ] [ -t ] [ -traditional-format ] - [ -u SYMBOL] [-V] [-v] [ -verbose] [ -version ] - [ -warn-common ] [ -warn-constructors] [ -warn-once ] - [ -y SYMBOL ] [ -X ] [-x ] - [ -( [ archives ] -) ] - [ --start-group [ archives ] --end-group ] - [ -split-by-reloc COUNT ] [ -split-by-file ] - [ --whole-archive ] - - This plethora of command-line options may seem intimidating, but in -actual practice few of them are used in any particular context. For -instance, a frequent use of `ld' is to link standard Unix object files -on a standard, supported Unix system. On such a system, to link a file -`hello.o': - - ld -o OUTPUT /lib/crt0.o hello.o -lc - - This tells `ld' to produce a file called OUTPUT as the result of -linking the file `/lib/crt0.o' with `hello.o' and the library `libc.a', -which will come from the standard search directories. (See the -discussion of the `-l' option below.) - - The command-line options to `ld' may be specified in any order, and -may be repeated at will. Repeating most options with a different -argument will either have no further effect, or override prior -occurrences (those further to the left on the command line) of that -option. - - The exceptions--which may meaningfully be used more than once--are -`-A', `-b' (or its synonym `-format'), `-defsym', `-L', `-l', `-R', -`-u', and `-(' (or its synonym `--start-group').. - - The list of object files to be linked together, shown as OBJFILE..., -may follow, precede, or be mixed in with command-line options, except -that an OBJFILE 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 `-l', `-R', and the -script command language. If *no* binary input files at all are -specified, the linker does not produce any output, and issues the -message `No input files'. - - If the linker can not recognize the format of an object file, it will -assume that it is a linker script. A script specified in this way -augments the main linker script used for the link (either the default -linker script or the one specified by using `-T'). This feature -permits the linker to link against a file which appears to be an object -or an archive, but actually merely defines some symbol values, or uses -`INPUT' or `GROUP' to load other objects. *Note Commands::. - - For options whose names are a single letter, option arguments must -either follow the option letter without intervening whitespace, or be -given as separate arguments immediately following the option that -requires them. - - For options whose names are multiple letters, either one dash or two -can precede the option name; for example, `--oformat' and `-oformat' -are equivalent. Arguments to multiple-letter options must either be -separated from the option name by an equals sign, or be given as -separate arguments immediately following the option that requires them. -For example, `--oformat srec' and `--oformat=srec' are equivalent. -Unique abbreviations of the names of multiple-letter options are -accepted. - -`-AARCHITECTURE' - In the current release of `ld', this option is useful only for the - Intel 960 family of architectures. In that `ld' configuration, the - ARCHITECTURE argument identifies the particular architecture in - the 960 family, enabling some safeguards and modifying the - archive-library search path. *Note `ld' and the Intel 960 family: - i960, for details. - - Future releases of `ld' may support similar functionality for - other architecture families. - -`-b INPUT-FORMAT' - `ld' may be configured to support more than one kind of object - file. If your `ld' is configured this way, you can use the `-b' - option to specify the binary format for input object files that - follow this option on the command line. Even when `ld' is - configured to support alternative object formats, you don't - usually need to specify this, as `ld' should be configured to - expect as a default input format the most usual format on each - machine. INPUT-FORMAT is a text string, the name of a particular - format supported by the BFD libraries. (You can list the - available binary formats with `objdump -i'.) - `-format INPUT-FORMAT' has the same effect, as does the script - command `TARGET'. *Note BFD::. - - You may want to use this option if you are linking files with an - unusual binary format. You can also use `-b' to switch formats - explicitly (when linking object files of different formats), by - including `-b INPUT-FORMAT' before each group of object files in a - particular format. - - The default format is taken from the environment variable - `GNUTARGET'. *Note Environment::. You can also define the input - format from a script, using the command `TARGET'; see *Note Option - Commands::. - -`-Bstatic' - Do not link against shared libraries. This is only meaningful on - platforms for which shared libraries are supported. - -`-Bdynamic' - Link against dynamic libraries. This is only meaningful on - platforms for which shared libraries are supported. This option - is normally the default on such platforms. - -`-Bsymbolic' - When creating a shared library, bind references to global symbols - to the definition within the shared library, if any. Normally, it - is possible for a program linked against a shared library to - override the definition within the shared library. This option is - only meaningful on ELF platforms which support shared libraries. - -`-c MRI-COMMANDFILE' - For compatibility with linkers produced by MRI, `ld' accepts script - files written in an alternate, restricted command language, - described in *Note MRI Compatible Script Files: MRI. Introduce - MRI script files with the option `-c'; use the `-T' option to run - linker scripts written in the general-purpose `ld' scripting - language. If MRI-CMDFILE does not exist, `ld' looks for it in the - directories specified by any `-L' options. - -`-d' -`-dc' -`-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 - `-r'). The script command `FORCE_COMMON_ALLOCATION' has the same - effect. *Note Option Commands::. - -`-defsym SYMBOL=EXPRESSION' - Create a global symbol in the output file, containing the absolute - address given by EXPRESSION. You may use this option as many - times as necessary to define multiple symbols in the command line. - A limited form of arithmetic is supported for the EXPRESSION in - this context: you may give a hexadecimal constant or the name of - an existing symbol, or use `+' and `-' to add or subtract - hexadecimal constants or symbols. If you need more elaborate - expressions, consider using the linker command language from a - script (*note Assignment: Symbol Definitions: Assignment.). - *Note:* there should be no white space between SYMBOL, the equals - sign ("="), and EXPRESSION. - -`-dynamic-linker FILE' - Set the name of the dynamic linker. This is only meaningful when - generating dynamically linked ELF executables. The default dynamic - linker is normally correct; don't use this unless you know what - you are doing. - -`-embedded-relocs' - This option is only meaningful when linking MIPS embedded PIC code, - generated by the -membedded-pic option to the GNU compiler and - assembler. It causes the linker to create a table which may be - used at runtime to relocate any data which was statically - initialized to pointer values. See the code in testsuite/ld-empic - for details. - -`-e ENTRY' - Use ENTRY as the explicit symbol for beginning execution of your - program, rather than the default entry point. *Note Entry Point::, - for a discussion of defaults and other ways of specifying the - entry point. - -`-F' -`-FFORMAT' - Ignored. Some older linkers used this option throughout a - compilation toolchain for specifying object-file format for both - input and output object files. The mechanisms `ld' uses for this - purpose (the `-b' or `-format' options for input files, `-oformat' - option or the `TARGET' command in linker scripts for output files, - the `GNUTARGET' environment variable) are more flexible, but `ld' - accepts the `-F' option for compatibility with scripts written to - call the old linker. - -`-format INPUT-FORMAT' - Synonym for `-b INPUT-FORMAT'. - -`-g' - Ignored. Provided for compatibility with other tools. - -`-GVALUE' -`-G VALUE' - Set the maximum size of objects to be optimized using the GP - register to SIZE under MIPS ECOFF. Ignored for other object file - formats. - -`-help' - Print a summary of the command-line options on the standard output - and exit. - -`-i' - Perform an incremental link (same as option `-r'). - -`-lAR' - Add archive file ARCHIVE to the list of files to link. This - option may be used any number of times. `ld' will search its - path-list for occurrences of `libAR.a' for every ARCHIVE specified. - -`-LSEARCHDIR' -`-L SEARCHDIR' - Add path SEARCHDIR to the list of paths that `ld' will search for - archive libraries and `ld' control scripts. You may use this - option any number of times. The directories are searched in the - order in which they are specified on the command line. - Directories specified on the command line are searched before the - default directories. All `-L' options apply to all `-l' options, - regardless of the order in which the options appear. - - The default set of paths searched (without being specified with - `-L') depends on which emulation mode `ld' is using, and in some - cases also on how it was configured. *Note Environment::. - - The paths can also be specified in a link script with the - `SEARCH_DIR' command. Directories specified this way are searched - at the point in which the linker script appears in the command - line. - -`-M' - Print (to the standard output) a link map--diagnostic information - about where symbols are mapped by `ld', and information on global - common storage allocation. - -`-Map MAPFILE' - Print to the file MAPFILE a link map--diagnostic information about - where symbols are mapped by `ld', and information on global common - storage allocation. - -`-mEMULATION' -`-m EMULATION' - Emulate the EMULATION linker. You can list the available - emulations with the `--verbose' or `-V' options. The default - depends on how your `ld' was configured. - -`-N' - Set the text and data sections to be readable and writable. Also, - do not page-align the data segment. If the output format supports - Unix style magic numbers, mark the output as `OMAGIC'. - -`-n' - Set the text segment to be read only, and mark the output as - `NMAGIC' if possible. - -`-noinhibit-exec' - Retain the executable output file whenever it is still usable. - Normally, the linker will not produce an output file if it - encounters errors during the link process; it exits without - writing an output file when it issues any error whatsoever. - -`-no-keep-memory' - `ld' normally optimizes for speed over memory usage by caching the - symbol tables of input files in memory. This option tells `ld' to - instead optimize for memory usage, by rereading the symbol tables - as necessary. This may be required if `ld' runs out of memory - space while linking a large executable. - -`-o OUTPUT' - Use OUTPUT as the name for the program produced by `ld'; if this - option is not specified, the name `a.out' is used by default. The - script command `OUTPUT' can also specify the output file name. - -`-oformat OUTPUT-FORMAT' - `ld' may be configured to support more than one kind of object - file. If your `ld' is configured this way, you can use the - `-oformat' option to specify the binary format for the output - object file. Even when `ld' is configured to support alternative - object formats, you don't usually need to specify this, as `ld' - should be configured to produce as a default output format the most - usual format on each machine. OUTPUT-FORMAT is a text string, the - name of a particular format supported by the BFD libraries. (You - can list the available binary formats with `objdump -i'.) The - script command `OUTPUT_FORMAT' can also specify the output format, - but this option overrides it. *Note BFD::. - -`-R FILENAME' - Read symbol names and their addresses from FILENAME, but do not - relocate it or include it in the output. This allows your output - file to refer symbolically to absolute locations of memory defined - in other programs. - -`-relax' - An option with machine dependent effects. Currently this option - is only supported on the H8/300 and the Intel 960. *Note `ld' and - the H8/300: H8/300. *Note `ld' and the Intel 960 family: i960. - - On some platforms, the `-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 platforms where this is not supported, `-relax' is accepted, but - ignored. - -`-retain-symbols-file FILENAME' - Retain *only* the symbols listed in the file FILENAME, discarding - all others. FILENAME is simply a flat file, with one symbol name - per line. This option is especially useful in environments (such - as VxWorks) where a large global symbol table is accumulated - gradually, to conserve run-time memory. - - `-retain-symbols-file' does *not* discard undefined symbols, or - symbols needed for relocations. - - You may only specify `-retain-symbols-file' once in the command - line. It overrides `-s' and `-S'. - -`-rpath DIR' - Add a directory to the runtime library search path. This is used - when linking an ELF executable with shared objects. All `-rpath' - arguments are concatenated and passed to the runtime linker, which - uses them to locate shared objects at runtime. The `-rpath' - option is also used when locating shared objects which are needed - by shared objects explicitly included in the link; see the - description of the `-rpath-link' option. If `-rpath' is not used - when linking an ELF executable, the contents of the environment - variable `LD_RUN_PATH' will be used if it is defined. - - The `-rpath' option may also be used on SunOS. By default, on - SunOS, the linker will form a runtime search patch out of all the - `-L' options it is given. If a `-rpath' option is used, the - runtime search path will be formed exclusively using the `-rpath' - options, ignoring the `-L' options. This can be useful when using - gcc, which adds many `-L' options which may be on NFS mounted - filesystems. - -`-rpath-link DIR' - When using ELF or SunOS, one shared library may require another. - This happens when an `ld -shared' link includes a shared library - as one of the input files. - - When the linker encounters such a dependency when doing a - non-shared, non-relocateable link, it will automatically try to - locate the required shared library and include it in the link, if - it is not included explicitly. In such a case, the `-rpath-link' - option specifies the first set of directories to search. The - `-rpath-link' option may specify a sequence of directory names - either by specifying a list of names separated by colons, or by - appearing multiple times. - - The linker uses the following search paths to locate required - shared libraries. - 1. Any directories specified by `-rpath-link' options. - - 2. Any directories specified by `-rpath' options. The difference - between `-rpath' and `-rpath-link' is that directories - specified by `-rpath' options are included in the executable - and used at runtime, whereas the `-rpath-link' option is only - effective at link time. - - 3. On an ELF system, if the `-rpath' and `rpath-link' options - were not used, search the contents of the environment variable - `LD_RUN_PATH'. - - 4. On SunOS, if the `-rpath' option was not used, search any - directories specified using `-L' options. - - 5. For a native linker, the contents of the environment variable - `LD_LIBRARY_PATH'. - - 6. The default directories, normally `/lib' and `/usr/lib'. - - If the required shared library is not found, the linker will issue - a warning and continue with the link. - -`-r' - Generate relocatable output--i.e., generate an output file that - can in turn serve as input to `ld'. This is often called "partial - linking". As a side effect, in environments that support standard - Unix magic numbers, this option also sets the output file's magic - number to `OMAGIC'. If this option is not specified, an absolute - file is produced. When linking C++ programs, this option *will - not* resolve references to constructors; to do that, use `-Ur'. - - This option does the same thing as `-i'. - -`-S' - Omit debugger symbol information (but not all symbols) from the - output file. - -`-s' - Omit all symbol information from the output file. - -`-soname NAME' - When creating an ELF shared object, set the internal DT_SONAME - field to the specified name. When an executable is linked with a - shared object which has a DT_SONAME field, then when the - executable is run the dynamic linker will attempt to load the - shared object specified by the DT_SONAME field rather than the - using the file name given to the linker. - -`-shared' - Create a shared library. This is currently only supported on ELF - and SunOS platforms. On SunOS, the linker will automatically - create a shared library if the `-e' option is not used and there - are undefined symbols in the link. - -`-sort-common' - Normally, when `ld' places the global common symbols in the - appropriate output sections, it sorts them by size. First come - all the one byte symbols, then all the two bytes, then all the - four bytes, and then everything else. This is to prevent gaps - between symbols due to alignment constraints. This option - disables that sorting. - -`-split-by-reloc COUNT' - Trys to creates extra sections in the output file so that no - single output section in the file contains more than COUNT - relocations. This is useful when generating huge relocatable for - downloading into certain real time kernels with the COFF object - file format; since COFF cannot represent more than 65535 - relocations in a single section. Note that this will fail to work - with object file formats which do not support arbitrary sections. - The linker will not split up individual input sections for - redistribution, so if a single input section contains more than - COUNT relocations one output section will contain that many - relocations. - -`-split-by-file' - Similar to -split-by-reloc but creates a new output section for - each input file. - -`-stats' - Compute and display statistics about the operation of the linker, - such as execution time and memory usage. - -`-Tbss ORG' -`-Tdata ORG' -`-Ttext ORG' - Use ORG as the starting address for--respectively--the `bss', - `data', or the `text' segment of the output file. ORG must be a - single hexadecimal integer; for compatibility with other linkers, - you may omit the leading `0x' usually associated with hexadecimal - values. - -`-T COMMANDFILE' -`-TCOMMANDFILE' - Read link commands from the file COMMANDFILE. These commands - replace `ld''s default link script (rather than adding to it), so - COMMANDFILE must specify everything necessary to describe the - target format. *Note Commands::. If COMMANDFILE does not exist, - `ld' looks for it in the directories specified by any preceding - `-L' options. Multiple `-T' options accumulate. - -`-t' - Print the names of the input files as `ld' processes them. - -`-traditional-format' - For some targets, the output of `ld' is different in some ways from - the output of some existing linker. This switch requests `ld' to - use the traditional format instead. - - For example, on SunOS, `ld' combines duplicate entries in the - symbol string table. This can reduce the size of an output file - with full debugging information by over 30 percent. - Unfortunately, the SunOS `dbx' program can not read the resulting - program (`gdb' has no trouble). The `-traditional-format' switch - tells `ld' to not combine duplicate entries. - -`-u SYMBOL' - Force 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. `-u' may be repeated - with different option arguments to enter additional undefined - symbols. - -`-Ur' - For anything other than C++ programs, this option is equivalent to - `-r': it generates relocatable output--i.e., an output file that - can in turn serve as input to `ld'. When linking C++ programs, - `-Ur' *does* resolve references to constructors, unlike `-r'. It - does not work to use `-Ur' on files that were themselves linked - with `-Ur'; once the constructor table has been built, it cannot - be added to. Use `-Ur' only for the last partial link, and `-r' - for the others. - -`--verbose' - Display the version number for `ld' and list the linker emulations - supported. Display which input files can and cannot be opened. - -`-v' -`-V' - Display the version number for `ld'. The `-V' option also lists - the supported emulations. - -`-version' - Display the version number for `ld' and exit. - -`-warn-common' - Warn when a common symbol is combined with another common symbol - or with a symbol definition. Unix linkers allow this somewhat - sloppy practice, but linkers on some other operating systems do - not. This option allows you to find potential problems from - combining global symbols. Unfortunately, some C libraries use - this practice, so you may get some warnings about symbols in the - libraries as well as in your programs. - - There are three kinds of global symbols, illustrated here by C - examples: - - `int i = 1;' - A definition, which goes in the initialized data section of - the output file. - - `extern int i;' - An undefined reference, which does not allocate space. There - must be either a definition or a common symbol for the - variable somewhere. - - `int i;' - A common symbol. If there are only (one or more) common - symbols for a variable, it goes in the uninitialized data - area of the output file. The linker merges multiple common - symbols for the same variable into a single symbol. If they - are of different sizes, it picks the largest size. The - linker turns a common symbol into a declaration, if there is - a definition of the same variable. - - The `-warn-common' option can produce five kinds of warnings. Each - warning consists of a pair of lines: the first describes the - symbol just encountered, and the second describes the previous - symbol encountered with the same name. One or both of the two - symbols will be a common symbol. - - 1. Turning a common symbol into a reference, because there is - already a definition for the symbol. - FILE(SECTION): warning: common of `SYMBOL' - overridden by definition - FILE(SECTION): warning: defined here - - 2. Turning a common symbol into a reference, because a later - definition for the symbol is encountered. This is the same - as the previous case, except that the symbols are encountered - in a different order. - FILE(SECTION): warning: definition of `SYMBOL' - overriding common - FILE(SECTION): warning: common is here - - 3. Merging a common symbol with a previous same-sized common - symbol. - FILE(SECTION): warning: multiple common - of `SYMBOL' - FILE(SECTION): warning: previous common is here - - 4. Merging a common symbol with a previous larger common symbol. - FILE(SECTION): warning: common of `SYMBOL' - overridden by larger common - FILE(SECTION): warning: larger common is here - - 5. Merging a common symbol with a previous smaller common - symbol. This is the same as the previous case, except that - the symbols are encountered in a different order. - FILE(SECTION): warning: common of `SYMBOL' - overriding smaller common - FILE(SECTION): warning: smaller common is here - -`-warn-constructors' - Warn if any global constructors are used. This is only useful for - a few object file formats. For formats like COFF or ELF, the - linker can not detect the use of global constructors. - -`-warn-once' - Only warn once for each undefined symbol, rather than once per - module which refers to it. - - For each archive mentioned on the command line, include every - object file in the archive in the link, rather than searching the - archive for the required object files. This is normally used to - turn an archive file into a shared library, forcing every object - to be included in the resulting shared library. - -`-X' - Delete all temporary local symbols. For most targets, this is all - local symbols whose names begin with `L'. - -`-x' - Delete all local symbols. - -`-y SYMBOL' - Print the name of each linked file in which SYMBOL appears. This - option may be given any number of times. On many systems it is - necessary to prepend an underscore. - - This option is useful when you have an undefined symbol in your - link but don't know where the reference is coming from. - -`-( ARCHIVES -)' -`--start-group ARCHIVES --end-group' - The ARCHIVES should be a list of archive files. They may be - either explicit file names, or `-l' options. - - The specified archives are searched repeatedly until no new - undefined references are created. Normally, an archive is - searched only once in the order that it is specified on the - command line. If a symbol in that archive is needed to resolve an - undefined symbol referred to by an object in an archive that - appears later on the command line, the linker would not be able to - resolve that reference. By grouping the archives, they all be - searched repeatedly until all possible references are resolved. - - Using this option has a significant performance cost. It is best - to use it only when there are unavoidable circular references - between two or more archives. - - -File: ld.info, Node: Environment, Prev: Options, Up: Invocation - -Environment Variables -===================== - - You can change the behavior of `ld' with the environment variable -`GNUTARGET'. - - `GNUTARGET' determines the input-file object format if you don't use -`-b' (or its synonym `-format'). Its value should be one of the BFD -names for an input format (*note BFD::.). If there is no `GNUTARGET' -in the environment, `ld' uses the natural format of the target. If -`GNUTARGET' is set to `default' then BFD attempts to discover the input -format by examining binary input files; this method often succeeds, but -there are potential ambiguities, since there is no method of ensuring -that the magic number used to specify object-file formats is unique. -However, the configuration procedure for BFD on each system places the -conventional format for that system first in the search-list, so -ambiguities are resolved in favor of convention. - - -File: ld.info, Node: Commands, Next: Machine Dependent, Prev: Invocation, Up: Top - -Command Language -**************** - - 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: - * input files - - * file formats - - * output file layout - - * addresses of sections - - * placement of common blocks - - You may supply a command file (also known as a link script) to the -linker either explicitly through the `-T' option, or implicitly as an -ordinary file. If the linker opens a file which it cannot recognize as -a supported object or archive format, it reports an error. - -* Menu: - -* Scripts:: Linker Scripts -* Expressions:: Expressions -* MEMORY:: MEMORY Command -* SECTIONS:: SECTIONS Command -* Entry Point:: The Entry Point -* Option Commands:: Option Commands - - -File: ld.info, Node: Scripts, Next: Expressions, Up: Commands - -Linker Scripts -============== - - The `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. - - The most fundamental command of the `ld' command language is the -`SECTIONS' command (*note SECTIONS::.). Every meaningful command -script must have a `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 `MEMORY' command complements `SECTIONS' by describing the -available memory in the target architecture. This command is optional; -if you don't use a `MEMORY' command, `ld' assumes sufficient memory is -available in a contiguous block for all output. *Note MEMORY::. - - You may include comments in linker scripts just as in C: delimited -by `/*' and `*/'. As in C, comments are syntactically equivalent to -whitespace. - - -File: ld.info, Node: Expressions, Next: MEMORY, Prev: Scripts, Up: Commands - -Expressions -=========== - - 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: - * All expressions evaluated as integers and are of "long" or - "unsigned long" type. - - * All constants are integers. - - * All of the C arithmetic operators are provided. - - * You may reference, define, and create global variables. - - * You may call special purpose built-in functions. - -* Menu: - -* Integers:: Integers -* Symbols:: Symbol Names -* Location Counter:: The Location Counter -* Operators:: Operators -* Evaluation:: Evaluation -* Assignment:: Assignment: Defining Symbols -* Arithmetic Functions:: Built-In Functions - - -File: ld.info, Node: Integers, Next: Symbols, Up: Expressions - -Integers --------- - - An octal integer is `0' followed by zero or more of the octal digits -(`01234567'). - _as_octal = 0157255; - - A decimal integer starts with a non-zero digit followed by zero or -more digits (`0123456789'). - _as_decimal = 57005; - - A hexadecimal integer is `0x' or `0X' followed by one or more -hexadecimal digits chosen from `0123456789abcdefABCDEF'. - _as_hex = 0xdead; - - To write a negative integer, use the prefix operator `-'; *note -Operators::.. - _as_neg = -57005; - - Additionally the suffixes `K' and `M' may be used to scale a -constant by `1024' or `1024*1024' respectively. For example, the -following all refer to the same quantity: - - _fourk_1 = 4K; - _fourk_2 = 4096; - _fourk_3 = 0x1000; - - -File: ld.info, Node: Symbols, Next: Location Counter, Prev: Integers, Up: Expressions - -Symbol Names ------------- - - 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: - "SECTION" = 9; - "with a space" = "also with a space" + 10; - - Since symbols can contain many non-alphabetic characters, it is -safest to delimit symbols with spaces. For example, `A-B' is one -symbol, whereas `A - B' is an expression involving subtraction. - - -File: ld.info, Node: Location Counter, Next: Operators, Prev: Symbols, Up: Expressions - -The Location Counter --------------------- - - The special linker variable "dot" `.' always contains the current -output location counter. Since the `.' always refers to a location in -an output section, it must always appear in an expression within a -`SECTIONS' command. The `.' 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 `.' symbol 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. - SECTIONS - { - output : - { - file1(.text) - . = . + 1000; - file2(.text) - . += 1000; - file3(.text) - } = 0x1234; - } - -In the previous example, `file1' is located at the beginning of the -output section, then there is a 1000 byte gap. Then `file2' appears, -also with a 1000 byte gap following before `file3' is loaded. The -notation `= 0x1234' specifies what data to write in the gaps (*note -Section Options::.). - - -File: ld.info, Node: Operators, Next: Evaluation, Prev: Location Counter, Up: Expressions - -Operators ---------- - - The linker recognizes the standard C set of arithmetic operators, -with the standard bindings and precedence levels: - 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) - Notes: (1) Prefix operators (2) *Note Assignment:: - - -File: ld.info, Node: Evaluation, Next: Assignment, Prev: Operators, Up: Expressions - -Evaluation ----------- - - 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. - - -File: ld.info, Node: Assignment, Next: Arithmetic Functions, Prev: Evaluation, Up: Expressions - -Assignment: Defining Symbols ----------------------------- - - You may create global symbols, and assign values (addresses) to -global symbols, using any of the C assignment operators: - -`SYMBOL = EXPRESSION ;' -`SYMBOL &= EXPRESSION ;' -`SYMBOL += EXPRESSION ;' -`SYMBOL -= EXPRESSION ;' -`SYMBOL *= EXPRESSION ;' -`SYMBOL /= EXPRESSION ;' - Two things distinguish assignment from other operators in `ld' -expressions. - * Assignment may only be used at the root of an expression; `a=b+3;' - is allowed, but `a+b=3;' is an error. - - * You must place a trailing semicolon (";") at the end of an - assignment statement. - - Assignment statements may appear: - * as commands in their own right in an `ld' script; or - - * as independent statements within a `SECTIONS' command; or - - * as part of the contents of a section definition in a `SECTIONS' - command. - - 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 (*note SECTIONS::.). - - 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 `ABSOLUTE'. For -example, to create an absolute symbol whose address is the last byte of -an output section named `.data': - SECTIONS{ ... - .data : - { - *(.data) - _edata = ABSOLUTE(.) ; - } - ... } - - The linker tries to put off the evaluation of an assignment until all -the terms in the source expression are known (*note 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 "dot", `.' 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 - SECTIONS { ... - text 9+this_isnt_constant : - { ... - } - ... } - -will cause the error message "`Non constant expression for initial -address'". - - 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 `etext'. However, ANSI C requires that the user be able to use -`etext' as a function name without encountering an error. The -`PROVIDE' keyword may be used to define a symbol, such as `etext', only -if it is referenced but not defined. The syntax is `PROVIDE(SYMBOL = -EXPRESSION)'. - - -File: ld.info, Node: Arithmetic Functions, Prev: Assignment, Up: Expressions - -Arithmetic Functions --------------------- - - The command language includes a number of built-in functions for use -in link script expressions. -`ABSOLUTE(EXP)' - Return the absolute (non-relocatable, as opposed to non-negative) - value of the expression EXP. Primarily useful to assign an - absolute value to a symbol within a section definition, where - symbol values are normally section-relative. - -`ADDR(SECTION)' - Return the absolute address of the named SECTION. Your script must - previously have defined the location of that section. In the - following example, `symbol_1' and `symbol_2' are assigned identical - values: - SECTIONS{ ... - .output1 : - { - start_of_output_1 = ABSOLUTE(.); - ... - } - .output : - { - symbol_1 = ADDR(.output1); - symbol_2 = start_of_output_1; - } - ... } - -`ALIGN(EXP)' - Return the result of the current location counter (`.') aligned to - the next EXP boundary. EXP must be an expression whose value is a - power of two. This is equivalent to - (. + EXP - 1) & ~(EXP - 1) - - `ALIGN' doesn't change the value of the location counter--it just - does arithmetic on it. As an example, to align the output `.data' - section to the next `0x2000' byte boundary after the preceding - section and to set a variable within the section to the next - `0x8000' boundary after the input sections: - SECTIONS{ ... - .data ALIGN(0x2000): { - *(.data) - variable = ALIGN(0x8000); - } - ... } - - The first use of `ALIGN' in this example specifies the location of - a section because it is used as the optional START attribute of a - section definition (*note Section Options::.). The second use - simply defines the value of a variable. - - The built-in `NEXT' is closely related to `ALIGN'. - -`DEFINED(SYMBOL)' - Return 1 if 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 `begin' to - the first location in the `.text' section--but if a symbol called - `begin' already existed, its value is preserved: - - SECTIONS{ ... - .text : { - begin = DEFINED(begin) ? begin : . ; - ... - } - ... } - -`NEXT(EXP)' - Return the next unallocated address that is a multiple of EXP. - This function is closely related to `ALIGN(EXP)'; unless you use - the `MEMORY' command to define discontinuous memory for the output - file, the two functions are equivalent. - -`SIZEOF(SECTION)' - Return the size in bytes of the named SECTION, if that section has - been allocated. In the following example, `symbol_1' and - `symbol_2' are assigned identical values: - SECTIONS{ ... - .output { - .start = . ; - ... - .end = . ; - } - symbol_1 = .end - .start ; - symbol_2 = SIZEOF(.output); - ... } - -`SIZEOF_HEADERS' -`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. - - -File: ld.info, Node: MEMORY, Next: SECTIONS, Prev: Expressions, Up: Commands - -Memory Layout -============= - - The linker's default configuration permits allocation of all -available memory. You can override this configuration by using the -`MEMORY' command. The `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 `MEMORY' command; -however, you can define as many blocks of memory within it as you wish. -The syntax is: - - MEMORY - { - NAME (ATTR) : ORIGIN = ORIGIN, LENGTH = LEN - ... - } - -`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. - -`(ATTR)' - is an optional list of attributes, permitted for compatibility - with the AT&T linker but not used by `ld' beyond checking that the - attribute list is valid. Valid attribute lists must be made up of - the characters "`LIRWX'". If you omit the attribute list, you may - omit the parentheses around it as well. - -`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 `ORIGIN' may be abbreviated - to `org' or `o' (but not, for example, `ORG'). - -`LEN' - is the size in bytes of the region (an expression). The keyword - `LENGTH' may be abbreviated to `len' or `l'. - - For example, to specify that memory has two regions available for -allocation--one starting at 0 for 256 kilobytes, and the other starting -at `0x40000000' for four megabytes: - - MEMORY - { - rom : ORIGIN = 0, LENGTH = 256K - ram : org = 0x40000000, l = 4M - } - - Once you have defined a region of memory named MEM, you can direct -specific output sections there by using a command ending in `>MEM' -within the `SECTIONS' command (*note Section Options::.). If the -combined output sections directed to a region are too big for the -region, the linker will issue an error message. - - -File: ld.info, Node: SECTIONS, Next: Entry Point, Prev: MEMORY, Up: Commands - -Specifying Output Sections -========================== - - The `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 `SECTIONS' command in a script file, but you -can have as many statements within it as you wish. Statements within -the `SECTIONS' command can do one of three things: - - * define the entry point; - - * assign a value to a symbol; - - * describe the placement of a named output section, and which input - sections go into it. - - You can also use the first two operations--defining the entry point -and defining symbols--outside the `SECTIONS' command: *note Entry -Point::., and *note Assignment::.. They are permitted here as well for -your convenience in reading the script, so that symbols and the entry -point can be defined at meaningful points in your output-file layout. - - If you do not use a `SECTIONS' command, the linker places each input -section into an identically named output section in the order that the -sections are first encountered in the input files. If all input -sections are present in the first file, for example, the order of -sections in the output file will match the order in the first input -file. - -* Menu: - -* Section Definition:: Section Definitions -* Section Placement:: Section Placement -* Section Data Expressions:: Section Data Expressions -* Section Options:: Optional Section Attributes - diff --git a/gnu/usr.bin/binutils/ld/ld.info-2 b/gnu/usr.bin/binutils/ld/ld.info-2 deleted file mode 100644 index 2900aeff162..00000000000 --- a/gnu/usr.bin/binutils/ld/ld.info-2 +++ /dev/null @@ -1,924 +0,0 @@ -This is Info file ld.info, produced by Makeinfo-1.55 from the input -file ./ld.texinfo. - -START-INFO-DIR-ENTRY -* Ld: (ld). The GNU linker. -END-INFO-DIR-ENTRY - - This file documents the GNU linker LD. - - Copyright (C) 1991, 92, 93, 94, 1995 Free Software Foundation, Inc. - - Permission is granted to make and distribute verbatim copies of this -manual provided the copyright notice and this permission notice are -preserved on all copies. - - Permission is granted to copy and distribute modified versions of -this manual under the conditions for verbatim copying, provided also -that the entire resulting derived work is distributed under the terms -of a permission notice identical to this one. - - Permission is granted to copy and distribute translations of this -manual into another language, under the above conditions for modified -versions. - - -File: ld.info, Node: Section Definition, Next: Section Placement, Up: SECTIONS - -Section Definitions -------------------- - - The most frequently used statement in the `SECTIONS' command is the -"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 - SECTIONS { ... - SECNAME : { - CONTENTS - } - ... } - -SECNAME is the name of the output section, and CONTENTS a specification -of what goes there--for example, a list of input files or sections of -input files (*note Section Placement::.). As you might assume, the -whitespace shown is optional. You do need the colon `:' and the braces -`{}', however. - - SECNAME must meet the constraints of your output format. In formats -which only support a limited number of sections, such as `a.out', the -name must be one of the names supported by the format (`a.out', for -example, allows only `.text', `.data' or `.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 `ld' symbol name syntax -must be quoted. *Note Symbol Names: Symbols. - - 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, - .foo { *(.foo } - will only create a `.foo' section in the output file if there is a -`.foo' section in at least one input file. - - -File: ld.info, Node: Section Placement, Next: Section Data Expressions, Prev: Section Definition, Up: SECTIONS - -Section Placement ------------------ - - In a section definition, you can specify the contents of an output -section by listing particular input files, by listing particular -input-file sections, or by a combination of the two. You can also place -arbitrary data in the section, and define symbols relative to the -beginning of the section. - - The 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. - -`FILENAME' - You may simply name a particular input file to be placed in the - current output section; *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: - .data : { afile.o bfile.o cfile.o } - - 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. - -`FILENAME( SECTION )' -`FILENAME( SECTION, SECTION, ... )' -`FILENAME( SECTION SECTION ... )' - 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, you may - separate the section names by either commas or whitespace. - -`* (SECTION)' -`* (SECTION, SECTION, ...)' -`* (SECTION SECTION ...)' - Instead of explicitly naming particular input files in a link - control script, you can refer to *all* files from the `ld' command - line: use `*' instead of a particular file name before the - parenthesized input-file section list. - - If you have already explicitly included some files by name, `*' - refers to all *remaining* files--those whose places in the output - file have not yet been defined. - - For example, to copy sections `1' through `4' from an Oasys file - into the `.text' section of an `a.out' file, and sections `13' and - `14' into the `.data' section: - SECTIONS { - .text :{ - *("1" "2" "3" "4") - } - - .data :{ - *("13" "14") - } - } - - `[ SECTION ... ]' 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. - -`FILENAME`( COMMON )'' -`*( COMMON )' - Specify where in your output file to place uninitialized data with - this notation. `*(COMMON)' by itself refers to all uninitialized - data from all input files (so far as it is not yet allocated); - FILENAME`(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: `ld' permits you to - refer to uninitialized data as if it were in an input-file section - named `COMMON', regardless of the input file's format. - - For example, the following command script arranges the output file -into three consecutive sections, named `.text', `.data', and `.bss', -taking the input for each from the correspondingly named sections of -all the input files: - - SECTIONS { - .text : { *(.text) } - .data : { *(.data) } - .bss : { *(.bss) *(COMMON) } - } - - The following example reads all of the sections from file `all.o' -and places them at the start of output section `outputa' which starts -at location `0x10000'. All of section `.input1' from file `foo.o' -follows immediately, in the same output section. All of section -`.input2' from `foo.o' goes into output section `outputb', followed by -section `.input1' from `foo1.o'. All of the remaining `.input1' and -`.input2' sections from any files are written to output section -`outputc'. - - SECTIONS { - outputa 0x10000 : - { - all.o - foo.o (.input1) - } - outputb : - { - foo.o (.input2) - foo1.o (.input1) - } - outputc : - { - *(.input1) - *(.input2) - } - } - - -File: ld.info, Node: Section Data Expressions, Next: Section Options, Prev: Section Placement, Up: SECTIONS - -Section Data Expressions ------------------------- - - 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; *note Expressions::.. -Although these statements are shown separately here for ease of -presentation, no such segregation is needed within a section definition -in the `SECTIONS' command; you can intermix them freely with any of the -statements we've just described. - -`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 `a.out' files it is conventional to have - a symbol for each input file. You can accomplish this by defining - the output `.text' section as follows: - SECTIONS { - .text 0x2020 : - { - CREATE_OBJECT_SYMBOLS - *(.text) - _etext = ALIGN(0x2000); - } - ... - } - - If `sample.ld' is a file containing this script, and `a.o', `b.o', - `c.o', and `d.o' are four input files with contents like the - following-- - /* a.c */ - - afunction() { } - int adata=1; - int abss; - - `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: - 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 - -`SYMBOL = EXPRESSION ;' -`SYMBOL F= EXPRESSION ;' - SYMBOL is any symbol name (*note Symbols::.). "F=" refers to any - of the operators `&= += -= *= /=' which combine arithmetic and - assignment. - - When you assign a value to a symbol within a particular section - definition, the value is relative to the beginning of the section - (*note Assignment::.). If you write - - SECTIONS { - abs = 14 ; - ... - .data : { ... rel = 14 ; ... } - abs2 = 14 + ADDR(.data); - ... - } - - `abs' and `rel' do not have the same value; `rel' has the same - value as `abs2'. - -`BYTE(EXPRESSION)' -`SHORT(EXPRESSION)' -`LONG(EXPRESSION)' -`QUAD(EXPRESSION)' - By including one of these four statements in a section definition, - you can explicitly place one, two, four, or eight bytes - (respectively) at the current address of that section. `QUAD' is - only supported when using a 64 bit host or target. - - Multiple-byte quantities are represented in whatever byte order is - appropriate for the output file format (*note BFD::.). - -`FILL(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 `.') are filled with the two least significant bytes from - the EXPRESSION argument. A `FILL' statement covers memory - locations *after* the point it occurs in the section definition; by - including more than one `FILL' statement, you can have different - fill patterns in different parts of an output section. - - -File: ld.info, Node: Section Options, Prev: Section Data Expressions, Up: SECTIONS - -Optional Section Attributes ---------------------------- - - Here is the full syntax of a section definition, including all the -optional portions: - - SECTIONS { - ... - SECNAME START BLOCK(ALIGN) (NOLOAD) : AT ( LDADR ) - { CONTENTS } >REGION =FILL - ... - } - - SECNAME and CONTENTS are required. *Note Section Definition::, and -*note Section Placement::. for details on CONTENTS. The remaining -elements--START, `BLOCK(ALIGN)', `(NOLOAD)', `AT ( LDADR )', `>REGION', -and `=FILL'--are all optional. - -`START' - You can force the output section to be loaded at a specified - address by specifying START immediately following the section name. - sTART can be represented as any expression. The following example - generates section OUTPUT at location `0x40000000': - - SECTIONS { - ... - output 0x40000000: { - ... - } - ... - } - -`BLOCK(ALIGN)' - You can include `BLOCK()' specification to advance the location - counter `.' prior to the beginning of the section, so that the - section will begin at the specified alignment. ALIGN is an - expression. - -`(NOLOAD)' - Use `(NOLOAD)' to prevent a section from being loaded into memory - each time it is accessed. For example, in the script sample - below, the `ROM' segment is addressed at memory location `0' and - does not need to be loaded into each object file: - - SECTIONS { - ROM 0 (NOLOAD) : { ... } - ... - } - -`AT ( LDADR )' - The expression LDADR that follows the `AT' keyword specifies the - load address of the section. The default (if you do not use the - `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 `SECTIONS' definition - creates two output sections: one called `.text', which starts at - `0x1000', and one called `.mdata', which is loaded at the end of - the `.text' section even though its relocation address is - `0x2000'. The symbol `_data' is defined with the value `0x2000': - - SECTIONS - { - .text 0x1000 : { *(.text) _etext = . ; } - .mdata 0x2000 : - AT ( ADDR(.text) + SIZEOF ( .text ) ) - { _data = . ; *(.data); _edata = . ; } - .bss 0x3000 : - { _bstart = . ; *(.bss) *(COMMON) ; _bend = . ;} - } - - The run-time initialization code (for C programs, usually `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: - - char *src = _etext; - char *dst = _data; - - /* ROM has data at end of text; copy it. */ - while (dst < _edata) { - *dst++ = *src++; - } - - /* Zero bss */ - for (dst = _bstart; dst< _bend; dst++) - *dst = 0; - -`>REGION' - Assign this section to a previously defined region of memory. - *Note MEMORY::. - -`=FILL' - Including `=FILL' in a section definition specifies the initial - fill value for that section. You may use any expression to - specify 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 `FILL' statement in the CONTENTS - of a section definition. - - -File: ld.info, Node: Entry Point, Next: Option Commands, Prev: SECTIONS, Up: Commands - -The Entry Point -=============== - - The linker command language includes a command specifically for -defining the first executable instruction in an output file (its "entry -point"). Its argument is a symbol name: - ENTRY(SYMBOL) - - Like symbol assignments, the `ENTRY' command may be placed either as -an independent command in the command file, or among the section -definitions within the `SECTIONS' command--whatever makes the most -sense for your layout. - - `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). - * the `-e' ENTRY command-line option; - - * the `ENTRY(SYMBOL)' command in a linker control script; - - * the value of the symbol `start', if present; - - * the address of the first byte of the `.text' section, if present; - - * The address `0'. - - For example, you can use these rules to generate an entry point with -an assignment statement: if no symbol `start' is defined within your -input files, you can simply define it, assigning it an appropriate -value-- - - start = 0x2020; - -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 `start': - - start = other_symbol ; - - -File: ld.info, Node: Option Commands, Prev: Entry Point, Up: Commands - -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. - -`CONSTRUCTORS' - This command ties up C++ style constructor and destructor records. - The details of the constructor representation vary from one - object format to another, but usually lists of constructors and - destructors appear as special sections. The `CONSTRUCTORS' - command specifies where the linker is to place the data from these - sections, relative to the rest of the linked output. Constructor - data is marked by the symbol `__CTOR_LIST__' at the start, and - `__CTOR_LIST_END' at the end; destructor data is bracketed - similarly, between `__DTOR_LIST__' and `__DTOR_LIST_END'. (The - compiler must arrange to actually run this code; GNU C++ calls - constructors from a subroutine `__main', which it inserts - automatically into the startup code for `main', and destructors - from `_exit'.) - -`FLOAT' -`NOFLOAT' - These keywords were used in some older linkers to request a - particular math subroutine library. `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 `FLOAT' and `NOFLOAT' are accepted - and ignored. - -`FORCE_COMMON_ALLOCATION' - This command has the same effect as the `-d' command-line option: - to make `ld' assign space to common symbols even if a relocatable - output file is specified (`-r'). - -`INPUT ( FILE, FILE, ... )' -`INPUT ( FILE FILE ... )' - 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 FILE, including `.a' if required. - - `ld' searches for each FILE through the archive-library search - path, just as for files you specify on the command line. See the - description of `-L' in *Note Command Line Options: Options. - - If you use `-lFILE', `ld' will transform the name to `libFILE.a' - as with the command line argument `-l'. - -`GROUP ( FILE, FILE, ... )' -`GROUP ( FILE FILE ... )' - This command is like `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 `-(' in - *Note Command Line Options: Options. - -`OUTPUT ( FILENAME )' - Use this command to name the link output file FILENAME. The - effect of `OUTPUT(FILENAME)' is identical to the effect of - `-o FILENAME', which overrides it. You can use this command to - supply a default output-file name other than `a.out'. - -`OUTPUT_ARCH ( BFDNAME )' - Specify a particular output machine architecture, with one of the - names used by the BFD back-end routines (*note 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 `OUTPUT_FORMAT' command. - -`OUTPUT_FORMAT ( BFDNAME )' - When `ld' is configured to support multiple object code formats, - you can use this command to specify a particular output format. - bFDNAME is one of the names used by the BFD back-end routines - (*note BFD::.). The effect is identical to the effect of the - `-oformat' command-line option. This selection affects only the - output file; the related command `TARGET' affects primarily input - files. - -`SEARCH_DIR ( PATH )' - Add PATH to the list of paths where `ld' looks for archive - libraries. `SEARCH_DIR(PATH)' has the same effect as `-LPATH' on - the command line. - -`STARTUP ( FILENAME )' - Ensure that FILENAME is the first input file used in the link - process. - -`TARGET ( FORMAT )' - When `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 `-b' or its synonym - `-format'). The argument FORMAT is one of the strings used by BFD - to name binary formats. If `TARGET' is specified but - `OUTPUT_FORMAT' is not, the last `TARGET' argument is also used as - the default format for the `ld' output file. *Note BFD::. - - If you don't use the `TARGET' command, `ld' uses the value of the - environment variable `GNUTARGET', if available, to select the - output file format. If that variable is also absent, `ld' uses - the default format configured for your machine in the BFD - libraries. - - -File: ld.info, Node: Machine Dependent, Next: BFD, Prev: Commands, Up: Top - -Machine Dependent Features -************************** - - `ld' has additional features on some platforms; the following -sections describe them. Machines where `ld' has no additional -functionality are not listed. - -* Menu: - -* H8/300:: `ld' and the H8/300 -* i960:: `ld' and the Intel 960 family - - -File: ld.info, Node: H8/300, Next: i960, Up: Machine Dependent - -`ld' and the H8/300 -=================== - - For the H8/300, `ld' can perform these global optimizations when you -specify the `-relax' command-line option. - -*relaxing address modes* - `ld' finds all `jsr' and `jmp' instructions whose targets are - within eight bits, and turns them into eight-bit program-counter - relative `bsr' and `bra' instructions, respectively. - -*synthesizing instructions* - `ld' finds all `mov.b' instructions which use the sixteen-bit - absolute address form, but refer to the top page of memory, and - changes them to use the eight-bit address form. (That is: the - linker turns `mov.b `@'AA:16' into `mov.b `@'AA:8' whenever the - address AA is in the top page of memory). - - -File: ld.info, Node: i960, Prev: H8/300, Up: Machine Dependent - -`ld' and the Intel 960 family -============================= - - You can use the `-AARCHITECTURE' command line option to specify one -of the two-letter names identifying members of the 960 family; the -option specifies the desired output target, and warns of any -incompatible instructions in the input files. It also modifies the -linker's search strategy for archive libraries, to support the use of -libraries specific to each particular architecture, by including in the -search loop names suffixed with the string identifying the architecture. - - For example, if your `ld' command line included `-ACA' as well as -`-ltry', the linker would look (in its built-in search paths, and in -any paths you specify with `-L') for a library with the names - - try - libtry.a - tryca - libtryca.a - -The first two possibilities would be considered in any event; the last -two are due to the use of `-ACA'. - - You can meaningfully use `-A' more than once on a command line, since -the 960 architecture family allows combination of target architectures; -each use will add another pair of name variants to search for when `-l' -specifies a library. - - `ld' supports the `-relax' option for the i960 family. If you -specify `-relax', `ld' finds all `balx' and `calx' instructions whose -targets are within 24 bits, and turns them into 24-bit program-counter -relative `bal' and `cal' instructions, respectively. `ld' also turns -`cal' instructions into `bal' instructions when it determines that the -target subroutine is a leaf routine (that is, the target subroutine does -not itself call any subroutines). - - -File: ld.info, Node: BFD, Next: MRI, Prev: Machine Dependent, Up: Top - -BFD -*** - - The linker accesses object and archive files using the BFD libraries. -These libraries allow the linker to use the same routines to operate on -object files whatever the object file format. A different object file -format can be supported simply by creating a new BFD back end and adding -it to the library. To conserve runtime memory, however, the linker and -associated tools are usually configured to support only a subset of the -object file formats available. You can use `objdump -i' (*note -objdump: (binutils.info)objdump.) to list all the formats available for -your configuration. - - As with most implementations, BFD is a compromise between several -conflicting requirements. The major factor influencing BFD design was -efficiency: any time used converting between formats is time which -would not have been spent had BFD not been involved. This is partly -offset by abstraction payback; since BFD simplifies applications and -back ends, more time and care may be spent optimizing algorithms for a -greater speed. - - One minor artifact of the BFD solution which you should bear in mind -is the potential for information loss. There are two places where -useful information can be lost using the BFD mechanism: during -conversion and during output. *Note BFD information loss::. - -* Menu: - -* BFD outline:: How it works: an outline of BFD - - -File: ld.info, Node: BFD outline, Up: BFD - -How it works: an outline of BFD -=============================== - - When an object file is opened, BFD subroutines automatically -determine the format of the input object file. They then build a -descriptor in memory with pointers to routines that will be used to -access elements of the object file's data structures. - - As different information from the the object files is required, BFD -reads from different sections of the file and processes them. For -example, a very common operation for the linker is processing symbol -tables. Each BFD back end provides a routine for converting between -the object file's representation of symbols and an internal canonical -format. When the linker asks for the symbol table of an object file, it -calls through a memory pointer to the routine from the relevant BFD -back end which reads and converts the table into a canonical form. The -linker then operates upon the canonical form. When the link is finished -and the linker writes the output file's symbol table, another BFD back -end routine is called to take the newly created symbol table and -convert it into the chosen output format. - -* Menu: - -* BFD information loss:: Information Loss -* Canonical format:: The BFD canonical object-file format - - -File: ld.info, Node: BFD information loss, Next: Canonical format, Up: BFD outline - -Information Loss ----------------- - - *Information can be lost during output.* The output formats -supported by BFD do not provide identical facilities, and information -which can be described in one form has nowhere to go in another format. -One example of this is alignment information in `b.out'. There is -nowhere in an `a.out' format file to store alignment information on the -contained data, so when a file is linked from `b.out' and an `a.out' -image is produced, alignment information will not propagate to the -output file. (The linker will still use the alignment information -internally, so the link is performed correctly). - - Another example is COFF section names. COFF files may contain an -unlimited number of sections, each one with a textual section name. If -the target of the link is a format which does not have many sections -(e.g., `a.out') or has sections without names (e.g., the Oasys format), -the link cannot be done simply. You can circumvent this problem by -describing the desired input-to-output section mapping with the linker -command language. - - *Information can be lost during canonicalization.* The BFD internal -canonical form of the external formats is not exhaustive; there are -structures in input formats for which there is no direct representation -internally. This means that the BFD back ends cannot maintain all -possible data richness through the transformation between external to -internal and back to external formats. - - This limitation is only a problem when an application reads one -format and writes another. Each BFD back end is responsible for -maintaining as much data as possible, and the internal BFD canonical -form has structures which are opaque to the BFD core, and exported only -to the back ends. When a file is read in one format, the canonical form -is generated for BFD and the application. At the same time, the back -end saves away any information which may otherwise be lost. If the data -is then written back in the same format, the back end routine will be -able to use the canonical form provided by the BFD core as well as the -information it prepared earlier. Since there is a great deal of -commonality between back ends, there is no information lost when -linking or copying big endian COFF to little endian COFF, or `a.out' to -`b.out'. When a mixture of formats is linked, the information is only -lost from the files whose format differs from the destination. - - -File: ld.info, Node: Canonical format, Prev: BFD information loss, Up: BFD outline - -The BFD canonical object-file format ------------------------------------- - - The greatest potential for loss of information occurs when there is -the least overlap between the information provided by the source -format, that stored by the canonical format, and that needed by the -destination format. A brief description of the canonical form may help -you understand which kinds of data you can count on preserving across -conversions. - -*files* - Information stored on a per-file basis includes target machine - architecture, particular implementation format type, a demand - pageable bit, and a write protected bit. Information like Unix - magic numbers is not stored here--only the magic numbers' meaning, - so a `ZMAGIC' file would have both the demand pageable bit and the - write protected text bit set. The byte order of the target is - stored on a per-file basis, so that big- and little-endian object - files may be used with one another. - -*sections* - Each section in the input file contains the name of the section, - the section's original address in the object file, size and - alignment information, various flags, and pointers into other BFD - data structures. - -*symbols* - Each symbol contains a pointer to the information for the object - file which originally defined it, its name, its value, and various - flag bits. When a BFD back end reads in a symbol table, it - relocates all symbols to make them relative to the base of the - section where they were defined. Doing this ensures that each - symbol points to its containing section. Each symbol also has a - varying amount of hidden private data for the BFD back end. Since - the symbol points to the original file, the private data format - for that symbol is accessible. `ld' can operate on a collection - of symbols of wildly different formats without problems. - - Normal global and simple local symbols are maintained on output, - so an output file (no matter its format) will retain symbols - pointing to functions and to global, static, and common variables. - Some symbol information is not worth retaining; in `a.out', type - information is stored in the symbol table as long symbol names. - This information would be useless to most COFF debuggers; the - linker has command line switches to allow users to throw it away. - - There is one word of type information within the symbol, so if the - format supports symbol type information within symbols (for - example, COFF, IEEE, Oasys) and the type is simple enough to fit - within one word (nearly everything but aggregates), the - information will be preserved. - -*relocation level* - Each canonical BFD relocation record contains a pointer to the - symbol to relocate to, the offset of the data to relocate, the - section the data is in, and a pointer to a relocation type - descriptor. Relocation is performed by passing messages through - the relocation type descriptor and the symbol pointer. Therefore, - relocations can be performed on output data using a relocation - method that is only available in one of the input formats. For - instance, Oasys provides a byte relocation format. A relocation - record requesting this relocation type would point indirectly to a - routine to perform this, so the relocation may be performed on a - byte being written to a 68k COFF file, even though 68k COFF has no - such relocation type. - -*line numbers* - Object formats can contain, for debugging purposes, some form of - mapping between symbols, source line numbers, and addresses in the - output file. These addresses have to be relocated along with the - symbol information. Each symbol with an associated list of line - number records points to the first record of the list. The head - of a line number list consists of a pointer to the symbol, which - allows finding out the address of the function whose line number - is being described. The rest of the list is made up of pairs: - offsets into the section and line numbers. Any format which can - simply derive this information can pass it successfully between - formats (COFF, IEEE and Oasys). - - -File: ld.info, Node: MRI, Next: Index, Prev: BFD, Up: Top - -MRI Compatible Script Files -*************************** - - To aid users making the transition to GNU `ld' from the MRI linker, -`ld' can use MRI compatible linker scripts as an alternative to the -more general-purpose linker scripting language described in *Note -Command Language: Commands. MRI compatible linker scripts have a much -simpler command set than the scripting language otherwise used with -`ld'. GNU `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 `a.out' object -file format, since it only has three sections and MRI scripts lack some -features to make use of them. - - You can specify a file containing an MRI-compatible script using the -`-c' command-line option. - - Each command in an MRI-compatible script occupies its own line; each -command line starts with the keyword that identifies the command (though -blank lines are also allowed for punctuation). If a line of an -MRI-compatible script begins with an unrecognized keyword, `ld' issues -a warning message, but continues processing the script. - - Lines beginning with `*' are comments. - - You can write these commands using all upper-case letters, or all -lower case; for example, `chip' is the same as `CHIP'. The following -list shows only the upper-case form of each command. - -`ABSOLUTE SECNAME' -`ABSOLUTE SECNAME, SECNAME, ... SECNAME' - Normally, `ld' includes in the output file all sections from all - the input files. However, in an MRI-compatible script, you can - use the `ABSOLUTE' command to restrict the sections that will be - present in your output program. If the `ABSOLUTE' command is used - at all in a script, then only the sections named explicitly in - `ABSOLUTE' commands will appear in the linker output. You can - still use other input sections (whatever you select on the command - line, or using `LOAD') to resolve addresses in the output file. - -`ALIAS OUT-SECNAME, IN-SECNAME' - Use this command to place the data from input section IN-SECNAME - in a section called OUT-SECNAME in the linker output file. - - IN-SECNAME may be an integer. - -`ALIGN SECNAME = EXPRESSION' - Align the section called SECNAME to EXPRESSION. The EXPRESSION - should be a power of two. - -`BASE EXPRESSION' - Use the value of EXPRESSION as the lowest address (other than - absolute addresses) in the output file. - -`CHIP EXPRESSION' -`CHIP EXPRESSION, EXPRESSION' - This command does nothing; it is accepted only for compatibility. - -`END' - This command does nothing whatever; it's only accepted for - compatibility. - -`FORMAT OUTPUT-FORMAT' - Similar to the `OUTPUT_FORMAT' command in the more general linker - language, but restricted to one of these output formats: - - 1. S-records, if OUTPUT-FORMAT is `S' - - 2. IEEE, if OUTPUT-FORMAT is `IEEE' - - 3. COFF (the `coff-m68k' variant in BFD), if OUTPUT-FORMAT is - `COFF' - -`LIST ANYTHING...' - Print (to the standard output file) a link map, as produced by the - `ld' command-line option `-M'. - - The keyword `LIST' may be followed by anything on the same line, - with no change in its effect. - -`LOAD FILENAME' -`LOAD FILENAME, FILENAME, ... FILENAME' - Include one or more object file FILENAME in the link; this has the - same effect as specifying FILENAME directly on the `ld' command - line. - -`NAME OUTPUT-NAME' - OUTPUT-NAME is the name for the program produced by `ld'; the - MRI-compatible command `NAME' is equivalent to the command-line - option `-o' or the general script language command `OUTPUT'. - -`ORDER SECNAME, SECNAME, ... SECNAME' -`ORDER SECNAME SECNAME SECNAME' - Normally, `ld' orders the sections in its output file in the order - in which they first appear in the input files. In an - MRI-compatible script, you can override this ordering with the - `ORDER' command. The sections you list with `ORDER' will appear - first in your output file, in the order specified. - -`PUBLIC NAME=EXPRESSION' -`PUBLIC NAME,EXPRESSION' -`PUBLIC NAME EXPRESSION' - Supply a value (EXPRESSION) for external symbol NAME used in the - linker input files. - -`SECT SECNAME, EXPRESSION' -`SECT SECNAME=EXPRESSION' -`SECT SECNAME EXPRESSION' - You can use any of these three forms of the `SECT' command to - specify the start address (EXPRESSION) for section SECNAME. If - you have more than one `SECT' statement for the same SECNAME, only - the *first* sets the start address. - diff --git a/gnu/usr.bin/binutils/ld/ld.info-3 b/gnu/usr.bin/binutils/ld/ld.info-3 deleted file mode 100644 index 2b364a6ec08..00000000000 --- a/gnu/usr.bin/binutils/ld/ld.info-3 +++ /dev/null @@ -1,343 +0,0 @@ -This is Info file ld.info, produced by Makeinfo-1.55 from the input -file ./ld.texinfo. - -START-INFO-DIR-ENTRY -* Ld: (ld). The GNU linker. -END-INFO-DIR-ENTRY - - This file documents the GNU linker LD. - - Copyright (C) 1991, 92, 93, 94, 1995 Free Software Foundation, Inc. - - Permission is granted to make and distribute verbatim copies of this -manual provided the copyright notice and this permission notice are -preserved on all copies. - - Permission is granted to copy and distribute modified versions of -this manual under the conditions for verbatim copying, provided also -that the entire resulting derived work is distributed under the terms -of a permission notice identical to this one. - - Permission is granted to copy and distribute translations of this -manual into another language, under the above conditions for modified -versions. - - -File: ld.info, Node: Index, Prev: MRI, Up: Top - -Index -***** - -* Menu: - -* ": Symbols. -* *( COMMON ): Section Placement. -* *(SECTION): Section Placement. -* -(: Options. -* -verbose: Options. -* -whole-archive: Options. -* -AARCH: Options. -* -b FORMAT: Options. -* -Bdynamic: Options. -* -Bstatic: Options. -* -Bsymbolic: Options. -* -c MRI-CMDFILE: Options. -* -d: Options. -* -dc: Options. -* -defsym SYMBOL=EXP: Options. -* -dp: Options. -* -dynamic-linker FILE: Options. -* -e ENTRY: Options. -* -embedded-relocs: Options. -* -F: Options. -* -format: Options. -* -g: Options. -* -G: Options. -* -help: Options. -* -i: Options. -* -lARCHIVE: Options. -* -LDIR: Options. -* -M: Options. -* -m EMULATION: Options. -* -Map: Options. -* -n: Options. -* -N: Options. -* -no-keep-memory: Options. -* -noinhibit-exec: Options. -* -o OUTPUT: Options. -* -oformat: Options. -* -r: Options. -* -R FILE: Options. -* -relax: Options. -* -rpath: Options. -* -rpath-link: Options. -* -S: Options. -* -s: Options. -* -shared: Options. -* -soname: Options. -* -sort-common: Options. -* -t: Options. -* -T SCRIPT: Options. -* -Tbss ORG: Options. -* -Tdata ORG: Options. -* -traditional-format: Options. -* -Ttext ORG: Options. -* -u SYMBOL: Options. -* -Ur: Options. -* -v: Options. -* -V: Options. -* -version: Options. -* -warn-comon: Options. -* -warn-constructors: Options. -* -warn-once: Options. -* -x: Options. -* -X: Options. -* -y SYMBOL: Options. -* .: Location Counter. -* 0x: Integers. -* ;: Assignment. -* =FILL: Section Options. -* >REGION: Section Options. -* -relax on i960: i960. -* ABSOLUTE (MRI): MRI. -* ALIAS (MRI): MRI. -* ALIGN (MRI): MRI. -* BASE (MRI): MRI. -* CHIP (MRI): MRI. -* END (MRI): MRI. -* FORMAT (MRI): MRI. -* LIST (MRI): MRI. -* LOAD (MRI): MRI. -* NAME (MRI): MRI. -* ORDER (MRI): MRI. -* PUBLIC (MRI): MRI. -* SECT (MRI): MRI. -* [SECTION...], not supported: Section Placement. -* GNU linker: Overview. -* FILENAME: Section Placement. -* FILENAME(SECTION): Section Placement. -* SYMBOL = EXPRESSION ;: Section Data Expressions. -* SYMBOL F= EXPRESSION ;: Section Data Expressions. -* absolute and relocatable symbols: Assignment. -* ABSOLUTE(EXP): Arithmetic Functions. -* ADDR(SECTION): Arithmetic Functions. -* ALIGN(EXP): Arithmetic Functions. -* aligning sections: Section Options. -* allocating memory: MEMORY. -* architectures: Options. -* archive files, from cmd line: Options. -* arithmetic: Expressions. -* arithmetic operators: Operators. -* assignment in scripts: Assignment. -* assignment, in section defn: Section Data Expressions. -* AT ( LDADR ): Section Options. -* back end: BFD. -* BFD canonical format: Canonical format. -* BFD requirements: BFD. -* binary input files: Option Commands. -* binary input format: Options. -* BLOCK(ALIGN): Section Options. -* BYTE(EXPRESSION): Section Data Expressions. -* C++ constructors, arranging in link: Option Commands. -* combining symbols, warnings on: Options. -* command files: Commands. -* command line: Options. -* commands, fundamental: Scripts. -* comments: Scripts. -* common allocation: Options. -* common allocation: Option Commands. -* commons in output: Section Placement. -* compatibility, MRI: Options. -* constructors: Options. -* CONSTRUCTORS: Option Commands. -* constructors, arranging in link: Option Commands. -* contents of a section: Section Placement. -* CREATE_OBJECT_SYMBOLS: Section Data Expressions. -* current output location: Location Counter. -* dbx: Options. -* decimal integers: Integers. -* default input format: Environment. -* DEFINED(SYMBOL): Arithmetic Functions. -* deleting local symbols: Options. -* direct output: Section Data Expressions. -* discontinuous memory: MEMORY. -* dot: Location Counter. -* dynamic linker, from command line: Options. -* emulation: Options. -* entry point, defaults: Entry Point. -* entry point, from command line: Options. -* ENTRY(SYMBOL): Entry Point. -* expression evaluation order: Evaluation. -* expression syntax: Expressions. -* expression, absolute: Arithmetic Functions. -* expressions in a section: Section Data Expressions. -* filename symbols: Section Data Expressions. -* files and sections, section defn: Section Placement. -* files, including in output sections: Section Placement. -* fill pattern, entire section: Section Options. -* FILL(EXPRESSION): Section Data Expressions. -* first input file: Option Commands. -* first instruction: Entry Point. -* FLOAT: Option Commands. -* FORCE_COMMON_ALLOCATION: Option Commands. -* format, output file: Option Commands. -* functions in expression language: Arithmetic Functions. -* fundamental script commands: Scripts. -* GNUTARGET: Environment. -* GNUTARGET: Option Commands. -* GROUP ( FILES ): Option Commands. -* grouping input files: Option Commands. -* groups of archives: Options. -* H8/300 support: H8/300. -* header size: Arithmetic Functions. -* help: Options. -* hexadecimal integers: Integers. -* holes: Location Counter. -* holes, filling: Section Data Expressions. -* i960 support: i960. -* including an entire archive: Options. -* incremental link: Options. -* INPUT ( FILES ): Option Commands. -* input file format: Option Commands. -* input filename symbols: Section Data Expressions. -* input files, displaying: Options. -* input files, section defn: Section Placement. -* input format: Options. -* input format: Options. -* input sections to output section: Section Placement. -* integer notation: Integers. -* integer suffixes: Integers. -* internal object-file format: Canonical format. -* K and M integer suffixes: Integers. -* l =: MEMORY. -* L, deleting symbols beginning: Options. -* layout of output file: Scripts. -* lazy evaluation: Evaluation. -* len =: MEMORY. -* LENGTH =: MEMORY. -* link map: Options. -* link map: Options. -* link-time runtime library search path: Options. -* load address, specifying: Section Options. -* loading, preventing: Section Options. -* local symbols, deleting: Options. -* location counter: Location Counter. -* LONG(EXPRESSION): Section Data Expressions. -* M and K integer suffixes: Integers. -* machine architecture, output: Option Commands. -* machine dependencies: Machine Dependent. -* MEMORY: MEMORY. -* memory region attributes: MEMORY. -* memory regions and sections: Section Options. -* memory usage: Options. -* MIPS embedded PIC code: Options. -* MRI compatibility: MRI. -* names: Symbols. -* naming memory regions: MEMORY. -* naming output sections: Section Definition. -* naming the output file: Options. -* naming the output file: Option Commands. -* negative integers: Integers. -* NEXT(EXP): Arithmetic Functions. -* NMAGIC: Options. -* NOFLOAT: Option Commands. -* NOLOAD: Section Options. -* Non constant expression: Assignment. -* o =: MEMORY. -* objdump -i: BFD. -* object file management: BFD. -* object files: Options. -* object formats available: BFD. -* object size: Options. -* octal integers: Integers. -* OMAGIC: Options. -* opening object files: BFD outline. -* Operators for arithmetic: Operators. -* options: Options. -* org =: MEMORY. -* ORIGIN =: MEMORY. -* OUTPUT ( FILENAME ): Option Commands. -* output file after errors: Options. -* output file layout: Scripts. -* OUTPUT_ARCH ( BFDNAME ): Option Commands. -* OUTPUT_FORMAT ( BFDNAME ): Option Commands. -* partial link: Options. -* path for libraries: Option Commands. -* precedence in expressions: Operators. -* prevent unnecessary loading: Section Options. -* provide: Assignment. -* QUAD(EXPRESSION): Section Data Expressions. -* quoted symbol names: Symbols. -* read-only text: Options. -* read/write from cmd line: Options. -* regions of memory: MEMORY. -* relaxing addressing modes: Options. -* relaxing on H8/300: H8/300. -* relaxing on i960: i960. -* relocatable and absolute symbols: Assignment. -* relocatable output: Options. -* requirements for BFD: BFD. -* retaining specified symbols: Options. -* rounding up location counter: Arithmetic Functions. -* runtime library name: Options. -* runtime library search path: Options. -* scaled integers: Integers. -* script files: Options. -* search directory, from cmd line: Options. -* search path, libraries: Option Commands. -* SEARCH_DIR ( PATH ): Option Commands. -* section address: Section Options. -* section address: Arithmetic Functions. -* section alignment: Section Options. -* section definition: Section Definition. -* section defn, full syntax: Section Options. -* section fill pattern: Section Options. -* section size: Arithmetic Functions. -* section start: Section Options. -* section, assigning to memory region: Section Options. -* SECTIONS: SECTIONS. -* segment origins, cmd line: Options. -* semicolon: Assignment. -* shared libraries: Options. -* SHORT(EXPRESSION): Section Data Expressions. -* SIZEOF(SECTION): Arithmetic Functions. -* sizeof_headers: Arithmetic Functions. -* SIZEOF_HEADERS: Arithmetic Functions. -* specify load address: Section Options. -* split: Options. -* split: Options. -* standard Unix system: Options. -* start address, section: Section Options. -* start of execution: Entry Point. -* STARTUP ( FILENAME ): Option Commands. -* strip all symbols: Options. -* strip debugger symbols: Options. -* stripping all but some symbols: Options. -* suffixes for integers: Integers. -* symbol defaults: Arithmetic Functions. -* symbol definition, scripts: Assignment. -* symbol names: Symbols. -* symbol tracing: Options. -* symbol-only input: Options. -* symbols, from command line: Options. -* symbols, relocatable and absolute: Assignment. -* symbols, retaining selectively: Options. -* synthesizing linker: Options. -* synthesizing on H8/300: H8/300. -* TARGET ( FORMAT ): Option Commands. -* traditional format: Options. -* unallocated address, next: Arithmetic Functions. -* undefined symbol: Options. -* undefined symbols, warnings on: Options. -* uninitialized data: Section Placement. -* unspecified memory: Section Data Expressions. -* usage: Options. -* variables, defining: Assignment. -* verbose: Options. -* version: Options. -* version: Options. -* warnings, on combining symbols: Options. -* warnings, on undefined symbols: Options. -* what is this?: Overview. - - diff --git a/gnu/usr.bin/binutils/ld/ld.texinfo b/gnu/usr.bin/binutils/ld/ld.texinfo index b782ce21edf..aae0935e75d 100644 --- a/gnu/usr.bin/binutils/ld/ld.texinfo +++ b/gnu/usr.bin/binutils/ld/ld.texinfo @@ -17,7 +17,7 @@ END-INFO-DIR-ENTRY @ifinfo This file documents the @sc{gnu} linker LD. -Copyright (C) 1991, 92, 93, 94, 1995 Free Software Foundation, Inc. +Copyright (C) 1991, 92, 93, 94, 95, 1996 Free Software Foundation, Inc. Permission is granted to make and distribute verbatim copies of this manual provided the copyright notice and this permission notice @@ -64,7 +64,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, 1995 Free Software Foundation, Inc. +Copyright @copyright{} 1991, 92, 93, 94, 95, 1996 Free Software Foundation, Inc. Permission is granted to make and distribute verbatim copies of this manual provided the copyright notice and this permission notice @@ -160,40 +160,8 @@ you have many choices to control its behavior. @cindex command line @cindex options -Here is a summary of the options you can use on the @code{ld} command -line: - -@c FIXME! -relax only avail h8/300, i960. Conditionals screwed in examples. -@smallexample -ld [ -o @var{output} ] @var{objfile}@dots{} - [ -A@var{architecture} ] [ -b @var{input-format} ] - [ -Bstatic ] [ -Bdynamic ] [ -Bsymbolic ] - [ -c @var{MRI-commandfile} ] [ -d | -dc | -dp ] - [ -defsym @var{symbol}=@var{expression} ] - [ -dynamic-linker @var{file} ] [ -embedded-relocs ] - [ -e @var{entry} ] [ -F ] [ -F @var{format} ] - [ -format @var{input-format} ] [ -g ] [ -G @var{size} ] - [ -help ] [ -i ] [ -l@var{archive} ] [ -L@var{searchdir} ] - [ -M ] [ -Map @var{mapfile} ] [ -m @var{emulation} ] - [ -N | -n ] [ -noinhibit-exec ] [ -no-keep-memory ] - [ -oformat @var{output-format} ] [ -R @var{filename} ] - [ -relax ] [ -retain-symbols-file @var{filename} ] - [ -r | -Ur ] [ -rpath @var{dir} ] [-rpath-link @var{dir} ] - [ -S ] [ -s ] [ -soname @var{name} ] [ -shared ] - [ -sort-common ] [ -stats ] [ -T @var{commandfile} ] - [ -Ttext @var{org} ] [ -Tdata @var{org} ] - [ -Tbss @var{org} ] [ -t ] [ -traditional-format ] - [ -u @var{symbol}] [-V] [-v] [ -verbose] [ -version ] - [ -warn-common ] [ -warn-constructors] [ -warn-once ] - [ -y @var{symbol} ] [ -X ] [-x ] - [ -( [ archives ] -) ] - [ --start-group [ archives ] --end-group ] - [ -split-by-reloc @var{count} ] [ -split-by-file ] - [ --whole-archive ] -@end smallexample - -This plethora of command-line options may seem intimidating, but in -actual practice few of them are used in any particular context. +The linker supports a plethora of command-line options, but in actual +practice few of them are used in any particular context. @cindex standard Unix system For instance, a frequent use of @code{ld} is to link standard Unix object files on a standard, supported Unix system. On such a system, to @@ -209,28 +177,17 @@ 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 +may be repeated at will. Repeating most options with a different +argument will either have no further effect, or override prior occurrences (those further to the left on the command line) of that -option. - -@ifclear SingleFormat -The exceptions---which may meaningfully be used more than once---are -@samp{-A}, @samp{-b} (or its synonym @samp{-format}), @samp{-defsym}, -@samp{-L}, @samp{-l}, @samp{-R}, @samp{-u}, and @samp{-(} (or its -synonym @samp{--start-group}).. -@end ifclear -@ifset SingleFormat -The exceptions---which may meaningfully be used more than once---are -@samp{-A}, @samp{-defsym}, @samp{-L}, @samp{-l}, @samp{-R}, @samp{-u}, -and @samp{-(} (or its synonym @samp{--start-group}). -@end ifset +option. Options which may be meaningfully specified more than once are +noted in the descriptions below. @cindex object files -The list of object files to be linked together, shown as @var{objfile}@dots{}, -may follow, precede, or be mixed in with command-line options, except that -an @var{objfile} argument may not be placed between an option and -its argument. +Non-option arguments are objects files which are to be linked together. +They may follow, precede, or be mixed in with command-line options, +except that an object file argument may not be placed between an option +and its argument. Usually the linker is invoked with at least one object file, but you can specify other forms of binary input files using @samp{-l}, @samp{-R}, @@ -261,10 +218,20 @@ requires them. For example, @samp{--oformat srec} and of multiple-letter options are accepted. @table @code +@kindex -a@var{keyword} +@item -a@var{keyword} +This option is supported for HP/UX compatibility. The @var{keyword} +argument must be one of the strings @samp{archive}, @samp{shared}, or +@samp{default}. @samp{-aarchive} is functionally equivalent to +@samp{-Bstatic}, and the other two keywords are functionally equivalent +to @samp{-Bdynamic}. This option may be used any number of times. + @ifset I960 @cindex architectures @kindex -A@var{arch} @item -A@var{architecture} +@kindex --architecture=@var{arch} +@itemx --architecture=@var{architecture} In the current release of @code{ld}, this option is useful only for the Intel 960 family of architectures. In that @code{ld} configuration, the @var{architecture} argument identifies the particular architecture in @@ -279,9 +246,11 @@ other architecture families. @ifclear SingleFormat @cindex binary input format @kindex -b @var{format} +@kindex --format=@var{format} @cindex input format @cindex input format @item -b @var{input-format} +@itemx --format=@var{input-format} @code{ld} may be configured to support more than one kind of object file. If your @code{ld} is configured this way, you can use the @samp{-b} option to specify the binary format for input object files @@ -291,8 +260,7 @@ to specify this, as @code{ld} should be configured to expect as a default input format the most usual format on each machine. @var{input-format} is a text string, the name of a particular format supported by the BFD libraries. (You can list the available binary -formats with @samp{objdump -i}.) @w{@samp{-format @var{input-format}}} -has the same effect, as does the script command @code{TARGET}. +formats with @samp{objdump -i}.) @xref{BFD}. You may want to use this option if you are linking files with an unusual @@ -311,28 +279,11 @@ format from a script, using the command @code{TARGET}; see @ref{Option Commands}. @end ifclear -@kindex -Bstatic -@item -Bstatic -Do not link against shared libraries. This is only meaningful on -platforms for which shared libraries are supported. - -@kindex -Bdynamic -@item -Bdynamic -Link against dynamic libraries. This is only meaningful on platforms -for which shared libraries are supported. This option is normally the -default on such platforms. - -@kindex -Bsymbolic -@item -Bsymbolic -When creating a shared library, bind references to global symbols to the -definition within the shared library, if any. Normally, it is possible -for a program linked against a shared library to override the definition -within the shared library. This option is only meaningful on ELF -platforms which support shared libraries. - @kindex -c @var{MRI-cmdfile} +@kindex --mri-script=@var{MRI-cmdfile} @cindex compatibility, MRI @item -c @var{MRI-commandfile} +@itemx --mri-script=@var{MRI-commandfile} For compatibility with linkers produced by MRI, @code{ld} accepts script files written in an alternate, restricted command language, described in @ref{MRI,,MRI Compatible Script Files}. Introduce MRI script files with @@ -355,48 +306,26 @@ specified (with @samp{-r}). The script command @code{FORCE_COMMON_ALLOCATION} has the same effect. @xref{Option Commands}. -@cindex symbols, from command line -@kindex -defsym @var{symbol}=@var{exp} -@item -defsym @var{symbol}=@var{expression} -Create a global symbol in the output file, containing the absolute -address given by @var{expression}. You may use this option as many -times as necessary to define multiple symbols in the command line. A -limited form of arithmetic is supported for the @var{expression} in this -context: you may give a hexadecimal constant or the name of an existing -symbol, or use @code{+} and @code{-} to add or subtract hexadecimal -constants or symbols. If you need more elaborate expressions, consider -using the linker command language from a script (@pxref{Assignment, , -Assignment: Symbol Definitions}). @emph{Note:} there should be no -white space between @var{symbol}, the equals sign (``@key{=}''), and -@var{expression}. - -@ifset GENERIC -@cindex dynamic linker, from command line -@kindex -dynamic-linker @var{file} -@item -dynamic-linker @var{file} -Set the name of the dynamic linker. This is only meaningful when -generating dynamically linked ELF executables. The default dynamic -linker is normally correct; don't use this unless you know what you are -doing. -@end ifset - -@cindex MIPS embedded PIC code -@kindex -embedded-relocs -@item -embedded-relocs -This option is only meaningful when linking MIPS embedded PIC code, -generated by the -membedded-pic option to the @sc{gnu} compiler and -assembler. It causes the linker to create a table which may be used at -runtime to relocate any data which was statically initialized to pointer -values. See the code in testsuite/ld-empic for details. - @cindex entry point, from command line @kindex -e @var{entry} +@kindex --entry=@var{entry} @item -e @var{entry} +@itemx --entry=@var{entry} Use @var{entry} as the explicit symbol for beginning execution of your program, rather than the default entry point. @xref{Entry Point}, for a discussion of defaults and other ways of specifying the entry point. +@cindex dynamic symbol table +@kindex -E +@kindex -export-dynamic +@item -E +@itemx -export-dynamic +When creating a dynamically linked executable, add all symbols to the +dynamic symbol table. Normally, the dynamic symbol table contains only +symbols which are used by a dynamic object. This option is needed for +some uses of @code{dlopen}. + @ifclear SingleFormat @kindex -F @item -F @@ -409,28 +338,43 @@ option or the @code{TARGET} command in linker scripts for output files, the @code{GNUTARGET} environment variable) are more flexible, but @code{ld} accepts the @samp{-F} option for compatibility with scripts written to call the old linker. - -@kindex -format -@item -format @var{input-format} -Synonym for @samp{-b @var{input-format}}. @end ifclear +@kindex --force-exe-suffix +@item --force-exe-suffix +Make sure that an output file has a .exe suffix. + +If a successfully built fully linked output file does not have a +@code{.exe} or @code{.dll} suffix, this option forces the linker to copy +the output file to one of the same name with a @code{.exe} suffix. This +option is useful when using unmodified Unix makefiles on a Microsoft +Windows host, since some versions of Windows won't run an image unless +it ends in a @code{.exe} suffix. + @kindex -g @item -g Ignored. Provided for compatibility with other tools. @kindex -G +@kindex --gpsize @cindex object size @item -G@var{value} -@itemx -G @var{value} +@itemx --gpsize=@var{value} Set the maximum size of objects to be optimized using the GP register to -@var{size} under MIPS ECOFF. Ignored for other object file formats. +@var{size}. This is only meaningful for object file formats such as +MIPS ECOFF which supports putting large and small objects into different +sections. This is ignored for other object file formats. -@cindex help -@cindex usage -@kindex -help -@item -help -Print a summary of the command-line options on the standard output and exit. +@cindex runtime library name +@kindex -h@var{name} +@kindex -soname=@var{name} +@item -h@var{name} +@itemx -soname=@var{name} +When creating an ELF shared object, set the internal DT_SONAME field to +the specified name. When an executable is linked with a shared object +which has a DT_SONAME field, then when the executable is run the dynamic +linker will attempt to load the shared object specified by the DT_SONAME +field rather than the using the file name given to the linker. @kindex -i @cindex incremental link @@ -439,16 +383,20 @@ Perform an incremental link (same as option @samp{-r}). @cindex archive files, from cmd line @kindex -l@var{archive} -@item -l@var{ar} -Add archive file @var{archive} to the list of files to link. This +@kindex --library=@var{archive} +@item -l@var{archive} +@itemx --library=@var{archive} +Add archive file @var{archive} to the list of files to link. This option may be used any number of times. @code{ld} will search its -path-list for occurrences of @code{lib@var{ar}.a} for every @var{archive} -specified. +path-list for occurrences of @code{lib@var{archive}.a} for every +@var{archive} specified. File extensions other than @code{.a} may be +used on certain systems. @cindex search directory, from cmd line @kindex -L@var{dir} +@kindex --library-path=@var{dir} @item -L@var{searchdir} -@itemx -L @var{searchdir} +@itemx --library-path=@var{searchdir} Add path @var{searchdir} to the list of paths that @code{ld} will search for archive libraries and @code{ld} control scripts. You may use this option any number of times. The directories are searched in the order @@ -467,66 +415,323 @@ The paths can also be specified in a link script with the @code{SEARCH_DIR} command. Directories specified this way are searched at the point in which the linker script appears in the command line. -@cindex link map -@kindex -M -@item -M -Print (to the standard output) a link map---diagnostic information about -where symbols are mapped by @code{ld}, and information on global common -storage allocation. - -@cindex link map -@kindex -Map -@item -Map @var{mapfile} -Print to the file @var{mapfile} a link map---diagnostic information -about where symbols are mapped by @code{ld}, and information on global -common storage allocation. - @cindex emulation @kindex -m @var{emulation} @item -m@var{emulation} -@itemx -m @var{emulation} Emulate the @var{emulation} linker. You can list the available emulations with the @samp{--verbose} or @samp{-V} options. The default depends on how your @code{ld} was configured. +@cindex link map +@kindex -M +@kindex --print-map +@item -M +@itemx --print-map +Print (to the standard output) a link map---diagnostic information about +where symbols are mapped by @code{ld}, and information on global common +storage allocation. + +@kindex -n +@cindex read-only text +@cindex NMAGIC +@kindex --nmagic +@item -n +@itemx --nmagic +Set the text segment to be read only, and mark the output as +@code{NMAGIC} if possible. + @kindex -N +@kindex --omagic @cindex read/write from cmd line -@kindex OMAGIC +@cindex OMAGIC @item -N +@itemx --omagic Set the text and data sections to be readable and writable. Also, do not page-align the data segment. If the output format supports Unix style magic numbers, mark the output as @code{OMAGIC}. -@kindex -n -@cindex read-only text -@kindex NMAGIC -@item -n -Set the text segment to be read only, and mark the output as -@code{NMAGIC} if possible. +@kindex -o @var{output} +@kindex --output=@var{output} +@cindex naming the output file +@item -o @var{output} +@itemx --output=@var{output} +Use @var{output} as the name for the program produced by @code{ld}; if this +option is not specified, the name @file{a.out} is used by default. The +script command @code{OUTPUT} can also specify the output file name. -@cindex output file after errors -@kindex -noinhibit-exec -@item -noinhibit-exec -Retain the executable output file whenever it is still usable. -Normally, the linker will not produce an output file if it encounters -errors during the link process; it exits without writing an output file -when it issues any error whatsoever. +@cindex partial link +@cindex relocatable output +@kindex -r +@kindex --relocateable +@item -r +@itemx --relocateable +Generate relocatable output---i.e., generate an output file that can in +turn serve as input to @code{ld}. This is often called @dfn{partial +linking}. As a side effect, in environments that support standard Unix +magic numbers, this option also sets the output file's magic number to +@code{OMAGIC}. +@c ; see @code{-N}. +If this option is not specified, an absolute file is produced. When +linking C++ programs, this option @emph{will not} resolve references to +constructors; to do that, use @samp{-Ur}. + +This option does the same thing as @samp{-i}. + +@kindex -R @var{file} +@kindex --just-symbols=@var{file} +@cindex symbol-only input +@item -R @var{filename} +@itemx --just-symbols=@var{filename} +Read symbol names and their addresses from @var{filename}, but do not +relocate it or include it in the output. This allows your output file +to refer symbolically to absolute locations of memory defined in other +programs. You may use this option more than once. + +For compatibility with other ELF linkers, if the @code{-R} option is +followed by a directory name, rather than a file name, it is treated as +the @code{-rpath} option. + +@kindex -s +@kindex --strip-all +@cindex strip all symbols +@item -s +@itemx --strip-all +Omit all symbol information from the output file. + +@kindex -S +@kindex --strip-debug +@cindex strip debugger symbols +@item -S +@itemx --strip-debug +Omit debugger symbol information (but not all symbols) from the output file. + +@kindex -t +@kindex --trace +@cindex input files, displaying +@item -t +@itemx --trace +Print the names of the input files as @code{ld} processes them. + +@kindex -T @var{script} +@kindex --script=@var{script} +@cindex script files +@item -T @var{commandfile} +@itemx --script=@var{commandfile} +Read link commands from the file @var{commandfile}. These commands +replace @code{ld}'s default link script (rather than adding +to it), so @var{commandfile} must specify everything necessary to describe +the target format. @xref{Commands}. If @var{commandfile} does not +exist, @code{ld} looks for it in the directories specified by any +preceding @samp{-L} options. Multiple @samp{-T} options accumulate. + +@kindex -u @var{symbol} +@kindex --undefined=@var{symbol} +@cindex undefined symbol +@item -u @var{symbol} +@itemx --undefined=@var{symbol} +Force @var{symbol} to be entered in the output file as an undefined symbol. +Doing this may, for example, trigger linking of additional modules from +standard libraries. @samp{-u} may be repeated with different option +arguments to enter additional undefined symbols. +@c Nice idea, but no such command: This option is equivalent +@c to the @code{EXTERN} linker command. + +@kindex -v +@kindex -V +@kindex --version +@cindex version +@item -v +@itemx --version +@itemx -V +Display the version number for @code{ld}. The @code{-V} option also +lists the supported emulations. + +@kindex -x +@kindex --discard-all +@cindex deleting local symbols +@item -x +@itemx --discard-all +Delete all local symbols. + +@kindex -X +@kindex --discard-locals +@cindex local symbols, deleting +@cindex L, deleting symbols beginning +@item -X +@itemx --discard-locals +Delete all temporary local symbols. For most targets, this is all local +symbols whose names begin with @samp{L}. + +@kindex -y @var{symbol} +@kindex --trace-symbol=@var{symbol} +@cindex symbol tracing +@item -y @var{symbol} +@itemx --trace-symbol=@var{symbol} +Print the name of each linked file in which @var{symbol} appears. This +option may be given any number of times. On many systems it is necessary +to prepend an underscore. + +This option is useful when you have an undefined symbol in your link but +don't know where the reference is coming from. + +@kindex -Y @var{path} +@item -Y @var{path} +Add @var{path} to the default library search path. This option exists +for Solaris compatibility. + +@kindex -z @var{keyword} +@item -z @var{keyword} +This option is ignored for Solaris compatibility. + +@kindex -( +@cindex groups of archives +@item -( @var{archives} -) +@itemx --start-group @var{archives} --end-group +The @var{archives} should be a list of archive files. They may be +either explicit file names, or @samp{-l} options. + +The specified archives are searched repeatedly until no new undefined +references are created. Normally, an archive is searched only once in +the order that it is specified on the command line. If a symbol in that +archive is needed to resolve an undefined symbol referred to by an +object in an archive that appears later on the command line, the linker +would not be able to resolve that reference. By grouping the archives, +they all be searched repeatedly until all possible references are +resolved. + +Using this option has a significant performance cost. It is best to use +it only when there are unavoidable circular references between two or +more archives. + +@kindex -assert @var{keyword} +@item -assert @var{keyword} +This option is ignored for SunOS compatibility. + +@kindex -Bdynamic +@kindex -dy +@kindex -call_shared +@item -Bdynamic +@itemx -dy +@itemx -call_shared +Link against dynamic libraries. This is only meaningful on platforms +for which shared libraries are supported. This option is normally the +default on such platforms. The different variants of this option are +for compatibility with various systems. You may use this option +multiple times on the command line: it affects library searching for +@code{-l} options which follow it. + +@kindex -Bstatic +@kindex -dn +@kindex -non_shared +@kindex -static +@item -Bstatic +@itemx -dn +@itemx -non_shared +@itemx -static +Do not link against shared libraries. This is only meaningful on +platforms for which shared libraries are supported. The different +variants of this option are for compatibility with various systems. You +may use this option multiple times on the command line: it affects +library searching for @code{-l} options which follow it. + +@kindex -Bsymbolic +@item -Bsymbolic +When creating a shared library, bind references to global symbols to the +definition within the shared library, if any. Normally, it is possible +for a program linked against a shared library to override the definition +within the shared library. This option is only meaningful on ELF +platforms which support shared libraries. + +@cindex cross reference table +@kindex --cref +@item --cref +Output a cross reference table. If a linker map file is being +generated, the cross reference table is printed to the map file. +Otherwise, it is printed on the standard output. + +The format of the table is intentionally simple, so that it may be +easily processed by a script if necessary. The symbols are printed out, +sorted by name. For each symbol, a list of file names is given. If the +symbol is defined, the first file listed is the location of the +definition. The remaining files contain references to the symbol. + +@cindex symbols, from command line +@kindex --defsym @var{symbol}=@var{exp} +@item --defsym @var{symbol}=@var{expression} +Create a global symbol in the output file, containing the absolute +address given by @var{expression}. You may use this option as many +times as necessary to define multiple symbols in the command line. A +limited form of arithmetic is supported for the @var{expression} in this +context: you may give a hexadecimal constant or the name of an existing +symbol, or use @code{+} and @code{-} to add or subtract hexadecimal +constants or symbols. If you need more elaborate expressions, consider +using the linker command language from a script (@pxref{Assignment, , +Assignment: Symbol Definitions}). @emph{Note:} there should be no +white space between @var{symbol}, the equals sign (``@key{=}''), and +@var{expression}. + +@cindex dynamic linker, from command line +@kindex --dynamic-linker @var{file} +@item --dynamic-linker @var{file} +Set the name of the dynamic linker. This is only meaningful when +generating dynamically linked ELF executables. The default dynamic +linker is normally correct; don't use this unless you know what you are +doing. + +@cindex big-endian objects +@cindex endianness +@kindex -EB +@item -EB +Link big-endian objects. This affects the default output format. + +@cindex little-endian objects +@kindex -EL +@item -EL +Link little-endian objects. This affects the default output format. + +@cindex MIPS embedded PIC code +@kindex -embedded-relocs +@item -embedded-relocs +This option is only meaningful when linking MIPS embedded PIC code, +generated by the -membedded-pic option to the @sc{gnu} compiler and +assembler. It causes the linker to create a table which may be used at +runtime to relocate any data which was statically initialized to pointer +values. See the code in testsuite/ld-empic for details. + +@cindex help +@cindex usage +@kindex --help +@item --help +Print a summary of the command-line options on the standard output and exit. + +@cindex link map +@kindex -Map +@item -Map @var{mapfile} +Print to the file @var{mapfile} a link map---diagnostic information +about where symbols are mapped by @code{ld}, and information on global +common storage allocation. @cindex memory usage -@kindex -no-keep-memory -@item -no-keep-memory +@kindex --no-keep-memory +@item --no-keep-memory @code{ld} normally optimizes for speed over memory usage by caching the symbol tables of input files in memory. This option tells @code{ld} to instead optimize for memory usage, by rereading the symbol tables as necessary. This may be required if @code{ld} runs out of memory space while linking a large executable. -@kindex -o @var{output} -@cindex naming the output file -@item -o @var{output} -Use @var{output} as the name for the program produced by @code{ld}; if this -option is not specified, the name @file{a.out} is used by default. The -script command @code{OUTPUT} can also specify the output file name. +@kindex --no-whole-archive +@item --no-whole-archive +Turn off the effect of the @code{--whole-archive} option for subsequent +archive files. + +@cindex output file after errors +@kindex --noinhibit-exec +@item --noinhibit-exec +Retain the executable output file whenever it is still usable. +Normally, the linker will not produce an output file if it encounters +errors during the link process; it exits without writing an output file +when it issues any error whatsoever. @ifclear SingleFormat @kindex -oformat @@ -544,21 +749,21 @@ command @code{OUTPUT_FORMAT} can also specify the output format, but this option overrides it. @xref{BFD}. @end ifclear -@kindex -R @var{file} -@cindex symbol-only input -@item -R @var{filename} -Read symbol names and their addresses from @var{filename}, but do not -relocate it or include it in the output. This allows your output file -to refer symbolically to absolute locations of memory defined in other -programs. - -@kindex -relax +@kindex -qmagic +@item -qmagic +This option is ignored for Linux compatibility. + +@kindex -Qy +@item -Qy +This option is ignored for SVR4 compatibility. + +@kindex --relax @cindex synthesizing linker @cindex relaxing addressing modes -@item -relax +@item --relax An option with machine dependent effects. @ifset GENERIC -Currently this option is only supported on the H8/300 and the Intel 960. +This option is only supported on a few targets. @end ifset @ifset H8300 @xref{H8/300,,@code{ld} and the H8/300}. @@ -567,10 +772,10 @@ Currently this option is only supported on the H8/300 and the Intel 960. @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, the @samp{--relax} option performs global +optimizations that become possible when the linker resolves addressing +in the program, such as relaxing address modes and synthesizing new +instructions in the output object file. @ifset GENERIC On platforms where this is not supported, @samp{-relax} is accepted, but @@ -580,7 +785,7 @@ ignored. @cindex retaining specified symbols @cindex stripping all but some symbols @cindex symbols, retaining selectively -@item -retain-symbols-file @var{filename} +@item --retain-symbols-file @var{filename} Retain @emph{only} the symbols listed in the file @var{filename}, discarding all others. @var{filename} is simply a flat file, with one symbol name per line. This option is especially useful in environments @@ -617,6 +822,10 @@ runtime search path will be formed exclusively using the @code{-rpath} options, ignoring the @code{-L} options. This can be useful when using gcc, which adds many @code{-L} options which may be on NFS mounted filesystems. + +For compatibility with other ELF linkers, if the @code{-R} option is +followed by a directory name, rather than a file name, it is treated as +the @code{-rpath} option. @end ifset @ifset GENERIC @@ -665,110 +874,46 @@ If the required shared library is not found, the linker will issue a warning and continue with the link. @end ifset -@cindex partial link -@cindex relocatable output -@kindex -r -@item -r -Generate relocatable output---i.e., generate an output file that can in -turn serve as input to @code{ld}. This is often called @dfn{partial -linking}. As a side effect, in environments that support standard Unix -magic numbers, this option also sets the output file's magic number to -@code{OMAGIC}. -@c ; see @code{-N}. -If this option is not specified, an absolute file is produced. When -linking C++ programs, this option @emph{will not} resolve references to -constructors; to do that, use @samp{-Ur}. - -This option does the same thing as @samp{-i}. - -@kindex -S -@cindex strip debugger symbols -@item -S -Omit debugger symbol information (but not all symbols) from the output file. - -@kindex -s -@cindex strip all symbols -@item -s -Omit all symbol information from the output file. - -@ifset GENERIC -@cindex runtime library name -@kindex -soname -@item -soname @var{name} -When creating an ELF shared object, set the internal DT_SONAME field to -the specified name. When an executable is linked with a shared object -which has a DT_SONAME field, then when the executable is run the dynamic -linker will attempt to load the shared object specified by the DT_SONAME -field rather than the using the file name given to the linker. -@end ifset - +@kindex -shared +@kindex -Bshareable @item -shared +@itemx -Bshareable @cindex shared libraries -@kindex -shared -Create a shared library. This is currently only supported on ELF and -SunOS platforms. On SunOS, the linker will automatically create a +Create a shared library. This is currently only supported on ELF, XCOFF +and SunOS platforms. On SunOS, the linker will automatically create a shared library if the @code{-e} option is not used and there are undefined symbols in the link. -@item -sort-common -@kindex -sort-common -Normally, when @code{ld} places the global common symbols in the -appropriate output sections, it sorts them by size. First come all the -one byte symbols, then all the two bytes, then all the four bytes, and -then everything else. This is to prevent gaps between symbols due to -alignment constraints. This option disables that sorting. - -@kindex split -@item -split-by-reloc @var{count} -Trys to creates extra sections in the output file so that no single output section -in the file contains more than @var{count} relocations. This -is useful when generating huge relocatable for downloading into -certain real time kernels with the COFF object file format; since -COFF cannot represent more than 65535 relocations in a single section. -Note that this will fail to work with object file formats which do not -support arbitrary sections. The linker will not split up individual input -sections for redistribution, so if a single input section contains +@item --sort-common +@kindex --sort-common +This option tells @code{ld} to sort the common symbols by size when it +places them in the appropriate output sections. First come all the one +byte symbols, then all the two bytes, then all the four bytes, and then +everything else. This is to prevent gaps between symbols due to +alignment constraints. + +@kindex --split-by-file +@item --split-by-file +Similar to @code{--split-by-reloc} but creates a new output section for +each input file. + +@kindex --split-by-reloc +@item --split-by-reloc @var{count} +Trys to creates extra sections in the output file so that no single +output section in the file contains more than @var{count} relocations. +This is useful when generating huge relocatable for downloading into +certain real time kernels with the COFF object file format; since COFF +cannot represent more than 65535 relocations in a single section. Note +that this will fail to work with object file formats which do not +support arbitrary sections. The linker will not split up individual +input sections for redistribution, so if a single input section contains more than @var{count} relocations one output section will contain that many relocations. -@kindex split -@item -split-by-file -Similar to -split-by-reloc but creates a new output section for each -input file. - -@item -stats -Compute and display statistics about the operation of the linker, -such as execution time and memory usage. - -@kindex -Tbss @var{org} -@kindex -Tdata @var{org} -@kindex -Ttext @var{org} -@cindex segment origins, cmd line -@item -Tbss @var{org} -@itemx -Tdata @var{org} -@itemx -Ttext @var{org} -Use @var{org} as the starting address for---respectively---the -@code{bss}, @code{data}, or the @code{text} segment of the output file. -@var{org} must be a single hexadecimal integer; -for compatibility with other linkers, you may omit the leading -@samp{0x} usually associated with hexadecimal values. - -@kindex -T @var{script} -@cindex script files -@item -T @var{commandfile} -@itemx -T@var{commandfile} -Read link commands from the file @var{commandfile}. These commands -replace @code{ld}'s default link script (rather than adding -to it), so @var{commandfile} must specify everything necessary to describe -the target format. @xref{Commands}. If @var{commandfile} does not -exist, @code{ld} looks for it in the directories specified by any -preceding @samp{-L} options. Multiple @samp{-T} options accumulate. - -@kindex -t -@cindex verbose -@cindex input files, displaying -@item -t -Print the names of the input files as @code{ld} processes them. +@kindex --stats +@item --stats +Compute and display statistics about the operation of the linker, such +as execution time and memory usage. @kindex -traditional-format @cindex traditional format @@ -785,15 +930,18 @@ full debugging information by over 30 percent. Unfortunately, the SunOS trouble). The @samp{-traditional-format} switch tells @code{ld} to not combine duplicate entries. -@kindex -u @var{symbol} -@cindex undefined symbol -@item -u @var{symbol} -Force @var{symbol} to be entered in the output file as an undefined symbol. -Doing this may, for example, trigger linking of additional modules from -standard libraries. @samp{-u} may be repeated with different option -arguments to enter additional undefined symbols. -@c Nice idea, but no such command: This option is equivalent -@c to the @code{EXTERN} linker command. +@kindex -Tbss @var{org} +@kindex -Tdata @var{org} +@kindex -Ttext @var{org} +@cindex segment origins, cmd line +@item -Tbss @var{org} +@itemx -Tdata @var{org} +@itemx -Ttext @var{org} +Use @var{org} as the starting address for---respectively---the +@code{bss}, @code{data}, or the @code{text} segment of the output file. +@var{org} must be a single hexadecimal integer; +for compatibility with other linkers, you may omit the leading +@samp{0x} usually associated with hexadecimal values. @kindex -Ur @cindex constructors @@ -808,22 +956,11 @@ be added to. Use @samp{-Ur} only for the last partial link, and @samp{-r} for the others. @kindex --verbose -@cindex version +@cindex verbose @item --verbose Display the version number for @code{ld} and list the linker emulations -supported. Display which input files can and cannot be opened. - -@kindex -v -@kindex -V -@cindex version -@item -v -@itemx -V -Display the version number for @code{ld}. The @code{-V} option also -lists the supported emulations. - -@kindex -version -@item -version -Display the version number for @code{ld} and exit. +supported. Display which input files can and cannot be opened. Display +the linker script if using a default builtin script. @kindex -warn-comon @cindex warnings, on combining symbols @@ -916,6 +1053,20 @@ Warn if any global constructors are used. This is only useful for a few object file formats. For formats like COFF or ELF, the linker can not detect the use of global constructors. +@kindex -warn-multiple-gp +@item -warn-multiple-gp +Warn if multiple global pointer values are required in the output file. +This is only meaningful for certain processors, such as the Alpha. +Specifically, some processors put large-valued constants in a special +section. A special register (the global pointer) points into the middle +of this section, so that constants can be loaded efficiently via a +base-register relative addressing mode. Since the offset in +base-register relative mode is fixed and relatively small (e.g., 16 +bits), this limits the maximum size of the constant pool. Thus, in +large programs, it is often necessary to use multiple global pointer +values in order to be able to address all possible constants. This +option causes a warning to be issued whenever this case occurs. + @kindex -warn-once @cindex warnings, on undefined symbols @cindex undefined symbols, warnings on @@ -925,53 +1076,48 @@ which refers to it. @kindex --whole-archive @cindex including an entire archive -For each archive mentioned on the command line, include every object -file in the archive in the link, rather than searching the archive for -the required object files. This is normally used to turn an archive -file into a shared library, forcing every object to be included in the -resulting shared library. - -@kindex -X -@cindex local symbols, deleting -@cindex L, deleting symbols beginning -@item -X -Delete all temporary local symbols. For most targets, this is all local -symbols whose names begin with @samp{L}. - -@kindex -x -@cindex deleting local symbols -@item -x -Delete all local symbols. +@item --whole-archive +For each archive mentioned on the command line after the +@code{--whole-archive} option, include every object file in the archive +in the link, rather than searching the archive for the required object +files. This is normally used to turn an archive file into a shared +library, forcing every object to be included in the resulting shared +library. This option may be used more than once. + +@kindex --wrap +@item --wrap @var{symbol} +Use a wrapper function for @var{symbol}. Any undefined reference to +@var{symbol} will be resolved to @code{__wrap_@var{symbol}}. Any +undefined reference to @code{__real_@var{symbol}} will be resolved to +@var{symbol}. + +This can be used to provide a wrapper for a system function. The +wrapper function should be called @code{__wrap_@var{symbol}}. If it +wishes to call the system function, it should call +@code{__real_@var{symbol}}. + +Here is a trivial example: -@kindex -y @var{symbol} -@cindex symbol tracing -@item -y @var{symbol} -Print the name of each linked file in which @var{symbol} appears. This -option may be given any number of times. On many systems it is necessary -to prepend an underscore. - -This option is useful when you have an undefined symbol in your link but -don't know where the reference is coming from. +@smallexample +void * +__wrap_malloc (int c) +@{ + printf ("malloc called with %ld\n", c); + return __real_malloc (c); +@} +@end smallexample -@kindex -( -@cindex groups of archives -@item -( @var{archives} -) -@itemx --start-group @var{archives} --end-group -The @var{archives} should be a list of archive files. They may be -either explicit file names, or @samp{-l} options. +If you link other code with this file using @code{--wrap malloc}, then +all calls to @code{malloc} will call the function @code{__wrap_malloc} +instead. The call to @code{__real_malloc} in @code{__wrap_malloc} will +call the real @code{malloc} function. -The specified archives are searched repeatedly until no new undefined -references are created. Normally, an archive is searched only once in -the order that it is specified on the command line. If a symbol in that -archive is needed to resolve an undefined symbol referred to by an -object in an archive that appears later on the command line, the linker -would not be able to resolve that reference. By grouping the archives, -they all be searched repeatedly until all possible references are -resolved. +You may wish to provide a @code{__real_malloc} function as well, so that +links without the @code{--wrap} option will succeed. If you do this, +you should not put the definition of @code{__real_malloc} in the same +file as @code{__wrap_malloc}; if you do, the assembler may resolve the +call before the linker has a chance to wrap it to @code{malloc}. -Using this option has a significant performance cost. It is best to use -it only when there are unavoidable circular references between two or -more archives. @end table @ifset UsesEnvVars @@ -1026,6 +1172,7 @@ as a supported object or archive format, it reports an error. * Expressions:: Expressions * MEMORY:: MEMORY Command * SECTIONS:: SECTIONS Command +* PHDRS:: PHDRS Command * Entry Point:: The Entry Point * Option Commands:: Option Commands @end menu @@ -1087,6 +1234,7 @@ You may call special purpose built-in functions. * Evaluation:: Evaluation * Assignment:: Assignment: Defining Symbols * Arithmetic Functions:: Built-In Functions +* Semicolons:: Semicolon Usage @end menu @node Integers @@ -1116,7 +1264,7 @@ _as_hex = 0xdead; @cindex negative integers To write a negative integer, use -the prefix operator @samp{-}; @pxref{Operators}. +the prefix operator @samp{-} (@pxref{Operators}). @smallexample _as_neg = -57005; @end smallexample @@ -1235,7 +1383,7 @@ precedence associativity Operators Notes @end smallexample Notes: (1) Prefix operators -(2) @xref{Assignment} +(2) @xref{Assignment}. @c TEXI2ROFF-KILL @end ifinfo @tex @@ -1528,6 +1676,22 @@ paging. @end table +@node Semicolons +@subsection Semicolons + +Semicolons (``@key{;}'') are required in the following places. In all +other places they can appear for aesthetic reasons but are otherwise ignored. + +@table @code +@item Assignment +Semicolons must appear at the end of assignment expressions. +@xref{Assignment} + +@item PHDRS +Semicolons must appear at the end of a @code{PHDRS} statement. +@xref{PHDRS} +@end table + @node MEMORY @section Memory Layout @kindex MEMORY @@ -1635,7 +1799,7 @@ sections go into it. You can also use the first two operations---defining the entry point and defining symbols---outside the @code{SECTIONS} command: @pxref{Entry -Point}, and @pxref{Assignment}. They are permitted here as well for +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. @@ -1687,11 +1851,15 @@ sequence of characters, but any name which does not conform to the standard @code{ld} symbol name syntax must be quoted. @xref{Symbols, , Symbol Names}. +The special @var{secname} @samp{/DISCARD/} may be used to discard input +sections. Any sections which are assigned to an output section named +@samp{/DISCARD/} are not included in the final link output. + The linker will not create output sections which do not have any contents. This is for convenience when referring to input sections that may or may not exist. For example, @smallexample -.foo @{ *(.foo @} +.foo @{ *(.foo) @} @end smallexample will only create a @samp{.foo} section in the output file if there is a @samp{.foo} section in at least one input file. @@ -1734,7 +1902,7 @@ 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{} ) @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 @@ -1847,7 +2015,7 @@ SECTIONS @{ 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 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 @@ -1990,17 +2158,18 @@ optional portions: SECTIONS @{ @dots{} @var{secname} @var{start} BLOCK(@var{align}) (NOLOAD) : AT ( @var{ldadr} ) - @{ @var{contents} @} >@var{region} =@var{fill} + @{ @var{contents} @} >@var{region} :@var{phdr} =@var{fill} @dots{} @} @end group @end smallexample @var{secname} and @var{contents} are required. @xref{Section -Definition}, and @pxref{Section Placement} for details on +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}}, and @code{=@var{fill}}---are all optional. +@code{>@var{region}}, @code{:@var{phdr}}, and @code{=@var{fill}}---are +all optional. @table @code @cindex start address, section @@ -2109,6 +2278,17 @@ for (dst = _bstart; dst< _bend; dst++) Assign this section to a previously defined region of memory. @xref{MEMORY}. +@kindex :@var{phdr} +@cindex section, assigning to program header +@cindex program headers and sections +@item :@var{phdr} +Assign this section to a segment described by a program header. +@xref{PHDRS}. If a section is assigned to one or more segments, then +all subsequent allocated sections will be assigned to those segments as +well, unless they use an explicitly @code{:@var{phdr}} modifier. To +prevent a section from being assigned to a segment when it would +normally default to one, use @code{:NONE}. + @kindex =@var{fill} @cindex section fill pattern @cindex fill pattern, entire section @@ -2123,6 +2303,144 @@ of a section definition. @end table +@node PHDRS +@section ELF Program Headers +@kindex PHDRS +@kindex program headers +@kindex ELF program headers + +The ELF object file format uses @dfn{program headers}, which are read by +the system loader and describe how the program should be loaded into +memory. These program headers must be set correctly in order to run the +program on a native ELF system. The linker will create reasonable +program headers by default. However, in some cases, it is desirable to +specify the program headers more precisely; the @code{PHDRS} command may +be used for this purpose. When the @code{PHDRS} command is used, the +linker will not generate any program headers itself. + +The @code{PHDRS} command is only meaningful when generating an ELF +output file. It is ignored in other cases. This manual does not +describe the details of how the system loader interprets program +headers; for more information, see the ELF ABI. The program headers of +an ELF file may be displayed using the @samp{-p} option of the +@code{objdump} command. + +This is the syntax of the @code{PHDRS} command. The words @code{PHDRS}, +@code{FILEHDR}, @code{AT}, and @code{FLAGS} are keywords. + +@smallexample +@group +PHDRS +@{ + @var{name} @var{type} [ FILEHDR ] [ PHDRS ] [ AT ( @var{address} ) ] + [ FLAGS ( @var{flags} ) ] ; +@} +@end group +@end smallexample + +The @var{name} is used only for reference in the @code{SECTIONS} command +of the linker script. It does not get put into the output file. + +Certain program header types describe segments of memory which are +loaded from the file by the system loader. In the linker script, the +contents of these segments are specified by directing allocated output +sections to be placed in the segment. To do this, the command +describing the output section in the @code{SECTIONS} command should use +@samp{:@var{name}}, where @var{name} is the name of the program header +as it appears in the @code{PHDRS} command. @xref{Section Options}. + +It is normal for certain sections to appear in more than one segment. +This merely implies that one segment of memory contains another. This +is specified by repeating @samp{:@var{name}}, using it once for each +program header in which the section is to appear. + +If a section is placed in one or more segments using @samp{:@var{name}}, +then all subsequent allocated sections which do not specify +@samp{:@var{name}} are placed in the same segments. This is for +convenience, since generally a whole set of contiguous sections will be +placed in a single segment. To prevent a section from being assigned to +a segment when it would normally default to one, use @code{:NONE}. + +The @code{FILEHDR} and @code{PHDRS} keywords which may appear after the +program header type also indicate contents of the segment of memory. +The @code{FILEHDR} keyword means that the segment should include the ELF +file header. The @code{PHDRS} keyword means that the segment should +include the ELF program headers themselves. + +The @var{type} may be one of the following. The numbers indicate the +value of the keyword. + +@table @asis +@item @code{PT_NULL} (0) +Indicates an unused program header. + +@item @code{PT_LOAD} (1) +Indicates that this program header describes a segment to be loaded from +the file. + +@item @code{PT_DYNAMIC} (2) +Indicates a segment where dynamic linking information can be found. + +@item @code{PT_INTERP} (3) +Indicates a segment where the name of the program interpreter may be +found. + +@item @code{PT_NOTE} (4) +Indicates a segment holding note information. + +@item @code{PT_SHLIB} (5) +A reserved program header type, defined but not specified by the ELF +ABI. + +@item @code{PT_PHDR} (6) +Indicates a segment where the program headers may be found. + +@item @var{expression} +An expression giving the numeric type of the program header. This may +be used for types not defined above. +@end table + +It is possible to specify that a segment should be loaded at a +particular address in memory. This is done using an @code{AT} +expression. This is identical to the @code{AT} command used in the +@code{SECTIONS} command (@pxref{Section Options}). Using the @code{AT} +command for a program header overrides any information in the +@code{SECTIONS} command. + +Normally the segment flags are set based on the sections. The +@code{FLAGS} keyword may be used to explicitly specify the segment +flags. The value of @var{flags} must be an integer. It is used to +set the @code{p_flags} field of the program header. + +Here is an example of the use of @code{PHDRS}. This shows a typical set +of program headers used on a native ELF system. + +@example +@group +PHDRS +@{ + headers PT_PHDR PHDRS ; + interp PT_INTERP ; + text PT_LOAD FILEHDR PHDRS ; + data PT_LOAD ; + dynamic PT_DYNAMIC ; +@} + +SECTIONS +@{ + . = SIZEOF_HEADERS; + .interp : @{ *(.interp) @} :text :interp + .text : @{ *(.text) @} :text + .rodata : @{ *(.rodata) @} /* defaults to :text */ + @dots{} + . = . + 0x1000; /* move to a new page in memory */ + .data : @{ *(.data) @} :data + .dynamic : @{ *(.dynamic) @} :data :dynamic + @dots{} +@} +@end group +@end example + @node Entry Point @section The Entry Point @kindex ENTRY(@var{symbol}) @@ -2187,18 +2505,49 @@ command-line options. @cindex C++ constructors, arranging in link @cindex constructors, arranging in link @item CONSTRUCTORS -This command ties up C++ style constructor and destructor records. The -details of the constructor representation vary from one object format to -another, but usually lists of constructors and destructors appear as -special sections. The @code{CONSTRUCTORS} command specifies where the -linker is to place the data from these sections, relative to the rest of -the linked output. Constructor data is marked by the symbol -@w{@code{__CTOR_LIST__}} at the start, and @w{@code{__CTOR_LIST_END}} at -the end; destructor data is bracketed similarly, between -@w{@code{__DTOR_LIST__}} and @w{@code{__DTOR_LIST_END}}. (The compiler -must arrange to actually run this code; @sc{gnu} C++ calls constructors from -a subroutine @code{__main}, which it inserts automatically into the -startup code for @code{main}, and destructors from @code{_exit}.) +When linking using the @code{a.out} object file format, the linker uses +an unusual set construct to support C++ global constructors and +destructors. When linking object file formats which do not support +arbitrary sections, such as @code{ECOFF} and @code{XCOFF}, the linker +will automatically recognize C++ global constructors and destructors by +name. For these object file formats, the @code{CONSTRUCTORS} command +tells the linker where this information should be placed. The +@code{CONSTRUCTORS} command is ignored for other object file formats. + +The symbol @w{@code{__CTOR_LIST__}} marks the start of the global +constructors, and the symbol @w{@code{__DTOR_LIST}} marks the end. The +first word in the list is the number of entries, followed by the address +of each constructor or destructor, followed by a zero word. The +compiler must arrange to actually run the code. For these object file +formats @sc{gnu} C++ calls constructors from a subroutine @code{__main}; +a call to @code{__main} is automatically inserted into the startup code +for @code{main}. @sc{gnu} C++ runs destructors either by using +@code{atexit}, or directly from the function @code{exit}. + +For object file formats such as @code{COFF} or @code{ELF} which support +multiple sections, @sc{gnu} C++ will normally arrange to put the +addresses of global constructors and destructors into the @code{.ctors} +and @code{.dtors} sections. Placing the following sequence into your +linker script will build the sort of table which the @sc{gnu} C++ +runtime code expects to see. + +@smallexample + __CTOR_LIST__ = .; + LONG((__CTOR_END__ - __CTOR_LIST__) / 4 - 2) + *(.ctors) + LONG(0) + __CTOR_END__ = .; + __DTOR_LIST__ = .; + LONG((__DTOR_END__ - __DTOR_LIST__) / 4 - 2) + *(.dtors) + LONG(0) + __DTOR_END__ = .; +@end smallexample + +Normally the compiler and linker will handle these issues automatically, +and you will not need to concern yourself with them. However, you may +need to consider this if you are using C++ and writing your own linker +scripts. @need 1000 @kindex FLOAT diff --git a/gnu/usr.bin/binutils/ld/ldctor.c b/gnu/usr.bin/binutils/ld/ldctor.c index 5ebc494596d..d986f321287 100644 --- a/gnu/usr.bin/binutils/ld/ldctor.c +++ b/gnu/usr.bin/binutils/ld/ldctor.c @@ -120,6 +120,7 @@ ldctor_build_sets () { static boolean called; lang_statement_list_type *old; + boolean header_printed; struct set_info *p; /* The emulation code may call us directly, but we only want to do @@ -133,6 +134,7 @@ ldctor_build_sets () lang_list_init (stat_ptr); + header_printed = false; for (p = sets; p != (struct set_info *) NULL; p = p->next) { struct set_element *e; @@ -201,6 +203,36 @@ ldctor_build_sets () for (e = p->elements; e != (struct set_element *) NULL; e = e->next) { + if (config.map_file != NULL) + { + int len; + + if (! header_printed) + { + minfo ("\nSet Symbol\n\n"); + header_printed = true; + } + + minfo ("%s", p->h->root.string); + len = strlen (p->h->root.string); + + if (len >= 19) + { + print_nl (); + len = 0; + } + while (len < 20) + { + print_space (); + ++len; + } + + if (e->name != NULL) + minfo ("%T\n", e->name); + else + minfo ("%G\n", e->section->owner, e->section, e->value); + } + if (link_info.relocateable) lang_add_reloc (p->reloc, howto, e->section, e->name, exp_intop (e->value)); diff --git a/gnu/usr.bin/binutils/ld/ldemul.c b/gnu/usr.bin/binutils/ld/ldemul.c index 84826e9fd36..d0243b29cc7 100644 --- a/gnu/usr.bin/binutils/ld/ldemul.c +++ b/gnu/usr.bin/binutils/ld/ldemul.c @@ -145,6 +145,17 @@ ldemul_parse_args (argc, argv) return 0; } +/* Let the emulation code handle an unrecognized file. */ + +boolean +ldemul_unrecognized_file (entry) + lang_input_statement_type *entry; +{ + if (ld_emulation->unrecognized_file) + return (*ld_emulation->unrecognized_file) (entry); + return false; +} + char * ldemul_choose_target() { diff --git a/gnu/usr.bin/binutils/ld/ldemul.h b/gnu/usr.bin/binutils/ld/ldemul.h index 2d768e4759c..65c04fe70c5 100644 --- a/gnu/usr.bin/binutils/ld/ldemul.h +++ b/gnu/usr.bin/binutils/ld/ldemul.h @@ -40,6 +40,8 @@ extern void ldemul_create_output_section_statements PARAMS ((void)); extern boolean ldemul_place_orphan PARAMS ((struct lang_input_statement_struct *, asection *)); extern int ldemul_parse_args PARAMS ((int, char **)); +extern boolean ldemul_unrecognized_file + PARAMS ((struct lang_input_statement_struct *)); extern boolean ldemul_open_dynamic_archive PARAMS ((const char *, struct search_dirs *, struct lang_input_statement_struct *)); @@ -112,14 +114,17 @@ typedef struct ld_emulation_xfer_struct /* Run after assigning parsing with the args, but before reading the script. Used to initialize symbols used in the script. */ - void (*set_symbols) PARAMS ((void)); /* Run to parse args which the base linker doesn't understand. Return non zero on sucess. */ - int (*parse_args) PARAMS ((int, char **)); + /* Run to handle files which are not recognized as object files or + archives. Return true if the file was handled. */ + boolean (*unrecognized_file) + PARAMS ((struct lang_input_statement_struct *)); + } ld_emulation_xfer_type; typedef enum diff --git a/gnu/usr.bin/binutils/ld/ldexp.c b/gnu/usr.bin/binutils/ld/ldexp.c index dcc0cae200a..6b143c7be7f 100644 --- a/gnu/usr.bin/binutils/ld/ldexp.c +++ b/gnu/usr.bin/binutils/ld/ldexp.c @@ -1,5 +1,5 @@ /* This module handles expression trees. -Copyright (C) 1991, 1993, 1994, 1995 Free Software Foundation, Inc. +Copyright (C) 1991, 1993, 1994, 1995, 1996 Free Software Foundation, Inc. Written by Steve Chamberlain of Cygnus Support (sac@cygnus.com). This file is part of GLD, the Gnu Linker. @@ -238,8 +238,9 @@ fold_binary (tree, current_section, allocation_done, dot, dotp) value from a relative value is meaningful, and is an exception. */ if (current_section != abs_output_section - && (result.section == abs_output_section - || other.section == abs_output_section) + && (other.section == abs_output_section + || (result.section == abs_output_section + && tree->type.node_code == '+')) && (tree->type.node_code == '+' || tree->type.node_code == '-')) { @@ -247,7 +248,7 @@ fold_binary (tree, current_section, allocation_done, dot, dotp) /* If there is only one absolute term, make sure it is the second one. */ - if (result.section == abs_output_section) + if (other.section != abs_output_section) { hold = result; result = other; @@ -345,8 +346,9 @@ fold_name (tree, current_section, allocation_done, dot) { struct bfd_link_hash_entry *h; - h = bfd_link_hash_lookup (link_info.hash, tree->name.name, - false, false, true); + h = bfd_wrapped_link_hash_lookup (output_bfd, &link_info, + tree->name.name, + false, false, true); result.value = (h != (struct bfd_link_hash_entry *) NULL && (h->type == bfd_link_hash_defined || h->type == bfd_link_hash_defweak @@ -368,15 +370,17 @@ fold_name (tree, current_section, allocation_done, dot) { struct bfd_link_hash_entry *h; - h = bfd_link_hash_lookup (link_info.hash, tree->name.name, - false, false, true); + h = bfd_wrapped_link_hash_lookup (output_bfd, &link_info, + tree->name.name, + false, false, true); if (h != NULL && (h->type == bfd_link_hash_defined || h->type == bfd_link_hash_defweak)) { if (bfd_is_abs_section (h->u.def.section)) result = new_abs (h->u.def.value); - else if (allocation_done == lang_final_phase_enum) + else if (allocation_done == lang_final_phase_enum + || allocation_done == lang_allocating_phase_enum) { lang_output_section_statement_type *os; @@ -475,28 +479,15 @@ exp_fold_tree (tree, current_section, allocation_done, dot, dotp) } break; case ABSOLUTE: - if (allocation_done != lang_first_phase_enum) - { - if (current_section - == (lang_output_section_statement_type*)NULL) + if (allocation_done != lang_first_phase_enum && result.valid) { - /* Outside a section, so it's all ok */ - - } - else { - /* Inside a section, subtract the base of the section, - so when it's added again (in an assignment), everything comes out fine - */ + result.value += result.section->bfd_section->vma; result.section = abs_output_section; - result.value -= current_section->bfd_section->vma; - result.valid = true; } - } else - { - result.valid = false; - } - + { + result.valid = false; + } break; case '~': make_abs(&result); @@ -549,7 +540,9 @@ 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"); - if (allocation_done == lang_allocating_phase_enum) { + if (allocation_done == lang_allocating_phase_enum + || (allocation_done == lang_final_phase_enum + && current_section == abs_output_section)) { result = exp_fold_tree(tree->assign.src, current_section, lang_allocating_phase_enum, dot, dotp); @@ -781,14 +774,12 @@ exp_print_tree (tree) { switch (tree->type.node_class) { case etree_value: - print_address(tree->value.value); + minfo ("0x%v", tree->value.value); return; case etree_rel: if (tree->rel.section->owner != NULL) - fprintf (config.map_file, "%s:", - bfd_get_filename (tree->rel.section->owner)); - fprintf (config.map_file, "%s+", tree->rel.section->name); - print_address (tree->rel.value); + minfo ("%B:", tree->rel.section->owner); + minfo ("%s+0x%v", tree->rel.section->name, tree->rel.value); return; case etree_assign: #if 0 @@ -800,7 +791,7 @@ exp_print_tree (tree) fprintf(config.map_file,"%s (UNDEFINED)",tree->assign.dst->name); } #endif - fprintf(config.map_file,"%s ",tree->assign.dst); + fprintf(config.map_file,"%s",tree->assign.dst); exp_print_token(tree->type.node_code); exp_print_tree(tree->assign.src); break; diff --git a/gnu/usr.bin/binutils/ld/ldgram.c b/gnu/usr.bin/binutils/ld/ldgram.c deleted file mode 100644 index 612c02b27bd..00000000000 --- a/gnu/usr.bin/binutils/ld/ldgram.c +++ /dev/null @@ -1,2052 +0,0 @@ - -/* A Bison parser, made from ./ldgram.y with Bison version GNU Bison version 1.24 - */ - -#define YYBISON 1 /* Identify Bison output. */ - -#define INT 258 -#define NAME 259 -#define LNAME 260 -#define PLUSEQ 261 -#define MINUSEQ 262 -#define MULTEQ 263 -#define DIVEQ 264 -#define LSHIFTEQ 265 -#define RSHIFTEQ 266 -#define ANDEQ 267 -#define OREQ 268 -#define OROR 269 -#define ANDAND 270 -#define EQ 271 -#define NE 272 -#define LE 273 -#define GE 274 -#define LSHIFT 275 -#define RSHIFT 276 -#define UNARY 277 -#define END 278 -#define ALIGN_K 279 -#define BLOCK 280 -#define QUAD 281 -#define LONG 282 -#define SHORT 283 -#define BYTE 284 -#define SECTIONS 285 -#define SIZEOF_HEADERS 286 -#define OUTPUT_FORMAT 287 -#define FORCE_COMMON_ALLOCATION 288 -#define OUTPUT_ARCH 289 -#define INCLUDE 290 -#define MEMORY 291 -#define DEFSYMEND 292 -#define NOLOAD 293 -#define DSECT 294 -#define COPY 295 -#define INFO 296 -#define OVERLAY 297 -#define DEFINED 298 -#define TARGET_K 299 -#define SEARCH_DIR 300 -#define MAP 301 -#define ENTRY 302 -#define SIZEOF 303 -#define NEXT 304 -#define ADDR 305 -#define STARTUP 306 -#define HLL 307 -#define SYSLIB 308 -#define FLOAT 309 -#define NOFLOAT 310 -#define ORIGIN 311 -#define FILL 312 -#define LENGTH 313 -#define CREATE_OBJECT_SYMBOLS 314 -#define INPUT 315 -#define GROUP 316 -#define OUTPUT 317 -#define CONSTRUCTORS 318 -#define ALIGNMOD 319 -#define AT 320 -#define PROVIDE 321 -#define CHIP 322 -#define LIST 323 -#define SECT 324 -#define ABSOLUTE 325 -#define LOAD 326 -#define NEWLINE 327 -#define ENDWORD 328 -#define ORDER 329 -#define NAMEWORD 330 -#define FORMAT 331 -#define PUBLIC 332 -#define BASE 333 -#define ALIAS 334 -#define TRUNCATE 335 -#define REL 336 -#define INPUT_SCRIPT 337 -#define INPUT_MRI_SCRIPT 338 -#define INPUT_DEFSYM 339 -#define CASE 340 -#define EXTERN 341 -#define START 342 - -#line 21 "./ldgram.y" - -/* - - */ - -#define DONTDECLARE_MALLOC - -#include "bfd.h" -#include "sysdep.h" -#include "bfdlink.h" -#include "ld.h" -#include "ldexp.h" -#include "ldver.h" -#include "ldlang.h" -#include "ldemul.h" -#include "ldfile.h" -#include "ldmisc.h" -#include "ldmain.h" -#include "mri.h" -#include "ldlex.h" - -#ifndef YYDEBUG -#define YYDEBUG 1 -#endif - -static int typebits; - -lang_memory_region_type *region; - - -char *current_file; -boolean ldgram_want_filename = true; -boolean had_script = false; -boolean force_make_executable = false; - -boolean ldgram_in_script = false; -boolean ldgram_had_equals = false; - - -#define ERROR_NAME_MAX 20 -static char *error_names[ERROR_NAME_MAX]; -static int error_index; -#define PUSH_ERROR(x) if (error_index < ERROR_NAME_MAX) error_names[error_index] = x; error_index++; -#define POP_ERROR() error_index--; - -#line 66 "./ldgram.y" -typedef union { - bfd_vma integer; - char *name; - int token; - union etree_union *etree; -} YYSTYPE; - -#ifndef YYLTYPE -typedef - struct yyltype - { - int timestamp; - int first_line; - int first_column; - int last_line; - int last_column; - char *text; - } - yyltype; - -#define YYLTYPE yyltype -#endif - -#include <stdio.h> - -#ifndef __cplusplus -#ifndef __STDC__ -#define const -#endif -#endif - - - -#define YYFINAL 394 -#define YYFLAG -32768 -#define YYNTBASE 111 - -#define YYTRANSLATE(x) ((unsigned)(x) <= 342 ? yytranslate[x] : 176) - -static const char yytranslate[] = { 0, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 109, 2, 2, 2, 34, 21, 2, 37, - 106, 32, 30, 104, 31, 2, 33, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 16, 105, 24, - 10, 25, 15, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 107, 2, 108, 20, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 45, 19, 46, 110, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 1, 2, 3, 4, 5, - 6, 7, 8, 9, 11, 12, 13, 14, 17, 18, - 22, 23, 26, 27, 28, 29, 35, 36, 38, 39, - 40, 41, 42, 43, 44, 47, 48, 49, 50, 51, - 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, - 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, - 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, - 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, - 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, - 102, 103 -}; - -#if YYDEBUG != 0 -static const short yyprhs[] = { 0, - 0, 3, 6, 9, 11, 12, 17, 18, 21, 25, - 26, 29, 34, 36, 38, 41, 43, 48, 53, 57, - 60, 65, 69, 74, 79, 84, 89, 94, 97, 100, - 103, 108, 113, 116, 119, 122, 125, 126, 132, 135, - 136, 140, 143, 144, 146, 150, 152, 156, 157, 159, - 163, 165, 169, 170, 173, 176, 177, 179, 181, 183, - 185, 187, 189, 191, 193, 198, 203, 208, 213, 222, - 227, 229, 234, 235, 241, 246, 247, 253, 255, 259, - 262, 264, 268, 271, 276, 279, 282, 283, 288, 291, - 293, 297, 299, 300, 305, 306, 312, 313, 319, 322, - 324, 326, 328, 330, 335, 340, 343, 345, 346, 348, - 350, 352, 354, 356, 359, 360, 362, 364, 366, 368, - 370, 372, 374, 376, 378, 380, 384, 388, 395, 397, - 398, 404, 407, 411, 412, 413, 421, 425, 429, 433, - 434, 439, 444, 448, 452, 454, 459, 463, 464, 466, - 468, 469, 472, 475, 479, 484, 487, 490, 493, 497, - 501, 505, 509, 513, 517, 521, 525, 529, 533, 537, - 541, 545, 549, 553, 557, 563, 567, 571, 576, 578, - 580, 585, 590, 595, 600, 605, 607, 612, 613, 614, - 615, 616, 617, 618, 633, 635, 637, 639, 641, 643, - 647, 648, 652, 655, 658 -}; - -static const short yyrhs[] = { 98, - 125, 0, 99, 115, 0, 100, 113, 0, 4, 0, - 0, 114, 4, 10, 164, 0, 0, 116, 117, 0, - 117, 118, 88, 0, 0, 83, 164, 0, 83, 164, - 104, 164, 0, 4, 0, 84, 0, 90, 120, 0, - 89, 0, 93, 4, 10, 164, 0, 93, 4, 104, - 164, 0, 93, 4, 164, 0, 92, 4, 0, 85, - 4, 104, 164, 0, 85, 4, 164, 0, 85, 4, - 10, 164, 0, 38, 4, 10, 164, 0, 38, 4, - 104, 164, 0, 80, 4, 10, 164, 0, 80, 4, - 104, 164, 0, 86, 122, 0, 87, 121, 0, 91, - 4, 0, 95, 4, 104, 4, 0, 95, 4, 104, - 3, 0, 94, 164, 0, 96, 3, 0, 101, 123, - 0, 102, 124, 0, 0, 51, 112, 119, 117, 36, - 0, 103, 4, 0, 0, 120, 104, 4, 0, 120, - 4, 0, 0, 4, 0, 121, 104, 4, 0, 4, - 0, 122, 104, 4, 0, 0, 4, 0, 123, 104, - 4, 0, 4, 0, 124, 104, 4, 0, 0, 126, - 127, 0, 127, 128, 0, 0, 149, 0, 132, 0, - 156, 0, 157, 0, 159, 0, 161, 0, 134, 0, - 105, 0, 60, 37, 4, 106, 0, 61, 37, 112, - 106, 0, 78, 37, 112, 106, 0, 48, 37, 4, - 106, 0, 48, 37, 4, 104, 4, 104, 4, 106, - 0, 50, 37, 4, 106, 0, 49, 0, 76, 37, - 131, 106, 0, 0, 77, 129, 37, 131, 106, 0, - 62, 37, 112, 106, 0, 0, 51, 112, 130, 127, - 36, 0, 4, 0, 131, 104, 4, 0, 131, 4, - 0, 5, 0, 131, 104, 5, 0, 131, 5, 0, - 44, 45, 133, 46, 0, 133, 166, 0, 133, 134, - 0, 0, 63, 37, 4, 106, 0, 147, 146, 0, - 4, 0, 135, 148, 4, 0, 4, 0, 0, 107, - 137, 135, 108, 0, 0, 4, 138, 37, 135, 106, - 0, 0, 32, 139, 37, 135, 106, 0, 147, 146, - 0, 75, 0, 105, 0, 79, 0, 136, 0, 143, - 37, 164, 106, 0, 73, 37, 164, 106, 0, 141, - 140, 0, 140, 0, 0, 141, 0, 40, 0, 41, - 0, 42, 0, 43, 0, 10, 162, 0, 0, 6, - 0, 7, 0, 8, 0, 9, 0, 11, 0, 12, - 0, 13, 0, 14, 0, 105, 0, 104, 0, 4, - 10, 162, 0, 4, 145, 162, 0, 82, 37, 4, - 10, 162, 106, 0, 104, 0, 0, 52, 45, 151, - 150, 46, 0, 150, 151, 0, 150, 104, 151, 0, - 0, 0, 4, 152, 155, 16, 153, 148, 154, 0, - 72, 10, 162, 0, 74, 10, 162, 0, 37, 4, - 106, 0, 0, 67, 37, 112, 106, 0, 68, 37, - 158, 106, 0, 68, 37, 106, 0, 158, 148, 112, - 0, 112, 0, 69, 37, 160, 106, 0, 160, 148, - 112, 0, 0, 70, 0, 71, 0, 0, 163, 164, - 0, 31, 164, 0, 37, 164, 106, 0, 65, 37, - 164, 106, 0, 109, 164, 0, 30, 164, 0, 110, - 164, 0, 164, 32, 164, 0, 164, 33, 164, 0, - 164, 34, 164, 0, 164, 30, 164, 0, 164, 31, - 164, 0, 164, 28, 164, 0, 164, 29, 164, 0, - 164, 22, 164, 0, 164, 23, 164, 0, 164, 26, - 164, 0, 164, 27, 164, 0, 164, 24, 164, 0, - 164, 25, 164, 0, 164, 21, 164, 0, 164, 20, - 164, 0, 164, 19, 164, 0, 164, 15, 164, 16, - 164, 0, 164, 18, 164, 0, 164, 17, 164, 0, - 59, 37, 4, 106, 0, 3, 0, 47, 0, 64, - 37, 4, 106, 0, 66, 37, 4, 106, 0, 86, - 37, 164, 106, 0, 38, 37, 164, 106, 0, 39, - 37, 164, 106, 0, 4, 0, 81, 37, 164, 106, - 0, 0, 0, 0, 0, 0, 0, 4, 167, 174, - 165, 168, 45, 169, 142, 46, 170, 175, 144, 171, - 148, 0, 54, 0, 55, 0, 56, 0, 57, 0, - 58, 0, 37, 172, 106, 0, 0, 164, 173, 16, - 0, 173, 16, 0, 25, 4, 0, 0 -}; - -#endif - -#if YYDEBUG != 0 -static const short yyrline[] = { 0, - 119, 121, 122, 126, 129, 131, 138, 143, 148, 150, - 153, 155, 156, 159, 162, 163, 164, 166, 168, 170, - 172, 174, 176, 178, 180, 182, 184, 186, 187, 188, - 190, 192, 194, 196, 198, 199, 200, 201, 202, 204, - 207, 209, 210, 213, 216, 219, 222, 226, 228, 229, - 232, 235, 239, 244, 250, 252, 257, 259, 260, 261, - 262, 263, 264, 265, 266, 268, 270, 272, 275, 277, - 279, 281, 282, 284, 286, 288, 289, 292, 296, 299, - 302, 305, 308, 313, 317, 319, 320, 323, 326, 329, - 332, 336, 341, 346, 347, 351, 352, 356, 359, 361, - 365, 366, 371, 372, 377, 387, 389, 392, 394, 397, - 400, 402, 404, 408, 416, 421, 424, 426, 428, 430, - 432, 434, 436, 441, 441, 445, 450, 458, 465, 466, - 469, 473, 475, 476, 480, 482, 485, 491, 500, 505, - 509, 514, 516, 520, 523, 528, 530, 533, 536, 539, - 544, 546, 549, 552, 554, 556, 558, 560, 563, 565, - 567, 569, 571, 573, 575, 577, 579, 581, 583, 585, - 587, 589, 591, 593, 595, 597, 599, 601, 603, 605, - 608, 610, 612, 614, 616, 618, 623, 625, 628, 630, - 632, 636, 636, 643, 645, 647, 648, 649, 650, 653, - 655, 659, 661, 664, 667 -}; - -static const char * const yytname[] = { "$","error","$undefined.","INT","NAME", -"LNAME","PLUSEQ","MINUSEQ","MULTEQ","DIVEQ","'='","LSHIFTEQ","RSHIFTEQ","ANDEQ", -"OREQ","'?'","':'","OROR","ANDAND","'|'","'^'","'&'","EQ","NE","'<'","'>'","LE", -"GE","LSHIFT","RSHIFT","'+'","'-'","'*'","'/'","'%'","UNARY","END","'('","ALIGN_K", -"BLOCK","QUAD","LONG","SHORT","BYTE","SECTIONS","'{'","'}'","SIZEOF_HEADERS", -"OUTPUT_FORMAT","FORCE_COMMON_ALLOCATION","OUTPUT_ARCH","INCLUDE","MEMORY","DEFSYMEND", -"NOLOAD","DSECT","COPY","INFO","OVERLAY","DEFINED","TARGET_K","SEARCH_DIR","MAP", -"ENTRY","SIZEOF","NEXT","ADDR","STARTUP","HLL","SYSLIB","FLOAT","NOFLOAT","ORIGIN", -"FILL","LENGTH","CREATE_OBJECT_SYMBOLS","INPUT","GROUP","OUTPUT","CONSTRUCTORS", -"ALIGNMOD","AT","PROVIDE","CHIP","LIST","SECT","ABSOLUTE","LOAD","NEWLINE","ENDWORD", -"ORDER","NAMEWORD","FORMAT","PUBLIC","BASE","ALIAS","TRUNCATE","REL","INPUT_SCRIPT", -"INPUT_MRI_SCRIPT","INPUT_DEFSYM","CASE","EXTERN","START","','","';'","')'", -"'['","']'","'!'","'~'","file","filename","defsym_expr","@1","mri_script_file", -"@2","mri_script_lines","mri_script_command","@3","ordernamelist","mri_load_name_list", -"mri_abs_name_list","casesymlist","extern_name_list","script_file","@4","ifile_list", -"ifile_p1","@5","@6","input_list","sections","sec_or_group_p1","statement_anywhere", -"file_NAME_list","input_section_spec","@7","@8","@9","statement","statement_list", -"statement_list_opt","length","fill_opt","assign_op","end","assignment","opt_comma", -"memory","memory_spec_list","memory_spec","@10","origin_spec","length_spec", -"attributes_opt","startup","high_level_library","high_level_library_NAME_list", -"low_level_library","low_level_library_NAME_list","floating_point_support","mustbe_exp", -"@11","exp","opt_at","section","@12","@13","@14","@15","@16","type","atype", -"opt_exp_with_type","memspec_opt","" -}; -#endif - -static const short yyr1[] = { 0, - 111, 111, 111, 112, 114, 113, 116, 115, 117, 117, - 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, - 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, - 118, 118, 118, 118, 118, 118, 119, 118, 118, 118, - 120, 120, 120, 121, 121, 122, 122, 123, 123, 123, - 124, 124, 126, 125, 127, 127, 128, 128, 128, 128, - 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, - 128, 128, 129, 128, 128, 130, 128, 131, 131, 131, - 131, 131, 131, 132, 133, 133, 133, 134, 134, 135, - 135, 136, 137, 136, 138, 136, 139, 136, 140, 140, - 140, 140, 140, 140, 140, 141, 141, 142, 142, 143, - 143, 143, 143, 144, 144, 145, 145, 145, 145, 145, - 145, 145, 145, 146, 146, 147, 147, 147, 148, 148, - 149, 150, 150, 150, 152, 151, 153, 154, 155, 155, - 156, 157, 157, 158, 158, 159, 160, 160, 161, 161, - 163, 162, 164, 164, 164, 164, 164, 164, 164, 164, - 164, 164, 164, 164, 164, 164, 164, 164, 164, 164, - 164, 164, 164, 164, 164, 164, 164, 164, 164, 164, - 164, 164, 164, 164, 164, 164, 165, 165, 167, 168, - 169, 170, 171, 166, 172, 172, 172, 172, 172, 173, - 173, 174, 174, 175, 175 -}; - -static const short yyr2[] = { 0, - 2, 2, 2, 1, 0, 4, 0, 2, 3, 0, - 2, 4, 1, 1, 2, 1, 4, 4, 3, 2, - 4, 3, 4, 4, 4, 4, 4, 2, 2, 2, - 4, 4, 2, 2, 2, 2, 0, 5, 2, 0, - 3, 2, 0, 1, 3, 1, 3, 0, 1, 3, - 1, 3, 0, 2, 2, 0, 1, 1, 1, 1, - 1, 1, 1, 1, 4, 4, 4, 4, 8, 4, - 1, 4, 0, 5, 4, 0, 5, 1, 3, 2, - 1, 3, 2, 4, 2, 2, 0, 4, 2, 1, - 3, 1, 0, 4, 0, 5, 0, 5, 2, 1, - 1, 1, 1, 4, 4, 2, 1, 0, 1, 1, - 1, 1, 1, 2, 0, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 3, 3, 6, 1, 0, - 5, 2, 3, 0, 0, 7, 3, 3, 3, 0, - 4, 4, 3, 3, 1, 4, 3, 0, 1, 1, - 0, 2, 2, 3, 4, 2, 2, 2, 3, 3, - 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, - 3, 3, 3, 3, 5, 3, 3, 4, 1, 1, - 4, 4, 4, 4, 4, 1, 4, 0, 0, 0, - 0, 0, 0, 14, 1, 1, 1, 1, 1, 3, - 0, 3, 2, 2, 0 -}; - -static const short yydefact[] = { 0, - 53, 7, 5, 1, 56, 2, 10, 3, 0, 54, - 8, 0, 0, 0, 0, 71, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 149, 150, 0, 73, - 0, 0, 64, 55, 58, 63, 0, 57, 59, 60, - 61, 62, 13, 0, 0, 0, 0, 14, 0, 0, - 0, 16, 43, 0, 0, 0, 0, 0, 0, 48, - 0, 0, 0, 0, 116, 117, 118, 119, 151, 120, - 121, 122, 123, 151, 87, 0, 0, 4, 76, 0, - 0, 0, 0, 0, 0, 0, 148, 0, 0, 0, - 0, 125, 124, 89, 0, 37, 0, 179, 186, 0, - 0, 0, 0, 0, 180, 0, 0, 0, 0, 0, - 0, 0, 11, 0, 46, 28, 44, 29, 15, 30, - 20, 0, 33, 0, 34, 49, 35, 51, 36, 39, - 9, 6, 126, 0, 127, 0, 0, 0, 56, 135, - 134, 0, 0, 0, 0, 0, 143, 145, 130, 130, - 78, 81, 0, 0, 0, 0, 0, 0, 10, 0, - 0, 157, 153, 0, 0, 0, 0, 0, 0, 0, - 0, 156, 158, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 22, 0, 0, 42, 0, - 0, 0, 19, 0, 0, 0, 152, 189, 84, 86, - 85, 0, 68, 70, 0, 140, 0, 65, 66, 75, - 88, 141, 129, 142, 0, 146, 0, 80, 83, 0, - 72, 0, 67, 151, 24, 25, 40, 26, 27, 154, - 0, 0, 0, 0, 0, 0, 0, 0, 177, 176, - 174, 173, 172, 166, 167, 170, 171, 168, 169, 164, - 165, 162, 163, 159, 160, 161, 12, 23, 21, 47, - 45, 41, 17, 18, 32, 31, 50, 52, 201, 0, - 77, 0, 0, 131, 0, 132, 144, 147, 79, 82, - 74, 0, 38, 184, 185, 178, 181, 155, 182, 183, - 0, 0, 201, 0, 188, 0, 0, 0, 133, 128, - 175, 195, 196, 197, 198, 199, 0, 0, 0, 203, - 0, 190, 0, 139, 0, 130, 200, 202, 0, 0, - 69, 151, 0, 0, 191, 137, 0, 136, 187, 108, - 151, 92, 97, 110, 111, 112, 113, 0, 100, 102, - 101, 93, 103, 107, 109, 0, 0, 0, 138, 0, - 0, 0, 0, 106, 192, 0, 99, 0, 0, 0, - 90, 130, 205, 0, 130, 130, 105, 94, 0, 0, - 115, 104, 96, 98, 91, 204, 151, 193, 114, 130, - 194, 0, 0, 0 -}; - -static const short yydefgoto[] = { 392, - 79, 8, 9, 6, 7, 11, 63, 159, 119, 118, - 116, 127, 129, 4, 5, 10, 34, 89, 139, 153, - 35, 136, 36, 372, 353, 363, 360, 361, 354, 355, - 356, 357, 388, 74, 94, 37, 379, 38, 217, 141, - 216, 326, 338, 283, 39, 40, 149, 41, 150, 42, - 133, 134, 164, 322, 211, 279, 330, 340, 373, 390, - 317, 304, 305, 381 -}; - -static const short yypact[] = { -37, --32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768, 29, 341, - 377, 30, 579, 21, 9,-32768, 48, 86, 56, 67, - 69, 83, 116, 119, 120, 121,-32768,-32768, 123,-32768, - 125, 128,-32768,-32768,-32768,-32768, -91,-32768,-32768,-32768, --32768,-32768,-32768, 155, 86, 164, 174,-32768, 165, 166, - 167,-32768,-32768, 168, 170, 171, 174, 172, 177, 178, - 179, 181, 93, 174,-32768,-32768,-32768,-32768,-32768,-32768, --32768,-32768,-32768,-32768,-32768, 183, 184,-32768,-32768, 185, - 188, 86, 86, 191, 86, 3,-32768, 47, 159, 86, - 199,-32768,-32768,-32768, -1,-32768, 12,-32768,-32768, 174, - 174, 174, 169, 186,-32768, 197, 198, 204, 205, 207, - 174, 174, 670, 163,-32768, 104,-32768, 105, 8,-32768, --32768, 227, 758, 132,-32768,-32768, 141,-32768, 143,-32768, --32768, 758,-32768, 174,-32768, 14, -83, 114,-32768,-32768, --32768, 142, 144, 146, 147, 149,-32768,-32768, -28, -18, --32768,-32768, 1, 47, 150, 241, 174, 174,-32768, 174, - 174,-32768,-32768, 490, 174, 174, 259, 267, 174, 271, - 174,-32768,-32768, 174, 174, 174, 174, 174, 174, 174, - 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, - 174, 174, 174, 174, 174, 758, 272, 273,-32768, 274, - 174, 174, 758, 122, 275, 276, 758, 579,-32768,-32768, --32768, 277,-32768,-32768, 302, 248, 4,-32768,-32768,-32768, --32768,-32768,-32768,-32768, 86,-32768, 86,-32768,-32768, 145, --32768, 11,-32768,-32768, 758, 758, 401, 758, 758,-32768, - 510, 530, 192, 193, 550, 194, 580, 732, 710, 774, - 789, 803, 816, 827, 827, 40, 40, 40, 40, 5, - 5, 60, 60,-32768,-32768,-32768, 758, 758, 758,-32768, --32768,-32768, 758, 758,-32768,-32768,-32768,-32768, 258, 190, --32768, 283, 285,-32768, 185,-32768,-32768,-32768,-32768,-32768, --32768, 196,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768, - 174, 160, 690, 287, 209, 300, 201, 236,-32768,-32768, - 758,-32768,-32768,-32768,-32768,-32768, 203, 26, 294,-32768, - 279,-32768, 206,-32768, 301, 214,-32768,-32768, 174, 280, --32768,-32768, 246, 600,-32768,-32768, 311,-32768,-32768, 16, --32768, 18,-32768,-32768,-32768,-32768,-32768, 289,-32768,-32768, --32768,-32768,-32768,-32768, 16, 281, 291, -91,-32768, 292, - 293, 174, 328,-32768,-32768, 174,-32768, 328, 328, 620, --32768, -61, 308, 640, -7, -4,-32768,-32768, 330, 331, - 329,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768, 214, --32768, 340, 342,-32768 -}; - -static const short yypgoto[] = {-32768, - -41,-32768,-32768,-32768,-32768, 182,-32768,-32768,-32768,-32768, --32768,-32768,-32768,-32768,-32768, 208,-32768,-32768,-32768, 189, --32768,-32768, 212, -217,-32768,-32768,-32768,-32768, -6,-32768, --32768,-32768,-32768,-32768, -3, -321, -147,-32768,-32768, -206, --32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768, - -73,-32768, -47,-32768,-32768,-32768,-32768,-32768,-32768,-32768, --32768, 53,-32768,-32768 -}; - - -#define YYLAST 861 - - -static const short yytable[] = { 113, - 135, 225, 227, 96, 228, 229, 78, 140, 157, 123, - 286, 199, 92, 93, 228, 229, 132, 208, 358, 342, - 212, 160, 213, 65, 66, 67, 68, 69, 70, 71, - 72, 73, 12, 358, 188, 189, 190, 191, 192, 64, - 143, 144, 223, 146, 148, 76, 378, 343, 155, 284, - 151, 152, 162, 163, -95, 344, 345, 346, 347, 209, - 1, 2, 3, 172, 173, 75, 196, 186, 187, 188, - 189, 190, 191, 192, 203, 223, 23, 224, 309, 312, - 313, 314, 315, 316, 77, 223, 207, 226, 348, 78, - 349, 190, 191, 192, 350, 32, 223, 32, 383, 223, - 80, 384, 158, 81, 230, 82, 231, 285, 147, 235, - 236, 200, 238, 239, 230, 161, 291, 241, 242, 83, - 351, 245, 352, 247, 275, 276, 248, 249, 250, 251, - 252, 253, 254, 255, 256, 257, 258, 259, 260, 261, - 262, 263, 264, 265, 266, 267, 268, 269, 289, 290, - 375, 376, 84, 273, 274, 85, 86, 87, 95, 88, - 292, 90, 98, 99, 91, 98, 99, 97, 114, 115, - 117, 120, 194, 121, 122, 124, 98, 99, 333, 125, - 131, 126, 128, 287, 130, 288, 137, 138, 140, 100, - 101, 142, 100, 101, 145, 154, 102, 103, 104, 102, - 103, 104, 156, 100, 101, 165, 105, 197, 198, 105, - 102, 103, 104, 312, 313, 314, 315, 316, 106, 214, - 105, 106, 166, 107, 108, 109, 107, 108, 109, 98, - 99, 303, 106, 167, 168, 204, 201, 107, 108, 109, - 169, 170, 391, 171, 205, 110, 206, 218, 110, 219, - 234, 220, 221, 311, 222, 233, 100, 101, 336, 110, - 98, 99, 243, 102, 103, 104, 195, 359, 111, 112, - 244, 111, 112, 105, 246, 270, 271, 272, 277, 278, - 280, 334, 111, 112, 282, 106, 307, 100, 101, 321, - 107, 108, 109, 306, 302, 103, 104, 296, 297, 299, - 308, 310, 320, 323, 105, 13, 324, 325, 327, 328, - 332, 331, 110, 389, 370, 329, 106, 223, 374, 337, - 341, 107, 108, 109, 335, 362, 365, 366, 368, 369, - 202, 371, 380, 385, 386, 111, 112, 281, 387, 393, - 237, 394, 232, 110, 13, 14, 215, 210, 364, 15, - 16, 17, 18, 19, 367, 319, 0, 0, 0, 0, - 0, 20, 21, 22, 23, 0, 111, 112, 24, 25, - 26, 27, 28, 0, 0, 0, 0, 29, 30, 31, - 43, 0, 0, 32, 14, 0, 0, 0, 15, 16, - 17, 18, 19, 0, 0, 0, 0, 0, 0, 0, - 20, 21, 22, 23, 43, 0, 33, 24, 25, 26, - 27, 28, 0, 0, 44, 0, 29, 30, 31, 0, - 0, 0, 32, 0, 0, 0, 0, 45, 0, 0, - 0, 0, 0, 0, 0, 0, 293, 0, 44, 0, - 0, 0, 0, 0, 0, 33, 0, 0, 0, 0, - 0, 45, 0, 0, 0, 0, 46, 0, 0, 47, - 48, 49, 50, 51, -40, 52, 53, 54, 55, 56, - 57, 58, 59, 0, 0, 0, 0, 60, 61, 62, - 46, 0, 0, 47, 48, 49, 50, 51, 0, 52, - 53, 54, 55, 56, 57, 58, 59, 0, 0, 0, - 0, 60, 61, 62, 174, 0, 175, 176, 177, 178, - 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, - 189, 190, 191, 192, 174, 0, 175, 176, 177, 178, - 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, - 189, 190, 191, 192, 174, 0, 175, 176, 177, 178, - 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, - 189, 190, 191, 192, 174, 0, 175, 176, 177, 178, - 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, - 189, 190, 191, 192, 65, 66, 67, 68, 69, 70, - 71, 72, 73, 0, 174, 240, 175, 176, 177, 178, - 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, - 189, 190, 191, 192, 174, 294, 175, 176, 177, 178, - 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, - 189, 190, 191, 192, 174, 295, 175, 176, 177, 178, - 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, - 189, 190, 191, 192, 174, 298, 175, 176, 177, 178, - 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, - 189, 190, 191, 192, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 174, 300, 175, 176, 177, 178, - 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, - 189, 190, 191, 192, 174, 339, 175, 176, 177, 178, - 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, - 189, 190, 191, 192, 0, 377, 318, 176, 177, 178, - 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, - 189, 190, 191, 192, 0, 382, 174, 301, 175, 176, - 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, - 187, 188, 189, 190, 191, 192, 0, 0, 0, 0, - 0, 0, 174, 193, 175, 176, 177, 178, 179, 180, - 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, - 191, 192, 177, 178, 179, 180, 181, 182, 183, 184, - 185, 186, 187, 188, 189, 190, 191, 192, 178, 179, - 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, - 190, 191, 192, 179, 180, 181, 182, 183, 184, 185, - 186, 187, 188, 189, 190, 191, 192, 180, 181, 182, - 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, - 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, - 192 -}; - -static const short yycheck[] = { 47, - 74, 149, 150, 45, 4, 5, 4, 4, 10, 57, - 217, 4, 104, 105, 4, 5, 64, 4, 340, 4, - 104, 10, 106, 6, 7, 8, 9, 10, 11, 12, - 13, 14, 4, 355, 30, 31, 32, 33, 34, 10, - 82, 83, 104, 85, 86, 37, 108, 32, 90, 46, - 4, 5, 100, 101, 37, 40, 41, 42, 43, 46, - 98, 99, 100, 111, 112, 45, 114, 28, 29, 30, - 31, 32, 33, 34, 122, 104, 63, 106, 285, 54, - 55, 56, 57, 58, 37, 104, 134, 106, 73, 4, - 75, 32, 33, 34, 79, 82, 104, 82, 106, 104, - 45, 106, 104, 37, 104, 37, 106, 104, 106, 157, - 158, 104, 160, 161, 104, 104, 106, 165, 166, 37, - 105, 169, 107, 171, 3, 4, 174, 175, 176, 177, - 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, - 188, 189, 190, 191, 192, 193, 194, 195, 4, 5, - 368, 369, 37, 201, 202, 37, 37, 37, 4, 37, - 234, 37, 3, 4, 37, 3, 4, 4, 4, 4, - 4, 4, 10, 4, 4, 4, 3, 4, 326, 3, - 88, 4, 4, 225, 4, 227, 4, 4, 4, 30, - 31, 4, 30, 31, 4, 37, 37, 38, 39, 37, - 38, 39, 4, 30, 31, 37, 47, 104, 104, 47, - 37, 38, 39, 54, 55, 56, 57, 58, 59, 106, - 47, 59, 37, 64, 65, 66, 64, 65, 66, 3, - 4, 279, 59, 37, 37, 104, 10, 64, 65, 66, - 37, 37, 390, 37, 104, 86, 104, 106, 86, 106, - 10, 106, 106, 301, 106, 106, 30, 31, 332, 86, - 3, 4, 4, 37, 38, 39, 104, 341, 109, 110, - 4, 109, 110, 47, 4, 4, 4, 4, 4, 4, - 4, 329, 109, 110, 37, 59, 4, 30, 31, 81, - 64, 65, 66, 104, 37, 38, 39, 106, 106, 106, - 16, 106, 16, 4, 47, 4, 106, 72, 106, 16, - 10, 106, 86, 387, 362, 37, 59, 104, 366, 74, - 10, 64, 65, 66, 45, 37, 46, 37, 37, 37, - 104, 4, 25, 4, 4, 109, 110, 36, 10, 0, - 159, 0, 154, 86, 4, 44, 139, 136, 355, 48, - 49, 50, 51, 52, 358, 303, -1, -1, -1, -1, - -1, 60, 61, 62, 63, -1, 109, 110, 67, 68, - 69, 70, 71, -1, -1, -1, -1, 76, 77, 78, - 4, -1, -1, 82, 44, -1, -1, -1, 48, 49, - 50, 51, 52, -1, -1, -1, -1, -1, -1, -1, - 60, 61, 62, 63, 4, -1, 105, 67, 68, 69, - 70, 71, -1, -1, 38, -1, 76, 77, 78, -1, - -1, -1, 82, -1, -1, -1, -1, 51, -1, -1, - -1, -1, -1, -1, -1, -1, 36, -1, 38, -1, - -1, -1, -1, -1, -1, 105, -1, -1, -1, -1, - -1, 51, -1, -1, -1, -1, 80, -1, -1, 83, - 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, - 94, 95, 96, -1, -1, -1, -1, 101, 102, 103, - 80, -1, -1, 83, 84, 85, 86, 87, -1, 89, - 90, 91, 92, 93, 94, 95, 96, -1, -1, -1, - -1, 101, 102, 103, 15, -1, 17, 18, 19, 20, - 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, - 31, 32, 33, 34, 15, -1, 17, 18, 19, 20, - 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, - 31, 32, 33, 34, 15, -1, 17, 18, 19, 20, - 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, - 31, 32, 33, 34, 15, -1, 17, 18, 19, 20, - 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, - 31, 32, 33, 34, 6, 7, 8, 9, 10, 11, - 12, 13, 14, -1, 15, 106, 17, 18, 19, 20, - 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, - 31, 32, 33, 34, 15, 106, 17, 18, 19, 20, - 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, - 31, 32, 33, 34, 15, 106, 17, 18, 19, 20, - 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, - 31, 32, 33, 34, 15, 106, 17, 18, 19, 20, - 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, - 31, 32, 33, 34, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, 15, 106, 17, 18, 19, 20, - 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, - 31, 32, 33, 34, 15, 106, 17, 18, 19, 20, - 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, - 31, 32, 33, 34, -1, 106, 37, 18, 19, 20, - 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, - 31, 32, 33, 34, -1, 106, 15, 16, 17, 18, - 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, - 29, 30, 31, 32, 33, 34, -1, -1, -1, -1, - -1, -1, 15, 104, 17, 18, 19, 20, 21, 22, - 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, - 33, 34, 19, 20, 21, 22, 23, 24, 25, 26, - 27, 28, 29, 30, 31, 32, 33, 34, 20, 21, - 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, - 32, 33, 34, 21, 22, 23, 24, 25, 26, 27, - 28, 29, 30, 31, 32, 33, 34, 22, 23, 24, - 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, - 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, - 34 -}; -/* -*-C-*- Note some compilers choke on comments on `#line' lines. */ -#line 3 "/usr/unsupported/share/bison.simple" - -/* Skeleton output parser for bison, - Copyright (C) 1984, 1989, 1990 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 - the Free Software Foundation; either version 2, or (at your option) - any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ - -/* As a special exception, when this file is copied by Bison into a - Bison output file, you may use that output file without restriction. - This special exception was added by the Free Software Foundation - in version 1.24 of Bison. */ - -#ifndef alloca -#ifdef __GNUC__ -#define alloca __builtin_alloca -#else /* not GNU C. */ -#if (!defined (__STDC__) && defined (sparc)) || defined (__sparc__) || defined (__sparc) || defined (__sgi) -#include <alloca.h> -#else /* not sparc */ -#if defined (MSDOS) && !defined (__TURBOC__) -#include <malloc.h> -#else /* not MSDOS, or __TURBOC__ */ -#if defined(_AIX) -#include <malloc.h> - #pragma alloca -#else /* not MSDOS, __TURBOC__, or _AIX */ -#ifdef __hpux -#ifdef __cplusplus -extern "C" { -void *alloca (unsigned int); -}; -#else /* not __cplusplus */ -void *alloca (); -#endif /* not __cplusplus */ -#endif /* __hpux */ -#endif /* not _AIX */ -#endif /* not MSDOS, or __TURBOC__ */ -#endif /* not sparc. */ -#endif /* not GNU C. */ -#endif /* alloca not defined. */ - -/* This is the parser code that is written into each bison parser - when the %semantic_parser declaration is not specified in the grammar. - It was written by Richard Stallman by simplifying the hairy parser - used when %semantic_parser is specified. */ - -/* Note: there must be only one dollar sign in this file. - It is replaced by the list of actions, each action - as one case of the switch. */ - -#define yyerrok (yyerrstatus = 0) -#define yyclearin (yychar = YYEMPTY) -#define YYEMPTY -2 -#define YYEOF 0 -#define YYACCEPT return(0) -#define YYABORT return(1) -#define YYERROR goto yyerrlab1 -/* Like YYERROR except do call yyerror. - This remains here temporarily to ease the - transition to the new meaning of YYERROR, for GCC. - Once GCC version 2 has supplanted version 1, this can go. */ -#define YYFAIL goto yyerrlab -#define YYRECOVERING() (!!yyerrstatus) -#define YYBACKUP(token, value) \ -do \ - if (yychar == YYEMPTY && yylen == 1) \ - { yychar = (token), yylval = (value); \ - yychar1 = YYTRANSLATE (yychar); \ - YYPOPSTACK; \ - goto yybackup; \ - } \ - else \ - { yyerror ("syntax error: cannot back up"); YYERROR; } \ -while (0) - -#define YYTERROR 1 -#define YYERRCODE 256 - -#ifndef YYPURE -#define YYLEX yylex() -#endif - -#ifdef YYPURE -#ifdef YYLSP_NEEDED -#ifdef YYLEX_PARAM -#define YYLEX yylex(&yylval, &yylloc, YYLEX_PARAM) -#else -#define YYLEX yylex(&yylval, &yylloc) -#endif -#else /* not YYLSP_NEEDED */ -#ifdef YYLEX_PARAM -#define YYLEX yylex(&yylval, YYLEX_PARAM) -#else -#define YYLEX yylex(&yylval) -#endif -#endif /* not YYLSP_NEEDED */ -#endif - -/* If nonreentrant, generate the variables here */ - -#ifndef YYPURE - -int yychar; /* the lookahead symbol */ -YYSTYPE yylval; /* the semantic value of the */ - /* lookahead symbol */ - -#ifdef YYLSP_NEEDED -YYLTYPE yylloc; /* location data for the lookahead */ - /* symbol */ -#endif - -int yynerrs; /* number of parse errors so far */ -#endif /* not YYPURE */ - -#if YYDEBUG != 0 -int yydebug; /* nonzero means print parse trace */ -/* Since this is uninitialized, it does not stop multiple parsers - from coexisting. */ -#endif - -/* YYINITDEPTH indicates the initial size of the parser's stacks */ - -#ifndef YYINITDEPTH -#define YYINITDEPTH 200 -#endif - -/* YYMAXDEPTH is the maximum size the stacks can grow to - (effective only if the built-in stack extension method is used). */ - -#if YYMAXDEPTH == 0 -#undef YYMAXDEPTH -#endif - -#ifndef YYMAXDEPTH -#define YYMAXDEPTH 10000 -#endif - -/* Prevent warning if -Wstrict-prototypes. */ -#ifdef __GNUC__ -int yyparse (void); -#endif - -#if __GNUC__ > 1 /* GNU C and GNU C++ define this. */ -#define __yy_memcpy(FROM,TO,COUNT) __builtin_memcpy(TO,FROM,COUNT) -#else /* not GNU C or C++ */ -#ifndef __cplusplus - -/* This is the most reliable way to avoid incompatibilities - in available built-in functions on various systems. */ -static void -__yy_memcpy (from, to, count) - char *from; - char *to; - int count; -{ - register char *f = from; - register char *t = to; - register int i = count; - - while (i-- > 0) - *t++ = *f++; -} - -#else /* __cplusplus */ - -/* This is the most reliable way to avoid incompatibilities - in available built-in functions on various systems. */ -static void -__yy_memcpy (char *from, char *to, int count) -{ - register char *f = from; - register char *t = to; - register int i = count; - - while (i-- > 0) - *t++ = *f++; -} - -#endif -#endif - -#line 192 "/usr/unsupported/share/bison.simple" - -/* The user can define YYPARSE_PARAM as the name of an argument to be passed - into yyparse. The argument should have type void *. - It should actually point to an object. - Grammar actions can access the variable by casting it - to the proper pointer type. */ - -#ifdef YYPARSE_PARAM -#define YYPARSE_PARAM_DECL void *YYPARSE_PARAM; -#else -#define YYPARSE_PARAM -#define YYPARSE_PARAM_DECL -#endif - -int -yyparse(YYPARSE_PARAM) - YYPARSE_PARAM_DECL -{ - register int yystate; - register int yyn; - register short *yyssp; - register YYSTYPE *yyvsp; - int yyerrstatus; /* number of tokens to shift before error messages enabled */ - int yychar1 = 0; /* lookahead token as an internal (translated) token number */ - - short yyssa[YYINITDEPTH]; /* the state stack */ - YYSTYPE yyvsa[YYINITDEPTH]; /* the semantic value stack */ - - short *yyss = yyssa; /* refer to the stacks thru separate pointers */ - YYSTYPE *yyvs = yyvsa; /* to allow yyoverflow to reallocate them elsewhere */ - -#ifdef YYLSP_NEEDED - YYLTYPE yylsa[YYINITDEPTH]; /* the location stack */ - YYLTYPE *yyls = yylsa; - YYLTYPE *yylsp; - -#define YYPOPSTACK (yyvsp--, yyssp--, yylsp--) -#else -#define YYPOPSTACK (yyvsp--, yyssp--) -#endif - - int yystacksize = YYINITDEPTH; - -#ifdef YYPURE - int yychar; - YYSTYPE yylval; - int yynerrs; -#ifdef YYLSP_NEEDED - YYLTYPE yylloc; -#endif -#endif - - YYSTYPE yyval; /* the variable used to return */ - /* semantic values from the action */ - /* routines */ - - int yylen; - -#if YYDEBUG != 0 - if (yydebug) - fprintf(stderr, "Starting parse\n"); -#endif - - yystate = 0; - yyerrstatus = 0; - yynerrs = 0; - yychar = YYEMPTY; /* Cause a token to be read. */ - - /* Initialize stack pointers. - Waste one element of value and location stack - so that they stay on the same level as the state stack. - The wasted elements are never initialized. */ - - yyssp = yyss - 1; - yyvsp = yyvs; -#ifdef YYLSP_NEEDED - yylsp = yyls; -#endif - -/* Push a new state, which is found in yystate . */ -/* In all cases, when you get here, the value and location stacks - have just been pushed. so pushing a state here evens the stacks. */ -yynewstate: - - *++yyssp = yystate; - - if (yyssp >= yyss + yystacksize - 1) - { - /* Give user a chance to reallocate the stack */ - /* Use copies of these so that the &'s don't force the real ones into memory. */ - YYSTYPE *yyvs1 = yyvs; - short *yyss1 = yyss; -#ifdef YYLSP_NEEDED - YYLTYPE *yyls1 = yyls; -#endif - - /* Get the current used size of the three stacks, in elements. */ - int size = yyssp - yyss + 1; - -#ifdef yyoverflow - /* Each stack pointer address is followed by the size of - the data in use in that stack, in bytes. */ -#ifdef YYLSP_NEEDED - /* This used to be a conditional around just the two extra args, - but that might be undefined if yyoverflow is a macro. */ - yyoverflow("parser stack overflow", - &yyss1, size * sizeof (*yyssp), - &yyvs1, size * sizeof (*yyvsp), - &yyls1, size * sizeof (*yylsp), - &yystacksize); -#else - yyoverflow("parser stack overflow", - &yyss1, size * sizeof (*yyssp), - &yyvs1, size * sizeof (*yyvsp), - &yystacksize); -#endif - - yyss = yyss1; yyvs = yyvs1; -#ifdef YYLSP_NEEDED - yyls = yyls1; -#endif -#else /* no yyoverflow */ - /* Extend the stack our own way. */ - if (yystacksize >= YYMAXDEPTH) - { - yyerror("parser stack overflow"); - return 2; - } - yystacksize *= 2; - if (yystacksize > YYMAXDEPTH) - yystacksize = YYMAXDEPTH; - yyss = (short *) alloca (yystacksize * sizeof (*yyssp)); - __yy_memcpy ((char *)yyss1, (char *)yyss, size * sizeof (*yyssp)); - yyvs = (YYSTYPE *) alloca (yystacksize * sizeof (*yyvsp)); - __yy_memcpy ((char *)yyvs1, (char *)yyvs, size * sizeof (*yyvsp)); -#ifdef YYLSP_NEEDED - yyls = (YYLTYPE *) alloca (yystacksize * sizeof (*yylsp)); - __yy_memcpy ((char *)yyls1, (char *)yyls, size * sizeof (*yylsp)); -#endif -#endif /* no yyoverflow */ - - yyssp = yyss + size - 1; - yyvsp = yyvs + size - 1; -#ifdef YYLSP_NEEDED - yylsp = yyls + size - 1; -#endif - -#if YYDEBUG != 0 - if (yydebug) - fprintf(stderr, "Stack size increased to %d\n", yystacksize); -#endif - - if (yyssp >= yyss + yystacksize - 1) - YYABORT; - } - -#if YYDEBUG != 0 - if (yydebug) - fprintf(stderr, "Entering state %d\n", yystate); -#endif - - goto yybackup; - yybackup: - -/* Do appropriate processing given the current state. */ -/* Read a lookahead token if we need one and don't already have one. */ -/* yyresume: */ - - /* First try to decide what to do without reference to lookahead token. */ - - yyn = yypact[yystate]; - if (yyn == YYFLAG) - goto yydefault; - - /* Not known => get a lookahead token if don't already have one. */ - - /* yychar is either YYEMPTY or YYEOF - or a valid token in external form. */ - - if (yychar == YYEMPTY) - { -#if YYDEBUG != 0 - if (yydebug) - fprintf(stderr, "Reading a token: "); -#endif - yychar = YYLEX; - } - - /* Convert token to internal form (in yychar1) for indexing tables with */ - - if (yychar <= 0) /* This means end of input. */ - { - yychar1 = 0; - yychar = YYEOF; /* Don't call YYLEX any more */ - -#if YYDEBUG != 0 - if (yydebug) - fprintf(stderr, "Now at end of input.\n"); -#endif - } - else - { - yychar1 = YYTRANSLATE(yychar); - -#if YYDEBUG != 0 - if (yydebug) - { - fprintf (stderr, "Next token is %d (%s", yychar, yytname[yychar1]); - /* Give the individual parser a way to print the precise meaning - of a token, for further debugging info. */ -#ifdef YYPRINT - YYPRINT (stderr, yychar, yylval); -#endif - fprintf (stderr, ")\n"); - } -#endif - } - - yyn += yychar1; - if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != yychar1) - goto yydefault; - - yyn = yytable[yyn]; - - /* yyn is what to do for this token type in this state. - Negative => reduce, -yyn is rule number. - Positive => shift, yyn is new state. - New state is final state => don't bother to shift, - just return success. - 0, or most negative number => error. */ - - if (yyn < 0) - { - if (yyn == YYFLAG) - goto yyerrlab; - yyn = -yyn; - goto yyreduce; - } - else if (yyn == 0) - goto yyerrlab; - - if (yyn == YYFINAL) - YYACCEPT; - - /* Shift the lookahead token. */ - -#if YYDEBUG != 0 - if (yydebug) - fprintf(stderr, "Shifting token %d (%s), ", yychar, yytname[yychar1]); -#endif - - /* Discard the token being shifted unless it is eof. */ - if (yychar != YYEOF) - yychar = YYEMPTY; - - *++yyvsp = yylval; -#ifdef YYLSP_NEEDED - *++yylsp = yylloc; -#endif - - /* count tokens shifted since error; after three, turn off error status. */ - if (yyerrstatus) yyerrstatus--; - - yystate = yyn; - goto yynewstate; - -/* Do the default action for the current state. */ -yydefault: - - yyn = yydefact[yystate]; - if (yyn == 0) - goto yyerrlab; - -/* Do a reduction. yyn is the number of a rule to reduce with. */ -yyreduce: - yylen = yyr2[yyn]; - if (yylen > 0) - yyval = yyvsp[1-yylen]; /* implement default value of the action */ - -#if YYDEBUG != 0 - if (yydebug) - { - int i; - - fprintf (stderr, "Reducing via rule %d (line %d), ", - yyn, yyrline[yyn]); - - /* Print the symbols being reduced, and their result. */ - for (i = yyprhs[yyn]; yyrhs[i] > 0; i++) - fprintf (stderr, "%s ", yytname[yyrhs[i]]); - fprintf (stderr, " -> %s\n", yytname[yyr1[yyn]]); - } -#endif - - - switch (yyn) { - -case 5: -#line 130 "./ldgram.y" -{ ldlex_defsym(); ; - break;} -case 6: -#line 132 "./ldgram.y" -{ - ldlex_popstate(); - lang_add_assignment(exp_assop(yyvsp[-1].token,yyvsp[-2].name,yyvsp[0].etree)); - ; - break;} -case 7: -#line 139 "./ldgram.y" -{ ldlex_mri_script(); - PUSH_ERROR("MRI style script"); - ; - break;} -case 8: -#line 143 "./ldgram.y" -{ ldlex_popstate(); - POP_ERROR(); - ; - break;} -case 13: -#line 156 "./ldgram.y" -{ - einfo("%P%F: unrecognised keyword in MRI style script '%s'\n",yyvsp[0].name); - ; - break;} -case 14: -#line 159 "./ldgram.y" -{ - config.map_filename = "-"; - ; - break;} -case 17: -#line 165 "./ldgram.y" -{ mri_public(yyvsp[-2].name, yyvsp[0].etree); ; - break;} -case 18: -#line 167 "./ldgram.y" -{ mri_public(yyvsp[-2].name, yyvsp[0].etree); ; - break;} -case 19: -#line 169 "./ldgram.y" -{ mri_public(yyvsp[-1].name, yyvsp[0].etree); ; - break;} -case 20: -#line 171 "./ldgram.y" -{ mri_format(yyvsp[0].name); ; - break;} -case 21: -#line 173 "./ldgram.y" -{ mri_output_section(yyvsp[-2].name, yyvsp[0].etree);; - break;} -case 22: -#line 175 "./ldgram.y" -{ mri_output_section(yyvsp[-1].name, yyvsp[0].etree);; - break;} -case 23: -#line 177 "./ldgram.y" -{ mri_output_section(yyvsp[-2].name, yyvsp[0].etree);; - break;} -case 24: -#line 179 "./ldgram.y" -{ mri_align(yyvsp[-2].name,yyvsp[0].etree); ; - break;} -case 25: -#line 181 "./ldgram.y" -{ mri_align(yyvsp[-2].name,yyvsp[0].etree); ; - break;} -case 26: -#line 183 "./ldgram.y" -{ mri_alignmod(yyvsp[-2].name,yyvsp[0].etree); ; - break;} -case 27: -#line 185 "./ldgram.y" -{ mri_alignmod(yyvsp[-2].name,yyvsp[0].etree); ; - break;} -case 30: -#line 189 "./ldgram.y" -{ mri_name(yyvsp[0].name); ; - break;} -case 31: -#line 191 "./ldgram.y" -{ mri_alias(yyvsp[-2].name,yyvsp[0].name,0);; - break;} -case 32: -#line 193 "./ldgram.y" -{ mri_alias(yyvsp[-2].name,0,(int) yyvsp[0].integer);; - break;} -case 33: -#line 195 "./ldgram.y" -{ mri_base(yyvsp[0].etree); ; - break;} -case 34: -#line 197 "./ldgram.y" -{ mri_truncate((unsigned int) yyvsp[0].integer); ; - break;} -case 37: -#line 201 "./ldgram.y" -{ ldfile_open_command_file (yyvsp[0].name); ; - break;} -case 39: -#line 203 "./ldgram.y" -{ lang_add_entry (yyvsp[0].name, false); ; - break;} -case 41: -#line 208 "./ldgram.y" -{ mri_order(yyvsp[0].name); ; - break;} -case 42: -#line 209 "./ldgram.y" -{ mri_order(yyvsp[0].name); ; - break;} -case 44: -#line 215 "./ldgram.y" -{ mri_load(yyvsp[0].name); ; - break;} -case 45: -#line 216 "./ldgram.y" -{ mri_load(yyvsp[0].name); ; - break;} -case 46: -#line 221 "./ldgram.y" -{ mri_only_load(yyvsp[0].name); ; - break;} -case 47: -#line 223 "./ldgram.y" -{ mri_only_load(yyvsp[0].name); ; - break;} -case 48: -#line 227 "./ldgram.y" -{ yyval.name = NULL; ; - break;} -case 51: -#line 234 "./ldgram.y" -{ ldlang_add_undef (yyvsp[0].name); ; - break;} -case 52: -#line 236 "./ldgram.y" -{ ldlang_add_undef (yyvsp[0].name); ; - break;} -case 53: -#line 240 "./ldgram.y" -{ - ldlex_both(); - ; - break;} -case 54: -#line 244 "./ldgram.y" -{ - ldlex_popstate(); - ; - break;} -case 65: -#line 267 "./ldgram.y" -{ lang_add_target(yyvsp[-1].name); ; - break;} -case 66: -#line 269 "./ldgram.y" -{ ldfile_add_library_path (yyvsp[-1].name, false); ; - break;} -case 67: -#line 271 "./ldgram.y" -{ lang_add_output(yyvsp[-1].name, 1); ; - break;} -case 68: -#line 273 "./ldgram.y" -{ lang_add_output_format (yyvsp[-1].name, (char *) NULL, - (char *) NULL, 1); ; - break;} -case 69: -#line 276 "./ldgram.y" -{ lang_add_output_format (yyvsp[-5].name, yyvsp[-3].name, yyvsp[-1].name, 1); ; - break;} -case 70: -#line 278 "./ldgram.y" -{ ldfile_set_output_arch(yyvsp[-1].name); ; - break;} -case 71: -#line 280 "./ldgram.y" -{ command_line.force_common_definition = true ; ; - break;} -case 73: -#line 283 "./ldgram.y" -{ lang_enter_group (); ; - break;} -case 74: -#line 285 "./ldgram.y" -{ lang_leave_group (); ; - break;} -case 75: -#line 287 "./ldgram.y" -{ lang_add_map(yyvsp[-1].name); ; - break;} -case 76: -#line 289 "./ldgram.y" -{ ldfile_open_command_file(yyvsp[0].name); ; - break;} -case 78: -#line 294 "./ldgram.y" -{ lang_add_input_file(yyvsp[0].name,lang_input_file_is_search_file_enum, - (char *)NULL); ; - break;} -case 79: -#line 297 "./ldgram.y" -{ lang_add_input_file(yyvsp[0].name,lang_input_file_is_search_file_enum, - (char *)NULL); ; - break;} -case 80: -#line 300 "./ldgram.y" -{ lang_add_input_file(yyvsp[0].name,lang_input_file_is_search_file_enum, - (char *)NULL); ; - break;} -case 81: -#line 303 "./ldgram.y" -{ lang_add_input_file(yyvsp[0].name,lang_input_file_is_l_enum, - (char *)NULL); ; - break;} -case 82: -#line 306 "./ldgram.y" -{ lang_add_input_file(yyvsp[0].name,lang_input_file_is_l_enum, - (char *)NULL); ; - break;} -case 83: -#line 309 "./ldgram.y" -{ lang_add_input_file(yyvsp[0].name,lang_input_file_is_l_enum, - (char *)NULL); ; - break;} -case 88: -#line 325 "./ldgram.y" -{ lang_add_entry (yyvsp[-1].name, false); ; - break;} -case 90: -#line 331 "./ldgram.y" -{ lang_add_wild(yyvsp[0].name, current_file); ; - break;} -case 91: -#line 333 "./ldgram.y" -{ lang_add_wild(yyvsp[0].name, current_file); ; - break;} -case 92: -#line 338 "./ldgram.y" -{ - lang_add_wild((char *)NULL, yyvsp[0].name); - ; - break;} -case 93: -#line 342 "./ldgram.y" -{ - current_file = (char *)NULL; - ; - break;} -case 95: -#line 348 "./ldgram.y" -{ - current_file =yyvsp[0].name; - ; - break;} -case 97: -#line 353 "./ldgram.y" -{ - current_file = (char *)NULL; - ; - break;} -case 100: -#line 362 "./ldgram.y" -{ - lang_add_attribute(lang_object_symbols_statement_enum); - ; - break;} -case 102: -#line 367 "./ldgram.y" -{ - - lang_add_attribute(lang_constructors_statement_enum); - ; - break;} -case 104: -#line 373 "./ldgram.y" -{ - lang_add_data((int) yyvsp[-3].integer,yyvsp[-1].etree); - ; - break;} -case 105: -#line 378 "./ldgram.y" -{ - lang_add_fill - (exp_get_value_int(yyvsp[-1].etree, - 0, - "fill value", - lang_first_phase_enum)); - ; - break;} -case 110: -#line 399 "./ldgram.y" -{ yyval.integer = yyvsp[0].token; ; - break;} -case 111: -#line 401 "./ldgram.y" -{ yyval.integer = yyvsp[0].token; ; - break;} -case 112: -#line 403 "./ldgram.y" -{ yyval.integer = yyvsp[0].token; ; - break;} -case 113: -#line 405 "./ldgram.y" -{ yyval.integer = yyvsp[0].token; ; - break;} -case 114: -#line 410 "./ldgram.y" -{ - yyval.integer = exp_get_value_int(yyvsp[0].etree, - 0, - "fill value", - lang_first_phase_enum); - ; - break;} -case 115: -#line 416 "./ldgram.y" -{ yyval.integer = 0; ; - break;} -case 116: -#line 423 "./ldgram.y" -{ yyval.token = '+'; ; - break;} -case 117: -#line 425 "./ldgram.y" -{ yyval.token = '-'; ; - break;} -case 118: -#line 427 "./ldgram.y" -{ yyval.token = '*'; ; - break;} -case 119: -#line 429 "./ldgram.y" -{ yyval.token = '/'; ; - break;} -case 120: -#line 431 "./ldgram.y" -{ yyval.token = LSHIFT; ; - break;} -case 121: -#line 433 "./ldgram.y" -{ yyval.token = RSHIFT; ; - break;} -case 122: -#line 435 "./ldgram.y" -{ yyval.token = '&'; ; - break;} -case 123: -#line 437 "./ldgram.y" -{ yyval.token = '|'; ; - break;} -case 126: -#line 447 "./ldgram.y" -{ - lang_add_assignment (exp_assop (yyvsp[-1].token, yyvsp[-2].name, yyvsp[0].etree)); - ; - break;} -case 127: -#line 451 "./ldgram.y" -{ - lang_add_assignment (exp_assop ('=', yyvsp[-2].name, - exp_binop (yyvsp[-1].token, - exp_nameop (NAME, - yyvsp[-2].name), - yyvsp[0].etree))); - ; - break;} -case 128: -#line 459 "./ldgram.y" -{ - lang_add_assignment (exp_provide (yyvsp[-3].name, yyvsp[-1].etree)); - ; - break;} -case 135: -#line 481 "./ldgram.y" -{ region = lang_memory_region_lookup(yyvsp[0].name); ; - break;} -case 137: -#line 487 "./ldgram.y" -{ region->current = - region->origin = - exp_get_vma(yyvsp[0].etree, 0L,"origin", lang_first_phase_enum); -; - break;} -case 138: -#line 493 "./ldgram.y" -{ region->length = exp_get_vma(yyvsp[0].etree, - ~((bfd_vma)0), - "length", - lang_first_phase_enum); - ; - break;} -case 139: -#line 502 "./ldgram.y" -{ - lang_set_flags(®ion->flags, yyvsp[-1].name); - ; - break;} -case 141: -#line 511 "./ldgram.y" -{ lang_startup(yyvsp[-1].name); ; - break;} -case 143: -#line 517 "./ldgram.y" -{ ldemul_hll((char *)NULL); ; - break;} -case 144: -#line 522 "./ldgram.y" -{ ldemul_hll(yyvsp[0].name); ; - break;} -case 145: -#line 524 "./ldgram.y" -{ ldemul_hll(yyvsp[0].name); ; - break;} -case 147: -#line 532 "./ldgram.y" -{ ldemul_syslib(yyvsp[0].name); ; - break;} -case 149: -#line 538 "./ldgram.y" -{ lang_float(true); ; - break;} -case 150: -#line 540 "./ldgram.y" -{ lang_float(false); ; - break;} -case 151: -#line 544 "./ldgram.y" -{ ldlex_expression(); ; - break;} -case 152: -#line 546 "./ldgram.y" -{ ldlex_popstate(); yyval.etree=yyvsp[0].etree;; - break;} -case 153: -#line 551 "./ldgram.y" -{ yyval.etree = exp_unop('-', yyvsp[0].etree); ; - break;} -case 154: -#line 553 "./ldgram.y" -{ yyval.etree = yyvsp[-1].etree; ; - break;} -case 155: -#line 555 "./ldgram.y" -{ yyval.etree = exp_unop((int) yyvsp[-3].integer,yyvsp[-1].etree); ; - break;} -case 156: -#line 557 "./ldgram.y" -{ yyval.etree = exp_unop('!', yyvsp[0].etree); ; - break;} -case 157: -#line 559 "./ldgram.y" -{ yyval.etree = yyvsp[0].etree; ; - break;} -case 158: -#line 561 "./ldgram.y" -{ yyval.etree = exp_unop('~', yyvsp[0].etree);; - break;} -case 159: -#line 564 "./ldgram.y" -{ yyval.etree = exp_binop('*', yyvsp[-2].etree, yyvsp[0].etree); ; - break;} -case 160: -#line 566 "./ldgram.y" -{ yyval.etree = exp_binop('/', yyvsp[-2].etree, yyvsp[0].etree); ; - break;} -case 161: -#line 568 "./ldgram.y" -{ yyval.etree = exp_binop('%', yyvsp[-2].etree, yyvsp[0].etree); ; - break;} -case 162: -#line 570 "./ldgram.y" -{ yyval.etree = exp_binop('+', yyvsp[-2].etree, yyvsp[0].etree); ; - break;} -case 163: -#line 572 "./ldgram.y" -{ yyval.etree = exp_binop('-' , yyvsp[-2].etree, yyvsp[0].etree); ; - break;} -case 164: -#line 574 "./ldgram.y" -{ yyval.etree = exp_binop(LSHIFT , yyvsp[-2].etree, yyvsp[0].etree); ; - break;} -case 165: -#line 576 "./ldgram.y" -{ yyval.etree = exp_binop(RSHIFT , yyvsp[-2].etree, yyvsp[0].etree); ; - break;} -case 166: -#line 578 "./ldgram.y" -{ yyval.etree = exp_binop(EQ , yyvsp[-2].etree, yyvsp[0].etree); ; - break;} -case 167: -#line 580 "./ldgram.y" -{ yyval.etree = exp_binop(NE , yyvsp[-2].etree, yyvsp[0].etree); ; - break;} -case 168: -#line 582 "./ldgram.y" -{ yyval.etree = exp_binop(LE , yyvsp[-2].etree, yyvsp[0].etree); ; - break;} -case 169: -#line 584 "./ldgram.y" -{ yyval.etree = exp_binop(GE , yyvsp[-2].etree, yyvsp[0].etree); ; - break;} -case 170: -#line 586 "./ldgram.y" -{ yyval.etree = exp_binop('<' , yyvsp[-2].etree, yyvsp[0].etree); ; - break;} -case 171: -#line 588 "./ldgram.y" -{ yyval.etree = exp_binop('>' , yyvsp[-2].etree, yyvsp[0].etree); ; - break;} -case 172: -#line 590 "./ldgram.y" -{ yyval.etree = exp_binop('&' , yyvsp[-2].etree, yyvsp[0].etree); ; - break;} -case 173: -#line 592 "./ldgram.y" -{ yyval.etree = exp_binop('^' , yyvsp[-2].etree, yyvsp[0].etree); ; - break;} -case 174: -#line 594 "./ldgram.y" -{ yyval.etree = exp_binop('|' , yyvsp[-2].etree, yyvsp[0].etree); ; - break;} -case 175: -#line 596 "./ldgram.y" -{ yyval.etree = exp_trinop('?' , yyvsp[-4].etree, yyvsp[-2].etree, yyvsp[0].etree); ; - break;} -case 176: -#line 598 "./ldgram.y" -{ yyval.etree = exp_binop(ANDAND , yyvsp[-2].etree, yyvsp[0].etree); ; - break;} -case 177: -#line 600 "./ldgram.y" -{ yyval.etree = exp_binop(OROR , yyvsp[-2].etree, yyvsp[0].etree); ; - break;} -case 178: -#line 602 "./ldgram.y" -{ yyval.etree = exp_nameop(DEFINED, yyvsp[-1].name); ; - break;} -case 179: -#line 604 "./ldgram.y" -{ yyval.etree = exp_intop(yyvsp[0].integer); ; - break;} -case 180: -#line 606 "./ldgram.y" -{ yyval.etree = exp_nameop(SIZEOF_HEADERS,0); ; - break;} -case 181: -#line 609 "./ldgram.y" -{ yyval.etree = exp_nameop(SIZEOF,yyvsp[-1].name); ; - break;} -case 182: -#line 611 "./ldgram.y" -{ yyval.etree = exp_nameop(ADDR,yyvsp[-1].name); ; - break;} -case 183: -#line 613 "./ldgram.y" -{ yyval.etree = exp_unop(ABSOLUTE, yyvsp[-1].etree); ; - break;} -case 184: -#line 615 "./ldgram.y" -{ yyval.etree = exp_unop(ALIGN_K,yyvsp[-1].etree); ; - break;} -case 185: -#line 617 "./ldgram.y" -{ yyval.etree = exp_unop(ALIGN_K,yyvsp[-1].etree); ; - break;} -case 186: -#line 619 "./ldgram.y" -{ yyval.etree = exp_nameop(NAME,yyvsp[0].name); ; - break;} -case 187: -#line 624 "./ldgram.y" -{ yyval.etree = yyvsp[-1].etree; ; - break;} -case 188: -#line 625 "./ldgram.y" -{ yyval.etree = 0; ; - break;} -case 189: -#line 628 "./ldgram.y" -{ ldlex_expression(); ; - break;} -case 190: -#line 630 "./ldgram.y" -{ ldlex_popstate(); ; - break;} -case 191: -#line 632 "./ldgram.y" -{ - lang_enter_output_section_statement(yyvsp[-5].name,yyvsp[-3].etree,typebits,0,0,0,yyvsp[-2].etree); - ; - break;} -case 192: -#line 636 "./ldgram.y" -{ldlex_expression();; - break;} -case 193: -#line 637 "./ldgram.y" -{ - ldlex_popstate(); - lang_leave_output_section_statement(yyvsp[0].integer, yyvsp[-1].name); - ; - break;} -case 195: -#line 646 "./ldgram.y" -{ typebits = SEC_NEVER_LOAD; ; - break;} -case 196: -#line 647 "./ldgram.y" -{ typebits = 0; ; - break;} -case 197: -#line 648 "./ldgram.y" -{ typebits = 0; ; - break;} -case 198: -#line 649 "./ldgram.y" -{ typebits = 0; ; - break;} -case 199: -#line 650 "./ldgram.y" -{ typebits = 0; ; - break;} -case 201: -#line 655 "./ldgram.y" -{ typebits = 0; ; - break;} -case 202: -#line 660 "./ldgram.y" -{ yyval.etree = yyvsp[-2].etree; ;; - break;} -case 203: -#line 661 "./ldgram.y" -{ yyval.etree= (etree_type *)NULL; ; - break;} -case 204: -#line 666 "./ldgram.y" -{ yyval.name = yyvsp[0].name; ; - break;} -case 205: -#line 667 "./ldgram.y" -{ yyval.name = "*default*"; ; - break;} -} - /* the action file gets copied in in place of this dollarsign */ -#line 487 "/usr/unsupported/share/bison.simple" - - yyvsp -= yylen; - yyssp -= yylen; -#ifdef YYLSP_NEEDED - yylsp -= yylen; -#endif - -#if YYDEBUG != 0 - if (yydebug) - { - short *ssp1 = yyss - 1; - fprintf (stderr, "state stack now"); - while (ssp1 != yyssp) - fprintf (stderr, " %d", *++ssp1); - fprintf (stderr, "\n"); - } -#endif - - *++yyvsp = yyval; - -#ifdef YYLSP_NEEDED - yylsp++; - if (yylen == 0) - { - yylsp->first_line = yylloc.first_line; - yylsp->first_column = yylloc.first_column; - yylsp->last_line = (yylsp-1)->last_line; - yylsp->last_column = (yylsp-1)->last_column; - yylsp->text = 0; - } - else - { - yylsp->last_line = (yylsp+yylen-1)->last_line; - yylsp->last_column = (yylsp+yylen-1)->last_column; - } -#endif - - /* Now "shift" the result of the reduction. - Determine what state that goes to, - based on the state we popped back to - and the rule number reduced by. */ - - yyn = yyr1[yyn]; - - yystate = yypgoto[yyn - YYNTBASE] + *yyssp; - if (yystate >= 0 && yystate <= YYLAST && yycheck[yystate] == *yyssp) - yystate = yytable[yystate]; - else - yystate = yydefgoto[yyn - YYNTBASE]; - - goto yynewstate; - -yyerrlab: /* here on detecting error */ - - if (! yyerrstatus) - /* If not already recovering from an error, report this error. */ - { - ++yynerrs; - -#ifdef YYERROR_VERBOSE - yyn = yypact[yystate]; - - if (yyn > YYFLAG && yyn < YYLAST) - { - int size = 0; - char *msg; - int x, count; - - count = 0; - /* Start X at -yyn if nec to avoid negative indexes in yycheck. */ - for (x = (yyn < 0 ? -yyn : 0); - x < (sizeof(yytname) / sizeof(char *)); x++) - if (yycheck[x + yyn] == x) - size += strlen(yytname[x]) + 15, count++; - msg = (char *) malloc(size + 15); - if (msg != 0) - { - strcpy(msg, "parse error"); - - if (count < 5) - { - count = 0; - for (x = (yyn < 0 ? -yyn : 0); - x < (sizeof(yytname) / sizeof(char *)); x++) - if (yycheck[x + yyn] == x) - { - strcat(msg, count == 0 ? ", expecting `" : " or `"); - strcat(msg, yytname[x]); - strcat(msg, "'"); - count++; - } - } - yyerror(msg); - free(msg); - } - else - yyerror ("parse error; also virtual memory exceeded"); - } - else -#endif /* YYERROR_VERBOSE */ - yyerror("parse error"); - } - - goto yyerrlab1; -yyerrlab1: /* here on error raised explicitly by an action */ - - if (yyerrstatus == 3) - { - /* if just tried and failed to reuse lookahead token after an error, discard it. */ - - /* return failure if at end of input */ - if (yychar == YYEOF) - YYABORT; - -#if YYDEBUG != 0 - if (yydebug) - fprintf(stderr, "Discarding token %d (%s).\n", yychar, yytname[yychar1]); -#endif - - yychar = YYEMPTY; - } - - /* Else will try to reuse lookahead token - after shifting the error token. */ - - yyerrstatus = 3; /* Each real token shifted decrements this */ - - goto yyerrhandle; - -yyerrdefault: /* current state does not do anything special for the error token. */ - -#if 0 - /* This is wrong; only states that explicitly want error tokens - should shift them. */ - yyn = yydefact[yystate]; /* If its default is to accept any token, ok. Otherwise pop it.*/ - if (yyn) goto yydefault; -#endif - -yyerrpop: /* pop the current state because it cannot handle the error token */ - - if (yyssp == yyss) YYABORT; - yyvsp--; - yystate = *--yyssp; -#ifdef YYLSP_NEEDED - yylsp--; -#endif - -#if YYDEBUG != 0 - if (yydebug) - { - short *ssp1 = yyss - 1; - fprintf (stderr, "Error: state stack now"); - while (ssp1 != yyssp) - fprintf (stderr, " %d", *++ssp1); - fprintf (stderr, "\n"); - } -#endif - -yyerrhandle: - - yyn = yypact[yystate]; - if (yyn == YYFLAG) - goto yyerrdefault; - - yyn += YYTERROR; - if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != YYTERROR) - goto yyerrdefault; - - yyn = yytable[yyn]; - if (yyn < 0) - { - if (yyn == YYFLAG) - goto yyerrpop; - yyn = -yyn; - goto yyreduce; - } - else if (yyn == 0) - goto yyerrpop; - - if (yyn == YYFINAL) - YYACCEPT; - -#if YYDEBUG != 0 - if (yydebug) - fprintf(stderr, "Shifting error token, "); -#endif - - *++yyvsp = yylval; -#ifdef YYLSP_NEEDED - *++yylsp = yylloc; -#endif - - yystate = yyn; - goto yynewstate; -} -#line 669 "./ldgram.y" - -void -yyerror(arg) - const char *arg; -{ - if (ldfile_assumed_script) - einfo ("%P:%s: file format not recognized; treating as linker script\n", - ldfile_input_filename); - if (error_index > 0 && error_index < ERROR_NAME_MAX) - einfo ("%P%F:%S: %s in %s\n", arg, error_names[error_index-1]); - else - einfo ("%P%F:%S: %s\n", arg); -} diff --git a/gnu/usr.bin/binutils/ld/ldgram.h b/gnu/usr.bin/binutils/ld/ldgram.h deleted file mode 100644 index fb17b7797a0..00000000000 --- a/gnu/usr.bin/binutils/ld/ldgram.h +++ /dev/null @@ -1,94 +0,0 @@ -typedef union { - bfd_vma integer; - char *name; - int token; - union etree_union *etree; -} YYSTYPE; -#define INT 258 -#define NAME 259 -#define LNAME 260 -#define PLUSEQ 261 -#define MINUSEQ 262 -#define MULTEQ 263 -#define DIVEQ 264 -#define LSHIFTEQ 265 -#define RSHIFTEQ 266 -#define ANDEQ 267 -#define OREQ 268 -#define OROR 269 -#define ANDAND 270 -#define EQ 271 -#define NE 272 -#define LE 273 -#define GE 274 -#define LSHIFT 275 -#define RSHIFT 276 -#define UNARY 277 -#define END 278 -#define ALIGN_K 279 -#define BLOCK 280 -#define QUAD 281 -#define LONG 282 -#define SHORT 283 -#define BYTE 284 -#define SECTIONS 285 -#define SIZEOF_HEADERS 286 -#define OUTPUT_FORMAT 287 -#define FORCE_COMMON_ALLOCATION 288 -#define OUTPUT_ARCH 289 -#define INCLUDE 290 -#define MEMORY 291 -#define DEFSYMEND 292 -#define NOLOAD 293 -#define DSECT 294 -#define COPY 295 -#define INFO 296 -#define OVERLAY 297 -#define DEFINED 298 -#define TARGET_K 299 -#define SEARCH_DIR 300 -#define MAP 301 -#define ENTRY 302 -#define SIZEOF 303 -#define NEXT 304 -#define ADDR 305 -#define STARTUP 306 -#define HLL 307 -#define SYSLIB 308 -#define FLOAT 309 -#define NOFLOAT 310 -#define ORIGIN 311 -#define FILL 312 -#define LENGTH 313 -#define CREATE_OBJECT_SYMBOLS 314 -#define INPUT 315 -#define GROUP 316 -#define OUTPUT 317 -#define CONSTRUCTORS 318 -#define ALIGNMOD 319 -#define AT 320 -#define PROVIDE 321 -#define CHIP 322 -#define LIST 323 -#define SECT 324 -#define ABSOLUTE 325 -#define LOAD 326 -#define NEWLINE 327 -#define ENDWORD 328 -#define ORDER 329 -#define NAMEWORD 330 -#define FORMAT 331 -#define PUBLIC 332 -#define BASE 333 -#define ALIAS 334 -#define TRUNCATE 335 -#define REL 336 -#define INPUT_SCRIPT 337 -#define INPUT_MRI_SCRIPT 338 -#define INPUT_DEFSYM 339 -#define CASE 340 -#define EXTERN 341 -#define START 342 - - -extern YYSTYPE yylval; diff --git a/gnu/usr.bin/binutils/ld/ldgram.y b/gnu/usr.bin/binutils/ld/ldgram.y index b08d00a58c1..a20437caebe 100644 --- a/gnu/usr.bin/binutils/ld/ldgram.y +++ b/gnu/usr.bin/binutils/ld/ldgram.y @@ -1,5 +1,5 @@ /* A YACC grammer to parse a superset of the AT&T linker scripting languaue. - Copyright (C) 1991, 1993 Free Software Foundation, Inc. + Copyright (C) 1991, 92, 93, 94, 95, 1996 Free Software Foundation, Inc. Written by Steve Chamberlain of Cygnus Support (steve@cygnus.com). This file is part of GNU ld. @@ -68,14 +68,22 @@ static int error_index; char *name; int token; union etree_union *etree; + struct phdr_info + { + boolean filehdr; + boolean phdrs; + union etree_union *at; + union etree_union *flags; + } phdr; } -%type <etree> exp opt_exp_with_type mustbe_exp opt_at +%type <etree> exp opt_exp_with_type mustbe_exp opt_at phdr_type phdr_val %type <integer> fill_opt %type <name> memspec_opt casesymlist %token <integer> INT %token <name> NAME LNAME %type <integer> length +%type <phdr> phdr_qualifiers %right <token> PLUSEQ MINUSEQ MULTEQ DIVEQ '=' LSHIFTEQ RSHIFTEQ ANDEQ OREQ %right <token> '?' ':' @@ -95,7 +103,7 @@ static int error_index; %token END %left <token> '(' %token <token> ALIGN_K BLOCK QUAD LONG SHORT BYTE -%token SECTIONS +%token SECTIONS PHDRS %token '{' '}' %token SIZEOF_HEADERS OUTPUT_FORMAT FORCE_COMMON_ALLOCATION OUTPUT_ARCH %token SIZEOF_HEADERS @@ -136,12 +144,15 @@ defsym_expr: /* SYNTAX WITHIN AN MRI SCRIPT FILE */ mri_script_file: - { ldlex_mri_script(); - PUSH_ERROR("MRI style script"); + { + ldlex_mri_script (); + PUSH_ERROR ("MRI style script"); } mri_script_lines - { ldlex_popstate(); - POP_ERROR(); + { + ldlex_popstate (); + mri_draw_tree (); + POP_ERROR (); } ; @@ -257,6 +268,7 @@ ifile_list: ifile_p1: memory | sections + | phdrs | startup | high_level_library | low_level_library @@ -633,13 +645,12 @@ section: NAME { ldlex_expression(); } lang_enter_output_section_statement($1,$3,typebits,0,0,0,$4); } statement_list_opt - '}' {ldlex_expression();} memspec_opt fill_opt + '}' {ldlex_expression();} memspec_opt phdr_opt fill_opt { ldlex_popstate(); - lang_leave_output_section_statement($12, $11); + lang_leave_output_section_statement($13, $11); } -opt_comma - + opt_comma ; type: @@ -666,6 +677,99 @@ memspec_opt: { $$ = $2; } | { $$ = "*default*"; } ; + +phdr_opt: + /* empty */ + | phdr_opt ':' NAME + { + lang_section_in_phdr ($3); + } + ; + +phdrs: + PHDRS '{' phdr_list '}' + ; + +phdr_list: + /* empty */ + | phdr_list phdr + ; + +phdr: + NAME { ldlex_expression (); } + phdr_type phdr_qualifiers { ldlex_popstate (); } + ';' + { + lang_new_phdr ($1, $3, $4.filehdr, $4.phdrs, $4.at, + $4.flags); + } + ; + +phdr_type: + exp + { + $$ = $1; + + if ($1->type.node_class == etree_name + && $1->type.node_code == NAME) + { + const char *s; + unsigned int i; + static const char * const phdr_types[] = + { + "PT_NULL", "PT_LOAD", "PT_DYNAMIC", + "PT_INTERP", "PT_NOTE", "PT_SHLIB", + "PT_PHDR" + }; + + s = $1->name.name; + for (i = 0; + i < sizeof phdr_types / sizeof phdr_types[0]; + i++) + if (strcmp (s, phdr_types[i]) == 0) + { + $$ = exp_intop (i); + break; + } + } + } + ; + +phdr_qualifiers: + /* empty */ + { + memset (&$$, 0, sizeof (struct phdr_info)); + } + | NAME phdr_val phdr_qualifiers + { + $$ = $3; + if (strcmp ($1, "FILEHDR") == 0 && $2 == NULL) + $$.filehdr = true; + else if (strcmp ($1, "PHDRS") == 0 && $2 == NULL) + $$.phdrs = true; + else if (strcmp ($1, "FLAGS") == 0 && $2 != NULL) + $$.flags = $2; + else + einfo ("%X%P:%S: PHDRS syntax error at `%s'\n", $1); + } + | AT '(' exp ')' phdr_qualifiers + { + $$ = $5; + $$.at = $3; + } + ; + +phdr_val: + /* empty */ + { + $$ = NULL; + } + | '(' exp ')' + { + $$ = $2; + } + ; + %% void yyerror(arg) diff --git a/gnu/usr.bin/binutils/ld/ldlang.c b/gnu/usr.bin/binutils/ld/ldlang.c index 88f15e4d2fe..44173fff09f 100644 --- a/gnu/usr.bin/binutils/ld/ldlang.c +++ b/gnu/usr.bin/binutils/ld/ldlang.c @@ -1,5 +1,5 @@ /* Linker command language support. - Copyright (C) 1991, 92, 93, 94, 1995 Free Software Foundation, Inc. + Copyright (C) 1991, 92, 93, 94, 95, 1996 Free Software Foundation, Inc. This file is part of GLD, the Gnu Linker. @@ -34,9 +34,6 @@ the Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307 #include "ldfile.h" /* FORWARDS */ -static void print_statements PARAMS ((void)); -static void print_statement PARAMS ((lang_statement_union_type *, - lang_output_section_statement_type *)); static lang_statement_union_type *new_statement PARAMS ((enum statement_enum, size_t, lang_statement_list_type*)); @@ -57,21 +54,17 @@ static lang_input_statement_type *first_file; static lang_statement_list_type lang_output_section_statement; static CONST char *current_target; static CONST char *output_target; -static int longest_section_name = 8; static lang_statement_list_type statement_list; +static struct lang_phdr *lang_phdr_list; -static void print_size PARAMS ((size_t value)); -static void print_alignment PARAMS ((unsigned int value)); -static void print_fill PARAMS ((fill_type value)); -static void print_section PARAMS ((const char *name)); static void lang_for_each_statement_worker PARAMS ((void (*func) (lang_statement_union_type *), lang_statement_union_type *s)); static lang_input_statement_type *new_afile PARAMS ((const char *name, lang_input_file_enum_type file_type, const char *target, boolean add_to_list)); -static void print_flags PARAMS ((int *ignore_flags)); static void init_os PARAMS ((lang_output_section_statement_type *s)); +static void section_already_linked PARAMS ((bfd *, asection *, PTR)); static void wild_section PARAMS ((lang_wild_statement_type *ptr, const char *section, lang_input_statement_type *file, @@ -102,6 +95,7 @@ static void print_input_statement PARAMS ((lang_input_statement_type *statm)); static void print_input_section PARAMS ((lang_input_section_type *in)); static void print_fill_statement PARAMS ((lang_fill_statement_type *fill)); static void print_data_statement PARAMS ((lang_data_statement_type *data)); +static void print_address_statement PARAMS ((lang_address_statement_type *)); static void print_reloc_statement PARAMS ((lang_reloc_statement_type *reloc)); static void print_padding_statement PARAMS ((lang_padding_statement_type *s)); static void print_wild_statement @@ -111,6 +105,8 @@ static void print_group PARAMS ((lang_group_statement_type *, lang_output_section_statement_type *)); static void print_statement PARAMS ((lang_statement_union_type *s, lang_output_section_statement_type *os)); +static void print_statement_list PARAMS ((lang_statement_union_type *s, + lang_output_section_statement_type *os)); static void print_statements PARAMS ((void)); static bfd_vma insert_pad PARAMS ((lang_statement_union_type **this_ptr, fill_type fill, unsigned int power, @@ -128,6 +124,7 @@ static void lang_place_orphans PARAMS ((void)); static int topower PARAMS ((int)); static void lang_set_startof PARAMS ((void)); static void reset_memory_regions PARAMS ((void)); +static void lang_record_phdrs PARAMS ((void)); /* EXPORTS */ lang_output_section_statement_type *abs_output_section; @@ -155,6 +152,8 @@ etree_type *base; /* Relocation base - or null */ #define outside_symbol_address(q) ((q)->value + outside_section_address(q->section)) +#define SECTION_NAME_MAP_LENGTH (16) + PTR stat_alloc (size) size_t size; @@ -162,34 +161,6 @@ stat_alloc (size) return obstack_alloc (&stat_obstack, size); } -static void -print_size (value) - size_t value; -{ - fprintf (config.map_file, "%5x", (unsigned) value); -} - -static void -print_alignment (value) - unsigned int value; -{ - fprintf (config.map_file, "2**%1u", value); -} - -static void -print_fill (value) - fill_type value; -{ - fprintf (config.map_file, "%04x", (unsigned) value); -} - -static void -print_section (name) - CONST char *name; -{ - fprintf (config.map_file, "%*s", -longest_section_name, name); -} - /*---------------------------------------------------------------------- lang_for_each_statement walks the parse tree and calls the provided function for each node @@ -233,6 +204,7 @@ lang_for_each_statement_worker (func, s) case lang_assignment_statement_enum: case lang_padding_statement_enum: case lang_address_statement_enum: + case lang_fill_statement_enum: break; default: FAIL (); @@ -372,6 +344,7 @@ new_afile (name, file_type, target, add_to_list) p->symbol_count = 0; p->common_output_section = (asection *) NULL; p->dynamic = config.dynamic_link; + p->whole_archive = whole_archive; p->loaded = false; lang_statement_append (&input_file_chain, (lang_statement_union_type *) p, @@ -526,6 +499,7 @@ lang_output_section_statement_lookup (name) lookup->subsection_alignment = -1; lookup->section_alignment = -1; lookup->load_base = (union etree_union *) NULL; + lookup->phdrs = NULL; lang_statement_append (&lang_output_section_statement, (lang_statement_union_type *) lookup, @@ -534,63 +508,39 @@ lang_output_section_statement_lookup (name) return lookup; } -/*ARGSUSED*/ -static void -print_flags (ignore_flags) - int *ignore_flags; -{ - fprintf (config.map_file, "("); -#if 0 - if (flags->flag_read) - fprintf (outfile, "R"); - if (flags->flag_write) - fprintf (outfile, "W"); - if (flags->flag_executable) - fprintf (outfile, "X"); - if (flags->flag_loadable) - fprintf (outfile, "L"); -#endif - fprintf (config.map_file, ")"); -} - void lang_map () { lang_memory_region_type *m; - fprintf (config.map_file, "**MEMORY CONFIGURATION**\n\n"); -#ifdef BFD64 - fprintf (config.map_file, "name\t\torigin\t\tlength\t\tattributes\n"); -#else - fprintf (config.map_file, - "name\t\torigin length r_size c_size is attributes\n"); + minfo ("\nMemory Configuration\n\n"); + fprintf (config.map_file, "%-16s %-18s %-18s\n", + "Name", "Origin", "Length"); -#endif for (m = lang_memory_region_list; m != (lang_memory_region_type *) NULL; m = m->next) { - fprintf (config.map_file, "%-16s", m->name); - print_address (m->origin); - print_space (); - print_address ((bfd_vma)m->length); - print_space (); - print_address ((bfd_vma)m->old_length); - print_space(); - print_address (m->current - m->origin); - print_space(); - if (m->old_length) - fprintf (config.map_file, " %2d%% ", - (int) ((m->current - m->origin) * 100 / m->old_length)); - print_flags (&m->flags); - fprintf (config.map_file, "\n"); - } - fprintf (config.map_file, "\n\n**LINK EDITOR MEMORY MAP**\n\n"); - fprintf (config.map_file, "output input virtual\n"); - fprintf (config.map_file, "section section address tsize\n\n"); + char buf[100]; + int len; - print_statements (); + fprintf (config.map_file, "%-16s ", m->name); + sprintf_vma (buf, m->origin); + minfo ("0x%s ", buf); + len = strlen (buf); + while (len < 16) + { + print_space (); + ++len; + } + + minfo ("0x%V\n", m->length); + } + + fprintf (config.map_file, "\nLinker script and memory map\n\n"); + + print_statements (); } /* @@ -600,10 +550,13 @@ static void init_os (s) lang_output_section_statement_type * s; { -/* asection *section = bfd_get_section_by_name(output_bfd, s->name);*/ - section_userdata_type *new = - (section_userdata_type *) - stat_alloc (sizeof (section_userdata_type)); + section_userdata_type *new; + + if (strcmp (s->name, DISCARD_SECTION_NAME) == 0) + einfo ("%P%F: Illegal use of `%s' section", DISCARD_SECTION_NAME); + + new = ((section_userdata_type *) + stat_alloc (sizeof (section_userdata_type))); s->bfd_section = bfd_get_section_by_name (output_bfd, s->name); if (s->bfd_section == (asection *) NULL) @@ -619,70 +572,191 @@ init_os (s) /* vma to allow us to output a section through itself */ s->bfd_section->output_offset = 0; get_userdata (s->bfd_section) = (PTR) new; - } -/*********************************************************************** - The wild routines. +/* 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. */ - These expand statements like *(.text) and foo.o to a list of - explicit actions, like foo.o(.text), bar.o(.text) and - foo.o(.text,.data) . +/*ARGSUSED*/ +static void +section_already_linked (abfd, sec, ignore) + bfd *abfd; + asection *sec; + PTR ignore; +{ + 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; - The toplevel routine, wild, takes a statement, section, file and - target. If either the section or file is null it is taken to be the - wildcard. Seperate lang_input_section statements are created for - each part of the expanstion, and placed after the statement provided. + flags = bfd_get_section_flags (abfd, sec); -*/ + if ((flags & SEC_LINK_ONCE) == 0) + return; + + name = bfd_get_section_name (abfd, sec); + + for (l = sec_link_once_list; l != NULL; l = l->next) + { + if (strcmp (name, bfd_get_section_name (l->sec->owner, l->sec)) == 0) + { + /* The section has already been linked. See if we should + issue a warning. */ + switch (flags & SEC_LINK_DUPLICATES) + { + default: + abort (); + + case SEC_LINK_DUPLICATES_DISCARD: + break; + + case SEC_LINK_DUPLICATES_ONE_ONLY: + einfo ("%P: %B: warning: ignoring duplicate section `%s'\n", + abfd, name); + break; + + case SEC_LINK_DUPLICATES_SAME_CONTENTS: + /* FIXME: We should really dig out the contents of both + sections and memcmp them. The COFF/PE spec says that + the Microsoft linker does not implement this + correctly, so I'm not going to bother doing it + either. */ + /* Fall through. */ + case SEC_LINK_DUPLICATES_SAME_SIZE: + if (bfd_section_size (abfd, sec) + != bfd_section_size (l->sec->owner, l->sec)) + einfo ("%P: %B: warning: duplicate section `%s' has different size\n", + abfd, name); + break; + } + + /* Set the output_section field so that wild_doit does not + create a lang_input_section structure for this section. */ + sec->output_section = bfd_abs_section_ptr; + + return; + } + } + + /* This is the first section with this name. Record it. */ + + l = (struct sec_link_once *) xmalloc (sizeof *l); + l->sec = sec; + l->next = sec_link_once_list; + sec_link_once_list = l; +} + +/* The wild routines. + + These expand statements like *(.text) and foo.o to a list of + explicit actions, like foo.o(.text), bar.o(.text) and + foo.o(.text, .data). */ + +/* Add SECTION to the output section OUTPUT. Do this by creating a + lang_input_section statement which is placed at PTR. FILE is the + input file which holds SECTION. */ void wild_doit (ptr, section, output, file) - lang_statement_list_type * ptr; - asection * section; - lang_output_section_statement_type * output; - lang_input_statement_type * file; + lang_statement_list_type *ptr; + asection *section; + lang_output_section_statement_type *output; + lang_input_statement_type *file; { - if (output->bfd_section == (asection *) NULL) - init_os (output); + flagword flags; + boolean discard; - if (section != (asection *) NULL - && section->output_section == (asection *) NULL) - { - /* Add a section reference to the list */ - lang_input_section_type *new = new_stat (lang_input_section, ptr); + flags = bfd_get_section_flags (section->owner, section); - new->section = section; - new->ifile = file; - section->output_section = output->bfd_section; + discard = false; - /* We don't copy the SEC_NEVER_LOAD flag from an input section to - an output section, because we want to be able to include a - SEC_NEVER_LOAD section in the middle of an otherwise loaded - section (I don't know why we want to do this, but we do). - build_link_order in ldwrite.c handles this case by turning the - embedded SEC_NEVER_LOAD section into a fill. */ - section->output_section->flags |= - section->flags & (flagword) (~ SEC_NEVER_LOAD); + /* If we are doing a final link, discard sections marked with + SEC_EXCLUDE. */ + if (! link_info.relocateable + && (flags & SEC_EXCLUDE) != 0) + discard = true; - if (!output->loadable) - { - /* Turn off load flag */ - output->bfd_section->flags &= ~SEC_LOAD; - output->bfd_section->flags |= SEC_NEVER_LOAD; - } - if (section->alignment_power > output->bfd_section->alignment_power) + /* Discard input sections which are assigned to a section named + DISCARD_SECTION_NAME. */ + if (strcmp (output->name, DISCARD_SECTION_NAME) == 0) + discard = true; + + /* Discard debugging sections if we are stripping debugging + information. */ + if ((link_info.strip == strip_debugger || link_info.strip == strip_all) + && (flags & SEC_DEBUGGING) != 0) + discard = true; + + if (discard) { - output->bfd_section->alignment_power = section->alignment_power; + if (section->output_section == NULL) + { + /* This prevents future calls from assigning this section. */ + section->output_section = bfd_abs_section_ptr; + } + return; } - /* If supplied an aligmnet, then force it */ - if (output->section_alignment != -1) + + if (section->output_section == NULL) { - output->bfd_section->alignment_power = output->section_alignment; + lang_input_section_type *new; + + if (output->bfd_section == NULL) + init_os (output); + + /* Add a section reference to the list */ + new = new_stat (lang_input_section, ptr); + + new->section = section; + new->ifile = file; + section->output_section = output->bfd_section; + + /* We don't copy the SEC_NEVER_LOAD flag from an input section + to an output section, because we want to be able to include a + SEC_NEVER_LOAD section in the middle of an otherwise loaded + section (I don't know why we want to do this, but we do). + build_link_order in ldwrite.c handles this case by turning + the embedded SEC_NEVER_LOAD section into a fill. + + If final link, don't copy the SEC_LINK_ONCE flags, they've already + been processed. One reason to do this is that on pe format targets, + .text$foo sections go into .text and it's odd to see .text with + SEC_LINK_ONCE set. */ + + section->output_section->flags |= + section->flags & (flagword) (~ (SEC_NEVER_LOAD + | (! link_info.relocateable + ? SEC_LINK_ONCE | SEC_LINK_DUPLICATES + : 0))); + + if (! output->loadable) + { + /* Turn off load flag */ + output->bfd_section->flags &= ~SEC_LOAD; + output->bfd_section->flags |= SEC_NEVER_LOAD; + } + + if (section->alignment_power > output->bfd_section->alignment_power) + output->bfd_section->alignment_power = section->alignment_power; + + /* If supplied an aligment, then force it. */ + if (output->section_alignment != -1) + output->bfd_section->alignment_power = output->section_alignment; } - } } +/* Expand a wild statement for a particular FILE. SECTION may be + NULL, in which case it is a wild card. */ + static void wild_section (ptr, section, file, output) lang_wild_statement_type *ptr; @@ -712,16 +786,13 @@ wild_section (ptr, section, file, output) } } -/* passed a file name (which must have been seen already and added to - the statement tree. We will see if it has been opened already and - had its symbols read. If not then we'll read it. +/* This is passed a file name which must have been seen already and + added to the statement tree. We will see if it has been opened + already and had its symbols read. If not then we'll read it. */ - Archives are pecuilar here. We may open them once, but if they do - not define anything we need at the time, they won't have all their - symbols read. If we need them later, we'll have to redo it. */ static lang_input_statement_type * lookup_name (name) - CONST char *name; + const char *name; { lang_input_statement_type *search; @@ -789,11 +860,16 @@ load_symbols (entry, place) || place == NULL) einfo ("%F%B: file not recognized: %E\n", entry->the_bfd); - /* Try to interpret the file as a linker script. */ - bfd_close (entry->the_bfd); entry->the_bfd = NULL; + /* See if the emulation has some special knowledge. */ + + if (ldemul_unrecognized_file (entry)) + return; + + /* Try to interpret the file as a linker script. */ + ldfile_open_command_file (entry->filename); hold = stat_ptr; @@ -825,7 +901,7 @@ load_symbols (entry, place) break; case bfd_archive: - if (whole_archive) + if (entry->whole_archive) { bfd *member = bfd_openr_next_archived_file (entry->the_bfd, (bfd *) NULL); @@ -835,7 +911,7 @@ load_symbols (entry, place) 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"))) + (&link_info, member, "--whole-archive"))) abort (); if (! bfd_link_add_symbols (member, &link_info)) einfo ("%F%B: could not read symbols: %E\n", member); @@ -855,13 +931,18 @@ load_symbols (entry, place) entry->loaded = true; } +/* Handle a wild statement. SECTION or FILE or both may be NULL, + indicating that it is a wildcard. Separate lang_input_section + statements are created for each part of the expansion; they are + added after the wild statement S. OUTPUT is the output section. */ + static void wild (s, section, file, target, output) - lang_wild_statement_type * s; - CONST char *section; - CONST char *file; - CONST char *target; - lang_output_section_statement_type * output; + lang_wild_statement_type *s; + const char *section; + const char *file; + const char *target; + lang_output_section_statement_type *output; { lang_input_statement_type *f; @@ -878,25 +959,51 @@ wild (s, section, file, target, output) else { /* Perform the iteration over a single file */ - wild_section (s, section, lookup_name (file), output); + f = lookup_name (file); + 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); + } + } } + if (section != (char *) NULL && strcmp (section, "COMMON") == 0 - && default_common_section == (lang_output_section_statement_type *) NULL) + && default_common_section == NULL) { - /* Remember the section that common is going to incase we later - get something which doesn't know where to put it */ + /* 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; } } -/* - read in all the files - */ +/* Open the output file. */ static bfd * open_output (name) - CONST char *name; + const char *name; { bfd *output; @@ -918,7 +1025,7 @@ open_output (name) einfo ("%P%F: cannot open output file %s: %E\n", name); } - delete_output_file_on_failure = 1; + delete_output_file_on_failure = true; /* output->flags |= D_PAGED;*/ @@ -958,7 +1065,7 @@ ldlang_open_output (statement) output_bfd->flags |= WP_TEXT; else output_bfd->flags &= ~WP_TEXT; - if (config.traditional_format) + if (link_info.traditional_format) output_bfd->flags |= BFD_TRADITIONAL_FORMAT; else output_bfd->flags &= ~BFD_TRADITIONAL_FORMAT; @@ -1202,70 +1309,45 @@ print_output_section_statement (output_section_statement) lang_output_section_statement_type * output_section_statement; { asection *section = output_section_statement->bfd_section; + int len; - print_nl (); - print_section (output_section_statement->name); + if (output_section_statement != abs_output_section) + { + minfo ("\n%s", output_section_statement->name); + if (section != NULL) + { + print_dot = section->vma; - if (section) - { - print_dot = section->vma; - print_space (); - print_section (""); - print_space (); - print_address (section->vma); - print_space (); - print_size (section->_raw_size); - print_space (); - print_size(section->_cooked_size); - print_space (); - print_alignment (section->alignment_power); - print_space (); -#if 0 - fprintf (config.map_file, "%s flags", output_section_statement->region->name); - print_flags (stdout, &output_section_statement->flags); -#endif - if (section->flags & SEC_LOAD) - fprintf (config.map_file, "load "); - if (section->flags & SEC_ALLOC) - fprintf (config.map_file, "alloc "); - if (section->flags & SEC_RELOC) - fprintf (config.map_file, "reloc "); - if (section->flags & SEC_HAS_CONTENTS) - fprintf (config.map_file, "contents "); + len = strlen (output_section_statement->name); + if (len >= SECTION_NAME_MAP_LENGTH - 1) + { + print_nl (); + len = 0; + } + while (len < SECTION_NAME_MAP_LENGTH) + { + print_space (); + ++len; + } - } - else - { - fprintf (config.map_file, " (no attached output section)"); - } - print_nl (); - if (output_section_statement->load_base) - { - bfd_vma b = exp_get_abs_int(output_section_statement->load_base, - 0, "output base", lang_final_phase_enum); - fprintf (config.map_file, "Output address "); - fprintf_vma (config.map_file, b); - fprintf (config.map_file, "\n"); - } - if (output_section_statement->section_alignment >= 0 - || output_section_statement->subsection_alignment >= 0) - { - fprintf (config.map_file, "\t\t\t\t\tforced alignment "); - if (output_section_statement->section_alignment >= 0) - { - fprintf (config.map_file, "section 2**%d ",output_section_statement->section_alignment ); - } - if ( output_section_statement->subsection_alignment >= 0) - { - fprintf (config.map_file, "subsection 2**%d ",output_section_statement->subsection_alignment ); + minfo ("0x%V %W", section->vma, section->_raw_size); + + if (output_section_statement->load_base != NULL) + { + bfd_vma addr; + + addr = exp_get_abs_int (output_section_statement->load_base, 0, + "load base", lang_final_phase_enum); + minfo (" load address 0x%V", addr); + } + } + + print_nl (); } - - print_nl (); - } - print_statement (output_section_statement->children.head, - output_section_statement); + print_statement_list (output_section_statement->children.head, + output_section_statement); } static void @@ -1273,32 +1355,29 @@ print_assignment (assignment, output_section) lang_assignment_statement_type * assignment; lang_output_section_statement_type * output_section; { + int i; etree_value_type result; - print_section (""); - print_space (); - print_section (""); - print_space (); - print_address (print_dot); - print_space (); - result = exp_fold_tree (assignment->exp->assign.src, - output_section, - lang_final_phase_enum, - print_dot, - &print_dot); + for (i = 0; i < SECTION_NAME_MAP_LENGTH; i++) + print_space (); + result = exp_fold_tree (assignment->exp->assign.src, output_section, + lang_final_phase_enum, print_dot, &print_dot); if (result.valid) - { - print_address (result.value); - } + minfo ("0x%V", result.value + result.section->bfd_section->vma); else { - fprintf (config.map_file, "*undefined*"); + minfo ("*undef* "); +#ifdef BFD64 + minfo (" "); +#endif } - print_space (); + + minfo (" "); + exp_print_tree (assignment->exp); - fprintf (config.map_file, "\n"); + print_nl (); } static void @@ -1311,34 +1390,37 @@ print_input_statement (statm) } } -/* Print all the defined symbols for the abfd provided by in the supplied - section. -*/ +/* Print all symbols defined in a particular section. This is called + via bfd_link_hash_traverse. */ static boolean print_one_symbol (hash_entry, ptr) -struct bfd_link_hash_entry *hash_entry; -PTR ptr; -{ - asection * sec = (asection *)ptr; - - if (hash_entry->type == bfd_link_hash_defined - || hash_entry->type == bfd_link_hash_defweak) - { - if (sec == hash_entry->u.def.section) { - print_section (""); - fprintf (config.map_file, " "); - print_section (""); - fprintf (config.map_file, " "); - print_address (hash_entry->u.def.value + outside_section_address (sec)); - fprintf (config.map_file, " %s", hash_entry->root.string); - print_nl (); - } + struct bfd_link_hash_entry *hash_entry; + PTR ptr; +{ + asection *sec = (asection *) ptr; + + if ((hash_entry->type == bfd_link_hash_defined + || hash_entry->type == bfd_link_hash_defweak) + && sec == hash_entry->u.def.section) + { + int i; + + for (i = 0; i < SECTION_NAME_MAP_LENGTH; i++) + print_space (); + minfo ("0x%V ", + (hash_entry->u.def.value + + hash_entry->u.def.section->output_offset + + hash_entry->u.def.section->output_section->vma)); + + minfo (" %T\n", hash_entry->root.string); } return true; } +/* Print information about an input section to the map file. */ + static void print_input_section (in) lang_input_section_type * in; @@ -1348,57 +1430,50 @@ print_input_section (in) if (size != 0) { - print_section (""); - fprintf (config.map_file, " "); - print_section (i->name); - fprintf (config.map_file, " "); - if (i->output_section) + print_space (); + + minfo ("%s", i->name); + + if (i->output_section != NULL) { - print_address (i->output_section->vma + i->output_offset); - fprintf (config.map_file, " "); - print_size (i->_raw_size); - fprintf (config.map_file, " "); - print_size(i->_cooked_size); - fprintf (config.map_file, " "); - print_alignment (i->alignment_power); - fprintf (config.map_file, " "); - if (in->ifile) - { + int len; - bfd *abfd = in->ifile->the_bfd; + len = 1 + strlen (i->name); + if (len >= SECTION_NAME_MAP_LENGTH - 1) + { + print_nl (); + len = 0; + } + while (len < SECTION_NAME_MAP_LENGTH) + { + print_space (); + ++len; + } - if (in->ifile->just_syms_flag == true) - { - fprintf (config.map_file, "symbols only "); - } + minfo ("0x%V %W %B\n", + i->output_section->vma + i->output_offset, size, + i->owner); - fprintf (config.map_file, " %s ", abfd->xvec->name); - if (abfd->my_archive != (bfd *) NULL) - { - fprintf (config.map_file, "[%s]%s", abfd->my_archive->filename, - abfd->filename); - } - else + if (i->_cooked_size != 0 && i->_cooked_size != i->_raw_size) + { + len = SECTION_NAME_MAP_LENGTH + 3; +#ifdef BFD64 + len += 16; +#else + len += 8; +#endif + while (len > 0) { - fprintf (config.map_file, "%s", abfd->filename); + print_space (); + --len; } - fprintf (config.map_file, "(overhead %d bytes)", (int) bfd_alloc_size (abfd)); - print_nl (); - /* Print all the symbols */ - bfd_link_hash_traverse (link_info.hash, print_one_symbol, (PTR) i); - } - else - { - print_nl (); + minfo ("%W (size before relaxing)\n", i->_raw_size); } + bfd_link_hash_traverse (link_info.hash, print_one_symbol, (PTR) i); - print_dot = outside_section_address (i) + size; - } - else - { - fprintf (config.map_file, "No output section allocated\n"); + print_dot = i->output_section->vma + i->output_offset + size; } } } @@ -1407,48 +1482,70 @@ static void print_fill_statement (fill) lang_fill_statement_type * fill; { - fprintf (config.map_file, "FILL mask "); - print_fill (fill->fill); + fprintf (config.map_file, " FILL mask 0x%x\n", fill->fill); } static void print_data_statement (data) lang_data_statement_type * data; { -/* bfd_vma value; */ - print_section (""); - print_space (); - print_section (""); - print_space (); -/* ASSERT(print_dot == data->output_vma);*/ + int i; + bfd_vma addr; + bfd_size_type size; + const char *name; + + for (i = 0; i < SECTION_NAME_MAP_LENGTH; i++) + print_space (); + + addr = data->output_vma; + if (data->output_section != NULL) + addr += data->output_section->vma; - print_address (data->output_vma + data->output_section->vma); - print_space (); - print_address (data->value); - print_space (); switch (data->type) { + default: + abort (); case BYTE: - fprintf (config.map_file, "BYTE "); - print_dot += BYTE_SIZE; + size = BYTE_SIZE; + name = "BYTE"; break; case SHORT: - fprintf (config.map_file, "SHORT "); - print_dot += SHORT_SIZE; + size = SHORT_SIZE; + name = "SHORT"; break; case LONG: - fprintf (config.map_file, "LONG "); - print_dot += LONG_SIZE; + size = LONG_SIZE; + name = "LONG"; break; case QUAD: - fprintf (config.map_file, "QUAD "); - print_dot += QUAD_SIZE; + size = QUAD_SIZE; + name = "QUAD"; break; } - exp_print_tree (data->exp); + minfo ("0x%V %W %s 0x%v", addr, size, name, data->value); + + if (data->exp->type.node_class != etree_value) + { + print_space (); + exp_print_tree (data->exp); + } + + print_nl (); + + print_dot = addr + size; +} + +/* Print an address statement. These are generated by options like + -Ttext. */ - fprintf (config.map_file, "\n"); +static void +print_address_statement (address) + lang_address_statement_type *address; +{ + minfo ("Address of section %s set to ", address->section_name); + exp_print_tree (address->address); + print_nl (); } /* Print a reloc statement. */ @@ -1457,44 +1554,60 @@ static void print_reloc_statement (reloc) lang_reloc_statement_type *reloc; { - print_section (""); - print_space (); - print_section (""); - print_space (); + int i; + bfd_vma addr; + bfd_size_type size; -/* ASSERT(print_dot == data->output_vma);*/ + for (i = 0; i < SECTION_NAME_MAP_LENGTH; i++) + print_space (); - print_address (reloc->output_vma + reloc->output_section->vma); - print_space (); - print_address (reloc->addend_value); - print_space (); + addr = reloc->output_vma; + if (reloc->output_section != NULL) + addr += reloc->output_section->vma; + + size = bfd_get_reloc_size (reloc->howto); - fprintf (config.map_file, "RELOC %s ", reloc->howto->name); + minfo ("0x%V %W RELOC %s ", addr, size, reloc->howto->name); - print_dot += bfd_get_reloc_size (reloc->howto); + if (reloc->name != NULL) + minfo ("%s+", reloc->name); + else + minfo ("%s+", reloc->section->name); exp_print_tree (reloc->addend_exp); - fprintf (config.map_file, "\n"); + print_nl (); + + print_dot = addr + size; } static void print_padding_statement (s) - lang_padding_statement_type * s; + lang_padding_statement_type *s; { - print_section (""); - print_space (); - print_section ("*fill*"); - print_space (); - print_address (s->output_offset + s->output_section->vma); - print_space (); - print_size (s->size); - print_space (); - print_fill (s->fill); - print_nl (); + int len; + bfd_vma addr; + + minfo (" *fill*"); + + len = sizeof " *fill*" - 1; + while (len < SECTION_NAME_MAP_LENGTH) + { + print_space (); + ++len; + } + + addr = s->output_offset; + if (s->output_section != NULL) + addr += s->output_section->vma; + minfo ("0x%V %W", addr, s->size); - print_dot = s->output_offset + s->output_section->vma + s->size; + if (s->fill != 0) + minfo (" 0x%x", s->fill); + print_nl (); + + print_dot = addr + s->size; } static void @@ -1502,26 +1615,21 @@ print_wild_statement (w, os) lang_wild_statement_type * w; lang_output_section_statement_type * os; { - fprintf (config.map_file, " from "); - if (w->filename != (char *) NULL) - { - fprintf (config.map_file, "%s", w->filename); - } + print_space (); + + if (w->filename != NULL) + minfo ("%s", w->filename); else - { - fprintf (config.map_file, "*"); - } - if (w->section_name != (char *) NULL) - { - fprintf (config.map_file, "(%s)", w->section_name); - } + minfo ("*"); + + if (w->section_name != NULL) + minfo ("(%s)", w->section_name); else - { - fprintf (config.map_file, "(*)"); - } + minfo ("(*)"); + print_nl (); - print_statement (w->children.head, os); + print_statement_list (w->children.head, os); } /* Print a group statement. */ @@ -1532,87 +1640,129 @@ print_group (s, os) lang_output_section_statement_type *os; { fprintf (config.map_file, "START GROUP\n"); - print_statement (s->children.head, os); + print_statement_list (s->children.head, os); fprintf (config.map_file, "END GROUP\n"); } +/* Print the list of statements in S. + This can be called for any statement type. */ + +static void +print_statement_list (s, os) + lang_statement_union_type *s; + lang_output_section_statement_type *os; +{ + while (s != NULL) + { + print_statement (s, os); + s = s->next; + } +} + +/* Print the first statement in statement list S. + This can be called for any statement type. */ + static void print_statement (s, os) - lang_statement_union_type * s; - lang_output_section_statement_type * os; + lang_statement_union_type *s; + lang_output_section_statement_type *os; { - while (s) + switch (s->header.type) { - switch (s->header.type) + default: + fprintf (config.map_file, "Fail with %d\n", s->header.type); + FAIL (); + break; + case lang_constructors_statement_enum: + if (constructor_list.head != NULL) { - case lang_constructors_statement_enum: - fprintf (config.map_file, "constructors:\n"); - print_statement (constructor_list.head, os); - break; - case lang_wild_statement_enum: - print_wild_statement (&s->wild_statement, os); - break; - default: - fprintf (config.map_file, "Fail with %d\n", s->header.type); - FAIL (); - break; - case lang_address_statement_enum: - fprintf (config.map_file, "address\n"); - break; - case lang_object_symbols_statement_enum: - fprintf (config.map_file, "object symbols\n"); - break; - case lang_fill_statement_enum: - print_fill_statement (&s->fill_statement); - break; - case lang_data_statement_enum: - print_data_statement (&s->data_statement); - break; - case lang_reloc_statement_enum: - print_reloc_statement (&s->reloc_statement); - break; - case lang_input_section_enum: - print_input_section (&s->input_section); - break; - case lang_padding_statement_enum: - print_padding_statement (&s->padding_statement); - break; - case lang_output_section_statement_enum: - print_output_section_statement (&s->output_section_statement); - break; - case lang_assignment_statement_enum: - print_assignment (&s->assignment_statement, - os); - break; - case lang_target_statement_enum: - fprintf (config.map_file, "TARGET(%s)\n", s->target_statement.target); - break; - case lang_output_statement_enum: - fprintf (config.map_file, "OUTPUT(%s %s)\n", - s->output_statement.name, - output_target ? output_target : ""); - break; - case lang_input_statement_enum: - print_input_statement (&s->input_statement); - break; - case lang_group_statement_enum: - print_group (&s->group_statement, os); - break; - case lang_afile_asection_pair_statement_enum: - FAIL (); - break; + minfo (" CONSTRUCTORS\n"); + print_statement_list (constructor_list.head, os); } - s = s->next; + break; + case lang_wild_statement_enum: + print_wild_statement (&s->wild_statement, os); + break; + case lang_address_statement_enum: + print_address_statement (&s->address_statement); + break; + case lang_object_symbols_statement_enum: + minfo (" CREATE_OBJECT_SYMBOLS\n"); + break; + case lang_fill_statement_enum: + print_fill_statement (&s->fill_statement); + break; + case lang_data_statement_enum: + print_data_statement (&s->data_statement); + break; + case lang_reloc_statement_enum: + print_reloc_statement (&s->reloc_statement); + break; + case lang_input_section_enum: + print_input_section (&s->input_section); + break; + case lang_padding_statement_enum: + print_padding_statement (&s->padding_statement); + break; + case lang_output_section_statement_enum: + print_output_section_statement (&s->output_section_statement); + break; + case lang_assignment_statement_enum: + print_assignment (&s->assignment_statement, os); + break; + case lang_target_statement_enum: + fprintf (config.map_file, "TARGET(%s)\n", s->target_statement.target); + break; + case lang_output_statement_enum: + minfo ("OUTPUT(%s", s->output_statement.name); + if (output_target != NULL) + minfo (" %s", output_target); + minfo (")\n"); + break; + case lang_input_statement_enum: + print_input_statement (&s->input_statement); + break; + case lang_group_statement_enum: + print_group (&s->group_statement, os); + break; + case lang_afile_asection_pair_statement_enum: + FAIL (); + break; } } - static void print_statements () { - print_statement (statement_list.head, - abs_output_section); + print_statement_list (statement_list.head, abs_output_section); +} + +/* Print the first N statements in statement list S to STDERR. + If N == 0, nothing is printed. + If N < 0, the entire list is printed. + Intended to be called from GDB. */ +void +dprint_statement (s, n) + lang_statement_union_type * s; + int n; +{ + FILE *map_save = config.map_file; + + config.map_file = stderr; + + if (n < 0) + print_statement_list (s, abs_output_section); + else + { + while (s && --n >= 0) + { + print_statement (s, abs_output_section); + s = s->next; + } + } + + config.map_file = map_save; } static bfd_vma @@ -1825,9 +1975,9 @@ lang_size_sections (s, output_section_statement, prev, fill, dot, relax) { 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->region->current < os->region->origin + || (os->region->current - os->region->origin + > os->region->length)) { if (os->addr_tree != (etree_type *) NULL) { @@ -1931,7 +2081,10 @@ lang_size_sections (s, output_section_statement, prev, fill, dot, relax) i = (*prev)->input_section.section; if (! relax) - i->_cooked_size = i->_raw_size; + { + if (i->_cooked_size == 0) + i->_cooked_size = i->_raw_size; + } else { boolean again; @@ -2007,6 +2160,8 @@ lang_size_sections (s, output_section_statement, prev, fill, dot, relax) 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: @@ -2189,6 +2344,9 @@ lang_set_startof () { asection *s; + if (link_info.relocateable) + return; + for (s = output_bfd->sections; s != NULL; s = s->next) { const char *secname; @@ -2376,9 +2534,51 @@ lang_one_common (h, info) section->flags |= SEC_ALLOC; if (config.map_file != NULL) - fprintf (config.map_file, "Allocating common %s: %lx at %lx %s\n", - h->root.string, (unsigned long) size, - (unsigned long) h->u.def.value, section->owner->filename); + { + static boolean header_printed; + int len; + char *name; + char buf[50]; + + if (! header_printed) + { + minfo ("\nAllocating common symbols\n"); + minfo ("Common symbol size file\n\n"); + header_printed = true; + } + + name = demangle (h->root.string); + minfo ("%s", name); + len = strlen (name); + free (name); + + if (len >= 19) + { + print_nl (); + len = 0; + } + while (len < 20) + { + print_space (); + ++len; + } + + minfo ("0x"); + if (size <= 0xffffffff) + sprintf (buf, "%lx", (unsigned long) size); + else + sprintf_vma (buf, size); + minfo ("%s", buf); + len = strlen (buf); + + while (len < 16) + { + print_space (); + ++len; + } + + minfo ("%B\n", section->owner); + } return true; } @@ -2575,6 +2775,18 @@ ldlang_add_file (entry) *pp = entry->the_bfd; entry->the_bfd->usrdata = (PTR) entry; bfd_set_gp_size (entry->the_bfd, g_switch_value); + + /* Look through the sections and check for any which should not be + included in the link. We need to do this now, so that we can + notice when the backend linker tries to report multiple + definition errors for symbols which are in sections we aren't + going to link. FIXME: It might be better to entirely ignore + symbols which are defined in sections which are going to be + discarded. This would require modifying the backend linker for + each backend which might set the SEC_LINK_ONCE flag. If we do + this, we should probably handle SEC_EXCLUDE in the same way. */ + + bfd_map_over_sections (entry->the_bfd, section_already_linked, (PTR) NULL); } void @@ -2725,6 +2937,10 @@ lang_process () ldemul_before_allocation (); + /* We must record the program headers before we try to fix the + section positions, since they will affect SIZEOF_HEADERS. */ + lang_record_phdrs (); + /* Now run around and relax if we can */ if (command_line.relax) { @@ -3115,3 +3331,151 @@ lang_leave_group () { stat_ptr = &statement_list; } + +/* Add a new program header. This is called for each entry in a PHDRS + command in a linker script. */ + +void +lang_new_phdr (name, type, filehdr, phdrs, at, flags) + const char *name; + etree_type *type; + boolean filehdr; + boolean phdrs; + etree_type *at; + etree_type *flags; +{ + struct lang_phdr *n, **pp; + + n = (struct lang_phdr *) stat_alloc (sizeof (struct lang_phdr)); + n->next = NULL; + n->name = name; + n->type = exp_get_value_int (type, 0, "program header type", + lang_final_phase_enum); + n->filehdr = filehdr; + n->phdrs = phdrs; + n->at = at; + n->flags = flags; + + for (pp = &lang_phdr_list; *pp != NULL; pp = &(*pp)->next) + ; + *pp = n; +} + +/* Record that a section should be placed in a phdr. */ + +void +lang_section_in_phdr (name) + const char *name; +{ + struct lang_output_section_phdr_list *n; + + n = ((struct lang_output_section_phdr_list *) + stat_alloc (sizeof (struct lang_output_section_phdr_list))); + n->name = name; + n->used = false; + n->next = current_section->phdrs; + current_section->phdrs = n; +} + +/* Record the program header information in the output BFD. FIXME: We + should not be calling an ELF specific function here. */ + +static void +lang_record_phdrs () +{ + unsigned int alc; + asection **secs; + struct lang_output_section_phdr_list *last; + struct lang_phdr *l; + lang_statement_union_type *u; + + alc = 10; + secs = xmalloc (alc * sizeof (asection *)); + last = NULL; + for (l = lang_phdr_list; l != NULL; l = l->next) + { + unsigned int c; + flagword flags; + bfd_vma at; + + c = 0; + for (u = lang_output_section_statement.head; + u != NULL; + u = u->output_section_statement.next) + { + lang_output_section_statement_type *os; + struct lang_output_section_phdr_list *pl; + + os = &u->output_section_statement; + + pl = os->phdrs; + if (pl != NULL) + last = pl; + else + { + if (! os->loadable + || os->bfd_section == NULL + || (os->bfd_section->flags & SEC_ALLOC) == 0) + continue; + pl = last; + } + + if (os->bfd_section == NULL) + continue; + + for (; pl != NULL; pl = pl->next) + { + if (strcmp (pl->name, l->name) == 0) + { + if (c >= alc) + { + alc *= 2; + secs = xrealloc (secs, alc * sizeof (asection *)); + } + secs[c] = os->bfd_section; + ++c; + pl->used = true; + } + } + } + + if (l->flags == NULL) + flags = 0; + else + flags = exp_get_vma (l->flags, 0, "phdr flags", + lang_final_phase_enum); + + if (l->at == NULL) + at = 0; + else + at = exp_get_vma (l->at, 0, "phdr load address", + lang_final_phase_enum); + + if (! bfd_record_phdr (output_bfd, l->type, + l->flags == NULL ? false : true, + flags, + l->at == NULL ? false : true, + at, l->filehdr, l->phdrs, c, secs)) + einfo ("%F%P: bfd_record_phdr failed: %E\n"); + } + + free (secs); + + /* Make sure all the phdr assignments succeeded. */ + for (u = lang_output_section_statement.head; + u != NULL; + u = u->output_section_statement.next) + { + struct lang_output_section_phdr_list *pl; + + if (u->output_section_statement.bfd_section == NULL) + continue; + + for (pl = u->output_section_statement.phdrs; + pl != NULL; + pl = pl->next) + if (! pl->used && strcmp (pl->name, "NONE") != 0) + einfo ("%X%P: section `%s' assigned to non-existent phdr `%s'\n", + u->output_section_statement.name, pl->name); + } +} diff --git a/gnu/usr.bin/binutils/ld/ldlang.h b/gnu/usr.bin/binutils/ld/ldlang.h index 9feeef3984e..1d1e3d28153 100644 --- a/gnu/usr.bin/binutils/ld/ldlang.h +++ b/gnu/usr.bin/binutils/ld/ldlang.h @@ -1,5 +1,5 @@ /* ldlang.h - linker command language support - Copyright 1991, 1992, 1993, 1994, 1995 Free Software Foundation, Inc. + Copyright 1991, 92, 93, 94, 95, 1996 Free Software Foundation, Inc. This file is part of GLD, the Gnu Linker. @@ -97,6 +97,16 @@ typedef struct lang_output_statement_struct } lang_output_statement_type; +/* This structure holds a list of program headers describing segments + in which this section should be placed. */ + +struct lang_output_section_phdr_list +{ + struct lang_output_section_phdr_list *next; + const char *name; + boolean used; +}; + typedef struct lang_output_section_statement_struct { lang_statement_header_type header; @@ -118,7 +128,9 @@ typedef struct lang_output_section_statement_struct int subsection_alignment; /* alignment of components */ int section_alignment; /* alignment of start of section */ - union etree_union *load_base; + union etree_union *load_base; + + struct lang_output_section_phdr_list *phdrs; } lang_output_section_statement_type; @@ -223,6 +235,9 @@ typedef struct lang_input_statement_struct /* Whether to search for this entry as a dynamic archive. */ boolean dynamic; + /* Whether to include the entire contents of an archive. */ + boolean whole_archive; + boolean loaded; /* unsigned int globals_in_this_file;*/ @@ -306,6 +321,20 @@ typedef union lang_statement_union lang_group_statement_type group_statement; } lang_statement_union_type; +/* This structure holds information about a program header, from the + PHDRS command in the linker script. */ + +struct lang_phdr +{ + struct lang_phdr *next; + const char *name; + unsigned long type; + boolean filehdr; + boolean phdrs; + etree_type *at; + etree_type *flags; +}; + extern lang_output_section_statement_type *abs_output_section; extern boolean lang_has_input_file; extern etree_type *base; @@ -398,5 +427,9 @@ extern void wild_doit PARAMS ((lang_statement_list_type *ptr, asection *section, lang_output_section_statement_type *output, lang_input_statement_type *file)); +extern void lang_new_phdr + PARAMS ((const char *, etree_type *, boolean, boolean, etree_type *, + etree_type *)); +extern void lang_section_in_phdr PARAMS ((const char *)); #endif diff --git a/gnu/usr.bin/binutils/ld/ldlex.c b/gnu/usr.bin/binutils/ld/ldlex.c deleted file mode 100644 index 5933d609341..00000000000 --- a/gnu/usr.bin/binutils/ld/ldlex.c +++ /dev/null @@ -1,3270 +0,0 @@ -/* A lexical scanner generated by flex */ - -/* Scanner skeleton version: - * $Header: /cvs/OpenBSD/src/gnu/usr.bin/binutils/ld/Attic/ldlex.c,v 1.1 1996/01/08 11:09:19 niklas Exp $ - */ - -#define FLEX_SCANNER -#define YY_FLEX_MAJOR_VERSION 2 -#define YY_FLEX_MINOR_VERSION 5 - -#include <stdio.h> - - -/* cfront 1.2 defines "c_plusplus" instead of "__cplusplus" */ -#ifdef c_plusplus -#ifndef __cplusplus -#define __cplusplus -#endif -#endif - - -#ifdef __cplusplus - -#include <stdlib.h> -#include <unistd.h> - -/* Use prototypes in function declarations. */ -#define YY_USE_PROTOS - -/* The "const" storage-class-modifier is valid. */ -#define YY_USE_CONST - -#else /* ! __cplusplus */ - -#if __STDC__ - -#define YY_USE_PROTOS -#define YY_USE_CONST - -#endif /* __STDC__ */ -#endif /* ! __cplusplus */ - -#ifdef __TURBOC__ - #pragma warn -rch - #pragma warn -use -#include <io.h> -#include <stdlib.h> -#define YY_USE_CONST -#define YY_USE_PROTOS -#endif - -#ifdef YY_USE_CONST -#define yyconst const -#else -#define yyconst -#endif - - -#ifdef YY_USE_PROTOS -#define YY_PROTO(proto) proto -#else -#define YY_PROTO(proto) () -#endif - -/* Returned upon end-of-file. */ -#define YY_NULL 0 - -/* Promotes a possibly negative, possibly signed char to an unsigned - * integer for use as an array index. If the signed char is negative, - * we want to instead treat it as an 8-bit unsigned char, hence the - * double cast. - */ -#define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c) - -/* Enter a start condition. This macro really ought to take a parameter, - * but we do it the disgusting crufty way forced on us by the ()-less - * definition of BEGIN. - */ -#define BEGIN yy_start = 1 + 2 * - -/* Translate the current start state into a value that can be later handed - * to BEGIN to return to the state. The YYSTATE alias is for lex - * compatibility. - */ -#define YY_START ((yy_start - 1) / 2) -#define YYSTATE YY_START - -/* Action number for EOF rule of a given start state. */ -#define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1) - -/* Special action meaning "start processing a new file". */ -#define YY_NEW_FILE yyrestart( yyin ) - -#define YY_END_OF_BUFFER_CHAR 0 - -/* Size of default input buffer. */ -#define YY_BUF_SIZE 16384 - -typedef struct yy_buffer_state *YY_BUFFER_STATE; - -extern int yyleng; -extern FILE *yyin, *yyout; - -#define EOB_ACT_CONTINUE_SCAN 0 -#define EOB_ACT_END_OF_FILE 1 -#define EOB_ACT_LAST_MATCH 2 - -/* The funky do-while in the following #define is used to turn the definition - * int a single C statement (which needs a semi-colon terminator). This - * avoids problems with code like: - * - * if ( condition_holds ) - * yyless( 5 ); - * else - * do_something_else(); - * - * Prior to using the do-while the compiler would get upset at the - * "else" because it interpreted the "if" statement as being all - * done when it reached the ';' after the yyless() call. - */ - -/* Return all but the first 'n' matched characters back to the input stream. */ - -#define yyless(n) \ - do \ - { \ - /* Undo effects of setting up yytext. */ \ - *yy_cp = yy_hold_char; \ - yy_c_buf_p = yy_cp = yy_bp + n - YY_MORE_ADJ; \ - YY_DO_BEFORE_ACTION; /* set up yytext again */ \ - } \ - while ( 0 ) - -#define unput(c) yyunput( c, yytext_ptr ) - -/* The following is because we cannot portably get our hands on size_t - * (without autoconf's help, which isn't available because we want - * flex-generated scanners to compile on their own). - */ -typedef unsigned int yy_size_t; - - -struct yy_buffer_state - { - FILE *yy_input_file; - - char *yy_ch_buf; /* input buffer */ - char *yy_buf_pos; /* current position in input buffer */ - - /* Size of input buffer in bytes, not including room for EOB - * characters. - */ - yy_size_t yy_buf_size; - - /* Number of characters read into yy_ch_buf, not including EOB - * characters. - */ - int yy_n_chars; - - /* Whether we "own" the buffer - i.e., we know we created it, - * and can realloc() it to grow it, and should free() it to - * delete it. - */ - int yy_is_our_buffer; - - /* Whether this is an "interactive" input source; if so, and - * if we're using stdio for input, then we want to use getc() - * instead of fread(), to make sure we stop fetching input after - * each newline. - */ - int yy_is_interactive; - - /* Whether we're considered to be at the beginning of a line. - * If so, '^' rules will be active on the next match, otherwise - * not. - */ - int yy_at_bol; - - /* Whether to try to fill the input buffer when we reach the - * end of it. - */ - int yy_fill_buffer; - - int yy_buffer_status; -#define YY_BUFFER_NEW 0 -#define YY_BUFFER_NORMAL 1 - /* When an EOF's been seen but there's still some text to process - * then we mark the buffer as YY_EOF_PENDING, to indicate that we - * shouldn't try reading from the input source any more. We might - * still have a bunch of tokens to match, though, because of - * possible backing-up. - * - * When we actually see the EOF, we change the status to "new" - * (via yyrestart()), so that the user can continue scanning by - * just pointing yyin at a new input file. - */ -#define YY_BUFFER_EOF_PENDING 2 - }; - -static YY_BUFFER_STATE yy_current_buffer = 0; - -/* We provide macros for accessing buffer states in case in the - * future we want to put the buffer states in a more general - * "scanner state". - */ -#define YY_CURRENT_BUFFER yy_current_buffer - - -/* yy_hold_char holds the character lost when yytext is formed. */ -static char yy_hold_char; - -static int yy_n_chars; /* number of characters read into yy_ch_buf */ - - -int yyleng; - -/* Points to current character in buffer. */ -static char *yy_c_buf_p = (char *) 0; -static int yy_init = 1; /* whether we need to initialize */ -static int yy_start = 0; /* start state number */ - -/* Flag which is used to allow yywrap()'s to do buffer switches - * instead of setting up a fresh yyin. A bit of a hack ... - */ -static int yy_did_buffer_switch_on_eof; - -void yyrestart YY_PROTO(( FILE *input_file )); - -void yy_switch_to_buffer YY_PROTO(( YY_BUFFER_STATE new_buffer )); -void yy_load_buffer_state YY_PROTO(( void )); -YY_BUFFER_STATE yy_create_buffer YY_PROTO(( FILE *file, int size )); -void yy_delete_buffer YY_PROTO(( YY_BUFFER_STATE b )); -void yy_init_buffer YY_PROTO(( YY_BUFFER_STATE b, FILE *file )); -void yy_flush_buffer YY_PROTO(( YY_BUFFER_STATE b )); -#define YY_FLUSH_BUFFER yy_flush_buffer( yy_current_buffer ) - -YY_BUFFER_STATE yy_scan_buffer YY_PROTO(( char *base, yy_size_t size )); -YY_BUFFER_STATE yy_scan_string YY_PROTO(( yyconst char *str )); -YY_BUFFER_STATE yy_scan_bytes YY_PROTO(( yyconst char *bytes, int len )); - -static void *yy_flex_alloc YY_PROTO(( yy_size_t )); -static void *yy_flex_realloc YY_PROTO(( void *, yy_size_t )); -static void yy_flex_free YY_PROTO(( void * )); - -#define yy_new_buffer yy_create_buffer - -#define yy_set_interactive(is_interactive) \ - { \ - if ( ! yy_current_buffer ) \ - yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE ); \ - yy_current_buffer->yy_is_interactive = is_interactive; \ - } - -#define yy_set_bol(at_bol) \ - { \ - if ( ! yy_current_buffer ) \ - yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE ); \ - yy_current_buffer->yy_at_bol = at_bol; \ - } - -#define YY_AT_BOL() (yy_current_buffer->yy_at_bol) - -typedef unsigned char YY_CHAR; -FILE *yyin = (FILE *) 0, *yyout = (FILE *) 0; -typedef int yy_state_type; -extern char *yytext; -#define yytext_ptr yytext - -static yy_state_type yy_get_previous_state YY_PROTO(( void )); -static yy_state_type yy_try_NUL_trans YY_PROTO(( yy_state_type current_state )); -static int yy_get_next_buffer YY_PROTO(( void )); -static void yy_fatal_error YY_PROTO(( yyconst char msg[] )); - -/* Done after the current pattern has been matched and before the - * corresponding action - sets up yytext. - */ -#define YY_DO_BEFORE_ACTION \ - yytext_ptr = yy_bp; \ - yyleng = (int) (yy_cp - yy_bp); \ - yy_hold_char = *yy_cp; \ - *yy_cp = '\0'; \ - yy_c_buf_p = yy_cp; - -#define YY_NUM_RULES 144 -#define YY_END_OF_BUFFER 145 -static yyconst short int yy_accept[895] = - { 0, - 0, 0, 137, 137, 0, 0, 0, 0, 0, 0, - 0, 0, 145, 144, 142, 141, 139, 140, 32, 142, - 137, 38, 29, 44, 43, 34, 35, 28, 36, 137, - 37, 8, 8, 45, 46, 39, 40, 27, 33, 8, - 8, 8, 8, 8, 8, 137, 137, 137, 137, 137, - 137, 137, 137, 137, 137, 137, 10, 9, 8, 88, - 86, 137, 42, 30, 41, 31, 143, 141, 140, 32, - 143, 135, 38, 29, 44, 43, 34, 35, 28, 36, - 135, 37, 8, 8, 45, 46, 39, 40, 27, 33, - 8, 8, 8, 135, 135, 135, 10, 9, 8, 135, - - 42, 30, 41, 31, 135, 8, 8, 8, 8, 8, - 8, 8, 8, 135, 135, 135, 135, 135, 135, 135, - 135, 135, 135, 8, 8, 88, 86, 4, 3, 2, - 4, 5, 4, 94, 95, 93, 134, 34, 35, 28, - 36, 134, 37, 8, 8, 45, 46, 40, 8, 8, - 8, 8, 8, 8, 134, 134, 134, 134, 134, 134, - 10, 9, 8, 8, 8, 8, 8, 134, 134, 134, - 134, 134, 134, 31, 15, 0, 138, 137, 8, 8, - 26, 24, 22, 20, 21, 1, 23, 8, 137, 18, - 17, 14, 16, 19, 8, 8, 137, 91, 137, 137, - - 137, 137, 8, 137, 137, 137, 137, 137, 137, 137, - 137, 137, 137, 137, 137, 137, 137, 137, 137, 137, - 137, 137, 137, 137, 137, 137, 137, 137, 8, 137, - 137, 137, 25, 13, 135, 6, 6, 20, 21, 0, - 23, 8, 7, 7, 8, 7, 14, 8, 7, 7, - 7, 8, 135, 91, 7, 8, 135, 135, 135, 135, - 7, 135, 8, 8, 8, 0, 8, 8, 135, 135, - 135, 135, 8, 135, 135, 135, 135, 135, 135, 135, - 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, - 135, 135, 135, 135, 135, 8, 135, 135, 4, 4, - - 4, 4, 93, 93, 134, 6, 6, 96, 22, 23, - 97, 8, 7, 7, 7, 8, 134, 8, 8, 7, - 134, 7, 7, 134, 134, 134, 134, 134, 134, 134, - 134, 7, 134, 8, 8, 7, 134, 7, 7, 134, - 134, 134, 134, 134, 134, 134, 134, 11, 12, 137, - 8, 137, 137, 137, 137, 137, 137, 8, 137, 137, - 137, 137, 137, 137, 73, 137, 137, 137, 137, 137, - 57, 137, 137, 137, 137, 137, 137, 137, 137, 137, - 137, 137, 137, 137, 137, 137, 137, 137, 89, 87, - 137, 135, 136, 135, 7, 135, 8, 135, 135, 135, - - 135, 135, 135, 8, 135, 135, 135, 135, 135, 8, - 135, 135, 135, 135, 135, 135, 73, 135, 135, 135, - 135, 135, 57, 135, 135, 135, 135, 135, 135, 135, - 135, 135, 135, 135, 135, 89, 87, 4, 93, 134, - 134, 134, 134, 134, 134, 98, 134, 134, 134, 134, - 134, 134, 134, 134, 134, 134, 134, 134, 134, 134, - 134, 116, 134, 134, 134, 134, 134, 134, 134, 134, - 134, 134, 137, 52, 137, 137, 79, 137, 83, 137, - 137, 137, 137, 69, 137, 137, 137, 137, 84, 137, - 137, 77, 137, 54, 137, 137, 137, 137, 137, 137, - - 76, 137, 137, 137, 137, 137, 137, 137, 137, 137, - 135, 52, 135, 135, 54, 135, 135, 135, 135, 135, - 135, 79, 135, 83, 135, 135, 135, 69, 135, 135, - 135, 135, 84, 135, 135, 77, 135, 135, 135, 135, - 135, 76, 135, 135, 135, 135, 135, 135, 8, 134, - 134, 134, 102, 110, 101, 134, 134, 113, 105, 108, - 134, 134, 114, 134, 134, 134, 134, 134, 120, 128, - 119, 134, 134, 131, 123, 126, 134, 134, 132, 134, - 134, 137, 51, 49, 137, 137, 137, 82, 53, 75, - 137, 63, 137, 62, 137, 137, 137, 137, 137, 137, - - 137, 137, 137, 137, 78, 137, 137, 137, 137, 137, - 137, 135, 51, 135, 135, 135, 135, 135, 135, 49, - 135, 135, 82, 53, 75, 135, 63, 135, 62, 135, - 135, 135, 135, 135, 135, 135, 135, 78, 135, 135, - 135, 134, 103, 100, 134, 134, 113, 113, 107, 134, - 112, 134, 134, 121, 118, 134, 134, 131, 131, 125, - 134, 130, 134, 137, 137, 137, 137, 137, 137, 50, - 47, 137, 81, 48, 61, 137, 137, 137, 137, 58, - 137, 74, 59, 137, 137, 135, 135, 81, 135, 58, - 135, 135, 135, 135, 135, 135, 50, 47, 135, 48, - - 61, 135, 135, 135, 135, 74, 59, 134, 134, 111, - 109, 106, 134, 134, 134, 129, 127, 124, 134, 137, - 137, 137, 64, 137, 90, 80, 137, 85, 92, 137, - 137, 137, 70, 137, 137, 135, 64, 92, 135, 135, - 135, 135, 135, 135, 90, 80, 135, 85, 135, 135, - 70, 134, 134, 134, 134, 134, 134, 115, 137, 137, - 137, 137, 137, 137, 68, 137, 133, 137, 115, 135, - 133, 135, 135, 135, 135, 135, 135, 135, 68, 115, - 99, 104, 133, 117, 122, 137, 137, 137, 137, 137, - 137, 137, 137, 135, 135, 135, 135, 135, 135, 135, - - 135, 137, 137, 137, 137, 137, 60, 137, 137, 135, - 135, 135, 135, 135, 135, 135, 60, 137, 137, 137, - 72, 137, 137, 137, 135, 135, 135, 135, 135, 72, - 135, 66, 137, 137, 137, 137, 137, 135, 135, 66, - 135, 135, 135, 137, 137, 71, 137, 137, 135, 135, - 135, 135, 71, 137, 137, 56, 55, 56, 55, 135, - 135, 137, 137, 135, 135, 137, 137, 135, 135, 137, - 137, 135, 135, 137, 137, 135, 135, 137, 137, 135, - 135, 137, 137, 135, 135, 65, 137, 65, 135, 137, - 135, 67, 67, 0 - - } ; - -static yyconst int yy_ec[256] = - { 0, - 1, 1, 1, 1, 1, 1, 1, 1, 2, 3, - 1, 1, 4, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 2, 5, 6, 7, 8, 9, 10, 1, 11, - 12, 13, 14, 15, 16, 17, 18, 19, 20, 20, - 20, 20, 20, 20, 20, 20, 20, 21, 22, 23, - 24, 25, 26, 1, 27, 28, 29, 30, 31, 32, - 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, - 43, 44, 45, 46, 47, 48, 17, 49, 50, 51, - 52, 17, 53, 1, 54, 1, 55, 56, 57, 58, - - 59, 60, 61, 62, 63, 17, 64, 65, 66, 67, - 68, 69, 17, 70, 71, 72, 73, 17, 17, 74, - 17, 75, 76, 77, 78, 79, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1 - } ; - -static yyconst int yy_meta[80] = - { 0, - 1, 1, 2, 1, 1, 1, 1, 3, 1, 1, - 1, 1, 1, 3, 4, 3, 5, 5, 6, 6, - 3, 1, 1, 4, 1, 1, 6, 6, 6, 6, - 6, 6, 5, 5, 5, 5, 6, 5, 6, 5, - 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, - 5, 3, 3, 5, 6, 6, 6, 6, 6, 6, - 5, 5, 5, 6, 5, 6, 5, 5, 5, 5, - 5, 5, 5, 6, 5, 1, 1, 1, 3 - } ; - -static yyconst short int yy_base[910] = - { 0, - 0, 0, 0, 0, 79, 0, 151, 0, 219, 0, - 298, 0, 1628, 1629, 1629, 1629, 1629, 1629, 1603, 1620, - 359, 1629, 150, 1629, 1629, 1601, 1600, 0, 1599, 0, - 148, 401, 1548, 0, 1629, 139, 1597, 140, 1629, 365, - 138, 125, 349, 127, 361, 1576, 1581, 1578, 146, 171, - 162, 170, 1573, 1569, 391, 1588, 0, 0, 139, 1555, - 1543, 1549, 1629, 357, 1629, 0, 1629, 1629, 1629, 1587, - 1604, 457, 1629, 373, 1629, 1629, 1585, 1584, 1629, 377, - 0, 191, 499, 1533, 1629, 1629, 361, 1582, 380, 1629, - 555, 416, 417, 351, 1561, 1569, 1629, 1629, 436, 1540, - - 1629, 374, 1629, 0, 611, 431, 432, 504, 471, 558, - 589, 485, 613, 1558, 1563, 1560, 369, 381, 412, 455, - 1552, 626, 1571, 625, 541, 1538, 1526, 673, 1629, 1629, - 0, 1629, 715, 1629, 1629, 1592, 763, 1570, 1569, 1629, - 1568, 0, 1567, 0, 1516, 1629, 0, 1565, 805, 445, - 473, 453, 541, 608, 372, 1561, 1543, 1539, 378, 1541, - 1629, 1629, 560, 635, 656, 647, 538, 105, 1529, 1513, - 1509, 377, 1511, 0, 1629, 1574, 1629, 0, 0, 1505, - 1629, 1629, 1629, 0, 0, 1629, 0, 0, 643, 1554, - 1629, 0, 1629, 1553, 405, 490, 1541, 0, 1534, 1528, - - 438, 1542, 420, 1541, 1525, 1532, 1528, 1524, 1526, 1528, - 654, 1525, 1524, 1521, 1523, 1512, 507, 1525, 1513, 1527, - 1516, 1529, 517, 1514, 1503, 1526, 1507, 1507, 529, 1483, - 1488, 1473, 1629, 1629, 0, 861, 1473, 1629, 1629, 0, - 0, 1472, 1471, 1629, 1629, 658, 1629, 710, 721, 730, - 0, 0, 1509, 0, 750, 769, 1494, 1504, 1500, 1489, - 770, 1464, 792, 791, 0, 0, 808, 864, 1497, 1491, - 593, 1505, 865, 1504, 1488, 1495, 1491, 1487, 1489, 1491, - 681, 1488, 1487, 1484, 1486, 515, 1489, 1477, 1491, 1494, - 618, 1479, 1492, 1473, 1473, 868, 1449, 1454, 0, 1440, - - 0, 0, 1510, 1508, 0, 921, 1437, 0, 0, 1629, - 0, 524, 670, 599, 0, 0, 1475, 840, 868, 1474, - 1478, 1461, 1462, 1460, 1477, 1464, 1472, 1473, 1471, 1472, - 1451, 698, 1434, 871, 884, 1433, 1437, 1422, 1423, 1421, - 1436, 1424, 1431, 1432, 1430, 1431, 1412, 1629, 1629, 1443, - 131, 1450, 1453, 1450, 1435, 1429, 1451, 653, 1448, 1432, - 1437, 1447, 1444, 1425, 0, 1433, 1429, 1422, 1435, 1434, - 0, 1425, 1419, 1426, 1422, 1429, 1419, 1416, 1411, 1428, - 1413, 1406, 1402, 1409, 1390, 1386, 1385, 1346, 0, 0, - 1322, 1361, 0, 1338, 926, 1345, 954, 1331, 1335, 1327, - - 1343, 1305, 1313, 924, 1342, 1339, 1324, 1318, 1340, 964, - 1337, 1321, 1326, 1336, 1333, 1314, 0, 1322, 1318, 1311, - 1324, 1323, 0, 1314, 1316, 1320, 1310, 1307, 1320, 1305, - 1302, 1303, 1302, 1307, 1311, 0, 0, 748, 1629, 1012, - 1302, 632, 1311, 1310, 1298, 0, 1308, 1299, 1291, 1306, - 1304, 1303, 1295, 1281, 1282, 1285, 1256, 651, 1264, 1263, - 1251, 0, 1255, 1243, 1231, 1244, 1242, 1241, 1234, 1226, - 1227, 1229, 1257, 0, 1254, 1256, 0, 1246, 0, 1245, - 1250, 1243, 1238, 0, 1241, 1255, 1243, 1237, 0, 1237, - 1236, 0, 1237, 0, 1239, 1252, 1243, 1230, 1238, 1240, - - 0, 1245, 1238, 1226, 1230, 1224, 1234, 1237, 1202, 1198, - 1227, 0, 1224, 1223, 0, 1235, 1226, 1219, 1194, 1190, - 1220, 0, 1210, 0, 1209, 1203, 1198, 0, 1201, 1215, - 1203, 1197, 0, 1196, 1190, 0, 1187, 1184, 1189, 1176, - 1184, 0, 1192, 1185, 1173, 1172, 1182, 1185, 811, 1177, - 1169, 1173, 0, 0, 0, 1168, 1184, 1072, 0, 0, - 1166, 1174, 0, 1162, 1178, 1141, 1134, 1137, 0, 0, - 0, 1133, 1147, 1150, 0, 0, 1131, 1137, 0, 1127, - 1141, 1150, 0, 0, 1152, 1164, 1163, 0, 0, 0, - 1139, 0, 1162, 0, 1157, 1140, 1162, 1158, 1147, 1140, - - 1158, 1154, 1149, 1141, 0, 1149, 1133, 1151, 1132, 1104, - 1111, 1123, 0, 1138, 1138, 1137, 1134, 1091, 1098, 0, - 1109, 1116, 0, 0, 0, 1092, 0, 1115, 0, 1110, - 1093, 1115, 1101, 1094, 1112, 1104, 1096, 0, 1089, 1107, - 1088, 1086, 0, 1093, 1091, 1084, 0, 1228, 0, 1100, - 0, 1101, 1054, 0, 1060, 1058, 1052, 0, 1306, 0, - 1066, 0, 1067, 1075, 1073, 1065, 1088, 1088, 1085, 0, - 0, 1069, 0, 0, 1060, 1063, 1081, 1057, 1070, 1055, - 1066, 0, 0, 1035, 1052, 1059, 1074, 0, 1072, 1048, - 1029, 1046, 1052, 1039, 1063, 1060, 0, 0, 1044, 0, - - 1035, 1038, 1032, 1040, 1033, 0, 0, 1020, 1024, 0, - 0, 0, 1018, 991, 994, 0, 0, 0, 989, 1029, - 1030, 1017, 0, 1016, 0, 0, 693, 0, 0, 1026, - 1010, 1020, 0, 994, 990, 1020, 0, 0, 1016, 990, - 986, 1018, 1005, 1004, 0, 0, 723, 0, 1008, 992, - 0, 1005, 1005, 1003, 974, 971, 968, 0, 980, 997, - 985, 979, 981, 986, 0, 989, 0, 960, 0, 987, - 0, 958, 970, 987, 975, 969, 971, 976, 0, 0, - 0, 0, 0, 0, 0, 969, 973, 969, 978, 962, - 961, 977, 947, 971, 942, 955, 958, 954, 962, 942, - - 931, 930, 942, 930, 935, 928, 0, 936, 907, 932, - 901, 913, 916, 905, 911, 905, 0, 893, 908, 896, - 0, 906, 895, 865, 892, 856, 869, 882, 870, 0, - 881, 0, 154, 352, 381, 449, 501, 528, 521, 0, - 563, 564, 610, 604, 647, 0, 633, 616, 654, 645, - 665, 710, 0, 694, 703, 0, 0, 0, 0, 708, - 719, 711, 724, 713, 726, 726, 736, 745, 745, 761, - 773, 775, 775, 764, 779, 768, 786, 779, 780, 800, - 794, 804, 816, 807, 824, 0, 829, 0, 835, 842, - 846, 0, 0, 1629, 1384, 1390, 1394, 1398, 889, 1400, - - 1406, 1410, 1416, 1422, 1426, 1432, 1438, 1444, 1450 - } ; - -static yyconst short int yy_def[910] = - { 0, - 895, 895, 894, 3, 894, 5, 5, 7, 894, 9, - 894, 11, 894, 894, 894, 894, 894, 894, 894, 896, - 897, 894, 894, 894, 894, 894, 897, 897, 897, 897, - 897, 897, 32, 897, 894, 894, 897, 894, 894, 32, - 32, 32, 32, 32, 32, 897, 897, 897, 897, 897, - 897, 897, 897, 897, 897, 897, 897, 897, 32, 897, - 897, 897, 894, 894, 894, 897, 894, 894, 894, 894, - 896, 898, 894, 894, 894, 894, 894, 894, 894, 894, - 898, 898, 894, 83, 894, 894, 894, 894, 894, 894, - 898, 91, 91, 898, 898, 898, 894, 894, 91, 898, - - 894, 894, 894, 898, 898, 899, 899, 105, 105, 105, - 105, 105, 105, 898, 898, 898, 898, 898, 898, 898, - 898, 898, 898, 105, 105, 898, 898, 900, 894, 894, - 900, 894, 900, 894, 894, 901, 902, 903, 894, 894, - 894, 902, 902, 83, 83, 894, 904, 894, 902, 149, - 149, 149, 149, 149, 902, 902, 902, 902, 902, 902, - 894, 894, 149, 149, 149, 149, 149, 902, 902, 902, - 902, 902, 902, 902, 894, 896, 894, 897, 32, 32, - 894, 894, 894, 897, 897, 894, 897, 897, 32, 894, - 894, 897, 894, 894, 32, 32, 897, 897, 897, 897, - - 897, 897, 32, 897, 897, 897, 897, 897, 897, 897, - 897, 897, 897, 897, 897, 897, 897, 897, 897, 897, - 897, 897, 897, 897, 897, 897, 897, 897, 32, 897, - 897, 897, 894, 894, 898, 898, 236, 894, 894, 905, - 898, 83, 83, 894, 894, 107, 894, 91, 91, 91, - 898, 898, 898, 898, 91, 91, 898, 898, 898, 898, - 91, 898, 105, 105, 107, 246, 105, 105, 898, 898, - 898, 898, 105, 898, 898, 898, 898, 898, 898, 898, - 898, 898, 898, 898, 898, 898, 898, 898, 898, 898, - 898, 898, 898, 898, 898, 105, 898, 898, 900, 133, - - 133, 900, 901, 894, 902, 902, 306, 903, 903, 894, - 904, 149, 149, 149, 902, 902, 902, 149, 149, 902, - 902, 902, 902, 902, 902, 902, 902, 902, 902, 902, - 902, 149, 902, 149, 149, 902, 902, 902, 902, 902, - 902, 902, 902, 902, 902, 902, 902, 894, 894, 897, - 32, 897, 897, 897, 897, 897, 897, 32, 897, 897, - 897, 897, 897, 897, 897, 897, 897, 897, 897, 897, - 897, 897, 897, 897, 897, 897, 897, 897, 897, 897, - 897, 897, 897, 897, 897, 897, 897, 897, 897, 897, - 897, 105, 905, 898, 91, 898, 91, 898, 898, 898, - - 898, 898, 898, 105, 898, 898, 898, 898, 898, 105, - 898, 898, 898, 898, 898, 898, 898, 898, 898, 898, - 898, 898, 898, 898, 898, 898, 898, 898, 898, 898, - 898, 898, 898, 898, 898, 898, 898, 133, 894, 902, - 902, 902, 902, 902, 902, 902, 902, 902, 902, 902, - 902, 902, 902, 902, 902, 902, 902, 902, 902, 902, - 902, 902, 902, 902, 902, 902, 902, 902, 902, 902, - 902, 902, 897, 897, 897, 897, 897, 897, 897, 897, - 897, 897, 897, 897, 897, 897, 897, 897, 897, 897, - 897, 897, 897, 897, 897, 897, 897, 897, 897, 897, - - 897, 897, 897, 897, 897, 897, 897, 897, 897, 897, - 898, 898, 898, 898, 898, 898, 898, 898, 898, 898, - 898, 898, 898, 898, 898, 898, 898, 898, 898, 898, - 898, 898, 898, 898, 898, 898, 898, 898, 898, 898, - 898, 898, 898, 898, 898, 898, 898, 898, 440, 902, - 902, 902, 902, 902, 902, 902, 902, 906, 902, 902, - 902, 902, 902, 902, 902, 902, 902, 902, 902, 902, - 902, 902, 902, 907, 902, 902, 902, 902, 902, 902, - 902, 897, 897, 897, 897, 897, 897, 897, 897, 897, - 897, 897, 897, 897, 897, 897, 897, 897, 897, 897, - - 897, 897, 897, 897, 897, 897, 897, 897, 897, 897, - 897, 898, 898, 898, 898, 898, 898, 898, 898, 898, - 898, 898, 898, 898, 898, 898, 898, 898, 898, 898, - 898, 898, 898, 898, 898, 898, 898, 898, 898, 898, - 898, 902, 902, 902, 902, 902, 908, 906, 902, 902, - 902, 902, 902, 902, 902, 902, 902, 909, 907, 902, - 902, 902, 902, 897, 897, 897, 897, 897, 897, 897, - 897, 897, 897, 897, 897, 897, 897, 897, 897, 897, - 897, 897, 897, 897, 897, 898, 898, 898, 898, 898, - 898, 898, 898, 898, 898, 898, 898, 898, 898, 898, - - 898, 898, 898, 898, 898, 898, 898, 902, 902, 902, - 902, 902, 902, 902, 902, 902, 902, 902, 902, 897, - 897, 897, 897, 897, 897, 897, 897, 897, 897, 897, - 897, 897, 897, 897, 897, 898, 898, 898, 898, 898, - 898, 898, 898, 898, 898, 898, 898, 898, 898, 898, - 898, 902, 902, 902, 902, 902, 902, 897, 897, 897, - 897, 897, 897, 897, 897, 897, 897, 897, 898, 898, - 898, 898, 898, 898, 898, 898, 898, 898, 898, 902, - 902, 902, 902, 902, 902, 897, 897, 897, 897, 897, - 897, 897, 897, 898, 898, 898, 898, 898, 898, 898, - - 898, 897, 897, 897, 897, 897, 897, 897, 897, 898, - 898, 898, 898, 898, 898, 898, 898, 897, 897, 897, - 897, 897, 897, 897, 898, 898, 898, 898, 898, 898, - 898, 897, 897, 897, 897, 897, 897, 898, 898, 898, - 898, 898, 898, 897, 897, 897, 897, 897, 898, 898, - 898, 898, 898, 897, 897, 897, 897, 898, 898, 898, - 898, 897, 897, 898, 898, 897, 897, 898, 898, 897, - 897, 898, 898, 897, 897, 898, 898, 897, 897, 898, - 898, 897, 897, 898, 898, 897, 897, 898, 898, 897, - 898, 897, 898, 0, 894, 894, 894, 894, 894, 894, - - 894, 894, 894, 894, 894, 894, 894, 894, 894 - } ; - -static yyconst short int yy_nxt[1709] = - { 0, - 15, 16, 17, 18, 19, 20, 15, 21, 22, 23, - 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, - 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, - 44, 45, 46, 47, 48, 30, 30, 49, 50, 51, - 52, 53, 54, 30, 55, 56, 30, 30, 30, 30, - 30, 57, 58, 30, 59, 33, 33, 33, 33, 33, - 30, 30, 30, 30, 60, 30, 30, 61, 30, 30, - 62, 30, 30, 30, 30, 63, 64, 65, 66, 67, - 68, 17, 69, 70, 71, 67, 72, 73, 74, 75, - 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, - - 86, 87, 88, 89, 90, 91, 92, 92, 93, 92, - 92, 81, 81, 81, 81, 81, 81, 81, 94, 81, - 95, 81, 81, 96, 81, 81, 81, 81, 81, 81, - 97, 98, 81, 99, 92, 92, 92, 92, 92, 81, - 81, 81, 81, 81, 81, 81, 81, 81, 81, 100, - 81, 81, 81, 81, 101, 102, 103, 104, 105, 181, - 186, 190, 191, 193, 194, 201, 205, 340, 202, 106, - 107, 187, 341, 182, 474, 199, 212, 108, 109, 110, - 111, 112, 113, 114, 115, 116, 213, 200, 117, 118, - 119, 120, 216, 121, 229, 122, 123, 214, 178, 844, - - 178, 215, 217, 186, 178, 124, 125, 125, 125, 125, - 125, 178, 178, 218, 241, 126, 219, 220, 127, 67, - 67, 14, 67, 67, 67, 67, 128, 67, 67, 67, - 67, 67, 129, 67, 130, 131, 131, 106, 107, 67, - 67, 67, 132, 67, 67, 133, 133, 133, 133, 133, - 133, 131, 131, 131, 131, 131, 131, 131, 131, 131, - 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, - 67, 67, 131, 133, 133, 133, 133, 133, 133, 131, - 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, - 131, 131, 131, 131, 67, 67, 67, 131, 15, 16, - - 134, 135, 19, 15, 136, 137, 22, 23, 24, 25, - 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, - 36, 148, 38, 39, 149, 150, 151, 152, 153, 154, - 142, 142, 142, 142, 142, 155, 142, 156, 157, 158, - 142, 142, 159, 160, 142, 142, 142, 142, 142, 161, - 162, 142, 163, 164, 165, 152, 166, 167, 142, 142, - 142, 142, 168, 142, 169, 170, 171, 142, 172, 173, - 142, 142, 142, 63, 64, 65, 174, 179, 180, 203, - 233, 257, 181, 190, 191, 180, 180, 180, 180, 180, - 180, 258, 195, 204, 196, 206, 182, 233, 207, 282, - - 239, 208, 197, 193, 194, 845, 324, 284, 329, 283, - 198, 285, 325, 180, 180, 180, 180, 180, 180, 180, - 180, 223, 178, 330, 224, 225, 846, 180, 180, 180, - 180, 180, 180, 234, 178, 345, 226, 188, 178, 188, - 227, 240, 257, 255, 255, 255, 255, 256, 346, 350, - 234, 358, 286, 235, 235, 180, 180, 180, 180, 180, - 180, 235, 235, 255, 188, 255, 188, 245, 245, 245, - 245, 318, 314, 235, 189, 236, 237, 355, 178, 356, - 314, 235, 305, 237, 237, 237, 237, 237, 237, 264, - 305, 261, 847, 178, 245, 245, 245, 245, 287, 319, - - 314, 288, 289, 264, 266, 894, 320, 252, 269, 252, - 305, 237, 237, 237, 237, 237, 237, 242, 242, 351, - 270, 252, 264, 252, 275, 242, 243, 242, 243, 242, - 242, 267, 244, 268, 252, 245, 252, 245, 374, 244, - 252, 253, 252, 381, 375, 382, 425, 244, 252, 254, - 252, 314, 399, 242, 243, 242, 243, 242, 242, 264, - 244, 305, 245, 178, 245, 314, 244, 252, 314, 252, - 848, 849, 246, 248, 248, 305, 264, 252, 305, 252, - 321, 248, 249, 248, 250, 248, 248, 314, 251, 322, - 850, 252, 253, 252, 252, 251, 252, 305, 271, 388, - - 254, 272, 178, 251, 252, 339, 252, 264, 851, 248, - 255, 248, 255, 248, 248, 332, 251, 852, 252, 273, - 252, 252, 251, 252, 333, 252, 314, 252, 251, 263, - 264, 264, 407, 274, 408, 314, 305, 264, 264, 264, - 264, 264, 264, 264, 430, 305, 431, 276, 323, 252, - 277, 252, 252, 278, 252, 853, 291, 854, 551, 292, - 260, 252, 314, 252, 552, 264, 264, 264, 264, 264, - 264, 293, 305, 855, 314, 294, 252, 856, 252, 178, - 296, 178, 366, 314, 305, 367, 857, 481, 252, 334, - 252, 300, 301, 305, 894, 368, 894, 314, 858, 301, - - 301, 301, 301, 301, 301, 567, 178, 305, 178, 418, - 335, 568, 419, 337, 441, 859, 178, 336, 860, 762, - 338, 894, 420, 894, 763, 314, 178, 301, 301, 301, - 301, 301, 301, 301, 301, 305, 861, 255, 862, 255, - 863, 301, 301, 301, 301, 301, 301, 235, 255, 776, - 255, 302, 864, 302, 777, 235, 865, 255, 235, 395, - 866, 867, 868, 869, 870, 394, 235, 235, 457, 301, - 301, 301, 301, 301, 301, 235, 871, 255, 302, 255, - 302, 306, 307, 872, 299, 873, 299, 235, 874, 307, - 307, 307, 307, 307, 307, 235, 255, 255, 255, 255, - - 397, 875, 876, 877, 878, 879, 235, 235, 880, 264, - 264, 299, 881, 299, 235, 235, 882, 307, 307, 307, - 307, 307, 307, 312, 312, 883, 264, 252, 252, 252, - 252, 312, 313, 312, 314, 312, 312, 884, 315, 885, - 402, 316, 317, 316, 252, 315, 252, 316, 886, 316, - 887, 888, 394, 315, 252, 252, 252, 252, 889, 312, - 314, 312, 314, 312, 312, 392, 315, 314, 316, 890, - 316, 252, 315, 252, 316, 891, 316, 305, 315, 237, - 237, 892, 264, 264, 443, 893, 264, 237, 237, 237, - 237, 237, 237, 404, 265, 314, 410, 252, 314, 252, - - 252, 252, 252, 252, 252, 305, 252, 843, 305, 842, - 841, 314, 444, 840, 839, 237, 237, 237, 237, 237, - 237, 305, 838, 837, 252, 836, 252, 252, 252, 252, - 252, 252, 835, 252, 392, 834, 833, 832, 402, 307, - 307, 459, 264, 831, 830, 829, 828, 307, 307, 307, - 307, 307, 307, 255, 460, 255, 827, 316, 826, 316, - 252, 825, 252, 235, 824, 823, 822, 512, 821, 512, - 820, 235, 819, 818, 817, 307, 307, 307, 307, 307, - 307, 255, 264, 255, 316, 816, 316, 252, 514, 252, - 815, 235, 814, 813, 440, 812, 811, 810, 514, 235, - - 252, 809, 252, 808, 807, 806, 805, 804, 803, 802, - 801, 800, 799, 798, 797, 796, 795, 794, 793, 792, - 791, 790, 789, 788, 787, 786, 785, 252, 784, 252, - 549, 549, 783, 782, 781, 780, 779, 778, 549, 549, - 549, 549, 549, 549, 775, 774, 773, 772, 771, 770, - 769, 768, 767, 766, 765, 764, 761, 760, 759, 758, - 757, 756, 755, 754, 753, 752, 549, 549, 549, 549, - 549, 549, 647, 647, 751, 647, 647, 647, 647, 750, - 647, 647, 647, 647, 647, 749, 647, 748, 747, 746, - 745, 744, 743, 647, 647, 647, 647, 647, 742, 741, - - 740, 739, 738, 737, 736, 735, 734, 733, 732, 731, - 730, 729, 728, 727, 726, 725, 724, 723, 722, 721, - 720, 719, 718, 717, 716, 715, 714, 713, 712, 711, - 710, 709, 708, 707, 706, 705, 704, 703, 702, 701, - 700, 699, 698, 697, 696, 695, 694, 647, 647, 647, - 658, 658, 693, 658, 658, 658, 658, 692, 658, 658, - 658, 658, 658, 691, 658, 690, 689, 688, 687, 686, - 685, 658, 658, 658, 658, 658, 684, 683, 682, 681, - 680, 679, 678, 677, 676, 675, 674, 673, 672, 671, - 670, 669, 668, 667, 666, 665, 664, 663, 662, 661, - - 660, 657, 656, 655, 654, 653, 652, 651, 650, 649, - 646, 645, 644, 643, 642, 641, 640, 639, 638, 637, - 636, 635, 634, 633, 632, 658, 658, 658, 647, 647, - 631, 647, 647, 647, 647, 630, 647, 647, 647, 647, - 647, 629, 647, 628, 627, 626, 625, 624, 623, 647, - 647, 647, 647, 647, 622, 621, 620, 619, 618, 617, - 616, 615, 614, 613, 612, 611, 610, 609, 608, 607, - 606, 605, 604, 603, 602, 601, 600, 599, 598, 597, - 596, 595, 594, 593, 592, 591, 590, 589, 588, 587, - 586, 585, 584, 583, 582, 581, 580, 579, 578, 577, - - 576, 575, 574, 647, 647, 647, 658, 658, 573, 658, - 658, 658, 658, 572, 658, 658, 658, 658, 658, 571, - 658, 570, 569, 566, 565, 564, 563, 658, 658, 658, - 658, 658, 562, 561, 560, 559, 558, 557, 556, 555, - 554, 553, 550, 548, 547, 546, 545, 544, 543, 542, - 541, 540, 539, 538, 537, 536, 535, 534, 533, 532, - 531, 530, 529, 528, 527, 526, 525, 524, 523, 522, - 521, 520, 519, 518, 517, 516, 515, 513, 511, 264, - 510, 658, 658, 658, 14, 14, 14, 14, 14, 14, - 176, 176, 176, 176, 176, 176, 178, 178, 178, 178, - - 235, 235, 235, 235, 299, 299, 303, 303, 303, 303, - 303, 303, 305, 509, 305, 305, 308, 508, 308, 308, - 308, 308, 311, 507, 311, 311, 311, 311, 393, 393, - 393, 393, 648, 506, 648, 648, 648, 648, 659, 505, - 659, 659, 659, 659, 647, 504, 647, 647, 647, 647, - 658, 503, 658, 658, 658, 658, 502, 501, 500, 499, - 498, 497, 496, 495, 494, 493, 492, 491, 490, 489, - 488, 487, 486, 485, 484, 483, 482, 480, 479, 478, - 477, 476, 475, 473, 472, 471, 470, 469, 468, 467, - 466, 465, 464, 463, 462, 461, 458, 456, 455, 454, - - 453, 452, 451, 450, 449, 448, 447, 446, 445, 442, - 305, 439, 304, 438, 437, 436, 435, 434, 433, 432, - 429, 428, 427, 426, 424, 423, 422, 421, 417, 416, - 415, 414, 413, 412, 411, 409, 406, 405, 403, 401, - 400, 399, 398, 396, 244, 244, 235, 391, 390, 389, - 387, 386, 385, 384, 383, 380, 379, 378, 377, 376, - 373, 372, 371, 370, 369, 365, 364, 363, 362, 361, - 360, 359, 357, 354, 353, 352, 349, 348, 178, 177, - 347, 344, 343, 342, 331, 328, 327, 326, 247, 244, - 310, 239, 238, 309, 304, 298, 297, 295, 290, 281, - - 280, 279, 262, 260, 259, 247, 244, 238, 183, 177, - 175, 232, 231, 230, 228, 222, 221, 211, 210, 209, - 192, 178, 185, 184, 183, 177, 175, 894, 13, 894, - 894, 894, 894, 894, 894, 894, 894, 894, 894, 894, - 894, 894, 894, 894, 894, 894, 894, 894, 894, 894, - 894, 894, 894, 894, 894, 894, 894, 894, 894, 894, - 894, 894, 894, 894, 894, 894, 894, 894, 894, 894, - 894, 894, 894, 894, 894, 894, 894, 894, 894, 894, - 894, 894, 894, 894, 894, 894, 894, 894, 894, 894, - 894, 894, 894, 894, 894, 894, 894, 894, 894, 894, - - 894, 894, 894, 894, 894, 894, 894, 894 - } ; - -static yyconst short int yy_chk[1709] = - { 0, - 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, - 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, - 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, - 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, - 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, - 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, - 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, - 3, 3, 3, 3, 3, 3, 3, 3, 3, 5, - 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, - 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, - - 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, - 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, - 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, - 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, - 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, - 5, 5, 5, 5, 5, 5, 5, 5, 7, 23, - 31, 36, 36, 38, 38, 42, 44, 168, 42, 7, - 7, 31, 168, 23, 351, 41, 49, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 49, 41, 7, 7, - 7, 7, 51, 7, 59, 7, 7, 50, 42, 833, - - 44, 50, 51, 82, 351, 7, 7, 7, 7, 7, - 7, 41, 59, 52, 82, 7, 52, 52, 7, 9, - 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, - 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, - 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, - 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, - 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, - 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, - 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, - 9, 9, 9, 9, 9, 9, 9, 9, 11, 11, - - 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, - 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, - 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, - 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, - 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, - 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, - 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, - 11, 11, 11, 11, 11, 11, 11, 21, 21, 43, - 64, 94, 74, 87, 87, 21, 21, 21, 21, 21, - 21, 94, 40, 43, 40, 45, 74, 102, 45, 117, - - 80, 45, 40, 89, 89, 834, 155, 118, 159, 117, - 40, 118, 155, 21, 21, 21, 21, 21, 21, 32, - 32, 55, 43, 159, 55, 55, 835, 32, 32, 32, - 32, 32, 32, 64, 45, 172, 55, 32, 40, 32, - 55, 80, 119, 92, 93, 92, 93, 93, 172, 195, - 102, 203, 119, 92, 93, 32, 32, 32, 32, 32, - 32, 92, 93, 99, 32, 99, 32, 106, 107, 106, - 107, 150, 150, 99, 32, 72, 72, 201, 195, 201, - 152, 99, 150, 72, 72, 72, 72, 72, 72, 109, - 152, 99, 836, 203, 106, 107, 106, 107, 120, 151, - - 151, 120, 120, 112, 106, 107, 151, 109, 109, 109, - 151, 72, 72, 72, 72, 72, 72, 83, 83, 196, - 109, 112, 108, 112, 112, 83, 83, 83, 83, 83, - 83, 108, 83, 108, 109, 83, 109, 83, 217, 83, - 108, 108, 108, 223, 217, 223, 286, 83, 112, 108, - 112, 312, 286, 83, 83, 83, 83, 83, 83, 125, - 83, 312, 83, 196, 83, 167, 83, 108, 153, 108, - 837, 838, 83, 91, 91, 167, 110, 125, 153, 125, - 153, 91, 91, 91, 91, 91, 91, 163, 91, 153, - 839, 91, 91, 91, 110, 91, 110, 163, 110, 229, - - 91, 110, 229, 91, 125, 167, 125, 111, 841, 91, - 91, 91, 91, 91, 91, 163, 91, 842, 91, 111, - 91, 110, 91, 110, 163, 111, 314, 111, 91, 105, - 105, 113, 271, 111, 271, 154, 314, 105, 105, 105, - 105, 105, 105, 124, 291, 154, 291, 113, 154, 113, - 113, 113, 111, 113, 111, 843, 122, 844, 442, 122, - 122, 124, 164, 124, 442, 105, 105, 105, 105, 105, - 105, 122, 164, 845, 166, 122, 113, 847, 113, 189, - 124, 189, 211, 165, 166, 211, 848, 358, 124, 164, - 124, 128, 128, 165, 246, 211, 246, 313, 849, 128, - - 128, 128, 128, 128, 128, 458, 189, 313, 189, 281, - 165, 458, 281, 166, 313, 850, 189, 165, 851, 727, - 166, 246, 281, 246, 727, 332, 358, 128, 128, 128, - 128, 128, 128, 133, 133, 332, 852, 248, 854, 248, - 855, 133, 133, 133, 133, 133, 133, 248, 249, 747, - 249, 133, 860, 133, 747, 248, 861, 250, 249, 250, - 862, 863, 864, 865, 866, 249, 249, 250, 332, 133, - 133, 133, 133, 133, 133, 250, 867, 255, 133, 255, - 133, 137, 137, 868, 438, 869, 438, 255, 870, 137, - 137, 137, 137, 137, 137, 255, 256, 261, 256, 261, - - 256, 871, 872, 873, 874, 875, 256, 261, 876, 264, - 263, 438, 877, 438, 256, 261, 878, 137, 137, 137, - 137, 137, 137, 149, 149, 879, 267, 264, 263, 264, - 263, 149, 149, 149, 149, 149, 149, 880, 149, 881, - 261, 149, 149, 149, 267, 149, 267, 549, 882, 549, - 883, 884, 267, 149, 264, 263, 264, 263, 885, 149, - 149, 149, 149, 149, 149, 263, 149, 318, 149, 887, - 149, 267, 149, 267, 549, 889, 549, 318, 149, 236, - 236, 890, 268, 273, 318, 891, 296, 236, 236, 236, - 236, 236, 236, 268, 899, 319, 273, 236, 334, 236, - - 268, 273, 268, 273, 296, 319, 296, 831, 334, 829, - 828, 335, 319, 827, 826, 236, 236, 236, 236, 236, - 236, 335, 825, 824, 236, 823, 236, 268, 273, 268, - 273, 296, 822, 296, 236, 820, 819, 818, 296, 306, - 306, 334, 404, 816, 815, 814, 813, 306, 306, 306, - 306, 306, 306, 395, 335, 395, 812, 306, 811, 306, - 404, 810, 404, 395, 809, 808, 806, 404, 805, 395, - 804, 395, 803, 802, 801, 306, 306, 306, 306, 306, - 306, 397, 410, 397, 306, 800, 306, 404, 397, 404, - 799, 397, 798, 797, 306, 796, 795, 794, 410, 397, - - 410, 793, 410, 792, 791, 790, 789, 788, 787, 786, - 778, 777, 776, 775, 774, 773, 772, 770, 768, 766, - 764, 763, 762, 761, 760, 759, 757, 410, 756, 410, - 440, 440, 755, 754, 753, 752, 750, 749, 440, 440, - 440, 440, 440, 440, 744, 743, 742, 741, 740, 739, - 736, 735, 734, 732, 731, 730, 724, 722, 721, 720, - 719, 715, 714, 713, 709, 708, 440, 440, 440, 440, - 440, 440, 558, 558, 705, 558, 558, 558, 558, 704, - 558, 558, 558, 558, 558, 703, 558, 702, 701, 699, - 696, 695, 694, 558, 558, 558, 558, 558, 693, 692, - - 691, 690, 689, 687, 686, 685, 684, 681, 680, 679, - 678, 677, 676, 675, 672, 669, 668, 667, 666, 665, - 664, 663, 661, 657, 656, 655, 653, 652, 650, 646, - 645, 644, 642, 641, 640, 639, 637, 636, 635, 634, - 633, 632, 631, 630, 628, 626, 622, 558, 558, 558, - 574, 574, 621, 574, 574, 574, 574, 619, 574, 574, - 574, 574, 574, 618, 574, 617, 616, 615, 614, 612, - 611, 574, 574, 574, 574, 574, 610, 609, 608, 607, - 606, 604, 603, 602, 601, 600, 599, 598, 597, 596, - 595, 593, 591, 587, 586, 585, 582, 581, 580, 578, - - 577, 573, 572, 568, 567, 566, 565, 564, 562, 561, - 557, 556, 552, 551, 550, 548, 547, 546, 545, 544, - 543, 541, 540, 539, 538, 574, 574, 574, 648, 648, - 537, 648, 648, 648, 648, 535, 648, 648, 648, 648, - 648, 534, 648, 532, 531, 530, 529, 527, 526, 648, - 648, 648, 648, 648, 525, 523, 521, 520, 519, 518, - 517, 516, 514, 513, 511, 510, 509, 508, 507, 506, - 505, 504, 503, 502, 500, 499, 498, 497, 496, 495, - 493, 491, 490, 488, 487, 486, 485, 483, 482, 481, - 480, 478, 476, 475, 473, 472, 471, 470, 469, 468, - - 467, 466, 465, 648, 648, 648, 659, 659, 464, 659, - 659, 659, 659, 463, 659, 659, 659, 659, 659, 461, - 659, 460, 459, 457, 456, 455, 454, 659, 659, 659, - 659, 659, 453, 452, 451, 450, 449, 448, 447, 445, - 444, 443, 441, 435, 434, 433, 432, 431, 430, 429, - 428, 427, 426, 425, 424, 422, 421, 420, 419, 418, - 416, 415, 414, 413, 412, 411, 409, 408, 407, 406, - 405, 403, 402, 401, 400, 399, 398, 396, 394, 392, - 391, 659, 659, 659, 895, 895, 895, 895, 895, 895, - 896, 896, 896, 896, 896, 896, 897, 897, 897, 897, - - 898, 898, 898, 898, 900, 900, 901, 901, 901, 901, - 901, 901, 902, 388, 902, 902, 903, 387, 903, 903, - 903, 903, 904, 386, 904, 904, 904, 904, 905, 905, - 905, 905, 906, 385, 906, 906, 906, 906, 907, 384, - 907, 907, 907, 907, 908, 383, 908, 908, 908, 908, - 909, 382, 909, 909, 909, 909, 381, 380, 379, 378, - 377, 376, 375, 374, 373, 372, 370, 369, 368, 367, - 366, 364, 363, 362, 361, 360, 359, 357, 356, 355, - 354, 353, 352, 350, 347, 346, 345, 344, 343, 342, - 341, 340, 339, 338, 337, 336, 333, 331, 330, 329, - - 328, 327, 326, 325, 324, 323, 322, 321, 320, 317, - 307, 304, 303, 300, 298, 297, 295, 294, 293, 292, - 290, 289, 288, 287, 285, 284, 283, 282, 280, 279, - 278, 277, 276, 275, 274, 272, 270, 269, 262, 260, - 259, 258, 257, 253, 243, 242, 237, 232, 231, 230, - 228, 227, 226, 225, 224, 222, 221, 220, 219, 218, - 216, 215, 214, 213, 212, 210, 209, 208, 207, 206, - 205, 204, 202, 200, 199, 197, 194, 190, 180, 176, - 173, 171, 170, 169, 160, 158, 157, 156, 148, 145, - 143, 141, 139, 138, 136, 127, 126, 123, 121, 116, - - 115, 114, 100, 96, 95, 88, 84, 78, 77, 71, - 70, 62, 61, 60, 56, 54, 53, 48, 47, 46, - 37, 33, 29, 27, 26, 20, 19, 13, 894, 894, - 894, 894, 894, 894, 894, 894, 894, 894, 894, 894, - 894, 894, 894, 894, 894, 894, 894, 894, 894, 894, - 894, 894, 894, 894, 894, 894, 894, 894, 894, 894, - 894, 894, 894, 894, 894, 894, 894, 894, 894, 894, - 894, 894, 894, 894, 894, 894, 894, 894, 894, 894, - 894, 894, 894, 894, 894, 894, 894, 894, 894, 894, - 894, 894, 894, 894, 894, 894, 894, 894, 894, 894, - - 894, 894, 894, 894, 894, 894, 894, 894 - } ; - -static yy_state_type yy_last_accepting_state; -static char *yy_last_accepting_cpos; - -/* The intent behind this definition is that it'll catch - * any uses of REJECT which flex missed. - */ -#define REJECT reject_used_but_not_detected -#define yymore() yymore_used_but_not_detected -#define YY_MORE_ADJ 0 -char *yytext; -#line 1 "./ldlex.l" -#define INITIAL 0 -#line 2 "./ldlex.l" - -/* Copyright (C) 1991, 1992, 1993, 1994 Free Software Foundation, Inc. - -This file is part of GLD, the Gnu Linker. - -GLD is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2, or (at your option) -any later version. - -GLD is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with GLD; see the file COPYING. If not, write to -the Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ - -/* -This was written by steve chamberlain - sac@cygnus.com -*/ - - -#include <ansidecl.h> -#include <stdio.h> -#include <ctype.h> - -#ifdef MPW -/* Prevent enum redefinition problems. */ -#define TRUE_FALSE_ALREADY_DEFINED -#endif /* MPW */ - -#include "bfd.h" -#include "sysdep.h" -#include "ld.h" -#include "ldgram.h" -#include "ldmisc.h" -#include "ldexp.h" -#include "ldlang.h" -#include "ldfile.h" -#include "ldlex.h" -#include "ldmain.h" - -/* The type of top-level parser input. - yylex and yyparse (indirectly) both check this. */ -input_type parser_input; - -/* Radix to use for bfd_scan_vma -- 0 (default to base 10) or 16. */ -int hex_mode; - -/* Line number in the current input file. - (FIXME Actually, it doesn't appear to get reset for each file?) */ -unsigned int lineno = 1; - -/* The string we are currently lexing, or NULL if we are reading a - file. */ -const char *lex_string = NULL; - -/* Support for flex reading from more than one input file (stream). - `include_stack' is flex's input state for each open file; - `file_name_stack' is the file names. `lineno_stack' is the current - line numbers. - - If `include_stack_ptr' is 0, we haven't started reading anything yet. - Otherwise, stack elements 0 through `include_stack_ptr - 1' are valid. */ - -#undef YY_INPUT -#define YY_INPUT(buf,result,max_size) yy_input(buf, &result, max_size) - -#define MAX_INCLUDE_DEPTH 10 -static YY_BUFFER_STATE include_stack[MAX_INCLUDE_DEPTH]; -static const char *file_name_stack[MAX_INCLUDE_DEPTH]; -static unsigned int lineno_stack[MAX_INCLUDE_DEPTH]; -static unsigned int include_stack_ptr = 0; - -static YY_BUFFER_STATE yy_create_string_buffer PARAMS ((const char *string, - size_t size)); -static void yy_input PARAMS ((char *, int *result, int max_size)); - -static void comment PARAMS ((void)); -static void lex_warn_invalid PARAMS ((char *where, char *what)); - -/* STATES - EXPRESSION definitely in an expression - SCRIPT definitely in a script - BOTH either EXPRESSION or SCRIPT - DEFSYMEXP in an argument to -defsym - MRI in an MRI script -*/ -#define RTOKEN(x) { yylval.token = x; return x; } - -/* Some versions of flex want this. */ -#ifndef yywrap -int yywrap () { return 1; } -#endif -#define SCRIPT 1 - -#define EXPRESSION 2 - -#define BOTH 3 - -#define DEFSYMEXP 4 - -#define MRI 5 - -#line 1146 "lex.yy.c" - -/* Macros after this point can all be overridden by user definitions in - * section 1. - */ - -#ifndef YY_SKIP_YYWRAP -#ifdef __cplusplus -extern "C" int yywrap YY_PROTO(( void )); -#else -extern int yywrap YY_PROTO(( void )); -#endif -#endif - -#ifndef YY_NO_UNPUT -static void yyunput YY_PROTO(( int c, char *buf_ptr )); -#endif - -#ifndef yytext_ptr -static void yy_flex_strncpy YY_PROTO(( char *, yyconst char *, int )); -#endif - -#ifndef YY_NO_INPUT -#ifdef __cplusplus -static int yyinput YY_PROTO(( void )); -#else -static int input YY_PROTO(( void )); -#endif -#endif - -#if YY_STACK_USED -static int yy_start_stack_ptr = 0; -static int yy_start_stack_depth = 0; -static int *yy_start_stack = 0; -#ifndef YY_NO_PUSH_STATE -static void yy_push_state YY_PROTO(( int new_state )); -#endif -#ifndef YY_NO_POP_STATE -static void yy_pop_state YY_PROTO(( void )); -#endif -#ifndef YY_NO_TOP_STATE -static int yy_top_state YY_PROTO(( void )); -#endif - -#else -#define YY_NO_PUSH_STATE 1 -#define YY_NO_POP_STATE 1 -#define YY_NO_TOP_STATE 1 -#endif - -#ifdef YY_MALLOC_DECL -YY_MALLOC_DECL -#else -#if __STDC__ -#ifndef __cplusplus -#include <stdlib.h> -#endif -#else -/* Just try to get by without declaring the routines. This will fail - * miserably on non-ANSI systems for which sizeof(size_t) != sizeof(int) - * or sizeof(void*) != sizeof(int). - */ -#endif -#endif - -/* Amount of stuff to slurp up with each read. */ -#ifndef YY_READ_BUF_SIZE -#define YY_READ_BUF_SIZE 8192 -#endif - -/* Copy whatever the last rule matched to the standard output. */ - -#ifndef ECHO -/* This used to be an fputs(), but since the string might contain NUL's, - * we now use fwrite(). - */ -#define ECHO (void) fwrite( yytext, yyleng, 1, yyout ) -#endif - -/* Gets input and stuffs it into "buf". number of characters read, or YY_NULL, - * is returned in "result". - */ -#ifndef YY_INPUT -#define YY_INPUT(buf,result,max_size) \ - if ( yy_current_buffer->yy_is_interactive ) \ - { \ - int c = '*', n; \ - for ( n = 0; n < max_size && \ - (c = getc( yyin )) != EOF && c != '\n'; ++n ) \ - buf[n] = (char) c; \ - if ( c == '\n' ) \ - buf[n++] = (char) c; \ - if ( c == EOF && ferror( yyin ) ) \ - YY_FATAL_ERROR( "input in flex scanner failed" ); \ - result = n; \ - } \ - else if ( ((result = fread( buf, 1, max_size, yyin )) == 0) \ - && ferror( yyin ) ) \ - YY_FATAL_ERROR( "input in flex scanner failed" ); -#endif - -/* No semi-colon after return; correct usage is to write "yyterminate();" - - * we don't want an extra ';' after the "return" because that will cause - * some compilers to complain about unreachable statements. - */ -#ifndef yyterminate -#define yyterminate() return YY_NULL -#endif - -/* Number of entries by which start-condition stack grows. */ -#ifndef YY_START_STACK_INCR -#define YY_START_STACK_INCR 25 -#endif - -/* Report a fatal error. */ -#ifndef YY_FATAL_ERROR -#define YY_FATAL_ERROR(msg) yy_fatal_error( msg ) -#endif - -/* Default declaration of generated scanner - a define so the user can - * easily add parameters. - */ -#ifndef YY_DECL -#define YY_DECL int yylex YY_PROTO(( void )) -#endif - -/* Code executed at the beginning of each rule, after yytext and yyleng - * have been set up. - */ -#ifndef YY_USER_ACTION -#define YY_USER_ACTION -#endif - -/* Code executed at the end of each rule. */ -#ifndef YY_BREAK -#define YY_BREAK break; -#endif - -#define YY_RULE_SETUP \ - YY_USER_ACTION - -YY_DECL - { - register yy_state_type yy_current_state; - register char *yy_cp, *yy_bp; - register int yy_act; - -#line 120 "./ldlex.l" - - - if (parser_input != input_selected) - { - /* The first token of the input determines the initial parser state. */ - input_type t = parser_input; - parser_input = input_selected; - switch (t) - { - case input_script: return INPUT_SCRIPT; break; - case input_mri_script: return INPUT_MRI_SCRIPT; break; - case input_defsym: return INPUT_DEFSYM; break; - default: abort (); - } - } - -#line 1310 "lex.yy.c" - - if ( yy_init ) - { - yy_init = 0; - -#ifdef YY_USER_INIT - YY_USER_INIT; -#endif - - if ( ! yy_start ) - yy_start = 1; /* first start state */ - - if ( ! yyin ) - yyin = stdin; - - if ( ! yyout ) - yyout = stdout; - - if ( ! yy_current_buffer ) - yy_current_buffer = - yy_create_buffer( yyin, YY_BUF_SIZE ); - - yy_load_buffer_state(); - } - - while ( 1 ) /* loops until end-of-file is reached */ - { - yy_cp = yy_c_buf_p; - - /* Support of yytext. */ - *yy_cp = yy_hold_char; - - /* yy_bp points to the position in yy_ch_buf of the start of - * the current run. - */ - yy_bp = yy_cp; - - yy_current_state = yy_start; -yy_match: - do - { - register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)]; - if ( yy_accept[yy_current_state] ) - { - yy_last_accepting_state = yy_current_state; - yy_last_accepting_cpos = yy_cp; - } - while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) - { - yy_current_state = (int) yy_def[yy_current_state]; - if ( yy_current_state >= 895 ) - yy_c = yy_meta[(unsigned int) yy_c]; - } - yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; - ++yy_cp; - } - while ( yy_base[yy_current_state] != 1629 ); - -yy_find_action: - yy_act = yy_accept[yy_current_state]; - if ( yy_act == 0 ) - { /* have to back up */ - yy_cp = yy_last_accepting_cpos; - yy_current_state = yy_last_accepting_state; - yy_act = yy_accept[yy_current_state]; - } - - YY_DO_BEFORE_ACTION; - - -do_action: /* This label is used only to access EOF actions. */ - - - switch ( yy_act ) - { /* beginning of action switch */ - case 0: /* must back up */ - /* undo the effects of YY_DO_BEFORE_ACTION */ - *yy_cp = yy_hold_char; - yy_cp = yy_last_accepting_cpos; - yy_current_state = yy_last_accepting_state; - goto yy_find_action; - -case 1: -YY_RULE_SETUP -#line 136 "./ldlex.l" -{ comment(); } - YY_BREAK -case 2: -YY_RULE_SETUP -#line 139 "./ldlex.l" -{ RTOKEN('-');} - YY_BREAK -case 3: -YY_RULE_SETUP -#line 140 "./ldlex.l" -{ RTOKEN('+');} - YY_BREAK -case 4: -YY_RULE_SETUP -#line 141 "./ldlex.l" -{ yylval.name = buystring(yytext); return NAME; } - YY_BREAK -case 5: -YY_RULE_SETUP -#line 142 "./ldlex.l" -{ RTOKEN('='); } - YY_BREAK -case 6: -YY_RULE_SETUP -#line 144 "./ldlex.l" -{ - yylval.integer = bfd_scan_vma (yytext+1, 0,16); - return INT; - } - YY_BREAK -case 7: -YY_RULE_SETUP -#line 149 "./ldlex.l" -{ - int ibase ; - switch (yytext[yyleng-1]) { - case 'X': - case 'x': - case 'H': - case 'h': - ibase = 16; - break; - case 'O': - case 'o': - ibase = 8; - break; - case 'B': - case 'b': - ibase = 2; - break; - default: - ibase = 10; - } - yylval.integer = bfd_scan_vma (yytext, 0, - ibase); - return INT; - } - YY_BREAK -case 8: -YY_RULE_SETUP -#line 173 "./ldlex.l" -{ - yylval.integer = bfd_scan_vma (yytext, 0, - hex_mode); - if (yytext[yyleng-1]=='M' - || yytext[yyleng-1] == 'm') { - yylval.integer *= 1024*1024; - } - if (yytext[yyleng-1]=='K' - || yytext[yyleng-1]=='k') { - yylval.integer *= 1024; - } - return INT; - } - YY_BREAK -case 9: -YY_RULE_SETUP -#line 186 "./ldlex.l" -{ RTOKEN(']');} - YY_BREAK -case 10: -YY_RULE_SETUP -#line 187 "./ldlex.l" -{ RTOKEN('[');} - YY_BREAK -case 11: -YY_RULE_SETUP -#line 188 "./ldlex.l" -{ RTOKEN(LSHIFTEQ);} - YY_BREAK -case 12: -YY_RULE_SETUP -#line 189 "./ldlex.l" -{ RTOKEN(RSHIFTEQ);} - YY_BREAK -case 13: -YY_RULE_SETUP -#line 190 "./ldlex.l" -{ RTOKEN(OROR);} - YY_BREAK -case 14: -YY_RULE_SETUP -#line 191 "./ldlex.l" -{ RTOKEN(EQ);} - YY_BREAK -case 15: -YY_RULE_SETUP -#line 192 "./ldlex.l" -{ RTOKEN(NE);} - YY_BREAK -case 16: -YY_RULE_SETUP -#line 193 "./ldlex.l" -{ RTOKEN(GE);} - YY_BREAK -case 17: -YY_RULE_SETUP -#line 194 "./ldlex.l" -{ RTOKEN(LE);} - YY_BREAK -case 18: -YY_RULE_SETUP -#line 195 "./ldlex.l" -{ RTOKEN(LSHIFT);} - YY_BREAK -case 19: -YY_RULE_SETUP -#line 196 "./ldlex.l" -{ RTOKEN(RSHIFT);} - YY_BREAK -case 20: -YY_RULE_SETUP -#line 197 "./ldlex.l" -{ RTOKEN(PLUSEQ);} - YY_BREAK -case 21: -YY_RULE_SETUP -#line 198 "./ldlex.l" -{ RTOKEN(MINUSEQ);} - YY_BREAK -case 22: -YY_RULE_SETUP -#line 199 "./ldlex.l" -{ RTOKEN(MULTEQ);} - YY_BREAK -case 23: -YY_RULE_SETUP -#line 200 "./ldlex.l" -{ RTOKEN(DIVEQ);} - YY_BREAK -case 24: -YY_RULE_SETUP -#line 201 "./ldlex.l" -{ RTOKEN(ANDEQ);} - YY_BREAK -case 25: -YY_RULE_SETUP -#line 202 "./ldlex.l" -{ RTOKEN(OREQ);} - YY_BREAK -case 26: -YY_RULE_SETUP -#line 203 "./ldlex.l" -{ RTOKEN(ANDAND);} - YY_BREAK -case 27: -YY_RULE_SETUP -#line 204 "./ldlex.l" -{ RTOKEN('>');} - YY_BREAK -case 28: -YY_RULE_SETUP -#line 205 "./ldlex.l" -{ RTOKEN(',');} - YY_BREAK -case 29: -YY_RULE_SETUP -#line 206 "./ldlex.l" -{ RTOKEN('&');} - YY_BREAK -case 30: -YY_RULE_SETUP -#line 207 "./ldlex.l" -{ RTOKEN('|');} - YY_BREAK -case 31: -YY_RULE_SETUP -#line 208 "./ldlex.l" -{ RTOKEN('~');} - YY_BREAK -case 32: -YY_RULE_SETUP -#line 209 "./ldlex.l" -{ RTOKEN('!');} - YY_BREAK -case 33: -YY_RULE_SETUP -#line 210 "./ldlex.l" -{ RTOKEN('?');} - YY_BREAK -case 34: -YY_RULE_SETUP -#line 211 "./ldlex.l" -{ RTOKEN('*');} - YY_BREAK -case 35: -YY_RULE_SETUP -#line 212 "./ldlex.l" -{ RTOKEN('+');} - YY_BREAK -case 36: -YY_RULE_SETUP -#line 213 "./ldlex.l" -{ RTOKEN('-');} - YY_BREAK -case 37: -YY_RULE_SETUP -#line 214 "./ldlex.l" -{ RTOKEN('/');} - YY_BREAK -case 38: -YY_RULE_SETUP -#line 215 "./ldlex.l" -{ RTOKEN('%');} - YY_BREAK -case 39: -YY_RULE_SETUP -#line 216 "./ldlex.l" -{ RTOKEN('<');} - YY_BREAK -case 40: -YY_RULE_SETUP -#line 217 "./ldlex.l" -{ RTOKEN('=');} - YY_BREAK -case 41: -YY_RULE_SETUP -#line 218 "./ldlex.l" -{ RTOKEN('}') ; } - YY_BREAK -case 42: -YY_RULE_SETUP -#line 219 "./ldlex.l" -{ RTOKEN('{'); } - YY_BREAK -case 43: -YY_RULE_SETUP -#line 220 "./ldlex.l" -{ RTOKEN(')');} - YY_BREAK -case 44: -YY_RULE_SETUP -#line 221 "./ldlex.l" -{ RTOKEN('(');} - YY_BREAK -case 45: -YY_RULE_SETUP -#line 222 "./ldlex.l" -{ RTOKEN(':'); } - YY_BREAK -case 46: -YY_RULE_SETUP -#line 223 "./ldlex.l" -{ RTOKEN(';');} - YY_BREAK -case 47: -YY_RULE_SETUP -#line 224 "./ldlex.l" -{ RTOKEN(MEMORY);} - YY_BREAK -case 48: -YY_RULE_SETUP -#line 225 "./ldlex.l" -{ RTOKEN(ORIGIN);} - YY_BREAK -case 49: -YY_RULE_SETUP -#line 226 "./ldlex.l" -{ RTOKEN(BLOCK);} - YY_BREAK -case 50: -YY_RULE_SETUP -#line 227 "./ldlex.l" -{ RTOKEN(LENGTH);} - YY_BREAK -case 51: -YY_RULE_SETUP -#line 228 "./ldlex.l" -{ RTOKEN(ALIGN_K);} - YY_BREAK -case 52: -YY_RULE_SETUP -#line 229 "./ldlex.l" -{ RTOKEN(ADDR);} - YY_BREAK -case 53: -YY_RULE_SETUP -#line 230 "./ldlex.l" -{ RTOKEN(ENTRY);} - YY_BREAK -case 54: -YY_RULE_SETUP -#line 231 "./ldlex.l" -{ RTOKEN(NEXT);} - YY_BREAK -case 55: -YY_RULE_SETUP -#line 232 "./ldlex.l" -{ RTOKEN(SIZEOF_HEADERS);} - YY_BREAK -case 56: -YY_RULE_SETUP -#line 233 "./ldlex.l" -{ RTOKEN(SIZEOF_HEADERS);} - YY_BREAK -case 57: -YY_RULE_SETUP -#line 234 "./ldlex.l" -{ RTOKEN(MAP);} - YY_BREAK -case 58: -YY_RULE_SETUP -#line 235 "./ldlex.l" -{ RTOKEN(SIZEOF);} - YY_BREAK -case 59: -YY_RULE_SETUP -#line 236 "./ldlex.l" -{ RTOKEN(TARGET_K);} - YY_BREAK -case 60: -YY_RULE_SETUP -#line 237 "./ldlex.l" -{ RTOKEN(SEARCH_DIR);} - YY_BREAK -case 61: -YY_RULE_SETUP -#line 238 "./ldlex.l" -{ RTOKEN(OUTPUT);} - YY_BREAK -case 62: -YY_RULE_SETUP -#line 239 "./ldlex.l" -{ RTOKEN(INPUT);} - YY_BREAK -case 63: -YY_RULE_SETUP -#line 240 "./ldlex.l" -{ RTOKEN(GROUP);} - YY_BREAK -case 64: -YY_RULE_SETUP -#line 241 "./ldlex.l" -{ RTOKEN(DEFINED);} - YY_BREAK -case 65: -YY_RULE_SETUP -#line 242 "./ldlex.l" -{ RTOKEN(CREATE_OBJECT_SYMBOLS);} - YY_BREAK -case 66: -YY_RULE_SETUP -#line 243 "./ldlex.l" -{ RTOKEN( CONSTRUCTORS);} - YY_BREAK -case 67: -YY_RULE_SETUP -#line 244 "./ldlex.l" -{ RTOKEN(FORCE_COMMON_ALLOCATION);} - YY_BREAK -case 68: -YY_RULE_SETUP -#line 245 "./ldlex.l" -{ RTOKEN(SECTIONS);} - YY_BREAK -case 69: -YY_RULE_SETUP -#line 246 "./ldlex.l" -{ RTOKEN(FILL);} - YY_BREAK -case 70: -YY_RULE_SETUP -#line 247 "./ldlex.l" -{ RTOKEN(STARTUP);} - YY_BREAK -case 71: -YY_RULE_SETUP -#line 248 "./ldlex.l" -{ RTOKEN(OUTPUT_FORMAT);} - YY_BREAK -case 72: -YY_RULE_SETUP -#line 249 "./ldlex.l" -{ RTOKEN( OUTPUT_ARCH);} - YY_BREAK -case 73: -YY_RULE_SETUP -#line 250 "./ldlex.l" -{ RTOKEN(HLL);} - YY_BREAK -case 74: -YY_RULE_SETUP -#line 251 "./ldlex.l" -{ RTOKEN(SYSLIB);} - YY_BREAK -case 75: -YY_RULE_SETUP -#line 252 "./ldlex.l" -{ RTOKEN(FLOAT);} - YY_BREAK -case 76: -YY_RULE_SETUP -#line 253 "./ldlex.l" -{ RTOKEN( QUAD);} - YY_BREAK -case 77: -YY_RULE_SETUP -#line 254 "./ldlex.l" -{ RTOKEN( LONG);} - YY_BREAK -case 78: -YY_RULE_SETUP -#line 255 "./ldlex.l" -{ RTOKEN( SHORT);} - YY_BREAK -case 79: -YY_RULE_SETUP -#line 256 "./ldlex.l" -{ RTOKEN( BYTE);} - YY_BREAK -case 80: -YY_RULE_SETUP -#line 257 "./ldlex.l" -{ RTOKEN(NOFLOAT);} - YY_BREAK -case 81: -YY_RULE_SETUP -#line 258 "./ldlex.l" -{ RTOKEN(NOLOAD);} - YY_BREAK -case 82: -YY_RULE_SETUP -#line 259 "./ldlex.l" -{ RTOKEN(DSECT);} - YY_BREAK -case 83: -YY_RULE_SETUP -#line 260 "./ldlex.l" -{ RTOKEN(COPY);} - YY_BREAK -case 84: -YY_RULE_SETUP -#line 261 "./ldlex.l" -{ RTOKEN(INFO);} - YY_BREAK -case 85: -YY_RULE_SETUP -#line 262 "./ldlex.l" -{ RTOKEN(OVERLAY);} - YY_BREAK -case 86: -YY_RULE_SETUP -#line 263 "./ldlex.l" -{ RTOKEN(ORIGIN);} - YY_BREAK -case 87: -YY_RULE_SETUP -#line 264 "./ldlex.l" -{ RTOKEN(ORIGIN);} - YY_BREAK -case 88: -YY_RULE_SETUP -#line 265 "./ldlex.l" -{ RTOKEN( LENGTH);} - YY_BREAK -case 89: -YY_RULE_SETUP -#line 266 "./ldlex.l" -{ RTOKEN( LENGTH);} - YY_BREAK -case 90: -YY_RULE_SETUP -#line 267 "./ldlex.l" -{ RTOKEN(INCLUDE);} - YY_BREAK -case 91: -YY_RULE_SETUP -#line 268 "./ldlex.l" -{ RTOKEN(AT);} - YY_BREAK -case 92: -YY_RULE_SETUP -#line 269 "./ldlex.l" -{ RTOKEN(PROVIDE); } - YY_BREAK -case 93: -YY_RULE_SETUP -#line 270 "./ldlex.l" -{ ++ lineno; } - YY_BREAK -case 94: -YY_RULE_SETUP -#line 271 "./ldlex.l" -{ ++ lineno; RTOKEN(NEWLINE); } - YY_BREAK -case 95: -YY_RULE_SETUP -#line 272 "./ldlex.l" -{ ++ lineno; RTOKEN(NEWLINE); } - YY_BREAK -case 96: -YY_RULE_SETUP -#line 273 "./ldlex.l" -{ /* Mri comment line */ } - YY_BREAK -case 97: -YY_RULE_SETUP -#line 274 "./ldlex.l" -{ /* Mri comment line */ } - YY_BREAK -case 98: -YY_RULE_SETUP -#line 275 "./ldlex.l" -{ RTOKEN(ENDWORD); } - YY_BREAK -case 99: -YY_RULE_SETUP -#line 276 "./ldlex.l" -{ RTOKEN(ALIGNMOD);} - YY_BREAK -case 100: -YY_RULE_SETUP -#line 277 "./ldlex.l" -{ RTOKEN(ALIGN_K);} - YY_BREAK -case 101: -YY_RULE_SETUP -#line 278 "./ldlex.l" -{ RTOKEN(CHIP); } - YY_BREAK -case 102: -YY_RULE_SETUP -#line 279 "./ldlex.l" -{ RTOKEN(BASE); } - YY_BREAK -case 103: -YY_RULE_SETUP -#line 280 "./ldlex.l" -{ RTOKEN(ALIAS); } - YY_BREAK -case 104: -YY_RULE_SETUP -#line 281 "./ldlex.l" -{ RTOKEN(TRUNCATE); } - YY_BREAK -case 105: -YY_RULE_SETUP -#line 282 "./ldlex.l" -{ RTOKEN(LOAD); } - YY_BREAK -case 106: -YY_RULE_SETUP -#line 283 "./ldlex.l" -{ RTOKEN(PUBLIC); } - YY_BREAK -case 107: -YY_RULE_SETUP -#line 284 "./ldlex.l" -{ RTOKEN(ORDER); } - YY_BREAK -case 108: -YY_RULE_SETUP -#line 285 "./ldlex.l" -{ RTOKEN(NAMEWORD); } - YY_BREAK -case 109: -YY_RULE_SETUP -#line 286 "./ldlex.l" -{ RTOKEN(FORMAT); } - YY_BREAK -case 110: -YY_RULE_SETUP -#line 287 "./ldlex.l" -{ RTOKEN(CASE); } - YY_BREAK -case 111: -YY_RULE_SETUP -#line 288 "./ldlex.l" -{ RTOKEN(EXTERN); } - YY_BREAK -case 112: -YY_RULE_SETUP -#line 289 "./ldlex.l" -{ RTOKEN(START); } - YY_BREAK -case 113: -YY_RULE_SETUP -#line 290 "./ldlex.l" -{ RTOKEN(LIST); /* LIST and ignore to end of line */ } - YY_BREAK -case 114: -YY_RULE_SETUP -#line 291 "./ldlex.l" -{ RTOKEN(SECT); } - YY_BREAK -case 115: -YY_RULE_SETUP -#line 292 "./ldlex.l" -{ RTOKEN(ABSOLUTE); } - YY_BREAK -case 116: -YY_RULE_SETUP -#line 293 "./ldlex.l" -{ RTOKEN(ENDWORD); } - YY_BREAK -case 117: -YY_RULE_SETUP -#line 294 "./ldlex.l" -{ RTOKEN(ALIGNMOD);} - YY_BREAK -case 118: -YY_RULE_SETUP -#line 295 "./ldlex.l" -{ RTOKEN(ALIGN_K);} - YY_BREAK -case 119: -YY_RULE_SETUP -#line 296 "./ldlex.l" -{ RTOKEN(CHIP); } - YY_BREAK -case 120: -YY_RULE_SETUP -#line 297 "./ldlex.l" -{ RTOKEN(BASE); } - YY_BREAK -case 121: -YY_RULE_SETUP -#line 298 "./ldlex.l" -{ RTOKEN(ALIAS); } - YY_BREAK -case 122: -YY_RULE_SETUP -#line 299 "./ldlex.l" -{ RTOKEN(TRUNCATE); } - YY_BREAK -case 123: -YY_RULE_SETUP -#line 300 "./ldlex.l" -{ RTOKEN(LOAD); } - YY_BREAK -case 124: -YY_RULE_SETUP -#line 301 "./ldlex.l" -{ RTOKEN(PUBLIC); } - YY_BREAK -case 125: -YY_RULE_SETUP -#line 302 "./ldlex.l" -{ RTOKEN(ORDER); } - YY_BREAK -case 126: -YY_RULE_SETUP -#line 303 "./ldlex.l" -{ RTOKEN(NAMEWORD); } - YY_BREAK -case 127: -YY_RULE_SETUP -#line 304 "./ldlex.l" -{ RTOKEN(FORMAT); } - YY_BREAK -case 128: -YY_RULE_SETUP -#line 305 "./ldlex.l" -{ RTOKEN(CASE); } - YY_BREAK -case 129: -YY_RULE_SETUP -#line 306 "./ldlex.l" -{ RTOKEN(EXTERN); } - YY_BREAK -case 130: -YY_RULE_SETUP -#line 307 "./ldlex.l" -{ RTOKEN(START); } - YY_BREAK -case 131: -YY_RULE_SETUP -#line 308 "./ldlex.l" -{ RTOKEN(LIST); /* LIST and ignore to end of line */ } - YY_BREAK -case 132: -YY_RULE_SETUP -#line 309 "./ldlex.l" -{ RTOKEN(SECT); } - YY_BREAK -case 133: -YY_RULE_SETUP -#line 310 "./ldlex.l" -{ RTOKEN(ABSOLUTE); } - YY_BREAK -case 134: -YY_RULE_SETUP -#line 312 "./ldlex.l" -{ -/* Filename without commas, needed to parse mri stuff */ - yylval.name = buystring(yytext); - return NAME; - } - YY_BREAK -case 135: -YY_RULE_SETUP -#line 319 "./ldlex.l" -{ - yylval.name = buystring(yytext); - return NAME; - } - YY_BREAK -case 136: -YY_RULE_SETUP -#line 323 "./ldlex.l" -{ - yylval.name = buystring (yytext + 2); - return LNAME; - } - YY_BREAK -case 137: -YY_RULE_SETUP -#line 327 "./ldlex.l" -{ yylval.name = buystring(yytext); - return NAME; - } - YY_BREAK -case 138: -YY_RULE_SETUP -#line 331 "./ldlex.l" -{ - /* No matter the state, quotes - give what's inside */ - yylval.name = buystring(yytext+1); - yylval.name[yyleng-2] = 0; - return NAME; - } - YY_BREAK -case 139: -YY_RULE_SETUP -#line 338 "./ldlex.l" -{ lineno++;} - YY_BREAK -case 140: -YY_RULE_SETUP -#line 339 "./ldlex.l" -{ lineno++;} - YY_BREAK -case 141: -YY_RULE_SETUP -#line 340 "./ldlex.l" - - YY_BREAK -case YY_STATE_EOF(INITIAL): -case YY_STATE_EOF(SCRIPT): -case YY_STATE_EOF(EXPRESSION): -case YY_STATE_EOF(BOTH): -case YY_STATE_EOF(DEFSYMEXP): -case YY_STATE_EOF(MRI): -#line 342 "./ldlex.l" -{ - include_stack_ptr--; - - if (include_stack_ptr == 0) - { - yyterminate(); - } - else - { - yy_switch_to_buffer(include_stack[include_stack_ptr]); - - } - BEGIN(SCRIPT); - ldfile_input_filename = file_name_stack[include_stack_ptr - 1]; - lineno = lineno_stack[include_stack_ptr - 1]; - - return END; -} - YY_BREAK -case 142: -YY_RULE_SETUP -#line 361 "./ldlex.l" -lex_warn_invalid(" in script", yytext); - YY_BREAK -case 143: -YY_RULE_SETUP -#line 362 "./ldlex.l" -lex_warn_invalid(" in expression", yytext); - YY_BREAK -case 144: -YY_RULE_SETUP -#line 364 "./ldlex.l" -ECHO; - YY_BREAK -#line 2195 "lex.yy.c" - - case YY_END_OF_BUFFER: - { - /* Amount of text matched not including the EOB char. */ - int yy_amount_of_matched_text = (int) (yy_cp - yytext_ptr) - 1; - - /* Undo the effects of YY_DO_BEFORE_ACTION. */ - *yy_cp = yy_hold_char; - - if ( yy_current_buffer->yy_buffer_status == YY_BUFFER_NEW ) - { - /* We're scanning a new file or input source. It's - * possible that this happened because the user - * just pointed yyin at a new source and called - * yylex(). If so, then we have to assure - * consistency between yy_current_buffer and our - * globals. Here is the right place to do so, because - * this is the first action (other than possibly a - * back-up) that will match for the new input source. - */ - yy_n_chars = yy_current_buffer->yy_n_chars; - yy_current_buffer->yy_input_file = yyin; - yy_current_buffer->yy_buffer_status = YY_BUFFER_NORMAL; - } - - /* Note that here we test for yy_c_buf_p "<=" to the position - * of the first EOB in the buffer, since yy_c_buf_p will - * already have been incremented past the NUL character - * (since all states make transitions on EOB to the - * end-of-buffer state). Contrast this with the test - * in input(). - */ - if ( yy_c_buf_p <= &yy_current_buffer->yy_ch_buf[yy_n_chars] ) - { /* This was really a NUL. */ - yy_state_type yy_next_state; - - yy_c_buf_p = yytext_ptr + yy_amount_of_matched_text; - - yy_current_state = yy_get_previous_state(); - - /* Okay, we're now positioned to make the NUL - * transition. We couldn't have - * yy_get_previous_state() go ahead and do it - * for us because it doesn't know how to deal - * with the possibility of jamming (and we don't - * want to build jamming into it because then it - * will run more slowly). - */ - - yy_next_state = yy_try_NUL_trans( yy_current_state ); - - yy_bp = yytext_ptr + YY_MORE_ADJ; - - if ( yy_next_state ) - { - /* Consume the NUL. */ - yy_cp = ++yy_c_buf_p; - yy_current_state = yy_next_state; - goto yy_match; - } - - else - { - yy_cp = yy_c_buf_p; - goto yy_find_action; - } - } - - else switch ( yy_get_next_buffer() ) - { - case EOB_ACT_END_OF_FILE: - { - yy_did_buffer_switch_on_eof = 0; - - if ( yywrap() ) - { - /* Note: because we've taken care in - * yy_get_next_buffer() to have set up - * yytext, we can now set up - * yy_c_buf_p so that if some total - * hoser (like flex itself) wants to - * call the scanner after we return the - * YY_NULL, it'll still work - another - * YY_NULL will get returned. - */ - yy_c_buf_p = yytext_ptr + YY_MORE_ADJ; - - yy_act = YY_STATE_EOF(YY_START); - goto do_action; - } - - else - { - if ( ! yy_did_buffer_switch_on_eof ) - YY_NEW_FILE; - } - break; - } - - case EOB_ACT_CONTINUE_SCAN: - yy_c_buf_p = - yytext_ptr + yy_amount_of_matched_text; - - yy_current_state = yy_get_previous_state(); - - yy_cp = yy_c_buf_p; - yy_bp = yytext_ptr + YY_MORE_ADJ; - goto yy_match; - - case EOB_ACT_LAST_MATCH: - yy_c_buf_p = - &yy_current_buffer->yy_ch_buf[yy_n_chars]; - - yy_current_state = yy_get_previous_state(); - - yy_cp = yy_c_buf_p; - yy_bp = yytext_ptr + YY_MORE_ADJ; - goto yy_find_action; - } - break; - } - - default: - YY_FATAL_ERROR( - "fatal flex scanner internal error--no action found" ); - } /* end of action switch */ - } /* end of scanning one token */ - } /* end of yylex */ - - -/* yy_get_next_buffer - try to read in a new buffer - * - * Returns a code representing an action: - * EOB_ACT_LAST_MATCH - - * EOB_ACT_CONTINUE_SCAN - continue scanning from current position - * EOB_ACT_END_OF_FILE - end of file - */ - -static int yy_get_next_buffer() - { - register char *dest = yy_current_buffer->yy_ch_buf; - register char *source = yytext_ptr; - register int number_to_move, i; - int ret_val; - - if ( yy_c_buf_p > &yy_current_buffer->yy_ch_buf[yy_n_chars + 1] ) - YY_FATAL_ERROR( - "fatal flex scanner internal error--end of buffer missed" ); - - if ( yy_current_buffer->yy_fill_buffer == 0 ) - { /* Don't try to fill the buffer, so this is an EOF. */ - if ( yy_c_buf_p - yytext_ptr - YY_MORE_ADJ == 1 ) - { - /* We matched a singled characater, the EOB, so - * treat this as a final EOF. - */ - return EOB_ACT_END_OF_FILE; - } - - else - { - /* We matched some text prior to the EOB, first - * process it. - */ - return EOB_ACT_LAST_MATCH; - } - } - - /* Try to read more data. */ - - /* First move last chars to start of buffer. */ - number_to_move = (int) (yy_c_buf_p - yytext_ptr) - 1; - - for ( i = 0; i < number_to_move; ++i ) - *(dest++) = *(source++); - - if ( yy_current_buffer->yy_buffer_status == YY_BUFFER_EOF_PENDING ) - /* don't do the read, it's not guaranteed to return an EOF, - * just force an EOF - */ - yy_n_chars = 0; - - else - { - int num_to_read = - yy_current_buffer->yy_buf_size - number_to_move - 1; - - while ( num_to_read <= 0 ) - { /* Not enough room in the buffer - grow it. */ -#ifdef YY_USES_REJECT - YY_FATAL_ERROR( -"input buffer overflow, can't enlarge buffer because scanner uses REJECT" ); -#else - - /* just a shorter name for the current buffer */ - YY_BUFFER_STATE b = yy_current_buffer; - - int yy_c_buf_p_offset = - (int) (yy_c_buf_p - b->yy_ch_buf); - - if ( b->yy_is_our_buffer ) - { - int new_size = b->yy_buf_size * 2; - - if ( new_size <= 0 ) - b->yy_buf_size += b->yy_buf_size / 8; - else - b->yy_buf_size *= 2; - - b->yy_ch_buf = (char *) - /* Include room in for 2 EOB chars. */ - yy_flex_realloc( (void *) b->yy_ch_buf, - b->yy_buf_size + 2 ); - } - else - /* Can't grow it, we don't own it. */ - b->yy_ch_buf = 0; - - if ( ! b->yy_ch_buf ) - YY_FATAL_ERROR( - "fatal error - scanner input buffer overflow" ); - - yy_c_buf_p = &b->yy_ch_buf[yy_c_buf_p_offset]; - - num_to_read = yy_current_buffer->yy_buf_size - - number_to_move - 1; -#endif - } - - if ( num_to_read > YY_READ_BUF_SIZE ) - num_to_read = YY_READ_BUF_SIZE; - - /* Read in more data. */ - YY_INPUT( (&yy_current_buffer->yy_ch_buf[number_to_move]), - yy_n_chars, num_to_read ); - } - - if ( yy_n_chars == 0 ) - { - if ( number_to_move == YY_MORE_ADJ ) - { - ret_val = EOB_ACT_END_OF_FILE; - yyrestart( yyin ); - } - - else - { - ret_val = EOB_ACT_LAST_MATCH; - yy_current_buffer->yy_buffer_status = - YY_BUFFER_EOF_PENDING; - } - } - - else - ret_val = EOB_ACT_CONTINUE_SCAN; - - yy_n_chars += number_to_move; - yy_current_buffer->yy_ch_buf[yy_n_chars] = YY_END_OF_BUFFER_CHAR; - yy_current_buffer->yy_ch_buf[yy_n_chars + 1] = YY_END_OF_BUFFER_CHAR; - - yytext_ptr = &yy_current_buffer->yy_ch_buf[0]; - - return ret_val; - } - - -/* yy_get_previous_state - get the state just before the EOB char was reached */ - -static yy_state_type yy_get_previous_state() - { - register yy_state_type yy_current_state; - register char *yy_cp; - - yy_current_state = yy_start; - - for ( yy_cp = yytext_ptr + YY_MORE_ADJ; yy_cp < yy_c_buf_p; ++yy_cp ) - { - register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1); - if ( yy_accept[yy_current_state] ) - { - yy_last_accepting_state = yy_current_state; - yy_last_accepting_cpos = yy_cp; - } - while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) - { - yy_current_state = (int) yy_def[yy_current_state]; - if ( yy_current_state >= 895 ) - yy_c = yy_meta[(unsigned int) yy_c]; - } - yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; - } - - return yy_current_state; - } - - -/* yy_try_NUL_trans - try to make a transition on the NUL character - * - * synopsis - * next_state = yy_try_NUL_trans( current_state ); - */ - -#ifdef YY_USE_PROTOS -static yy_state_type yy_try_NUL_trans( yy_state_type yy_current_state ) -#else -static yy_state_type yy_try_NUL_trans( yy_current_state ) -yy_state_type yy_current_state; -#endif - { - register int yy_is_jam; - register char *yy_cp = yy_c_buf_p; - - register YY_CHAR yy_c = 1; - if ( yy_accept[yy_current_state] ) - { - yy_last_accepting_state = yy_current_state; - yy_last_accepting_cpos = yy_cp; - } - while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) - { - yy_current_state = (int) yy_def[yy_current_state]; - if ( yy_current_state >= 895 ) - yy_c = yy_meta[(unsigned int) yy_c]; - } - yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; - yy_is_jam = (yy_current_state == 894); - - return yy_is_jam ? 0 : yy_current_state; - } - - -#ifndef YY_NO_UNPUT -#ifdef YY_USE_PROTOS -static void yyunput( int c, register char *yy_bp ) -#else -static void yyunput( c, yy_bp ) -int c; -register char *yy_bp; -#endif - { - register char *yy_cp = yy_c_buf_p; - - /* undo effects of setting up yytext */ - *yy_cp = yy_hold_char; - - if ( yy_cp < yy_current_buffer->yy_ch_buf + 2 ) - { /* need to shift things up to make room */ - /* +2 for EOB chars. */ - register int number_to_move = yy_n_chars + 2; - register char *dest = &yy_current_buffer->yy_ch_buf[ - yy_current_buffer->yy_buf_size + 2]; - register char *source = - &yy_current_buffer->yy_ch_buf[number_to_move]; - - while ( source > yy_current_buffer->yy_ch_buf ) - *--dest = *--source; - - yy_cp += (int) (dest - source); - yy_bp += (int) (dest - source); - yy_n_chars = yy_current_buffer->yy_buf_size; - - if ( yy_cp < yy_current_buffer->yy_ch_buf + 2 ) - YY_FATAL_ERROR( "flex scanner push-back overflow" ); - } - - *--yy_cp = (char) c; - - - yytext_ptr = yy_bp; - yy_hold_char = *yy_cp; - yy_c_buf_p = yy_cp; - } -#endif /* ifndef YY_NO_UNPUT */ - - -#ifdef __cplusplus -static int yyinput() -#else -static int input() -#endif - { - int c; - - *yy_c_buf_p = yy_hold_char; - - if ( *yy_c_buf_p == YY_END_OF_BUFFER_CHAR ) - { - /* yy_c_buf_p now points to the character we want to return. - * If this occurs *before* the EOB characters, then it's a - * valid NUL; if not, then we've hit the end of the buffer. - */ - if ( yy_c_buf_p < &yy_current_buffer->yy_ch_buf[yy_n_chars] ) - /* This was really a NUL. */ - *yy_c_buf_p = '\0'; - - else - { /* need more input */ - yytext_ptr = yy_c_buf_p; - ++yy_c_buf_p; - - switch ( yy_get_next_buffer() ) - { - case EOB_ACT_END_OF_FILE: - { - if ( yywrap() ) - { - yy_c_buf_p = - yytext_ptr + YY_MORE_ADJ; - return EOF; - } - - if ( ! yy_did_buffer_switch_on_eof ) - YY_NEW_FILE; -#ifdef __cplusplus - return yyinput(); -#else - return input(); -#endif - } - - case EOB_ACT_CONTINUE_SCAN: - yy_c_buf_p = yytext_ptr + YY_MORE_ADJ; - break; - - case EOB_ACT_LAST_MATCH: -#ifdef __cplusplus - YY_FATAL_ERROR( - "unexpected last match in yyinput()" ); -#else - YY_FATAL_ERROR( - "unexpected last match in input()" ); -#endif - } - } - } - - c = *(unsigned char *) yy_c_buf_p; /* cast for 8-bit char's */ - *yy_c_buf_p = '\0'; /* preserve yytext */ - yy_hold_char = *++yy_c_buf_p; - - - return c; - } - - -#ifdef YY_USE_PROTOS -void yyrestart( FILE *input_file ) -#else -void yyrestart( input_file ) -FILE *input_file; -#endif - { - if ( ! yy_current_buffer ) - yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE ); - - yy_init_buffer( yy_current_buffer, input_file ); - yy_load_buffer_state(); - } - - -#ifdef YY_USE_PROTOS -void yy_switch_to_buffer( YY_BUFFER_STATE new_buffer ) -#else -void yy_switch_to_buffer( new_buffer ) -YY_BUFFER_STATE new_buffer; -#endif - { - if ( yy_current_buffer == new_buffer ) - return; - - if ( yy_current_buffer ) - { - /* Flush out information for old buffer. */ - *yy_c_buf_p = yy_hold_char; - yy_current_buffer->yy_buf_pos = yy_c_buf_p; - yy_current_buffer->yy_n_chars = yy_n_chars; - } - - yy_current_buffer = new_buffer; - yy_load_buffer_state(); - - /* We don't actually know whether we did this switch during - * EOF (yywrap()) processing, but the only time this flag - * is looked at is after yywrap() is called, so it's safe - * to go ahead and always set it. - */ - yy_did_buffer_switch_on_eof = 1; - } - - -#ifdef YY_USE_PROTOS -void yy_load_buffer_state( void ) -#else -void yy_load_buffer_state() -#endif - { - yy_n_chars = yy_current_buffer->yy_n_chars; - yytext_ptr = yy_c_buf_p = yy_current_buffer->yy_buf_pos; - yyin = yy_current_buffer->yy_input_file; - yy_hold_char = *yy_c_buf_p; - } - - -#ifdef YY_USE_PROTOS -YY_BUFFER_STATE yy_create_buffer( FILE *file, int size ) -#else -YY_BUFFER_STATE yy_create_buffer( file, size ) -FILE *file; -int size; -#endif - { - YY_BUFFER_STATE b; - - b = (YY_BUFFER_STATE) yy_flex_alloc( sizeof( struct yy_buffer_state ) ); - if ( ! b ) - YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" ); - - b->yy_buf_size = size; - - /* yy_ch_buf has to be 2 characters longer than the size given because - * we need to put in 2 end-of-buffer characters. - */ - b->yy_ch_buf = (char *) yy_flex_alloc( b->yy_buf_size + 2 ); - if ( ! b->yy_ch_buf ) - YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" ); - - b->yy_is_our_buffer = 1; - - yy_init_buffer( b, file ); - - return b; - } - - -#ifdef YY_USE_PROTOS -void yy_delete_buffer( YY_BUFFER_STATE b ) -#else -void yy_delete_buffer( b ) -YY_BUFFER_STATE b; -#endif - { - if ( ! b ) - return; - - if ( b == yy_current_buffer ) - yy_current_buffer = (YY_BUFFER_STATE) 0; - - if ( b->yy_is_our_buffer ) - yy_flex_free( (void *) b->yy_ch_buf ); - - yy_flex_free( (void *) b ); - } - - -#ifndef YY_ALWAYS_INTERACTIVE -#ifndef YY_NEVER_INTERACTIVE -extern int isatty YY_PROTO(( int )); -#endif -#endif - -#ifdef YY_USE_PROTOS -void yy_init_buffer( YY_BUFFER_STATE b, FILE *file ) -#else -void yy_init_buffer( b, file ) -YY_BUFFER_STATE b; -FILE *file; -#endif - - - { - yy_flush_buffer( b ); - - b->yy_input_file = file; - b->yy_fill_buffer = 1; - -#if YY_ALWAYS_INTERACTIVE - b->yy_is_interactive = 1; -#else -#if YY_NEVER_INTERACTIVE - b->yy_is_interactive = 0; -#else - b->yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0; -#endif -#endif - } - - -#ifdef YY_USE_PROTOS -void yy_flush_buffer( YY_BUFFER_STATE b ) -#else -void yy_flush_buffer( b ) -YY_BUFFER_STATE b; -#endif - - { - b->yy_n_chars = 0; - - /* We always need two end-of-buffer characters. The first causes - * a transition to the end-of-buffer state. The second causes - * a jam in that state. - */ - b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR; - b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR; - - b->yy_buf_pos = &b->yy_ch_buf[0]; - - b->yy_at_bol = 1; - b->yy_buffer_status = YY_BUFFER_NEW; - - if ( b == yy_current_buffer ) - yy_load_buffer_state(); - } - - -#ifndef YY_NO_SCAN_BUFFER -#ifdef YY_USE_PROTOS -YY_BUFFER_STATE yy_scan_buffer( char *base, yy_size_t size ) -#else -YY_BUFFER_STATE yy_scan_buffer( base, size ) -char *base; -yy_size_t size; -#endif - { - YY_BUFFER_STATE b; - - if ( size < 2 || - base[size-2] != YY_END_OF_BUFFER_CHAR || - base[size-1] != YY_END_OF_BUFFER_CHAR ) - /* They forgot to leave room for the EOB's. */ - return 0; - - b = (YY_BUFFER_STATE) yy_flex_alloc( sizeof( struct yy_buffer_state ) ); - if ( ! b ) - YY_FATAL_ERROR( "out of dynamic memory in yy_scan_buffer()" ); - - b->yy_buf_size = size - 2; /* "- 2" to take care of EOB's */ - b->yy_buf_pos = b->yy_ch_buf = base; - b->yy_is_our_buffer = 0; - b->yy_input_file = 0; - b->yy_n_chars = b->yy_buf_size; - b->yy_is_interactive = 0; - b->yy_at_bol = 1; - b->yy_fill_buffer = 0; - b->yy_buffer_status = YY_BUFFER_NEW; - - yy_switch_to_buffer( b ); - - return b; - } -#endif - - -#ifndef YY_NO_SCAN_STRING -#ifdef YY_USE_PROTOS -YY_BUFFER_STATE yy_scan_string( yyconst char *str ) -#else -YY_BUFFER_STATE yy_scan_string( str ) -yyconst char *str; -#endif - { - int len; - for ( len = 0; str[len]; ++len ) - ; - - return yy_scan_bytes( str, len ); - } -#endif - - -#ifndef YY_NO_SCAN_BYTES -#ifdef YY_USE_PROTOS -YY_BUFFER_STATE yy_scan_bytes( yyconst char *bytes, int len ) -#else -YY_BUFFER_STATE yy_scan_bytes( bytes, len ) -yyconst char *bytes; -int len; -#endif - { - YY_BUFFER_STATE b; - char *buf; - yy_size_t n; - int i; - - /* Get memory for full buffer, including space for trailing EOB's. */ - n = len + 2; - buf = (char *) yy_flex_alloc( n ); - if ( ! buf ) - YY_FATAL_ERROR( "out of dynamic memory in yy_scan_bytes()" ); - - for ( i = 0; i < len; ++i ) - buf[i] = bytes[i]; - - buf[len] = buf[len+1] = YY_END_OF_BUFFER_CHAR; - - b = yy_scan_buffer( buf, n ); - if ( ! b ) - YY_FATAL_ERROR( "bad buffer in yy_scan_bytes()" ); - - /* It's okay to grow etc. this buffer, and we should throw it - * away when we're done. - */ - b->yy_is_our_buffer = 1; - - return b; - } -#endif - - -#ifndef YY_NO_PUSH_STATE -#ifdef YY_USE_PROTOS -static void yy_push_state( int new_state ) -#else -static void yy_push_state( new_state ) -int new_state; -#endif - { - if ( yy_start_stack_ptr >= yy_start_stack_depth ) - { - yy_size_t new_size; - - yy_start_stack_depth += YY_START_STACK_INCR; - new_size = yy_start_stack_depth * sizeof( int ); - - if ( ! yy_start_stack ) - yy_start_stack = (int *) yy_flex_alloc( new_size ); - - else - yy_start_stack = (int *) yy_flex_realloc( - (void *) yy_start_stack, new_size ); - - if ( ! yy_start_stack ) - YY_FATAL_ERROR( - "out of memory expanding start-condition stack" ); - } - - yy_start_stack[yy_start_stack_ptr++] = YY_START; - - BEGIN(new_state); - } -#endif - - -#ifndef YY_NO_POP_STATE -static void yy_pop_state() - { - if ( --yy_start_stack_ptr < 0 ) - YY_FATAL_ERROR( "start-condition stack underflow" ); - - BEGIN(yy_start_stack[yy_start_stack_ptr]); - } -#endif - - -#ifndef YY_NO_TOP_STATE -static int yy_top_state() - { - return yy_start_stack[yy_start_stack_ptr - 1]; - } -#endif - -#ifndef YY_EXIT_FAILURE -#define YY_EXIT_FAILURE 2 -#endif - -#ifdef YY_USE_PROTOS -static void yy_fatal_error( yyconst char msg[] ) -#else -static void yy_fatal_error( msg ) -char msg[]; -#endif - { - (void) fprintf( stderr, "%s\n", msg ); - exit( YY_EXIT_FAILURE ); - } - - - -/* Redefine yyless() so it works in section 3 code. */ - -#undef yyless -#define yyless(n) \ - do \ - { \ - /* Undo effects of setting up yytext. */ \ - yytext[yyleng] = yy_hold_char; \ - yy_c_buf_p = yytext + n - YY_MORE_ADJ; \ - yy_hold_char = *yy_c_buf_p; \ - *yy_c_buf_p = '\0'; \ - yyleng = n; \ - } \ - while ( 0 ) - - -/* Internal utility routines. */ - -#ifndef yytext_ptr -#ifdef YY_USE_PROTOS -static void yy_flex_strncpy( char *s1, yyconst char *s2, int n ) -#else -static void yy_flex_strncpy( s1, s2, n ) -char *s1; -yyconst char *s2; -int n; -#endif - { - register int i; - for ( i = 0; i < n; ++i ) - s1[i] = s2[i]; - } -#endif - - -#ifdef YY_USE_PROTOS -static void *yy_flex_alloc( yy_size_t size ) -#else -static void *yy_flex_alloc( size ) -yy_size_t size; -#endif - { - return (void *) xmalloc( size ); - } - -#ifdef YY_USE_PROTOS -static void *yy_flex_realloc( void *ptr, yy_size_t size ) -#else -static void *yy_flex_realloc( ptr, size ) -void *ptr; -yy_size_t size; -#endif - { - /* The cast to (char *) in the following accommodates both - * implementations that use char* generic pointers, and those - * that use void* generic pointers. It works with the latter - * because both ANSI C and C++ allow castless assignment from - * any pointer type to void*, and deal with argument conversions - * as though doing an assignment. - */ - return (void *) realloc( (char *) ptr, size ); - } - -#ifdef YY_USE_PROTOS -static void yy_flex_free( void *ptr ) -#else -static void yy_flex_free( ptr ) -void *ptr; -#endif - { - free( ptr ); - } - -#if YY_MAIN -int main() - { - yylex(); - return 0; - } -#endif -#line 364 "./ldlex.l" - - - -/* Switch flex to reading script file NAME, open on FILE, - saving the current input info on the include stack. */ - -void -lex_push_file (file, name) - FILE *file; - const char *name; -{ - if (include_stack_ptr >= MAX_INCLUDE_DEPTH) - { - einfo("%F:includes nested too deeply\n"); - } - file_name_stack[include_stack_ptr] = name; - lineno_stack[include_stack_ptr] = 1; - include_stack[include_stack_ptr] = YY_CURRENT_BUFFER; - - include_stack_ptr++; - yyin = file; - yy_switch_to_buffer(yy_create_buffer(yyin, YY_BUF_SIZE)); - BEGIN (SCRIPT); -} - -/* Return a newly created flex input buffer containing STRING, - which is SIZE bytes long. */ - -static YY_BUFFER_STATE -yy_create_string_buffer (string, size) - CONST char *string; - size_t size; -{ - YY_BUFFER_STATE b; - - /* Calls to m-alloc get turned by sed into xm-alloc. */ - b = (YY_BUFFER_STATE) xmalloc (sizeof (struct yy_buffer_state)); - b->yy_input_file = 0; - b->yy_buf_size = size; - - /* yy_ch_buf has to be 2 characters longer than the size given because - we need to put in 2 end-of-buffer characters. */ - b->yy_ch_buf = (char *) xmalloc ((unsigned) (b->yy_buf_size + 3)); - - b->yy_ch_buf[0] = '\n'; - strcpy (b->yy_ch_buf+1, string); - b->yy_ch_buf[size+1] = YY_END_OF_BUFFER_CHAR; - b->yy_ch_buf[size+2] = YY_END_OF_BUFFER_CHAR; - b->yy_n_chars = size+1; - b->yy_buf_pos = &b->yy_ch_buf[1]; - - /* flex 2.4.7 changed the interface. FIXME: We should not be using - a flex internal interface in the first place! */ -#ifdef YY_BUFFER_NEW - b->yy_buffer_status = YY_BUFFER_NEW; -#else - b->yy_eof_status = EOF_NOT_SEEN; -#endif - - return b; -} - -/* Switch flex to reading from STRING, saving the current input info - on the include stack. */ - -void -lex_redirect (string) - CONST char *string; -{ - YY_BUFFER_STATE tmp; - - yy_init = 0; - if (include_stack_ptr >= MAX_INCLUDE_DEPTH) - { - einfo("%F: macros nested too deeply\n"); - } - file_name_stack[include_stack_ptr] = "redirect"; - lineno_stack[include_stack_ptr] = 0; - include_stack[include_stack_ptr] = YY_CURRENT_BUFFER; - include_stack_ptr++; - tmp = yy_create_string_buffer (string, strlen (string)); - yy_switch_to_buffer (tmp); - BEGIN (SCRIPT); -} - -/* Functions to switch to a different flex start condition, - saving the current start condition on `state_stack'. */ - -static int state_stack[MAX_INCLUDE_DEPTH * 2]; -static int *state_stack_p = state_stack; - -void -ldlex_script () -{ - *(state_stack_p)++ = yy_start; - BEGIN (SCRIPT); -} - -void -ldlex_mri_script () -{ - *(state_stack_p)++ = yy_start; - BEGIN (MRI); -} - -void -ldlex_defsym () -{ - *(state_stack_p)++ = yy_start; - BEGIN (DEFSYMEXP); -} - -void -ldlex_expression () -{ - *(state_stack_p)++ = yy_start; - BEGIN (EXPRESSION); -} - -void -ldlex_both () -{ - *(state_stack_p)++ = yy_start; - BEGIN (BOTH); -} - -void -ldlex_popstate () -{ - yy_start = *(--state_stack_p); -} - - -/* Place up to MAX_SIZE characters in BUF and return in *RESULT - either the number of characters read, or 0 to indicate EOF. */ - -static void -yy_input (buf, result, max_size) - char *buf; - int *result; - int max_size; -{ - *result = 0; - if (yy_current_buffer->yy_input_file) - { - if (yyin) - { - *result = read (fileno (yyin), (char *) buf, max_size); - if (*result < 0) - einfo ("%F%P: read in flex scanner failed"); - } - } -} - -/* Eat the rest of a C-style comment. */ - -static void -comment () -{ - int c; - - while (1) - { - c = input(); - while (c != '*' && c != EOF) - { - if (c == '\n' || c == '\r') - lineno++; - c = input(); - } - - if (c == '*') - { - c = input(); - while (c == '*') - c = input(); - if (c == '/') - break; /* found the end */ - } - - if (c == '\n' || c == '\r') - lineno++; - - if (c == EOF) - { - einfo( "%F%P: EOF in comment\n"); - break; - } - } -} - -/* Warn the user about a garbage character WHAT in the input - in context WHERE. */ - -static void -lex_warn_invalid (where, what) - char *where, *what; -{ - char buf[5]; - - /* If we have found an input file whose format we do not recognize, - and we are therefore treating it as a linker script, and we find - an invalid character, then most likely this is a real object file - of some different format. Treat it as such. */ - if (ldfile_assumed_script) - { - bfd_set_error (bfd_error_file_not_recognized); - einfo ("%F%s: file not recognized: %E\n", ldfile_input_filename); - } - - if (! isprint ((unsigned char) *what)) - { - sprintf (buf, "\\%03o", (unsigned int) *what); - what = buf; - } - - einfo ("%P:%S: ignoring invalid character `%s'%s\n", what, where); -} diff --git a/gnu/usr.bin/binutils/ld/ldlex.l b/gnu/usr.bin/binutils/ld/ldlex.l index c1107c04853..5eb1dcedbb9 100644 --- a/gnu/usr.bin/binutils/ld/ldlex.l +++ b/gnu/usr.bin/binutils/ld/ldlex.l @@ -265,6 +265,7 @@ NOCFILENAMECHAR [_a-zA-Z0-9\/\.\-\_\+\$\:\[\]\\\~] <BOTH,SCRIPT>"l" { RTOKEN( LENGTH);} <BOTH,SCRIPT>"len" { RTOKEN( LENGTH);} <BOTH,SCRIPT>"INCLUDE" { RTOKEN(INCLUDE);} +<BOTH,SCRIPT>"PHDRS" { RTOKEN (PHDRS); } <EXPRESSION,BOTH,SCRIPT>"AT" { RTOKEN(AT);} <EXPRESSION,BOTH,SCRIPT>"PROVIDE" { RTOKEN(PROVIDE); } <MRI>"#".*\n?\r? { ++ lineno; } diff --git a/gnu/usr.bin/binutils/ld/ldmain.c b/gnu/usr.bin/binutils/ld/ldmain.c index 0ae8d4f009a..673879fe42a 100644 --- a/gnu/usr.bin/binutils/ld/ldmain.c +++ b/gnu/usr.bin/binutils/ld/ldmain.c @@ -115,8 +115,8 @@ static boolean reloc_dangerous PARAMS ((struct bfd_link_info *, const char *, static boolean unattached_reloc PARAMS ((struct bfd_link_info *, const char *, bfd *, asection *, bfd_vma)); -static boolean notice_ysym PARAMS ((struct bfd_link_info *, const char *, - bfd *, asection *, bfd_vma)); +static boolean notice PARAMS ((struct bfd_link_info *, const char *, + bfd *, asection *, bfd_vma)); static struct bfd_link_callbacks link_callbacks = { @@ -130,7 +130,7 @@ static struct bfd_link_callbacks link_callbacks = reloc_overflow, reloc_dangerous, unattached_reloc, - notice_ysym + notice }; struct bfd_link_info link_info; @@ -162,12 +162,13 @@ main (argc, argv) bfd_init (); + bfd_set_error_program_name (program_name); + xatexit (remove_output); /* Initialize the data about options. */ trace_files = trace_file_tries = version_printed = false; whole_archive = false; - config.traditional_format = false; config.build_constructors = true; config.dynamic_link = false; command_line.force_common_definition = false; @@ -179,6 +180,7 @@ main (argc, argv) link_info.shared = false; link_info.symbolic = false; link_info.static_link = false; + link_info.traditional_format = false; link_info.strip = strip_none; link_info.discard = discard_none; link_info.lprefix_len = 1; @@ -188,8 +190,9 @@ main (argc, argv) link_info.create_object_symbols_section = NULL; link_info.hash = NULL; link_info.keep_hash = NULL; + link_info.notice_all = false; link_info.notice_hash = NULL; - + link_info.wrap_hash = NULL; ldfile_add_arch (""); @@ -316,6 +319,11 @@ main (argc, argv) ldwrite (); + if (config.map_file != NULL) + lang_map (); + if (link_info.notice_all) + output_cref (config.map_file != NULL ? config.map_file : stdout); + /* Even if we're producing relocateable output, some non-fatal errors should be reported in the exit status. (What non-fatal errors, if any, do we want to ignore for relocateable output?) */ @@ -328,16 +336,57 @@ main (argc, argv) output_filename); } - if (output_bfd->iostream) - fclose ((FILE *) (output_bfd->iostream)); + /* The file will be removed by remove_output. */ - unlink (output_filename); xexit (1); } else { if (! bfd_close (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. */ + + if (! link_info.relocateable && command_line.force_exe_suffix) + { + int len = strlen (output_filename); + if (len < 4 + || (strcasecmp (output_filename + len - 4, ".exe") != 0 + && strcasecmp (output_filename + len - 4, ".dll") != 0)) + { + FILE *src; + FILE *dst; + const int bsize = 4096; + char *buf = xmalloc (bsize); + int l; + char *dst_name = xmalloc (len + 5); + strcpy (dst_name, output_filename); + strcat (dst_name, ".exe"); + src = fopen (output_filename, FOPEN_RB); + dst = fopen (dst_name, FOPEN_WB); + + if (!src) + 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); + 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); + } + } + fclose (src); + if (!fclose (dst)) + { + einfo ("%P: Error closing file `%s'\n", dst_name); + } + free (dst_name); + free (buf); + } + } } END_PROGRESS (program_name); @@ -515,6 +564,25 @@ add_ysym (name) einfo ("%P%F: bfd_hash_lookup failed: %E\n"); } +/* Record a symbol to be wrapped, from the --wrap option. */ + +void +add_wrap (name) + const char *name; +{ + if (link_info.wrap_hash == NULL) + { + link_info.wrap_hash = ((struct bfd_hash_table *) + xmalloc (sizeof (struct bfd_hash_table))); + if (! bfd_hash_table_init_n (link_info.wrap_hash, + bfd_hash_newfunc, + 61)) + 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"); +} + /* Handle the -retain-symbols-file option. */ void @@ -616,7 +684,82 @@ add_archive_element (info, abfd, name) ldlang_add_file (input); if (config.map_file != (FILE *) NULL) - minfo ("%s needed due to %T\n", abfd->filename, name); + { + static boolean header_printed; + struct bfd_link_hash_entry *h; + bfd *from; + int len; + + h = bfd_link_hash_lookup (link_info.hash, name, false, false, true); + + if (h == NULL) + from = NULL; + else + { + switch (h->type) + { + default: + from = NULL; + break; + + case bfd_link_hash_defined: + case bfd_link_hash_defweak: + from = h->u.def.section->owner; + break; + + case bfd_link_hash_undefined: + case bfd_link_hash_undefweak: + from = h->u.undef.abfd; + break; + + case bfd_link_hash_common: + from = h->u.c.p->section->owner; + break; + } + } + + if (! header_printed) + { + char buf[100]; + + sprintf (buf, "%-29s %s\n\n", "Archive member included", + "because of file (symbol)"); + minfo ("%s", buf); + header_printed = true; + } + + if (bfd_my_archive (abfd) == NULL) + { + minfo ("%s", bfd_get_filename (abfd)); + len = strlen (bfd_get_filename (abfd)); + } + else + { + minfo ("%s(%s)", bfd_get_filename (bfd_my_archive (abfd)), + bfd_get_filename (abfd)); + len = (strlen (bfd_get_filename (bfd_my_archive (abfd))) + + strlen (bfd_get_filename (abfd)) + + 2); + } + + if (len >= 29) + { + print_nl (); + len = 0; + } + while (len < 30) + { + print_space (); + ++len; + } + + if (from != NULL) + minfo ("%B ", from); + if (h != NULL) + minfo ("(%T)\n", h->root.string); + else + minfo ("(%s)\n", name); + } if (trace_files || trace_file_tries) info_msg ("%I\n", input); @@ -639,6 +782,17 @@ multiple_definition (info, name, obfd, osec, oval, nbfd, nsec, nval) asection *nsec; bfd_vma nval; { + /* If either section has the output_section field set to + bfd_abs_section_ptr, it means that the section is being + discarded, and this is not really a multiple definition at all. + FIXME: It would be cleaner to somehow ignore symbols defined in + sections which are being discarded. */ + if ((osec->output_section != NULL + && bfd_is_abs_section (osec->output_section)) + || (nsec->output_section != NULL + && bfd_is_abs_section (nsec->output_section))) + return true; + einfo ("%X%C: multiple definition of `%T'\n", nbfd, nsec, nval, name); if (obfd != (bfd *) NULL) @@ -775,7 +929,9 @@ constructor_callback (info, constructor, name, abfd, section, value) /* Ensure that BFD_RELOC_CTOR exists now, so that we can give a useful error message. */ - if (bfd_reloc_type_lookup (output_bfd, BFD_RELOC_CTOR) == NULL) + 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"); s = set_name; @@ -786,10 +942,6 @@ constructor_callback (info, constructor, name, abfd, section, value) else strcpy (s, "__DTOR_LIST__"); - if (config.map_file != (FILE *) NULL) - fprintf (config.map_file, - "Adding %s to constructor/destructor set %s\n", name, set_name); - h = bfd_link_hash_lookup (info->hash, set_name, true, true, true); if (h == (struct bfd_link_hash_entry *) NULL) einfo ("%P%F: bfd_link_hash_lookup failed: %E\n"); @@ -829,6 +981,12 @@ warning_callback (info, warning, symbol, abfd, section, address) asection *section; bfd_vma address; { + /* This is a hack to support warn_multiple_gp. FIXME: This should + have a cleaner interface, but what? */ + if (! config.warn_multiple_gp + && strcmp (warning, "using multiple gp values") == 0) + return true; + if (section != NULL) einfo ("%C: %s\n", abfd, section, address, warning); else if (abfd == NULL) @@ -1065,20 +1223,27 @@ unattached_reloc (info, name, abfd, section, address) return true; } -/* This is called when a symbol in notice_hash is found. Symbols are - put in notice_hash using the -y option. */ +/* This is called if link_info.notice_all is set, or when a symbol in + link_info.notice_hash is found. Symbols are put in notice_hash + using the -y option. */ -/*ARGSUSED*/ static boolean -notice_ysym (info, name, abfd, section, value) +notice (info, name, abfd, section, value) struct bfd_link_info *info; const char *name; bfd *abfd; asection *section; bfd_vma value; { - einfo ("%B: %s %s\n", abfd, - bfd_is_und_section (section) ? "reference to" : "definition of", - name); + 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 (info->notice_all) + add_cref (name, abfd, section, value); + return true; } diff --git a/gnu/usr.bin/binutils/ld/ldmain.h b/gnu/usr.bin/binutils/ld/ldmain.h index 93ce3a25869..5c5f38b8493 100644 --- a/gnu/usr.bin/binutils/ld/ldmain.h +++ b/gnu/usr.bin/binutils/ld/ldmain.h @@ -32,6 +32,7 @@ extern const char *output_filename; extern struct bfd_link_info link_info; extern void add_ysym PARAMS ((const char *)); +extern void add_wrap PARAMS ((const char *)); extern void add_keepsyms_file PARAMS ((const char *filename)); #endif diff --git a/gnu/usr.bin/binutils/ld/ldmisc.c b/gnu/usr.bin/binutils/ld/ldmisc.c index f4ded2765db..9116f35a94e 100644 --- a/gnu/usr.bin/binutils/ld/ldmisc.c +++ b/gnu/usr.bin/binutils/ld/ldmisc.c @@ -1,6 +1,5 @@ /* ldmisc.c - Copyright (C) 1991, 92, 93, 94 Free Software Foundation, Inc. - + Copyright (C) 1991, 92, 93, 94, 95, 1996 Free Software Foundation, Inc. Written by Steve Chamberlain of Cygnus Support. This file is part of GLD, the Gnu Linker. @@ -21,17 +20,15 @@ the Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307 #include "bfd.h" #include "sysdep.h" -#include <demangle.h> -/* this collection of routines wants to use the Unix style varargs - use special abbreviated portion of varargs.h */ -#ifdef WINDOWS_NT -/* Since macro __STDC__ is defined, the compiler will raise and error if - VARARGS.H from mstools\h is included. Since we only need a portion of - this header file, it has been incorporated into local header file - xvarargs.h */ -#include "xvarargs.h" +#include "libiberty.h" +#include "demangle.h" + +#ifdef ANSI_PROTOTYPES +#include <stdarg.h> +#define USE_STDARG 1 #else #include <varargs.h> +#define USE_STDARG 0 #endif #include "ld.h" @@ -43,12 +40,6 @@ the Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307 #include "ldmain.h" #include "ldfile.h" - -/* VARARGS*/ -static void finfo (); -static const char *demangle PARAMS ((const char *string, - int remove_underscore)); - /* %% literal % %F error is fatal @@ -61,303 +52,341 @@ static const char *demangle PARAMS ((const char *string, %X no object output, fail return %V hex bfd_vma %v hex bfd_vma, no leading zeros + %W hex bfd_vma with 0x with no leading zeros taking up 8 spaces %C clever filename:linenumber with function %D like %C, but no function name + %G like %D, but only function name %R info about a relent %s arbitrary string, like printf %d integer, like printf %u integer, like printf */ -static const char * -demangle (string, remove_underscore) +char * +demangle (string) const char *string; - int remove_underscore; { - const char *res; + char *res; - if (remove_underscore - && output_bfd != NULL + if (output_bfd != NULL && bfd_get_symbol_leading_char (output_bfd) == string[0]) ++string; /* This is a hack for better error reporting on XCOFF. */ - if (remove_underscore && string[0] == '.') + if (string[0] == '.') ++string; - /* Note that there's a memory leak here, we keep buying memory for - demangled names, and never free. But if you have so many errors - that you run out of VM with the error messages, then there's - something up. */ res = cplus_demangle (string, DMGL_ANSI | DMGL_PARAMS); - return res ? res : string; + return res ? res : xstrdup (string); } static void -vfinfo(fp, fmt, arg) +vfinfo (fp, fmt, arg) FILE *fp; - char *fmt; + const char *fmt; va_list arg; { boolean fatal = false; - while (*fmt) - { - while (*fmt != '%' && *fmt != '\0') + while (*fmt != '\0') { - putc(*fmt, fp); - fmt++; - } - - if (*fmt == '%') - { - fmt ++; - switch (*fmt++) - { - default: - fprintf(fp,"%%%c", fmt[-1]); - break; - - case '%': - /* literal % */ - putc('%', fp); - break; - - case 'X': - /* no object output, fail return */ - config.make_executable = false; - break; - - case 'V': - /* hex bfd_vma */ - { - bfd_vma value = va_arg(arg, bfd_vma); - fprintf_vma(fp, value); - } - break; - - case 'v': - /* hex bfd_vma, no leading zeros */ + while (*fmt != '%' && *fmt != '\0') { - char buf[100]; - char *p = buf; - bfd_vma value = va_arg (arg, bfd_vma); - sprintf_vma (p, value); - while (*p == '0') - p++; - if (!*p) - p--; - fputs (p, fp); + putc (*fmt, fp); + fmt++; } - break; - case 'T': - /* Symbol name. */ + if (*fmt == '%') { - const char *name = va_arg (arg, const char *); + fmt ++; + switch (*fmt++) + { + default: + fprintf (fp,"%%%c", fmt[-1]); + break; + + case '%': + /* literal % */ + putc ('%', fp); + break; + + case 'X': + /* no object output, fail return */ + config.make_executable = false; + break; + + case 'V': + /* hex bfd_vma */ + { + bfd_vma value = va_arg (arg, bfd_vma); + fprintf_vma (fp, value); + } + break; + + case 'v': + /* hex bfd_vma, no leading zeros */ + { + char buf[100]; + char *p = buf; + bfd_vma value = va_arg (arg, bfd_vma); + sprintf_vma (p, value); + while (*p == '0') + p++; + if (!*p) + p--; + fputs (p, fp); + } + break; + + case 'W': + /* hex bfd_vma with 0x with no leading zeroes taking up + 8 spaces. */ + { + char buf[100]; + bfd_vma value; + char *p; + int len; + + value = va_arg (arg, bfd_vma); + sprintf_vma (buf, value); + for (p = buf; *p == '0'; ++p) + ; + len = strlen (p); + while (len < 8) + { + putc (' ', fp); + ++len; + } + fprintf (fp, "0x%s", p); + } + break; + + case 'T': + /* Symbol name. */ + { + const char *name = va_arg (arg, const char *); + + if (name == (const char *) NULL) + fprintf (fp, "no symbol"); + else + { + char *demangled; + + demangled = demangle (name); + fprintf (fp, "%s", demangled); + free (demangled); + } + } + break; + + case 'B': + /* filename from a bfd */ + { + bfd *abfd = va_arg (arg, bfd *); + if (abfd->my_archive) + fprintf (fp, "%s(%s)", abfd->my_archive->filename, + abfd->filename); + else + fprintf (fp, "%s", abfd->filename); + } + break; + + case 'F': + /* error is fatal */ + fatal = true; + break; + + case 'P': + /* print program name */ + fprintf (fp, "%s", program_name); + break; + + case 'E': + /* current bfd error or errno */ + fprintf (fp, bfd_errmsg (bfd_get_error ())); + break; + + case 'I': + /* filename from a lang_input_statement_type */ + { + lang_input_statement_type *i; + + i = va_arg (arg, lang_input_statement_type *); + if (bfd_my_archive (i->the_bfd) != NULL) + fprintf (fp, "(%s)", + bfd_get_filename (bfd_my_archive (i->the_bfd))); + fprintf (fp, "%s", i->local_sym_name); + if (bfd_my_archive (i->the_bfd) == NULL + && strcmp (i->local_sym_name, i->filename) != 0) + fprintf (fp, " (%s)", i->filename); + } + break; + + case 'S': + /* print script file and linenumber */ + if (parsing_defsym) + fprintf (fp, "--defsym %s", lex_string); + else if (ldfile_input_filename != NULL) + fprintf (fp, "%s:%u", ldfile_input_filename, lineno); + else + fprintf (fp, "built in linker script:%u", lineno); + break; - if (name != (const char *) NULL) - fprintf (fp, "%s", demangle (name, 1)); - else - fprintf (fp, "no symbol"); - } - break; - - case 'B': - /* filename from a bfd */ - { - bfd *abfd = va_arg(arg, bfd *); - if (abfd->my_archive) { - fprintf(fp,"%s(%s)", abfd->my_archive->filename, - abfd->filename); - } - else { - fprintf(fp,"%s", abfd->filename); - } - } - break; - - case 'F': - /* error is fatal */ - fatal = true; - break; - - case 'P': - /* print program name */ - fprintf(fp,"%s", program_name); - break; - - case 'E': - /* current bfd error or errno */ - fprintf(fp, bfd_errmsg(bfd_get_error ())); - break; - - case 'I': - /* filename from a lang_input_statement_type */ - { - lang_input_statement_type *i = - va_arg(arg,lang_input_statement_type *); - - if (i->the_bfd->my_archive) - fprintf(fp, "(%s)", i->the_bfd->my_archive->filename); - fprintf(fp,"%s", i->local_sym_name); - } - break; - - case 'S': - /* print script file and linenumber */ - if (parsing_defsym) - fprintf (fp, "--defsym %s", lex_string); - else if (ldfile_input_filename != NULL) - fprintf (fp, "%s:%u", ldfile_input_filename, lineno); - else - fprintf (fp, "built in linker script:%u", lineno); - break; - - case 'R': - /* Print all that's interesting about a relent */ - { - arelent *relent = va_arg(arg, arelent *); + case 'R': + /* Print all that's interesting about a relent */ + { + arelent *relent = va_arg (arg, arelent *); - finfo (fp, "%s+0x%v (type %s)", - (*(relent->sym_ptr_ptr))->name, - relent->addend, - relent->howto->name); - } - break; + finfo (fp, "%s+0x%v (type %s)", + (*(relent->sym_ptr_ptr))->name, + relent->addend, + relent->howto->name); + } + break; - case 'C': - case 'D': - /* Clever filename:linenumber with function name if possible, - or section name as a last resort. The arguments are a BFD, - a section, and an offset. */ - { - static bfd *last_bfd; - static char *last_file = NULL; - static char *last_function = NULL; - bfd *abfd; - asection *section; - bfd_vma offset; - lang_input_statement_type *entry; - asymbol **asymbols; - const char *filename; - const char *functionname; - unsigned int linenumber; - boolean discard_last; - - abfd = va_arg (arg, bfd *); - section = va_arg (arg, asection *); - offset = va_arg (arg, bfd_vma); - - entry = (lang_input_statement_type *) abfd->usrdata; - if (entry != (lang_input_statement_type *) NULL - && entry->asymbols != (asymbol **) NULL) - asymbols = entry->asymbols; - else - { - long symsize; - long symbol_count; - - symsize = bfd_get_symtab_upper_bound (abfd); - if (symsize < 0) - 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); - if (entry != (lang_input_statement_type *) NULL) - { - entry->asymbols = asymbols; - entry->symbol_count = symbol_count; - } - } + case 'C': + case 'D': + case 'G': + /* Clever filename:linenumber with function name if possible, + or section name as a last resort. The arguments are a BFD, + a section, and an offset. */ + { + static bfd *last_bfd; + static char *last_file = NULL; + static char *last_function = NULL; + bfd *abfd; + asection *section; + bfd_vma offset; + lang_input_statement_type *entry; + asymbol **asymbols; + const char *filename; + const char *functionname; + unsigned int linenumber; + boolean discard_last; + + abfd = va_arg (arg, bfd *); + section = va_arg (arg, asection *); + offset = va_arg (arg, bfd_vma); + + entry = (lang_input_statement_type *) abfd->usrdata; + if (entry != (lang_input_statement_type *) NULL + && entry->asymbols != (asymbol **) NULL) + asymbols = entry->asymbols; + else + { + long symsize; + long symbol_count; + + symsize = bfd_get_symtab_upper_bound (abfd); + if (symsize < 0) + 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); + if (entry != (lang_input_statement_type *) NULL) + { + entry->asymbols = asymbols; + entry->symbol_count = symbol_count; + } + } + + discard_last = true; + if (bfd_find_nearest_line (abfd, section, asymbols, offset, + &filename, &functionname, + &linenumber)) + { + if (functionname != NULL && fmt[-1] == 'G') + { + finfo (fp, "%B:", abfd); + if (filename != NULL + && strcmp (filename, bfd_get_filename (abfd)) != 0) + fprintf (fp, "%s:", filename); + finfo (fp, "%T", functionname); + } + else if (functionname != NULL && fmt[-1] == 'C') + { + if (filename == (char *) NULL) + filename = abfd->filename; + + if (last_bfd == NULL + || last_file == NULL + || last_function == NULL + || last_bfd != abfd + || strcmp (last_file, filename) != 0 + || strcmp (last_function, functionname) != 0) + { + /* We use abfd->filename in this initial line, + in case filename is a .h file or something + similarly unhelpful. */ + finfo (fp, "%B: In function `%T':\n", + abfd, functionname); + + last_bfd = abfd; + if (last_file != NULL) + free (last_file); + last_file = buystring (filename); + if (last_function != NULL) + free (last_function); + last_function = buystring (functionname); + } + discard_last = false; + if (linenumber != 0) + fprintf (fp, "%s:%u", filename, linenumber); + else + finfo (fp, "%s(%s+0x%v)", filename, section->name, + offset); + } + else if (filename == NULL + || strcmp (filename, abfd->filename) == 0) + { + finfo (fp, "%B(%s+0x%v)", abfd, section->name, offset); + if (linenumber != 0) + finfo (fp, ":%u", linenumber); + } + else if (linenumber != 0) + finfo (fp, "%B:%s:%u", abfd, filename, linenumber); + else + finfo (fp, "%B(%s+0x%v):%s", abfd, section->name, offset, + filename); + } + else + finfo (fp, "%B(%s+0x%v)", abfd, section->name, offset); - discard_last = true; - if (bfd_find_nearest_line (abfd, section, asymbols, offset, - &filename, &functionname, &linenumber)) - { - if (functionname != NULL && fmt[-1] == 'C') - { - if (filename == (char *) NULL) - filename = abfd->filename; - - if (last_bfd == NULL - || last_file == NULL - || last_function == NULL - || last_bfd != abfd - || strcmp (last_file, filename) != 0 - || strcmp (last_function, functionname) != 0) - { - /* We use abfd->filename in this initial line, - in case filename is a .h file or something - similarly unhelpful. */ - finfo (fp, "%B: In function `%s':\n", - abfd, demangle (functionname, 1)); - - last_bfd = abfd; - if (last_file != NULL) + if (discard_last) + { + last_bfd = NULL; + if (last_file != NULL) + { free (last_file); - last_file = buystring (filename); - if (last_function != NULL) + last_file = NULL; + } + if (last_function != NULL) + { free (last_function); - last_function = buystring (functionname); - } - discard_last = false; - if (linenumber != 0) - fprintf (fp, "%s:%u", filename, linenumber); - else - finfo (fp, "%s(%s+0x%v)", filename, section->name, offset); - } - else if (filename == NULL - || strcmp (filename, abfd->filename) == 0) - { - finfo (fp, "%B(%s+0x%v)", abfd, section->name, offset); - if (linenumber != 0) - finfo (fp, "%u", linenumber); - } - else if (linenumber != 0) - finfo (fp, "%B:%s:%u", abfd, filename, linenumber); - else - finfo (fp, "%B(%s+0x%v):%s", abfd, section->name, offset, - filename); - } - else - finfo (fp, "%B(%s+0x%v)", abfd, section->name, offset); - - if (discard_last) - { - last_bfd = NULL; - if (last_file != NULL) - { - free (last_file); - last_file = NULL; - } - if (last_function != NULL) - { - free (last_function); - last_function = NULL; - } + last_function = NULL; + } + } + } + break; + + case 's': + /* arbitrary string, like printf */ + fprintf (fp, "%s", va_arg (arg, char *)); + break; + + case 'd': + /* integer, like printf */ + fprintf (fp, "%d", va_arg (arg, int)); + break; + + case 'u': + /* unsigned integer, like printf */ + fprintf (fp, "%u", va_arg (arg, unsigned int)); + break; } } - break; - - case 's': - /* arbitrary string, like printf */ - fprintf(fp,"%s", va_arg(arg, char *)); - break; - - case 'd': - /* integer, like printf */ - fprintf(fp,"%d", va_arg(arg, int)); - break; - - case 'u': - /* unsigned integer, like printf */ - fprintf(fp,"%u", va_arg(arg, unsigned int)); - break; - } } - } if (fatal == true) xexit(1); @@ -365,39 +394,63 @@ vfinfo(fp, fmt, arg) /* Format info message and print on stdout. */ -/* (You would think this should be called just "info", but then you would - hosed by LynxOS, which defines that name in its libc.) */ +/* (You would think this should be called just "info", but then you + would hosed by LynxOS, which defines that name in its libc.) */ -void info_msg(va_alist) +void +#if USE_STDARG +info_msg (const char *fmt, ...) +#else +info_msg (va_alist) va_dcl +#endif { - char *fmt; va_list arg; - va_start(arg); - fmt = va_arg(arg, char *); - vfinfo(stdout, fmt, arg); - va_end(arg); + +#if ! USE_STDARG + const char *fmt; + + va_start (arg); + fmt = va_arg (arg, const char *); +#else + va_start (arg, fmt); +#endif + + vfinfo (stdout, fmt, arg); + va_end (arg); } /* ('e' for error.) Format info message and print on stderr. */ -void einfo(va_alist) +void +#if USE_STDARG +einfo (const char *fmt, ...) +#else +einfo (va_alist) va_dcl +#endif { - char *fmt; va_list arg; - va_start(arg); - fmt = va_arg(arg, char *); - vfinfo(stderr, fmt, arg); - va_end(arg); + +#if ! USE_STDARG + const char *fmt; + + va_start (arg); + fmt = va_arg (arg, const char *); +#else + va_start (arg, fmt); +#endif + + vfinfo (stderr, fmt, arg); + va_end (arg); } void -info_assert(file, line) - char *file; +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 * @@ -410,54 +463,65 @@ buystring (x) return r; } - /* ('m' for map) Format info message and print on map. */ -void minfo(va_alist) +void +#if USE_STDARG +minfo (const char *fmt, ...) +#else +minfo (va_alist) va_dcl +#endif { - char *fmt; va_list arg; - va_start(arg); - fmt = va_arg(arg, char *); - vfinfo(config.map_file, fmt, arg); - va_end(arg); -} +#if ! USE_STDARG + const char *fmt; + va_start (arg); + fmt = va_arg (arg, const char *); +#else + va_start (arg, fmt); +#endif -static void + vfinfo (config.map_file, fmt, arg); + va_end (arg); +} + +void +#if USE_STDARG +finfo (FILE *file, const char *fmt, ...) +#else finfo (va_alist) va_dcl +#endif { - char *fmt; - FILE *file; va_list arg; + +#if ! USE_STDARG + FILE *file; + const char *fmt; + va_start (arg); file = va_arg (arg, FILE *); - fmt = va_arg (arg, char *); + fmt = va_arg (arg, const char *); +#else + va_start (arg, fmt); +#endif + vfinfo (file, fmt, arg); va_end (arg); } - - - -/*---------------------------------------------------------------------- - Functions to print the link map - */ + +/* Functions to print the link map. */ void print_space () { - fprintf(config.map_file, " "); + fprintf (config.map_file, " "); } + void print_nl () { - fprintf(config.map_file, "\n"); -} -void -print_address (value) - bfd_vma value; -{ - fprintf_vma(config.map_file, value); + fprintf (config.map_file, "\n"); } diff --git a/gnu/usr.bin/binutils/ld/ldmisc.h b/gnu/usr.bin/binutils/ld/ldmisc.h index 25d472644fd..f0073a7d7e3 100644 --- a/gnu/usr.bin/binutils/ld/ldmisc.h +++ b/gnu/usr.bin/binutils/ld/ldmisc.h @@ -1,5 +1,5 @@ /* ldmisc.h - - Copyright (C) 1991, 92, 93, 94 Free Software Foundation, Inc. + Copyright (C) 1991, 92, 93, 94, 95, 1996 Free Software Foundation, Inc. This file is part of GLD, the Gnu Linker. @@ -20,13 +20,23 @@ #ifndef LDMISC_H #define LDMISC_H +#ifdef ANSI_PROTOTYPES +extern void einfo PARAMS ((const char *, ...)); +extern void minfo PARAMS ((const char *, ...)); +extern void info_msg PARAMS ((const char *, ...)); +extern void finfo PARAMS ((FILE *, const char *, ...)); +#else /* VARARGS*/ extern void einfo (); /* VARARGS*/ extern void minfo (); /* VARARGS*/ extern void info_msg (); -extern void info_assert PARAMS ((char *, unsigned int)); +/*VARARGS*/ +extern void finfo (); +#endif + +extern void info_assert PARAMS ((const char *, unsigned int)); extern void yyerror PARAMS ((const char *)); extern PTR xmalloc PARAMS ((size_t)); extern PTR xrealloc PARAMS ((PTR, size_t)); @@ -41,6 +51,6 @@ do { info_assert(__FILE__,__LINE__); } while (0) extern void print_space PARAMS ((void)); extern void print_nl PARAMS ((void)); -extern void print_address PARAMS ((bfd_vma value)); +extern char *demangle PARAMS ((const char *)); #endif diff --git a/gnu/usr.bin/binutils/ld/ldver.c b/gnu/usr.bin/binutils/ld/ldver.c index c8ec676fdf0..920e08bbe96 100644 --- a/gnu/usr.bin/binutils/ld/ldver.c +++ b/gnu/usr.bin/binutils/ld/ldver.c @@ -1,4 +1,5 @@ -/* Copyright (C) 1991 Free Software Foundation, Inc. +/* ldver.c -- Print linker version. + Copyright (C) 1991, 92, 93, 94, 95, 1996 Free Software Foundation, Inc. This file is part of GLD, the Gnu Linker. @@ -29,60 +30,17 @@ void ldversion (noisy) int noisy; { - fprintf(stdout,"ld version 2.6 (with BFD %s)\n", BFD_VERSION); + fprintf (stdout,"ld version cygnus-2.6 (with BFD %s)\n", BFD_VERSION); if (noisy) - { - ld_emulation_xfer_type **ptr = ld_emulations; - - printf(" Supported emulations:\n"); - while (*ptr) { - printf(" %s \n", (*ptr)->emulation_name); - ptr++; + ld_emulation_xfer_type **ptr = ld_emulations; + + printf (" Supported emulations:\n"); + while (*ptr) + { + printf (" %s\n", (*ptr)->emulation_name); + ptr++; + } } - } -} - -void -help () -{ - extern bfd_target *bfd_target_vector[]; - int t; - - printf ("\ -Usage: %s [-o output] objfile...\n\ -Options:\n\ - [-A architecture] [-b input-format]\n\ - [-Bstatic] [-Bdynamic] [-Bsymbolic] [-base-file file]\n\ - [-c MRI-commandfile] [-d | -dc | -dp]\n\ - [-defsym symbol=expression] [-dynamic-linker filename]\n", - program_name); - puts ("\ - [-EB | -EL] [-e entry] [-embeddded-relocs] [-export-dynamic]\n\ - [-F] [-Fformat] [-format input-format] [-g] [-G size]\n\ - [-heap reserve[,commit]] [-help] [-i]\n\ - [-l archive] [-L searchdir] [-M] [-Map mapfile]\n\ - [-m emulation] [-N | -n] [-no-keep-memory] [-noinhibit-exec]\n\ - [-oformat output-format] [-R filename] [-relax]"); - puts ("\ - [-retain-symbols-file file] [-rpath path] [-shared] [-soname name]\n\ - [-r | -Ur] [-S] [-s] [-sort-common] [-stack reserve[,commit]]\n\ - [-split-by-reloc count] [-split-by-file]\n\ - [-stats] [-subsystem type] [-T commandfile]\n\ - [-Ttext textorg] [-Tdata dataorg] [-Tbss bssorg] [-t]"); - puts ("\ - [-traditional-format] [-u symbol] [-V] [-v] [-verbose]\n\ - [-version] [-warn-common] [-warn-constructors] [-warn-once]\n\ - [-whole-archive] [-X] [-x] [-y symbol]\n\ - [-( archives -)] [--start-group archives --end-group]"); - - printf ("%s: supported targets:", program_name); - for (t = 0; bfd_target_vector[t] != NULL; t++) - printf (" %s", bfd_target_vector[t]->name); - printf ("\n"); - - printf ("%s: supported emulations: ", program_name); - ldemul_list_emulations (stdout); - printf ("\n"); } diff --git a/gnu/usr.bin/binutils/ld/ldver.h b/gnu/usr.bin/binutils/ld/ldver.h index e95496e20f2..514da3204c0 100644 --- a/gnu/usr.bin/binutils/ld/ldver.h +++ b/gnu/usr.bin/binutils/ld/ldver.h @@ -1,7 +1,7 @@ -/* ldver.h - - Copyright 1991, 1992 Free Software Foundation, Inc. +/* ldver.h -- Header file for ldver.c. + Copyright (C) 1991, 92, 93, 95, 1996 Free Software Foundation, Inc. - This file is part of GLD, the Gnu Linker. +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 @@ -18,4 +18,3 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ void ldversion PARAMS ((int)); -void help PARAMS ((void)); diff --git a/gnu/usr.bin/binutils/ld/ldwrite.c b/gnu/usr.bin/binutils/ld/ldwrite.c index 0bb86691644..7c8e81cbc2e 100644 --- a/gnu/usr.bin/binutils/ld/ldwrite.c +++ b/gnu/usr.bin/binutils/ld/ldwrite.c @@ -21,6 +21,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include "bfd.h" #include "sysdep.h" #include "bfdlink.h" +#include "libiberty.h" #include "ld.h" #include "ldexp.h" @@ -31,11 +32,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include "ldmain.h" static void build_link_order PARAMS ((lang_statement_union_type *)); -static void print_symbol_table PARAMS ((void)); -static void print_file_stuff PARAMS ((lang_input_statement_type *)); -static boolean print_symbol PARAMS ((struct bfd_link_hash_entry *, PTR)); - -extern char *strdup(); /* Build link_order structures for the BFD linker. */ @@ -64,6 +60,58 @@ build_link_order (statement) value = statement->data_statement.value; + /* If the endianness of the output BFD is not known, then we + base the endianness of the data on the first input file. + By convention, the bfd_put routines for an unknown + endianness are big endian, so we must swap here if the + input file is little endian. */ + if (! bfd_big_endian (output_bfd) + && ! bfd_little_endian (output_bfd)) + { + boolean swap; + + swap = false; + if (command_line.endian == ENDIAN_LITTLE) + swap = true; + else if (command_line.endian == ENDIAN_UNSET) + { + LANG_FOR_EACH_INPUT_STATEMENT (s) + { + if (s->the_bfd != NULL) + { + if (bfd_little_endian (s->the_bfd)) + swap = true; + break; + } + } + } + + if (swap) + { + bfd_byte buffer[8]; + + switch (statement->data_statement.type) + { + case QUAD: + bfd_putl64 (value, buffer); + value = bfd_getb64 (buffer); + break; + case LONG: + bfd_putl32 (value, buffer); + value = bfd_getb32 (buffer); + break; + case SHORT: + bfd_putl16 (value, buffer); + value = bfd_getb16 (buffer); + break; + case BYTE: + break; + default: + abort (); + } + } + } + ASSERT (output_section->owner == output_bfd); switch (statement->data_statement.type) { @@ -232,7 +280,7 @@ clone_section (abfd, s, count) } while (bfd_get_section_by_name (abfd, sname)); - n = bfd_make_section_anyway (abfd, strdup (sname)); + n = bfd_make_section_anyway (abfd, xstrdup (sname)); /* Create a symbol of the same name */ @@ -438,151 +486,4 @@ ldwrite () else xexit(1); } - - if (config.map_file) - { - print_symbol_table (); - lang_map (); - } -} - -/* Print the symbol table. */ - -static void -print_symbol_table () -{ - fprintf (config.map_file, "**FILES**\n\n"); - lang_for_each_file (print_file_stuff); - - fprintf (config.map_file, "**GLOBAL SYMBOLS**\n\n"); - fprintf (config.map_file, "offset section offset symbol\n"); - bfd_link_hash_traverse (link_info.hash, print_symbol, (PTR) NULL); -} - -/* Print information about a file. */ - -static void -print_file_stuff (f) - lang_input_statement_type *f; -{ - fprintf (config.map_file, " %s\n", f->filename); - if (f->just_syms_flag) - { - fprintf (config.map_file, " symbols only\n"); - } - else - { - asection *s; - if (true) - { - for (s = f->the_bfd->sections; - s != (asection *) NULL; - s = s->next) - { -#ifdef WINDOWS_NT - /* Don't include any information that goes into the '.junk' - section. This includes the code view .debug$ data and - stuff from .drectve sections */ - if (strcmp (s->name, ".drectve") == 0 || - strncmp (s->name, ".debug$", 7) == 0) - continue; -#endif - print_address (s->output_offset); - if (s->reloc_done) - { - fprintf (config.map_file, " %08x 2**%2ud %s\n", - (unsigned) bfd_get_section_size_after_reloc (s), - s->alignment_power, s->name); - } - - else - { - fprintf (config.map_file, " %08x 2**%2ud %s\n", - (unsigned) bfd_get_section_size_before_reloc (s), - s->alignment_power, s->name); - } - } - } - else - { - for (s = f->the_bfd->sections; - s != (asection *) NULL; - s = s->next) - { - fprintf (config.map_file, "%s ", s->name); - print_address (s->output_offset); - fprintf (config.map_file, "(%x)", - (unsigned) bfd_get_section_size_after_reloc (s)); - } - fprintf (config.map_file, "hex \n"); - } - } - print_nl (); -} - -/* Print a symbol. */ - -/*ARGSUSED*/ -static boolean -print_symbol (p, ignore) - struct bfd_link_hash_entry *p; - PTR ignore; -{ - while (p->type == bfd_link_hash_indirect - || p->type == bfd_link_hash_warning) - p = p->u.i.link; - - switch (p->type) - { - case bfd_link_hash_new: - abort (); - - case bfd_link_hash_undefined: - fprintf (config.map_file, "undefined "); - fprintf (config.map_file, "%s ", p->root.string); - print_nl (); - break; - - case bfd_link_hash_undefweak: - fprintf (config.map_file, "weak "); - fprintf (config.map_file, "%s ", p->root.string); - print_nl (); - break; - - case bfd_link_hash_defined: - case bfd_link_hash_defweak: - { - asection *defsec = p->u.def.section; - - print_address (p->u.def.value); - if (defsec) - { - fprintf (config.map_file, " %-10s", - bfd_section_name (output_bfd, defsec)); - print_space (); - print_address (p->u.def.value + defsec->vma); - } - else - { - fprintf (config.map_file, " ......."); - } - fprintf (config.map_file, " %s", p->root.string); - if (p->type == bfd_link_hash_defweak) - fprintf (config.map_file, " [weak]"); - } - print_nl (); - break; - - case bfd_link_hash_common: - fprintf (config.map_file, "common "); - print_address (p->u.c.size); - fprintf (config.map_file, " %s ", p->root.string); - print_nl (); - break; - - default: - abort (); - } - - return true; } diff --git a/gnu/usr.bin/binutils/ld/lexsup.c b/gnu/usr.bin/binutils/ld/lexsup.c index 06f8e19c597..33dd94debd5 100644 --- a/gnu/usr.bin/binutils/ld/lexsup.c +++ b/gnu/usr.bin/binutils/ld/lexsup.c @@ -1,5 +1,5 @@ /* Parse options for the GNU linker. - Copyright (C) 1991, 92, 93, 94, 1995 Free Software Foundation, Inc. + Copyright (C) 1991, 92, 93, 94, 95, 1996 Free Software Foundation, Inc. This file is part of GLD, the Gnu Linker. @@ -46,32 +46,18 @@ unsigned long strtoul (); static void set_default_dirlist PARAMS ((char *dirlist_ptr)); static void set_section_start PARAMS ((char *sect, char *valstr)); +static void help PARAMS ((void)); /* Non-zero if we are processing a --defsym from the command line. */ int parsing_defsym = 0; -void -parse_args (argc, argv) - int argc; - char **argv; -{ - int i; - int ingroup = 0; - char *default_dirlist = NULL; - - /* Starting the short option string with '-' is for programs that - expect options and other ARGV-elements in any order and that care about - the ordering of the two. We describe each non-option ARGV-element - as if it were the argument of an option with character code 1. */ - - const char *shortopts = - "-a:A:b:c:de:F::G:gh:iL:l:Mm:NnO:o:R:rSsT:tu:VvXxY:y:z:()"; - - /* 150 isn't special; it's just an arbitrary non-ASCII char value. */ +/* Codes used for the long options with no short synonyms. 150 isn't + special; it's just an arbitrary non-ASCII char value. */ #define OPTION_ASSERT 150 #define OPTION_CALL_SHARED (OPTION_ASSERT + 1) -#define OPTION_DEFSYM (OPTION_CALL_SHARED + 1) +#define OPTION_CREF (OPTION_CALL_SHARED + 1) +#define OPTION_DEFSYM (OPTION_CREF + 1) #define OPTION_DYNAMIC_LINKER (OPTION_DEFSYM + 1) #define OPTION_EB (OPTION_DYNAMIC_LINKER + 1) #define OPTION_EL (OPTION_EB + 1) @@ -83,7 +69,8 @@ parse_args (argc, argv) #define OPTION_NO_KEEP_MEMORY (OPTION_MAP + 1) #define OPTION_NOINHIBIT_EXEC (OPTION_NO_KEEP_MEMORY + 1) #define OPTION_NON_SHARED (OPTION_NOINHIBIT_EXEC + 1) -#define OPTION_OFORMAT (OPTION_NON_SHARED + 1) +#define OPTION_NO_WHOLE_ARCHIVE (OPTION_NON_SHARED + 1) +#define OPTION_OFORMAT (OPTION_NO_WHOLE_ARCHIVE + 1) #define OPTION_RELAX (OPTION_OFORMAT + 1) #define OPTION_RETAIN_SYMBOLS_FILE (OPTION_RELAX + 1) #define OPTION_RPATH (OPTION_RETAIN_SYMBOLS_FILE + 1) @@ -102,69 +89,267 @@ parse_args (argc, argv) #define OPTION_VERSION (OPTION_VERBOSE + 1) #define OPTION_WARN_COMMON (OPTION_VERSION + 1) #define OPTION_WARN_CONSTRUCTORS (OPTION_WARN_COMMON + 1) -#define OPTION_WARN_ONCE (OPTION_WARN_CONSTRUCTORS + 1) +#define OPTION_WARN_MULTIPLE_GP (OPTION_WARN_CONSTRUCTORS + 1) +#define OPTION_WARN_ONCE (OPTION_WARN_MULTIPLE_GP + 1) #define OPTION_SPLIT_BY_RELOC (OPTION_WARN_ONCE + 1) #define OPTION_SPLIT_BY_FILE (OPTION_SPLIT_BY_RELOC + 1) #define OPTION_WHOLE_ARCHIVE (OPTION_SPLIT_BY_FILE + 1) +#define OPTION_WRAP (OPTION_WHOLE_ARCHIVE + 1) +#define OPTION_FORCE_EXE_SUFFIX (OPTION_WRAP + 1) + +/* The long options. This structure is used for both the option + parsing and the help text. */ + +struct ld_option +{ + /* The long option information. */ + struct option opt; + /* The short option with the same meaning ('\0' if none). */ + char shortopt; + /* The name of the argument (NULL if none). */ + const char *arg; + /* The documentation string. If this is NULL, this is a synonym for + the previous option. */ + const char *doc; + enum + { + /* Use one dash before long option name. */ + ONE_DASH, + /* Use two dashes before long option name. */ + TWO_DASHES, + /* Don't mention this option in --help output. */ + NO_HELP + } control; +}; + +static const struct ld_option ld_options[] = +{ + { {NULL, required_argument, NULL, '\0'}, + 'a', "KEYWORD", "Shared library control for HP/UX compatibility", + ONE_DASH }, + { {"architecture", required_argument, NULL, 'A'}, + 'A', "ARCH", "Set architecture" , TWO_DASHES }, + { {"format", required_argument, NULL, 'b'}, + 'b', "TARGET", "Specify target for following input files", TWO_DASHES }, + { {"mri-script", required_argument, NULL, 'c'}, + 'c', "FILE", "Read MRI format linker script", TWO_DASHES }, + { {"dc", no_argument, NULL, 'd'}, + 'd', NULL, "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 }, + { {"export-dynamic", no_argument, NULL, OPTION_EXPORT_DYNAMIC}, + 'E', NULL, "Export all dynamic symbols", TWO_DASHES }, + { {NULL, optional_argument, NULL, '\0'}, + 'F', "[FORMAT]", "Ignored", ONE_DASH }, + { {NULL, no_argument, NULL, '\0'}, + 'g', NULL, "Ignored", ONE_DASH }, + { {"gpsize", required_argument, NULL, 'G'}, + 'G', "SIZE", "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 }, + { {"library", required_argument, NULL, 'l'}, + 'l', "LIBNAME", "Search for library LIBNAME", TWO_DASHES }, + { {"library-path", required_argument, NULL, 'L'}, + 'L', "DIRECTORY", "Add DIRECTORY to library search path", TWO_DASHES }, + { {NULL, required_argument, NULL, '\0'}, + 'm', "EMULATION", "Set emulation", ONE_DASH }, + { {"print-map", no_argument, NULL, 'M'}, + 'M', NULL, "Print map file on standard output", TWO_DASHES }, + { {"nmagic", no_argument, NULL, 'n'}, + 'n', NULL, "Do not page align data", TWO_DASHES }, + { {"omagic", no_argument, NULL, 'N'}, + 'N', NULL, "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 }, + { {NULL, required_argument, NULL, '\0'}, + 'O', NULL, "Ignored", ONE_DASH }, + { {"relocateable", no_argument, NULL, 'r'}, + 'r', NULL, "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)", + TWO_DASHES }, + { {"strip-all", no_argument, NULL, 's'}, + 's', NULL, "Strip all symbols", TWO_DASHES }, + { {"strip-debug", no_argument, NULL, 'S'}, + 'S', NULL, "Strip debugging symbols", TWO_DASHES }, + { {"trace", no_argument, NULL, 't'}, + 't', NULL, "Trace file opens", TWO_DASHES }, + { {"script", required_argument, NULL, 'T'}, + 'T', "FILE", "Read linker script", TWO_DASHES }, + { {"undefined", required_argument, NULL, 'u'}, + 'u', "SYMBOL", "Start with undefined reference to SYMBOL", TWO_DASHES }, + { {"version", no_argument, NULL, OPTION_VERSION}, + 'v', NULL, "Print version information", TWO_DASHES }, + { {NULL, no_argument, NULL, '\0'}, + 'V', NULL, "Print version and emulation information", ONE_DASH }, + { {"discard-all", no_argument, NULL, 'x'}, + 'x', NULL, "Discard all local symbols", TWO_DASHES }, + { {"discard-locals", no_argument, NULL, 'X'}, + 'X', NULL, "Discard temporary local symbols", TWO_DASHES }, + { {"trace-symbol", required_argument, NULL, 'y'}, + 'y', "SYMBOL", "Trace mentions of SYMBOL", TWO_DASHES }, + { {NULL, required_argument, NULL, '\0'}, + 'Y', "PATH", "Default search path for Solaris compatibility", ONE_DASH }, + { {NULL, required_argument, NULL, '\0'}, + 'z', "KEYWORD", "Ignored for Solaris compatibility", ONE_DASH }, + { {"start-group", no_argument, NULL, '('}, + '(', NULL, "Start a group", TWO_DASHES }, + { {"end-group", no_argument, NULL, ')'}, + ')', NULL, "End a group", TWO_DASHES }, + { {"assert", required_argument, NULL, OPTION_ASSERT}, + '\0', "KEYWORD", "Ignored for SunOS compatibility", ONE_DASH }, + { {"Bdynamic", no_argument, NULL, OPTION_CALL_SHARED}, + '\0', NULL, "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 }, + { {"dn", no_argument, NULL, OPTION_NON_SHARED}, + '\0', NULL, NULL, ONE_DASH }, + { {"non_shared", no_argument, NULL, OPTION_NON_SHARED}, + '\0', NULL, NULL, ONE_DASH }, + { {"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 }, + { {"cref", no_argument, NULL, OPTION_CREF}, + '\0', NULL, "Output cross reference table", TWO_DASHES }, + { {"defsym", required_argument, NULL, OPTION_DEFSYM}, + '\0', "SYMBOL=EXPRESSION", "Define a symbol", 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 }, + { {"embedded-relocs", no_argument, NULL, OPTION_EMBEDDED_RELOCS}, + '\0', NULL, "Generate embedded relocs", TWO_DASHES}, + { {"force-exe-suffix", no_argument, NULL, OPTION_FORCE_EXE_SUFFIX}, + '\0', NULL, "Force generation of file with .exe suffix", TWO_DASHES}, + { {"help", no_argument, NULL, OPTION_HELP}, + '\0', NULL, "Print option help", TWO_DASHES }, + { {"Map", required_argument, NULL, OPTION_MAP}, + '\0', "FILE", "Write a map file", ONE_DASH }, + { {"no-keep-memory", no_argument, NULL, OPTION_NO_KEEP_MEMORY}, + '\0', NULL, "Use less memory and more disk I/O", TWO_DASHES }, + { {"no-whole-archive", no_argument, NULL, OPTION_NO_WHOLE_ARCHIVE}, + '\0', NULL, "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 }, + { {"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 }, + { {"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 }, + { {"relax", no_argument, NULL, OPTION_RELAX}, + '\0', NULL, "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 }, + { {"rpath", required_argument, NULL, OPTION_RPATH}, + '\0', "PATH", "Set runtime shared library search path", ONE_DASH }, + { {"rpath-link", required_argument, NULL, OPTION_RPATH_LINK}, + '\0', "PATH", "Set line time shared library search path", ONE_DASH }, + { {"shared", no_argument, NULL, OPTION_SHARED}, + '\0', NULL, "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 }, + { {"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 }, + { {"split-by-reloc", required_argument, NULL, OPTION_SPLIT_BY_RELOC}, + '\0', "COUNT", "Split output sections every COUNT relocs", TWO_DASHES }, + { {"stats", no_argument, NULL, OPTION_STATS}, + '\0', NULL, "Print memory usage statistics", TWO_DASHES }, + { {"traditional-format", no_argument, NULL, OPTION_TRADITIONAL_FORMAT}, + '\0', NULL, "Use same format as native linker", TWO_DASHES }, + { {"Tbss", required_argument, NULL, OPTION_TBSS}, + '\0', "ADDRESS", "Set address of .bss section", ONE_DASH }, + { {"Tdata", required_argument, NULL, OPTION_TDATA}, + '\0', "ADDRESS", "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 }, + { {"verbose", no_argument, NULL, OPTION_VERBOSE}, + '\0', NULL, "Output lots of information during link", TWO_DASHES }, + { {"dll-verbose", no_argument, NULL, OPTION_VERSION}, /* Linux. */ + '\0', NULL, NULL, NO_HELP }, + { {"warn-common", no_argument, NULL, OPTION_WARN_COMMON}, + '\0', NULL, "Warn about duplicate common symbols", TWO_DASHES }, + { {"warn-constructors", no_argument, NULL, OPTION_WARN_CONSTRUCTORS}, + '\0', NULL, "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 }, + { {"warn-once", no_argument, NULL, OPTION_WARN_ONCE}, + '\0', NULL, "Warn only once per undefined symbol", TWO_DASHES }, + { {"whole-archive", no_argument, NULL, OPTION_WHOLE_ARCHIVE}, + '\0', NULL, "Include all objects from following archives", TWO_DASHES }, + { {"wrap", required_argument, NULL, OPTION_WRAP}, + '\0', "SYMBOL", "Use wrapper functions for SYMBOL", TWO_DASHES } +}; + +#define OPTION_COUNT (sizeof ld_options / sizeof ld_options[0]) +void +parse_args (argc, argv) + int argc; + char **argv; +{ + int i, is, il; + int ingroup = 0; + char *default_dirlist = NULL; + char shortopts[OPTION_COUNT * 3 + 2]; + struct option longopts[OPTION_COUNT + 1]; - static struct option longopts[] = { - /* Sorted alphabeticaly, except for the PE options grouped at the end. */ - {"assert", required_argument, NULL, OPTION_ASSERT}, - {"Bdynamic", no_argument, NULL, OPTION_CALL_SHARED}, - {"Bstatic", no_argument, NULL, OPTION_NON_SHARED}, - {"Bsymbolic", no_argument, NULL, OPTION_SYMBOLIC}, - {"call_shared", no_argument, NULL, OPTION_CALL_SHARED}, - {"dc", no_argument, NULL, 'd'}, - {"defsym", required_argument, NULL, OPTION_DEFSYM}, - {"dll-verbose", no_argument, NULL, OPTION_VERSION}, /* Linux. */ - {"dn", no_argument, NULL, OPTION_NON_SHARED}, - {"dp", no_argument, NULL, 'd'}, - {"dy", no_argument, NULL, OPTION_CALL_SHARED}, - {"dynamic-linker", required_argument, NULL, OPTION_DYNAMIC_LINKER}, - {"EB", no_argument, NULL, OPTION_EB}, - {"EL", no_argument, NULL, OPTION_EL}, - {"embedded-relocs", no_argument, NULL, OPTION_EMBEDDED_RELOCS}, - {"end-group", no_argument, NULL, ')'}, - {"export-dynamic", no_argument, NULL, OPTION_EXPORT_DYNAMIC}, - {"format", required_argument, NULL, 'b'}, - {"help", no_argument, NULL, OPTION_HELP}, - {"Map", required_argument, NULL, OPTION_MAP}, - {"no-keep-memory", no_argument, NULL, OPTION_NO_KEEP_MEMORY}, - {"noinhibit-exec", no_argument, NULL, OPTION_NOINHIBIT_EXEC}, - {"noinhibit_exec", no_argument, NULL, OPTION_NOINHIBIT_EXEC}, - {"non_shared", no_argument, NULL, OPTION_NON_SHARED}, - {"oformat", required_argument, NULL, OPTION_OFORMAT}, - {"Qy", no_argument, NULL, OPTION_IGNORE}, - {"qmagic", no_argument, NULL, OPTION_IGNORE}, /* Linux compatibility. */ - {"relax", no_argument, NULL, OPTION_RELAX}, - {"retain-symbols-file", required_argument, NULL, OPTION_RETAIN_SYMBOLS_FILE}, - {"rpath", required_argument, NULL, OPTION_RPATH}, - {"rpath-link", required_argument, NULL, OPTION_RPATH_LINK}, - {"shared", no_argument, NULL, OPTION_SHARED}, - {"soname", required_argument, NULL, OPTION_SONAME}, - {"sort-common", no_argument, NULL, OPTION_SORT_COMMON}, - {"sort_common", no_argument, NULL, OPTION_SORT_COMMON}, - {"start-group", no_argument, NULL, '('}, - {"stats", no_argument, NULL, OPTION_STATS}, - {"static", no_argument, NULL, OPTION_NON_SHARED}, - {"Tbss", required_argument, NULL, OPTION_TBSS}, - {"Tdata", required_argument, NULL, OPTION_TDATA}, - {"Ttext", required_argument, NULL, OPTION_TTEXT}, - {"traditional-format", no_argument, NULL, OPTION_TRADITIONAL_FORMAT}, - {"Ur", no_argument, NULL, OPTION_UR}, - {"verbose", no_argument, NULL, OPTION_VERBOSE}, - {"version", no_argument, NULL, OPTION_VERSION}, - {"warn-common", no_argument, NULL, OPTION_WARN_COMMON}, - {"warn-constructors", no_argument, NULL, OPTION_WARN_CONSTRUCTORS}, - {"warn-once", no_argument, NULL, OPTION_WARN_ONCE}, - {"split-by-reloc", required_argument, NULL, OPTION_SPLIT_BY_RELOC}, - {"split-by-file", no_argument, NULL, OPTION_SPLIT_BY_FILE}, - {"whole-archive", no_argument, NULL, OPTION_WHOLE_ARCHIVE}, - - - {NULL, no_argument, NULL, 0} - }; + /* Starting the short option string with '-' is for programs that + expect options and other ARGV-elements in any order and that care about + the ordering of the two. We describe each non-option ARGV-element + as if it were the argument of an option with character code 1. */ + shortopts[0] = '-'; + is = 1; + il = 0; + for (i = 0; i < OPTION_COUNT; i++) + { + if (ld_options[i].shortopt != '\0') + { + shortopts[is] = ld_options[i].shortopt; + ++is; + if (ld_options[i].opt.has_arg == required_argument + || ld_options[i].opt.has_arg == optional_argument) + { + shortopts[is] = ':'; + ++is; + if (ld_options[i].opt.has_arg == optional_argument) + { + shortopts[is] = ':'; + ++is; + } + } + } + if (ld_options[i].opt.name != NULL) + { + longopts[il] = ld_options[i].opt; + ++il; + } + } + shortopts[is] = '\0'; + longopts[il].name = NULL; /* The -G option is ambiguous on different platforms. Sometimes it specifies the largest data size to put into the small data @@ -250,6 +435,9 @@ parse_args (argc, argv) case OPTION_NON_SHARED: config.dynamic_link = false; break; + case OPTION_CREF: + link_info.notice_all = true; + break; case 'd': command_line.force_common_definition = true; break; @@ -275,6 +463,7 @@ parse_args (argc, argv) command_line.embedded_relocs = true; break; case OPTION_EXPORT_DYNAMIC: + case 'E': /* HP/UX compatibility. */ command_line.export_dynamic = true; break; case 'e': @@ -283,6 +472,9 @@ parse_args (argc, argv) case 'F': /* Ignore. */ break; + case OPTION_FORCE_EXE_SUFFIX: + command_line.force_exe_suffix = true; + break; case 'G': { char *end; @@ -317,9 +509,11 @@ parse_args (argc, argv) case 'N': config.text_read_only = false; config.magic_demand_paged = false; + config.dynamic_link = false; break; case 'n': config.magic_demand_paged = false; + config.dynamic_link = false; break; case OPTION_NO_KEEP_MEMORY: link_info.keep_memory = false; @@ -327,6 +521,9 @@ parse_args (argc, argv) case OPTION_NOINHIBIT_EXEC: force_make_executable = true; break; + case OPTION_NO_WHOLE_ARCHIVE: + whole_archive = false; + break; case 'O': /* FIXME "-O<non-digits> <value>" used to set the address of section <non-digits>. Was this for compatibility with @@ -445,7 +642,7 @@ parse_args (argc, argv) set_section_start (".text", optarg); break; case OPTION_TRADITIONAL_FORMAT: - config.traditional_format = true; + link_info.traditional_format = true; break; case OPTION_UR: link_info.relocateable = true; @@ -480,12 +677,18 @@ parse_args (argc, argv) case OPTION_WARN_CONSTRUCTORS: config.warn_constructors = true; break; + case OPTION_WARN_MULTIPLE_GP: + config.warn_multiple_gp = true; + break; case OPTION_WARN_ONCE: config.warn_once = true; break; case OPTION_WHOLE_ARCHIVE: whole_archive = true; break; + case OPTION_WRAP: + add_wrap (optarg); + break; case 'X': link_info.discard = discard_l; break; @@ -579,3 +782,100 @@ set_section_start (sect, valstr) lang_section_start (sect, exp_intop (val)); } +/* Print help messages for the options. */ + +static void +help () +{ + int i; + const char **targets, **pp; + + printf ("Usage: %s [options] file...\n", program_name); + + printf ("Options:\n"); + for (i = 0; i < OPTION_COUNT; i++) + { + if (ld_options[i].doc != NULL) + { + boolean comma; + int len; + int j; + + printf (" "); + + comma = false; + len = 2; + + j = i; + do + { + if (ld_options[j].shortopt != '\0' + && ld_options[j].control != NO_HELP) + { + printf ("%s-%c", comma ? ", " : "", ld_options[j].shortopt); + len += (comma ? 2 : 0) + 2; + if (ld_options[j].arg != NULL) + { + if (ld_options[j].opt.has_arg != optional_argument) + { + printf (" "); + ++len; + } + printf ("%s", ld_options[j].arg); + len += strlen (ld_options[j].arg); + } + comma = true; + } + ++j; + } + while (j < OPTION_COUNT && ld_options[j].doc == NULL); + + j = i; + do + { + if (ld_options[j].opt.name != NULL + && ld_options[j].control != NO_HELP) + { + printf ("%s-%s%s", + comma ? ", " : "", + ld_options[j].control == TWO_DASHES ? "-" : "", + ld_options[j].opt.name); + len += ((comma ? 2 : 0) + + 1 + + (ld_options[j].control == TWO_DASHES ? 1 : 0) + + 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); + } + comma = true; + } + ++j; + } + while (j < OPTION_COUNT && ld_options[j].doc == NULL); + + if (len >= 30) + { + printf ("\n"); + len = 0; + } + + for (; len < 30; len++) + putchar (' '); + + printf ("%s\n", ld_options[i].doc); + } + } + + 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); + ldemul_list_emulations (stdout); + printf ("\n"); +} diff --git a/gnu/usr.bin/binutils/ld/mac-ld.r b/gnu/usr.bin/binutils/ld/mac-ld.r index 8500a8057f2..b316fc5f193 100644 --- a/gnu/usr.bin/binutils/ld/mac-ld.r +++ b/gnu/usr.bin/binutils/ld/mac-ld.r @@ -1,3 +1,29 @@ +/* Resources for GNU LD. */ + +#include "SysTypes.r" + +/* Version resources. */ + +resource 'vers' (1) { + 0, + 0, + 0, + 0, + verUs, + VERSION_STRING, + VERSION_STRING " (C) 1986-95 FSF, Inc." +}; + +resource 'vers' (2, purgeable) { + 0, + 0, + 0, + 0, + verUs, + VERSION_STRING, + "GLD " VERSION_STRING " for MPW" +}; + #ifdef WANT_CFRG #include "CodeFragmentTypes.r" @@ -9,7 +35,7 @@ resource 'cfrg' (0) { kNoVersionNum, kNoVersionNum, 0, 0, kIsApp, kOnDiskFlat, kZeroOffset, kWholeFork, - "ld" + PROG_NAME } }; diff --git a/gnu/usr.bin/binutils/ld/mpw-config.in b/gnu/usr.bin/binutils/ld/mpw-config.in index 45fc41f3d99..ff45f969354 100644 --- a/gnu/usr.bin/binutils/ld/mpw-config.in +++ b/gnu/usr.bin/binutils/ld/mpw-config.in @@ -4,18 +4,22 @@ If "{target_canonical}" =~ /m68k-apple-macos/ Set emulname m68kcoff forward-include "{srcdir}"mpw-em68kcoff.c em68kcoff.c Set emulation_ofiles "{o}"em68kcoff.c.o + Else If "{target_canonical}" =~ /powerpc-apple-macos/ Set emulname ppcmacos - forward-include "{srcdir}"mpw-eppcmacos.c eppcmacos.c + forward-include "{srcdir}"mpw-eppcmac.c eppcmacos.c Set emulation_ofiles "{o}"eppcmacos.c.o + Else If "{target_canonical}" =~ /i386-unknown-go32/ Set emulname i386go32 forward-include "{srcdir}"mpw-ei386go32.c ei386go32.c Set emulation_ofiles "{o}"ei386go32.c.o -Else If "{target_canonical}" =~ /mips-idt-ecoff/ + +Else If "{target_canonical}" =~ /mips-\Option-x-\Option-x/ Set emulname mipsidt forward-include "{srcdir}"mpw-emipsidt.c emipsidt.c Set emulation_ofiles "{o}"emipsidt.c.o + Else If "{target_canonical}" =~ /sh-hitachi-hms/ Set emulname sh forward-include "{srcdir}"mpw-esh.c esh.c diff --git a/gnu/usr.bin/binutils/ld/mpw-eppcmacos.c b/gnu/usr.bin/binutils/ld/mpw-eppcmacos.c deleted file mode 100644 index 9bc98127368..00000000000 --- a/gnu/usr.bin/binutils/ld/mpw-eppcmacos.c +++ /dev/null @@ -1,841 +0,0 @@ -/* This file is is generated by a shell script. DO NOT EDIT! */ - -/* AIX emulation code for ppcmacos - Copyright (C) 1991, 1993, 1995 Free Software Foundation, Inc. - Written by Steve Chamberlain <sac@cygnus.com> - AIX support by Ian Lance Taylor <ian@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_ppcmacos - -#include "bfd.h" -#include "sysdep.h" -#include "libiberty.h" -#include "getopt.h" -#include "bfdlink.h" - -#include <ctype.h> - -#include "ld.h" -#include "ldmain.h" -#include "ldemul.h" -#include "ldfile.h" -#include "ldmisc.h" -#include "ldexp.h" -#include "ldlang.h" - -static void gldppcmacos_before_parse PARAMS ((void)); -static int gldppcmacos_parse_args PARAMS ((int, char **)); -static void gldppcmacos_before_allocation PARAMS ((void)); -static void gldppcmacos_read_file PARAMS ((const char *, boolean)); -static void gldppcmacos_free PARAMS ((PTR)); -static char *gldppcmacos_get_script PARAMS ((int *isfile)); - -/* The file alignment required for each section. */ -static unsigned long file_align; - -/* The maximum size the stack is permitted to grow. This is stored in - the a.out header. */ -static unsigned long maxstack; - -/* The maximum data size. This is stored in the a.out header. */ -static unsigned long maxdata; - -/* Whether to perform garbage collection. */ -static int gc = 1; - -/* The module type to use. */ -static unsigned short modtype = ('1' << 8) | 'L'; - -/* Whether the .text section must be read-only (i.e., no relocs - permitted). */ -static int textro; - -/* Structure used to hold import or export file list. */ - -struct filelist -{ - struct filelist *next; - const char *name; -}; - -/* List of import files. */ -struct filelist *import_files; - -/* List of export files. */ -struct filelist *export_files; - -static void -gldppcmacos_before_parse() -{ -#ifndef TARGET_ /* I.e., if not generic. */ - ldfile_output_architecture = bfd_arch_powerpc; -#endif /* not TARGET_ */ -} - -/* Handle AIX specific options. */ - -static int -gldppcmacos_parse_args (argc, argv) - int argc; - char **argv; -{ - int prevoptind = optind; - int prevopterr = opterr; - int longind; - int optc; - long val; - char *end; - -#define OPTION_IGNORE (300) -#define OPTION_AUTOIMP (OPTION_IGNORE + 1) -#define OPTION_ERNOTOK (OPTION_AUTOIMP + 1) -#define OPTION_EROK (OPTION_ERNOTOK + 1) -#define OPTION_EXPORT (OPTION_EROK + 1) -#define OPTION_IMPORT (OPTION_EXPORT + 1) -#define OPTION_MAXDATA (OPTION_IMPORT + 1) -#define OPTION_MAXSTACK (OPTION_MAXDATA + 1) -#define OPTION_MODTYPE (OPTION_MAXSTACK + 1) -#define OPTION_NOAUTOIMP (OPTION_MODTYPE + 1) -#define OPTION_NOSTRCMPCT (OPTION_NOAUTOIMP + 1) -#define OPTION_STRCMPCT (OPTION_NOSTRCMPCT + 1) - - static struct option longopts[] = { - {"basis", no_argument, NULL, OPTION_IGNORE}, - {"bautoimp", no_argument, NULL, OPTION_AUTOIMP}, - {"bcomprld", no_argument, NULL, OPTION_IGNORE}, - {"bcrld", no_argument, NULL, OPTION_IGNORE}, - {"bcror31", no_argument, NULL, OPTION_IGNORE}, - {"bD", required_argument, NULL, OPTION_MAXDATA}, - {"bE", required_argument, NULL, OPTION_EXPORT}, - {"bernotok", no_argument, NULL, OPTION_ERNOTOK}, - {"berok", no_argument, NULL, OPTION_EROK}, - {"berrmsg", no_argument, NULL, OPTION_IGNORE}, - {"bexport", required_argument, NULL, OPTION_EXPORT}, - {"bf", no_argument, NULL, OPTION_ERNOTOK}, - {"bgc", no_argument, &gc, 1}, - {"bh", required_argument, NULL, OPTION_IGNORE}, - {"bhalt", required_argument, NULL, OPTION_IGNORE}, - {"bI", required_argument, NULL, OPTION_IMPORT}, - {"bimport", required_argument, NULL, OPTION_IMPORT}, - {"bmaxdata", required_argument, NULL, OPTION_MAXDATA}, - {"bmaxstack", required_argument, NULL, OPTION_MAXSTACK}, - {"bM", required_argument, NULL, OPTION_MODTYPE}, - {"bmodtype", required_argument, NULL, OPTION_MODTYPE}, - {"bnoautoimp", no_argument, NULL, OPTION_NOAUTOIMP}, - {"bnodelcsect", no_argument, NULL, OPTION_IGNORE}, - {"bnogc", no_argument, &gc, 0}, - {"bnso", no_argument, NULL, OPTION_NOAUTOIMP}, - {"bnostrcmpct", no_argument, NULL, OPTION_NOSTRCMPCT}, - {"bnotextro", no_argument, &textro, 0}, - {"bnro", no_argument, &textro, 0}, - {"bro", no_argument, &textro, 1}, - {"bS", required_argument, NULL, OPTION_MAXSTACK}, - {"bso", no_argument, NULL, OPTION_AUTOIMP}, - {"bstrcmpct", no_argument, NULL, OPTION_STRCMPCT}, - {"btextro", no_argument, &textro, 1}, - {NULL, no_argument, NULL, 0} - }; - - /* Options supported by the AIX linker which we do not support: -f, - -S, -v, -Z, -bbindcmds, -bbinder, -bbindopts, -bcalls, -bcaps, - -bcror15, -bdebugopt, -bdbg, -bdelcsect, -bex?, -bfilelist, -bfl, - -bgcbypass, -bglink, -binsert, -bi, -bloadmap, -bl, -bmap, -bnl, - -bnobind, -bnocomprld, -bnocrld, -bnoerrmsg, -bnoglink, - -bnoloadmap, -bnl, -bnoobjreorder, -bnoquiet, -bnoreorder, - -bnotypchk, -bnox, -bquiet, -bR, -brename, -breorder, -btypchk, - -bx, -bX, -bxref. */ - - /* If the first option starts with -b, change the first : to an =. - The AIX linker uses : to separate the option from the argument; - changing it to = lets us treat it as a getopt option. */ - if (optind < argc && strncmp (argv[optind], "-b", 2) == 0) - { - char *s; - - for (s = argv[optind]; *s != '\0'; s++) - { - if (*s == ':') - { - *s = '='; - break; - } - } - } - - opterr = 0; - optc = getopt_long_only (argc, argv, "-D:H:KT:z", longopts, &longind); - opterr = prevopterr; - - switch (optc) - { - default: - optind = prevoptind; - return 0; - - case 0: - /* Long option which just sets a flag. */ - break; - - case 'D': - val = strtol (optarg, &end, 0); - if (*end != '\0') - einfo ("%P: warning: ignoring invalid -D number %s\n", optarg); - else if (val != -1) - lang_section_start (".data", exp_intop (val)); - break; - - case 'H': - val = strtoul (optarg, &end, 0); - if (*end != '\0' - || (val & (val - 1)) != 0) - einfo ("%P: warning: ignoring invalid -H number %s\n", optarg); - else - file_align = val; - break; - - case 'K': - case 'z': - /* FIXME: This should use the page size for the target system. */ - file_align = 4096; - break; - - case 'T': - /* On AIX this is the same as GNU ld -Ttext. When we see -T - number, we assume the AIX option is intended. Otherwise, we - assume the usual GNU ld -T option is intended. We can't just - ignore the AIX option, because gcc passes it to the linker. */ - val = strtoul (optarg, &end, 0); - if (*end != '\0') - { - optind = prevoptind; - return 0; - } - lang_section_start (".text", exp_intop (val)); - break; - - case OPTION_IGNORE: - break; - - case OPTION_AUTOIMP: - link_info.static_link = false; - break; - - case OPTION_ERNOTOK: - force_make_executable = false; - break; - - case OPTION_EROK: - force_make_executable = true; - break; - - case OPTION_EXPORT: - case OPTION_IMPORT: - { - struct filelist *n; - struct filelist **flpp; - - n = (struct filelist *) xmalloc (sizeof (struct filelist)); - n->next = NULL; - n->name = optarg; - if (optc == OPTION_EXPORT) - flpp = &export_files; - else - flpp = &import_files; - while (*flpp != NULL) - flpp = &(*flpp)->next; - *flpp = n; - } - break; - - case OPTION_MAXDATA: - val = strtoul (optarg, &end, 0); - if (*end != '\0') - einfo ("%P: warning: ignoring invalid -bmaxdata number %s\n", - optarg); - else - maxdata = val; - break; - - case OPTION_MAXSTACK: - val = strtoul (optarg, &end, 0); - if (*end != '\0') - einfo ("%P: warning: ignoring invalid -bmaxstack number %s\n", - optarg); - else - maxstack = val; - break; - - case OPTION_MODTYPE: - if (*optarg == 'S') - { - link_info.shared = true; - ++optarg; - } - if (*optarg == '\0' || optarg[1] == '\0') - einfo ("%P: warning: ignoring invalid module type %s\n", optarg); - else - modtype = (*optarg << 8) | optarg[1]; - break; - - case OPTION_NOAUTOIMP: - link_info.static_link = true; - break; - - case OPTION_NOSTRCMPCT: - config.traditional_format = true; - break; - - case OPTION_STRCMPCT: - config.traditional_format = false; - break; - } - - return 1; -} - -/* This is called after the sections have been attached to output - sections, but before any sizes or addresses have been set. */ - -static void -gldppcmacos_before_allocation () -{ - struct filelist *fl; - char *libpath; - - /* Handle the import and export files, if any. */ - for (fl = import_files; fl != NULL; fl = fl->next) - gldppcmacos_read_file (fl->name, true); - for (fl = export_files; fl != NULL; fl = fl->next) - gldppcmacos_read_file (fl->name, false); - - /* We need to build LIBPATH from the -L arguments. If any -rpath - arguments were used, though, we use -rpath instead, as a GNU - extension. */ - if (command_line.rpath != NULL) - libpath = command_line.rpath; - else if (search_head == NULL) - libpath = (char *) ""; - else - { - size_t len; - search_dirs_type *search; - - len = strlen (search_head->name); - libpath = xmalloc (len + 1); - strcpy (libpath, search_head->name); - for (search = search_head->next; search != NULL; search = search->next) - { - size_t nlen; - - nlen = strlen (search->name); - libpath = xrealloc (libpath, len + nlen + 2); - libpath[len] = ':'; - strcpy (libpath + len + 1, search->name); - len += nlen + 1; - } - } - - /* Let the XCOFF backend set up the .loader section. */ - if (! bfd_xcoff_size_dynamic_sections (output_bfd, &link_info, libpath, - entry_symbol, file_align, - maxstack, maxdata, - gc ? true : false, - modtype, - textro ? true : false)) - einfo ("%P%F: failed to set dynamic section sizes: %E\n"); -} - -/* Read an import or export file. */ - -static void -gldppcmacos_read_file (filename, import) - const char *filename; - boolean import; -{ - struct obstack *o; - FILE *f; - int lineno; - int c; - boolean keep; - const char *imppath; - const char *impfile; - const char *impmember; - - o = (struct obstack *) xmalloc (sizeof (struct obstack)); - obstack_specify_allocation (o, 0, 0, xmalloc, gldppcmacos_free); - - f = fopen (filename, "r"); - if (f == NULL) - { - bfd_set_error (bfd_error_system_call); - einfo ("%F%s: %E\n", filename); - } - - keep = false; - - imppath = NULL; - impfile = NULL; - impmember = NULL; - - lineno = 0; - while ((c = getc (f)) != EOF) - { - char *s; - char *symname; - boolean syscall; - bfd_vma address; - struct bfd_link_hash_entry *h; - - if (c != '\n') - { - obstack_1grow (o, c); - continue; - } - - obstack_1grow (o, '\0'); - ++lineno; - - s = (char *) obstack_base (o); - while (isspace ((unsigned char) *s)) - ++s; - if (*s == '\0' - || *s == '*' - || (*s == '#' && s[1] == ' ') - || (! import && *s == '#' && s[1] == '!')) - { - obstack_free (o, obstack_base (o)); - continue; - } - - if (*s == '#' && s[1] == '!') - { - s += 2; - while (isspace ((unsigned char) *s)) - ++s; - if (*s == '\0') - { - imppath = NULL; - impfile = NULL; - impmember = NULL; - obstack_free (o, obstack_base (o)); - } - else if (*s == '(') - einfo ("%F%s%d: #! ([member]) is not supported in import files", - filename, lineno); - else - { - char cs; - char *file; - - (void) obstack_finish (o); - keep = true; - imppath = s; - impfile = NULL; - while (! isspace ((unsigned char) *s) && *s != '(' && *s != '\0') - { - if (*s == '/') - file = s + 1; - ++s; - } - if (file != NULL) - { - file[-1] = '\0'; - impfile = file; - if (imppath == file - 1) - imppath = "/"; - } - else - { - impfile = imppath; - imppath = ""; - } - cs = *s; - *s = '\0'; - while (isspace ((unsigned char) cs)) - { - ++s; - cs = *s; - } - if (cs != '(') - { - impmember = ""; - if (cs != '\0') - einfo ("%s:%d: warning: syntax error in import file\n", - filename, lineno); - } - else - { - ++s; - impmember = s; - while (*s != ')' && *s != '\0') - ++s; - if (*s == ')') - *s = '\0'; - else - einfo ("%s:%d: warning: syntax error in import file\n", - filename, lineno); - } - } - - continue; - } - - /* This is a symbol to be imported or exported. */ - symname = s; - syscall = false; - address = (bfd_vma) -1; - - while (! isspace ((unsigned char) *s) && *s != '\0') - ++s; - if (*s != '\0') - { - char *se; - - *s++ = '\0'; - - while (isspace ((unsigned char) *s)) - ++s; - - se = s; - while (! isspace ((unsigned char) *se) && *se != '\0') - ++se; - if (*se != '\0') - { - *se++ = '\0'; - while (isspace ((unsigned char) *se)) - ++se; - if (*se != '\0') - einfo ("%s%d: warning: syntax error in import/export file\n", - filename, lineno); - } - - if (strcasecmp (s, "svc") == 0 - || strcasecmp (s, "syscall") == 0) - syscall = true; - else - { - char *end; - - address = strtoul (s, &end, 0); - if (*end != '\0') - einfo ("%s:%d: warning: syntax error in import/export file\n", - filename, lineno); - } - } - - h = bfd_link_hash_lookup (link_info.hash, symname, false, false, true); - if (h == NULL || h->type == bfd_link_hash_new) - { - /* We can just ignore attempts to import an unreferenced - symbol. */ - if (! import) - einfo ("%X%s:%d: attempt to export undefined symbol %s\n", - filename, lineno, symname); - } - else if (import) - { - if (! bfd_xcoff_import_symbol (output_bfd, &link_info, h, address, - imppath, impfile, impmember)) - einfo ("%X%s:%d: failed to import symbol %s: %E\n", - filename, lineno, symname); - } - else - { - if (! bfd_xcoff_export_symbol (output_bfd, &link_info, h, syscall)) - einfo ("%X%s:%d: failed to export symbol %s: %E\n", - filename, lineno, symname); - } - - obstack_free (o, obstack_base (o)); - } - - if (obstack_object_size (o) > 0) - { - einfo ("%s:%d: warning: ignoring unterminated last line\n", - filename, lineno); - obstack_free (o, obstack_base (o)); - } - - if (! keep) - { - obstack_free (o, NULL); - free (o); - } -} - -/* This routine saves us from worrying about declaring free. */ - -static void -gldppcmacos_free (p) - PTR p; -{ - free (p); -} - -static char * -gldppcmacos_get_script(isfile) - int *isfile; -{ - *isfile = 0; - - if (link_info.relocateable == true && config.build_constructors == true) - return -"OUTPUT_FORMAT(\"xcoff-powermac\")\n\ -OUTPUT_ARCH(powerpc)\n\ -ENTRY(__start)\n\ -SECTIONS\n\ -{\n\ - .pad 0 : { *(.pad) }\n\ - .text 0 : {\n\ - *(.text)\n\ - *(.pr)\n\ - *(.ro)\n\ - *(.db)\n\ - *(.gl)\n\ - *(.xo)\n\ - *(.ti)\n\ - *(.tb)\n\ - }\n\ - .data 0 : {\n\ - *(.data)\n\ - *(.rw)\n\ - *(.sv)\n\ - *(.ua)\n\ - *(.ds)\n\ - *(.tc0)\n\ - *(.tc)\n\ - *(.td)\n\ - }\n\ - .bss : {\n\ - *(.bss)\n\ - *(.bs)\n\ - *(.uc)\n\ - *(COMMON)\n\ - }\n\ - .loader 0 : {\n\ - *(.loader)\n\ - }\n\ - .debug 0 : {\n\ - *(.debug)\n\ - }\n\ -}\n\n" - ; else if (link_info.relocateable == true) return -"OUTPUT_FORMAT(\"xcoff-powermac\")\n\ -OUTPUT_ARCH(powerpc)\n\ -ENTRY(__start)\n\ -SECTIONS\n\ -{\n\ - .pad 0 : { *(.pad) }\n\ - .text 0 : {\n\ - *(.text)\n\ - *(.pr)\n\ - *(.ro)\n\ - *(.db)\n\ - *(.gl)\n\ - *(.xo)\n\ - *(.ti)\n\ - *(.tb)\n\ - }\n\ - .data 0 : {\n\ - *(.data)\n\ - *(.rw)\n\ - *(.sv)\n\ - *(.ua)\n\ - *(.ds)\n\ - *(.tc0)\n\ - *(.tc)\n\ - *(.td)\n\ - }\n\ - .bss : {\n\ - *(.bss)\n\ - *(.bs)\n\ - *(.uc)\n\ - *(COMMON)\n\ - }\n\ - .loader 0 : {\n\ - *(.loader)\n\ - }\n\ - .debug 0 : {\n\ - *(.debug)\n\ - }\n\ -}\n\n" - ; else if (!config.text_read_only) return -"OUTPUT_FORMAT(\"xcoff-powermac\")\n\ -OUTPUT_ARCH(powerpc)\n\ - SEARCH_DIR(/usr/local/powerpc-apple-macos/lib);\n\ -ENTRY(__start)\n\ -SECTIONS\n\ -{\n\ - .pad 0 : { *(.pad) }\n\ - .text : {\n\ - PROVIDE (_text = .);\n\ - *(.text)\n\ - *(.pr)\n\ - *(.ro)\n\ - *(.db)\n\ - *(.gl)\n\ - *(.xo)\n\ - *(.ti)\n\ - *(.tb)\n\ - PROVIDE (_etext = .);\n\ - }\n\ - .data 0 : {\n\ - PROVIDE (_data = .);\n\ - *(.data)\n\ - *(.rw)\n\ - *(.sv)\n\ - *(.ua)\n\ - *(.ds)\n\ - *(.tc0)\n\ - *(.tc)\n\ - *(.td)\n\ - PROVIDE (_edata = .);\n\ - }\n\ - .bss : {\n\ - *(.bss)\n\ - *(.bs)\n\ - *(.uc)\n\ - *(COMMON)\n\ - PROVIDE (_end = .);\n\ - PROVIDE (end = .);\n\ - }\n\ - .loader 0 : {\n\ - *(.loader)\n\ - }\n\ - .debug 0 : {\n\ - *(.debug)\n\ - }\n\ -}\n\n" - ; else if (!config.magic_demand_paged) return -"OUTPUT_FORMAT(\"xcoff-powermac\")\n\ -OUTPUT_ARCH(powerpc)\n\ - SEARCH_DIR(/usr/local/powerpc-apple-macos/lib);\n\ -ENTRY(__start)\n\ -SECTIONS\n\ -{\n\ - .pad 0 : { *(.pad) }\n\ - .text : {\n\ - PROVIDE (_text = .);\n\ - *(.text)\n\ - *(.pr)\n\ - *(.ro)\n\ - *(.db)\n\ - *(.gl)\n\ - *(.xo)\n\ - *(.ti)\n\ - *(.tb)\n\ - PROVIDE (_etext = .);\n\ - }\n\ - .data 0 : {\n\ - PROVIDE (_data = .);\n\ - *(.data)\n\ - *(.rw)\n\ - *(.sv)\n\ - *(.ua)\n\ - *(.ds)\n\ - *(.tc0)\n\ - *(.tc)\n\ - *(.td)\n\ - PROVIDE (_edata = .);\n\ - }\n\ - .bss : {\n\ - *(.bss)\n\ - *(.bs)\n\ - *(.uc)\n\ - *(COMMON)\n\ - PROVIDE (_end = .);\n\ - PROVIDE (end = .);\n\ - }\n\ - .loader 0 : {\n\ - *(.loader)\n\ - }\n\ - .debug 0 : {\n\ - *(.debug)\n\ - }\n\ -}\n\n" - ; else return -"OUTPUT_FORMAT(\"xcoff-powermac\")\n\ -OUTPUT_ARCH(powerpc)\n\ - SEARCH_DIR(/usr/local/powerpc-apple-macos/lib);\n\ -ENTRY(__start)\n\ -SECTIONS\n\ -{\n\ - .pad 0 : { *(.pad) }\n\ - .text : {\n\ - PROVIDE (_text = .);\n\ - *(.text)\n\ - *(.pr)\n\ - *(.ro)\n\ - *(.db)\n\ - *(.gl)\n\ - *(.xo)\n\ - *(.ti)\n\ - *(.tb)\n\ - PROVIDE (_etext = .);\n\ - }\n\ - .data 0 : {\n\ - PROVIDE (_data = .);\n\ - *(.data)\n\ - *(.rw)\n\ - *(.sv)\n\ - *(.ua)\n\ - *(.ds)\n\ - *(.tc0)\n\ - *(.tc)\n\ - *(.td)\n\ - PROVIDE (_edata = .);\n\ - }\n\ - .bss : {\n\ - *(.bss)\n\ - *(.bs)\n\ - *(.uc)\n\ - *(COMMON)\n\ - PROVIDE (_end = .);\n\ - PROVIDE (end = .);\n\ - }\n\ - .loader 0 : {\n\ - *(.loader)\n\ - }\n\ - .debug 0 : {\n\ - *(.debug)\n\ - }\n\ -}\n\n" -; } - -struct ld_emulation_xfer_struct ld_ppcmacos_emulation = -{ - gldppcmacos_before_parse, - syslib_default, - hll_default, - after_parse_default, - after_open_default, - after_allocation_default, - set_output_arch_default, - ldemul_default_target, - gldppcmacos_before_allocation, - gldppcmacos_get_script, - "ppcmacos", - "xcoff-powermac", - 0, /* finish */ - 0, /* create_output_section_statements */ - 0, /* open_dynamic_archive */ - 0, /* place_orphan */ - 0, /* set_symbols */ - gldppcmacos_parse_args, -}; diff --git a/gnu/usr.bin/binutils/ld/mpw-make.sed b/gnu/usr.bin/binutils/ld/mpw-make.sed index f672da09870..3d82a646ba9 100644 --- a/gnu/usr.bin/binutils/ld/mpw-make.sed +++ b/gnu/usr.bin/binutils/ld/mpw-make.sed @@ -54,15 +54,42 @@ /ldemul-list.h/s/"{s}"ldemul-list\.h/"{o}"ldemul-list.h/g /ldemul-list.h/s/^ldemul-list\.h/"{o}"ldemul-list.h/ +# Edit pathnames to emulation files. /"{s}"e.*\.c/s/"{s}"e\([-_a-z0-9]*\)\.c/"{o}"e\1.c/g /^e.*\.c/s/^e\([-_a-z0-9]*\)\.c/"{o}"e\1.c/ +# We can't run genscripts, so don't try. +/{GENSCRIPTS}/s/{GENSCRIPTS}/null-command/ + +# Comment out the TDIRS bits. +/^TDIRS@/s/^/#/ + +# Point at the BFD library directly. +/@BFDLIB@/s/@BFDLIB@/::bfd:libbfd.o/ + +# Don't need this. +/@HLDFLAGS@/s/@HLDFLAGS@// + #/sed.*free/,/> "{o}"ldlex.c.new/c\ # \ Catenate "{o}"lex.yy.c >"{o}"ldlex.c.new # The resource file is called mac-ld.r. /{LD_PROG}.r/s/{LD_PROG}\.r/mac-ld.r/ +/^install \\Option-f /,/^$/c\ +install \\Option-f all install-only\ +\ +install-only \\Option-f\ + If "`Exists "{prefix}"`" == ""\ + Echo "{prefix}" does not exist, cannot install anything\ + Exit 1\ + End If\ + If "`Exists "{bindir}"`" == ""\ + NewFolder "{bindir}"\ + End If\ + Duplicate -y :ld.new "{bindir}"ld\ + + # Remove dependency rebuilding crud. /^.dep /,/# .PHONY /d diff --git a/gnu/usr.bin/binutils/ld/mri.c b/gnu/usr.bin/binutils/ld/mri.c index 1dbb287e82c..7273e015dd7 100644 --- a/gnu/usr.bin/binutils/ld/mri.c +++ b/gnu/usr.bin/binutils/ld/mri.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1991, 92, 93, 94 Free Software Foundation, Inc. +/* Copyright (C) 1991, 92, 93, 94, 95, 1996 Free Software Foundation, Inc. This file is part of GLD, the Gnu Linker. @@ -62,7 +62,6 @@ static void mri_add_to_list PARAMS ((struct section_name_struct **list, const char *name, etree_type *vma, const char *zalias, etree_type *align, etree_type *subalign)); -static void mri_draw_tree PARAMS ((void)); static struct section_name_struct ** lookup (name, list) @@ -135,11 +134,13 @@ mri_base (exp) static int done_tree = 0; -static void +void mri_draw_tree () { if (done_tree) return; + /* We don't bother with memory regions. */ +#if 0 /* Create the regions */ { lang_memory_region_type *r; @@ -149,7 +150,7 @@ mri_draw_tree () r->length = (bfd_size_type) exp_get_vma(0, (bfd_vma) ~((bfd_size_type)0), "length", lang_first_phase_enum); } - +#endif /* Now build the statements for the ldlang machine */ @@ -264,7 +265,7 @@ mri_draw_tree () } } - lang_leave_output_section_statement(0, "long"); + lang_leave_output_section_statement(0, "*default*"); p = p->next; } } @@ -277,8 +278,6 @@ void mri_load (name) CONST char *name; { - mri_draw_tree(); - base = 0; lang_add_input_file(name, lang_input_file_is_file_enum, (char *)NULL); diff --git a/gnu/usr.bin/binutils/ld/mri.h b/gnu/usr.bin/binutils/ld/mri.h index 66f67a5017a..dc3f0f3a190 100644 --- a/gnu/usr.bin/binutils/ld/mri.h +++ b/gnu/usr.bin/binutils/ld/mri.h @@ -1,5 +1,5 @@ /* mri.h -- header file for MRI scripting functions - Copyright 1993 Free Software Foundation, Inc. + Copyright 1993, 95, 1996 Free Software Foundation, Inc. This file is part of GLD, the Gnu Linker. @@ -34,5 +34,6 @@ extern void mri_public PARAMS ((const char *name, etree_type *exp)); extern void mri_align PARAMS ((const char *name, etree_type *exp)); extern void mri_alignmod PARAMS ((const char *name, etree_type *exp)); extern void mri_truncate PARAMS ((unsigned int exp)); +extern void mri_draw_tree PARAMS ((void)); #endif diff --git a/gnu/usr.bin/binutils/ld/scripttempl/alpha.sc b/gnu/usr.bin/binutils/ld/scripttempl/alpha.sc index 3b0c921a45c..44a10c469cd 100644 --- a/gnu/usr.bin/binutils/ld/scripttempl/alpha.sc +++ b/gnu/usr.bin/binutils/ld/scripttempl/alpha.sc @@ -33,6 +33,9 @@ SECTIONS .rdata : { *(.rdata) } + .rconst : { + *(.rconst) + } .pdata : { ${RELOCATING+ _fpdata = .;} *(.pdata) diff --git a/gnu/usr.bin/binutils/ld/scripttempl/aout.sc b/gnu/usr.bin/binutils/ld/scripttempl/aout.sc index 1898badf252..a5b7c188ffb 100644 --- a/gnu/usr.bin/binutils/ld/scripttempl/aout.sc +++ b/gnu/usr.bin/binutils/ld/scripttempl/aout.sc @@ -6,6 +6,7 @@ ${RELOCATING+${LIB_SEARCH_DIRS}} ${STACKZERO+${RELOCATING+${STACKZERO}}} ${SHLIB_PATH+${RELOCATING+${SHLIB_PATH}}} ${RELOCATING+${EXECUTABLE_SYMBOLS}} +${RELOCATING+PROVIDE (__stack = 0);} SECTIONS { ${RELOCATING+. = ${TEXT_START_ADDR};} diff --git a/gnu/usr.bin/binutils/ld/scripttempl/elf.sc b/gnu/usr.bin/binutils/ld/scripttempl/elf.sc index ea7c4c3ba93..91915c96512 100644 --- a/gnu/usr.bin/binutils/ld/scripttempl/elf.sc +++ b/gnu/usr.bin/binutils/ld/scripttempl/elf.sc @@ -23,13 +23,14 @@ 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} +if [ -z "$MACHINE" ]; then OUTPUT_ARCH=${ARCH}; else OUTPUT_ARCH=${ARCH}:${MACHINE}; fi test "$LD_FLAG" = "N" && DATA_ADDR=. INTERP=".interp ${RELOCATING-0} : { *(.interp) }" PLT=".plt ${RELOCATING-0} : { *(.plt) }" cat <<EOF OUTPUT_FORMAT("${OUTPUT_FORMAT}", "${BIG_OUTPUT_FORMAT}", "${LITTLE_OUTPUT_FORMAT}") -OUTPUT_ARCH(${ARCH}) +OUTPUT_ARCH(${OUTPUT_ARCH}) ENTRY(${ENTRY}) ${RELOCATING+${LIB_SEARCH_DIRS}} @@ -86,22 +87,8 @@ SECTIONS ${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} - ALIGN(${MAXPAGESIZE})) - & (${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}};} + the same address within the page on the next page up. */ + ${RELOCATING+. = ${DATA_ADDR-ALIGN(${MAXPAGESIZE}) + (ALIGN(8) & (${MAXPAGESIZE} - 1))};} .data ${RELOCATING-0} : { diff --git a/gnu/usr.bin/binutils/ld/scripttempl/elfppc.sc b/gnu/usr.bin/binutils/ld/scripttempl/elfppc.sc index 13704659303..a2cb2ed178a 100644 --- a/gnu/usr.bin/binutils/ld/scripttempl/elfppc.sc +++ b/gnu/usr.bin/binutils/ld/scripttempl/elfppc.sc @@ -2,9 +2,9 @@ # 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 .ctors .rodata ... +# OTHER_READONLY_SECTIONS - other than .text .init .rodata ... # (e.g., .PARISC.milli) -# OTHER_READWRITE_SECTIONS - other than .data .bss .sdata ... +# 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 @@ -24,8 +24,10 @@ 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=. -INTERP=".interp ${RELOCATING-0} : { *(.interp) }" -PLT=".plt ${RELOCATING-0} : { *(.plt) }" +SBSS2=".sbss2 ${RELOCATING-0} : { *(.sbss2) }" +SDATA2=".sdata2 ${RELOCATING-0} : { *(.sdata2) }" +INTERP=".interp ${RELOCATING-0} : { *(.interp) }" +PLT=".plt ${RELOCATING-0} : { *(.plt) }" cat <<EOF OUTPUT_FORMAT("${OUTPUT_FORMAT}", "${BIG_OUTPUT_FORMAT}", "${LITTLE_OUTPUT_FORMAT}") @@ -40,40 +42,33 @@ ${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);} 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) } - .rel.text ${RELOCATING-0} : { *(.rel.text) } - .rela.text ${RELOCATING-0} : { *(.rela.text) } - .rel.data ${RELOCATING-0} : { *(.rel.data) } - .rela.data ${RELOCATING-0} : { *(.rela.data) } - .rel.rodata ${RELOCATING-0} : { *(.rel.rodata) } - .rela.rodata ${RELOCATING-0} : { *(.rela.rodata) } - .rel.got ${RELOCATING-0} : { *(.rel.got) } - .rela.got ${RELOCATING-0} : { *(.rela.got) } - .rel.got1 ${RELOCATING-0} : { *(.rel.got1) } - .rela.got1 ${RELOCATING-0} : { *(.rela.got1) } - .rel.got2 ${RELOCATING-0} : { *(.rel.got2) } - .rela.got2 ${RELOCATING-0} : { *(.rela.got2) } - .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.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} + .hash ${RELOCATING-0} : { *(.hash) } + .dynsym ${RELOCATING-0} : { *(.dynsym) } + .dynstr ${RELOCATING-0} : { *(.dynstr) } + .rela.text ${RELOCATING-0} : { *(.rela.text) } + .rela.data ${RELOCATING-0} : { *(.rela.data) } + .rela.rodata ${RELOCATING-0} : { *(.rela.rodata) } + .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.sdata2) } + .rela.sbss ${RELOCATING-0} : { *(.rela.sbss2) } + .rela.sdata2 ${RELOCATING-0} : { *(.rela.sdata2) } + .rela.sbss2 ${RELOCATING-0} : { *(.rela.sbss2) } ${DATA_PLT-${PLT}} .text ${RELOCATING-0} : { @@ -82,15 +77,32 @@ SECTIONS /* .gnu.warning sections are handled specially by elf32.em. */ *(.gnu.warning) } =${NOP-0} + .init ${RELOCATING-0} : { *(.init) } =${NOP-0} + .fini ${RELOCATING-0} : { *(.fini) } =${NOP-0} + .rodata ${RELOCATING-0} : { *(.rodata) } + .rodata1 ${RELOCATING-0} : { *(.rodata1) } ${RELOCATING+_etext = .;} ${RELOCATING+PROVIDE (etext = .);} - .fini ${RELOCATING-0} : { *(.fini) } =${NOP-0} - .rodata ${RELOCATING-0} : { *(.rodata) } - .rodata1 ${RELOCATING-0} : { *(.rodata1) } + ${CREATE_SHLIB-${SDATA2}} + ${CREATE_SHLIB-${SBSS2}} ${RELOCATING+${OTHER_READONLY_SECTIONS}} - /* Read-write section, merged into data segment: */ + /* 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}} @@ -100,54 +112,55 @@ SECTIONS .data1 ${RELOCATING-0} : { *(.data1) } ${RELOCATING+${OTHER_READWRITE_SECTIONS}} - ${RELOCATING+_GOT1_START_ = .;} - .got1 ${RELOCATING-0} : { *(.got1) } - ${RELOCATING+_GOT1_END_ = .;} - - .dynamic ${RELOCATING-0} : { *(.dynamic) } + .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. */ + 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+_GOT2_START_ = .;} - .got2 ${RELOCATING-0} : { *(.got2) } + ${RELOCATING+PROVIDE (_GOT2_START_ = .);} + .got2 ${RELOCATING-0} : { *(.got2) } - ${RELOCATING+__CTOR_LIST__ = .;} - .ctors ${RELOCATING-0} : { *(.ctors) } - ${RELOCATING+__CTOR_END__ = .;} + ${RELOCATING+PROVIDE (__CTOR_LIST__ = .);} + .ctors ${RELOCATING-0} : { *(.ctors) } + ${RELOCATING+PROVIDE (__CTOR_END__ = .);} - ${RELOCATING+__DTOR_LIST__ = .;} - .dtors ${RELOCATING-0} : { *(.dtors) } - ${RELOCATING+__DTOR_END__ = .;} + ${RELOCATING+PROVIDE (__DTOR_LIST__ = .);} + .dtors ${RELOCATING-0} : { *(.dtors) } + ${RELOCATING+PROVIDE (__DTOR_END__ = .);} - ${RELOCATING+_FIXUP_START_ = .;} - .fixup ${RELOCATING-0} : { *(.fixup) } - ${RELOCATING+_FIXUP_END_ = .;} - ${RELOCATING+_GOT2_END_ = .;} + ${RELOCATING+PROVIDE (_FIXUP_START_ = .);} + .fixup ${RELOCATING-0} : { *(.fixup) } + ${RELOCATING+PROVIDE (_FIXUP_END_ = .);} + ${RELOCATING+PROVIDE (_GOT2_END_ = .);} + + ${RELOCATING+PROVIDE (_GOT_START_ = .);} + ${RELOCATING+PROVIDE (_GLOBAL_OFFSET_TABLE_ = .);} + .got ${RELOCATING-0} : { *(.got) } + .got.plt ${RELOCATING-0} : { *(.got.plt) } + ${CREATE_SHLIB+${SDATA2}} + ${CREATE_SHLIB+${SBSS2}} + ${RELOCATING+PROVIDE (_GOT_END_ = .);} - ${RELOCATING+_GOT_START_ = .;} - ${RELOCATING+_GLOBAL_OFFSET_TABLE_ = . + 32768;} - ${RELOCATING+_SDA_BASE_ = . + 32768;} - .got ${RELOCATING-0} : { *(.got.plt) *(.got) } ${DATA_PLT+${PLT}} /* 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} : { *(.sdata) } ${RELOCATING+_edata = .;} ${RELOCATING+PROVIDE (edata = .);} .sbss ${RELOCATING-0} : { - ${RELOCATING+__sbss_start = .;} + ${RELOCATING+PROVIDE (__sbss_start = .);} *(.sbss) *(.scommon) - ${RELOCATING+__sbss_end = .;} + ${RELOCATING+PROVIDE (__sbss_end = .);} } - ${RELOCATING+_GOT_END_ = .;} .bss ${RELOCATING-0} : { ${RELOCATING+${OTHER_BSS_SYMBOLS}} - ${RELOCATING+__bss_start = .;} + ${RELOCATING+PROVIDE (__bss_start = .);} *(.dynbss) *(.bss) *(COMMON) @@ -160,6 +173,17 @@ SECTIONS .stab 0 : { *(.stab) } .stabstr 0 : { *(.stabstr) } + /* DWARF debug sections. + Symbols in the .debug DWARF section are relative to the beginning of the + section so we begin .debug at 0. It's not clear yet what needs to happen + for the others. */ + .debug 0 : { *(.debug) } + .debug_srcinfo 0 : { *(.debug_srcinfo) } + .debug_aranges 0 : { *(.debug_aranges) } + .debug_pubnames 0 : { *(.debug_pubnames) } + .debug_sfnames 0 : { *(.debug_sfnames) } + .line 0 : { *(.line) } + /* These must appear regardless of ${RELOCATING}. */ ${OTHER_SECTIONS} } diff --git a/gnu/usr.bin/binutils/ld/scripttempl/h8300.sc b/gnu/usr.bin/binutils/ld/scripttempl/h8300.sc index ca90af7f144..f2f876e2835 100644 --- a/gnu/usr.bin/binutils/ld/scripttempl/h8300.sc +++ b/gnu/usr.bin/binutils/ld/scripttempl/h8300.sc @@ -1,59 +1,69 @@ cat <<EOF OUTPUT_FORMAT("${OUTPUT_FORMAT}") OUTPUT_ARCH(${ARCH}) +ENTRY("_start") -MEMORY { - rom : o = 0x0000, l = 0x7fe0 - duart : o = 0x7fe0, l = 16 - ram : o = 0x8000, l = 28k - topram : o = 0x8000+28k, l = 1k - hmsram : o = 0xfb80, l = 512 - } +MEMORY +{ + /* 0xc4 is a magic entry. We should have the linker just + skip over it one day... */ + vectors : o = 0x0000, l = 0xc4 + magicvectors : o = 0xc4, l = 0x3c + ram : o = 0x0100, l = 0xfdfc + /* The stack starts at the top of main ram. */ + topram : o = 0xfefc, l = 0x4 + /* At the very to of the address space is the 8-bit area. */ + eight : o = 0xff00, l = 0x100 +} SECTIONS { -.text : - { - *(.text) - *(.strings) - ${RELOCATING+ _etext = . ; } +.vectors : { + /* Use something like this to place a specific function's address + into the vector table. + + SHORT(ABSOLUTE(_foobar)) */ + + *(.vectors) + } ${RELOCATING+ > vectors} + +.text : { + *(.rodata) + *(.text) + *(.strings) + ${RELOCATING+ _etext = . ; } } ${RELOCATING+ > ram} -.tors : { +.tors : { ___ctors = . ; *(.ctors) ___ctors_end = . ; ___dtors = . ; *(.dtors) ___dtors_end = . ; -} ${RELOCATING+ > ram} -.data : - { + } ${RELOCATING+ > ram} +.data : { *(.data) + *(.tiny) ${RELOCATING+ _edata = . ; } } ${RELOCATING+ > ram} -.bss : - { +.bss : { ${RELOCATING+ _bss_start = . ;} *(.bss) *(COMMON) ${RELOCATING+ _end = . ; } } ${RELOCATING+ >ram} -.stack : - { +.stack : { ${RELOCATING+ _stack = . ; } *(.stack) } ${RELOCATING+ > topram} - .stab 0 ${RELOCATING+(NOLOAD)} : - { - [ .stab ] - } - .stabstr 0 ${RELOCATING+(NOLOAD)} : - { - [ .stabstr ] - } +.eight : { + *(.eight) + } ${RELOCATING+ > eight} +.stab 0 ${RELOCATING+(NOLOAD)} : { + [ .stab ] + } +.stabstr 0 ${RELOCATING+(NOLOAD)} : { + [ .stabstr ] + } } EOF - - - - diff --git a/gnu/usr.bin/binutils/ld/scripttempl/h8300h.sc b/gnu/usr.bin/binutils/ld/scripttempl/h8300h.sc index 3ecdce083bd..d433d682761 100644 --- a/gnu/usr.bin/binutils/ld/scripttempl/h8300h.sc +++ b/gnu/usr.bin/binutils/ld/scripttempl/h8300h.sc @@ -1,51 +1,76 @@ cat <<EOF OUTPUT_FORMAT("${OUTPUT_FORMAT}") OUTPUT_ARCH(h8300h) +ENTRY("_start") -MEMORY { - rom : o = 0x0000, l = 0x7fe0 - duart : o = 0x7fe0, l = 16 - ram : o = 0x8000, l = 28k - topram : o = 0x8000+28k, l = 1k - hmsram : o = 0xfb80, l = 512 - } +/* The memory size is 256KB to coincide with the simulator. + Don't change either without considering the other. */ + +MEMORY +{ + /* 0xc4 is a magic entry. We should have the linker just + skip over it one day... */ + vectors : o = 0x0000, l = 0xc4 + magicvectors : o = 0xc4, l = 0x3c + /* We still only use 256k as the main ram size. */ + ram : o = 0x0100, l = 0x3fefc + /* The stack starts at the top of main ram. */ + topram : o = 0x3fffc, l = 0x4 + /* This holds variables in the "tiny" sections. */ + tiny : o = 0xff8000, l = 7f00 + /* At the very top of the address space is the 8-bit area. */ + eight : o = 0xffff00, l = 0x100 +} SECTIONS { -.text : - { - *(.text) - *(.strings) - ${RELOCATING+ _etext = . ; } +.vectors : { + /* Use something like this to place a specific function's address + into the vector table. + + LONG(ABSOLUTE(_foobar)) */ + + *(.vectors) + } ${RELOCATING+ > vectors} +.text : { + *(.rodata) + *(.text) + *(.strings) + ${RELOCATING+ _etext = . ; } } ${RELOCATING+ > ram} -.tors : { +.tors : { ___ctors = . ; *(.ctors) ___ctors_end = . ; ___dtors = . ; *(.dtors) ___dtors_end = . ; -} ${RELOCATING+ > ram} -.data : - { + } ${RELOCATING+ > ram} +.data : { *(.data) ${RELOCATING+ _edata = . ; } } ${RELOCATING+ > ram} -.bss : - { +.bss : { ${RELOCATING+ _bss_start = . ;} *(.bss) *(COMMON) ${RELOCATING+ _end = . ; } } ${RELOCATING+ >ram} -.stack : - { +.stack : { ${RELOCATING+ _stack = . ; } *(.stack) } ${RELOCATING+ > topram} +.tiny : { + *(.tiny) + } ${RELOCATING+ > tiny} +.eight : { + *(.eight) + } ${RELOCATING+ > eight} +.stab 0 ${RELOCATING+(NOLOAD)} : { + [ .stab ] + } +.stabstr 0 ${RELOCATING+(NOLOAD)} : { + [ .stabstr ] + } } EOF - - - - diff --git a/gnu/usr.bin/binutils/ld/scripttempl/i386msdos.sc b/gnu/usr.bin/binutils/ld/scripttempl/i386msdos.sc index 783f2d9f913..4d312e7ff92 100644 --- a/gnu/usr.bin/binutils/ld/scripttempl/i386msdos.sc +++ b/gnu/usr.bin/binutils/ld/scripttempl/i386msdos.sc @@ -14,12 +14,10 @@ SECTIONS ${RELOCATING+etext = .;} ${RELOCATING+_etext = .;} ${RELOCATING+__etext = .;} - ${PAD_TEXT+${RELOCATING+. = ${DATA_ALIGNMENT};}} } - ${RELOCATING+. = ${DATA_ALIGNMENT};} - .rodata ${RELOCATING-0} : { *(.rodata) } .data : { + *(.rodata) *(.data) ${CONSTRUCTING+CONSTRUCTORS} ${RELOCATING+edata = .;} diff --git a/gnu/usr.bin/binutils/ld/scripttempl/m68kcoff.sc b/gnu/usr.bin/binutils/ld/scripttempl/m68kcoff.sc index fa9379d81f5..9c2f5561b50 100644 --- a/gnu/usr.bin/binutils/ld/scripttempl/m68kcoff.sc +++ b/gnu/usr.bin/binutils/ld/scripttempl/m68kcoff.sc @@ -1,19 +1,10 @@ -# This is totally made up, from the a29k stuff. If you know better, -# tell us about it. cat <<EOF OUTPUT_FORMAT("${OUTPUT_FORMAT}") ${LIB_SEARCH_DIRS} - -MEMORY { - text : ORIGIN = 0x1000000, LENGTH = 0x1000000 - talias : ORIGIN = 0x2000000, LENGTH = 0x1000000 - data : ORIGIN = 0x3000000, LENGTH = 0x1000000 - mstack : ORIGIN = 0x4000000, LENGTH = 0x1000000 - rstack : ORIGIN = 0x5000000, LENGTH = 0x1000000 -} +PROVIDE (__stack = 0); SECTIONS { - .text : { + .text 0x1000000 : { *(.text) ${RELOCATING+ etext = .;} ${CONSTRUCTING+ __CTOR_LIST__ = .;} @@ -26,27 +17,18 @@ SECTIONS ${CONSTRUCTING+ *(.dtors)} ${CONSTRUCTING+ LONG(0)} ${CONSTRUCTING+ __DTOR_END__ = .;} - *(.lit) - *(.shdata) - } ${RELOCATING+ > text} - .shbss SIZEOF(.text) + ADDR(.text) : { - *(.shbss) - } - .talias : { } ${RELOCATING+ > talias} - .data : { + } + .data : { *(.data) ${RELOCATING+ edata = .}; - } ${RELOCATING+ > data} - .bss SIZEOF(.data) + ADDR(.data) : - { + } + .bss : { ${RELOCATING+ __bss_start = .}; - *(.bss) - *(COMMON) + *(.bss) + *(COMMON) ${RELOCATING+ end = ALIGN(0x8)}; ${RELOCATING+ _end = ALIGN(0x8)}; - } ${RELOCATING+ > data} - .mstack : { } ${RELOCATING+ > mstack} - .rstack : { } ${RELOCATING+ > rstack} + } .stab 0 ${RELOCATING+(NOLOAD)} : { [ .stab ] diff --git a/gnu/usr.bin/binutils/ld/scripttempl/mips.sc b/gnu/usr.bin/binutils/ld/scripttempl/mips.sc index 41e824d9a57..d60aeedfeeb 100644 --- a/gnu/usr.bin/binutils/ld/scripttempl/mips.sc +++ b/gnu/usr.bin/binutils/ld/scripttempl/mips.sc @@ -3,7 +3,12 @@ # These variables may be overridden by the emulation file. The # defaults are appropriate for a DECstation running Ultrix. test -z "$ENTRY" && ENTRY=__start -test -z "$TEXT_START_ADDR" && TEXT_START_ADDR="0x400000 + SIZEOF_HEADERS" + +if [ -z "$EMBEDDED" ]; then + test -z "$TEXT_START_ADDR" && TEXT_START_ADDR="0x400000 + SIZEOF_HEADERS" +else + test -z "$TEXT_START_ADDR" && TEXT_START_ADDR="0x400000" +fi if test "x$LD_FLAG" = "xn" -o "x$LD_FLAG" = "xN"; then DATA_ADDR=. else diff --git a/gnu/usr.bin/binutils/ld/scripttempl/pe.sc b/gnu/usr.bin/binutils/ld/scripttempl/pe.sc index 608cd2d8a43..ee3e0c19d05 100644 --- a/gnu/usr.bin/binutils/ld/scripttempl/pe.sc +++ b/gnu/usr.bin/binutils/ld/scripttempl/pe.sc @@ -1,8 +1,5 @@ # Linker script for PE. -# 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} @@ -11,95 +8,89 @@ ENTRY(_mainCRTStartup) SECTIONS { - .text ${RELOCATING+ __image_base__ + __section_alignment__ } : - { - ${RELOCATING+ *(.init);} - *(.text) - ${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 = .}; - } + { + ${RELOCATING+ *(.init)} + *(.text) + ${CONSTRUCTING+ ___CTOR_LIST__ = .; __CTOR_LIST__ = . ; + LONG (-1); *(.ctors); *(.ctor); LONG (0); } + ${CONSTRUCTING+ ___DTOR_LIST__ = .; __DTOR_LIST__ = . ; + LONG (-1); *(.dtors); *(.dtor); LONG (0); } + ${RELOCATING+ *(.fini)} + /* ??? Why is .gcc_exc here? */ + ${RELOCATING+ *(.gcc_exc)} + ${RELOCATING+ etext = .;} + /* Grouped section support currently must be explicitly provided for + in the linker script. */ + *(.text\$) + } .bss BLOCK(__section_alignment__) : - { - __bss_start__ = . ; - *(.bss) ; - *(COMMON); - __bss_end__ = . ; - ${RELOCATING+ end = .}; - } + { + __bss_start__ = . ; + *(.bss) + *(COMMON) + __bss_end__ = . ; + } .data BLOCK(__section_alignment__) : - { - __data_start__ = . ; - *(.data); - *(.data2); - __data_end__ = . ; - } + { + __data_start__ = . ; + *(.data) + *(.data2) + __data_end__ = . ; + /* Grouped section support currently must be explicitly provided for + in the linker script. */ + *(.data\$) + } .rdata BLOCK(__section_alignment__) : - { + { *(.rdata) - ; + /* Grouped section support currently must be explicitly provided for + in the linker script. */ + *(.rdata\$) } - - - .edata BLOCK(__section_alignment__) : { - *(.edata) ; + .edata BLOCK(__section_alignment__) : + { + *(.edata) } - .junk BLOCK(__section_alignment__) : { + /DISCARD/ BLOCK(__section_alignment__) : + { *(.debug\$S) *(.debug\$T) *(.debug\$F) *(.drectve) - ; } .idata BLOCK(__section_alignment__) : - { + { + /* This cannot currently be handled with grouped sections. + See pe.em:sort_sections. */ *(.idata\$2) *(.idata\$3) *(.idata\$4) *(.idata\$5) *(.idata\$6) *(.idata\$7) - ; } .CRT 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) - ; + /* Grouped sections are used to handle .CRT\$foo. */ + *(.CRT\$) } .rsrc BLOCK(__section_alignment__) : { - *(.rsrc\$01) - *(.rsrc\$02) - ; + /* Grouped sections are used to handle .rsrc\$0[12]. */ + *(.rsrc\$) } - .junk BLOCK(__section_alignment__) : - { - *(.debug\$S) - *(.debug\$T) - *(.debug\$F) - *(.drectve) - ; + + .endjunk BLOCK(__section_alignment__) : + { + /* end is deprecated, don't use it */ + ${RELOCATING+ end = .;} + ${RELOCATING+ __end__ = .;} } .stab BLOCK(__section_alignment__) ${RELOCATING+(NOLOAD)} : @@ -112,13 +103,9 @@ SECTIONS [ .stabstr ] } - .reloc BLOCK(__section_alignment__) : { *(.reloc) - ; } - - } EOF diff --git a/gnu/usr.bin/binutils/ld/scripttempl/ppcpe.sc b/gnu/usr.bin/binutils/ld/scripttempl/ppcpe.sc index bfeca163eaa..12bd9d8cc51 100644 --- a/gnu/usr.bin/binutils/ld/scripttempl/ppcpe.sc +++ b/gnu/usr.bin/binutils/ld/scripttempl/ppcpe.sc @@ -68,6 +68,10 @@ SECTIONS *(.CRT\$XTZ); *(.rdata); *(.xdata); + } + + .edata BLOCK(__section_alignment__) : + { *(.edata); } @@ -129,6 +133,7 @@ SECTIONS *(.idata\$3); __idata4_magic__ = .; *(.idata\$4); + . = ALIGN(4); .toc = . + 32768; *(.private.toc); __idata5_magic__ = .; @@ -148,17 +153,6 @@ SECTIONS ; } - /* We don't do anything useful with codeview debugger support or the - directive section (yet). Hopefully, we junk them correctly. - */ - .junk BLOCK(__section_alignment__) : - { - *(.debug\$S) - *(.debug\$T) - *(.debug\$F) - *(.drectve) - ; - } /* Resources */ .rsrc BLOCK(__section_alignment__) : @@ -168,6 +162,16 @@ SECTIONS ; } + .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. @@ -178,14 +182,16 @@ SECTIONS ; } - .stab BLOCK(__section_alignment__) ${RELOCATING+(NOLOAD)} : + /* We don't do anything useful with codeview debugger support or the + directive section (yet). Hopefully, we junk them correctly. + */ + /DISCARD/ BLOCK(__section_alignment__) : { - [ .stab ] - } - - .stabstr BLOCK(__section_alignment__) ${RELOCATING+(NOLOAD)} : - { - [ .stabstr ] - } + *(.debug\$S) + *(.debug\$T) + *(.debug\$F) + *(.drectve) + ; + } } EOF diff --git a/gnu/usr.bin/binutils/ld/scripttempl/sh.sc b/gnu/usr.bin/binutils/ld/scripttempl/sh.sc index 45bd83b431e..036dd216db2 100644 --- a/gnu/usr.bin/binutils/ld/scripttempl/sh.sc +++ b/gnu/usr.bin/binutils/ld/scripttempl/sh.sc @@ -1,3 +1,13 @@ +TORS=".tors : + { + ___ctors = . ; + *(.ctors) + ___ctors_end = . ; + ___dtors = . ; + *(.dtors) + ___dtors_end = . ; + } > ram" + cat <<EOF OUTPUT_FORMAT("${OUTPUT_FORMAT}") OUTPUT_ARCH(${ARCH}) @@ -15,15 +25,7 @@ SECTIONS *(.strings) ${RELOCATING+ _etext = . ; } } ${RELOCATING+ > ram} - .tors : - { - ___ctors = . ; - *(.ctors) - ___ctors_end = . ; - ___dtors = . ; - *(.dtors) - ___dtors_end = . ; - } ${RELOCATING+ > ram} + ${CONSTRUCTING+${TORS}} .data : { *(.data) diff --git a/gnu/usr.bin/binutils/ld/testsuite/ChangeLog b/gnu/usr.bin/binutils/ld/testsuite/ChangeLog index 38369ce4ef8..4f573a3f23a 100644 --- a/gnu/usr.bin/binutils/ld/testsuite/ChangeLog +++ b/gnu/usr.bin/binutils/ld/testsuite/ChangeLog @@ -1,3 +1,86 @@ +Wed May 1 16:45:13 1996 Ian Lance Taylor <ian@cygnus.com> + + * ld-sh/sh.exp: Use -O when compiling with -mrelax. + +Mon Apr 29 10:33:10 1996 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de> + + * ld-shared/shared.exp: Run the shared library tests on + Linux/m68k. + +Fri Apr 5 16:20:55 1996 Ian Lance Taylor <ian@cygnus.com> + + * ld-shared/shared.exp: Run the shared library tests on Linux. + +Mon Feb 26 12:45:26 1996 Ian Lance Taylor <ian@cygnus.com> + + * ld-shared/shared.exp: Don't use -fpic on MIPS targets. + +Wed Jan 31 15:09:57 1996 Jeffrey A Law (law@cygnus.com) + + * ld-srec/srec.exp: Add xfails for hppa*-*-*elf*. + * ld-undefined/undefined.exp: Likewise. + +Fri Jan 26 18:43:03 1996 Ian Lance Taylor <ian@cygnus.com> + + * ld-undefined/undefined.exp: ELF targets should now pass the + undefined line test. + +Thu Jan 25 15:36:13 1996 Ian Lance Taylor <ian@cygnus.com> + + * ld-empic/empic.exp: Update for change to MIPS disassembler. + +Mon Jan 15 15:05:53 1996 Ian Lance Taylor <ian@cygnus.com> + + * ld-bootstrap/bootstrap.exp: Expect failure for mips*-*-irix5* + when doing the --static test. + * ld-shared/shared.exp: Run tests on mips*-*-irix5*. + +Fri Dec 29 12:33:09 1995 Ian Lance Taylor <ian@cygnus.com> + + * ld-bootstrap/bootstrap.exp: On AIX, don't pass the -bI option + when creating ld-partial.o. + +Tue Dec 26 17:37:23 1995 Ian Lance Taylor <ian@cygnus.com> + + * ld-srec/srec.exp: If powerpc*-*-eabi*, use --defsym to define + __eabi. + +Tue Dec 19 18:01:01 1995 Ian Lance Taylor <ian@cygnus.com> + + * ld-srec/srec.exp: Add setup_xfails for XCOFF targets. + +Fri Dec 15 16:36:17 1995 Ian Lance Taylor <ian@cygnus.com> + + * ld-srec/srec.exp: On a29k targets, use --defsym to define + V_SPILL and V_FILL. + * ld-srec/sr1.c (V_SPILL, V_FILL): Remove definitions. + * ld-srec/sr3.cc: Likewise. + + * ld-srec/srec.exp: Remove i960 COFF setup_xfail. + +Sat Dec 2 01:20:31 1995 Ian Lance Taylor <ian@cygnus.com> + + * ld-srec/srec.exp: Don't use [] in setup_xfail expressions. + +Fri Dec 1 13:18:18 1995 Ian Lance Taylor <ian@cygnus.com> + + * ld-srec/srec.exp: Add setup_xfails for MIPS ELF targets. + +Wed Nov 29 13:01:10 1995 Ian Lance Taylor <ian@cygnus.com> + + * ld-srec/srec.exp: Add setup_xfail for i960 COFF targets. + +Mon Nov 27 14:36:11 1995 Ian Lance Taylor <ian@cygnus.com> + + * ld-srec/srec.exp: Add setup_xfail calls for i[345]86-*-aout*. + + * ld-srec/sr1.c (V_SPILL, V_FILL): Define. + * ld-srec/sr3.cc: Likewise. + +Tue Nov 21 16:05:53 1995 Ian Lance Taylor <ian@cygnus.com> + + * ld-empic/empic.exp: Update for changes in objdump output. + Wed Nov 15 17:42:48 1995 Ian Lance Taylor <ian@cygnus.com> * ld-srec/srec.exp: New tests. diff --git a/gnu/usr.bin/binutils/ld/testsuite/ld-bootstrap/bootstrap.exp b/gnu/usr.bin/binutils/ld/testsuite/ld-bootstrap/bootstrap.exp index d79891df4cd..00331e3ae6a 100644 --- a/gnu/usr.bin/binutils/ld/testsuite/ld-bootstrap/bootstrap.exp +++ b/gnu/usr.bin/binutils/ld/testsuite/ld-bootstrap/bootstrap.exp @@ -1,5 +1,5 @@ # Expect script for LD Bootstrap Tests -# Copyright (C) 1993,1994,1995 Free Software Foundation +# Copyright (C) 1993, 1994, 1995, 1996 Free Software Foundation # # This file is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -38,13 +38,6 @@ foreach flags {"" "--static" "--traditional-format" "--no-keep-memory"} { set testname "bootstrap" } - # On AIX, you need to specify an import list when using --static. - if [istarget "*-*-aix*"] { - if {"$flags" == "--static"} { - set flags "--static -bI:/lib/syscalls.exp" - } - } - # This test can only be run if we have the ld build directory, # since we need the object files. if {$ld != "$objdir/ld.new"} { @@ -57,6 +50,21 @@ foreach flags {"" "--static" "--traditional-format" "--no-keep-memory"} { continue } + # On AIX, you need to specify an import list when using --static. + # You only want the import list when creating the final + # executable. + if [istarget "*-*-aix*"] { + if {"$flags" == "--static"} { + set flags "--static -bI:/lib/syscalls.exp" + } + } + + # On Irix 5, linking with --static only works if all the files are + # compiled using -non_shared. + if {"$flags" == "--static"} { + setup_xfail "mips*-*-irix5*" + } + if ![ld_link $ld tmpdir/ld1 "$flags tmpdir/ld-partial.o $BFDLIB $LIBIBERTY"] { fail $testname continue diff --git a/gnu/usr.bin/binutils/ld/testsuite/ld-empic/empic.exp b/gnu/usr.bin/binutils/ld/testsuite/ld-empic/empic.exp index 937f01aac8f..97cb72ff59b 100644 --- a/gnu/usr.bin/binutils/ld/testsuite/ld-empic/empic.exp +++ b/gnu/usr.bin/binutils/ld/testsuite/ld-empic/empic.exp @@ -99,6 +99,7 @@ if ![ld_simple_link $ld tmpdir/relax "--relax -T $srcdir$subdir/relax.t tmpdir/r # This is a straight function call. All function calls in # this example are to either foo or bar. if "0x$dest != $nm_output(foo) && 0x$dest != $nm_output(bar)" { + send_log "fail 1\n" send_log "$line\n" fail $testname return @@ -109,6 +110,7 @@ if ![ld_simple_link $ld tmpdir/relax "--relax -T $srcdir$subdir/relax.t tmpdir/r # Otherwise, it should be lui, and the next instruction # should be an addiu, followed by an addu to $31. if { [gets $file l] == -1 } { + send_log "fail 2\n" send_log "$line\n" fail $testname return @@ -118,7 +120,8 @@ if ![ld_simple_link $ld tmpdir/relax "--relax -T $srcdir$subdir/relax.t tmpdir/r if [string match "*sll*" $l] { continue } - if ![regexp "lui (\[\$a-z0-9\]+),(\[0-9\]+)" $l whole reg upper] { + if ![regexp "lui (\[\$a-z0-9\]+),(\[0-9a-fA-Fx\]+)" $l whole reg upper] { + send_log "fail 3\n" send_log "$line\n" send_log "$l\n" fail $testname @@ -126,12 +129,14 @@ if ![ld_simple_link $ld tmpdir/relax "--relax -T $srcdir$subdir/relax.t tmpdir/r } if { [gets $file l] == -1 } { + send_log "fail 4\n" send_log "$line\n" fail $testname return } verbose "$l" if ![regexp "addiu \\$reg,\\$reg,(\[-0-9\]+)" $l whole lower] { + send_log "fail 5\n" send_log "$line\n" send_log "$l\n" send_log "addiu \\$reg,\\$reg,(\[-0-9\]+)\n" @@ -140,12 +145,14 @@ if ![ld_simple_link $ld tmpdir/relax "--relax -T $srcdir$subdir/relax.t tmpdir/r } if { [gets $file l] == -1 } { + send_log "fail 6\n" send_log "$line\n" fail $testname return } verbose "$l" if ![regexp "addu \\$reg,\\$reg,\\\$ra" $l] { + send_log "fail 7\n" send_log "$line\n" send_log "$l\n" fail $testname @@ -157,26 +164,34 @@ if ![ld_simple_link $ld tmpdir/relax "--relax -T $srcdir$subdir/relax.t tmpdir/r # function, and the next line can be anything. if { [gets $file l] == -1 } { + send_log "fail 8\n" send_log "$line\n" fail $testname return } - + verbose "$l" if [string match "*jalr*" $l] { set dest [expr 0x$addr + 8 + ($upper << 16) + $lower] if { $dest != $nm_output(foo) && $dest != $nm_output(bar) } { + send_log "fail 9\n" send_log "$line\n" fail $testname return } } else { set dest [expr ($upper << 16) + $lower] - if ![regexp "<\[a-z\]+\\+(\[0-9a-fA-F\]+)>" $label whole offset] { + if ![regexp "<(\[.a-z\]+)\\+(\[0-9a-fA-F\]+)>" $label whole base offset] { + send_log "fail 10\n" send_log "$line\n" fail $testname return } - if "0x$offset + 8 != - $dest" { + set offset 0x$offset + if { $base == ".foo" } { + set offset [expr $offset - ($nm_output(foo) - 0x30)] + } + if { $offset + 8 != - $dest } { + send_log "fail 11\n" send_log "$line\n" fail $testname return @@ -188,6 +203,7 @@ if ![ld_simple_link $ld tmpdir/relax "--relax -T $srcdir$subdir/relax.t tmpdir/r close $file if {$balcnt < 10} { + send_log "fail 12\n" fail $testname } else { verbose "$balcnt bal instructions" diff --git a/gnu/usr.bin/binutils/ld/testsuite/ld-sh/sh.exp b/gnu/usr.bin/binutils/ld/testsuite/ld-sh/sh.exp index 3bd2a654e7a..36e12cc1c0a 100644 --- a/gnu/usr.bin/binutils/ld/testsuite/ld-sh/sh.exp +++ b/gnu/usr.bin/binutils/ld/testsuite/ld-sh/sh.exp @@ -103,7 +103,7 @@ if { [which $CC] == 0 } { } if {![ld_assemble $as "-relax $srcdir$subdir/start.s" tmpdir/start.o] \ - || ![ld_compile $CC "-mrelax $srcdir$subdir/sh2.c" tmpdir/sh2.o]} { + || ![ld_compile $CC "-O -mrelax $srcdir$subdir/sh2.c" tmpdir/sh2.o]} { unresolved $testlink unresolved $testjsr unresolved $testrun diff --git a/gnu/usr.bin/binutils/ld/testsuite/ld-shared/shared.exp b/gnu/usr.bin/binutils/ld/testsuite/ld-shared/shared.exp index 3ad71385919..f6578998c20 100644 --- a/gnu/usr.bin/binutils/ld/testsuite/ld-shared/shared.exp +++ b/gnu/usr.bin/binutils/ld/testsuite/ld-shared/shared.exp @@ -1,5 +1,5 @@ # Expect script for ld-shared tests -# Copyright (C) 1994,1995 Free Software Foundation +# Copyright (C) 1994, 1995, 1996 Free Software Foundation # # This file is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -36,6 +36,11 @@ if { ![istarget i386-*-sysv4*] \ && ![istarget i386-*-elf*] \ && ![istarget i486-*-elf*] \ && ![istarget i586-*-elf*] \ + && ![istarget i386-*-linux*] \ + && ![istarget i486-*-linux*] \ + && ![istarget i586-*-linux*] \ + && ![istarget m68k-*-linux*] \ + && ![istarget mips*-*-irix5*] \ && ![istarget sparc*-*-elf] \ && ![istarget sparc*-*-solaris2*] \ && ![istarget sparc*-*-sunos4*] \ @@ -44,6 +49,16 @@ if { ![istarget i386-*-sysv4*] \ return } +if { [istarget i386-*-linuxaout*] \ + || [istarget i486-*-linuxaout*] \ + || [istarget i586-*-linuxaout*] \ + || [istarget i386-*-linuxoldld*] \ + || [istarget i486-*-linuxoldld*] \ + || [istarget i586-*-linuxoldld*] \ + || [istarget m68k-*-linuxaout*] } { + return +} + set tmpdir tmpdir set SHCFLAG "" @@ -136,23 +151,26 @@ proc shared_test { progname testname main sh1 sh2 dat } { pass "$testname" } -# Unfortunately, the gcc argument is -fpic and the cc argument is -# -KPIC. We have to try both. - -set picflag "-fpic" -send_log "$CC $picflag\n" -verbose "$CC $picflag" -catch "exec $CC $picflag" exec_output -send_log "$exec_output\n" -verbose "--" "$exec_output" -if { [string match "*illegal option*" $exec_output] \ - || [string match "*option ignored*" $exec_output] \ - || [string match "*unrecognized option*" $exec_output] \ - || [string match "*passed to ld*" $exec_output] } { - if [istarget *-*-sunos4*] { - set picflag "-pic" - } else { - set picflag "-KPIC" +if [istarget mips*-*-*] { + set picflag "" +} else { + # Unfortunately, the gcc argument is -fpic and the cc argument is + # -KPIC. We have to try both. + set picflag "-fpic" + send_log "$CC $picflag\n" + verbose "$CC $picflag" + catch "exec $CC $picflag" exec_output + send_log "$exec_output\n" + verbose "--" "$exec_output" + if { [string match "*illegal option*" $exec_output] \ + || [string match "*option ignored*" $exec_output] \ + || [string match "*unrecognized option*" $exec_output] \ + || [string match "*passed to ld*" $exec_output] } { + if [istarget *-*-sunos4*] { + set picflag "-pic" + } else { + set picflag "-KPIC" + } } } verbose "Using $picflag to compile PIC code" diff --git a/gnu/usr.bin/binutils/ld/testsuite/ld-srec/srec.exp b/gnu/usr.bin/binutils/ld/testsuite/ld-srec/srec.exp index 5dfbc0c29ad..f5246f096ef 100644 --- a/gnu/usr.bin/binutils/ld/testsuite/ld-srec/srec.exp +++ b/gnu/usr.bin/binutils/ld/testsuite/ld-srec/srec.exp @@ -210,19 +210,32 @@ proc run_srec_test { test objs } { global sizeof_headers global host_triplet + set flags "" + # If the linker script uses SIZEOF_HEADERS, use a -Ttext argument # to force both the normal link and the S-record link to be put in # the same place. We don't always use -Ttext because it interacts # poorly with a.out. if { $sizeof_headers } { - set targ "-Ttext 0x1000" - } else { - set targ "" + set flags "$flags -Ttext 0x1000" + } + + # The a29k compiled code calls V_SPILL and V_FILL. Since we don't + # need to run this code, but we don't have definitions for those + # functions, we just define them out. + if [istarget a29k*-*-*] { + set flags "$flags --defsym V_SPILL=0 --defsym V_FILL=0" + } + + # PowerPC EABI code calls __eabi. + if [istarget powerpc*-*-eabi*] { + set flags "$flags --defsym __eabi=0" } - if { ![ld_simple_link $ld tmpdir/sr1 "$targ $objs"] \ - || ![ld_simple_link $ld tmpdir/sr2.sr "$targ -oformat srec $objs"] } { + if { ![ld_simple_link $ld tmpdir/sr1 "$flags $objs"] \ + || ![ld_simple_link $ld tmpdir/sr2.sr "$flags -oformat srec $objs"] } { + setup_xfail "hppa*-*-*elf*" fail $test return } @@ -274,6 +287,19 @@ if { ![ld_compile $CC $srcdir/$subdir/sr1.c tmpdir/sr1.o] \ return } +# The i386-aout target is confused: the linker does not put the +# sections where objdump finds them. I don't know which is wrong. +setup_xfail "i*86-*-aout*" + +# These tests fail on the MIPS ELF target because the GP value in the +# .reginfo section is not updated when the S-record version is written +# out. +setup_xfail "mips*-*-elf*" "mips*-*-irix5*" "mips*-*-irix6*" + +# The S-record linker doesn't do the magic TOC handling that XCOFF +# linkers do. +setup_xfail "*-*-aix*" "*-*-xcoff*" + run_srec_test $test1 "tmpdir/sr1.o tmpdir/sr2.o" # Now try linking a C++ program with global constructors and @@ -290,4 +316,9 @@ if ![ld_compile "$CXX $CXXFLAGS -fgnu-linker" $srcdir/$subdir/sr3.cc tmpdir/sr3. return } +# See above. +setup_xfail "i*86-*-aout*" +setup_xfail "mips*-*-elf*" "mips*-*-irix5*" "mips*-*-irix6*" +setup_xfail "*-*-aix*" "*-*-xcoff*" + run_srec_test $test2 "tmpdir/sr3.o" diff --git a/gnu/usr.bin/binutils/ld/testsuite/ld-undefined/undefined.exp b/gnu/usr.bin/binutils/ld/testsuite/ld-undefined/undefined.exp index 2e426dd2ed1..208d679f6c1 100644 --- a/gnu/usr.bin/binutils/ld/testsuite/ld-undefined/undefined.exp +++ b/gnu/usr.bin/binutils/ld/testsuite/ld-undefined/undefined.exp @@ -63,16 +63,12 @@ checkund $mu $testund # a COFF file. setup_xfail "arm*-*-pe*" +# Just doesn't work for PA ELF. No clue why. +setup_xfail "hppa*-*-*elf*" + set mf "tmpdir/undefined.o: In function `function':" checkund $mf $testfn -# ELF targets currently can not get line number information (except -# for MIPS ELF). -setup_xfail "*-*-elf*" "*-*-sysv4*" "*-*-unixware*" "*-*-solaris*" "*-*-gnu*" -setup_xfail "hppa*-*-lites*" "m88*-harris-cxux*" "m88*-*-dgux*" -setup_xfail "powerpc*-*-eabi*" "*-stratus-*" "*-cbm-*" "*-ncr-*" -clear_xfail "mips*-*-elf*" "mips*-*-sysv4*" "mips*-*-gnu*" - # COFF SH gets this test wrong--it reports line 10, because although # the jump is at line 9, the function address, and the reloc, is # stored at the end of the function. @@ -82,5 +78,8 @@ setup_xfail "sh-*-*" # a COFF file. setup_xfail "arm*-*-pe*" +# Just doesn't work for PA ELF. No clue why. +setup_xfail "hppa*-*-*elf*" + set ml "undefined.c:9: undefined reference to `this_function_is_not_defined'" checkund $ml $testline |