ld: track linker-definedness of symbols

Keep "lineno" as zero while not processing any script, and use it being
zero to set the "linker_def" field to true.
This commit is contained in:
Jan Beulich 2016-07-05 11:36:08 +02:00 committed by Jan Beulich
parent 33d0ab9548
commit 1753ed6811
3 changed files with 14 additions and 5 deletions

View file

@ -1,3 +1,10 @@
2016-07-05 Jan Beulich <jbeulich@suse.com>
* ldexp.c (exp_fold_tree_1): Set linker_def field based on
assignment line number.
* ldlex.l (lineno): Drop initializer.
(<<EOF>>): Set lineno to zero after reaching top of stack.
2016-07-04 H.J. Lu <hongjiu.lu@intel.com> 2016-07-04 H.J. Lu <hongjiu.lu@intel.com>
PR ld/20321 PR ld/20321

View file

@ -1182,7 +1182,7 @@ exp_fold_tree_1 (etree_type *tree)
h->type = bfd_link_hash_defined; h->type = bfd_link_hash_defined;
h->u.def.value = expld.result.value; h->u.def.value = expld.result.value;
h->u.def.section = expld.result.section; h->u.def.section = expld.result.section;
h->linker_def = 0; h->linker_def = ! tree->assign.type.lineno;
if (tree->type.node_class == etree_provide) if (tree->type.node_class == etree_provide)
tree->type.node_class = etree_provided; tree->type.node_class = etree_provided;

View file

@ -39,9 +39,8 @@
yylex and yyparse (indirectly) both check this. */ yylex and yyparse (indirectly) both check this. */
input_type parser_input; input_type parser_input;
/* Line number in the current input file. /* Line number in the current input file. */
(FIXME Actually, it doesn't appear to get reset for each file?) */ unsigned int lineno;
unsigned int lineno = 1;
/* The string we are currently lexing, or NULL if we are reading a /* The string we are currently lexing, or NULL if we are reading a
file. */ file. */
@ -460,7 +459,10 @@ V_IDENTIFIER [*?.$_a-zA-Z\[\]\-\!\^\\]([*?.$_a-zA-Z0-9\[\]\-\!\^\\]|::)*
<<EOF>> { <<EOF>> {
include_stack_ptr--; include_stack_ptr--;
if (include_stack_ptr == 0) if (include_stack_ptr == 0)
yyterminate (); {
lineno = 0;
yyterminate ();
}
else else
yy_switch_to_buffer (include_stack[include_stack_ptr]); yy_switch_to_buffer (include_stack[include_stack_ptr]);