diff options
author | Alan Modra <amodra@gmail.com> | 2016-03-30 17:39:36 +1030 |
---|---|---|
committer | Alan Modra <amodra@gmail.com> | 2016-03-30 17:50:03 +1030 |
commit | 2e4a7aea70a94d0efe1ad1912f8392c848d8de54 (patch) | |
tree | fc2eb10f13df13dbef01c1e049e027c964bf8979 /ld | |
parent | 4ae6cc19626d010005fbfbfba72952d26cc7c728 (diff) | |
download | gdb-2e4a7aea70a94d0efe1ad1912f8392c848d8de54.zip gdb-2e4a7aea70a94d0efe1ad1912f8392c848d8de54.tar.gz gdb-2e4a7aea70a94d0efe1ad1912f8392c848d8de54.tar.bz2 |
Use consistent test for .tbss sections in ldlang.c
Some places tested SEC_LOAD, others SEC_HAS_CONTENTS.
* 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.
Diffstat (limited to 'ld')
-rw-r--r-- | ld/ChangeLog | 7 | ||||
-rw-r--r-- | ld/ldlang.c | 20 |
2 files changed, 15 insertions, 12 deletions
diff --git a/ld/ChangeLog b/ld/ChangeLog index 0e16f80..4508d2e 100644 --- a/ld/ChangeLog +++ b/ld/ChangeLog @@ -1,3 +1,10 @@ +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 diff --git a/ld/ldlang.c b/ld/ldlang.c index 2efab24..235a246 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); |