Commit Graph

1214 Commits

Author SHA1 Message Date
Alan Modra 945906ff86 * elf-bfd.h (struct bfd_elf_section_data): Rename "group" to
"group_name".
	(elf_group_name): Define.
	(elf_next_in_group): Define.
	* elf.c: Make use of elf_group_name and elf_next_in_group throughout.
	(setup_group): Don't use sec->lineno for SHT_GROUP section to store
	first member section; Instead use elf_next_in_group.
	(bfd_section_from_shdr): Likewise.
	(set_group_contents): Likewise.  Use elf_section_syms, not sec->symbol.
2001-10-09 13:12:19 +00:00
Alan Modra dbb410c3e2 * elf-bfd.h (struct bfd_elf_section_data): Add "group" and
"next_in_group".  Fix gp and gp_size comments.
	* elf.c (union elf_internal_group): New.
	(setup_group): New function.
	(_bfd_elf_make_section_from_shdr): Set BFD flags for SHT_GROUP.
	Call setup_group for SHF_GROUP sections.
	(bfd_section_from_shdr): Build a BFD section for SHT_GROUP.
	(elf_fake_sections): Set header type for SEC_GROUP, and header
	flags for sections in a group.
	(set_group_contents): New function.
	(_bfd_elf_compute_section_file_positions): Call it.
	(assign_section_numbers): Set sh_link for SHT_GROUP.
	* elflink.h (gc_mark_hook): Handle section groups.
	* elfxx-target.h: Add SEC_GROUP to applicable_flags.
	* section.c (SEC_GROUP): Define.
	(struct sec): Comment fixes.
	* bfd-in2.h: Regenerate.

	* elf.c (bfd_elf_print_symbol): Formatting fix; migrate expression
	out of function args.
	(_bfd_elf_canonicalize_reloc): Similarly.
	(_bfd_elf_get_symtab): Here too.
	(_bfd_elf_canonicalize_dynamic_symtab): And here.
	* elfcode.h (elf_slurp_symbol_table): Don't recalculate size for
	bfd_bread, and remove unnecessary cast.
2001-10-09 06:05:17 +00:00
Aldy Hernandez 24c603fab2 * bfd/config.bfd (targ_cpu): Add arm9e-*-elf. 2001-10-08 19:11:36 +00:00
Alan Modra 7f0b3a8f8d daily update 2001-10-07 00:00:06 +00:00
Stephane Carrez 3f5864e1f4 * dwarf2.c (comp_unit_find_nearest_line): Check for end of
compilation unit.
2001-10-06 10:01:09 +00:00
Alan Modra aec2f56188 * bfd.c (bfd_assert): Report bfd version.
(_bfd_abort): Likewise.
2001-10-06 07:40:44 +00:00
Alan Modra 50b4d48631 * elflink.h (elf_link_input_bfd): Don't zero discarded link-once
section sym values.  Instead replace any relocs against them with
	relocs against STN_UNDEF, which has a zero value.
2001-10-06 07:25:40 +00:00
Alan Modra fb9ceeac4e * elf32-arc.c (elf_arc_howto_table): Set partial_inplace for all
relocs.
2001-10-06 06:41:47 +00:00
Alan Modra 55e369b374 daily update 2001-10-06 00:00:07 +00:00
Jeff Law 1761749581 * som.h (som_exec_data): New field "version_id".
* som.c (som_object_setup): Record the version_id if it
        exists.
        (som_prep_headers): Do not initialize version_id here.
        (som_finish_writing): Initialize version_id here.
2001-10-05 21:55:12 +00:00
Thiemo Seufer 7e766c3b49 * elf32-mips.c (elf_mips_howto_table): Fix some relocation howtos
according to the MIPS/SGI ELF64 ABI Draft.
	(mips_elf_sort_hash_table): Typo.
2001-10-05 16:14:39 +00:00
Alan Modra 5abe4e058f daily update 2001-10-05 00:00:06 +00:00
Alan Modra 8ea52284ab Fix a comment typo in last commit. 2001-10-04 16:18:32 +00:00
Alan Modra 58e3d09d2a * elf32-mips.c (_bfd_mips_elf_copy_indirect_symbol): Bail out after
copying flags if this is a weakdef.
2001-10-04 16:09:03 +00:00
Alan Modra d828d54ea4 somehow missed committing this.
* dep-in.sed: Remove symcat.h from dependencies.
2001-10-04 15:37:38 +00:00
Alan Modra a90b9fca6f * elf-bfd.h (struct elf_link_hash_entry): Reorganise for better
packing.
2001-10-04 12:30:26 +00:00
Alan Modra 3a6b859720 * elf32-mips.c (mips_elf_record_global_got_symbol): Set got.offset
to 1 rather than 0 to avoid confusing copy_indirect_symbol.
	(mips_elf_sort_hash_table_f): Compare got.offset against 1.
2001-10-04 05:50:29 +00:00
Alan Modra b13c7b49d6 * Makefile.am (BFD_H_DEPS): Add symcat.h. Ensure everything
depends on $(BFD_H) $(BFD_H_DEPS) $(LOCAL_H_DEPS), not just those
	backends we configure.  Run "make dep-am".
	(install-data-local): Install symcat.h.
	* dep-in.sed: Remove symcat.h from dependencies.
	* Makefile.in: Regenerate.
2001-10-04 05:40:43 +00:00
Alan Modra ad681e7b5f daily update 2001-10-04 00:03:26 +00:00
Alan Modra 8bd621d883 Add support for -z nocopyreloc. 2001-10-03 15:11:48 +00:00
Thiemo Seufer 1e2be829b6 * elf64-mips.c (elf_backend_may_use_rela_p): New define.
(elf_backend_default_use_rela_p): New define.
2001-10-03 14:12:12 +00:00
Alan Modra 57c7194e0e * elfxx-ia64.c (elfNN_ia64_hash_copy_indirect): Fix typos in last
change.
2001-10-03 13:16:18 +00:00
Alan Modra 87b632fc07 bfd/ChangeLog
* configure.in (AC_OUTPUT <bfd-in3.h>): Remove version.h.
	* configure: Regenerate.
	* Makefile.am (BFD_H_FILES): Add version.h.
	* Makefile.in: Regenerate.
	* po/SRC-POTFILES.in: Regenerate.

bfd/doc/ChangeLog
	* Makefile.am (BFD_H_DEP): Add ../version.h.
	* Makefile.in: Regenerate.
2001-10-03 12:29:10 +00:00
Alan Modra 0a991dfe0d * elflink.h (elf_fix_symbol_flags): Copy flags to weakdef using
elf_backend_copy_indirect_symbol so that backend has a chance to
	copy other necessary fields.
	* elf-bfd.h (struct elf_backend_data): Update description of
	elf_backend_copy_indirect_symbol.
	* elf.c (_bfd_elf_link_hash_copy_indirect): Bail out after
	copying flags if this is a weakdef.
	* elfxx-ia64.c (elfNN_ia64_hash_copy_indirect): Likewise.
	(elfNN_ia64_aix_add_symbol_hook): Use elf_link_hash_lookup rather
	than bfd_link_hash_lookup.
	* elf32-i386 (elf_i386_adjust_dynamic_symbol): Don't do copy
	reloc processing for weakdefs.
	* elf32-hppa.c (elf32_hppa_adjust_dynamic_symbol): Likewise.
	* elf64-ppc.c (ppc64_elf_adjust_dynamic_symbol): Likewise.
2001-10-03 08:33:18 +00:00
Alan Modra 7997c6eaf4 daily update 2001-10-03 02:02:26 +00:00
Nick Clifton ea04a8f6ec Fix (for the last time, I hope) handling of R_ARC_B22_PCREL. 2001-10-02 14:28:42 +00:00
Alan Modra a33d1f7775 * elf64-ppc.c (ppc64_elf_check_relocs): Use a local var and cast
result of ELF64_R_TYPE to enum before using in a switch.
	(ppc64_elf_gc_mark_hook): Likewise.
	(ppc64_elf_gc_sweep_hook): Likewise.
	(ppc64_elf_reloc_type_class): Likewise.
2001-10-02 09:22:46 +00:00
Alan Modra 8c96f6f4c8 * Makefile.in: Regenerate. 2001-10-02 05:59:30 +00:00
Alan Modra e43d48ccc3 * version.h: New file.
* bfd-in.h: (BFD_VERSION): Substitute bfd_version.
	(BFD_VERSION_DATE): Define.
	(BFD_VERSION_STRING): Define.
	* configure.in: AC_SUBST bfd_version, bfd_version_date and
	bfd_version_string.
	(AC_OUTPUT <bfd-in3.h>): Depend on version.h.
	* bfd-in2.h: Regenerate.
	* configure: Regenerate.
	* Makefile.am: Run "make dep-am"
	* Makefile.in: Regenerate.

	* bfd-in.h: Include "symcat.h".
	(CONCAT4): Redefine as for old CAT4.
	* aout-arm.c: Use equivalent CONCAT* macro in place of CAT* macros.
	Add warning regarding whitespace.
	* aout-cris.c: Likewise.
	* aout-ns32k.c: Likewise.
	* aout-sparcle.c: Likewise.
	* aout-tic30.c: Likewise.
	* aout0.c: Likewise.
	* armnetbsd.c: Likewise.
	* demo64.c: Likewise.
	* elf-bfd.h: Likewise.
	* gen-aout.c: Likewise.
	* host-aout.c: Likewise.
	* hp300bsd.c: Likewise.
	* hp300hpux.c: Likewise.
	* i386aout.c: Likewise.
	* i386bsd.c: Likewise.
	* i386dynix.c: Likewise.
	* i386freebsd.c: Likewise.
	* i386linux.c: Likewise.
	* i386lynx.c: Likewise.
	* i386mach3.c: Likewise.
	* i386netbsd.c: Likewise.
	* libaout.h: Likewise.
	* m68k4knetbsd.c: Likewise.
	* m68klinux.c: Likewise.
	* m68klynx.c: Likewise.
	* m68knetbsd.c: Likewise.
	* m88kmach3.c: Likewise.
	* mipsbsd.c: Likewise.
	* newsos3.c: Likewise.
	* ns32knetbsd.c: Likewise.
	* pc532-mach.c: Likewise.
	* pdp11.c: Likewise.
	* riscix.c: Likewise.
	* sparclinux.c: Likewise.
	* sparclynx.c: Likewise.
	* sparcnetbsd.c: Likewise.
	* sunos.c: Likewise.
	* targets.c: Likewise.
	* vaxnetbsd.c: Likewise.
	* vms-hdr.c: Likewise.
2001-10-02 05:58:41 +00:00
Alan Modra 4eef72c77d bfd/
* bfd-in.h: Remove comments regarding generated files.
	* libbfd-in.h: Likewise.
	* libcoff-in.h: Likewise.
	* bfd-in2.h: Regenerate.
	* libbfd.h: Likewise.
	* libcoff.h: Likewise.
bfd/doc/
	* header.sed: New file, adds header to generated files.
	* Makefile.am: Rewrite rules generating libbfd.h, libcoff.h and
	bfd.h, using above.  Add missing elf.c dependecy for libbfd.h.
	* Makefile.in: Regenerate.
2001-10-01 14:03:36 +00:00
Hans-Peter Nilsson 146be91a2b * elf32-sh.c (sh_elf_howto_table, R_SH_REL32): Make
partial_inplace, matching assembler output.  Set src_mask to
	all ones.
	(sh_elf_relocate_section): Delete misplaced comment.
	For relocatable linking against section symbol, call
	_bfd_relocate_contents for partial_inplace relocs and adjust
	rel->r_addend for others.
	<case R_SH_DIR32, R_SH_REL32>: Fetch partial_inplace addend with
	bfd_get_32, not at rel->r_addend.
2001-10-01 00:16:27 +00:00
Alan Modra 3c3e9281c3 * elf.c (_bfd_elf_link_hash_copy_indirect): Set ind refcounts to
the old dir refcount, so we indirectly set them to init_refcount.
	Short-circuit asserts when we've just verified they are true.
2001-09-30 03:03:11 +00:00
Alan Modra 862517b650 * section.c (struct sec): Remove kept_section.
(STD_SECTION): Remove kept_section initialisation.
	(bfd_make_section_anyway): Here too.
	* ecoff.c (bfd_debug_section): Remove kept_section initialisation.
	* cofflink.c (_bfd_coff_link_input_bfd): Don't test kept_section.
	* elflink.h (elf_link_input_bfd): Set discarded link-once section
	symbols to zero, and remove all code involved with kept_section
	and tracking section symbol values.
	* bfd-in2.h: Regenerate.
	* configure.in: Bump version number.
	* configure: Regenerate.

	* ldlang.c (section_already_linked): Remove assignment to kept_section.
2001-09-29 12:07:01 +00:00
Alan Modra 65f38f15bf * elf64-ppc.c (struct ppc_dyn_relocs): New.
(IS_ABSOLUTE_RELOC): Define.
	(struct ppc_link_hash_entry): New.
	(struct ppc_link_hash_table): New.
	(ppc_hash_table): Define.
	(link_hash_newfunc): New function.
	(ppc64_elf_link_hash_table_create): New function.
	(create_got_section): New function.
	(ppc64_elf_create_dynamic_sections): Call create_got_section.  Stash
	pointers to our dynamic sections in hash table.
	(ppc64_elf_copy_indirect_symbol): New function.
	(ppc64_elf_check_relocs): Remove DEBUG code.  Use short-cuts to
	dynamic sections.  Localise vars.  Modify code for refcounts
	starting from zero.  Don't allocate here, or force symbols dynamic.
	Don't copy all relocs if shared, select ones we need.  Add code
	to track possible copy relocs for non-shared link.
	(ppc64_elf_gc_mark_hook): Update comment.
	(ppc64_elf_gc_sweep_hook): Sweep dynrelocs too.
	(ppc64_elf_adjust_dynamic_symbol): Remove DEBUG code.  Rewrite .plt
	code for reference counting garbage collection.  Don't create .plt
	entries for functions that don't comply with ABI naming convention,
	and don't allocate .plt space here.  Use short-cuts to dynamic
	sections.  If possible, keep dynamic relocations instead of using
	copy relocs.  Remove confused comments.
	(ppc_adjust_dynindx): Delete.
	(WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define.
	(allocate_dynrelocs): New function.
	(readonly_dynrelocs): New function.
	(ppc64_elf_size_dynamic_sections): Rewrite.  Allocate local .got
	space here, and call allocate_dynrelocs to allocate space for
	global .plt, .got and reloc sections.  Use short-cuts to dynamic
	sections.  Call readonly_dynrelocs to determine whether we need
	DT_TEXTREL.  Don't generate section symbols here, the generic
	ELF linker code does it for us.
	(ppc64_elf_final_link): Call regular ELF backend linker rather than
	gc variety, since we do our own .got handling.
	(ppc64_elf_relocate_section): Remove DEBUG code.  Make use of
	dynamic section short-cuts.  Localise vars, and delay setting.
	Handle unknown relocs in main switch statement.  Replace ugly
	complicated tests for unresolvable relocs with a simple direct
	scheme using "unresolved_reloc" var.  Test ELF_ST_VISIBILITY
	before allowing an undefined sym in a shared lib.  Do R_*_DS tests
	after main switch, when we've set addend.  Do non-addend insn
	tweaks before main swithc.  Ignore input_section->vma when
	calculating reloc offsets as it's always zero.  Rewrite dynamic
	reloc handling.  Consolidate R_*_HA handling.  Handle more relocs.
	(ppc64_elf_finish_dynamic_symbol): Remove DEBUG code.  Make use
	of dynamic section short-cuts.  Reorganise .plt handling code.
	Remove confused comments.  Take note of ELF_LINK_FORCED_LOCAL.
	Move expressions out of swap_reloca_out function calls.
	(ppc64_elf_reloc_type_class): New function.
	(ppc64_elf_info_to_howto): Move common expression to local var.
	(ppc64_elf_finish_dynamic_sections): Remove DEBUG code.  Make use
	of dynamic section short-cuts.  Don't fiddle with section syms
	here as the ELF linker does it for us.
	(elf_backend_can_refcount): Define.
	(bfd_elf64_bfd_link_hash_table_create): Define.
	(elf_backend_copy_indirect_symbol): Define.
	(elf_backend_reloc_type_class): Define.
	(elf_backend_*, bfd_elf64_bfd_* defines): Sort.
2001-09-29 06:49:16 +00:00
Alan Modra 51b64d56a7 * elf-bfd.h (struct elf_link_local_dynamic_entry): Add init_refcount.
(struct elf_backend_data): Add can_refcount.
	* elf.c (_bfd_elf_link_hash_newfunc): Get rid of a few casts.  Set
	got.refcount and plt.refcount from init_refcount.
	(_bfd_elf_link_hash_table_init): Set up init_refcount.
	(_bfd_elf_link_hash_copy_indirect): Reference got/plt.refcount
	rather than got/plt.offset, and test for <= 0 rather than -1.
	* elflink.h (size_dynamic_sections): Set init_refcount to -1.
	* elfxx-target.h (elf_backend_can_refcount): Define.
	(elfNN_bed): Init can_refcount.
	* linker.c (_bfd_link_hash_newfunc): Get rid of a few casts.
	(_bfd_generic_link_hash_newfunc): Likewise.
	* elf32-cris.c (cris_elf_check_relocs): Modify for refcounts
	starting from zero.
	(elf_backend_can_refcount): Define.
	* elf32-hppa.c (elf32_hppa_check_relocs): Modify for refcounts
	starting from zero.
	(elf32_hppa_copy_indirect_symbol): Make static to agree with
	prototype.
	(elf_backend_can_refcount): Define.
	* elf32-i386.c (elf_i386_check_relocs): Modify for refcounts
	starting from zero.
	(allocate_dynrelocs): Set plt/got.offset rather than *.refcount.
	(elf_i386_finish_dynamic_symbol): Expand SHN_UNDEF comment.
	(elf_i386_finish_dynamic_sections): Use local var so line < 80 chars.
	(elf_backend_can_refcount): Define.
	(elf_i386_copy_indirect_symbol): Make static to agree with
	prototype.  Formatting fix.
	* elf32-m68k.c (elf_m68k_check_relocs): Modify for refcounts
	starting from zero.
	(elf_backend_can_refcount): Define.
	* elf32-ppc.c (ppc_elf_check_relocs): Modify for refcounts
	starting from zero.
	(elf_backend_can_refcount): Define.
	* elf32-s390.c (elf_s390_check_relocs): Modify for refcounts
	starting from zero.
	(elf_backend_can_refcount): Define.
	* elf64-s390.c (elf_s390_check_relocs): Modify for refcounts
	starting from zero.
	(elf_backend_can_refcount): Define.
	* elf64-x86-64.c (elf64_x86_64_check_relocs): Modify for refcounts
	starting from zero.
	(elf_backend_can_refcount): Define.
2001-09-29 06:21:59 +00:00
Alan Modra 21d17a588f * som.c (som_write_symbol_strings): Cast current_offset in
bfd_seek call to match param type.
2001-09-29 06:13:53 +00:00
Richard Henderson e0aae569d6 * elfxx-target.h [section_flags]: Add SEC_ARCH_BIT_0, SEC_SMALL_DATA,
SEC_MERGE, SEC_STRINGS.
2001-09-28 21:47:25 +00:00
Joel Brobecker 78ae4cb9c0 Document changes to som.c revision 1.22. 2001-09-28 21:36:18 +00:00
Joel Brobecker 982cfd7867 som_write_symbol_strings: Fix incorrect type of current_offset to match
the function definition. Fixes a build failure on HPUX-11.00.
2001-09-28 21:35:45 +00:00
Richard Henderson 65db3b0dbf * section.c (SEC_ARCH_BIT_0): New; replace unused SEC_BALIGN.
* bfd-in2.h: Rebuild.
2001-09-28 20:51:15 +00:00
Alan Modra ffaef15911 * elf64-x86-64.c (elf64_x86_64_reloc_type_lookup): Don't map bfd
reloc code using x86_64_reloc_map.
2001-09-28 12:54:53 +00:00
Alan Modra 3ac8354b40 * elf32-hppa.c (elf32_hppa_check_relocs): Update comment since we
no longer allocate here.  Localise some vars to blocks where they
	are used.
	(elf32_hppa_adjust_dynamic_symbol): Correct a comment.  Delay
	setting of vars until needed.
	(allocate_dynrelocs): Don't create a .plt entry without a reloc
	when symbol visibilty makes a function local.
	(elf32_hppa_finish_dynamic_symbol): Move expressions out of
	swap_reloca_out function calls.
	(elf32_hppa_relocate_section): Likewies.  Comment typo fix.
	(elf32_hppa_finish_dynamic_sections): Migrate common code out of
	switch statement.
2001-09-28 08:56:51 +00:00
Alan Modra 0ac8d2cabf * elf32-i386.c (elf_i386_check_relocs): Update comment since we
no longer allocate here.  Localise some vars to blocks where they
	are used.  Remove separate switch stmt for creating .got sec.
	(elf_i386_adjust_dynamic_symbol): Correct a comment.  Remove
	redundant casts and aborts.  Delay setting of vars until needed.
	(allocate_dynrelocs): Remove redundant casts and aborts.
	(elf_i386_size_dynamic_sections): Move comment.
	(elf_i386_finish_dynamic_symbol): Move expressions out of function
	calls.
	(elf_i386_relocate_section): Likewise.  Comment typo fix.
	(elf_i386_finish_dynamic_sections): Migrate common code out of
	switch statement.
	(elf_backend_* defines): Sort.
2001-09-27 16:18:42 +00:00
Alan Modra ced53ee5da * elf32-i386.c (allocate_dynrelocs): Don't create a .plt entry
without a reloc when symbol visibilty makes a function local.
2001-09-27 16:10:28 +00:00
Nick Clifton 06317a278f Revert most of previous delta. Do not call bfd_archive_filename on output
bfd, nor twice in one expression.
2001-09-27 13:49:27 +00:00
Nick Clifton 63b0f74538 Replace bfd_get_filename with bfd_archive_filename in error message.
Fix detection of conflicting float flags.
2001-09-27 07:49:27 +00:00
Alan Modra ebe50baeda * elf32-i386 (elf_i386_copy_indirect_symbol): New function.
(elf_backend_copy_indirect_symbol): Define.
	(struct elf_i386_link_hash_entry): Rename "root" to "elf".
	(struct elf_i386_link_hash_table): Likewise.
	(link_hash_newfunc): Get rid of unnecessary casts.
	(elf_i386_link_hash_table_create): Likewise.
	(elf_i386_check_relocs): Initialise local_got_refcounts to 0.
	Don't test input section SEC_READONLY here to try to avoid copy
	relocs, and keep dyn_relocs regardleas of ELF_LINK_NON_GOT_REF.
	(elf_i386_adjust_dynamic_symbol): Check output section SEC_READONLY
	here to properly test whether we need copy relocs.  Do so for weak
	syms too.

	* elf32-hppa (elf32_hppa_copy_indirect_symbol): New function.
	(elf_backend_copy_indirect_symbol): Define.
	(struct elf32_hppa_link_hash_table): Rename "root" to "elf".
	(stub_hash_newfunc): Get rid of unnecessary casts.
	(hppa_link_hash_newfunc): Likewise.
	(elf32_hppa_check_relocs): Initialise local_got_refcounts to 0.
	Don't test input section SEC_READONLY here to try to avoid copy
	relocs, and keep dyn_relocs regardleas of ELF_LINK_NON_GOT_REF.
	(elf32_hppa_adjust_dynamic_symbol): Check output section SEC_READONLY
	here to properly test whether we need copy relocs.  Do so for weak
	syms too.
2001-09-26 09:25:04 +00:00
Alan Modra af6166c063 * bfd.c (_bfd_default_error_handlerl): Define using VPARAMS,
VA_OPEN, VA_FIXEDARG, VA_CLOSE.
	(bfd_archive_filename): Cast bfd_malloc arg to the correct size.
2001-09-26 01:53:25 +00:00
Jakub Jelinek e62de969f0 * elf64-sparc.c (sparc64_elf_build_plt): Fix .plt[32768+] slot
computation.
2001-09-25 22:12:29 +00:00
H.J. Lu 09c1cc8828 2001-09-25 H.J. Lu <hjl@gnu.org>
* bfd-in2.h: Regenerated.
2001-09-25 16:35:05 +00:00