+2005-07-04 Alan Modra <amodra@bigpond.net.au>
+
+ PR 1004
+ * elf-bfd.h (struct elf_backend_data): Add get_sec_type_attr. Delete
+ special_sections.
+ (_bfd_elf_get_special_section): Declare.
+ (bfd_elf_special_section): Update prototype.
+ * elf.c (special_sections): Remove unused outer entries.
+ (get_special_section): Delete.
+ (_bfd_elf_get_special_section): New function.
+ (_bfd_elf_get_sec_type_attr): Replace "name" arg with "sec". Update
+ special_sections indexing.
+ (_bfd_elf_new_section_hook): Call backend get_sec_type_attr.
+ * elf32-arm.c (symbian_special_sections_d): Delete.
+ (symbian_special_sections_g, symbian_special_sections_h): Delete.
+ (symbian_special_sections_i, symbian_special_sections_f): Delete.
+ (symbian_special_sections_p): Delete.
+ (elf32_arm_symbian_special_sections): Merge above to here.
+ (elf32_arm_symbian_get_sec_type_attr): New function.
+ (elf_backend_special_sections): Don't define.
+ (elf_backend_get_sec_type_attr): Define.
+ * elf32-m32r.c: Similarly to elf32-arm.c.
+ * elf32-m68hc11.c: Likewise.
+ * elf32-m68hc12.c: Likewise.
+ * elf32-mcore.c: Likewise.
+ * elf32-sh64.c: Likewise.
+ * elf32-v850.c: Likewise.
+ * elf32-xtensa.c: Likewise.
+ * elf64-alpha.c: Likewise.
+ * elf64-hppa.c: Likewise.
+ * elf64-ppc.c: Likewise.
+ * elf64-sh64.c: Likewise.
+ * elfxx-ia64.c: Likewise.
+ * elfxx-mips.c: Likewise.
+ * elf32-ppc.c: Likewise.
+ (bfd_elf_special_section ppc_alt_plt): New. Use it if .plt loadable.
+ * elfxx-mips.h (_bfd_mips_elf_get_sec_type_attr): Declare.
+ (_bfd_mips_elf_special_sections, elf_backend_special_sections): Delete.
+ (elf_backend_get_sec_type_attr): Define.
+ * elfxx-target.h (elf_backend_get_sec_type_attr): Define.
+ (elf_backend_special_sections): Don't define.
+ (elfNN_bed): Update.
+
2005-07-01 Nick Clifton <nickc@redhat.com>
* cpu-d10v.c: Update to ISO C90 style function declarations and
bfd_boolean (*elf_backend_section_from_shdr)
(bfd *, Elf_Internal_Shdr *, const char *, int);
- /* A function to convert machine dependent section header flags to
+ /* A function to convert machine dependent ELF section header flags to
BFD internal section header flags. */
bfd_boolean (*elf_backend_section_flags)
(flagword *, const Elf_Internal_Shdr *);
+ /* A function that returns a struct containing ELF section flags and
+ type for the given BFD section. */
+ const struct bfd_elf_special_section * (*get_sec_type_attr)
+ (bfd *, asection *);
+
/* A function to handle unusual program segment types when creating BFD
sections from ELF program segments. */
bfd_boolean (*elf_backend_section_from_phdr)
const struct elf_size_info *s;
- /* An array of 27 target specific special section map arrays,
- covering 'a' to 'z', plus other. */
- const struct bfd_elf_special_section **special_sections;
-
/* The size in bytes of the header for the GOT. This includes the
so-called reserved entries on some systems. */
bfd_vma got_header_size;
(bfd *, asection *);
extern bfd_boolean _bfd_elf_init_reloc_shdr
(bfd *, Elf_Internal_Shdr *, asection *, bfd_boolean);
+extern const struct bfd_elf_special_section *_bfd_elf_get_special_section
+ (const char *, const struct bfd_elf_special_section *, unsigned int);
extern const struct bfd_elf_special_section *_bfd_elf_get_sec_type_attr
- (bfd *, const char *);
+ (bfd *, asection *);
/* If the target doesn't have reloc handling written yet: */
extern void _bfd_elf_no_info_to_howto
{ NULL, 0, 0, 0, 0 }
};
-static struct bfd_elf_special_section const *special_sections [27] =
+static struct bfd_elf_special_section const *special_sections[] =
{
- NULL, /* 'a' */
special_sections_b, /* 'b' */
special_sections_c, /* 'b' */
special_sections_d, /* 'd' */
special_sections_r, /* 'r' */
special_sections_s, /* 's' */
special_sections_t, /* 't' */
- NULL, /* 'u' */
- NULL, /* 'v' */
- NULL, /* 'w' */
- NULL, /* 'x' */
- NULL, /* 'y' */
- NULL, /* 'z' */
- NULL /* other */
};
-static const struct bfd_elf_special_section *
-get_special_section (const char *name,
- const struct bfd_elf_special_section **special_sections_p,
- unsigned int rela)
+const struct bfd_elf_special_section *
+_bfd_elf_get_special_section (const char *name,
+ const struct bfd_elf_special_section *spec,
+ unsigned int rela)
{
int i;
int len;
- const struct bfd_elf_special_section *special_sections;
-
- if (name [0] == '.')
- {
- i = name [1] - 'a';
- if (i < 0 || i > 25)
- i = 26;
- }
- else
- i = 26;
-
- special_sections = special_sections_p [i];
- if (!special_sections)
- return special_sections;
+ len = strlen (name);
- len= strlen (name);
-
- for (i = 0; special_sections[i].prefix != NULL; i++)
+ for (i = 0; spec[i].prefix != NULL; i++)
{
int suffix_len;
- int prefix_len = special_sections[i].prefix_length;
+ int prefix_len = spec[i].prefix_length;
if (len < prefix_len)
continue;
- if (memcmp (name, special_sections[i].prefix, prefix_len) != 0)
+ if (memcmp (name, spec[i].prefix, prefix_len) != 0)
continue;
- suffix_len = special_sections[i].suffix_length;
+ suffix_len = spec[i].suffix_length;
if (suffix_len <= 0)
{
if (name[prefix_len] != 0)
continue;
if (name[prefix_len] != '.'
&& (suffix_len == -2
- || (rela && special_sections[i].type == SHT_REL)))
+ || (rela && spec[i].type == SHT_REL)))
continue;
}
}
if (len < prefix_len + suffix_len)
continue;
if (memcmp (name + len - suffix_len,
- special_sections[i].prefix + prefix_len,
+ spec[i].prefix + prefix_len,
suffix_len) != 0)
continue;
}
- return &special_sections[i];
+ return &spec[i];
}
return NULL;
}
const struct bfd_elf_special_section *
-_bfd_elf_get_sec_type_attr (bfd *abfd, const char *name)
+_bfd_elf_get_sec_type_attr (bfd *abfd ATTRIBUTE_UNUSED, asection *sec)
{
- const struct elf_backend_data *bed = get_elf_backend_data (abfd);
- const struct bfd_elf_special_section *ssect = NULL;
+ int i;
+ const struct bfd_elf_special_section *spec;
/* See if this is one of the special sections. */
- if (name)
- {
- unsigned int rela = bed->default_use_rela_p;
+ if (sec->name == NULL)
+ return NULL;
- if (bed->special_sections)
- ssect = get_special_section (name, bed->special_sections, rela);
+ if (sec->name[0] != '.')
+ return NULL;
- if (! ssect)
- ssect = get_special_section (name, special_sections, rela);
- }
+ i = sec->name[1] - 'b';
+ if (i < 0 || i > 't' - 'b')
+ return NULL;
+
+ spec = special_sections[i];
- return ssect;
+ if (spec == NULL)
+ return NULL;
+
+ return _bfd_elf_get_special_section (sec->name, spec, sec->use_rela_p);
}
bfd_boolean
_bfd_elf_new_section_hook (bfd *abfd, asection *sec)
{
struct bfd_elf_section_data *sdata;
+ const struct elf_backend_data *bed;
const struct bfd_elf_special_section *ssect;
sdata = (struct bfd_elf_section_data *) sec->used_by_bfd;
sec->used_by_bfd = sdata;
}
+ /* Indicate whether or not this section should use RELA relocations. */
+ bed = get_elf_backend_data (abfd);
+ sec->use_rela_p = bed->default_use_rela_p;
+
/* When we read a file, we don't need section type and flags unless
it is a linker created section. They will be overridden in
_bfd_elf_make_section_from_shdr anyway. */
if (abfd->direction != read_direction
|| (sec->flags & SEC_LINKER_CREATED) != 0)
{
- ssect = _bfd_elf_get_sec_type_attr (abfd, sec->name);
+ ssect = (*bed->get_sec_type_attr) (abfd, sec);
if (ssect != NULL)
{
elf_section_type (sec) = ssect->type;
}
}
- /* Indicate whether or not this section should use RELA relocations. */
- sec->use_rela_p = get_elf_backend_data (abfd)->default_use_rela_p;
-
return TRUE;
}
}
static struct bfd_elf_special_section const
- symbian_special_sections_d[]=
+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]=
+static const struct bfd_elf_special_section *
+elf32_arm_symbian_get_sec_type_attr (bfd *abfd, asection *sec)
{
- 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 */
-};
+ const struct bfd_elf_special_section const *ssect;
+
+ /* See if this is one of the special sections. */
+ if (sec->name == NULL)
+ return NULL;
+
+ ssect = _bfd_elf_get_special_section (sec->name,
+ elf32_arm_symbian_special_sections,
+ sec->use_rela_p);
+ if (ssect != NULL)
+ return ssect;
+
+ return _bfd_elf_get_sec_type_attr (abfd, sec);
+}
static void
elf32_arm_symbian_begin_write_processing (bfd *abfd,
#define bfd_elf32_bfd_link_hash_table_create \
elf32_arm_symbian_link_hash_table_create
-#undef elf_backend_special_sections
-#define elf_backend_special_sections elf32_arm_symbian_special_sections
+#undef elf_backend_get_sec_type_attr
+#define elf_backend_get_sec_type_attr elf32_arm_symbian_get_sec_type_attr
#undef elf_backend_begin_write_processing
#define elf_backend_begin_write_processing \
return TRUE;
}
-static struct bfd_elf_special_section const
- m32r_elf_special_sections_s[] =
+static struct bfd_elf_special_section const m32r_elf_special_sections[] =
{
- { ".sdata", 6, -2, SHT_PROGBITS, SHF_ALLOC + SHF_WRITE },
{ ".sbss", 5, -2, SHT_NOBITS, SHF_ALLOC + SHF_WRITE },
- { NULL, 0, 0, 0, 0 }
+ { ".sdata", 6, -2, SHT_PROGBITS, SHF_ALLOC + SHF_WRITE },
+ { NULL, 0, 0, 0, 0 }
};
-static struct bfd_elf_special_section const *
- m32r_elf_special_sections[27] =
+static const struct bfd_elf_special_section *
+m32r_elf_get_sec_type_attr (bfd *abfd, asection *sec)
{
- NULL, /* 'a' */
- NULL, /* 'b' */
- NULL, /* 'c' */
- NULL, /* 'd' */
- NULL, /* 'e' */
- NULL, /* 'f' */
- NULL, /* 'g' */
- NULL, /* 'h' */
- NULL, /* 'i' */
- NULL, /* 'j' */
- NULL, /* 'k' */
- NULL, /* 'l' */
- NULL, /* 'm' */
- NULL, /* 'n' */
- NULL, /* 'o' */
- NULL, /* 'p' */
- NULL, /* 'q' */
- NULL, /* 'r' */
- m32r_elf_special_sections_s, /* 's' */
- NULL, /* 't' */
- NULL, /* 'u' */
- NULL, /* 'v' */
- NULL, /* 'w' */
- NULL, /* 'x' */
- NULL, /* 'y' */
- NULL, /* 'z' */
- NULL /* other */
-};
+ const struct bfd_elf_special_section const *ssect;
+
+ /* See if this is one of the special sections. */
+ if (sec->name == NULL)
+ return NULL;
+
+ ssect = _bfd_elf_get_special_section (sec->name,
+ m32r_elf_special_sections,
+ sec->use_rela_p);
+ if (ssect != NULL)
+ return ssect;
+
+ return _bfd_elf_get_sec_type_attr (abfd, sec);
+}
static bfd_boolean
m32r_elf_fake_sections (bfd *abfd,
#define bfd_elf32_bfd_merge_private_bfd_data m32r_elf_merge_private_bfd_data
#define bfd_elf32_bfd_set_private_flags m32r_elf_set_private_flags
#define bfd_elf32_bfd_print_private_bfd_data m32r_elf_print_private_bfd_data
-#define elf_backend_special_sections m32r_elf_special_sections
+#define elf_backend_get_sec_type_attr m32r_elf_get_sec_type_attr
#include "elf32-target.h"
are located in .page0.
- The .vectors is the section that represents the interrupt
vectors. */
-static struct bfd_elf_special_section const
- m68hc11_special_sections_e[] =
+static struct bfd_elf_special_section const elf32_m68hc11_special_sections[] =
{
{ ".eeprom", 7, 0, SHT_PROGBITS, SHF_ALLOC + SHF_WRITE },
- { NULL, 0, 0, 0, 0 }
-};
-
-static struct bfd_elf_special_section const
- m68hc11_special_sections_s[]=
-{
+ { ".page0", 6, 0, SHT_PROGBITS, SHF_ALLOC + SHF_WRITE },
{ ".softregs", 9, 0, SHT_NOBITS, SHF_ALLOC + SHF_WRITE },
+ { ".vectors", 8, 0, SHT_PROGBITS, SHF_ALLOC },
{ NULL, 0, 0, 0, 0 }
};
-static struct bfd_elf_special_section const
- m68hc11_special_sections_p[]=
+static const struct bfd_elf_special_section *
+elf32_m68hc11_get_sec_type_attr (bfd *abfd, asection *sec)
{
- { ".page0", 6, 0, SHT_PROGBITS, SHF_ALLOC + SHF_WRITE },
- { NULL, 0, 0, 0, 0 }
-};
+ const struct bfd_elf_special_section const *ssect;
-static struct bfd_elf_special_section const
- m68hc11_special_sections_v[]=
-{
- { ".vectors", 8, 0, SHT_PROGBITS, SHF_ALLOC },
- { NULL, 0, 0, 0, 0 }
-};
+ /* See if this is one of the special sections. */
+ if (sec->name == NULL)
+ return NULL;
-static struct bfd_elf_special_section const *
- elf32_m68hc11_special_sections[27] =
-{
- NULL, /* 'a' */
- NULL, /* 'b' */
- NULL, /* 'c' */
- NULL, /* 'd' */
- m68hc11_special_sections_e, /* 'e' */
- NULL, /* 'f' */
- NULL, /* 'g' */
- NULL, /* 'h' */
- NULL, /* 'i' */
- NULL, /* 'j' */
- NULL, /* 'k' */
- NULL, /* 'l' */
- NULL, /* 'm' */
- NULL, /* 'n' */
- NULL, /* 'o' */
- m68hc11_special_sections_p, /* 'p' */
- NULL, /* 'q' */
- NULL, /* 'r' */
- m68hc11_special_sections_s, /* 's' */
- NULL, /* 't' */
- NULL, /* 'u' */
- m68hc11_special_sections_v, /* 'v' */
- NULL, /* 'w' */
- NULL, /* 'x' */
- NULL, /* 'y' */
- NULL, /* 'z' */
- NULL /* other */
-};
+ ssect = _bfd_elf_get_special_section (sec->name,
+ elf32_m68hc11_special_sections,
+ sec->use_rela_p);
+ if (ssect != NULL)
+ return ssect;
+
+ return _bfd_elf_get_sec_type_attr (abfd, sec);
+}
\f
#define ELF_ARCH bfd_arch_m68hc11
#define ELF_MACHINE_CODE EM_68HC11
#define elf_backend_object_p 0
#define elf_backend_final_write_processing 0
#define elf_backend_can_gc_sections 1
-#define elf_backend_special_sections elf32_m68hc11_special_sections
+#define elf_backend_get_sec_type_attr elf32_m68hc11_get_sec_type_attr
#define bfd_elf32_bfd_link_hash_table_create \
m68hc11_elf_bfd_link_hash_table_create
Page0 accesses are faster on the M68HC12.
- The .vectors is the section that represents the interrupt
vectors. */
-static struct bfd_elf_special_section const
- m68hc12_special_sections_e[] =
+static struct bfd_elf_special_section const elf32_m68hc12_special_sections[] =
{
{ ".eeprom", 7, 0, SHT_PROGBITS, SHF_ALLOC + SHF_WRITE },
- { NULL, 0, 0, 0, 0 }
-};
-
-static struct bfd_elf_special_section const
- m68hc12_special_sections_s[]=
-{
+ { ".page0", 6, 0, SHT_PROGBITS, SHF_ALLOC + SHF_WRITE },
{ ".softregs", 9, 0, SHT_NOBITS, SHF_ALLOC + SHF_WRITE },
+ { ".vectors", 8, 0, SHT_PROGBITS, SHF_ALLOC },
{ NULL, 0, 0, 0, 0 }
};
-static struct bfd_elf_special_section const
- m68hc12_special_sections_p[]=
+static const struct bfd_elf_special_section *
+elf32_m68hc12_get_sec_type_attr (bfd *abfd, asection *sec)
{
- { ".page0", 6, 0, SHT_PROGBITS, SHF_ALLOC + SHF_WRITE },
- { NULL, 0, 0, 0, 0 }
-};
+ const struct bfd_elf_special_section const *ssect;
-static struct bfd_elf_special_section const
- m68hc12_special_sections_v[]=
-{
- { ".vectors", 8, 0, SHT_PROGBITS, SHF_ALLOC },
- { NULL, 0, 0, 0, 0 }
-};
+ /* See if this is one of the special sections. */
+ if (sec->name == NULL)
+ return NULL;
-static struct bfd_elf_special_section const *
- elf32_m68hc12_special_sections[27] =
-{
- NULL, /* 'a' */
- NULL, /* 'b' */
- NULL, /* 'c' */
- NULL, /* 'd' */
- m68hc12_special_sections_e, /* 'e' */
- NULL, /* 'f' */
- NULL, /* 'g' */
- NULL, /* 'h' */
- NULL, /* 'i' */
- NULL, /* 'j' */
- NULL, /* 'k' */
- NULL, /* 'l' */
- NULL, /* 'm' */
- NULL, /* 'n' */
- NULL, /* 'o' */
- m68hc12_special_sections_p, /* 'p' */
- NULL, /* 'q' */
- NULL, /* 'r' */
- m68hc12_special_sections_s, /* 's' */
- NULL, /* 't' */
- NULL, /* 'u' */
- m68hc12_special_sections_v, /* 'v' */
- NULL, /* 'w' */
- NULL, /* 'x' */
- NULL, /* 'y' */
- NULL, /* 'z' */
- NULL /* other */
-};
+ ssect = _bfd_elf_get_special_section (sec->name,
+ elf32_m68hc12_special_sections,
+ sec->use_rela_p);
+ if (ssect != NULL)
+ return ssect;
+
+ return _bfd_elf_get_sec_type_attr (abfd, sec);
+}
\f
#define ELF_ARCH bfd_arch_m68hc12
#define ELF_MACHINE_CODE EM_68HC12
#define elf_backend_object_p m68hc12_elf_set_mach_from_flags
#define elf_backend_final_write_processing 0
#define elf_backend_can_gc_sections 1
-#define elf_backend_special_sections elf32_m68hc12_special_sections
+#define elf_backend_get_sec_type_attr elf32_m68hc12_get_sec_type_attr
#define elf_backend_post_process_headers elf32_m68hc11_post_process_headers
#define elf_backend_add_symbol_hook elf32_m68hc11_add_symbol_hook
return TRUE;
}
-static struct bfd_elf_special_section const
- mcore_special_sections_c [] =
+static struct bfd_elf_special_section const mcore_elf_special_sections[]=
{
{ ".ctors", 6, -2, SHT_PROGBITS, SHF_ALLOC + SHF_WRITE },
- { NULL, 0, 0, 0, 0 }
-};
-
-static struct bfd_elf_special_section const
- mcore_special_sections_d[]=
-{
{ ".dtors", 6, -2, SHT_PROGBITS, SHF_ALLOC + SHF_WRITE },
{ NULL, 0, 0, 0, 0 }
};
-static struct bfd_elf_special_section const *
- mcore_elf_special_sections[27]=
+static const struct bfd_elf_special_section *
+mcore_elf_get_sec_type_attr (bfd *abfd, asection *sec)
{
- NULL, /* 'a' */
- NULL, /* 'b' */
- mcore_special_sections_c, /* 'c' */
- mcore_special_sections_d, /* 'd' */
- NULL, /* 'e' */
- NULL, /* 'f' */
- NULL, /* 'g' */
- NULL, /* 'h' */
- NULL, /* 'i' */
- NULL, /* 'j' */
- NULL, /* 'k' */
- NULL, /* 'l' */
- NULL, /* 'm' */
- NULL, /* 'n' */
- NULL, /* 'o' */
- NULL, /* 'p' */
- NULL, /* 'q' */
- NULL, /* 'r' */
- NULL, /* 's' */
- NULL, /* 't' */
- NULL, /* 'u' */
- NULL, /* 'v' */
- NULL, /* 'w' */
- NULL, /* 'x' */
- NULL, /* 'y' */
- NULL, /* 'z' */
- NULL /* other */
-};
+ const struct bfd_elf_special_section const *ssect;
+
+ /* See if this is one of the special sections. */
+ if (sec->name == NULL)
+ return NULL;
+
+ ssect = _bfd_elf_get_special_section (sec->name,
+ mcore_elf_special_sections,
+ sec->use_rela_p);
+ if (ssect != NULL)
+ return ssect;
+
+ return _bfd_elf_get_sec_type_attr (abfd, sec);
+}
#define TARGET_BIG_SYM bfd_elf32_mcore_big_vec
#define TARGET_BIG_NAME "elf32-mcore-big"
#define elf_backend_gc_mark_hook mcore_elf_gc_mark_hook
#define elf_backend_gc_sweep_hook mcore_elf_gc_sweep_hook
#define elf_backend_check_relocs mcore_elf_check_relocs
-#define elf_backend_special_sections mcore_elf_special_sections
+#define elf_backend_get_sec_type_attr mcore_elf_get_sec_type_attr
#define elf_backend_can_gc_sections 1
#define elf_backend_rela_normal 1
that the linker doesn't crater when trying to make more than
2 sections. */
-static struct bfd_elf_special_section const
- ppc_special_sections_p[] =
+static struct bfd_elf_special_section const ppc_elf_special_sections[] =
{
{ ".plt", 4, 0, SHT_NOBITS, SHF_ALLOC + SHF_EXECINSTR },
- { NULL, 0, 0, 0, 0 }
-};
-
-static struct bfd_elf_special_section const
- ppc_special_sections_s[] =
-{
- { ".sdata", 6, -2, SHT_PROGBITS, SHF_ALLOC + SHF_WRITE },
{ ".sbss", 5, -2, SHT_NOBITS, SHF_ALLOC + SHF_WRITE },
- { ".sdata2", 7, -2, SHT_PROGBITS, SHF_ALLOC },
{ ".sbss2", 6, -2, SHT_PROGBITS, SHF_ALLOC },
- { NULL, 0, 0, 0, 0 }
-};
-
-static struct bfd_elf_special_section const
- ppc_special_sections_t[] =
-{
+ { ".sdata", 6, -2, SHT_PROGBITS, SHF_ALLOC + SHF_WRITE },
+ { ".sdata2", 7, -2, SHT_PROGBITS, SHF_ALLOC },
{ ".tags", 5, 0, SHT_ORDERED, SHF_ALLOC },
- { NULL, 0, 0, 0, 0 }
-};
-
-static struct bfd_elf_special_section const
- ppc_special_sections_other[]=
-{
{ ".PPC.EMB.apuinfo", 16, 0, SHT_NOTE, 0 },
- { ".PPC.EMB.sdata0", 15, 0, SHT_PROGBITS, SHF_ALLOC },
{ ".PPC.EMB.sbss0", 14, 0, SHT_PROGBITS, SHF_ALLOC },
- { NULL, 0, 0, 0, 0 }
+ { ".PPC.EMB.sdata0", 15, 0, SHT_PROGBITS, SHF_ALLOC },
+ { NULL, 0, 0, 0, 0 }
};
-static struct bfd_elf_special_section const *
- ppc_elf_special_sections[27]=
+/* This is what we want for new plt/got. */
+static struct bfd_elf_special_section ppc_alt_plt =
+ { ".plt", 4, 0, SHT_PROGBITS, SHF_ALLOC };
+
+static const struct bfd_elf_special_section *
+ppc_elf_get_sec_type_attr (bfd *abfd ATTRIBUTE_UNUSED, asection *sec)
{
- NULL, /* 'a' */
- NULL, /* 'b' */
- NULL, /* 'c' */
- NULL, /* 'd' */
- NULL, /* 'e' */
- NULL, /* 'f' */
- NULL, /* 'g' */
- NULL, /* 'h' */
- NULL, /* 'i' */
- NULL, /* 'j' */
- NULL, /* 'k' */
- NULL, /* 'l' */
- NULL, /* 'm' */
- NULL, /* 'n' */
- NULL, /* 'o' */
- ppc_special_sections_p, /* 'p' */
- NULL, /* 'q' */
- NULL, /* 'r' */
- ppc_special_sections_s, /* 's' */
- ppc_special_sections_t, /* 's' */
- NULL, /* 'u' */
- NULL, /* 'v' */
- NULL, /* 'w' */
- NULL, /* 'x' */
- NULL, /* 'y' */
- NULL, /* 'z' */
- ppc_special_sections_other, /* other */
-};
+ const struct bfd_elf_special_section const *ssect;
+
+ /* See if this is one of the special sections. */
+ if (sec->name == NULL)
+ return NULL;
+
+ ssect = _bfd_elf_get_special_section (sec->name, ppc_elf_special_sections,
+ sec->use_rela_p);
+ if (ssect != NULL)
+ {
+ if (ssect == ppc_elf_special_sections && (sec->flags & SEC_LOAD) != 0)
+ ssect = &ppc_alt_plt;
+ return ssect;
+ }
+
+ return _bfd_elf_get_sec_type_attr (abfd, sec);
+}
\f
/* Very simple linked list structure for recording apuinfo values. */
typedef struct apuinfo_list
#define elf_backend_begin_write_processing ppc_elf_begin_write_processing
#define elf_backend_final_write_processing ppc_elf_final_write_processing
#define elf_backend_write_section ppc_elf_write_section
-#define elf_backend_special_sections ppc_elf_special_sections
+#define elf_backend_get_sec_type_attr ppc_elf_get_sec_type_attr
#define elf_backend_plt_sym_val ppc_elf_plt_sym_val
#include "elf32-target.h"
#define elf_backend_merge_symbol_attribute sh64_elf_merge_symbol_attribute
#define elf_backend_final_write_processing sh64_elf_final_write_processing
#define elf_backend_section_from_shdr sh64_backend_section_from_shdr
-#define elf_backend_special_sections sh64_elf_special_sections
+#define elf_backend_get_sec_type_attr sh64_elf_get_sec_type_attr
#define elf_backend_section_flags sh64_elf_section_flags
#define bfd_elf32_new_section_hook sh64_elf_new_section_hook
return;
}
-static struct bfd_elf_special_section const
- sh64_special_sections_c[] =
+static struct bfd_elf_special_section const sh64_elf_special_sections[] =
{
{ ".cranges", 8, 0, SHT_PROGBITS, 0 },
- { NULL, 0, 0, 0, 0 }
+ { NULL, 0, 0, 0, 0 }
};
-static struct bfd_elf_special_section const *
- sh64_elf_special_sections[27]=
+static const struct bfd_elf_special_section *
+sh64_elf_get_sec_type_attr (bfd *abfd, asection *sec)
{
- NULL, /* 'a' */
- NULL, /* 'b' */
- sh64_special_sections_c, /* 'c' */
- NULL, /* 'd' */
- NULL, /* 'e' */
- NULL, /* 'f' */
- NULL, /* 'g' */
- NULL, /* 'h' */
- NULL, /* 'i' */
- NULL, /* 'j' */
- NULL, /* 'k' */
- NULL, /* 'l' */
- NULL, /* 'm' */
- NULL, /* 'n' */
- NULL, /* 'o' */
- NULL, /* 'p' */
- NULL, /* 'q' */
- NULL, /* 'r' */
- NULL, /* 's' */
- NULL, /* 't' */
- NULL, /* 'u' */
- NULL, /* 'v' */
- NULL, /* 'w' */
- NULL, /* 'x' */
- NULL, /* 'y' */
- NULL, /* 'z' */
- NULL /* other */
-};
+ const struct bfd_elf_special_section const *ssect;
+
+ /* See if this is one of the special sections. */
+ if (sec->name == NULL)
+ return NULL;
+
+ ssect = _bfd_elf_get_special_section (sec->name,
+ sh64_elf_special_sections,
+ sec->use_rela_p);
+ if (ssect != NULL)
+ return ssect;
+
+ return _bfd_elf_get_sec_type_attr (abfd, sec);
+}
#undef TARGET_BIG_SYM
#define TARGET_BIG_SYM bfd_elf32_sh64_vec
goto finish;
}
-static struct bfd_elf_special_section const
- v850_special_sections_c[]=
+static struct bfd_elf_special_section const v850_elf_special_sections[] =
{
{ ".call_table_data", 16, 0, SHT_PROGBITS, (SHF_ALLOC
+ SHF_WRITE) },
{ ".call_table_text", 16, 0, SHT_PROGBITS, (SHF_ALLOC + SHF_WRITE
+ SHF_EXECINSTR) },
- { NULL, 0, 0, 0, 0 }
-};
-
-static struct bfd_elf_special_section const
- v850_special_sections_r[]=
-{
{ ".rosdata", 8, -2, SHT_PROGBITS, (SHF_ALLOC
+ SHF_V850_GPREL) },
{ ".rozdata", 8, -2, SHT_PROGBITS, (SHF_ALLOC
+ SHF_V850_R0REL) },
- { NULL, 0, 0, 0, 0 }
-};
-
-static struct bfd_elf_special_section const
- v850_special_sections_s[]=
-{
- { ".sdata", 6, -2, SHT_PROGBITS, (SHF_ALLOC + SHF_WRITE
- + SHF_V850_GPREL) },
{ ".sbss", 5, -2, SHT_NOBITS, (SHF_ALLOC + SHF_WRITE
+ SHF_V850_GPREL) },
{ ".scommon", 8, -2, SHT_V850_SCOMMON, (SHF_ALLOC + SHF_WRITE
+ SHF_V850_GPREL) },
- { NULL, 0, 0, 0, 0 }
-};
-
-static struct bfd_elf_special_section const
- v850_special_sections_t[]=
-{
- { ".tdata", 6, -2, SHT_PROGBITS, (SHF_ALLOC + SHF_WRITE
- + SHF_V850_EPREL) },
+ { ".sdata", 6, -2, SHT_PROGBITS, (SHF_ALLOC + SHF_WRITE
+ + SHF_V850_GPREL) },
{ ".tbss", 5, -2, SHT_NOBITS, (SHF_ALLOC + SHF_WRITE
+ SHF_V850_EPREL) },
{ ".tcommon", 8, -2, SHT_V850_TCOMMON, (SHF_ALLOC + SHF_WRITE
+ SHF_V850_R0REL) },
- { NULL, 0, 0, 0, 0 }
-};
-
-static struct bfd_elf_special_section const
- v850_special_sections_z[]=
-{
- { ".zdata", 6, -2, SHT_PROGBITS, (SHF_ALLOC + SHF_WRITE
- + SHF_V850_R0REL) },
+ { ".tdata", 6, -2, SHT_PROGBITS, (SHF_ALLOC + SHF_WRITE
+ + SHF_V850_EPREL) },
{ ".zbss", 5, -2, SHT_NOBITS, (SHF_ALLOC + SHF_WRITE
+ SHF_V850_R0REL) },
{ ".zcommon", 8, -2, SHT_V850_ZCOMMON, (SHF_ALLOC + SHF_WRITE
+ SHF_V850_R0REL) },
+ { ".zdata", 6, -2, SHT_PROGBITS, (SHF_ALLOC + SHF_WRITE
+ + SHF_V850_R0REL) },
{ NULL, 0, 0, 0, 0 }
};
-static struct bfd_elf_special_section const *
- v850_elf_special_sections[27] =
+static const struct bfd_elf_special_section *
+v850_elf_get_sec_type_attr (bfd *abfd, asection *sec)
{
- NULL, /* 'a' */
- NULL, /* 'b' */
- v850_special_sections_c, /* 'c' */
- NULL, /* 'd' */
- NULL, /* 'e' */
- NULL, /* 'f' */
- NULL, /* 'g' */
- NULL, /* 'h' */
- NULL, /* 'i' */
- NULL, /* 'j' */
- NULL, /* 'k' */
- NULL, /* 'l' */
- NULL, /* 'm' */
- NULL, /* 'n' */
- NULL, /* 'o' */
- NULL, /* 'p' */
- NULL, /* 'q' */
- v850_special_sections_r, /* 'r' */
- v850_special_sections_s, /* 's' */
- v850_special_sections_t, /* 't' */
- NULL, /* 'u' */
- NULL, /* 'v' */
- NULL, /* 'w' */
- NULL, /* 'x' */
- NULL, /* 'y' */
- v850_special_sections_z, /* 'z' */
- NULL /* other */
-};
+ const struct bfd_elf_special_section const *ssect;
+
+ /* See if this is one of the special sections. */
+ if (sec->name == NULL)
+ return NULL;
+
+ ssect = _bfd_elf_get_special_section (sec->name,
+ v850_elf_special_sections,
+ sec->use_rela_p);
+ if (ssect != NULL)
+ return ssect;
+
+ return _bfd_elf_get_sec_type_attr (abfd, sec);
+}
\f
#define TARGET_LITTLE_SYM bfd_elf32_v850_vec
#define TARGET_LITTLE_NAME "elf32-v850"
#define elf_backend_fake_sections v850_elf_fake_sections
#define elf_backend_gc_mark_hook v850_elf_gc_mark_hook
#define elf_backend_gc_sweep_hook v850_elf_gc_sweep_hook
-#define elf_backend_special_sections v850_elf_special_sections
+#define elf_backend_get_sec_type_attr v850_elf_get_sec_type_attr
#define elf_backend_can_gc_sections 1
#define elf_backend_rela_normal 1
/* The default literal sections should always be marked as "code" (i.e.,
SHF_EXECINSTR). This is particularly important for the Linux kernel
module loader so that the literals are not placed after the text. */
-static struct bfd_elf_special_section const
- xtensa_special_sections_f[]=
+static struct bfd_elf_special_section const elf_xtensa_special_sections[] =
{
{ ".fini.literal", 13, 0, SHT_PROGBITS, SHF_ALLOC + SHF_EXECINSTR },
- { NULL, 0, 0, 0, 0 }
-};
-
-static struct bfd_elf_special_section const
- xtensa_special_sections_i[]=
-{
{ ".init.literal", 13, 0, SHT_PROGBITS, SHF_ALLOC + SHF_EXECINSTR },
- { NULL, 0, 0, 0, 0 }
-};
-static struct bfd_elf_special_section const
- xtensa_special_sections_l[]=
-{
{ ".literal", 8, 0, SHT_PROGBITS, SHF_ALLOC + SHF_EXECINSTR },
{ NULL, 0, 0, 0, 0 }
};
-static struct bfd_elf_special_section const *
- elf_xtensa_special_sections[27] =
-{
- NULL, /* 'a' */
- NULL, /* 'b' */
- NULL, /* 'c' */
- NULL, /* 'd' */
- NULL, /* 'e' */
- xtensa_special_sections_f, /* 'f' */
- NULL, /* 'g' */
- NULL, /* 'h' */
- xtensa_special_sections_i, /* 'i' */
- NULL, /* 'j' */
- NULL, /* 'k' */
- xtensa_special_sections_l, /* 'l' */
- NULL, /* 'm' */
- NULL, /* 'n' */
- NULL, /* 'o' */
- NULL, /* 'p' */
- NULL, /* 'q' */
- NULL, /* 'r' */
- NULL, /* 's' */
- NULL, /* 't' */
- NULL, /* 'u' */
- NULL, /* 'v' */
- NULL, /* 'w' */
- NULL, /* 'x' */
- NULL, /* 'y' */
- NULL, /* 'z' */
- NULL /* other */
-};
+static const struct bfd_elf_special_section *
+elf_xtensa_get_sec_type_attr (bfd *abfd, asection *sec)
+{
+ const struct bfd_elf_special_section const *ssect;
+
+ /* See if this is one of the special sections. */
+ if (sec->name == NULL)
+ return NULL;
+
+ ssect = _bfd_elf_get_special_section (sec->name,
+ elf_xtensa_special_sections,
+ sec->use_rela_p);
+ if (ssect != NULL)
+ return ssect;
+
+ return _bfd_elf_get_sec_type_attr (abfd, sec);
+}
\f
#ifndef ELF_ARCH
#define elf_backend_reloc_type_class elf_xtensa_reloc_type_class
#define elf_backend_relocate_section elf_xtensa_relocate_section
#define elf_backend_size_dynamic_sections elf_xtensa_size_dynamic_sections
-#define elf_backend_special_sections elf_xtensa_special_sections
+#define elf_backend_get_sec_type_attr elf_xtensa_get_sec_type_attr
#include "elf32-target.h"
}
}
\f
-static struct bfd_elf_special_section const
- alpha_special_sections_s[]=
+static struct bfd_elf_special_section const elf64_alpha_special_sections[] =
{
- { ".sdata", 6, -2, SHT_PROGBITS, SHF_ALLOC + SHF_WRITE + SHF_ALPHA_GPREL },
{ ".sbss", 5, -2, SHT_NOBITS, SHF_ALLOC + SHF_WRITE + SHF_ALPHA_GPREL },
+ { ".sdata", 6, -2, SHT_PROGBITS, SHF_ALLOC + SHF_WRITE + SHF_ALPHA_GPREL },
{ NULL, 0, 0, 0, 0 }
};
-static struct bfd_elf_special_section const *
- elf64_alpha_special_sections[27] =
+static const struct bfd_elf_special_section *
+elf64_alpha_get_sec_type_attr (bfd *abfd, asection *sec)
{
- NULL, /* 'a' */
- NULL, /* 'b' */
- NULL, /* 'c' */
- NULL, /* 'd' */
- NULL, /* 'e' */
- NULL, /* 'f' */
- NULL, /* 'g' */
- NULL, /* 'h' */
- NULL, /* 'i' */
- NULL, /* 'j' */
- NULL, /* 'k' */
- NULL, /* 'l' */
- NULL, /* 'm' */
- NULL, /* 'n' */
- NULL, /* 'o' */
- NULL, /* 'p' */
- NULL, /* 'q' */
- NULL, /* 'r' */
- alpha_special_sections_s, /* 's' */
- NULL, /* 't' */
- NULL, /* 'u' */
- NULL, /* 'v' */
- NULL, /* 'w' */
- NULL, /* 'x' */
- NULL, /* 'y' */
- NULL, /* 'z' */
- NULL /* other */
-};
+ const struct bfd_elf_special_section const *ssect;
+
+ /* See if this is one of the special sections. */
+ if (sec->name == NULL)
+ return NULL;
+
+ ssect = _bfd_elf_get_special_section (sec->name,
+ elf64_alpha_special_sections,
+ sec->use_rela_p);
+ if (ssect != NULL)
+ return ssect;
+
+ return _bfd_elf_get_sec_type_attr (abfd, sec);
+}
/* ECOFF swapping routines. These are used when dealing with the
.mdebug section, which is in the ECOFF debugging format. Copied
#define elf_backend_size_info \
alpha_elf_size_info
-#define elf_backend_special_sections \
- elf64_alpha_special_sections
+#define elf_backend_get_sec_type_attr \
+ elf64_alpha_get_sec_type_attr
/* A few constants that determine how the .plt section is set up. */
#define elf_backend_want_got_plt 0
return type;
}
-static struct bfd_elf_special_section const
- hppa_special_sections_f[]=
+static struct bfd_elf_special_section const elf64_hppa_special_sections[] =
{
{ ".fini", 5, 0, SHT_PROGBITS, SHF_ALLOC + SHF_WRITE },
- { NULL, 0, 0, 0, 0 }
-};
-
-static struct bfd_elf_special_section const
- hppa_special_sections_i[]=
-{
{ ".init", 5, 0, SHT_PROGBITS, SHF_ALLOC + SHF_WRITE },
{ NULL, 0, 0, 0, 0 }
};
-static struct bfd_elf_special_section const *
- elf64_hppa_special_sections[27] =
+static const struct bfd_elf_special_section *
+elf64_hppa_get_sec_type_attr (bfd *abfd, asection *sec)
{
- NULL, /* 'a' */
- NULL, /* 'b' */
- NULL, /* 'c' */
- NULL, /* 'd' */
- NULL, /* 'e' */
- hppa_special_sections_f, /* 'f' */
- NULL, /* 'g' */
- NULL, /* 'h' */
- hppa_special_sections_i, /* 'i' */
- NULL, /* 'j' */
- NULL, /* 'k' */
- NULL, /* 'l' */
- NULL, /* 'm' */
- NULL, /* 'n' */
- NULL, /* 'o' */
- NULL, /* 'f' */
- NULL, /* 'q' */
- NULL, /* 'r' */
- NULL, /* 's' */
- NULL, /* 't' */
- NULL, /* 'u' */
- NULL, /* 'v' */
- NULL, /* 'w' */
- NULL, /* 'x' */
- NULL, /* 'y' */
- NULL, /* 'z' */
- NULL /* other */
-};
+ const struct bfd_elf_special_section const *ssect;
+
+ /* See if this is one of the special sections. */
+ if (sec->name == NULL)
+ return NULL;
+
+ ssect = _bfd_elf_get_special_section (sec->name,
+ elf64_hppa_special_sections,
+ sec->use_rela_p);
+ if (ssect != NULL)
+ return ssect;
+
+ return _bfd_elf_get_sec_type_attr (abfd, sec);
+}
/* The hash bucket size is the standard one, namely 4. */
#define elf_backend_get_symbol_type elf64_hppa_elf_get_symbol_type
#define elf_backend_reloc_type_class elf64_hppa_reloc_type_class
#define elf_backend_rela_normal 1
-#define elf_backend_special_sections elf64_hppa_special_sections
+#define elf_backend_get_sec_type_attr elf64_hppa_get_sec_type_attr
#include "elf64-target.h"
#undef TARGET_BIG_NAME
#define TARGET_BIG_NAME "elf64-hppa-linux"
-#undef elf_backend_special_sections
+#undef elf_backend_get_sec_type_attr
#define INCLUDED_TARGET_FILE 1
#include "elf64-target.h"
#define elf_backend_reloc_type_class ppc64_elf_reloc_type_class
#define elf_backend_finish_dynamic_sections ppc64_elf_finish_dynamic_sections
#define elf_backend_link_output_symbol_hook ppc64_elf_output_symbol_hook
-#define elf_backend_special_sections ppc64_elf_special_sections
+#define elf_backend_get_sec_type_attr ppc64_elf_get_sec_type_attr
/* The name of the dynamic interpreter. This is put in the .interp
section. */
/* Add extra PPC sections. */
-static struct bfd_elf_special_section const
- ppc64_special_sections_p[]=
+static struct bfd_elf_special_section const ppc64_elf_special_sections[]=
{
{ ".plt", 4, 0, SHT_NOBITS, 0 },
- { NULL, 0, 0, 0, 0 }
-};
-
-static struct bfd_elf_special_section const
- ppc64_special_sections_s[]=
-{
- { ".sdata", 6, -2, SHT_PROGBITS, SHF_ALLOC + SHF_WRITE },
{ ".sbss", 5, -2, SHT_NOBITS, SHF_ALLOC + SHF_WRITE },
- { NULL, 0, 0, 0, 0 }
-};
-
-static struct bfd_elf_special_section const
- ppc64_special_sections_t[]=
-{
+ { ".sdata", 6, -2, SHT_PROGBITS, SHF_ALLOC + SHF_WRITE },
{ ".toc", 4, 0, SHT_PROGBITS, SHF_ALLOC + SHF_WRITE },
{ ".toc1", 5, 0, SHT_PROGBITS, SHF_ALLOC + SHF_WRITE },
{ ".tocbss", 7, 0, SHT_NOBITS, SHF_ALLOC + SHF_WRITE },
{ NULL, 0, 0, 0, 0 }
};
-static struct bfd_elf_special_section const *
- ppc64_elf_special_sections[27]=
+static const struct bfd_elf_special_section *
+ppc64_elf_get_sec_type_attr (bfd *abfd, asection *sec)
{
- NULL, /* 'a' */
- NULL, /* 'b' */
- NULL, /* 'c' */
- NULL, /* 'd' */
- NULL, /* 'e' */
- NULL, /* 'f' */
- NULL, /* 'g' */
- NULL, /* 'h' */
- NULL, /* 'i' */
- NULL, /* 'j' */
- NULL, /* 'k' */
- NULL, /* 'l' */
- NULL, /* 'm' */
- NULL, /* 'n' */
- NULL, /* 'o' */
- ppc64_special_sections_p, /* 'p' */
- NULL, /* 'q' */
- NULL, /* 'r' */
- ppc64_special_sections_s, /* 's' */
- ppc64_special_sections_t, /* 't' */
- NULL, /* 'u' */
- NULL, /* 'v' */
- NULL, /* 'w' */
- NULL, /* 'x' */
- NULL, /* 'y' */
- NULL, /* 'z' */
- NULL /* other */
-};
+ const struct bfd_elf_special_section const *ssect;
+
+ /* See if this is one of the special sections. */
+ if (sec->name == NULL)
+ return NULL;
+
+ ssect = _bfd_elf_get_special_section (sec->name,
+ ppc64_elf_special_sections,
+ sec->use_rela_p);
+ if (ssect != NULL)
+ return ssect;
+
+ return _bfd_elf_get_sec_type_attr (abfd, sec);
+}
struct _ppc64_elf_section_data
{
return;
}
-static struct bfd_elf_special_section const
- sh64_special_sections_c[] =
+static struct bfd_elf_special_section const sh64_elf64_special_sections[]=
{
{ ".cranges", 8, 0, SHT_PROGBITS, 0 },
- { NULL, 0, 0, 0, 0 }
+ { NULL, 0, 0, 0, 0 }
};
-static struct bfd_elf_special_section const *
- sh64_elf64_special_sections[27]=
+static const struct bfd_elf_special_section *
+sh64_elf64_get_sec_type_attr (bfd *abfd, asection *sec)
{
- NULL, /* 'a' */
- NULL, /* 'b' */
- sh64_special_sections_c, /* 'c' */
- NULL, /* 'd' */
- NULL, /* 'e' */
- NULL, /* 'f' */
- NULL, /* 'g' */
- NULL, /* 'h' */
- NULL, /* 'i' */
- NULL, /* 'j' */
- NULL, /* 'k' */
- NULL, /* 'l' */
- NULL, /* 'm' */
- NULL, /* 'n' */
- NULL, /* 'o' */
- NULL, /* 'p' */
- NULL, /* 'q' */
- NULL, /* 'r' */
- NULL, /* 's' */
- NULL, /* 't' */
- NULL, /* 'u' */
- NULL, /* 'v' */
- NULL, /* 'w' */
- NULL, /* 'x' */
- NULL, /* 'y' */
- NULL, /* 'z' */
- NULL /* other */
-};
+ const struct bfd_elf_special_section const *ssect;
+
+ /* See if this is one of the special sections. */
+ if (sec->name == NULL)
+ return NULL;
+
+ ssect = _bfd_elf_get_special_section (sec->name,
+ sh64_elf64_special_sections,
+ sec->use_rela_p);
+ if (ssect != NULL)
+ return ssect;
+
+ return _bfd_elf_get_sec_type_attr (abfd, sec);
+}
#define TARGET_BIG_SYM bfd_elf64_sh64_vec
#define TARGET_BIG_NAME "elf64-sh64"
sh64_elf64_finish_dynamic_symbol
#define elf_backend_finish_dynamic_sections \
sh64_elf64_finish_dynamic_sections
-#define elf_backend_special_sections sh64_elf64_special_sections
+#define elf_backend_get_sec_type_attr sh64_elf64_get_sec_type_attr
#define elf_backend_want_got_plt 1
#define elf_backend_plt_readonly 1
}
}
-static struct bfd_elf_special_section const
- ia64_special_sections_s[]=
+static struct bfd_elf_special_section const elfNN_ia64_special_sections[] =
{
{ ".sbss", 5, -1, SHT_NOBITS, SHF_ALLOC + SHF_WRITE + SHF_IA_64_SHORT },
{ ".sdata", 6, -1, SHT_PROGBITS, SHF_ALLOC + SHF_WRITE + SHF_IA_64_SHORT },
{ NULL, 0, 0, 0, 0 }
};
-static struct bfd_elf_special_section const *
- elfNN_ia64_special_sections[27] =
+static const struct bfd_elf_special_section *
+elfNN_ia64_get_sec_type_attr (bfd *abfd, asection *sec)
{
- NULL, /* 'a' */
- NULL, /* 'b' */
- NULL, /* 'c' */
- NULL, /* 'd' */
- NULL, /* 'e' */
- NULL, /* 'f' */
- NULL, /* 'g' */
- NULL, /* 'h' */
- NULL, /* 'i' */
- NULL, /* 'j' */
- NULL, /* 'k' */
- NULL, /* 'l' */
- NULL, /* 'm' */
- NULL, /* 'n' */
- NULL, /* 'o' */
- NULL, /* 'p' */
- NULL, /* 'q' */
- NULL, /* 'r' */
- ia64_special_sections_s, /* 's' */
- NULL, /* 't' */
- NULL, /* 'u' */
- NULL, /* 'v' */
- NULL, /* 'w' */
- NULL, /* 'x' */
- NULL, /* 'y' */
- NULL, /* 'z' */
- NULL /* other */
-};
+ const struct bfd_elf_special_section const *ssect;
+
+ /* See if this is one of the special sections. */
+ if (sec->name == NULL)
+ return NULL;
+
+ ssect = _bfd_elf_get_special_section (sec->name,
+ elfNN_ia64_special_sections,
+ sec->use_rela_p);
+ if (ssect != NULL)
+ return ssect;
+
+ return _bfd_elf_get_sec_type_attr (abfd, sec);
+}
static bfd_boolean
elfNN_ia64_object_p (bfd *abfd)
#define elf_backend_hide_symbol elfNN_ia64_hash_hide_symbol
#define elf_backend_reloc_type_class elfNN_ia64_reloc_type_class
#define elf_backend_rela_normal 1
-#define elf_backend_special_sections elfNN_ia64_special_sections
+#define elf_backend_get_sec_type_attr elfNN_ia64_get_sec_type_attr
/* FIXME: PR 290: The Intel C compiler generates SHT_IA_64_UNWIND with
SHF_LINK_ORDER. But it doesn't set theh sh_link or sh_info fields.
return TRUE;
}
-static struct bfd_elf_special_section const
- mips_special_sections_l[]=
+struct bfd_elf_special_section const _bfd_mips_elf_special_sections[] =
{
{ ".lit4", 5, 0, SHT_PROGBITS, SHF_ALLOC + SHF_WRITE + SHF_MIPS_GPREL },
{ ".lit8", 5, 0, SHT_PROGBITS, SHF_ALLOC + SHF_WRITE + SHF_MIPS_GPREL },
- { NULL, 0, 0, 0, 0 }
-};
-
-static struct bfd_elf_special_section const
- mips_special_sections_m[]=
-{
{ ".mdebug", 7, 0, SHT_MIPS_DEBUG, 0 },
+ { ".sbss", 5, -2, SHT_NOBITS, SHF_ALLOC + SHF_WRITE + SHF_MIPS_GPREL },
+ { ".sdata", 6, -2, SHT_PROGBITS, SHF_ALLOC + SHF_WRITE + SHF_MIPS_GPREL },
+ { ".ucode", 6, 0, SHT_MIPS_UCODE, 0 },
{ NULL, 0, 0, 0, 0 }
};
-static struct bfd_elf_special_section const
- mips_special_sections_s[]=
+const struct bfd_elf_special_section *
+_bfd_mips_elf_get_sec_type_attr (bfd *abfd, asection *sec)
{
- { ".sdata", 6, -2, SHT_PROGBITS, SHF_ALLOC + SHF_WRITE + SHF_MIPS_GPREL },
- { ".sbss", 5, -2, SHT_NOBITS, SHF_ALLOC + SHF_WRITE + SHF_MIPS_GPREL },
-};
+ const struct bfd_elf_special_section const *ssect;
-static struct bfd_elf_special_section const
- mips_special_sections_u[]=
-{
- { ".ucode", 6, 0, SHT_MIPS_UCODE, 0 },
- { NULL, 0, 0, 0, 0 }
-};
+ /* See if this is one of the special sections. */
+ if (sec->name == NULL)
+ return NULL;
-struct bfd_elf_special_section const *
- _bfd_mips_elf_special_sections[27] =
-{
- NULL, /* 'a' */
- NULL, /* 'b' */
- NULL, /* 'c' */
- NULL, /* 'd' */
- NULL, /* 'e' */
- NULL, /* 'f' */
- NULL, /* 'g' */
- NULL, /* 'h' */
- NULL, /* 'i' */
- NULL, /* 'j' */
- NULL, /* 'k' */
- mips_special_sections_l, /* 'l' */
- mips_special_sections_m, /* 'm' */
- NULL, /* 'n' */
- NULL, /* 'o' */
- NULL, /* 'p' */
- NULL, /* 'q' */
- NULL, /* 'r' */
- mips_special_sections_s, /* 'm' */
- NULL, /* 't' */
- mips_special_sections_u, /* 'u' */
- NULL, /* 'v' */
- NULL, /* 'w' */
- NULL, /* 'x' */
- NULL, /* 'y' */
- NULL, /* 'z' */
- NULL /* other */
-};
+ ssect = _bfd_elf_get_special_section (sec->name,
+ _bfd_mips_elf_special_sections,
+ sec->use_rela_p);
+ if (ssect != NULL)
+ return ssect;
+
+ return _bfd_elf_get_sec_type_attr (abfd, sec);
+}
(bfd *, asection *, struct bfd_link_info *, bfd_boolean *);
extern bfd_vma _bfd_mips_elf_sign_extend
(bfd_vma, int);
+extern const struct bfd_elf_special_section *_bfd_mips_elf_get_sec_type_attr
+ (bfd *, asection *);
-extern struct bfd_elf_special_section const *_bfd_mips_elf_special_sections[];
#define elf_backend_name_local_section_symbols \
_bfd_mips_elf_name_local_section_symbols
-#define elf_backend_special_sections _bfd_mips_elf_special_sections
+#define elf_backend_get_sec_type_attr _bfd_mips_elf_get_sec_type_attr
#define elf_backend_eh_frame_address_size _bfd_mips_elf_eh_frame_address_size
#ifndef elf_backend_section_flags
#define elf_backend_section_flags 0
#endif
+#ifndef elf_backend_get_sec_type_attr
+#define elf_backend_get_sec_type_attr _bfd_elf_get_sec_type_attr
+#endif
#ifndef elf_backend_section_from_phdr
#define elf_backend_section_from_phdr _bfd_elf_make_section_from_phdr
#endif
#define elf_backend_size_info _bfd_elfNN_size_info
#endif
-#ifndef elf_backend_special_sections
-#define elf_backend_special_sections NULL
-#endif
-
#ifndef elf_backend_sign_extend_vma
#define elf_backend_sign_extend_vma 0
#endif
elf_backend_section_processing,
elf_backend_section_from_shdr,
elf_backend_section_flags,
+ elf_backend_get_sec_type_attr,
elf_backend_section_from_phdr,
elf_backend_fake_sections,
elf_backend_section_from_bfd_section,
ELF_MACHINE_ALT1,
ELF_MACHINE_ALT2,
&elf_backend_size_info,
- elf_backend_special_sections,
elf_backend_got_header_size,
elf_backend_collect,
elf_backend_type_change_ok,
+2005-07-04 Alan Modra <amodra@bigpond.net.au>
+
+ PR 1004
+ * objcopy.c (copy_object): Use bfd_make_section_with_flags.
+ (write_debugging_info): Likewise.
+ (setup_section): Use bfd_make_section_anyway_with_flags.
+
2005-07-01 Steve Ellcey <sje@cup.hp.com>
* configure.in (AM_BINUTILS_WARNINGS): Add.
{
flagword flags;
- padd->section = bfd_make_section (obfd, padd->name);
+ pset = find_section_list (padd->name, FALSE);
+ if (pset != NULL)
+ pset->used = TRUE;
+
+ flags = SEC_HAS_CONTENTS | SEC_READONLY | SEC_DATA;
+ if (pset != NULL && pset->set_flags)
+ flags = pset->flags | SEC_HAS_CONTENTS;
+
+ padd->section = bfd_make_section_with_flags (obfd, padd->name, flags);
if (padd->section == NULL)
{
non_fatal (_("can't create section `%s': %s"),
return FALSE;
}
- pset = find_section_list (padd->name, FALSE);
- if (pset != NULL)
- pset->used = TRUE;
-
- if (pset != NULL && pset->set_flags)
- flags = pset->flags | SEC_HAS_CONTENTS;
- else
- flags = SEC_HAS_CONTENTS | SEC_READONLY | SEC_DATA;
-
- if (! bfd_set_section_flags (obfd, padd->section, flags))
- {
- bfd_nonfatal (bfd_get_filename (obfd));
- return FALSE;
- }
-
if (pset != NULL)
{
if (pset->change_vma != CHANGE_IGNORE)
name = n;
}
- osection = bfd_make_section_anyway (obfd, name);
+ if (p != NULL && p->set_flags)
+ flags = p->flags | (flags & (SEC_HAS_CONTENTS | SEC_RELOC));
+ else if (strip_symbols == STRIP_NONDEBUG && (flags & SEC_ALLOC) != 0)
+ flags &= ~(SEC_HAS_CONTENTS | SEC_LOAD);
+
+ osection = bfd_make_section_anyway_with_flags (obfd, name, flags);
if (osection == NULL)
{
goto loser;
}
+ if (strip_symbols == STRIP_NONDEBUG
+ && obfd->xvec->flavour == bfd_target_elf_flavour
+ && (flags & SEC_ALLOC) != 0
+ && (p == NULL || !p->set_flags))
+ elf_section_type (osection) = SHT_NOBITS;
+
size = bfd_section_size (ibfd, isection);
if (copy_byte >= 0)
size = (size + interleave - 1) / interleave;
goto loser;
}
- if (p != NULL && p->set_flags)
- flags = p->flags | (flags & (SEC_HAS_CONTENTS | SEC_RELOC));
- else if (strip_symbols == STRIP_NONDEBUG && (flags & SEC_ALLOC) != 0)
- {
- flags &= ~(SEC_HAS_CONTENTS | SEC_LOAD);
- if (obfd->xvec->flavour == bfd_target_elf_flavour)
- elf_section_type (osection) = SHT_NOBITS;
- }
-
- if (!bfd_set_section_flags (obfd, osection, flags))
- {
- err = _("flags");
- goto loser;
- }
-
/* Copy merge entity size. */
osection->entsize = isection->entsize;
bfd_byte *syms, *strings;
bfd_size_type symsize, stringsize;
asection *stabsec, *stabstrsec;
+ flagword flags;
if (! write_stabs_in_sections_debugging_info (obfd, dhandle, &syms,
&symsize, &strings,
&stringsize))
return FALSE;
- stabsec = bfd_make_section (obfd, ".stab");
- stabstrsec = bfd_make_section (obfd, ".stabstr");
+ flags = SEC_HAS_CONTENTS | SEC_READONLY | SEC_DEBUGGING;
+ stabsec = bfd_make_section_with_flags (obfd, ".stab", flags);
+ stabstrsec = bfd_make_section_with_flags (obfd, ".stabstr", flags);
if (stabsec == NULL
|| stabstrsec == NULL
|| ! bfd_set_section_size (obfd, stabsec, symsize)
|| ! bfd_set_section_size (obfd, stabstrsec, stringsize)
|| ! bfd_set_section_alignment (obfd, stabsec, 2)
- || ! bfd_set_section_alignment (obfd, stabstrsec, 0)
- || ! bfd_set_section_flags (obfd, stabsec,
- (SEC_HAS_CONTENTS
- | SEC_READONLY
- | SEC_DEBUGGING))
- || ! bfd_set_section_flags (obfd, stabstrsec,
- (SEC_HAS_CONTENTS
- | SEC_READONLY
- | SEC_DEBUGGING)))
+ || ! bfd_set_section_alignment (obfd, stabstrsec, 0))
{
non_fatal (_("%s: can't create debugging section: %s"),
bfd_get_filename (obfd),
+2005-07-04 Alan Modra <amodra@bigpond.net.au>
+
+ PR 1004
+ * config/obj-elf.c (obj_elf_change_section): Use backend
+ get_sec_type_attr.
+
2005-07-01 Jan Beulich <jbeulich@novell.com>
* config/tc-ia64.c (line_separator_chars): Add '{' and '}'.
asection *old_sec;
segT sec;
flagword flags;
+ const struct elf_backend_data *bed;
const struct bfd_elf_special_section *ssect;
#ifdef md_flush_pending_output
else
sec = subseg_force_new (name, 0);
- ssect = _bfd_elf_get_sec_type_attr (stdoutput, name);
+ bed = get_elf_backend_data (stdoutput);
+ ssect = (*bed->get_sec_type_attr) (stdoutput, sec);
if (ssect != NULL)
{