aboutsummaryrefslogtreecommitdiff
path: root/ld/ldgram.y
AgeCommit message (Collapse)AuthorFilesLines
1996-08-02 * ldgram.y (LOADADDR): New terminal.Ian Lance Taylor1-1/+3
(exp): Handle LOADADDR. * ldlex.l: Recognize LOADADDR. * ldexp.c (exp_print_token): Add LOADADDR. (fold_name): Implement LOADADDR. * ldlang.c (exp_init_os): Treat LOADADDR like ADDR. * ld.texinfo (Arithmetic Functions): Document LOADADDR.
1996-08-01 * ld.h (check_nocrossrefs): Declare.Ian Lance Taylor1-2/+32
* ldlang.h (struct lang_nocrossref): Define. (struct lang_nocrossrefs): Define. (nocrossref_list): Declare. (lang_add_nocrossref): Declare. * ldlex.l: Recognize NOCROSSREFS keyword. * ldgram.y (%union): Add nocrossref field. (NOCROSSREFS): New terminal. (ifile_p1): Recognize NOCROSSREFS. (nocrossref_list): New nonterminal. * ldlang.c (nocrossref_list): Define. (lang_add_nocrossref): New function. * ldmain.c (main): If nocrossref_list is not NULL, call check_nocrossrefs. (warning_callback): Free symbols if there is no place to store them. (notice): Call add_cref if nocrossref_list is not NULL. * ldcref.c: Include "ldexp.h" and "ldlang.h". (check_nocrossrefs): New function. (check_nocrossref): New static function. (struct check_refs_info): Define. (check_refs, check_reloc_refs): New static functions. * Makefile.in: Rebuild dependencies. * ld.texinfo (Option Commands): Document NOCROSSREFS.
1996-07-29 * fnmatch.h, fnmatch.c: New files.Ian Lance Taylor1-33/+180
* ldlex.l: Remove unused definition of FILENAME. Add definition of WILDCHAR. In SCRIPT mode, accept any sequence of WILDCHAR as a NAME. * ldgram.y (file_NAME_list): Accept '*' and '?' specially. (input_section_spec): Accept '?' specially. (statement): Change exp to mustbe_exp in length and FILL cases. (section): Call ldlex_script before section statements, and call ldlex_popstate after them. * ldlang.c: Include "fnmatch.h". (wildcardp): New static function. (wild_section): Permit the section name to be a wildcard. (wild_file): New static function, broken out of wild. (wild): Call wild_file. Permit the file name to be a wildcard. (open_input_bfds): Don't call lookup_name for a wildcard pattern. * Makefile.in: Rebuild dependencies. (CFILES): Add fnmatch.c. (HFILES): Add fnmatch.h. (OFILES): Add fnmatch.o. * ld.texinfo: Document that file and section names can now be wildcard patterns. * ldlang.c (lang_place_orphans): Correct condition: place a common section if not relocateable or if common definitions are forced.
1995-08-16 * ldgram.y: Tweak casesymlist to avoid bison errors.Ian Lance Taylor1-2/+2
1995-08-15 * ldgram.y (YYDEBUG): If not defined, define as 1.Ian Lance Taylor1-8/+43
(CASE, EXTERN, START): New tokens. (mri_script_command): Handle CASE, EXTERN, INCLUDE, START. (casesymlist): New nonterminal. (extern_name_list): New nonterminal. * ldlex.l: Accept lower case trailing base specifiers. Don't ignore the first digit when the base is a suffix. Accept many EXPRESSION state tokens in MRI state. Support MRI continuation lines and MRI semicolon comments. Accept all MRI keywords in lower case. Add CASE, EXTERN, and START MRI keywords.
1994-09-13 * ldlang.c (load_symbols): Check for archive before object. UseIan Lance Taylor1-8/+23
bfd_check_format_matches, and, if ambiguous, print a list of matching formats. If file format is not recognized, treat file as a linker script. * ldgram.y (yyerror): If assuming an object file is a script, mention that. Tweak the format of the error messages. * ldlex.l (lex_warn_invalid): If assuming an object is a script, guess that this is not actually a script, and just report that the file format was not recognized. * ld.texinfo (Options): Admit that -( may be used more than once. Add note that unrecognized object files are now treated as linker scripts. * ldfile.c (ldfile_input_filename): Make const. (ldfile_assumed_script): New variable. (try_open): Change arguments types to const. (ldfile_find_command_file): Likewise. (ldfile_open_command_file): Likewise. Also, set lineno to 1. * ldfile.h: Update declarations for ldfile.c changes. * ldlex.l: Include <ctype.h>. (file_name_stack): Change to be const char *. (lineno_stack): New static variable. (<<EOF>>): Set lineno as well as ldfile_input_filename. (lex_push_file): Make name argument const. Initialize lineno_stack entry. (lex_redirect): Initialize lineno_stack entry. (lex_warn_invalid): Handle non printable characters nicely. * ldlex.h (lex_push_file): Declare second argument as const. * ldgram.y (ifile_p1): Recognize GROUP. * ldlex.l: Recognize GROUP. * ld.texinfo (Option Commands): Document GROUP.
1994-06-13 * ldgram.y (YYDEBUG): Don't define.Ian Lance Taylor1-2/+0
1994-06-02 * ldfile.h (search_dirs_type): Move from ldfile.c, and add cmdlineIan Lance Taylor1-1/+1
field. (search_head): Declare. (ldfile_add_library_path): Add new cmdline argument in prototype. * ldfile.c (search_head): Make non-static. (search_dirs_type): Move to ldfile.h. (ldfile_add_library_path): Accept cmdline argument, and save it. * lexsup.c (parse_args): Pass true for new cmdline argument of ldfile_add_library_path. (set_default_dirlist): Likewise. * ldmain.c (check_for_scripts_dir): Pass false for new cmdline argument of ldfile_add_library_path. * ldgram.y (ifile_p1): Likewise.
1994-05-27 * ldlang.c (entry_symbol): Make static.Ian Lance Taylor1-2/+1
(lang_add_entry): Add cmdline argument. * ldlang.h (lang_add_entry): Change prototype. * ldgram.y (statement_anywhere): Change lang_add_entry call. * lexsup.c (parse_args): Likewise.
1994-02-26 * ldgram.y (section): Reverse the order of memspec_opt andIan Lance Taylor1-2/+2
fill_opt to avoid an ambiguity when both are used. * ld.texinfo: Changed accordingly.
1994-02-26 * ldgram.y: Move include of ldlex.h back with other includes.Ian Lance Taylor1-4/+1
* ldlex.h (input_type): Don't initialize enum constants to particular values. * ldlex.l: Use a switch to return the right token based on input_type, rather than knowing that input_type has a value based on a token type.
1994-02-26 * ldgram.y (dirlist_ptr): Removed; not used.Ian Lance Taylor1-2/+0
* lexsup.c: Include ldver.h. * Makefile.in: Rebuilt dependencies.
1994-02-26 * ldgram.y: Include ldlex.h after %token decls, for byacc.David MacKenzie1-1/+4
1994-02-25 Use getopt instead of lex and yacc to parse the command line.David MacKenzie1-309/+19
* 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-01-27 * ldmain.c ldmain.h ldgram.y: If -v -V or --version was given,David MacKenzie1-4/+16
exit successfully instead of complaining if no input files are given.
1994-01-06 * ld.h (QUAD_SIZE): Define.Ian Lance Taylor1-6/+8
* 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.
1993-12-30 A major rewrite to move the bulk of the linker into BFD so thatIan Lance Taylor1-27/+29
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-11 Made many changes to eliminate gcc warnings. Made variousIan Lance Taylor1-27/+5
cosmetic changes, declared various things in header files, removed various extern declarations from .c files. No substantive changes.
1993-12-01 * ldgram.y (OPTION_call_shared, OPTION_non_shared): New tokens.Ian Lance Taylor1-11/+51
(command_line_option): Accept and ignore them (for now). * ldlex.l (<COMMAND>): Handle -non_shared and -call_shared.
1993-07-16 * ldgram.y (OPTION_Lfile): New token.Ian Lance Taylor1-4/+8
(command_line_option): Accept OPTION_L NAME (whitespace after -L). * ldlex.l (<COMMAND>): Accept -L without FILENAME.
1993-07-15source cleanups; fix finding scriptsDavid MacKenzie1-3/+2
1993-07-08 * Make -v only print the version number.David MacKenzie1-10/+24
Share some Texinfo documentation with BFD.
1993-06-17 * ldgram.y: Tweak grammar to make reporting of invalid options work.David MacKenzie1-4/+7
1993-06-17 * ldfile.c (ldfile_open_command): Don't try .ld extension.David MacKenzie1-9/+30
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-03-30 Support for linking and loading at different places:Steve Chamberlain1-34/+55
* 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-01-08 Fix support for NOLOAD, add INCLUDESteve Chamberlain1-40/+44
* 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.
1992-08-07 * ldlang.h: add new field "loadable" to output_section_statement.Steve Chamberlain1-7/+9
* ldlang.c (lang_output_section_statement_lookup): initilize new field. (wild_doit): if new field is not set, then stop output section from being loadable. (lang_enter_output_section_statement): set the field from the NOLOAD keyword * ldgram.y: new synax for NOLOAD. Removes a shift/reduce too. * h8300hms.sc-sh, h8300hms.em: get -r right.
1992-05-02 * ldgram.y, ldlex.c, mri.c: added more compatible words; BASE, ALIAS andSteve Chamberlain1-10/+24
PUBLIC. * Makefile.in: now use flex, not lex
1992-04-15Strange link script supportSteve Chamberlain1-8/+20
1992-04-15Personal checkpoint - now should parse some MRI stuffSteve Chamberlain1-71/+132
1992-04-05New lexer.Steve Chamberlain1-48/+50
New targets for h8/300 simulator and DOS
1992-03-02Modifed to care about semi colons again, newlines are ignored - sorrySteve Chamberlain1-23/+16
Per.
1992-01-28 * ldgram.y: map -M behave in the same way as -Map (sets file nameSteve Chamberlain1-5/+2
to be "-". * ldsym.c, ldlang.c: remember that size of a section is dependent on whether or not relaxing has been done. * ldmain.c: don't open a map file if it doesn't have a name * relax.c: all the brains have moved into bfd. * ldwrite.c: ammend comment
1992-01-24 * Makefile.in: added relax, also made three stage go through aSteve Chamberlain1-2/+9
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-24Merging from VMS port. Doc to follow..Steve Chamberlain1-15/+39
1991-10-11Include bfd.h before sysdep.h, so ansidecl and PROTO() get defined first.John Gilmore1-16/+38
1991-05-18*** empty log message ***Steve Chamberlain1-1/+1
1991-05-07Fixed the shift reduce errors in the grammer using the yacc debugger.Steve Chamberlain1-22/+23
Removed some lint highlighted by the same.
1991-05-03*** empty log message ***Steve Chamberlain1-1/+4
1991-04-24Added the sizeof_headers keyword.Steve Chamberlain1-1/+3
1991-04-23*** empty log message ***Steve Chamberlain1-11/+9
1991-04-19Yet more diffs due to my incompetence.Steve Chamberlain1-13/+7
1991-04-18Fixed some bugs.Steve Chamberlain1-2/+6
1991-04-17Moved declarations from header file into here.Steve Chamberlain1-1/+2
1991-04-17Added support for OUTPUT_FORMAT(name) and FORCE_COMMON_ALLOCATIONSteve Chamberlain1-3/+9
1991-04-16*** empty log message ***Steve Chamberlain1-2/+1
1991-04-14checkpoint before a mergeSteve Chamberlain1-56/+84
1991-04-09*** empty log message ***Steve Chamberlain1-23/+0
1991-04-08*** empty log message ***Steve Chamberlain1-5/+8
1991-04-03Fixed some grammer ambiguitiesSteve Chamberlain1-62/+39
Better error reporting sun3 support