MY_bfd_copy_private_section_data (bfd *ibfd,
asection *isec ATTRIBUTE_UNUSED,
bfd *obfd,
- asection *osec ATTRIBUTE_UNUSED)
+ asection *osec ATTRIBUTE_UNUSED,
+ struct bfd_link_info *link_info)
{
- if (bfd_get_flavour (ibfd) == bfd_target_aout_flavour
+ if (link_info == NULL
+ && bfd_get_flavour (ibfd) == bfd_target_aout_flavour
&& bfd_get_flavour (obfd) == bfd_target_aout_flavour)
obj_aout_subformat (obfd) = obj_aout_subformat (ibfd);
return true;
#define MY_bfd_merge_private_bfd_data _bfd_generic_bfd_merge_private_bfd_data
#endif
-#define MY_init_private_section_data \
- _bfd_generic_init_private_section_data
-
#ifndef MY_bfd_copy_private_symbol_data
#define MY_bfd_copy_private_symbol_data _bfd_generic_bfd_copy_private_symbol_data
#endif
(bfd *abfd, asection *section, bfd_byte **buf);
bool bfd_copy_private_section_data
- (bfd *ibfd, asection *isec, bfd *obfd, asection *osec);
+ (bfd *ibfd, asection *isec, bfd *obfd, asection *osec,
+ struct bfd_link_info *link_info);
-#define bfd_copy_private_section_data(ibfd, isection, obfd, osection) \
+#define bfd_copy_private_section_data(ibfd, isec, obfd, osec, link_info) \
BFD_SEND (obfd, _bfd_copy_private_section_data, \
- (ibfd, isection, obfd, osection))
+ (ibfd, isec, obfd, osec, link_info))
bool bfd_generic_is_group_section (bfd *, const asection *sec);
const char *bfd_generic_group_name (bfd *, const asection *sec);
#define BFD_JUMP_TABLE_COPY(NAME) \
NAME##_bfd_copy_private_bfd_data, \
NAME##_bfd_merge_private_bfd_data, \
- NAME##_init_private_section_data, \
NAME##_bfd_copy_private_section_data, \
NAME##_bfd_copy_private_symbol_data, \
NAME##_bfd_copy_private_header_data, \
/* Called to merge BFD general private data from one object file
to a common output file when linking. */
bool (*_bfd_merge_private_bfd_data) (bfd *, struct bfd_link_info *);
- /* Called to initialize BFD private section data from one object file
- to another. */
-#define bfd_init_private_section_data(ibfd, isec, obfd, osec, link_info) \
- BFD_SEND (obfd, _bfd_init_private_section_data, \
- (ibfd, isec, obfd, osec, link_info))
- bool (*_bfd_init_private_section_data) (bfd *, sec_ptr, bfd *, sec_ptr,
- struct bfd_link_info *);
/* Called to copy BFD private section data from one object file
to another. */
- bool (*_bfd_copy_private_section_data) (bfd *, sec_ptr, bfd *, sec_ptr);
+ bool (*_bfd_copy_private_section_data) (bfd *, sec_ptr, bfd *, sec_ptr,
+ struct bfd_link_info *);
/* Called to copy BFD private symbol data from one symbol
to another. */
bool (*_bfd_copy_private_symbol_data) (bfd *, asymbol *,
#define _bfd_xcoff_get_section_contents _bfd_generic_get_section_contents
/* For copy private data entry points. */
-#define _bfd_xcoff_init_private_section_data \
- _bfd_generic_init_private_section_data
#define _bfd_xcoff_bfd_copy_private_bfd_data \
_bfd_xcoff_copy_private_bfd_data
#define _bfd_xcoff_bfd_merge_private_bfd_data \
/* Copy */
_bfd_xcoff_copy_private_bfd_data,
_bfd_generic_bfd_merge_private_bfd_data,
- _bfd_generic_init_private_section_data,
_bfd_generic_bfd_copy_private_section_data,
_bfd_generic_bfd_copy_private_symbol_data,
_bfd_generic_bfd_copy_private_header_data,
/* Copy */
_bfd_xcoff_copy_private_bfd_data,
_bfd_generic_bfd_merge_private_bfd_data,
- _bfd_generic_init_private_section_data,
_bfd_generic_bfd_copy_private_section_data,
_bfd_generic_bfd_copy_private_symbol_data,
_bfd_generic_bfd_copy_private_header_data,
#define coff_bfd_copy_private_header_data _bfd_generic_bfd_copy_private_header_data
#endif
-#define coff_init_private_section_data _bfd_generic_init_private_section_data
-
#ifndef coff_bfd_copy_private_section_data
#define coff_bfd_copy_private_section_data _bfd_generic_bfd_copy_private_section_data
#endif
(bfd *, bfd *);
extern bool _bfd_elf_copy_private_symbol_data
(bfd *, asymbol *, bfd *, asymbol *);
-extern bool _bfd_elf_init_private_section_data
- (bfd *, asection *, bfd *, asection *, struct bfd_link_info *);
extern bool _bfd_elf_copy_private_section_data
- (bfd *, asection *, bfd *, asection *);
+ (bfd *, asection *, bfd *, asection *, struct bfd_link_info *);
extern bool _bfd_elf_write_object_contents
(bfd *);
extern bool _bfd_elf_write_corefile_contents
return rewrite_elf_program_header (ibfd, obfd, maxpagesize);
}
-/* Initialize private output section information from input section. */
+/* Copy private section information from input to output. This function
+ is called both by objcopy where LINK_INFO is NULL, and ld where
+ LINK_INFO is non-NULL in the usual case but NULL for a special case
+ when dealing with LTO IR or cloning output sections. */
bool
-_bfd_elf_init_private_section_data (bfd *ibfd,
+_bfd_elf_copy_private_section_data (bfd *ibfd,
asection *isec,
bfd *obfd,
asection *osec,
struct bfd_link_info *link_info)
-
{
- Elf_Internal_Shdr *ihdr, *ohdr;
- bool final_link = (link_info != NULL
- && !bfd_link_relocatable (link_info));
-
if (ibfd->xvec->flavour != bfd_target_elf_flavour
|| obfd->xvec->flavour != bfd_target_elf_flavour)
return true;
- BFD_ASSERT (elf_section_data (osec) != NULL);
+ Elf_Internal_Shdr *ihdr = &elf_section_data (isec)->this_hdr;
+ Elf_Internal_Shdr *ohdr = &elf_section_data (osec)->this_hdr;
+ if (link_info == NULL)
+ {
+ ohdr->sh_entsize = ihdr->sh_entsize;
+
+ if (ihdr->sh_type == SHT_SYMTAB
+ || ihdr->sh_type == SHT_DYNSYM
+ || ihdr->sh_type == SHT_GNU_verneed
+ || ihdr->sh_type == SHT_GNU_verdef)
+ ohdr->sh_info = ihdr->sh_info;
+ }
/* If this is a known ABI section, ELF section type and flags may
have been set up when OSEC was created. For normal sections we
|| elf_section_type (osec) == SHT_NOTE
|| elf_section_type (osec) == SHT_NOBITS)
elf_section_type (osec) = SHT_NULL;
+
/* For objcopy and relocatable link, copy the ELF section type from
the input file if the BFD section flags are the same. (If they
are different the user may be doing something like
"objcopy --set-section-flags .text=alloc,data".) For a final
link allow some flags that the linker clears to differ. */
+ bool final_link = (link_info != NULL
+ && !bfd_link_relocatable (link_info));
if (elf_section_type (osec) == SHT_NULL
&& (osec->flags == isec->flags
|| (final_link
elf_section_flags (osec) |= (elf_section_flags (isec)
& SHF_COMPRESSED);
- ihdr = &elf_section_data (isec)->this_hdr;
-
/* We need to handle elf_linked_to_section for SHF_LINK_ORDER. We
don't use the output section of the linked-to section since it
may be NULL at this point. */
if ((ihdr->sh_flags & SHF_LINK_ORDER) != 0)
{
- ohdr = &elf_section_data (osec)->this_hdr;
ohdr->sh_flags |= SHF_LINK_ORDER;
elf_linked_to_section (osec) = elf_linked_to_section (isec);
}
return true;
}
-/* Copy private section information. This copies over the entsize
- field, and sometimes the info field. */
-
-bool
-_bfd_elf_copy_private_section_data (bfd *ibfd,
- asection *isec,
- bfd *obfd,
- asection *osec)
-{
- Elf_Internal_Shdr *ihdr, *ohdr;
-
- if (ibfd->xvec->flavour != bfd_target_elf_flavour
- || obfd->xvec->flavour != bfd_target_elf_flavour)
- return true;
-
- ihdr = &elf_section_data (isec)->this_hdr;
- ohdr = &elf_section_data (osec)->this_hdr;
-
- ohdr->sh_entsize = ihdr->sh_entsize;
-
- if (ihdr->sh_type == SHT_SYMTAB
- || ihdr->sh_type == SHT_DYNSYM
- || ihdr->sh_type == SHT_GNU_verneed
- || ihdr->sh_type == SHT_GNU_verdef)
- ohdr->sh_info = ihdr->sh_info;
-
- return _bfd_elf_init_private_section_data (ibfd, isec, obfd, osec,
- NULL);
-}
-
/* Look at all the SHT_GROUP sections in IBFD, making any adjustments
necessary if we are removing either the SHT_GROUP section or any of
the group member sections. DISCARDED is the value that a section's
static bool
elf_x86_64_copy_private_section_data (bfd *ibfd, asection *isec,
- bfd *obfd, asection *osec)
+ bfd *obfd, asection *osec,
+ struct bfd_link_info *link_info)
{
- if (!_bfd_elf_copy_private_section_data (ibfd, isec, obfd, osec))
+ if (!_bfd_elf_copy_private_section_data (ibfd, isec, obfd, osec, link_info))
return false;
/* objcopy --set-section-flags without "large" drops SHF_X86_64_LARGE. */
- if (ibfd != obfd)
+ if (link_info == NULL && ibfd != obfd)
elf_section_flags (osec) &= ~SHF_X86_64_LARGE;
return true;
_bfd_elf_copy_private_symbol_data
#endif
-#define bfd_elfNN_init_private_section_data \
- _bfd_elf_init_private_section_data
#ifndef bfd_elfNN_bfd_copy_private_section_data
#define bfd_elfNN_bfd_copy_private_section_data \
_bfd_elf_copy_private_section_data
#define _bfd_generic_bfd_merge_private_bfd_data \
_bfd_bool_bfd_link_true
#define _bfd_generic_bfd_set_private_flags _bfd_bool_bfd_uint_true
-#define _bfd_generic_bfd_copy_private_section_data \
- _bfd_bool_bfd_asection_bfd_asection_true
+extern bool _bfd_generic_bfd_copy_private_section_data
+ (bfd *, asection *, bfd *, asection *, struct bfd_link_info *)
+ ATTRIBUTE_HIDDEN;
#define _bfd_generic_bfd_copy_private_symbol_data \
_bfd_bool_bfd_asymbol_bfd_asymbol_true
#define _bfd_generic_bfd_copy_private_header_data _bfd_bool_bfd_bfd_true
#define _bfd_generic_bfd_print_private_bfd_data _bfd_bool_bfd_ptr_true
-extern bool _bfd_generic_init_private_section_data
- (bfd *, asection *, bfd *, asection *, struct bfd_link_info *)
- ATTRIBUTE_HIDDEN;
-
/* Routines to use for BFD_JUMP_TABLE_CORE when there is no core file
support. Use BFD_JUMP_TABLE_CORE (_bfd_nocore). */
}
bool
-_bfd_generic_init_private_section_data (bfd *ibfd ATTRIBUTE_UNUSED,
- asection *isec ATTRIBUTE_UNUSED,
- bfd *obfd ATTRIBUTE_UNUSED,
- asection *osec ATTRIBUTE_UNUSED,
- struct bfd_link_info *link_info ATTRIBUTE_UNUSED)
+_bfd_generic_bfd_copy_private_section_data (bfd *ibfd ATTRIBUTE_UNUSED,
+ asection *isec ATTRIBUTE_UNUSED,
+ bfd *obfd ATTRIBUTE_UNUSED,
+ asection *osec ATTRIBUTE_UNUSED,
+ struct bfd_link_info *link_info ATTRIBUTE_UNUSED)
{
return true;
}
#define _bfd_generic_bfd_merge_private_bfd_data \
_bfd_bool_bfd_link_true
#define _bfd_generic_bfd_set_private_flags _bfd_bool_bfd_uint_true
-#define _bfd_generic_bfd_copy_private_section_data \
- _bfd_bool_bfd_asection_bfd_asection_true
+extern bool _bfd_generic_bfd_copy_private_section_data
+ (bfd *, asection *, bfd *, asection *, struct bfd_link_info *)
+ ATTRIBUTE_HIDDEN;
#define _bfd_generic_bfd_copy_private_symbol_data \
_bfd_bool_bfd_asymbol_bfd_asymbol_true
#define _bfd_generic_bfd_copy_private_header_data _bfd_bool_bfd_bfd_true
#define _bfd_generic_bfd_print_private_bfd_data _bfd_bool_bfd_ptr_true
-extern bool _bfd_generic_init_private_section_data
- (bfd *, asection *, bfd *, asection *, struct bfd_link_info *)
- ATTRIBUTE_HIDDEN;
-
/* Routines to use for BFD_JUMP_TABLE_CORE when there is no core file
support. Use BFD_JUMP_TABLE_CORE (_bfd_nocore). */
#define _bfd_ecoff_bfd_link_split_section _bfd_generic_link_split_section
#define _bfd_ecoff_bfd_link_check_relocs _bfd_generic_link_check_relocs
-#define _bfd_ecoff_init_private_section_data \
- _bfd_generic_init_private_section_data
-
extern bool _bfd_ecoff_bfd_copy_private_bfd_data
(bfd *, bfd *);
#define _bfd_ecoff_bfd_copy_private_section_data \
unsigned _bfd_XX_only_swap_filehdr_out (bfd *, void *, void *);
unsigned _bfd_XXi_only_swap_filehdr_out (bfd *, void *, void *);
bool _bfd_XX_bfd_copy_private_section_data
- (bfd *, asection *, bfd *, asection *);
+ (bfd *, asection *, bfd *, asection *, struct bfd_link_info *);
bool _bfd_pe_print_ce_compressed_pdata (bfd *, void *);
bool _bfd_pe64_print_ce_compressed_pdata (bfd *, void *);
#define bfd_mach_o_write_armap _bfd_noarchive_write_armap
#define bfd_mach_o_get_elt_at_index _bfd_noarchive_get_elt_at_index
#define bfd_mach_o_update_armap_timestamp _bfd_noarchive_update_armap_timestamp
-#define bfd_mach_o_init_private_section_data _bfd_generic_init_private_section_data
#define TARGET_NAME_BACKEND XCONCAT2(TARGET_NAME,_backend)
bool
bfd_mach_o_bfd_copy_private_section_data (bfd *ibfd, asection *isection,
- bfd *obfd, asection *osection)
+ bfd *obfd, asection *osection,
+ struct bfd_link_info *link_info)
{
- bfd_mach_o_section *os = bfd_mach_o_get_mach_o_section (osection);
- bfd_mach_o_section *is = bfd_mach_o_get_mach_o_section (isection);
-
- if (ibfd->xvec->flavour != bfd_target_mach_o_flavour
+ if (link_info != NULL
+ || ibfd->xvec->flavour != bfd_target_mach_o_flavour
|| obfd->xvec->flavour != bfd_target_mach_o_flavour)
return true;
+ bfd_mach_o_section *os = bfd_mach_o_get_mach_o_section (osection);
+ bfd_mach_o_section *is = bfd_mach_o_get_mach_o_section (isection);
+
BFD_ASSERT (is != NULL && os != NULL);
os->flags = is->flags;
bool bfd_mach_o_bfd_copy_private_symbol_data (bfd *, asymbol *,
bfd *, asymbol *);
bool bfd_mach_o_bfd_copy_private_section_data (bfd *, asection *,
- bfd *, asection *);
+ bfd *, asection *,
+ struct bfd_link_info *);
bool bfd_mach_o_bfd_copy_private_header_data (bfd *, bfd *);
bool bfd_mach_o_bfd_set_private_flags (bfd *, flagword);
bool bfd_mach_o_bfd_print_private_bfd_data (bfd *, void *);
#define mmo_bfd_copy_private_header_data _bfd_generic_bfd_copy_private_header_data
#define mmo_bfd_set_private_flags _bfd_generic_bfd_set_private_flags
#define mmo_bfd_print_private_bfd_data _bfd_generic_bfd_print_private_bfd_data
-#define mmo_init_private_section_data _bfd_generic_init_private_section_data
const bfd_target mmix_mmo_vec =
{
_bfd_XX_bfd_copy_private_section_data (bfd *ibfd,
asection *isec,
bfd *obfd,
- asection *osec)
+ asection *osec,
+ struct bfd_link_info *link_info)
{
- if (bfd_get_flavour (ibfd) != bfd_target_coff_flavour
+ if (link_info != NULL
+ || bfd_get_flavour (ibfd) != bfd_target_coff_flavour
|| bfd_get_flavour (obfd) != bfd_target_coff_flavour)
return true;
#define bfd_plugin_bfd_free_cached_info _bfd_generic_bfd_free_cached_info
#define bfd_plugin_new_section_hook _bfd_generic_new_section_hook
#define bfd_plugin_get_section_contents _bfd_generic_get_section_contents
-#define bfd_plugin_init_private_section_data _bfd_generic_init_private_section_data
-#define bfd_plugin_bfd_copy_private_header_data _bfd_generic_bfd_copy_private_header_data
#define bfd_plugin_bfd_merge_private_bfd_data _bfd_generic_bfd_merge_private_bfd_data
#define bfd_plugin_bfd_copy_private_header_data _bfd_generic_bfd_copy_private_header_data
#define bfd_plugin_bfd_set_private_flags _bfd_generic_bfd_set_private_flags
bfd_plugin_bfd_copy_private_section_data (bfd *ibfd ATTRIBUTE_UNUSED,
asection *isection ATTRIBUTE_UNUSED,
bfd *obfd ATTRIBUTE_UNUSED,
- asection *osection ATTRIBUTE_UNUSED)
+ asection *osection ATTRIBUTE_UNUSED,
+ struct bfd_link_info *link_info ATTRIBUTE_UNUSED)
{
BFD_ASSERT (0);
return true;
#define ppcboot_bfd_copy_private_bfd_data _bfd_generic_bfd_copy_private_bfd_data
#define ppcboot_bfd_merge_private_bfd_data _bfd_generic_bfd_merge_private_bfd_data
-#define ppcboot_init_private_section_data _bfd_generic_init_private_section_data
#define ppcboot_bfd_copy_private_section_data _bfd_generic_bfd_copy_private_section_data
#define ppcboot_bfd_copy_private_symbol_data _bfd_generic_bfd_copy_private_symbol_data
#define ppcboot_bfd_copy_private_header_data _bfd_generic_bfd_copy_private_header_data
SYNOPSIS
bool bfd_copy_private_section_data
- (bfd *ibfd, asection *isec, bfd *obfd, asection *osec);
+ (bfd *ibfd, asection *isec, bfd *obfd, asection *osec,
+ struct bfd_link_info *link_info);
DESCRIPTION
Copy private section information from @var{isec} in the BFD
o <<bfd_error_no_memory>> -
Not enough memory exists to create private data for @var{osec}.
-.#define bfd_copy_private_section_data(ibfd, isection, obfd, osection) \
+.#define bfd_copy_private_section_data(ibfd, isec, obfd, osec, link_info) \
. BFD_SEND (obfd, _bfd_copy_private_section_data, \
-. (ibfd, isection, obfd, osection))
+. (ibfd, isec, obfd, osec, link_info))
*/
/*
som_bfd_copy_private_section_data (bfd *ibfd,
asection *isection,
bfd *obfd,
- asection *osection)
+ asection *osection,
+ struct bfd_link_info *link_info)
{
- size_t amt;
-
/* One day we may try to grok other private data. */
- if (ibfd->xvec->flavour != bfd_target_som_flavour
+ if (link_info != NULL
+ || ibfd->xvec->flavour != bfd_target_som_flavour
|| obfd->xvec->flavour != bfd_target_som_flavour
|| (!som_is_space (isection) && !som_is_subspace (isection)))
return true;
- amt = sizeof (struct som_copyable_section_data_struct);
+ size_t amt = sizeof (struct som_copyable_section_data_struct);
som_section_data (osection)->copy_data = bfd_zalloc (obfd, amt);
if (som_section_data (osection)->copy_data == NULL)
return false;
{
/* User has specified a subspace without its containing space. */
_bfd_error_handler (_("%pB[%pA]: no output section for space %pA"),
- obfd, osection, som_section_data (osection)->copy_data->container);
+ obfd, osection,
+ som_section_data (osection)->copy_data->container);
return false;
}
}
#define som_bfd_link_hide_symbol _bfd_generic_link_hide_symbol
#define som_bfd_define_start_stop bfd_generic_define_start_stop
#define som_bfd_merge_private_bfd_data _bfd_generic_bfd_merge_private_bfd_data
-#define som_init_private_section_data _bfd_generic_init_private_section_data
#define som_bfd_copy_private_header_data _bfd_generic_bfd_copy_private_header_data
#define som_bfd_set_private_flags _bfd_generic_bfd_set_private_flags
#define som_find_inliner_info _bfd_nosymbols_find_inliner_info
.#define BFD_JUMP_TABLE_COPY(NAME) \
. NAME##_bfd_copy_private_bfd_data, \
. NAME##_bfd_merge_private_bfd_data, \
-. NAME##_init_private_section_data, \
. NAME##_bfd_copy_private_section_data, \
. NAME##_bfd_copy_private_symbol_data, \
. NAME##_bfd_copy_private_header_data, \
. {* Called to merge BFD general private data from one object file
. to a common output file when linking. *}
. bool (*_bfd_merge_private_bfd_data) (bfd *, struct bfd_link_info *);
-. {* Called to initialize BFD private section data from one object file
-. to another. *}
-.#define bfd_init_private_section_data(ibfd, isec, obfd, osec, link_info) \
-. BFD_SEND (obfd, _bfd_init_private_section_data, \
-. (ibfd, isec, obfd, osec, link_info))
-. bool (*_bfd_init_private_section_data) (bfd *, sec_ptr, bfd *, sec_ptr,
-. struct bfd_link_info *);
. {* Called to copy BFD private section data from one object file
. to another. *}
-. bool (*_bfd_copy_private_section_data) (bfd *, sec_ptr, bfd *, sec_ptr);
+. bool (*_bfd_copy_private_section_data) (bfd *, sec_ptr, bfd *, sec_ptr,
+. struct bfd_link_info *);
. {* Called to copy BFD private symbol data from one symbol
. to another. *}
. bool (*_bfd_copy_private_symbol_data) (bfd *, asymbol *,
#define vms_bfd_copy_private_bfd_data _bfd_generic_bfd_copy_private_bfd_data
#define vms_bfd_merge_private_bfd_data _bfd_generic_bfd_merge_private_bfd_data
-#define vms_init_private_section_data _bfd_generic_init_private_section_data
#define vms_bfd_copy_private_section_data _bfd_generic_bfd_copy_private_section_data
#define vms_bfd_copy_private_symbol_data _bfd_generic_bfd_copy_private_symbol_data
#define vms_bfd_copy_private_header_data _bfd_generic_bfd_copy_private_header_data
/* Allow the BFD backend to copy any private data it understands
from the input section to the output section. */
- if (!bfd_copy_private_section_data (ibfd, isection, obfd, osection))
+ if (!bfd_copy_private_section_data (ibfd, isection, obfd, osection, NULL))
err = _("failed to copy private data");
if (make_nobits)
/* This must happen after flags have been updated. The output
section may have been created before we saw its first input
section, eg. for a data statement. */
- bfd_init_private_section_data (section->owner, section,
+ bfd_copy_private_section_data (section->owner, section,
link_info.output_bfd,
output->bfd_section,
&link_info);
/* Allow the BFD backend to copy any private data it understands
from the input section to the output section. */
- if (!bfd_copy_private_section_data (ibfd, isection, obfd, osection))
+ if (!bfd_copy_private_section_data (ibfd, isection, obfd, osection, NULL))
{
err = _("failed to copy private data");
goto loser;
n->reloc_count = 0;
n->alignment_power = s->alignment_power;
- bfd_copy_private_section_data (abfd, s, abfd, n);
+ bfd_copy_private_section_data (abfd, s, abfd, n, NULL);
return n;
}