Commit Graph

2556 Commits

Author SHA1 Message Date
Alan Modra 7619e7c7de * elf32-ppc.h: New file.
* elf32-ppc.c: Include elf32-ppc.h.
	(NOP, CROR_151515, CROR_313131, TP_OFFSET, DTP_OFFSET): Define.
	(struct ppc_elf_link_hash_entry): Rename "root" to "elf".  Adjust uses.
	Add "tls_mask" field.
	(TLS_GD, TLS_LD, TLS_TPREL, TLS_DTPREL, TLS_TLS, TLS_TPRELGD): Define.
	(struct ppc_elf_link_hash_table): Rename "root" to "elf".  Adjust uses.
	Add got, relgot, plt, relplt, dynbss, relbss, dynsbss, relsbss,
	sdata, sdata2, tls_sec, tls_get_addr, tlsld_got fields.
	Make use of htab shortcuts throughout file.
	(ppc_elf_link_hash_newfunc): Init tls_mask field.
	(ppc_elf_link_hash_table_create): Init new fields.
	(ppc_elf_copy_indirect_symbol): Copy tls_mask.
	(ppc_elf_howto_raw): Add tls relocs.
	(ppc_elf_reloc_type_lookup): Handle them.
	(ppc_elf_unhandled_reloc): New function.
	(ppc_elf_create_got): Stash got section pointer in hash table,
	return status.  Make .rela.got too.
	(ppc_elf_create_dynamic_sections): Stash section pointers in htab.
	(ppc_elf_adjust_dynamic_symbol): Only set up copy relocs when
	NON_GOT_REF set.  Don't allocate space in .plt here..
	(allocate_dynrelocs): ..do so here instead, properly ref-counting and
	not allocating plt entries unnecessarily.  Allocate got entries here.
	(WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define.
	(ppc_elf_size_dynamic_sections): Allocate local got entries.  Pass
	"info" during allocate_dynrelocs hash traversal.  Use htab section
	shortcuts rather than searching for named sections.  Get rid of
	"plt" and "strip" booleans.
	(update_local_sym_info, bad_shared_reloc): New functions.
	(ppc_elf_check_relocs): Handle TLS relocs.  Move .rela.got creation to
	ppc_elf_create_got.  Don't mark got or plt reloc syms dynamic, do so
	in allocate_dynreloc.  Use update_local_sym_info and bad_shared_reloc.
	Disallow R_PPC_EMB_RELSDA, R_PPC_EMB_NADDR32, R_PPC_EMB_NADDR16,
	R_PPC_EMB_NADDR16_LO, R_PPC_EMB_NADDR16_HI and R_PPC_EMB_NADDR16_HA
	in shared libs.  R_PPC_PLTREL32 is a plt reloc too.  Refcount all
	relocs that might use a plt entry.  Set NON_GOT_REF too.
	Enumerate all do-nothing relocs.
	(ppc_elf_gc_sweep_hook): Simplify removal of dynrelocs.  Handle
	tls relocs and all plt relocs.
	(ppc_elf_tls_setup, ppc_elf_tls_optimize): New functions.
	(ppc_elf_finish_dynamic_symbol): Don't build got entries here.
	(ppc_elf_finish_dynamic_sections): Rewrite tag code using htab
	shortcuts.
	(ppc_elf_relocate_section): Tidy.  Handle TLS relocs.  Use
	bfd_elf_local_sym_name.  Simplify unresolved reloc code.  Build got
	entries and got relocs here.  Warn on non-zero got reloc addend.
	Split out branch taken/not taken reloc code into a separate switch
	and correct offset calculation. Allow BRTAKEN/BRNTAKEN dynamic relocs.
	Split out HA reloc adjustments to separate switch statement.  Don't
	warn on reloc overflow if we've already warned about undefined.
	Don't rebuild sym name when reporting errors.  Report all possible
	errors from _bfd_final_link_relocate.
	(bfd_elf32_bfd_final_link): Don't define.
2003-02-18 06:06:17 +00:00
Alan Modra b5503a6c69 daily update 2003-02-17 23:00:05 +00:00
Alan Modra cd27b2768b * elf64-ppc.c (ppc64_elf_relocate_section): Don't init "r". Don't
rebuild sym name when reporting errors.
2003-02-17 22:57:54 +00:00
Nick Clifton ae9a127f86 Fix the behaviour of --allow-shlib-undefined, so that it does what it claims
to do.  Add an inverse switch.  Update the documentation.
2003-02-17 18:24:40 +00:00
Nick Clifton b5f852ea83 SEGMENT_OVERLAPS: Check that LMAs overlap as well. 2003-02-17 18:13:18 +00:00
Alan Modra da97039a7c daily update 2003-02-15 23:00:06 +00:00
Alan Modra 2b9583905d daily update 2003-02-14 23:00:05 +00:00
Nick Clifton ed781d5d99 Change embedded documentation to use consistent indentation and to split up
long lines.  Change informal style of description for functions lacking real
documentation.
2003-02-14 11:16:09 +00:00
Nick Clifton 21efdc8d7c (_bfd_stab_section_find_nearest_line): For line number stabs outside of
functions, treat values as absolute addresses.
2003-02-14 09:31:57 +00:00
Nick Clifton 3193e2343c (elf_core_file_p): Compare alternate machine codes for ELF backends when
checking if the generic ELF target should be used.
2003-02-14 09:21:21 +00:00
Alan Modra 58ac9f718e * elf64-ppc.c (ppc64_elf_link_hash_table_create): Init tls_get_addr.
(ppc64_elf_copy_indirect_symbol): Merge tls_mask too.
	(ppc64_elf_gc_sweep_hook): Simplify removal of dyn_relocs.
	(allocate_dynrelocs): Don't treat undefined and undefweak specially.
	(ppc_size_one_stub): Fix warning, and tighten plt entry check.
	(group_sections): Don't share a stub section if stubs are for a large
	section.  Adjust comment.
	(ppc64_elf_size_stubs): Roughly double the size left for stubs if
	!stubs_always_before_branch.
	(ppc64_elf_relocate_section): Initialize tlsld GOT entry once.  Don't
	treat undefined and undefweak specially when processing dyn relocs.
2003-02-13 23:48:31 +00:00
Alan Modra 224ec17a5e daily update 2003-02-13 23:00:06 +00:00
Jakub Jelinek 9147e853bf bfd/
* elflink.h (elf_link_add_object_symbols): Handle .symver x, x@FOO.
ld/testsuite/
	* ld-shared/shared.exp: Run on s390*-*-linux* and x86_64-*-linux* too.
	xfail tests linking non-pic code into shared libs on x86_64-*-linux*.
	* ld-elfvsb/elfvsb.exp: Likewise.
	* ld-elfvers/vers.exp: Likewise.  Add vers24a, vers24b and vers24c
	tests.
	* ld-elfvers/vers3.ver: Allow VERS_2.0 to come before GLIBC_*
	version.
	* ld-elfvers/vers19.ver: Likewise.
	* ld-elfvers/vers24a.c: New test.
	* ld-elfvers/vers24b.c: New test.
	* ld-elfvers/vers24c.c: New test.
	* ld-elfvers/vers24.map: New test.
	* ld-elfvers/vers24.rd: New test.
	* lib/ld-lib.exp (run_ld_link_tests): Add optional 7th argument
	cflags.  If source files have .c extension, compile them first.
2003-02-13 22:14:11 +00:00
Nick Clifton 427bfd905d (elf32_thumb_to_arm_stub): Include section VMAs in computation of offset to
insert into BL instruction.
2003-02-13 19:35:22 +00:00
Nick Clifton 53954f5e85 Documenation formatting improvements.
Move Gnu Free Documenation License to a seperate file.
2003-02-13 11:26:41 +00:00
Alan Modra 5b54723e51 daily update 2003-02-12 23:00:05 +00:00
Alan Modra 44aa9df053 daily update 2003-02-11 23:00:05 +00:00
Nick Clifton 42b5d0eaa9 Add support for configuring *-*-kaos targets. 2003-02-11 13:47:08 +00:00
Alan Modra a48ebf4d62 * elf64-ppc.c (ppc64_elf_check_relocs): Match versioned
.__tls_get_addr too.
	(ppc64_elf_tls_setup): Ensure cached tls_get_addr is not indirect.
2003-02-11 03:02:46 +00:00
Alan Modra 4c188e4954 daily update 2003-02-10 23:00:05 +00:00
Kaz Kojima c95b8a7ace * elf32-sh.c (elf_sh_dyn_relocs): Add tls_tpoff32 field.
(elf_sh_link_hash_entry): Remove tls_tpoff32 field.
	(sh_elf_link_hash_newfunc): Remove the initialization of
	tls_tpoff32 field.
	(allocate_dynrelocs): Keep dyn_relocs if it includes the entry
	for which tls_tpoff32 flag is set.
	(sh_elf_relocate_section): Covert to LE only if the dyn_relocs
	of the symbol includes the entry matched with the input_section
	and having tls_tpoff32 flag on.	 When linking statically, set
	symbol index of R_SH_TLS_TPOFF32 relocation to zero if the symbol
	is defined in this executable.
	(sh_elf_check_relocs): Set tls_tpoff32 flag appropriately.
2003-02-10 22:17:18 +00:00
Jakub Jelinek a779acda15 * elf32-s390.c (elf_s390_size_dynamic_sections): Set relocs to TRUE
even if there is just non-empty .rela.plt.
2003-02-10 13:22:12 +00:00
Nick Clifton c178919ba9 Add function to set machine number based on flags in header. 2003-02-10 11:21:19 +00:00
Nick Clifton fde78edd7a Add support for marking ARM ELF binaries as support the Cirrus EP9312 Maverick
floating point co-processor.
2003-02-10 10:44:48 +00:00
Alan Modra e7b938ca5f * elf64-ppc.c: Rename assorted occurrences of tls_type and similar
variables, structure fields or function params to tls_mask or
	similar to better reflect usage.
	(struct got_entry): Comment.
	(struct ppc_link_hash_entry):  Expand comment, and renumber TLS_*.
	(get_tls_mask): Rename from get_tls_type.
2003-02-09 23:17:57 +00:00
Alan Modra 2d4c37e9e1 daily update 2003-02-09 23:00:15 +00:00
Alan Modra 951fd09be7 * elf64-ppc.c (TLS_GD_LD): Don't define..
(TLS_GD): ..define this instead and update all uses.
	(TLS_TPRELGD): Define.
	(ppc64_elf_link_hash_table_create): Tweak initialization of
	init_refcount and init_offset.
	(ppc64_elf_check_relocs): Add one extra element to t_symndx array.
	Mark second slot of GD or LD toc entries.
	(get_tls_type): Return an int.  Distinguish toc GD and LD entries
	from other tls types.
	(ppc64_elf_tls_setup): New function, split out from..
	(ppc64_elf_tls_optimize): ..here.  Don't optimize when symbols are
	defined in a dynamic object.  Fix LD optimization.  Don't set TLS_TPREL
	on GD->IE optimization, use TLS_TPRELGD instead.  Use get_tls_type
	return value to properly decide whether toc GD and LD entries can
	optimize away __tls_get_addr call.  Check next reloc after DTPMOD64
	to determine GD or LD rather than looking at TLS_LD flag.  Don't
	attempt to adjust got entry tls_type here..
	(allocate_dynrelocs): ..instead, adjust got entry tls_type here, and
	look for possible merges.
	(ppc64_elf_size_dynamic_sections): Adjust local got entries for
	optimization.
	(ppc64_elf_size_stubs): Tweak __tls_get_addr fudge.
	(ppc64_elf_relocate_section): Rename some vars to better reflect usage.
	Make use of return value from get_tls_type to properly detect GD and
	LD optimizations.  Split tlsld/gd hi/ha from lo/ds case.  Don't
	handle tls_get_addr removal when looking at REL24 relocs, do it when
	looking at the previous reloc.  Check reloc after DTPMOD64 to determine
	GD or LD.
	* elf64-ppc.h (ppc64_elf_tls_setup): Declare.
2003-02-09 04:36:23 +00:00
Alan Modra 6538ad7304 daily update 2003-02-08 23:00:06 +00:00
Alan Modra 00b28bb047 * elf32-hppa.c (group_sections): Don't share a stub section if
stubs are for a large section.
2003-02-08 08:18:41 +00:00
Alan Modra acc990f282 * elf32-hppa.c (elf32_hppa_size_stubs): Double the size left for
stubs if !stubs_always_before_branch.
2003-02-08 01:10:30 +00:00
Alan Modra c3eba5102a daily update 2003-02-07 23:00:04 +00:00
Nick Clifton 589e6347e9 Generate an error message if a section cannot be found for a symbol. 2003-02-07 14:27:59 +00:00
Jakub Jelinek c328dc3fe7 * elf64-alpha.c (elf64_alpha_relax_section): Don't crash if
local_got_entries is NULL.
2003-02-07 09:30:33 +00:00
Andreas Schwab 84f97cb641 * elf-eh-frame.c (get_DW_EH_PE_signed): Define.
(read_value): Add parameter is_signed, use signed extraction if
	the value is signed.
	(_bfd_elf_write_section_eh_frame): Pass signed flag of the
	encoding to read_value.
2003-02-06 23:01:04 +00:00
Alan Modra 9e1d9e8d68 daily update 2003-02-06 23:00:06 +00:00
Alan Modra ca44d00ab9 daily update 2003-02-05 23:00:04 +00:00
Alan Modra 6349e62823 * elf64-ppc.c (ppc64_elf_copy_indirect_symbol): Don't copy got and
plt info when called to transfer weak sym info.
2003-02-05 15:49:04 +00:00
Alan Modra abc0de032a daily update 2003-02-04 23:00:05 +00:00
Alan Modra 411e1bfb66 * reloc.c: Add PPC and PPC64 TLS relocs.
* libbfd.h: Regenerate.
	* bfd-in2.h: Regenerate.
	* elf64-ppc.c (TP_OFFSET, DTP_OFFSET): Declare.
	(ppc64_elf_howto_raw): Add TLS howto's.  Adjust R_PPC64_NONE to be
	against a 32 bit field.
	(ppc64_elf_reloc_type_lookup): Handle TLS relocs.
	(_ppc64_elf_section_data): Add t_symndx and comments.
	(ppc64_elf_section_data): Use elf_section_data macro.
	(ppc64_elf_new_section_hook): American spelling.
	(struct got_entry, struct plt_entry): New.
	(MUST_BE_DYN_RELOC): Rename from IS_ABSOLUTE_RELOC.
	(struct ppc_stub_hash_entry): Add "addend" field.
	(struct ppc_link_hash_entry): Add "tls_type".
	(TLS_TLS, TLS_GD_LD, TLS_LD, TLS_TPREL, TLS_DTPREL,
	TLS_EXPLICIT): Define.
	(struct ppc_link_hash_table): Add tls_sec, tls_get_addr, tlsld_got.
	(link_hash_newfunc): Init new fields.
	(ppc64_elf_link_hash_table_create): Likewise.  Set init_relcount and
	init_offset to NULL.
	(ppc64_elf_copy_indirect_symbol): Copy got and plt info.  Don't call
	_bfd_elf_link_hash_copy_indirect, rather insert relevant code from
	there.
	(update_local_sym_info, update_plt_info): New functions.
	(ppc64_elf_check_relocs): Use them.  Handle TLS relocs.  Adjust GOT
	handling to use got.glist rather than got.refcount.  Likewise for PLT.
	(ppc64_elf_gc_sweep_hook): Handle TLS relocs, new GOT and PLT lists.
	(func_desc_adjust): Adjust for new PLT list.
	(ppc64_elf_adjust_dynamic_symbol): Likewise.
	(get_sym_h, get_tls_type): New functions.
	(ppc64_elf_edit_opd): Remove unused variable.  Use get_sym_h.
	(ppc64_elf_tls_optimize): New function.
	(allocate_dynrelocs): Adjust for new PLT and GOT lists.  Allocate
	TLS relocs.
	(ppc64_elf_size_dynamic_sections): Likewise.
	(ppc_type_of_stub): Adjust for new PLT list.
	(ppc_build_one_stub): Likewise.
	(ppc64_elf_size_stubs): Likewise.  Use get_sym_h.  Treat __tls_get_addr
	calls specially.
	(ppc64_elf_relocate_section): Adjust for new GOT and PLT lists.  Handle
	TLS relocs.  Report local syms using bfd_elf_local_sym_name.  Don't
	init GOT entries that have a reloc.  Generate GOT relocs here..
	(ppc64_elf_finish_dynamic_symbol): ..not here.  Adjust for PLT list.
	* elf64-ppc.h (ppc64_elf_tls_optimize): Declare.
2003-02-04 14:50:50 +00:00
Andreas Schwab 0cca5f05a9 * elf32-m68k.c (elf_m68k_hash_entry): Define.
(elf_m68k_link_hash_traverse): Remove.
	(elf_m68k_link_hash_newfunc): Use struct bfd_hash_entry and
	elf_m68k_hash_entry instead of struct elf_m68k_link_hash_entry to
	reduce casting.
	(elf_m68k_check_relocs): Use elf_m68k_hash_entry instead of
	casting.
	(elf_m68k_size_dynamic_sections): Use elf_link_hash_traverse
	instead of elf_m68k_link_hash_traverse.
	(elf_m68k_discard_copies): Change first parameter to pointer to
	struct elf_link_hash_entry and use elf_m68k_hash_entry when struct
	elf_m68k_link_hash_entry is needed.
2003-02-04 13:23:40 +00:00
Alan Modra 5cab59f622 * elf-bfd.h (struct got_entry, struct plt_entry): Forward declare.
(struct elf_link_hash_entry): Add "glist" and "plist" fields to
	"got" union, and declare as gotplt_union.  Use gotplt_uinion for
	"plt" field.
	(struct elf_link_hash_table): Make "init_refcount" a gotplt_union.
	Add "init_offset" field.
	(struct elf_obj_tdata <local_got>): Add "struct got_entry **" to union.
	(elf_local_got_ents): Declare.
	* elf.c (_bfd_elf_link_hash_newfunc): Adjust initialization of "got"
	and "plt".
	(_bfd_elf_link_hash_hide_symbol): Use "init_offset".
	(_bfd_elf_link_hash_table_init): Set "init_offset".
	* elflink.h (NAME(bfd_elf,size_dynamic_sections)): Set init_refcount
	from init_offset.
	(elf_adjust_dynamic_symbol): Set plt and got offsets using init_offset.

	* elf.c (bfd_elf_local_sym_name): Split out from..
	(group_signature): ..here.
	* elf-bfd.h (bfd_elf_local_sym_name): Declare.
2003-02-04 12:49:57 +00:00
Alan Modra 68bfbfcc5a bfd
* elf-bfd.h (enum elf_link_info_type): Remove.
	(struct bfd_elf_section_data): Move sec_info_type, use_rela_p fields
	to struct sec.  Remove linkonce_p field.
	(elf_linkonce_p): Delete.
	(elf_discarded_section): Update for sec_info_type change.
	* section.c (struct sec): Add sec_info_type, use_rela_p, has_tls_reloc,
	flag11, flag12, flag13, flag14, flag15, flag16, flag20, flag24.
	(ELF_INFO_TYPE_NONE): Define.
	(ELF_INFO_TYPE_STABS): Define.
	(ELF_INFO_TYPE_MERGE): Define.
	(ELF_INFO_TYPE_EH_FRAME): Define.
	(ELF_INFO_TYPE_JUST_SYMS): Define.
	(STD_SECTION): Update struct sec initializer.
	* ecoff.c (bfd_debug_section): Likewise.
	* elf.c: Likewise.  Update occurrences of sec_info_type and use_rela_p.
	* elflink.h: Likewise.
	* elf-eh-frame.c: Likewise.
	* elf64-alpha.c: Likewise.
	* elfxx-ia64.c: Likewise.
	* elfxx-mips.c: Likewise.
	* bfd-in2.h: Regenerate.

	* elf32-sparc.c (sec_do_relax): Use elf_section_data macro rather than
	referring to used_by_bfd.
	* elf64-sparc.c (sec_do_relax): Likewise.
	* elf64-mmix.c (mmix_elf_section_data): Likewise.
	* elfxx-mips.c (mips_elf_section_data): Likewise.
	* ieee.c (ieee_slurp_section_data): Use ieee_per_section macro.
	(ieee_get_section_contents): Likewise.
	(ieee_new_section_hook): Formatting.
	(ieee_canonicalize_reloc): Remove commented out code.
	* mmo.c (mmo_section_data): Define.  Use throughout file.
	* oasys.c (oasys_get_section_contents): Use oasys_per_section macro.

gas
	* config/obj-elf.c (obj_elf_change_section): Set SEC_LINK_ONCE and
	SEC_LINK_DUPLICATES_DISCARD directly rather than using elf_linkonce_p.
2003-02-04 12:34:08 +00:00
Alan Modra 5cb8c6cb8a daily update 2003-02-03 23:00:06 +00:00
Alan Modra 44c6ae1d17 daily update 2003-02-02 23:00:06 +00:00
Alan Modra b66cc1a0d2 daily update 2003-02-01 23:00:06 +00:00
Alan Modra 26c0321be8 daily update 2003-01-31 23:59:42 +00:00
Nick Clifton 31f7ba0423 bfd_follow_gnu_debuglink: New function. Follow the pointer contained inside a
.gnu_debuglink section.
2003-01-31 10:04:16 +00:00
Alan Modra 927f884ddb daily update 2003-01-30 23:00:05 +00:00
Alan Modra b92225a1b9 daily update 2003-01-29 23:00:05 +00:00
Alexandre Oliva 38985a1cb4 * elfxx-mips.c (mips_elf_got_entry_hash): Don't dereference
entry->abfd when it's NULL.
2003-01-29 08:29:34 +00:00