diff options
author | Alan Modra <amodra@bigpond.net.au> | 2003-07-04 01:50:12 +0000 |
---|---|---|
committer | Alan Modra <amodra@bigpond.net.au> | 2003-07-04 01:50:12 +0000 |
commit | 919f6ba79faf146eca9bd033e5f151c99986fe4b (patch) | |
tree | eb44c3cb789341384e17101d5754907a13815fab /bfd/elflink.c | |
parent | d52a3c9a894e8fb5c3f32c16a1ceb51d7a4be070 (diff) | |
download | gdb-919f6ba79faf146eca9bd033e5f151c99986fe4b.tar.gz |
* elf-bfd.h (_bfd_elf_create_linker_section) Don't declare.
(_bfd_elf_find_pointer_linker_section): Likewise.
(bfd_elf32_create_pointer_linker_section): Likewise.
(bfd_elf32_finish_pointer_linker_section): Likewise.
(bfd_elf64_create_pointer_linker_section): Likewise.
(bfd_elf64_finish_pointer_linker_section): Likewise.
(_bfd_elf_make_linker_section_rela): Likewise.
* elfcode.h (elf_create_pointer_linker_section): Don't define.
(elf_finish_pointer_linker_section): Likewise.
* elflink.c (_bfd_elf_make_linker_section_rela): Delete.
(_bfd_elf_create_linker_section): Move this function..
(_bfd_elf_find_pointer_linker_section): ..and this..
* elflink.h (elf_create_pointer_linker_section): ..and this..
(elf_finish_pointer_linker_section): ..and this..
* elf32-ppc.c: ..to here, renaming to the following, and adjusting
calls.
(elf_create_linker_section): Convert to C90, tidy.
(elf_find_pointer_linker_section): Likewise.
(elf_create_pointer_linker_section): Likewise.
(elf_finish_pointer_linker_section): Likewise.
* elf32-i370.c: Delete #if 0 code.
Diffstat (limited to 'bfd/elflink.c')
-rw-r--r-- | bfd/elflink.c | 173 |
1 files changed, 0 insertions, 173 deletions
diff --git a/bfd/elflink.c b/bfd/elflink.c index d6f6d705ead..b448367d24e 100644 --- a/bfd/elflink.c +++ b/bfd/elflink.c @@ -1896,179 +1896,6 @@ _bfd_elf_link_assign_sym_version (h, data) return TRUE; } -/* Create a special linker section, or return a pointer to a linker - section already created */ - -elf_linker_section_t * -_bfd_elf_create_linker_section (abfd, info, which, defaults) - bfd *abfd; - struct bfd_link_info *info; - enum elf_linker_section_enum which; - elf_linker_section_t *defaults; -{ - bfd *dynobj = elf_hash_table (info)->dynobj; - elf_linker_section_t *lsect; - - /* Record the first bfd section that needs the special section */ - if (!dynobj) - dynobj = elf_hash_table (info)->dynobj = abfd; - - /* If this is the first time, create the section */ - lsect = elf_linker_section (dynobj, which); - if (!lsect) - { - asection *s; - bfd_size_type amt = sizeof (elf_linker_section_t); - - lsect = (elf_linker_section_t *) bfd_alloc (dynobj, amt); - - *lsect = *defaults; - elf_linker_section (dynobj, which) = lsect; - lsect->which = which; - lsect->hole_written_p = FALSE; - - /* See if the sections already exist */ - lsect->section = s = bfd_get_section_by_name (dynobj, lsect->name); - if (!s || (s->flags & defaults->flags) != defaults->flags) - { - lsect->section = s = bfd_make_section_anyway (dynobj, lsect->name); - - if (s == NULL) - return (elf_linker_section_t *)0; - - bfd_set_section_flags (dynobj, s, defaults->flags); - bfd_set_section_alignment (dynobj, s, lsect->alignment); - } - else if (bfd_get_section_alignment (dynobj, s) < lsect->alignment) - bfd_set_section_alignment (dynobj, s, lsect->alignment); - - s->_raw_size = align_power (s->_raw_size, lsect->alignment); - - /* Is there a hole we have to provide? If so check whether the - segment is too big already */ - if (lsect->hole_size) - { - lsect->hole_offset = s->_raw_size; - s->_raw_size += lsect->hole_size; - if (lsect->hole_offset > lsect->max_hole_offset) - { - (*_bfd_error_handler) - (_("%s: Section %s is too large to add hole of %ld bytes"), - bfd_get_filename (abfd), - lsect->name, - (long) lsect->hole_size); - - bfd_set_error (bfd_error_bad_value); - return (elf_linker_section_t *)0; - } - } - -#ifdef DEBUG - fprintf (stderr, "Creating section %s, current size = %ld\n", - lsect->name, (long)s->_raw_size); -#endif - - if (lsect->sym_name) - { - struct elf_link_hash_entry *h; - struct bfd_link_hash_entry *bh; - -#ifdef DEBUG - fprintf (stderr, "Adding %s to section %s\n", - lsect->sym_name, - lsect->name); -#endif - bh = bfd_link_hash_lookup (info->hash, lsect->sym_name, - FALSE, FALSE, FALSE); - - if ((bh == NULL || bh->type == bfd_link_hash_undefined) - && !(_bfd_generic_link_add_one_symbol - (info, abfd, lsect->sym_name, BSF_GLOBAL, s, - (lsect->hole_size - ? s->_raw_size - lsect->hole_size + lsect->sym_offset - : lsect->sym_offset), - (const char *) NULL, FALSE, - get_elf_backend_data (abfd)->collect, &bh))) - return (elf_linker_section_t *) 0; - h = (struct elf_link_hash_entry *) bh; - - if ((defaults->which != LINKER_SECTION_SDATA) - && (defaults->which != LINKER_SECTION_SDATA2)) - h->elf_link_hash_flags |= ELF_LINK_HASH_DEF_DYNAMIC; - - h->type = STT_OBJECT; - lsect->sym_hash = h; - - if (info->shared - && ! _bfd_elf_link_record_dynamic_symbol (info, h)) - return (elf_linker_section_t *) 0; - } - } - -#if 0 - /* This does not make sense. The sections which may exist in the - object file have nothing to do with the sections we want to - create. */ - - /* Find the related sections if they have been created */ - if (lsect->bss_name && !lsect->bss_section) - lsect->bss_section = bfd_get_section_by_name (dynobj, lsect->bss_name); - - if (lsect->rel_name && !lsect->rel_section) - lsect->rel_section = bfd_get_section_by_name (dynobj, lsect->rel_name); -#endif - - return lsect; -} - -/* Find a linker generated pointer with a given addend and type. */ - -elf_linker_section_pointers_t * -_bfd_elf_find_pointer_linker_section (linker_pointers, addend, which) - elf_linker_section_pointers_t *linker_pointers; - bfd_vma addend; - elf_linker_section_enum_t which; -{ - for ( ; linker_pointers != NULL; linker_pointers = linker_pointers->next) - { - if (which == linker_pointers->which && addend == linker_pointers->addend) - return linker_pointers; - } - - return (elf_linker_section_pointers_t *)0; -} - -/* Make the .rela section corresponding to the generated linker section. */ - -bfd_boolean -_bfd_elf_make_linker_section_rela (dynobj, lsect, alignment) - bfd *dynobj; - elf_linker_section_t *lsect; - int alignment; -{ - if (lsect->rel_section) - return TRUE; - - lsect->rel_section = bfd_get_section_by_name (dynobj, lsect->rel_name); - if (lsect->rel_section == NULL) - { - lsect->rel_section = bfd_make_section (dynobj, lsect->rel_name); - if (lsect->rel_section == NULL - || ! bfd_set_section_flags (dynobj, - lsect->rel_section, - (SEC_ALLOC - | SEC_LOAD - | SEC_HAS_CONTENTS - | SEC_IN_MEMORY - | SEC_LINKER_CREATED - | SEC_READONLY)) - || ! bfd_set_section_alignment (dynobj, lsect->rel_section, alignment)) - return FALSE; - } - - return TRUE; -} - /* Read and swap the relocs from the section indicated by SHDR. This may be either a REL or a RELA section. The relocations are translated into RELA relocations and stored in INTERNAL_RELOCS, |