diff options
Diffstat (limited to 'ld/ldlang.c')
-rw-r--r-- | ld/ldlang.c | 78 |
1 files changed, 9 insertions, 69 deletions
diff --git a/ld/ldlang.c b/ld/ldlang.c index 32c4af3..6f4e200 100644 --- a/ld/ldlang.c +++ b/ld/ldlang.c @@ -3249,6 +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); + break; default: break; } @@ -3395,65 +3398,6 @@ lang_place_undefineds (void) insert_undefined (ptr->name); } -typedef struct bfd_sym_chain ldlang_def_chain_list_type; - -static ldlang_def_chain_list_type ldlang_def_chain_list_head; - -/* Insert NAME as defined in the symbol table. */ - -static void -insert_defined (const char *name) -{ - struct bfd_link_hash_entry *h; - - h = bfd_link_hash_lookup (link_info.hash, name, TRUE, FALSE, TRUE); - if (h == NULL) - einfo (_("%P%F: bfd_link_hash_lookup failed: %E\n")); - if (h->type == bfd_link_hash_new - || h->type == bfd_link_hash_undefined - || h->type == bfd_link_hash_undefweak) - { - h->type = bfd_link_hash_defined; - h->u.def.section = bfd_abs_section_ptr; - h->u.def.value = 0; - } -} - -/* Like lang_add_undef, but this time for symbols defined on the - command line. */ - -static void -ldlang_add_def (const char *const name) -{ - if (link_info.output_bfd != NULL) - insert_defined (xstrdup (name)); - else - { - ldlang_def_chain_list_type *new_def; - - new_def = (ldlang_def_chain_list_type *) stat_alloc (sizeof (*new_def)); - new_def->next = ldlang_def_chain_list_head.next; - ldlang_def_chain_list_head.next = new_def; - - new_def->name = xstrdup (name); - } -} - -/* Run through the list of defineds created above and place them - into the linker hash table as defined symbols belonging to the - script file. */ - -static void -lang_place_defineds (void) -{ - ldlang_def_chain_list_type *ptr; - - for (ptr = ldlang_def_chain_list_head.next; - ptr != NULL; - ptr = ptr->next) - insert_defined (ptr->name); -} - /* Check for all readonly or some readwrite sections. */ static void @@ -3982,12 +3926,12 @@ scan_for_self_assignment (const char * dst, etree_type * rhs) switch (rhs->type.node_class) { case etree_binary: - return scan_for_self_assignment (dst, rhs->binary.lhs) - || scan_for_self_assignment (dst, rhs->binary.rhs); + return (scan_for_self_assignment (dst, rhs->binary.lhs) + || scan_for_self_assignment (dst, rhs->binary.rhs)); case etree_trinary: - return scan_for_self_assignment (dst, rhs->trinary.lhs) - || scan_for_self_assignment (dst, rhs->trinary.rhs); + return (scan_for_self_assignment (dst, rhs->trinary.lhs) + || scan_for_self_assignment (dst, rhs->trinary.rhs)); case etree_assign: case etree_provided: @@ -4042,7 +3986,7 @@ print_assignment (lang_assignment_statement_type *assignment, is_dot = (dst[0] == '.' && dst[1] == 0); tree = assignment->exp->assign.src; - computation_is_valid = is_dot || (scan_for_self_assignment (dst, tree) == FALSE); + computation_is_valid = is_dot || !scan_for_self_assignment (dst, tree); } osec = output_section->bfd_section; @@ -6461,7 +6405,6 @@ lang_process (void) /* Add to the hash table all undefineds on the command line. */ lang_place_undefineds (); - lang_place_defineds (); if (!bfd_section_already_linked_table_init ()) einfo (_("%P%F: Failed to create hash table\n")); @@ -6523,6 +6466,7 @@ lang_process (void) /* Run through the contours of the script and attach input sections to the correct output sections. */ + lang_statement_iteration++; map_input_to_output_sections (statement_list.head, NULL, NULL); process_insert_statements (); @@ -6746,10 +6690,6 @@ lang_add_assignment (etree_type *exp) { lang_assignment_statement_type *new_stmt; - extern int parsing_defsym; - if (parsing_defsym) - ldlang_add_def (exp->assign.dst); - new_stmt = new_stat (lang_assignment_statement, stat_ptr); new_stmt->exp = exp; return new_stmt; |