(import_files): Make static.
(struct export_symbol_list): Define.
(export_symbols): New static variable.
(gld${EMULATION_NAME}_parse_args): Handle an initial -b option
correctly. Call read_file for an export file.
(gld${EMULATION_NAME}_before_allocation): Call
bfd_xcoff_export_symbol for each export symbol, rather than
calling read_file for each export file.
(gld${EMULATION_NAME}_read_file): For an export file, make the
exported symbols undefined, and store them on the export_symbols
list.
* emultempl/pe.em (gld_${EMULATION_NAME}_parse_args):
Don't hang if last option is unrecognised.
(gld_${EMULATION_NAME}_set_symbols): Insert created
symbols into ABS output section.
(gld${EMULATION_NAME}_after_open): New static function.
(gld${EMULATION_NAME}_before_allocation): Call find_relocs.
(gld${EMULATION_NAME}_find_relocs): New static function.
(gld${EMULATION_NAME}_find_exp_assignment): New static function.
(ld_${EMULATION_NAME}_emulation): Use new after_open function.
* scripttempl/aix.sc: Use CONSTRUCTORS in .data.
* ldctor.c (struct set_info): Move definition into ldctor.h.
(struct set_element): Likewise.
(sets): Make non-static.
(ldctor_add_set_entry): Add name parameter. Save it in the new
set element.
(ldctor_build_sets): Avoid being called twice. Pass set element
name to lang_add_reloc.
* ldctor.h (struct set_info): Move definition here from ldctor.c.
(struct set_element): Likewise. Add new field name.
(sets): Declare.
(ldctor_add_set_entry): Declare new name parameter.
* ldwrite.c (build_link_order): Don't insist that either name or
section be NULL in a lang_reloc_statement.
* ldmain.c (add_to_set): Pass NULL to ldctor_add_new_set_entry for
new name parameter.
(constructor_callback): Pass name to ldctor_add_new_set_entry for
new name parameter.
directory searching code into gld${EMULATION_NAME}_search_dir.
(gld${EMULATION_NAME}_search_dir): New static function, extracted
from gld${EMULATION_NAME}_find_so.
(global_needed, global_found): New static variables.
(gld${EMULATION_NAME}_after_open): New static function.
(gld${EMULATION_NAME}_search_needed): New static function.
(gld${EMULATION_NAME}_try_needed): New static function.
(gld${EMULATION_NAME}_check_needed): New static function.
(ld_${EMULATION_NAME}_emulation): Use new after_open function.
* ld.texinfo, ld.1: Mention -rpath-link on SunOS.
(rs6000-*-aix*): New target; use aixrs6.
* emulparams/aixppc.sh, emulparams/aixrs6.sh: New files.
* emultempl/aix.em: New file.
* scripttempl/aix.sc: New file.
* Makefile.in (ALL_EMULATIONS): Add eaixppc.o and eaixrs6.o.
(eaixppc.c, eaixrs6.c): New targets.
(gld${EMULATION_NAME}_try_needed): Call stat_needed to make sure
that the file has not already been included under another name.
(gld${EMULATION_NAME}_stat_needed): New static function.
* emulparams/sun4.sh (GENERATE_SHLIB_SCRIPT): Define.
* emultempl/sunos.em (gld${EMULATION_NAME}_get_script): Use the
shared library script when appropriate.
* scripttempl/aout.sc: If CREATE_SHLIB is set, start the .text
section at SIZEOF_HEADERS.
* configure.tgt: Add i386lelf to targ_extra_emuls for
i[345]86-*-linuxaout* and i[345]86-*-linuxoldld. For
i[345]86-*-linux*, set targ_emul to i386lelf, and add elf_i386 to
targ_extra_emuls.
* emulparams/i386lelf.sh: New file, a copy of elf_i386.sh.
* emultempl/elf32.em: If TARGET_IS_i386lelf, use autoconf
recommended mechanism to define DIR and struct dirent.
(libcmp): New static function use only when TARGET_IS_i386lelf.
(gld${EMULATION_NAME}_open_dynamic_archive): Likewise.
* Makefile.in (ALL_EMULATIONS): Add ei386lelf.o
(ei386lelf.c): New target.
* configure.host: New file.
* configure.tgt: New file.
* aclocal.m4: New file.
* configure: New file, built by autoconf.
* acconfig.h: New file.
* config.h.in: New file, built by autoheader.
* sysdep.h: New file.
* ld.h: Incorporate old contents of config.h.
* config.h: Remove.
* Makefile.in: Various changes for new configure script. Also:
(CC_FOR_BUILD): Remove.
(ldmain.o): Don't bother to ensure that EMUL is non-empty.
(dep.sed): Use @SRCDIR@, not @srcdir@.
* dep-in.sed: Use @SRCDIR@, not @srcdir@.
* genscripts.sh: Create ldscripts if it does not exist.
* ldemul.c, lexsup.c, mpw-emipsidt.c: Don't include "config.h".
* mpw-esh.c, emultemp/*.em: Likewise.
* ldmain.c: Likewise. Include <ctype.h>. Don't try to set
HAVE_SBRK here.
* config/*.mt, config/*.mh: Remove.
* emultempl/{armpe.sc, i386pe.sc}: Deleted.
* emultempl/pe.sc: New file performs generic PE support and sorts
archive members.
* emulparams/{armpe.sh,i386pe.sh}: Use new file.
* scripttempl/{armpe.sc, i386pe.sc}: Deleted
* scripttempl/pe.sc: New.
* Makefile.in: Use new files.
b
* ldmain.c (main): Always initialize PE info in link_info.
* lexsup.c (OPTION_BASE_FILE): New option.
(parse_args): Handle new option.
* emulparams/armpe.sh: Output pei.
* emultempl/i386pe.em: Add newline to end.
* scripttempl/armpe.sc: Change output and quote the $s.
* scripttempl/i386pe.sc: Change output and quote the $s.
* emulparams/mipsidt.sh (TEMPLATE_NAME): Set to mipsecoff.
* emulparams/mipsidtl.sh (TEMPLATE_NAME): Likewise.
* scripttempl/mips.sc: Put .rel.sdata sections in .text, and
provide __runtime_reloc_start and __runtime_reloc_stop if they are
used. Align _fdata to a 16 byte boundary.
* Makefile.in (emipsidt.c): Depend upon mipsecoff.em rather than
generic.em.
(emipsidtl.c): Likewise.
(check): Pass CC_FOR_HOST and CFLAGS_FOR_HOST to runtest.
* emultempl/linux.em: New file providing support for linking
against Linux shared libraries.
* config/i386-linux.mt (ei386linux.c): Depend upon linux.em.
* emulparams/i386linux.sh (TEMPLATE_NAME): Define as linux.
* ld.h (args_type): Add new field interpreter.
* lexsup.c (parse_args): Add dynamic-linker to longopts, and
handle it.
* ldmain.c (main): Initialize command_line.interpreter to NULL.
* emultempl/elf32.em (gld${EMULATION_NAME}_before_allocation): Get
the ELF backend to return the .interp section. If
command_line.interpreter is not NULL, set the contents of .interp
to it.
* ld.texinfo: Mention -dynamic-linker.
* aout.sc: Don't define __DYNAMIC here. Add new sections used by
shared library support code.
* emultempl/sunos.em: New file.
* emulparams/sun4.sh (TEMPLATE_NAME): Define as sunos.
* Makefile.in (esun4.c): Depend upon sunos.em, not generic.em.
* ld.h (ld_config_type): Add field dynamic_link.
* ldmain.c (main): Initialize config.dynamic_link to false. Warn
on attempts to use -r with -relax, -call_shared or -s.
* lexsup.c (longopts): Separate OPTION_CALL_SHARED from
OPTION_NON_SHARED. Add OPTION_IGNORE. Adjust macro values
accordingly. Add "dy" and "non_shared" options. Change "Qy" to
OPTION_IGNORE for now. Handle OPTION_CALL_SHARED and
OPTION_NON_SHARED by setting dynamic_link field accordingly.
Handle OPTION_IGNORE by ignoring it. Clear dynamic_link field for
-r and -Ur.
* ldfile.c (ldfile_open_file): If config.dynamic_link is true, try
opening a file with a .so extension first.
* emultempl/elf32.em: New file.
* emulparams/elf32_sparc.sh (TEXT_START_ADDR): Change to 0x10000.
(NONPAGED_TEXT_START_ADDR): Likewise.
(TEMPLATE_NAME): Define as elf32.
(DATA_PLT): Define.
* emulparams/elf_i386.sh (TEMPLATE_NAME): Define as elf32.
* scripttempl/elf.sc: Add placement for new dynamic sections.
Don't use CREATE_OBJECT_SYMBOLS. Define _etext, _edata and _end
outside of any section. Don't use ALIGN(8); just let one section
VMA follow another. Put .dynbss in .bss. Don't mention debugging
sections; they'll be handled correctly anyhow.
* Makefile.in (eelf_i386.c): Depend upon elf32.em, not generic.em.
* emultempl/gld960.em, emultempl/gld960c.em, emultempl/lnk960.em,
emultempl/hppaelf.em, emultempl/m88kbcs.em, emultempl/vanilla.em: Ditto.
* Makefile.in: Changed all generated file names.
(ldemul-list.h): Depend on Makefile, not config.status. Changed sed patterns
to handle new filenames.
(file_chain): Add decl.
(hppa_look_for_stubs_in_section): Delete decl.
(hppaelf_finish): Reenable code. Do not pass symbols
down to hppa_look_for_stubs_in_section.
Add comments in several functions as to their purpose and
how they function (or my current best guess). Clean up horrible
spacing and indention that never should have been accepted in the
first place. Add FIXMEs for issues which need to be resolved.
Disable linker-stub generation until it gets fixed. This allows
the linker to at least work on simple code for testing purposes.
it via hppaelf_finish). Prototype moved into ldlang.h.
(lang_process): Move problematic extra call to lang_size_sections
into the PA ELF specific code.
* emultempl/hppaelf.em (hppaelf_finish): Extra call to
lang_size_sections moved here.
* config/ppc-elf32.mt: New file.
* emulparams/elf32ppc.sh: New file.
* emultempl/ppc.em: New file.
* Makefile.in (ALL_EMULATIONS): Added em_elf32ppc.o.
(em_elf32ppc.c): New target; uses elf32ppc.sh, ppc.em and elf.sc.
(EMULATION_OFILES): Added dependencies on ldexp.h and ldlang.h.
* ld.texinfo (Options): Document changes to option syntax.
* Makefile.in: Update dependencies.
* ldver.c (help): Tweak dashes in usage message.
* ldgram.y (%union): Remove unused members.
Remove %tokens for command line options; add ones for input types.
(command_line): Rules removed.
(file): Instead of command line, recognize an
input type indicator, then use the nonterminal for that type.
(defsym_expr): New nonterminal from code formerly in command_line.
* ldlex.h: Declare parser input type enum and variable.
Don't declare parse_line.
* ldlex.l: Remove unused variables. Make some used ones static
and comment them.
(COMMAND): Start state and its rules removed.
At start of yylex, return input state token if at start of input.
(lex_redirect): Don't need to set yyout.
(ldlex_command): Function removed.
* ldmain.c (main): Instead of calling parse_line, set up the
redirections and call yyparse directly.
* ldmisc.c (vfinfo): If there's no input filename, print nothing, not
"command line".
* lexsup.c: Remove #if 0'd code.
(parse_line): Function removed.
(parse_args): Rewrite to use getopt_long_only.
(set_default_dirlist): New function from code formerly in
ldgram.y:command_line.
(set_section_start): New function.
* emultempl/generic.em, emultempl/gld960.em, emultempl/hppaelf.em,
emultempl/lnk960.em, emultempl/m88kbcs.em: Don't enclose
compiled-in link scripts in "{" and "}", as the grammar no longer
wants them to be.