nodes.
* ldlang.h (lang_new_vers_pattern): Add literal_p parameter.
* ldgram.y (vers_defns): Allow NAME as well as VERS_IDENTIFIER.
Adjust calls to lang_new_vers_pattern to pass literal_p argument.
* ldlang.c (lang_vers_match): Fix indentation. Do not glob-match
version nodes without a pattern.
(lang_new_vers_pattern): Add literal_p parameter.
(lang_do_version_exports_section): Pass it.
* ld-elfvers/vers.exp: Add vers31.
* ld-elfvers/vers31.c: New file.
* ld-elfvers/vers31.dsym: Likewise.
* ld-elfvers/vers31.map: Likewise.
* ld-elfvers/vers31.ver: Likewise.
extern NAME {}. Handle global, local and extern symbol names.
ld/testsuite/
* ld-elfvers/vers.exp: Add a new test, vers30.
* ld-elfvers/vers30.c: New file.
* ld-elfvers/vers30.map: New file.
* ld-elfvers/vers30.ver: New file.
* ld-elfvers/vers30.dsym: New file.
* ldexp.h: ..here. Add lang_mark_phase_enum.
(node_type): Remove etree_undef and etree_unspec.
(exp_data_seg): Delete.
(struct ldexp_control, expld): New.
(invalid, exp_mark_used_section): Delete.
(exp_fold_tree, exp_get_vma, exp_get_value_int, exp_get_fill,
exp_get_abs_int): Update prototypes.
* ldexp.c (assigning_to_dot): Delete.
(expld): Define.
(make_abs): Operate directly on expld.result. Update all callers.
(new_abs): Likewise. Return void.
(new_rel_from_abs): Rename from new_rel_from_section.
(new_rel, new_rel_from_abs): Operate on expld.result and return void.
Update all callers.
(fold_unary): Operate on expld.result and return void. Remove
"current_section", "allocation_done", "dot", "dotp" and "mark_used"
params. Update all callers.
(fold_binary, fold_trinary, fold_name, exp_fold_tree_1): Likewise.
(fold_unary <ALIGN_K>): Ensure alignment is absolute.
(fold_unary <ABSOLUTE>): Use make_abs.
(fold_unary <DATA_SEGMENT_END>): Evaluate mark_phase as for
allocating_phase.
(fold_binary <DATA_SEGMENT_ALIGN, DATA_SEGMENT_RELRO_END, >): Ditto.
(fold_binary <'%','/'>): Don't error if marking.
(fold_name <SIZEOF_HEADERS>): Don't call bfd_sizeof_headers when
marking.
(fold_name <NAME>): Remove FIXME; -R is handled correctly. Don't
error when marking.
(fold_name <ADDR, LOADADDR, SIZEOF>): Don't set SEC_KEEP.
(exp_fold_tree_1): Don't error when marking.
(exp_fold_tree_1 <etree_rel>): Evaluate in all phases except first.
(exp_fold_tree_1 <etree_assign to dot>): Don't check for NULL
current section, instead check for NULL dotp.
(exp_fold_tree_1 <etree_provide>): Don't evaluate the assignment
source unless the symbol is referenced and undefined.
(exp_fold_tree): Remove "allocation_done" and "dot" params. Save
params to expld.
(exp_fold_tree_no_dot): Remove "current_section", "allocation_done
and "mark_used" params. Save params to expld. Update all callers.
(exp_assop): Do without temp var.
(exp_print_tree <etree_undef>): Delete code.
(exp_get_vma): Remove "allocation_done" param. Correct error return.
(exp_get_fill, exp_get_abs_int): Likewise.
(exp_get_value_int): Remove "allocation_done" param.
(exp_mark_used_section): Delete.
* ldgram.y (fill_exp): Update exp_get_fill call.
(origin_spec, length_spec): Update exp_get_vma call.
* ldlang.c (lang_init): Don't bother clearing lang_statement_iteration.
(lang_mark_used_section_1, lang_mark_used_section): Delete.
(strip_excluded_output_sections): Call one_lang_size_sections_pass in
marking mode. Merge old lang_mark_used_section code. Correct handling
of output sections with excluded input sections and data statements.
Don't drop non-zero sized sections. Don't zap os->bfd_section.
Do set SEC_EXCLUDE when appropriate.
(print_output_section_statement): Update for changed ldexp.c
interface.
(print_assignment, lang_size_sections_1): Likewise.
(lang_do_assignments_1, lang_enter_output_section_statement): Likewise.
(lang_new_phdr, lang_record_phdrs): Likewise.
(lang_size_sections): Likewise.
(insert_pad): Use following statement if it is a pad, rather than
creating a new one.
(lang_size_sections_1 <lang_output_section_statement_enum>): Do
process ignored output section to set vma and lma, but don't
update dot for these sections. Don't error if marking.
(lang_size_sections_1 <lang_assignment_statement_enum>): Don't
update dot for ignored sections.
(lang_size_sections_1 <lang_data_statement_enum>): Don't mark absolute
section with SEC_ALLOC.
(one_lang_size_sections_pass): New function.
(lang_size_sections): Remove first five params. Set expld.phase on
entry and exit. Use one_lang_size_sections_pass.
(lang_do_assignments): Remove all params. Update all callers.
(lang_reset_memory_regions): Clear os->processed for all output
section statements.
* ldlang.h (lang_do_assignments): Update prototype.
(lang_size_sections): Likewise.
(one_lang_size_sections_pass): Declare.
* pe-dll.c (pe_dll_fill_sections, pe_exe_fill_sections): Update
lang_size_sections and lang_do_assignments calls.
* emultempl/elf32.em (layout_sections_again): Likewise.
* emultempl/ppc64elf.em (ppc_before_allocation): Use
one_lang_size_sections_pass.
* ldexp.h (segment_type): New type.
(segments): New variable.
* ldexp.c (segments): New variable.
(exp_print_token): Handle SEGMENT_START.
(fold_binary): Likewise.
* ldgram.y (SEGMENT_START): Declare it as a token.
(exp): Handle SEGMENT_START.
* ldlang.h (lang_address_statement_type): Add segment field.
(lang_section_start): Change prototype.
* ldlang.c (map_input_to_output_sections): Do not process section
assignments if a corresponding SEGMENT_START has already been
seen.
(lang_section_start): Add segment parameter.
* ldlex.l (SEGMENT_START): Add it.
* lexsup.c (seg_segment_start): New function.
(parse_args): Use it for -Tbss, -Tdata, and -Ttext.
* ld.texinfo (SEGMENT_START): Document it.
* emulparams/armsymbian.sh (EMBEDDED): Set it.
* scripttempl/armbpabi.sc: Use SEGMENT_START to control segment
base addresses. Do not map relocations.
* NEWS: Mention SEGMENT_START.
* scripttempl/elf.sc (DATA_SEGMENT_RELRO_END): Add 0 as first
argument.
(DATA_SEGMENT_RELRO_GOTPLT_END): Pass $SEPARATE_GOTPLT as first
and . as second argument.
(GOTPLT): Move $DATA_SEGMENT_RELRO_GOTPLT_END before the section.
* ldexp.c (fold_unary): Remove DATA_SEGMENT_RELRO_END handling here.
(fold_binary): Add it here. Insert padding to make relro_end
COMMONPAGESIZE bytes aligned. For DATA_SEGMENT_ALIGN in
exp_dataseg_relro_adjust phase just use previously computed
exp_data_seg.base.
* ldlang.c (lang_size_sections): Set exp_data_seg.base for
relro_adjust here. Call lang_size_sections_1 once more if there
was too big padding at DATA_SEGMENT_RELRO_END.
* ld.texinfo (DATA_SEGMENT_RELRO_END): Add documentation.
(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.
* 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.
* 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.
* 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.
* 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.
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.