diff --git a/ld/ChangeLog b/ld/ChangeLog index 0e16f80e99..4508d2e4e5 100644 --- a/ld/ChangeLog +++ b/ld/ChangeLog @@ -1,3 +1,10 @@ +2016-03-30 Alan Modra + + * ldlang.c (IS_TBSS): New macro, extracted from.. + (IGNORE_SECTION): ..here. + (lang_size_sections_1): Use IS_TBSS and IGNORE_SECTION. + (lang_size_sections, lang_do_assignments_1): Use IS_TBSS. + 2016-03-22 Nick Clifton PR ld/19803 diff --git a/ld/ldlang.c b/ld/ldlang.c index 2efab242c0..235a246452 100644 --- a/ld/ldlang.c +++ b/ld/ldlang.c @@ -4697,10 +4697,11 @@ sort_sections_by_lma (const void *arg1, const void *arg2) return 0; } +#define IS_TBSS(s) \ + ((s->flags & (SEC_LOAD | SEC_THREAD_LOCAL)) == SEC_THREAD_LOCAL) + #define IGNORE_SECTION(s) \ - ((s->flags & SEC_ALLOC) == 0 \ - || ((s->flags & SEC_THREAD_LOCAL) != 0 \ - && (s->flags & SEC_LOAD) == 0)) + ((s->flags & SEC_ALLOC) == 0 || IS_TBSS (s)) /* Check to see if any allocated sections overlap with other allocated sections. This can happen if a linker script specifies the output @@ -5109,9 +5110,7 @@ lang_size_sections_1 To avoid warnings about dot moving backwards when using -Ttext, don't start tracking sections until we find one of non-zero size or with lma set differently to vma. */ - if (((os->bfd_section->flags & SEC_HAS_CONTENTS) != 0 - || (os->bfd_section->flags & SEC_THREAD_LOCAL) == 0) - && (os->bfd_section->flags & SEC_ALLOC) != 0 + if (!IGNORE_SECTION (os->bfd_section) && (os->bfd_section->size != 0 || (r->last_os == NULL && os->bfd_section->vma != os->bfd_section->lma) @@ -5123,8 +5122,7 @@ lang_size_sections_1 r->last_os = s; /* .tbss sections effectively have zero size. */ - if ((os->bfd_section->flags & SEC_HAS_CONTENTS) != 0 - || (os->bfd_section->flags & SEC_THREAD_LOCAL) == 0 + if (!IS_TBSS (os->bfd_section) || bfd_link_relocatable (&link_info)) dotdelta = TO_ADDR (os->bfd_section->size); else @@ -5466,8 +5464,7 @@ lang_size_sections (bfd_boolean *relax, bfd_boolean check_regions) bfd_vma start, end, bump; end = start = sec->vma; - if ((sec->flags & SEC_HAS_CONTENTS) != 0 - || (sec->flags & SEC_THREAD_LOCAL) == 0) + if (!IS_TBSS (sec)) end += sec->size; bump = desired_end - end; /* We'd like to increase START by BUMP, but we must heed @@ -5563,8 +5560,7 @@ lang_do_assignments_1 (lang_statement_union_type *s, os, os->fill, dot, found_end); /* .tbss sections effectively have zero size. */ - if ((os->bfd_section->flags & SEC_HAS_CONTENTS) != 0 - || (os->bfd_section->flags & SEC_THREAD_LOCAL) == 0 + if (!IS_TBSS (os->bfd_section) || bfd_link_relocatable (&link_info)) dot += TO_ADDR (os->bfd_section->size);