PR ld/12356
* ld.texinfo (Miscellaneous Commands): Describe LD_FEATURE. (Expression Section): Update. * ld.h (ld_config_type): Add sane_expr. * ldgram.y (ifile_p1): Add LD_FEATURE. * ldlex.l (LD_FEATYRE): New. * ldemul.c (after_parse_default): Delete code handling ld_compatibility. * ldexp.h (struct ldexp_control): Delete uses_defined. * ldexp.c: Remove all uses of uses_defined. (fold_name): Test config.sane_expr rather than ld_compatibility. (exp_fold_tree_1): Likewise. Adjust handling of assignments during first phase. * ldlang.h (ld_compatibility): Delete. (lang_ld_feature): Declare. * ldlang.c (ld_compatibility): Delete. (open_input_bfds): Only handle assignments for --defsym. (lang_ld_feature): New function.
This commit is contained in:
parent
2e57b2afce
commit
01554a74b5
10 changed files with 77 additions and 26 deletions
34
ld/ldlang.c
34
ld/ldlang.c
|
@ -108,7 +108,6 @@ bfd_boolean delete_output_file_on_failure = FALSE;
|
|||
struct lang_phdr *lang_phdr_list;
|
||||
struct lang_nocrossrefs *nocrossref_list;
|
||||
bfd_boolean missing_file = FALSE;
|
||||
int ld_compatibility;
|
||||
|
||||
/* Functions that traverse the linker script and might evaluate
|
||||
DEFINED() need to increment this. */
|
||||
|
@ -3250,7 +3249,9 @@ open_input_bfds (lang_statement_union_type *s, bfd_boolean force)
|
|||
}
|
||||
break;
|
||||
case lang_assignment_statement_enum:
|
||||
exp_fold_tree_no_dot (s->assignment_statement.exp);
|
||||
if (s->assignment_statement.exp->assign.hidden)
|
||||
/* This is from a --defsym on the command line. */
|
||||
exp_fold_tree_no_dot (s->assignment_statement.exp);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
@ -7845,3 +7846,32 @@ lang_append_dynamic_list_cpp_new (void)
|
|||
|
||||
lang_append_dynamic_list (dynamic);
|
||||
}
|
||||
|
||||
/* Scan a space and/or comma separated string of features. */
|
||||
|
||||
void
|
||||
lang_ld_feature (char *str)
|
||||
{
|
||||
char *p, *q;
|
||||
|
||||
p = str;
|
||||
while (*p)
|
||||
{
|
||||
char sep;
|
||||
while (*p == ',' || ISSPACE (*p))
|
||||
++p;
|
||||
if (!*p)
|
||||
break;
|
||||
q = p + 1;
|
||||
while (*q && *q != ',' && !ISSPACE (*q))
|
||||
++q;
|
||||
sep = *q;
|
||||
*q = 0;
|
||||
if (strcasecmp (p, "SANE_EXPR") == 0)
|
||||
config.sane_expr = TRUE;
|
||||
else
|
||||
einfo (_("%X%P: unknown feature `%s'\n"), p);
|
||||
*q = sep;
|
||||
p = q;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue