Commit graph

26 commits

Author SHA1 Message Date
Jakub Jelinek
9ee5e4996f binutils/
* readelf.c (get_segment_type): Handle PT_GNU_STACK.
bfd/
	* elf.c (_bfd_elf_print_private_bfd_data): Handle PT_GNU_STACK.
	(bfd_section_from_phdr): Likewise.
	(map_sections_to_segments): Create PT_GNU_STACK segment header.
	(get_program_header_size): Count with PT_GNU_STACK.
	* elf-bfd.h (struct elf_obj_tdata): Add stack_flags.
	* elflink.h (bfd_elfNN_size_dynamic_sections): Set stack_flags.
include/
	* bfdlink.h (struct bfd_link_info): Add execstack and noexecstack.
	* elf/common.h (PT_GNU_STACK): Define.
ld/
	* ldgram.y (phdr_type): Grok PT_GNU_STACK.
	* emultempl/elf32.em (gld${EMULATION_NAME}_handle_option): Add
	-z execstack and -z noexecstack.
	(gld${EMULATION_NAME}_list_options): Likewise.
	* scripttempl/elf.sc: If not -r, discard .note.GNU-stack section.
2003-06-03 22:27:24 +00:00
Roland McGrath
d038301c19 2003-04-24 Roland McGrath <roland@redhat.com>
* ldgram.y (phdr_type): Grok PT_TLS and PT_GNU_EH_FRAME names.
	If a name string is unknown, give an error rather than crashing later.
2003-04-24 17:15:25 +00:00
Alan Modra
8e23b15d1c * ldgram.y (vers_defns): Also recurse with 'EXTERN NAME' patterns.
* ldgram.y (vers_defns): Allow optional trailing semicolon in
	EXTERN NAME block;
2003-02-20 01:02:39 +00:00
Alan Modra
b34976b65a s/boolean/bfd_boolean/ s/true/TRUE/ s/false/FALSE/. Simplify
comparisons of bfd_boolean vars with TRUE/FALSE.  Formatting.
2002-11-30 08:39:46 +00:00
Alan Modra
2d801b0fa0 * ldgram.y (memory_spec): Provide empty action.
(section <NAME>): Likewise.
2002-10-11 07:39:07 +00:00
Richard Sandiford
9f88b410a0 * ldlang.h (lang_output_section_statement_type): Add update_dot_tree.
(lang_enter_overlay): Remove the last two parameters.
	(lang_leave_overlay): Take them here instead.
	* ldgram.y (memspec_at_opt): Set $$ to null if no region is given.
	(section): Pass LMA and crossref flag to lang_leave_overlay rather
	than lang_enter_overlay.
	* ldlang.c (lang_memory_region_lookup): Return null for null names.
	(lang_output_section_statement_lookup): Initialize update_dot_tree.
	(lang_size_sections_1): Evaluate it.
	(lang_leave_output_section_statement): Rework LMA lookup.
	(overlay_lma, overlay_nocrossrefs): Remove.
	(lang_enter_overlay): Remove LMA and corssref arguments.
	(lang_enter_overlay_section): Don't set the LMA here.
	(lang_leave_overlay): Take LMA and crossref arguments.  Move the '.'
	assignment to the last section's update_dot_tree.  Unconditionally
	use the load and run-time regions specified in the OVERLAY statement.
	Likewise the first section's LMA.  Only set the other sections' LMAs
	when no load region is given.
2002-05-07 11:04:54 +00:00
Thiemo Seufer
944cd72c7e * arparse.y: Fix syntax warning.
* ldgram.y: Fix syntax warning.
2002-04-17 13:05:55 +00:00
Alan Modra
2c382fb6f5 Support arbitrary length fill patterns.
* ldexp.h (etree_value_type): Add "str" field.
	(union etree_union): Add "str" to "value" struct.
	(exp_bigintop): Declare.
	(exp_get_fill): Declare.
	* ldexp.c: Include "safe-ctype.h".
	(exp_intop): Set value.str to NULL.
	(exp_bigintop): New function.
	(new_rel): Pass in "str", and set new.str from it.
	(new_rel_from_section): Set new.str to NULL.
	(fold_name): Adjust calls to new_rel.
	(exp_fold_tree): Likewise.
	(exp_get_fill): New function.
	* ldgram.y (struct big_int bigint, fill_type *fill): New.
	(INT): Returns a "bigint".  Adjust all code handling INTs.
	(fill_opt): Returns a "fill".
	(fill_exp): Split out of fill_opt, use for FILL.
	* ldlang.h (struct _fill_type): New.
	(fill_type): Move typedef to ldexp.h.
	(lang_output_section_statement_type): "fill" is now a pointer.
	(lang_fill_statement_type): Likewise.
	(lang_padding_statement_type): Likewise.
	(lang_add_fill): Now takes a "fill_type *" param.
	(lang_leave_output_section_statement): Likewise.
	(lang_do_assignments): Likewise.
	(lang_size_sections): Likewise.
	(lang_leave_overlay_section): Likewise.
	(lang_leave_overlay): Likewise.
	* ldlang.c: Include ldgram.h after ldexp.h.
	(lang_output_section_statement_lookup): Adjust for fill_type change.
	(print_fill_statement): Likewise.
	(print_padding_statement): Likewise.
	(insert_pad): Now takes a "fill_type *" arg.
	(size_input_section): Likewise.
	(lang_size_sections_1): Likewise.
	(lang_size_sections): Likewise.
	(lang_do_assignments): Likewise.
	(lang_add_fill): Likewise.
	(lang_leave_output_section_statement): Likewise.
	(lang_leave_overlay_section): Likewise.
	(lang_leave_overlay): Likewise.
	Adjust all callers of the above function.
	* ldlex.l: Include ldgram.h after ldexp.h.  Allow hex numbers
	starting with "0X" as well as "0x".  Return bigint.str for hex
	numbers starting with "0x" or "0X", zero bigint.str otherwise.
	Always use base 16 for numbers starting with "$".
	* ldmain.c: Include ldgram.h after ldexp.h.
	* ldwrite.c (build_link_order): Use bfd_data_link_order in place
	of bfd_fill_link_order.
	* pe-dll.c: Adjust lang_do_assignments calls.
	* emultempl/elf32.em: Likewise.
	* emultempl/hppaelf.em: Likewise.
	* emultempl/ppc64elf.em: Likewise.
	* emultempl/beos.em: Include ldgram.h after ldexp.h, adjust
	lang_add_assignment call.
	* emultempl/pe.em: Likewise.
2002-02-15 02:11:05 +00:00
Alan Modra
313e35ee7c * ld.texinfo (VERSION scripts): Symbol names are globbing patterns.
* ldgram.y (lang_new_vers_regex):  Rename to lang_new_vers_pattern;
	the pattern in question is not a regexp.
	* ldlang.c:  Likewise.
	* ldlang.h:  Likewise.
	* ldlex.l (V_IDENTIFIER):  Allow '[', ']', '-', '!', and '^' also.
2002-02-14 04:24:33 +00:00
Jakub Jelinek
2d20f7bf67 * ldlex.l (DATA_SEGMENT_ALIGN, DATA_SEGMENT_END): New tokens.
* ldgram.y (DATA_SEGMENT_ALIGN, DATA_SEGMENT_END): New tokens.
	(exp): Add DATA_SEGMENT_ALIGN (exp, exp) and DATA_SEGMENT_END (exp).
	* ldexp.c (exp_data_seg): New variable.
	(exp_print_token): Handle DATA_SEGMENT_ALIGN and DATA_SEGMENT_END.
	(fold_binary): Handle DATA_SEGMENT_ALIGN.
	(exp_fold_tree): Handle DATA_SEGMENT_END.
	Pass allocation_done when recursing instead of hardcoding
	lang_allocating_phase_enum.
	* ldexp.h (exp_data_seg): New.
	* ldlang.c (lang_size_sections_1): Renamed from lang_size_sections.
	(lang_size_sections): New.
	* ld.texinfo (DATA_SEGMENT_ALIGN, DATA_SEGMENT_END): Document.
	* scripttempl/elf.sc: Use DATA_SEGMENT_ALIGN and DATA_SEGMENT_END
	if COMMONPAGESIZE is defined.
	* emulparams/elf_i386.sh (COMMONPAGESIZE): Set to 4K.
	* emulparams/elf32_sparc.sh (COMMONPAGESIZE): Set to 8K.
	* emulparams/elf64_sparc.sh (COMMONPAGESIZE): Set to 8K.
	* emulparams/elf64alpha.sh (COMMONPAGESIZE): Set to 8K.
	* emulparams/elf64_ia64.sh (COMMONPAGESIZE): Set to 16K for shared
	libraries only.
2002-02-12 14:50:08 +00:00
Jakub Jelinek
6b9b879a02 * ldgram.y (vers_node): Support anonymous version tags.
* ldlang.c (lang_register_vers_node): Ensure anonymous version
	tag is not defined together with non-anonymous versions.
	* ld.texinfo: Document it.

	* elflink.h (size_dynamic_sections): Skip anonymous version tag.
	(elf_link_assign_sym_version): Don't count anonymous version tag.
2001-12-18 12:15:35 +00:00
Alan Modra
b47c420856 * ldgram.y (mri_script_command): Surround processing of INCLUDE
with ldlex_script, ldlex_popstate.
	(ifile_p1): Likewise.
	* ldlex.l (EOF): Don't BEGIN(SCRIPT).  Restore lineno from the
	correct slot.
	(lex_push_file): Save current lineno to lineno_stack.  Set lineno
	to 1.  Don't BEGIN(SCRIPT).
	(lex_redirect): Similarly.
	* ldmain.c (main): Set yydebug non-zero if YYDEBUG.
2001-10-20 13:49:00 +00:00
Alan Modra
4818e05fe5 From John Reiser <jreiser@BitWagon.com>
* ldlang.c (lang_common): Conditionally inhibit Common allocation.
	* lexsup.c: Add --no-define-common commandline option.
	* ldgram.y: Add INHIBIT_COMMON_ALLOCATION script command.
	* ldlex.l: Likewise.
	* ld.h: Add command_line.inhibit_common_definition.
	* ldmain.c (main): Initialize.
	* ld.texinfo: Document.
2001-09-29 12:57:54 +00:00
Tom Rix
b90e1c6f3e Fix for ld 2001-08-15 17:10:18 +00:00
Nick Clifton
b9a8de1ea3 Make --verbose always display linker script 2001-08-12 07:59:28 +00:00
Alan Modra
b6bf44ba1b * ld.texinfo (Input Section Basics): Clarify ordering of output
sections.
	* ldlang.c (callback_t): Add wildcard_list param.
	(walk_wild_section): Remove "section" param.  Rewrite for
	lang_wild_statement_type change.  Remove unique_section_p test.
	(walk_wild_file): Remove "section" param.
	(walk_wild): Remove "section" and "file" params.
	(lang_gc_wild): Likewise.
	(wild): Likewise.  Modify for lang_wild_statement_type change.
	(wild_sort): Likewise.  Add "sec" param.
	(gc_section_callback): Likewise.
	(output_section_callback): Likewise.  Do unique_section_p test.
	(map_input_to_output_sections): Modify call to wild.
	(lang_gc_sections_1): Likewise.
	(print_wild_statement): Modify for lang_wild_statement_type
	change.
	(lang_add_wild): Replace filename, filenames_sorted param with
	filespec.  Replace section_name, sections_sorted,
	exclude_filename_list with section_list.
	* ldlang.h (lang_add_wild): Here too.
	(lang_wild_statement_type): Replace section_name, sections_sorted,
	and exclude_filename_list with section_list.
	* ldgram.y (current_file): Delete.
	(%union): Add wildcard_list.
	(file_NAME_list): Set type to wildcard_list.  Build a linked list
	rather than calling lang_add_wild for each entry.
	(input_section_spec_no_keep): Call lang_add_wild here instead.
	* ld.h (struct wildcard_list): Declare.
	* mri.c (mri_draw_tree): Modify to suit new lang_add_wild.
2001-08-03 01:11:21 +00:00
Alan Modra
8e5a525cbb * ldgram.y: Fix typo. 2001-05-07 09:20:25 +00:00
Nick Clifton
a2b64bede3 Fixtypos in ChangeLogs, fix copyright dates in files 2001-03-13 06:14:29 +00:00
Alan Modra
b71e277823 Remove some forward declarations in ldemul.h and ldfile.h, and
re-arrange header include order.
Fix shadowing warnings in ldlang.h
Fix compile errors in mpw-elfmips.c
2000-07-11 03:42:41 +00:00
Timothy Wall
74459f0e3e tic54x/ibmc54xdsp target for ld. 2000-06-20 13:29:07 +00:00
H.J. Lu
e06cae3665 2000-06-05 Michael Matz <matz@ifh.de>
* ldgram.y (vers_defns): Handle 'extern "C++" { ... }' in
	 version scripts.

	 * ldlex.l (V_IDENTIFIER): Accept `::' in symbols.
2000-06-05 16:16:31 +00:00
Jim Blandy
765b7cbe05 * ldgram.y (exclude_name_list): Don't require a comma to separate
list entries; the lexer considers commas to be valid part of a
filename, so in something like `foo, bar' the comma is considered
part of the first filename, `foo,'.
* ld.texinfo: Update section on EXCLUDE_FILE lists.
2000-02-29 03:28:57 +00:00
Timothy Wall
562d3460fb Add LMA memory region functionality. 2000-02-16 18:53:32 +00:00
Catherine Moore
18625d5459 * ld.h (wildcard_spec): Change exclude_name to exclude_name_list.
(name_list): New.
        * ld.texinfo (EXCLUDE_FILE): Update documentation.
        * ldgram.y (wildcard_spec): Support a list of excluded_files.
        (exclude_name_list): New.
        ldlang.c (walk_wild_section): Support list of excluded files.
        (print_wild_statement): Likewise.
        (lang_add_wild): Likewise.
        * ldlang.h (lang_wild_statement_type): Likewise.
        * scripttempl/elf.sc (OTHER_EXCLUDE_FILES): Support.
2000-01-05 14:12:23 +00:00
Ian Lance Taylor
aa8804e46e This fixes ! to work as documented in a memory region attribute list.
From Thomas Zenker <thz@lennartz-electronic.de>:
	* ldgram.y (attributes_opt): Use attributes_list instead of NAME.
	(attributes_list, attributes_string): New nonterminals.
	* ldlang.c (lang_set_flags): Add invert parameter.  Don't handle
	'!'.
	* ldlang.c (lang_set_flags): Update declaration.
1999-06-12 21:24:56 +00:00
Richard Henderson
252b5132c7 19990502 sourceware import 1999-05-03 07:29:11 +00:00