/* ELF linker support.
- Copyright 1995, 1996 Free Software Foundation, Inc.
+ Copyright 1995, 1996, 1997 Free Software Foundation, Inc.
This file is part of BFD, the Binary File Descriptor library.
{
boolean failed;
struct bfd_link_info *info;
-};
+};
/* Given an ELF BFD, add symbols to the global hash table as
appropriate. */
goto error_return;
if (! (_bfd_generic_link_add_one_symbol
- (info, abfd,
+ (info, abfd,
name + sizeof ".gnu.warning." - 1,
BSF_WARNING, s, (bfd_vma) 0, msg, false, collect,
(struct bfd_link_hash_entry **) NULL)))
/* Note that we set the SEC_IN_MEMORY flag for all of these
sections. */
- flags = SEC_ALLOC | SEC_LOAD | SEC_HAS_CONTENTS | SEC_IN_MEMORY;
+ flags = (SEC_ALLOC | SEC_LOAD | SEC_HAS_CONTENTS
+ | SEC_IN_MEMORY | SEC_LINKER_CREATED);
/* A dynamically linked executable has a .interp section, but a
shared library does not. */
/* Cache the results for next time, if we can. */
if (keep_memory)
elf_section_data (o)->relocs = internal_relocs;
-
+
if (alloc1 != NULL)
free (alloc1);
boolean
NAME(bfd_elf,size_dynamic_sections) (output_bfd, soname, rpath,
export_dynamic, filter_shlib,
- auxiliary_filter_shlib, info, sinterpptr)
+ auxiliary_filters, info, sinterpptr)
bfd *output_bfd;
const char *soname;
const char *rpath;
boolean export_dynamic;
const char *filter_shlib;
- const char *auxiliary_filter_shlib;
+ const char * const *auxiliary_filters;
struct bfd_link_info *info;
asection **sinterpptr;
{
if (info->hash->creator->flavour != bfd_target_elf_flavour)
return true;
+ /* The backend may have to create some sections regardless of whether
+ we're dynamic or not. */
+ bed = get_elf_backend_data (output_bfd);
+ if (bed->elf_backend_always_size_sections
+ && ! (*bed->elf_backend_always_size_sections) (output_bfd, info))
+ return false;
+
dynobj = elf_hash_table (info)->dynobj;
/* If there were no dynamic objects in the link, there is nothing to
if (indx == (bfd_size_type) -1
|| ! elf_add_dynamic_entry (info, DT_SONAME, indx))
return false;
- }
+ }
if (info->symbolic)
{
return false;
}
- if (auxiliary_filter_shlib != NULL)
+ if (auxiliary_filters != NULL)
{
- bfd_size_type indx;
+ const char * const *p;
- indx = _bfd_stringtab_add (elf_hash_table (info)->dynstr,
- auxiliary_filter_shlib, true, true);
- if (indx == (bfd_size_type) -1
- || ! elf_add_dynamic_entry (info, DT_AUXILIARY, indx))
- return false;
+ for (p = auxiliary_filters; *p != NULL; p++)
+ {
+ bfd_size_type indx;
+
+ indx = _bfd_stringtab_add (elf_hash_table (info)->dynstr,
+ *p, true, true);
+ if (indx == (bfd_size_type) -1
+ || ! elf_add_dynamic_entry (info, DT_AUXILIARY, indx))
+ return false;
+ }
}
/* Find all symbols which were defined in a dynamic object and make
/* The backend must work out the sizes of all the other dynamic
sections. */
- bed = get_elf_backend_data (output_bfd);
if (! (*bed->elf_backend_size_dynamic_sections) (output_bfd, info))
return false;
{
boolean failed;
struct elf_final_link_info *finfo;
-};
+};
/* Do the final step of an ELF link. */
{
if (*rel_hash == NULL)
continue;
-
+
BFD_ASSERT ((*rel_hash)->indx >= 0);
if (rel_hdr->sh_entsize == sizeof (Elf_External_Rel))
if ((o->flags & SEC_HAS_CONTENTS) == 0
|| o->_raw_size == 0)
continue;
- if ((o->flags & SEC_IN_MEMORY) == 0)
+ if ((o->flags & SEC_LINKER_CREATED) == 0)
{
/* At this point, we are only interested in sections
- created by elf_link_create_dynamic_sections. FIXME:
- This test is fragile. */
+ created by elf_link_create_dynamic_sections. */
continue;
}
if ((elf_section_data (o->output_section)->this_hdr.sh_type
|| (o->_raw_size == 0 && (o->flags & SEC_RELOC) == 0))
continue;
- if ((o->flags & SEC_IN_MEMORY) != 0
- && input_bfd == elf_hash_table (finfo->info)->dynobj)
+ if ((o->flags & SEC_LINKER_CREATED) != 0)
{
- /* Section was created by elf_link_create_dynamic_sections.
- FIXME: This test is fragile. */
+ /* Section was created by elf_link_create_dynamic_sections
+ or somesuch. */
continue;
}