X-Git-Url: http://drtracing.org/?a=blobdiff_plain;f=ld%2Fldlang.c;h=89b896f51dfe81faa37bd9130a577a228bde0edf;hb=77f5e65ecfb669ea1d2fd74b74fbbf0d0c20daf8;hp=0a224d4473491956fe285e878544db9c41fc32f7;hpb=9ef7906f20e81faa4498761002e6376f4d35c865;p=deliverable%2Fbinutils-gdb.git diff --git a/ld/ldlang.c b/ld/ldlang.c index 0a224d4473..89b896f51d 100644 --- a/ld/ldlang.c +++ b/ld/ldlang.c @@ -1,5 +1,5 @@ /* Linker command language support. - Copyright (C) 1991-2016 Free Software Foundation, Inc. + Copyright (C) 1991-2017 Free Software Foundation, Inc. This file is part of the GNU Binutils. @@ -2035,14 +2035,11 @@ static void lang_print_asneeded (void) { struct asneeded_minfo *m; - char buf[100]; if (asneeded_list_head == NULL) return; - sprintf (buf, _("\nAs-needed library included " - "to satisfy reference by file (symbol)\n\n")); - minfo ("%s", buf); + minfo (_("\nAs-needed library included to satisfy reference by file (symbol)\n\n")); for (m = asneeded_list_head; m != NULL; m = m->next) { @@ -3377,7 +3374,8 @@ open_input_bfds (lang_statement_union_type *s, enum open_bfd_mode mode) #endif break; case lang_assignment_statement_enum: - if (s->assignment_statement.exp->assign.defsym) + if (s->assignment_statement.exp->type.node_class != etree_assert + && s->assignment_statement.exp->assign.defsym) /* This is from a --defsym on the command line. */ exp_fold_tree_no_dot (s->assignment_statement.exp); break; @@ -6846,6 +6844,27 @@ lang_check_relocs (void) } } +/* Look through all output sections looking for places where we can + propagate forward the lma region. */ + +static void +lang_propagate_lma_regions (void) +{ + lang_output_section_statement_type *os; + + for (os = &lang_output_section_statement.head->output_section_statement; + os != NULL; + os = os->next) + { + if (os->prev != NULL + && os->lma_region == NULL + && os->load_base == NULL + && os->addr_tree == NULL + && os->region == os->prev->region) + os->lma_region = os->prev->lma_region; + } +} + void lang_process (void) { @@ -7024,6 +7043,9 @@ lang_process (void) } } + /* Copy forward lma regions for output sections in same lma region. */ + lang_propagate_lma_regions (); + /* Do anything special before sizing sections. This is where ELF and other back-ends size dynamic sections. */ ldemul_before_allocation (); @@ -7304,16 +7326,6 @@ lang_leave_output_section_statement (fill_type *fill, const char *memspec, current_section->load_base != NULL, current_section->addr_tree != NULL); - /* If this section has no load region or base, but uses the same - region as the previous section, then propagate the previous - section's load region. */ - - if (current_section->lma_region == NULL - && current_section->load_base == NULL - && current_section->addr_tree == NULL - && current_section->region == current_section->prev->region) - current_section->lma_region = current_section->prev->lma_region; - current_section->fill = fill; current_section->phdrs = phdrs; pop_stat_ptr ();