Commit Graph

36 Commits

Author SHA1 Message Date
Ian Lance Taylor b6eb341bf8 Mon Jun 16 18:56:27 1997 Geoff Keating <geoffk@ozemail.com.au>
* elf32-ppc.c (ppc_elf_relocate_section): Don't emit R_PPC_REL*
 	relocs in shared libraries which refer to local symbols.  Cope
 	with addend when processing a GOT relocation.

	* elf32-ppc.c (ppc_elf_size_dynamic_sections): Only create symbols
	for sections that the linker didn't create.
	(ppc_elf_finish_dynamic_sections): Only try to write out a section
 	symbol if it was created in ppc_elf_size_dynamic_sections.
	(ppc_elf_relocate_section): Complain if we have to generate a reloc
	relative to a section for which we didn't output a symbol.

	* elf32-ppc.c (ppc_elf_size_dynamic_sections): Clean up.  PLT
 	relocs are 'rela' relocs, like everything else.  .rela.plt is not
 	a read-only section, so we don't have to special-case it.

	* elf32-ppc.c (ppc_elf_adjust_dynamic_symbol): Entries in the
	.rela.bss section are (of course) 'rela' relocs not 'rel' relocs.

	* elf32-ppc.c (ppc_elf_check_relocs): Initialise srelgot.
	(ppc_elf_relocate_section): @got offsets are 4 from start of the
	actual .got section.
	* elflink.c (_bfd_elf_create_got_section): The three reserved
	words start from the symbol '_GLOBAL_OFFSET_TABLE_'.

	* elf32-ppc.c (ppc_elf_size_dynamic_sections): '.rela' is 5
	characters, not 4.

	* elf32-ppc.c (ppc_elf_check_relocs): Use
	_bfd_elf_create_got_section to create the GOT rather than
	ppc_elf_create_linker_section. Create the '.rela.got' section
	ourselves.
	(ppc_elf_finish_dynamic_symbol): Set up GOT relocations when a
	symbol has a GOT entry.
	(ppc_elf_relocate_section): Record when a symbol is used through
	the GOT, and allocate space in the GOT for each such symbol.
	(ppc_elf_adjust_dynamic_symbol): Delete unused .got.plt stuff.
	(ppc_elf_create_linker_section): Delete unused LINKER_SECTION_GOT
	stuff.

	* elf32-ppc.c (ppc_elf_howto_raw): GOT16_HA relocs should be
	treated in a similar way to ADDR16_HA relocs.
	(ppc_elf_relocate_section): PLTREL24 relocs do not get copied into
	shared objects; the linker must deal with them.
	(ppc_elf_create_linker_section): Stop setting
	_GLOBAL_OFFSET_TABLE_ to the wrong value; delete unused
	LINKER_SECTION_PLT stuff.
	(ppc_elf_check_relocs): Delete unused LINKER_SECTION_PLT stuff.
	(ppc_elf_finish_dynamic_sections): Use BFD calls to get GOT
	section, not ELF-specific calls.
	(elf_backend_plt_not_loaded): Set to 1.
	(elf_backend_got_symbol_offset): Set to 4.
	* elf-bfd.h (elf_backend_data): Add 'plt_not_loaded' member
	for when ld.so fills in the PLT; and 'got_symbol_offset' member.
	* elflink.c (_bfd_elf_create_dynamic_sections): Apply
	plt_not_loaded member.
	(_bfd_elf_create_got_section): Apply got_symbol_offset.
	* elfxx-target.h (elf_backend_plt_not_loaded): Set default to
	'loaded'.
	(elf_backend_G_O_T_offset): Set default to 0.
	(elfNN_bed): Set added fields.

	* elf32-ppc.c (ppc_elf_size_dynamic_sections): Was setting
	DT_RELENT in shared objects; should be DT_RELAENT.

	* elf32-ppc.c (ppc_elf_relocate_section): Propagate
	R_PPC_ADDR16_HA relocs to shared objects. Cope with case where
	such a reloc (in a non-shared object) refers to a symbol that's
	not defined.
1997-06-16 23:05:27 +00:00
Michael Meissner acba322ed2 Undo part of 3/26 change and always create got section 1997-04-02 21:22:19 +00:00
Ian Lance Taylor 6717fb0de0 * stabs.c (_bfd_stab_section_offset): New function.
* libbfd-in.h (_bfd_stab_section_offset): Declare.
	* libbfd.h: Rebuild.
	* elf32-i386.c (elf_i386_relocate_section): Adjust the offset of a
	stab reloc.
	* elf32-m68k.c (elf_m68k_relocate_section): Likewise.
	* elf32-mips.c (mips_elf_relocate_section): Likewise.
	* elf32-ppc.c (ppc_elf_relocate_section): Likewise.
	* elf32-sparc.c (elf32_sparc_relocate_section): Likewise.
	* elf64-alpha.c (elf64_alpha_relocate_section): Likewise.
1997-03-25 20:49:31 +00:00
Ian Lance Taylor 9950f925f7 * elf32-i386.c (elf_i386_size_dynamic_sections): When checking for
relocations against the text segment, look up the output name of
	the reloc section.
	* elf32-m68k.c (elf_m68k_size_dynamic_sections): Likewise.
	* elf32-mips.c (mips_elf_size_dynamic_sections): Likewise.
	* elf32-ppc.c (ppc_elf_size_dynamic_sections): Likewise.
	* elf32-sparc.c (elf32_sparc_size_dynamic_sections): Likewise.
	* elf64-alpha.c (elf64_alpha_size_dynamic_sections): Likewise.
1997-01-27 18:13:01 +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
Michael Meissner e7bab9df0f Support R_PPC_PLTREL24 1996-12-12 20:08:54 +00:00
Ian Lance Taylor dab4573409 * elf32-ppc.c (ppc_elf_howto_raw): For R_PPC_ADDR16_HA, use
ppc_elf_addr16_ha_reloc.
	(ppc_elf_addr16_ha_reloc): New static function.
PR 10036.
1996-07-08 21:38:59 +00:00
Michael Meissner 0293d5b019 Do not put small common symbols into .sbss if ld -r 1996-05-24 18:30:52 +00:00
Michael Meissner e25a798839 Forward relocs to output if -Bshared 1996-04-26 16:36:14 +00:00
Michael Meissner 3f7ca26b1c Add support for linking against shared libraries 1996-04-25 18:24:05 +00:00
Ian Lance Taylor cf5138e388 * elf32-hppa.c (elf32_hppa_relocate_section): Handle indirect and
warning symbols correctly.
	* elf32-i386.c (elf_i386_relocate_section): Likewise.
	* elf32-m68k.c (elf_m68k_relocate_section): Likewise.
	* elf32-mips.c (mips_elf_relocate_section): Likewise.
	* elf32-ppc.c (ppc_elf_relocate_section): Likewise.
	* elf32-sparc.c (elf32_sparc_relocate_section): Likewise.
	* elf64-sparc.c (sparc64_elf_relocate_section): Likewise.
1996-01-30 18:18:17 +00:00
Michael Meissner c1e65e244c Make eabi error messages include symbol name if it is an external symbol 1996-01-25 22:35:51 +00:00
Michael Meissner eb82bc605f Add more eabi relocations 1996-01-25 17:15:24 +00:00
Michael Meissner 9d621c7d32 Fix typo in eabl relocations 1996-01-25 01:46:57 +00:00
Michael Meissner d8fd85ada3 Implement R_PPC_EMB_{SDA21,RELSDA} relocations 1996-01-23 20:11:13 +00:00
Michael Meissner 3cbe19d280 Do not complain if some objects have the embedded bit set and others do not. 1996-01-23 19:35:11 +00:00
Michael Meissner 05f927dd46 Make 64k .sdata and .sdata2 sections work; fix typos 1996-01-22 23:55:25 +00:00
Michael Meissner e37a16442a Fix typo in last change 1996-01-22 20:10:51 +00:00
Michael Meissner 3b3753b874 snapshot of eabi relocation support. 1996-01-22 16:43:35 +00:00
Michael Meissner 4500a1128e Add new PPC relocations 1996-01-15 22:50:07 +00:00
Michael Meissner bd2d10c006 Redo unknown reloc support. Do not allow symbols in .sdata/.sbss to satify a TOC16 relocation. Begin support R_PPC_SDA{2,}REL relocation. 1996-01-15 02:41:58 +00:00
Michael Meissner 1c3a295b13 Warn about relocations we do not yet support 1996-01-13 14:40:50 +00:00
Michael Meissner 57081126b6 Add PowerPC support for SHF_EXCLUDE, SHT_ORDERED 1996-01-12 20:31:05 +00:00
Michael Meissner 71897943c4 update copyright 1996-01-11 22:50:52 +00:00
Michael Meissner 83f4323e5a Add support for SHT_ORDERED and SHF_EXCLUDE 1996-01-11 22:47:04 +00:00
Ian Lance Taylor 761f377fec * elf-bfd.h (struct bfd_elf_section_data): Add tdata field.
(struct elf_obj_tdata): Rename ppc_flags_init field to flags_init.
	(elf_flags_init): Rename from elf_ppc_flags_init.
	* elf32-ppc.c (ppc_elf_set_private_flags): Use elf_flags_init, not
	elf_ppc_flags_init.
	(ppc_elf_copy_private_bfd_data): Likewise.
	(ppc_elf_merge_private_bfd_data): Likewise.
1996-01-11 16:27:24 +00:00
Michael Meissner 07a159dbd4 Make @GOT relocations work 1996-01-04 00:44:32 +00:00
Michael Meissner 08556813ed Work in progress to add real GOT support 1995-12-21 17:50:22 +00:00
Ian Lance Taylor 7a7fbffb25 * aout-adobe.c (aout_adobe_callback): Use _bfd_error_handler
rather than a direct fprintf.
	* archive.c (_bfd_write_archive_contents): Likewise.
	* coffcode.h (coff_slurp_symbol_table): Likewise.
	* elf32-ppc.c (ppc_elf_merge_private_bfd_data): Likewise.
	(ppc_elf_unsupported_reloc): Likewise.
	(ppc_elf_relocate_section): Likewise.
	* i386linux.c (linux_tally_symbols): Likewise.
	(linux_finish_dynamic_link): Likewise.
	* osf-core.c (osf_core_core_file_p): Likewise.
	* rs6000-core.c (rs6000coff_get_section_contents): Likewise.
	* som.c (som_sizeof_headers): Likewise.
	* srec.c (srec_bad_byte): Likewise.
	* bfd.c (bfd_assert): Likewise.  Also change file to be const.
	* libbfd-in.h (bfd_assert): Declare first parameter const.
	* libbfd.h: Rebuild.
	* coff-a29k.c (a29k_reloc): Don't bother to fprintf; returning
	bfd_reloc_overflow is enough.
	* coff-h8300.c (rtype2howto): Don't bother to fprintf; just abort.
	* coff-h8500.c (rtype2howto): Likewise.
	* coff-z8k.c (rtype2howto): Likewise.
	* coffcode.h (dummy_reloc16_extra_cases): Likewise.
	* elf.c (_bfd_elf_get_lineno): Likewise.
	(_bfd_elf_no_info_to_howto): Likewise.
	(_bfd_elf_no_info_to_howto_rel): Likewise.
	* hp300hpux.c (convert_sym_type): Likewise.
	(MY(swap_std_reloc_in)): Likewise.
	* elf.c (bfd_section_from_shdr): Remove #if 0 sections.
1995-09-25 21:31:29 +00:00
Michael Meissner cc47d19a93 Fix previous change 1995-09-25 20:07:26 +00:00
Michael Meissner 02f85cda33 Start work to all full PowerPC V.4 reloc support. 1995-09-22 20:30:18 +00:00
Michael Meissner 08eb30b625 minor cleanup 1995-09-22 02:37:04 +00:00
Michael Meissner a71ac3f916 minor cleanup 1995-09-22 02:33:41 +00:00
Michael Meissner dd82c578be Add support -mrelocatable-lib 1995-09-22 02:30:57 +00:00
Ken Raeburn ede4eed483 Added new files elflink.c, elflink.h, elfcore.h.
Moved some mostly size-independent stuff from elfcode.h to elf.c, adding a data
structure to elfcode.h with some misc data and callback functions.  Added a
pointer to that structure to the target back end data.  More work can be done
here.

Renamed generic elf routines (not cpu-specific stuff) to start with bfd_elf or
_bfd_elf.  Updated most call sites, sometimes defined some macros.

Moved some dynamic linking support code from m68k, sparc, i386 to common files,
using target back end flags to control behavior.  More work can probably be
done here too.

Moved core- and linker-support code out of elfcode.h to elf.c, elfcore.h,
elflink.h, or elflink.c.  Now elfcode.h contains only .o and executable
support, plus #includes of elfcore.h and elflink.h.  Much of the contents of
these other header files can probably still be moved from the .h files to the
.c files, to get compiled only once.

Cleaned up some "gcc -Wall" warnings regarding unused or uninitialized
variables, in generic and cpu-specific code.
1995-07-06 02:22:00 +00:00
Michael Meissner bcbe2c719c Fix powerpc PC relative reloc & add some 16 bit relocs. 1995-02-15 19:57:56 +00:00