for (s = dynobj->sections; s != NULL; s = s->next)
{
const char * name;
- bfd_boolean strip;
if ((s->flags & SEC_LINKER_CREATED) == 0)
continue;
of the dynobj section names depend upon the input files. */
name = bfd_get_section_name (dynobj, s);
- strip = FALSE;
-
if (strcmp (name, ".plt") == 0)
{
- if (s->size == 0)
- {
- /* Strip this section if we don't need it; see the
- comment below. */
- strip = TRUE;
- }
- else
- {
- /* Remember whether there is a PLT. */
- plt = TRUE;
- }
+ /* Remember whether there is a PLT. */
+ plt = s->size != 0;
}
else if (strncmp (name, ".rel", 4) == 0)
{
- if (s->size == 0)
- {
- /* If we don't need this section, strip it from the
- output file. This is mostly to handle .rel.bss and
- .rel.plt. We must create both sections in
- create_dynamic_sections, because they must be created
- before the linker maps input sections to output
- sections. The linker does that before
- adjust_dynamic_symbol is called, and it is that
- function which decides whether anything needs to go
- into these sections. */
- strip = TRUE;
- }
- else
+ if (s->size != 0)
{
/* Remember whether there are any reloc sections other
than .rel.plt. */
s->reloc_count = 0;
}
}
- else if (strncmp (name, ".got", 4) != 0)
+ else if (strncmp (name, ".got", 4) != 0
+ && strcmp (name, ".dynbss") != 0)
{
/* It's not one of our sections, so don't allocate space. */
continue;
}
- if (strip)
+ if (s->size == 0)
{
+ /* If we don't need this section, strip it from the
+ output file. This is mostly to handle .rel.bss and
+ .rel.plt. We must create both sections in
+ create_dynamic_sections, because they must be created
+ before the linker maps input sections to output
+ sections. The linker does that before
+ adjust_dynamic_symbol is called, and it is that
+ function which decides whether anything needs to go
+ into these sections. */
s->flags |= SEC_EXCLUDE;
continue;
}
+ if ((s->flags & SEC_HAS_CONTENTS) == 0)
+ continue;
+
/* Allocate memory for the section contents. */
s->contents = (bfd_byte *) bfd_zalloc (dynobj, s->size);
- if (s->contents == NULL && s->size != 0)
+ if (s->contents == NULL)
return FALSE;
}
#define add_dynamic_entry(TAG, VAL) \
_bfd_elf_add_dynamic_entry (info, TAG, VAL)
- if (!info->shared)
+ if (info->executable)
{
if (!add_dynamic_entry (DT_DEBUG, 0))
return FALSE;
{
if (!add_dynamic_entry (DT_TEXTREL, 0))
return FALSE;
- info->flags |= DF_TEXTREL;
}
}
-#undef add_synamic_entry
+#undef add_dynamic_entry
return TRUE;
}
return ret;
}
-static struct bfd_elf_special_section const
- symbian_special_sections_d[]=
+static const struct bfd_elf_special_section
+elf32_arm_symbian_special_sections[] =
{
/* In a BPABI executable, the dynamic linking sections do not go in
the loadable read-only segment. The post-linker may wish to
{ ".dynamic", 8, 0, SHT_DYNAMIC, 0 },
{ ".dynstr", 7, 0, SHT_STRTAB, 0 },
{ ".dynsym", 7, 0, SHT_DYNSYM, 0 },
- { NULL, 0, 0, 0, 0 }
-};
-
-static struct bfd_elf_special_section const
- symbian_special_sections_g[]=
-{
- /* In a BPABI executable, the dynamic linking sections do not go in
- the loadable read-only segment. The post-linker may wish to
- refer to these sections, but they are not part of the final
- program image. */
{ ".got", 4, 0, SHT_PROGBITS, 0 },
- { NULL, 0, 0, 0, 0 }
-};
-
-static struct bfd_elf_special_section const
- symbian_special_sections_h[]=
-{
- /* In a BPABI executable, the dynamic linking sections do not go in
- the loadable read-only segment. The post-linker may wish to
- refer to these sections, but they are not part of the final
- program image. */
{ ".hash", 5, 0, SHT_HASH, 0 },
- { NULL, 0, 0, 0, 0 }
-};
-
-static struct bfd_elf_special_section const
- symbian_special_sections_i[]=
-{
/* These sections do not need to be writable as the SymbianOS
postlinker will arrange things so that no dynamic relocation is
required. */
{ ".init_array", 11, 0, SHT_INIT_ARRAY, SHF_ALLOC },
- { NULL, 0, 0, 0, 0 }
-};
-
-static struct bfd_elf_special_section const
- symbian_special_sections_f[]=
-{
- /* These sections do not need to be writable as the SymbianOS
- postlinker will arrange things so that no dynamic relocation is
- required. */
{ ".fini_array", 11, 0, SHT_FINI_ARRAY, SHF_ALLOC },
- { NULL, 0, 0, 0, 0 }
-};
-
-static struct bfd_elf_special_section const
- symbian_special_sections_p[]=
-{
- /* These sections do not need to be writable as the SymbianOS
- postlinker will arrange things so that no dynamic relocation is
- required. */
{ ".preinit_array", 14, 0, SHT_PREINIT_ARRAY, SHF_ALLOC },
{ NULL, 0, 0, 0, 0 }
};
-static struct bfd_elf_special_section const *
- elf32_arm_symbian_special_sections[27]=
-{
- NULL, /* 'a' */
- NULL, /* 'b' */
- NULL, /* 'c' */
- symbian_special_sections_d, /* 'd' */
- NULL, /* 'e' */
- symbian_special_sections_f, /* 'f' */
- symbian_special_sections_g, /* 'g' */
- symbian_special_sections_h, /* 'h' */
- symbian_special_sections_i, /* 'i' */
- NULL, /* 'j' */
- NULL, /* 'k' */
- NULL, /* 'l' */
- NULL, /* 'm' */
- NULL, /* 'n' */
- NULL, /* 'o' */
- symbian_special_sections_p, /* 'p' */
- NULL, /* 'q' */
- NULL, /* 'r' */
- NULL, /* 's' */
- NULL, /* 't' */
- NULL, /* 'u' */
- NULL, /* 'v' */
- NULL, /* 'w' */
- NULL, /* 'x' */
- NULL, /* 'y' */
- NULL, /* 'z' */
- NULL /* other */
-};
-
static void
elf32_arm_symbian_begin_write_processing (bfd *abfd,
struct bfd_link_info *link_info