bfd/
	* 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.

binutils/
	* objcopy.c (copy_object): Use bfd_make_section_with_flags.
	(write_debugging_info): Likewise.
	(setup_section): Use bfd_make_section_anyway_with_flags.
gas/
	* config/obj-elf.c (obj_elf_change_section): Use backend
	get_sec_type_attr.
This commit is contained in:
Alan Modra
2005-07-04 01:53:44 +00:00
parent 90f7da277e
commit 551b43fde1
24 changed files with 435 additions and 799 deletions

View File

@ -1290,7 +1290,15 @@ copy_object (bfd *ibfd, bfd *obfd)
{
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"),
@ -1304,21 +1312,6 @@ copy_object (bfd *ibfd, bfd *obfd)
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)
@ -2001,7 +1994,12 @@ setup_section (bfd *ibfd, sec_ptr isection, void *obfdarg)
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)
{
@ -2009,6 +2007,12 @@ setup_section (bfd *ibfd, sec_ptr isection, void *obfdarg)
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;
@ -2057,21 +2061,6 @@ setup_section (bfd *ibfd, sec_ptr isection, void *obfdarg)
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;
@ -2353,28 +2342,22 @@ write_debugging_info (bfd *obfd, void *dhandle,
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),