- if (expld.result.section == NULL)
- expld.result.section = expld.section;
- if (!update_definedness (tree->assign.dst, h) && 0)
- {
- /* Symbol was already defined. For now this error
- is disabled because it causes failures in the ld
- testsuite: ld-elf/var1, ld-scripts/defined5, and
- ld-scripts/pr14962. Some of these no doubt
- reflect scripts used in the wild. */
- (*link_info.callbacks->multiple_definition)
- (&link_info, h, link_info.output_bfd,
- expld.result.section, expld.result.value);
- }
- h->type = bfd_link_hash_defined;
- h->u.def.value = expld.result.value;
- h->u.def.section = expld.result.section;
- h->linker_def = ! tree->assign.type.lineno;
- h->ldscript_def = 1;
- if (tree->type.node_class == etree_provide)
- tree->type.node_class = etree_provided;
-
- /* Copy the symbol type if this is a simple assignment of
- one symbol to another. Also, handle the case of a foldable
- ternary conditional with names on either side. */
- if (tree->assign.src->type.node_class == etree_name)
- try_copy_symbol_type (h, tree->assign.src);
- else if (tree->assign.src->type.node_class == etree_trinary)
+ /* If the expression is not valid then fake a zero value. In
+ the final phase any errors will already have been raised,
+ in earlier phases we want to create this definition so
+ that it can be seen by other expressions. */
+ if (!expld.result.valid_p
+ && h->type == bfd_link_hash_new)
+ {
+ expld.result.value = 0;
+ expld.result.section = NULL;
+ expld.result.valid_p = TRUE;
+ }
+
+ if (expld.result.valid_p)