From: Jan Beulich Date: Tue, 5 Jul 2016 09:36:08 +0000 (+0200) Subject: ld: track linker-definedness of symbols X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=1753ed681125949b081376dd97056a3f2930e7d7;p=binutils-gdb.git 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. --- diff --git a/ld/ChangeLog b/ld/ChangeLog index 7e24b9506ad..53f24280adb 100644 --- a/ld/ChangeLog +++ b/ld/ChangeLog @@ -1,3 +1,10 @@ +2016-07-05 Jan Beulich + + * ldexp.c (exp_fold_tree_1): Set linker_def field based on + assignment line number. + * ldlex.l (lineno): Drop initializer. + (<>): Set lineno to zero after reaching top of stack. + 2016-07-04 H.J. Lu PR ld/20321 diff --git a/ld/ldexp.c b/ld/ldexp.c index 4e9c03fc554..649954fbfdc 100644 --- a/ld/ldexp.c +++ b/ld/ldexp.c @@ -1182,7 +1182,7 @@ exp_fold_tree_1 (etree_type *tree) h->type = bfd_link_hash_defined; h->u.def.value = expld.result.value; 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) tree->type.node_class = etree_provided; diff --git a/ld/ldlex.l b/ld/ldlex.l index 2eb8fc1020f..e1394a03576 100644 --- a/ld/ldlex.l +++ b/ld/ldlex.l @@ -39,9 +39,8 @@ yylex and yyparse (indirectly) both check this. */ input_type parser_input; -/* Line number in the current input file. - (FIXME Actually, it doesn't appear to get reset for each file?) */ -unsigned int lineno = 1; +/* Line number in the current input file. */ +unsigned int lineno; /* The string we are currently lexing, or NULL if we are reading a file. */ @@ -460,7 +459,10 @@ V_IDENTIFIER [*?.$_a-zA-Z\[\]\-\!\^\\]([*?.$_a-zA-Z0-9\[\]\-\!\^\\]|::)* <> { include_stack_ptr--; if (include_stack_ptr == 0) - yyterminate (); + { + lineno = 0; + yyterminate (); + } else yy_switch_to_buffer (include_stack[include_stack_ptr]);