Commit Graph

35 Commits

Author SHA1 Message Date
Ian Lance Taylor
ae02b41c50 * emultempl/elf32.em (gld${EMULATION_NAME}_before_allocation):
Remove unused variable is.
1995-01-27 00:54:51 +00:00
Ian Lance Taylor
5f3548d6c7 update copyrights 1995-01-24 16:01:04 +00:00
Ian Lance Taylor
dc5df17b8a * emultempl/miposecoff.em: New file.
* 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.
1994-12-02 22:28:09 +00:00
Ian Lance Taylor
39a6e282d1 * ld.h (args_type): Add new field embedded_relocs.
* ldemul.h (ldemul_after_open, after_open_default): Declare.
	(ld_emulation_xfer_struct): Add new field after_open.
	* ldemul.c (ldemul_after_open): New function.
	(after_open_default): New function.
	* ldlang.c (lang_process): Call ldemul_after_open.
	* lexsup.c (parse_args): Handle --embedded-relocs.
	* emultempl/elf32.em (ld_${EMULATION_NAME}_emulation): Initialize
	new after_open field to after_open_default.
	* emultempl/generic.em, emultempl/gld960.em: Likewise.
	* emultempl/gld960c.em, emultempl/hppaelf.em: Likewise.
	* emultempl/linux.em, emultempl/m88kbcs.em: Likewise.
	* emultempl/sunos.em, emultempl/vanilla.em: Likewise.
	* ld.texinfo, ld.1: Mention -embedded-relocs.
1994-12-02 22:25:50 +00:00
Ian Lance Taylor
5efddb2e7c * ld.h (args_type): Add field export_dynamic.
* lexsup.c (parse_args): Recognize --export-dynamic.
	* emultempl/elf32.em (gld${EMULATION_NAME}_before_allocation):
	Pass export_dynamic argument to bfd_elf32_size_dynamic_sections.
1994-11-12 20:54:09 +00:00
Ian Lance Taylor
08f20f66c4 Thu Jun 16 14:25:22 1994 Eric Youngdale (ericy@cais.cais.com)
* 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.
1994-06-16 18:36:40 +00:00
Ian Lance Taylor
ece5b08d17 Comment fix. 1994-06-15 21:23:28 +00:00
Ian Lance Taylor
7fb9ca5fc2 Let the user change the dynamic linker used by ELF code.
* 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.
1994-06-15 20:46:43 +00:00
Ian Lance Taylor
b6ef97506c * emultempl/sunos.em: Only look for .so files if doing a dynamic
link.
1994-06-10 20:46:42 +00:00
Ian Lance Taylor
2f4b5b5302 Correct handling of .sa file. 1994-06-02 23:54:37 +00:00
Ian Lance Taylor
ed601bea1c Add support for SunOS shared libraries.
* 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.
1994-06-02 22:01:53 +00:00
Ken Raeburn
c06e55d99a changes from gas-2.3/binutils-2.4 dist (details in branch log msgs, changelogs) 1994-05-27 16:58:05 +00:00
Ian Lance Taylor
2a9fa50cd8 Add support for ELF shared libraries.
* 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.
1994-05-19 18:25:10 +00:00
Ken Raeburn
7009748cab keep gld960c.em 1994-05-08 05:38:24 +00:00
Ken Raeburn
38cae0cd30 * emultempl/generic.em: Use "e" rather than "em_" as prefix for filename.
* 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.
1994-05-06 06:55:35 +00:00
Ian Lance Taylor
0a6ffe9cfd Remove ppc.em; do it all in nlmconv instead. 1994-03-12 03:19:27 +00:00
Jeff Law
2e39abdb96 * emultempl/hppaelf.em: Include elf32-hppa.h.
(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.
1994-02-28 00:30:36 +00:00
Jeff Law
531a5bd189 * emultempl/hppaelf.em: First attempt to clean this file up.
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.
1994-02-26 00:33:30 +00:00
Jeff Law
a62494c41b * ldlang.c (lang_size_sections): No longer static (PA ELF calls
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.
1994-02-25 18:51:35 +00:00
Ian Lance Taylor
3de3daca78 Make correspond to djm's last change. 1994-02-25 03:39:17 +00:00
Ian Lance Taylor
c361ce46c5 * configure.in (powerpc-*-elf*): New target; use ppc-elf32.
* 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.
1994-02-25 03:32:08 +00:00
David MacKenzie
d4e5e3c330 Use getopt instead of lex and yacc to parse the command line.
* 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.
1994-02-25 03:26:25 +00:00
Jeff Law
6cc2ced133 Oops. 1994-02-08 00:40:22 +00:00
Jeff Law
a9cff99018 Renamed hppaosf.em to hppaelf.em 1994-02-08 00:28:05 +00:00
David MacKenzie
744b2885b4 remove cvs lossage 1994-02-06 01:05:54 +00:00
David MacKenzie
52a8ebfe04 * emultempl/lnk960.em (append), emultempl/hppaosf.em
(hppaosf_finish): Call xmalloc, not ldmalloc.
	* ldmain.c (preserve_output): Function removed.
	(main): Do it here instead.
1994-02-05 12:00:15 +00:00
Jeff Law
9dd7d585d6 * ldlang.h (LANG_FOR_EACH_{INPUT,OUTPUT}_SECTION): Delete (unused)
GNU C specific macros.

        * emultempl/hppaosf.em (hppaosf_finish): Expand the only remaining
        call to LANG_FOR_EACH_INPUT_SECTION.
1994-02-05 07:03:48 +00:00
Ian Lance Taylor
4a6afc88bb A major rewrite to move the bulk of the linker into BFD so that
more efficient backend code can be written for specific object
	files.
	* lderror.c, lderror.h, ldindr.c, ldindr.h, ldsym.c, ldsym.h,
	ldwarn.c, ldwarn.h, relax.c, relax.h: Removed.
	* ldctor.c, ldctor.h: Complete rewrite.
	* ldwrite.c, ldwrite.h: Complete rewrite.
	* ld.h (strip_symbols_type, strip_symbols): Removed.  Use
	link_info.strip instead.  Changed all uses.
	(discard_locals_type, discard_locals): Removed.  Use
	link_info.discard instead.  Changed all uses.
	(ld_config_type): Removed relocateable_output field; use
	link_info.relocateable instead; changed all uses.  Added stats
	field.
	(set_asymbol_chain, get_asymbol_chain, get_loader_symbol,
	set_loader_symbol): Removed.
	* ldexp.h (node_class): Added etree_rel.
	(etree_type): Added rel field.
	* ldexp.c (exp_print_token): Bracketed table initialization.
	(exp_relop): New function.
	(fold_name): Use linker hash table rather than ldsym functions.
	(exp_fold_tree): Likewise.  Also, handle etree_rel case.
	(exp_print_tree): Handle etree_rel.
	* ldgram.y (strip_symbols, discard_locals): Removed.
	(OPTION_stats, OPTION_no_keep_memory): New tokens.  Handle them.
	(REL): New token.  Does not appear in grammar, but needed for
	expression code.
	(file): Don't call lang_final; it's called by main anyhow.
	* ldlex.l: Accept -stats and -no-keep-memory options.
	* ldlang.h (fill_type): Make unsigned int, not unsigned short.
	* ldlang.c: Consistently use fill_type for fill argument.
	(lang_init_script_file, script_file): Removed.
	(create_object_symbols): Removed.  Use
	link_info.create_object_symbols_section instead.  Changed all
	uses.
	(lang_add_keepsyms_file): Removed.
	(lookup_name): Call bfd_link_add_symbols instead of
	ldmain_open_file_read_symbol.
	(wild): Don't iterate over script_file.
	(open_output): Create link hash table.
	(lang_place_undefineds): Rewrote.
	(lang_size_sections): Handle relaxing (doesn't work yet).
	(lang_relocate_globals): Removed.
	(lang_finish): Use link hash table rather than ldsym functions.
	(lang_common): Rewrote.
	(lang_one_common): New function.
	(ldlang_add_file): Add file to link_info.input_bfds list.  Set
	usrdata.
	(create_symbol): Removed.
	(lang_process): Don't call lang_init_script_file.  Call
	ldctor_build_sets rather than find_constructors.  Don't call
	lang_relocate_globals.
	(lang_abs_symbol_at_beginning_of): Rewrote.
	(lang_abs_symbol_at_end_of): Rewrote.
	* ldmain.c (had_y): Removed.
	(lprefix, lprefix_len): Removed; use link_info fields instead.
	Changed all uses.
	(multiple_def_count, commons_pending, undefined_global_sym_count,
	total_symbols_seen, total_files_seen): Removed.
	(link_callbacks, link_info): New variables.
	(main): Initialize link_info.  Don't call init_bfd_error_vector or
	ldsym_init.  Don't set now unused variables.  Handle -stats.
	(get_emulation): Removed obsolete and nonfunctional GNU960 code.
	(add_ysym): Rewrote.
	(read_entry_symbols, refize, enter_global_ref, enter_file_symbols,
	search_library, gnu960_check_format, decode_library_subfile,
	linear_library, symdef_library, clear_syms, subfile_wanted_p):
	Removed.
	(add_keepsyms_file, add_archive_element, multiple_definition,
	multiple_common, add_to_set, warning_callback, undefined_symbol,
	reloc_overflow, reloc_dangerous, unattached_reloc, notice_ysym):
	New functions.
	* ldmisc.c (vfinfo): Accept a string for %T, not a symbol.  Don't
	require symbols for %C; look them up instead.
	* emultempl/hppaosf.em: Pass link_info to
	hppa_look_for_stubs_in_section.
	* Makefile.in: Rebuilt dependencies.
	(CFILES): Removed lderror.c, ldindr.c, ldsym.c, ldwarn.c, and
	relax.c.
	(HFILES): Removed lderror.h, ldindr.h, ldsym.h, ldwarn.h, and
	relax.h.
	(EMULATION_OFILES): Depend on bfdlink.h, ldmain.h, ldexp.h,
	ldlang.h and ldctor.h.

	* Makefile.in (ldlex.c): Don't depend on ldgram.h.  Remove
	declarations of free and malloc from flex output.  Change malloc
	to ldmalloc in flex output.
1993-12-30 19:51:41 +00:00
Jeff Law
93df4ec5fe * ldmain.c (lprefix): Change default from a char to a string
with only one character.
        (lprefix_len): Set default to one.

        * ldmain.h (lprefix_len): Declare.

        * ldsym.c (write_file_locals): Use strncmp rather than a character
        comparison for lprefix.

        * emultmpl/m88kbcs.em (before_parse): Set lprefix and lprefix_len
        correctly.

        * emultmpl/hppaosf.em: Include ldexp.h.
        (before_parse): Set lprefix and lprefix_len correctly.
1993-12-17 05:21:33 +00:00
Jeff Law
9d9d72fcf5 * emultempl/hppaosf.em: Various fixes and support for linker stub
generation.
	(hppaosf_finish, hppaosf_search_for_padding_statements,
	hppaosf_create_output_section_statements): New functions in
	support of linker stub generation.
	(ld_hppaosf_emulation):  Redefine to include new
	emulation-specific routines.
1993-11-02 23:54:04 +00:00
Ken Raeburn
4346166b07 From Peter Hoogenboom <hoogen@shafer.cs.utah.edu>:
* emultempl/hppaosf.em (ld_hppaosf_emulation): Correct name for PA
ELF emulation is "elf32-hppa" not "elf-big".
(hppaosf_before_parse): Remove unneeded processing of environment variables.
* scripttempl/hppaosf.sc: Include .hppa_linker_stubs sections in
.text segment of output file.
* emulparams/hppaosf.sh (OUTPUT_FORMAT): Use elf32-hppa.
1993-08-24 23:45:26 +00:00
Steve Chamberlain
e85fd7216e Keep m88kbcs.em 1993-08-04 17:19:22 +00:00
David MacKenzie
d59e5a4707 move compile-in decision to genscripts.sh 1993-07-22 00:55:56 +00:00
David MacKenzie
a6152e399b The default script is now compiled in; the others are still in the filesystem. 1993-07-22 00:33:10 +00:00
David MacKenzie
8ddef5528d * ldfile.c (ldfile_open_command): Don't try .ld extension.
It wasn't documented (or likely used) and wastes time.
	(try_open): If EXTEN is empty, don't try it.

	* ldctor.c, lderror.c, ldexp.c, ldfile.c, ldindr.c, ldlang.c,
	ldlex.l, ldmain.c, ldmisc.c, ldsym.c, ldver.c, ldwarn.c,
	ldwrite.c, lexsup.c, mri.c, relax.c: Replace DEFUN macro calls
	with normal function declarations.

	* Move *.em to emultempl/*.em.  Move *.sh to emulparams/*.sh.
	Move *.sc-sh to scripttempl/*.sc.
	* {emultempl,emulparams,scripttempl}/README: New files.
	* sh.em, st2000.em, z8ksim.em, h8300hms.em, h8500hms.em: Files
	removed, replaced with generic.em.
	* h8300.sh, h8500.sh, h8300.sc, h8500.sc: Renamed from
	 h8[35]00hms.s[ch].  Change their contents to omit the "hms".

	* *.em (*_get_script): Return script name instead of script contents.
	* ldlang.c (lang_process): Change caller.

	* ldlex.l, ldgram.y: Recognize -m option.
	Check for input files after *all* options in grammar.
	* ldmain.c (main): Check for -m options.  Add default directory
	for -m.

	* mkscript.c: File removed.
	* genscripts.sh: Take two more parameters, tooldirlib and libdir,
	to add to the default LIB_PATH.
	Look for input files in the new subdirectories.
	Create the scripts in emulations subdirectory and don't filter
	them through mkscript.
	* configure.in: Make the emulations subdirectory.

	* Makefile.in: Account for all of the above changes.
	Remove unused .SUFFIXES.  Get libgcc.a path with gcc
	-print-libgcc-file-name instead of $(libdir)/libgcc.a.
	Put CFLAGS last in the compilation rules.
	Add -I../bfd to INCLUDES so sysdep.h is found.

	* ldfile.c (try_open): If opening without the extension fails,
	try with the extension even if -v or -V was given.
	had_script is imported (from ldgram.y), not exported.
1993-06-17 20:55:43 +00:00