+2016-03-30 Alan Modra <amodra@gmail.com>
+
+ * 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 <nickc@redhat.com>
PR ld/19803
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
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)
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
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
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);