Commit Graph

93 Commits

Author SHA1 Message Date
Nick Clifton 8bef8c3071 Set machine number based in bits in e_flags field rather than magic number. 1997-09-03 00:44:56 +00:00
Nick Clifton 8988d935a3 Switched over to using machine numbers to distinguish v850 architecture variants. 1997-08-25 23:00:29 +00:00
David Edelsohn 76af94b9a4 Remove ARC sanitization. 1997-08-15 12:08:52 +00:00
Ian Lance Taylor 20db24950c * elf.c (bfd_elf_string_from_elf_section): Check for an invalid
string index.
1997-06-26 15:40:41 +00:00
Ian Lance Taylor d6bfcdb505 From Eric Youngdale <eric@andante.jic.com>:
* elf-bfd.h (elf_symbol_type): Add version field.
	* elfcode.h (elf_slurp_symbol_table): Set version field.
	* elflink.h (elf_link_add_object_symbols): When creating an
 	indirect symbol for a default version symbol, set DEF_DYNAMIC if
 	appropriate.  Set up an indirection from the nondefault version of
	the symbol as well.
	(NAME(bfd_elf,size_dynamic_sections)): Call
	elf_link_assign_sym_version before checking whether there are any
	versions.  Always record the version name as a dynamic symbol.
	Initialize counters.
	(elf_link_assign_sym_version): After finding a version, see if a
	symbol should be forced to local scope.  Create a new version
	definition if appropriate.
	(elf_link_output_extsym): Correct indirect symbol handling.
	* elf.c (bfd_elf_print_symbol): Print version information.
	(bfd_section_from_shdr): Turn version sections into BFD sections.
	(elf_fake_sections): Only copy cverdefs and cverrefs into sh_info
	if sh_info is not already set.
	(_bfd_elf_copy_private_section_data): Copy sh_info for version
	sections.
	* elflink.c (_bfd_elf_link_record_dynamic_symbol): Tell
	_bfd_stringtab_add to copy the name into permanent memory if
	appropriate.
1997-03-10 04:43:42 +00:00
Ian Lance Taylor a66a61a0a2 * elfxx-target.h (bfd_elfNN_bfd_is_local_label_name): Define as
_bfd_elf_is_local_label_name if not already defined.
	* elf.c (_bfd_elf_is_local_label_name): New function.
	* elf-bfd.h (_bfd_elf_is_local_label_name): Declare.
1997-02-28 04:11:09 +00:00
Michael Meissner c6c7035cfb Since d10v is public now, remove all sanitization statements 1997-02-20 16:05:18 +00:00
Martin Hunt fd8d7c31c0 Tue Feb 18 17:22:59 1997 Martin M. Hunt <hunt@pizza.cygnus.com>
* Makefile.in, archures.c, config.bfd, configure.in, elf.c,
	reloc.c, targets.c: New target, elf-*-D30V.

	* bfd-in2.h, configure, libbfd.h: Rebuilt.

	* cpu-d30v.c, elf32-d30v.c: New files.
1997-02-19 01:29:29 +00:00
Ian Lance Taylor ff12f30335 Fri Jan 3 16:58:31 1997 Richard Henderson <rth@tamu.edu>
elf64-alpha multiple .got rewrite:

	* elf-bfd.h (struct elf_backend_data): Add always_size_sections entry.
	(bfd_elf*_mkobject): Don't define here ...
	* elfxx-target.h: ... but rather here.  Default always_size_sections
	hook to NULL.
	* elf.c (elf_mkobject): Rename to bfd_elf_mkobject, since that was
	what the #defines in elf-bfd.h transmuted it to anyway.

	* section.c: Add SEC_LINKER_CREATED flag.
	* bfd-in2.h: Rebuild.
	* elf32-i386.c (elf_i386_check_relocs): Add SEC_LINKER_CREATED to
	relocation section flags.
	(elf_i386_size_dynamic_sections): Use SEC_LINKER_CREATED instead of
	SEC_IN_MEMORY to recognize generated bits.
	* elf32-m68k.c (elf_m68k_check_relocs, elf_m68k_size_dynamic_sections):
	Likewise.
	* elf32-mips.c (mips_elf_final_link, mips_elf_create_dynamic_sections,
	mips_elf_create_compact_rel_section, mips_elf_create_got_section,
	mips_elf_check_relocs, mips_elf_size_dynamic_sections): Likewise.
	* elf32-ppc.c (ppc_elf_create_linker_section,
	ppc_elf_size_dynamic_sections): Likewise.
	* elf32-sparc.c (elf32_sparc_check_relocs,
	elf32_sparc_size_dynamic_sections): Likewise.
	* elflink.c (_bfd_elf_create_got_section): Add SEC_LINKER_CREATED to
	section flags.
	(_bfd_elf_create_dynamic_sections): Likewise.
	(_bfd_elf_make_linker_section_rela): Likewise.
	* elflink.h (elf_link_create_dynamic_sections): Likewise.
	(bfd_elf,size_dynamic_sections): Call the always_size_sections hook.
	(elf_bfd_final_link): Use SEC_LINKER_CREATED instead of SEC_IN_MEMORY
	to identify generated bits.
	(elf_link_input_bfd): Likewise.

	* elf64-alpha.c: Rewrite everything touching relocations.
1997-01-03 22:09:40 +00:00
Ian Lance Taylor 148437ec14 * elflink.h (NAME(bfd_elf,size_dynamic_sections)): Add
filter_shlib and auxiliary_filter_shlib parameters.
	* elf.c (_bfd_elf_print_private_bfd_data): Handle DT_AUXILIARY and
	DT_FILTER.
	* bfd-in.h (bfd_elf32_size_dynamic_sections): Update declaration.
	(bfd_elf64_size_dynamic_sections): Likewise.
	* bfd-in2.h: Rebuild.
1996-12-31 19:46:37 +00:00
Ian Lance Taylor 69e2ff181d * elf.c (bfd_elf_print_symbol): Print the st_other field if it is
not zero.
1996-12-17 16:12:58 +00:00
Ian Lance Taylor e85f2fbd15 * elf.c (bfd_section_from_shdr): Don't check for reloc sections
against SEC_DEBUGGING sections here (revert patch of December 5).
	* elfcode.h (elf_object_p): Check for them here, instead.
1996-12-16 19:39:39 +00:00
Ian Lance Taylor e35765a9a2 * elfcode.h (elf_slurp_reloc_table): Add dynamic parameter.
* elf.c (_bfd_elf_canonicalize_reloc): Pass new argument to
	slurp_reloc_table.
	(_bfd_elf_get_dynamic_reloc_upper_bound): New function.
	(_bfd_elf_canonicalize_dynamic_reloc): New function.
	* elf-bfd.h (struct elf_size_info): Update declaration of
	slurp_reloc_table.
	(_bfd_elf_get_dynamic_reloc_upper_bound): Declare.
	(_bfd_elf_canonicalize_dynamic_reloc): Declare.
	* elfxx-target.h: Use new dynamic reloc routines by default.
	* elf64-mips.c (mips_elf64_slurp_reloc_table): Add dynamic
	parameter.
1996-12-15 19:59:18 +00:00
Ian Lance Taylor 80be821d2e * elflink.h (elf_link_add_object_symbols): Calling check_relocs
even if SEC_ALLOC is not set.
	* elf32-i386.c (elf_i386_check_relocs): Don't check SEC_ALLOC
	when deciding whether to copy a reloc into a shared object.
	(elf_i386_relocate_section): Likewise.
	* elf32-sparc.c (elf32_sparc_check_relocs): Likewise.
	(elf32_sparc_relocate_section): Likewise.
	* elf32-i386.c (elf_i386_check_relocs): Don't set SEC_ALLOC in a
	reloc section if it is not set in the source section.
	* elf32-sparc.c (elf32_sparc_check_relocs): Likewise.
	* elf.c (bfd_section_from_shdr): Mark a reloc section associated
	with a SEC_DEBUGGING section as SEC_DEBUGGING.
PR 11174.
1996-12-05 18:47:03 +00:00
Jeff Law efc2b06463 * cpu-mn10x00.c, elf32-mn10x00.c: New files.
* Makefile.in (ALL_MACHINES): Add cpu-mn10x00.o.
        (BFD32_BACKENDS): Similarly for elf32-mn10x00.o.
        (elf32-mn10x00.o): Add dependencies.
        * archures.c (enum bfd_architecture): Add bfd_arch_mn10x00.
        (bfd_mn10x00_arch): Declare.
        (bfd_archures_list): Add bfd_mn10x00_arch.
        * config.bfd: Add mn10x00-*-*.
        * configure.in: Add bfd_elf32_mn10x00_vec.
        * elf.c (prep_headers): Handle bfd_arch_mn10x00.
        * targets.c (bfd_elf32_mn10x00_vec): Declare.
        (bfd_target_vector): Add bfd_elf32_mn10x00_vec.
        * bfd-in2.h, configure: Rebuilt.
Stubbing out Matsushita support.
1996-10-03 03:56:20 +00:00
Ian Lance Taylor d7775b4355 * elf.c (assign_file_positions_for_segments): Test SEC_ALLOC
rather than SEC_LOAD when aligning the file offset for the first
	section in a segment.
Fixes the case in which . is set just before the .bss section in a
linker script.
1996-09-11 15:59:34 +00:00
Fred Fish ea3f058549 * syms.c (coff_section_type): Make arg const.
* irix-core.c (irix_core_core_file_p): Remove extraneous extra arg
	to make_bfd_asection().
	* elf-bfd.h (bfd_section_from_phdr): Add prototype.
	* elfcode.h (bfd_section_from_phdr): Remove prototype.
	(_bfd_elf_stringtab_init): Remove prototype.

	* netbsd-core.c (swap_abort): Add prototype.
	* aix386-core.c (swap_abort): Ditto & make static
	* hpux-core.c (swap_abort): Ditto & make static.
	* irix-core.c (swap_abort): Ditto & make static.
	* ptrace-core.c (swap_abort): Ditto & make static.
	* trad-core.c (swap_abort): Ditto & make static.
	* coffswap.h (coff_swap_reloc_in): Ditto.
	(coff_swap_reloc_out): Ditto.
	(coff_swap_filehdr_in): Ditto.
	(coff_swap_filehdr_out): Ditto.
	(coff_swap_sym_in): Ditto.
	(coff_swap_sym_out): Ditto.
	(coff_swap_aux_in): Ditto.
	(coff_swap_aux_out): Ditto.
	(coff_swap_lineno_in): Ditto.
	(coff_swap_lineno_out): Ditto.
	(coff_swap_aouthdr_in): Ditto.
	(coff_swap_aouthdr_out): Ditto.
	(coff_swap_scnhdr_in): Ditto.
	(coff_swap_scnhdr_out): Ditto.
	* ihex.c (ihex_sizeof_headers): Ditto.
	* tekhex.c (getsym): Ditto.
	(find_chunk): Ditto & make static.
	(insert_byte): Ditto.
	(first_phase): Ditto.
	(pass_over): Ditto.
	(tekhex_get_symtab): Ditto & make static.
	(tekhex_get_symtab_upper_bound): Ditto & make static.
	(tekhex_mkobject): Ditto.
	(tekhex_object_p): Ditto.
	(move_section_contents): Ditto.
	(tekhex_get_section_contents): Ditto.
	(tekhex_set_arch_mach): Ditto & make static.
	(tekhex_set_section_contents): Ditto.
	(writevalue): Ditto.
	(writesym): Ditto.
	(out): Ditto.
	(tekhex_write_object_contents): Ditto.
	(tekhex_sizeof_headers): Ditto.
	(tekhex_make_empty_symbol): Ditto.
	(tekhex_get_symbol_info): Ditto.
	(tekhex_print_symbol): Ditto.
	* irix-core.c (make_bfd_asection): Ditto.
	(irix_core_core_file_p): Ditto.
	(irix_core_core_file_failing_command): Ditto.
	(irix_core_core_file_failing_signal): Ditto.
	(irix_core_core_file_matches_executable_p): Ditto.
	(irix_core_make_empty_symbol): Ditto.
	* coff-mips.c (mips_bfd_reloc_type_lookup): Ditto.
	* srec.c (srec_new_symbol): Ditto.
	(srec_get_section_contents): Ditto.
	(srec_set_arch_mach): Ditto.
	(srec_set_section_contents): Ditto.
	(internal_srec_write_object_contents): Ditto.
	(srec_write_object_contents): Ditto.
	(symbolsrec_write_object_contents): Ditto.
	(srec_sizeof_headers): Ditto.
	(srec_make_empty_symbol): Ditto.
	(srec_get_symtab_upper_bound): Ditto.
	(srec_get_symtab): Ditto.
	(srec_print_symbol): Ditto and make static.
	* elf.c (elf_read): Ditto
	(assign_section_numbers): Ditto.
	(elf_fake_sections): Ditto.
	(sym_is_global): Ditto.
	(elf_map_symbols): Ditto.
	(get_program_header_size): Ditto.
	* coffgen.c (make_a_section_from_file): Ditto.
	(coff_real_object_p): Ditto.
	(fixup_symbol_value): Ditto.
	(build_debug_section): Ditto.
	(copy_name): Ditto.
	* syms.c (coff_section_type): Ditto.
1996-09-11 04:25:57 +00:00
David Edelsohn f0c12b7340 * config.bfd,configure.in,configure: Add m32r support.
* Makefile.in,archures.c,elf.c,targets.c: Likewise.
1996-09-09 22:59:40 +00:00
Ian Lance Taylor b944e7e855 * elf.c (_bfd_elf_make_section_from_shdr): For a loadable section,
only get the LMA from the phdr if they are in the same part of the
	file.
1996-08-05 20:45:55 +00:00
Ian Lance Taylor 191d910cb9 * elf.c (map_sections_to_segments): Rewrite tests for starting a
new segment to make them more comprehensible.  If the relationship
	between the LMA and the VMA changed, start a new segment.  Don't
	check dynsec when deciding whether to start a new segment for a
	writeable section; -N will now handle this.
1996-08-05 17:45:58 +00:00
Ian Lance Taylor cdb88e8764 Make ld -N more reasonable for ELF:
* elf.c (map_sections_to_segments): If D_PAGED is not set, set
	phdr_in_section to false, and always use a single load segment.
	(elf_sort_sections): Sort sections by LMA after VMA.
	(assign_file_positions_for_segments): If D_PAGED is not set, don't
	align to maxpagesize.
	(assign_file_positions_except_relocs): Likewise.
	* elfcode.h (elf_object_p): If a section is loaded but not page
	aligned, clear D_PAGED.
1996-07-31 19:58:05 +00:00
Ian Lance Taylor 64f808f92b * elf.c (assign_file_positions_for_segments): Track the virtual
memory position separately from the file position, and use it to
	compute the alignment adjustment.
PR 10039.
1996-07-24 16:05:32 +00:00
Martin Hunt 50bd50d48f start-sanitize-d10v
Wed Jul 17 14:51:52 1996  Martin M. Hunt  <hunt@pizza.cygnus.com>
        * Makefile.in (ALL_MACHINES): Add cpu-d10v.o
        (BFD32_BACKENDS) Add elf32-d10v.o
        * archures.c: Add bfd_d10v_arch.
        * bfd-in2.h: Add bfd_d10v_arch.
        * config.bfd (d10v-*-*): New target.
        * configure: (bfd_elf32_d10v_vec) New vector.
        * configure.in: (bfd_elf32_d10v_vec) New vector.
        * cpu-d10v.c: New file.
        * elf.c (prep_headers): Added case bfd_arch_d10v.
        * elf32-d10v.c: New file.
        * libbfd.h: Rebuild.
        * reloc.c (BFD_RELOC_D10V_10_PCREL_R, BFD_RELOC_D10V_10_PCREL_L, BFD_RELOC_D10V_18,
          BFD_RELOC_D10V_18_PCREL): Define.
        * targets.c (bfd_elf32_d10v_vec): New vector.
end-sanitize-d10v
1996-07-18 00:47:05 +00:00
Ian Lance Taylor 7fc6a16a7f * elf.c (map_sections_to_segments): Fix up the test for -Ttext to
approximate the correct answer if SIZEOF_HEADERS was not used.
1996-06-19 16:30:27 +00:00
Ian Lance Taylor d1bf45aa94 64-bit MIPS ELF ABI objdump support:
* elf64-mips.c: New file.
	* Makefile.in: Rebuild dependencies.
 	(BFD64_BACKENDS): Add elf64-mips.o.
	(BFD64_BACKENDS_CFILES): Add elf64-mips.c.
	* config.bfd (mips*el-*-elf*) Add bfd_elf64_bigmips_vec and
	bfd_elf64_littlemips_vec to targ_selvecs.
	(mips*-*-elf*): Likewise.
	* confingure.in: Add bfd_elf64_bigmips_vec and
	bfd_elf64_littlemips_vec to vector switch.
	* configure: Rebuild.
	* elf32-mips.c (_bfd_mips_elf_section_from_shdr): New function,
	broken out of mips_elf_section_from_shdr.
	(mips_elf32_section_from_shdr): Rename from
	mips_elf_section_from_shdr.  Call new function.
	(elf_backend_section_from_shdr): Update name of renamed function.
	* elf-bfd.h (struct elf_size_info): Change second parameter of
	write_out_phdrs to be const.  Likewise for second parameter of
	swap_symbol_out.
	(struct bfd_elf_section_data): Add rel_hdr2 field.
	(bfd_elf32_swap_symbol_in): Change second parameter to be const.
	(bfd_elf32_swap_symbol_out): Likewise.
	(bfd_elf32_swap_reloc_in): Likewise.
	(bfd_elf32_swap_reloc_out): Likewise.
	(bfd_elf32_swap_reloca_in): Likewise.
	(bfd_elf32_swap_reloca_out): Likewise.
	(bfd_elf32_swap_phdr_in): Likewise.
	(bfd_elf32_swap_phdr_out): Likewise.
	(bfd_elf32_swap_dyn_in): Likewise.
	(bfd_elf32_swap_dyn_out): Likewise.
	(bfd_elf32_slurp_symbol_table): Declare.
	(bfd_elf32_write_shdrs_and_ehdr): Declare.
	(bfd_elf32_write_out_phdrs): Declare.
	(bfd_elf64_swap_symbol_in): Change second parameter to be const.
	(bfd_elf64_swap_symbol_out): Likewise.
	(bfd_elf64_swap_reloc_in): Likewise.
	(bfd_elf64_swap_reloc_out): Likewise.
	(bfd_elf64_swap_reloca_in): Likewise.
	(bfd_elf64_swap_reloca_out): Likewise.
	(bfd_elf64_swap_phdr_in): Likewise.
	(bfd_elf64_swap_phdr_out): Likewise.
	(bfd_elf64_swap_dyn_in): Likewise.
	(bfd_elf64_swap_dyn_out): Likewise.
	(bfd_elf64_slurp_symbol_table): Declare.
	(bfd_elf64_write_shdrs_and_ehdr): Declare.
	(bfd_elf64_write_out_phdrs): Declare.
	(_bfd_mips_elf_section_from_shdr): Declare.
	* elf.c (bfd_section_from_shdr): Remove assertion requiring
	SHT_REL/SHT_RELA to match use_rela_p.  If there is already a reloc
	section for the section, add the new one to rel_hdr2.  Increment
	reloc_count rather than setting it.
	* elfcode.h (elf_slurp_symbol_table): Define name as macro.
	Remove static declaration.
	(elf_write_shdrs_and_ehdr): Define name as macro.
	(elf_write_out_phdrs): Likewise.
	(elf_swap_ehdr_in, elf_swap_ehdr_out): Declare.
	(elf_swap_shdr_in, elf_swap_shdr_out): Declare.
	(elf_swap_symbol_in): Change second parameter to be const.
	(elf_swap_symbol_out): Likewise.
	(elf_swap_ehdr_in, elf_swap_ehdr_out): Likewise.
	(elf_swap_shdr_in, elf_swap_shdr_out): Likewise.
	(elf_swap_phdr_in, elf_swap_phdr_out): Likewise.
	(elf_swap_reloc_in, elf_swap_reloc_out): Likewise.
	(elf_swap_reloca_in, elf_swap_reloca_out): Likewise.
	(elf_write_out_phdrs): Rename from write_out_phdrs.  Change second
	parameter to be const.  Make non-static.
	(elf_write_shdrs_and_ehdr): Rename from write_shdrs_and_ehdr.
	Make non-static.
	(elf_slurp_symbol_table): Make non-static.
	(NAME(_bfd_elf,size_info)): Update names of renamed functions.
	* elfxx-target.h (elf_info_to_howto): Define if not defined.
	(elf_backend_size_info): Likewise.
	(elfNN_bed): Use elf_backend_size_info.
	* targets.c (bfd_elf64_bigmips_vec): Declare.
	(bfd_elf64_littlemips_vec): Declare.
	(bfd_target_vector): Add bfd_elf64_bigmips_vec and
	bfd_elf64_littlemips_vec if BFD64 is defined.
1996-05-29 20:33:00 +00:00
Ian Lance Taylor 19bfbcbecf * elf-bfd.h (struct elf_link_hash_table): Add hgot field.
* elf.c (_bfd_elf_link_hash_table_init): Initialize hgot field.
	* elflink.c (_bfd_elf_create_got_section): Store the
	_GLOBAL_OFFSET_TABLE_ hash table entry in the hgot field.
	* elf32-sparc.c (elf32_sparc_check_relocs): If the size of the
	global offset table goes over 0x1000, set the value of
	_GLOBAL_OFFSET_TABLE_ to 0x1000 into the section.
	(elf32_sparc_relocate_section): Subtract the offset of
	_GLOBAL_OFFSET_TABLE_ when handling GOT relocations.
PR 9323.
1996-04-02 19:57:33 +00:00
Ian Lance Taylor cb84f0284f * elf.c (_bfd_elf_symbol_from_bfd_symbol): Print a useful error
message rather than calling BFD_ASSERT.
	* elfcode.h (write_relocs): Check return value of
	_bfd_elf_symbol_from_bfd_symbol.
1996-03-04 17:50:38 +00:00
Ian Lance Taylor 0960941513 * elf.c (assign_file_positions_for_segments): Adjust the segment
memory size for the alignment of a SEC_ALLOC section, not just a
	SEC_LOAD section.
1996-02-28 16:01:04 +00:00
Ian Lance Taylor 053ae1d77a * elf.c (bfd_elf_set_dt_needed_name): Don't do anything if the
format is not bfd_object.
	(bfd_elf_get_dt_soname): Likewise.
1996-02-24 20:03:55 +00:00
Ian Lance Taylor edf3fe4885 * elf.c (map_sections_to_segments): If we have a .dynamic section,
then start a new segment rather than put a writable section in a
	readonly segment.
1996-02-15 20:27:29 +00:00
Ian Lance Taylor 869b7d80d3 * elf-bfd.h (ELF_LINK_NON_ELF): Define.
* elf.c (_bfd_elf_link_hash_newfunc): Set elf_link_hash_flags to
	ELF_LINK_NON_ELF.
	* elflink.h (elf_link_add_object_symbols): Reset ELF_LINK_NON_ELF
	flag for a newly defined symbol.
	(NAME(bfd_elf,record_link_assignment)): Likewise.
	(elf_adjust_dynamic_symbol): If ELF_LINK_NON_ELF is set, try to
	set the DEF or REF_REGULAR flags correctly.
1996-02-01 23:15:23 +00:00
Ian Lance Taylor 052b35d2e7 Based on patches from Ronald F. Guilmette <rfg@monkeys.com>:
* syms.c (BSF_OBJECT): Define.
	(bfd_print_symbol_vandf): Print 'O' for BSF_OBJECT.
	* bfd-in2.h: Rebuild.
	* elfcode.h (elf_slurp_symbol_table): Set BSF_OBJECT for an
	STT_OBJECT symbol.
	* elf.c (swap_out_syms): Only set type to STT_OBJECT if BSF_OBJECT
	is set.
1996-01-29 22:04:32 +00:00
Ian Lance Taylor 86aac8eabe * syms.c: Include "bfdlink.h".
(struct stab_find_info): Define.
	(_bfd_stab_section_find_nearest_line): New function.
	* libbfd-in.h (_bfd_stab_section_find_nearest_line): Declare.
	* libbfd.h: Rebuild.
	* elf-bfd.h (struct elf_obj_tdata): Add line_info field.
	* elf.c (_bfd_elf_find_nearest_line): Try calling
	_bfd_stab_section_find_nearest_line before searching the ELF
	symbol table.  Find the closest STT_FUNC symbol, not the last one.
	* libcoff-in.h (coff_data_type): Add line_info field.
	* libcoff.h: Rebuild.
	* coffgen.c (coff_find_nearest_line): Try calling
	_bfd_stab_section_find_nearest_line before searching the COFF
	symbol table.
	* Makefile.in: Rebuild dependencies.
1996-01-26 23:42:58 +00:00
Ian Lance Taylor d49ddb8575 * elf.c (assign_file_positions_for_segments): Don't increment file
offset for a segment which contains no loadable sections.
1996-01-16 20:53:04 +00:00
Ian Lance Taylor 6014cea70c update copyrights 1996-01-15 21:06:31 +00:00
Ian Lance Taylor 14899eb7f2 * elf.c (assign_file_positions_for_segments): If a segment
contains no sections, don't mark it as readable.
1996-01-12 22:47:04 +00:00
Ian Lance Taylor 927d05b5a3 tweak last change 1996-01-12 20:46:22 +00:00
Ian Lance Taylor 02fcd12620 * elf.c (_bfd_elf_print_private_bfd_data): Dump contents of
dynamic section, if there is one.
	* elf-bfd.h (struct elf_size_info): Add swap_dyn_in field.
	(bfd_elf32_swap_dyn_in): Change type of second parameter to PTR.
	(bfd_elf64_swap_dyn_in): Likewise.
	* elfcode.h (elf_swap_dyn_in): Change type of second parameter to
	PTR.
	(NAME(_bfd_elf,size_info)): Initialize swap_dyn_in field.
1996-01-12 19:13:49 +00:00
Ian Lance Taylor 5b3b9ff61d * elf32-mips.c: Extensive changes for a start at dynamic linking
support, from Kazumoto Kojima <kkojima@info.kanagawa-u.ac.jp>.

	* 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.
1996-01-11 21:06:42 +00:00
Ken Raeburn 86587dd4ca * elf.c (copy_private_bfd_data): When attaching sections to segments ignore
sections that won't be allocated.  Patch from Andreas Schwab.
1995-12-21 00:41:20 +00:00
Ian Lance Taylor 3b95078004 * elf.c (assign_file_positions_for_segments): Sort the sections in
each segment.
	(get_program_header_size): Return the right size if segment_map is
	not NULL.
	(copy_private_bfd_data): Don't bother to sort the sections.
1995-12-01 21:44:38 +00:00
Ian Lance Taylor 58142f101d * libbfd.c (bfd_malloc, bfd_realloc): New functions.
(bfd_zmalloc): Return PTR, not char *.  Take size_t, not
	bfd_size_type.
	* libbfd-in.h (bfd_malloc, bfd_realloc): Declare.
	(bfd_zmalloc): Change declaration.
	* libbfd.h: Rebuild.
	* Many files: Use bfd_malloc and bfd_realloc rather than malloc
	and realloc.  Don't set bfd_error_no_memory if they fail.
1995-12-01 19:48:10 +00:00
Ian Lance Taylor 6933148af0 * elf.c (_bfd_elf_make_section_from_shdr): Don't set lma based on
p_paddr if p_paddr is zero.
	(make_mapping): Set includes_filehdr and includes_phdrs for first
	PT_LOAD segment.
	(map_sections_to_segments): Set includes_phdrs for PT_PHDR
	segment.
	(assign_file_positions_for_segments): Handle includes_filehdr and
	includes_phdrs.  Remove special handling of PT_PHDR and first
	PT_LOAD segments.
	(copy_private_bfd_data): Set includes_filehdr and includes_phdr
	when appropriate.  Remove special handling of PT_PHDR segment.
	Use a more complex condition for when a section is included in a
	segment to handle Solaris linker oddities.
1995-11-30 22:15:13 +00:00
Ian Lance Taylor a9713b91a7 * opncls.c (bfd_alloc_by_size_t): Set bfd_error_no_memory if
obstack_alloc fails.
	(bfd_alloc_finish): Set bfd_error_no_memory if obstack_finish
	fails.
	* libbfd.c (bfd_zmalloc): Set bfd_error_no_memory if malloc fails.
	* Many files: don't set bfd_error_no_memory if one of the above
	routines fails.
1995-11-29 22:05:37 +00:00
Ian Lance Taylor 3dbf33eeb4 * elf.c (assign_file_positions_for_segments): Don't adjust p_paddr
if p_paddr_valid is set.
	(copy_private_bfd_data): New static function.
	(_bfd_elf_copy_private_section_data): Call copy_private_bfd_data.
1995-11-29 20:04:17 +00:00
Ian Lance Taylor 44ef8897da * elf.c (assign_file_positions_for_segments): Fix case where extra
program headers were allocated.
1995-11-29 19:14:33 +00:00
Ian Lance Taylor 27fb8f2933 * elf.c (_bfd_elf_print_private_bfd_data): New function.
* elf-bfd.h (_bfd_elf_print_private_bfd_data): Declare.
	* elfxx-target.h (bfd_elfNN_bfd_print_private_bfd_data): Define to
	_bfd_elf_print_private_bfd_data.
1995-11-29 18:46:07 +00:00
Ian Lance Taylor fd0198f023 * elf-bfd.h (struct elf_obj_tdata): Add segment_map field.
* elf.c (make_mapping): New static function.
	(map_sections_to_segments): New static function.
	(elf_sort_sections): New static function.
	(assign_file_positions_for_segments): New static function.
	(map_program_segments): Remove.
	(get_program_header_size): Remove sorted_hdrs, count, and
	maxpagesize parameters.  Simplify.
	(assign_file_positions_except_relocs): When generating an
	executable, use assign_file_positions_for_segments.
	(elf_sort_hdrs): Remove.
	(_bfd_elf_sizeof_headers): Remove eliminated parameters from call
	to get_program_header_size.
1995-11-28 22:02:13 +00:00
Ian Lance Taylor b2193cc594 * elf.c (bfd_elf_set_dt_needed_name): Don't do anything if the
BFD is not of the right type.
	(bfd_elf_get_needed_list): Likewise.
	* i386linux.c (bfd_linux_size_dynamic_sections): Likewise.
	* sunos.c (bfd_sunos_get_needed_list): Likewise.
	* xcofflink.c (XCOFF_XVECP): Define.
	(bfd_xcoff_link_record_set): Don't do anything if the BFD is not
	of the right type.
	(bfd_xcoff_import_symbol): Likewise.
	(bfd_xcoff_export_symbol): Likewise.
	(bfd_xcoff_link_count_reloc): Likewise.
	(bfd_xcoff_record_link_assignment): Likewise.
	(bfd_xcoff_size_dynamic_sections): Likewise.
1995-11-01 18:25:35 +00:00
Fred Fish 6ab826bd98 * libelf.h: Rename to elf-bfd.h to avoid conflict with
systems that have a system <libelf.h>.
	* Makefile.in: Globally replace libelf.h with elf-bfd.h.
	* bfd.c, elf.c, elf32-arc.c, elf32-gen.c, elf32-hppa.c,
	elf32-hppa.h, elf32-i386.c, elf32-i860.c, elf32-m68k.c,
	elf32-m88k.c, elf32-mips.c, elf32-ppc.c, elf32-sparc.c,
	elf64-gen.c, elf64-sparc.c, elfcode.h, elflink.c,
	elfxx-target.h: Include elf-bfd.h rather than libelf.h.
	* elfxx-target.h: Change libelf.h reference to elf-bfd.h.
1995-10-31 23:29:05 +00:00