Commit Graph

36 Commits

Author SHA1 Message Date
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
David MacKenzie
fb55f9b8ae * ldlex.l: Add rule to catch invalid input characters instead of
printing them.  Include "ldmain.h" for program_name decl.
	(lex_warn_invalid): New function.
	* Makefile.in: Add dependency.
1994-01-28 19:36:53 +00:00
Stan Shebs
b5b2c88649 Tue Jan 25 19:54:19 1994 Stan Shebs (shebs@andros.cygnus.com)
* mpw-config.in: New file, MPW configuration fragment.
	* mpw-build.in: New file, MPW build script fragment.
	* mpw-make.in: New file, MPW makefile fragment.
	(This file is semi-automatically generated from Makefile.in.)
	* ldfile.c (slash): If MPW, set to `:'.
	* ldlex.l (TRUE_FALSE_ALREADY_DEFINED): If MPW, set this to
	prevent redefinition errors.
1994-01-26 04:17:05 +00:00
Ian Lance Taylor
c477527cbb * ld.h (QUAD_SIZE): Define.
* ldgram.y (QUAD): New token.
	(length): Handle it.
	* ldlex.l: Return QUAD.
	* lexsup.c (keywords): Add QUAD.
	* ldwrite.c (build_link_order): Handle QUAD.
	* ldlang.c (print_data_statement): Handle QUAD.
	(lang_size_sections): Likewise.
	(lang_do_assignments): Likewise.
	* ldexp.c (exp_print_token): Add QUAD to table.
	* ld.texinfo: Describe QUAD.
1994-01-06 19:38:36 +00:00
Ian Lance Taylor
9f6294075e More gcc lint. 1993-12-12 00:54:14 +00:00
Ian Lance Taylor
fcf276c495 Made many changes to eliminate gcc warnings. Made various
cosmetic changes, declared various things in header files, removed
	various extern declarations from .c files.  No substantive
	changes.
1993-12-11 22:55:55 +00:00
Ian Lance Taylor
f651733a12 * ldgram.y (OPTION_call_shared, OPTION_non_shared): New tokens.
(command_line_option): Accept and ignore them (for now).
	* ldlex.l (<COMMAND>): Handle -non_shared and -call_shared.
1993-12-01 17:22:03 +00:00
David MacKenzie
8bf66be8aa add missing newlines in messages 1993-08-05 02:52:17 +00:00
David MacKenzie
2a28d8b006 add -warn-common option 1993-08-03 22:47:28 +00:00
Ken Raeburn
a02945df81 Don't define bfd_vma here!
(Wasted at least a day tracking this damn thing down...)
1993-07-07 21:15:09 +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
Steve Chamberlain
9fce28edd5 Support for linking and loading at different places:
* ldlex.l: Add "AT" keyword.
	* ldgram.y: Cleanup, and parse AT.
	* ldlang.c (print_output_section_statement): Print output address
	of section in map. (lang_size_sections): Fill sections' lma with
	load address.
	* ldlang.h (lang_output_section_statement_type): Add load_base
	information.
1993-03-30 22:45:39 +00:00
Steve Chamberlain
dadd414a89 Fix support for NOLOAD, add INCLUDE
* ldfile.c (ldfile_open_command_file): pass file name to
	lex_push_file.
	* ldlex.l, ldgram.y: tidy up, parse INCLUDE and NOLOAD
	* ldlang.c (wild_doit): make output sections inherit NEVER_LOAD
	attribute.
1993-01-08 22:42:42 +00:00
Steve Chamberlain
85e38cfa01 -y support
* ld.texinfo: new doc.
	* ldgram.y, ldlex.l: understand -y<symbol>
	* ldmain.c (Q_enter_file_symbols): if had -y, lookup symbol and
	print info. (add_ysym): new function.
	* ldsym.h: (ldsym_type): new define SYM_Y.
1992-12-07 16:49:54 +00:00
Steve Chamberlain
6bf2e3a762 * ldlex.l: now parses comment correctly, added ~ to acceptable
chars in filenames

	* ldexp.c (exp_unop): pass down abs_output_section - now can have
	unary -ve constants.

	* ldlang.c (lang_finish): warn when an entry symbol supplied on
	the command line can't be found.
1992-08-13 19:16:49 +00:00
Per Bothner
91e25b4f8f * ldlex.c: Fix some unnecessary flex-specific-isms. 1992-05-22 20:56:37 +00:00
Steve Chamberlain
dc4726c236 lint 1992-05-01 20:09:44 +00:00
Steve Chamberlain
ee0c4cf7d1 * ldlex.l: added CMDFILENAMECHAR state so that you can lex
different sorts of filenames on the command line than in a script.
1992-04-22 19:55:15 +00:00
Steve Chamberlain
0d3e45eab0 * relax.c: added handling for new "padding" seclet type, used to
fill out gaps between section.
	* ldgram.y, ldlex.l: now -defsym on the command line is done
	properly.
1992-04-17 15:59:37 +00:00
Steve Chamberlain
1bd1fa2ddb Lint found by Rich and gcc 1992-04-16 18:03:51 +00:00
Steve Chamberlain
2e38b71d27 Strange link script support 1992-04-15 23:11:09 +00:00
Steve Chamberlain
3d2b83ea49 Personal checkpoint - now should parse some MRI stuff 1992-04-15 22:23:33 +00:00
Steve Chamberlain
9d1fe8a410 New lexer.
New targets for h8/300 simulator and DOS
1992-04-05 01:47:16 +00:00
Steve Chamberlain
2e2bf962db * Makefile.in: added relax, also made three stage go through a
partial link stage.
	* relax.c : added
	* config.h: if GNU960 defined, then default emulation mode is
	GLD960
	* ldexp.h, ldexp.c: map to file hooks
	* ldlang.c: map to file hooks
	* ldgram.y: added -Map -relax
	* ldlex.l: added -relax, -Map
	* ldmain.c: open map file
	* ldmisc.c: support for map file
	* ldwrite.c: new relax magic
1992-01-24 22:34:34 +00:00
Steve Chamberlain
48491e2e15 *** empty log message *** 1991-06-04 23:05:54 +00:00
Steve Chamberlain
6812f0e89f Fixed the shift reduce errors in the grammer using the yacc debugger.
Removed some lint highlighted by the same.
1991-05-07 19:16:33 +00:00
Steve Chamberlain
b63165349f *** empty log message *** 1991-05-03 23:52:48 +00:00
Steve Chamberlain
65c552e308 Added the sizeof_headers keyword. 1991-04-24 20:53:36 +00:00
Steve Chamberlain
a37cc0c05c *** empty log message *** 1991-04-23 15:59:24 +00:00
Steve Chamberlain
1d45ccb383 Yet more diffs due to my incompetence. 1991-04-19 00:59:53 +00:00
Steve Chamberlain
ac00487023 Fixed some bugs. 1991-04-18 00:06:26 +00:00
Steve Chamberlain
fd846434f0 Added keywords
FORCE_COMMON_ALLOCATION
OUTPUT_FORMAT
1991-04-17 00:49:15 +00:00
Steve Chamberlain
070aa81923 *** empty log message *** 1991-04-16 14:32:02 +00:00
Steve Chamberlain
1418c83b39 checkpoint before a merge 1991-04-14 03:22:42 +00:00
Steve Chamberlain
7ca04d280d Fixed some grammer ambiguities
Better error reporting
sun3 support
1991-04-03 22:03:55 +00:00
David Henkel-Wallace
2fa0b342a5 Initial revision 1991-03-21 21:29:06 +00:00