summaryrefslogtreecommitdiff
path: root/bfd/section.c
diff options
context:
space:
mode:
authorH.J. Lu <hjl@lucon.org>2005-05-05 14:34:04 +0000
committerH.J. Lu <hjl@lucon.org>2005-05-05 14:34:04 +0000
commited85379194ed7ff9f7b28851025b5c5c0f0442a7 (patch)
tree7870ed8fafc0aec58f69689a2bbe6382a22781ac /bfd/section.c
parentdda0df804c7ec49c426afa9d85b62d37bd4b4a58 (diff)
downloadgdb-ed85379194ed7ff9f7b28851025b5c5c0f0442a7.tar.gz
2005-05-05 H.J. Lu <hongjiu.lu@intel.com>
* section.c (bfd_make_section_anyway_with_flags): New. (bfd_make_section_anyway): Call bfd_make_section_anyway_with_flags, (bfd_make_section_with_flags): New. (bfd_make_section): Call bfd_make_section_with_flags. * elf-m10300.c (_bfd_mn10300_elf_create_got_section): Call bfd_make_section_with_flags/bfd_make_section_anyway_with_flags instead of bfd_make_section/bfd_make_section and don't call bfd_set_section_flags. (mn10300_elf_check_relocs): Likewise. (_bfd_mn10300_elf_create_dynamic_sections): Likewise. * elf32-arm.c (create_got_section): Likewise. (bfd_elf32_arm_add_glue_sections_to_bfd): Likewise. (elf32_arm_check_relocs): Likewise. * elf32-cris.c (cris_elf_check_relocs): Likewise. * elf32-frv.c (elf32_frv_add_symbol_hook): Likewise. (_frv_create_got_section): Likewise. (elf32_frvfdpic_create_dynamic_sections): Likewise. * elf32-hppa.c (elf32_hppa_create_dynamic_sections): Likewise. (elf32_hppa_check_relocs): Likewise. * elf32-i370.c (i370_elf_create_dynamic_sections): Likewise. (i370_elf_check_relocs): Likewise. * elf32-i386.c (create_got_section): Likewise. (elf_i386_check_relocs): Likewise. * elf32-m32r.c (m32r_elf_add_symbol_hook): Likewise. (create_got_section): Likewise. (m32r_elf_create_dynamic_sections): Likewise. (m32r_elf_check_relocs): Likewise. * elf32-m68k.c (elf_m68k_check_relocs): Likewise. * elf32-ppc.c (ppc_elf_create_got): Likewise. (ppc_elf_create_dynamic_sections): Likewise. (ppc_elf_add_symbol_hook): Likewise. (ppc_elf_check_relocs): Likewise. * elf32-s390.c (create_got_section): Likewise. (elf_s390_check_relocs): Likewise. * elf32-sh.c (create_got_section): Likewise. (sh_elf_create_dynamic_sections): Likewise. (sh_elf_check_relocs): Likewise. * elf32-vax.c (elf_vax_check_relocs): Likewise. * elf32-xstormy16.c (xstormy16_elf_check_relocs): Likewise. * elf32-xtensa.c (elf_xtensa_create_dynamic_sections): Likewise. (add_extra_plt_sections): Likewise. * elf64-alpha.c (elf64_alpha_add_symbol_hook): Likewise. (elf64_alpha_create_got_section): Likewise. (elf64_alpha_create_dynamic_sections): Likewise. (elf64_alpha_check_relocs): Likewise. * elf64-hppa.c (get_reloc_section): Likewise. (get_opd): Likewise. (get_plt): Likewise. (get_dlt): Likewise. (get_stub): Likewise. (elf64_hppa_create_dynamic_sectionso): Likewise. * elf64-mmix.c (mmix_elf_check_common_relocs): Likewise. * elf64-ppc.c (create_linkage_sections): Likewise. (ppc64_elf_check_relocs): Likewise. * elf64-s390.c (create_got_section): Likewise. (elf_s390_check_relocs): Likewise. * elf64-sh64.c (sh_elf64_check_relocs): Likewise. (sh64_elf64_create_dynamic_sections): Likewise. * elf64-x86-64.c (create_got_section): Likewise. (elf64_x86_64_check_relocs): Likewise. * elflink.c (_bfd_elf_create_got_section): Likewise. (_bfd_elf_link_create_dynamic_sections): Likewise. (elf_link_add_object_symbols): Likewise. * elfxx-ia64.c (elfNN_ia64_add_symbol_hook): Likewise. (elfNN_ia64_create_dynamic_sections): Likewise. (get_fptr): Likewise. (get_pltoff): Likewise. (get_reloc_section): Likewise. (elfNN_ia64_object_p): Likewise. * elfxx-mips.c (mips_elf_rel_dyn_section): Likewise. (mips_elf_create_compact_rel_section): Likewise. (mips_elf_create_got_section): Likewise. (_bfd_mips_elf_create_dynamic_sections): Likewise. * elfxx-sparc.c (create_got_section): Likewise. (_bfd_sparc_elf_check_relocs): Likewise. * elf.c (_bfd_elf_new_section_hook): Call _bfd_elf_get_sec_type_attr on linker created sections.
Diffstat (limited to 'bfd/section.c')
-rw-r--r--bfd/section.c67
1 files changed, 59 insertions, 8 deletions
diff --git a/bfd/section.c b/bfd/section.c
index 2683cea6add..4e46a5db330 100644
--- a/bfd/section.c
+++ b/bfd/section.c
@@ -1004,15 +1004,17 @@ bfd_make_section_old_way (bfd *abfd, const char *name)
/*
FUNCTION
- bfd_make_section_anyway
+ bfd_make_section_anyway_with_flags
SYNOPSIS
- asection *bfd_make_section_anyway (bfd *abfd, const char *name);
+ asection *bfd_make_section_anyway_with_flags
+ (bfd *abfd, const char *name, flagword flags);
DESCRIPTION
Create a new empty section called @var{name} and attach it to the end of
the chain of sections for @var{abfd}. Create a new section even if there
- is already a section with that name.
+ is already a section with that name. Also set the attributes of the
+ new section to the value @var{flags}.
Return <<NULL>> and set <<bfd_error>> on error; possible errors are:
o <<bfd_error_invalid_operation>> - If output has already started for @var{abfd}.
@@ -1020,7 +1022,8 @@ DESCRIPTION
*/
sec_ptr
-bfd_make_section_anyway (bfd *abfd, const char *name)
+bfd_make_section_anyway_with_flags (bfd *abfd, const char *name,
+ flagword flags)
{
struct section_hash_entry *sh;
asection *newsect;
@@ -1053,26 +1056,53 @@ bfd_make_section_anyway (bfd *abfd, const char *name)
newsect = &new_sh->section;
}
+ newsect->flags = flags;
newsect->name = name;
return bfd_section_init (abfd, newsect);
}
/*
FUNCTION
- bfd_make_section
+ bfd_make_section_anyway
SYNOPSIS
- asection *bfd_make_section (bfd *, const char *name);
+ asection *bfd_make_section_anyway (bfd *abfd, const char *name);
+
+DESCRIPTION
+ Create a new empty section called @var{name} and attach it to the end of
+ the chain of sections for @var{abfd}. Create a new section even if there
+ is already a section with that name.
+
+ Return <<NULL>> and set <<bfd_error>> on error; possible errors are:
+ o <<bfd_error_invalid_operation>> - If output has already started for @var{abfd}.
+ o <<bfd_error_no_memory>> - If memory allocation fails.
+*/
+
+sec_ptr
+bfd_make_section_anyway (bfd *abfd, const char *name)
+{
+ return bfd_make_section_anyway_with_flags (abfd, name, 0);
+}
+
+/*
+FUNCTION
+ bfd_make_section_with_flags
+
+SYNOPSIS
+ asection *bfd_make_section_with_flags
+ (bfd *, const char *name, flagword flags);
DESCRIPTION
Like <<bfd_make_section_anyway>>, but return <<NULL>> (without calling
bfd_set_error ()) without changing the section chain if there is already a
- section named @var{name}. If there is an error, return <<NULL>> and set
+ section named @var{name}. Also set the attributes of the new section to
+ the value @var{flags}. If there is an error, return <<NULL>> and set
<<bfd_error>>.
*/
asection *
-bfd_make_section (bfd *abfd, const char *name)
+bfd_make_section_with_flags (bfd *abfd, const char *name,
+ flagword flags)
{
struct section_hash_entry *sh;
asection *newsect;
@@ -1101,11 +1131,32 @@ bfd_make_section (bfd *abfd, const char *name)
}
newsect->name = name;
+ newsect->flags = flags;
return bfd_section_init (abfd, newsect);
}
/*
FUNCTION
+ bfd_make_section
+
+SYNOPSIS
+ asection *bfd_make_section (bfd *, const char *name);
+
+DESCRIPTION
+ Like <<bfd_make_section_anyway>>, but return <<NULL>> (without calling
+ bfd_set_error ()) without changing the section chain if there is already a
+ section named @var{name}. If there is an error, return <<NULL>> and set
+ <<bfd_error>>.
+*/
+
+asection *
+bfd_make_section (bfd *abfd, const char *name)
+{
+ return bfd_make_section_with_flags (abfd, name, 0);
+}
+
+/*
+FUNCTION
bfd_set_section_flags
SYNOPSIS