From 5b3b9ff61d3a2a6cdd90fcec1a61d38699f3c608 Mon Sep 17 00:00:00 2001 From: Ian Lance Taylor Date: Thu, 11 Jan 1996 21:06:42 +0000 Subject: * elf32-mips.c: Extensive changes for a start at dynamic linking support, from Kazumoto Kojima . * elf-bfd.h (struct elf_backend_data): Add type_change_ok field. (struct elf_backend_data): Remove elf_backend_create_program_headers field. Add elf_backend_additional_program_headers and elf_backend_modify_segment_map fields. * elfxx-target.h (elf_backend_type_change_ok): Define if not defined. (elf_backend_additional_program_headers): Likewise. (elf_backend_modify_segment_map): Likewise. (elf_backend_create_program_headers): Don't define. (elfNN_bed): Change to account for field changes. * elf.c (assign_file_positions_for_segments): Call new modify_segment_map backend function. Don't call old create_program_headers backend function. (get_program_header_size): Call additional_program_headers rather than create_program_headers. * elflink.h (elf_link_add_object_symbols): Initialize type_change_ok from new backend field. (elf_link_output_extsym): Don't warn if _rld_new_interface is defined. (elf_reloc_link_order): Treat a reloc against a defined symbol as a reloc against the appropriate section. --- bfd/elf.c | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) (limited to 'bfd/elf.c') diff --git a/bfd/elf.c b/bfd/elf.c index a7bdf5c..05254ff 100644 --- a/bfd/elf.c +++ b/bfd/elf.c @@ -576,6 +576,7 @@ bfd_section_from_shdr (abfd, shindex) case SHT_DYNAMIC: /* Dynamic linking information. */ case SHT_NOBITS: /* .bss section. */ case SHT_HASH: /* .hash section. */ + case SHT_NOTE: /* .note section. */ return _bfd_elf_make_section_from_shdr (abfd, hdr, name); case SHT_SYMTAB: /* A symbol table */ @@ -752,9 +753,6 @@ bfd_section_from_shdr (abfd, shindex) } break; - case SHT_NOTE: - break; - case SHT_SHLIB: return true; @@ -1746,6 +1744,12 @@ assign_file_positions_for_segments (abfd) return false; } + if (bed->elf_backend_modify_segment_map) + { + if (! (*bed->elf_backend_modify_segment_map) (abfd)) + return false; + } + count = 0; for (m = elf_tdata (abfd)->segment_map; m != NULL; m = m->next) ++count; @@ -1757,11 +1761,6 @@ assign_file_positions_for_segments (abfd) if (count == 0) return true; - /* Let the backend count up any program headers it might need. */ - if (bed->elf_backend_create_program_headers) - count = ((*bed->elf_backend_create_program_headers) - (abfd, (Elf_Internal_Phdr *) NULL, count)); - /* If we already counted the number of program segments, make sure that we allocated enough space. This happens when SIZEOF_HEADERS is used in a linker script. */ @@ -1978,11 +1977,6 @@ assign_file_positions_for_segments (abfd) } } - /* Let the backend set up any program headers it might need. */ - if (bed->elf_backend_create_program_headers) - count = ((*bed->elf_backend_create_program_headers) - (abfd, phdrs, count)); - /* Clear out any program headers we allocated but did not use. */ for (; count < alloc; count++, p++) { @@ -2057,9 +2051,15 @@ get_program_header_size (abfd) } /* Let the backend count up any program headers it might need. */ - if (bed->elf_backend_create_program_headers) - segs = ((*bed->elf_backend_create_program_headers) - (abfd, (Elf_Internal_Phdr *) NULL, segs)); + if (bed->elf_backend_additional_program_headers) + { + int a; + + a = (*bed->elf_backend_additional_program_headers) (abfd); + if (a == -1) + abort (); + segs += a; + } elf_tdata (abfd)->program_header_size = segs * bed->s->sizeof_phdr; return elf_tdata (abfd)->program_header_size; -- cgit v1.1