Commit Graph

139 Commits

Author SHA1 Message Date
H.J. Lu 257a482034 2005-03-18 H.J. Lu <hongjiu.lu@intel.com>
* elflink.c (elf_mark_used_section): Check bfd_is_const_section
	for special sections.
2005-03-18 15:46:25 +00:00
Alan Modra 554220db5b * elf-bfd.h (_bfd_elf_link_renumber_dynsyms): Delete.
* elflink.c (_bfd_elf_link_renumber_dynsyms): Make static, add
	section_sym_count param, and return number of section symbols.
	(bfd_elf_size_dynamic_sections): Clear section symbol area of
	.dynsym contents.  Don't bother calling swap_symbol_out on the
	first all-zero dynsym.
	(elf_mark_used_section): Formatting.  Avoid twiddling flags in
	special sections like bfd_abs_section.
	(bfd_elf_gc_sections): Spelling fix.
2005-03-18 13:21:11 +00:00
H.J. Lu 57316bff0a bfd/
2005-03-16  H.J. Lu  <hongjiu.lu@intel.com>

	* elflink.c (elf_mark_used_section): New.
	(bfd_elf_gc_sections): Call elf_gc_mark_section for
	non-relocatable link if we don't do GC.

include/

2005-03-16  H.J. Lu  <hongjiu.lu@intel.com>

	* bfdlink.h (bfd_link_info): Add gc_sections.

ld/

2005-03-16  H.J. Lu  <hongjiu.lu@intel.com>

	* emultempl/elf32.em (gld${EMULATION_NAME}_finish): Remove
	unused empty output sections for non-relocatable link.

	* ld.h (args_type): Remove gc_sections.

	* ldlang.c (lang_mark_used_section): New.
	(lang_gc_sections): Use link_info.gc_sections instead of
	command_line.gc_sections.
	* ldmain.c (main): Likewise.
	* lexsup.c (parse_args): Likewise.
	* ldlang.c (lang_process): Call lang_mark_used_section.

	* ldmain.c (main): Initialize link_info.gc_sections to FALSE.

ld/testsuite/

2005-03-16  H.J. Lu  <hongjiu.lu@intel.com>

	* ld-alpha/tlsbin.rd: Updated for empty section removal.
	* ld-alpha/tlsbinr.rd: Likewise.
	* ld-alpha/tlspic.rd: Likewise.
	* ld-arm/mixed-lib.sym: Likewise.
	* ld-i386/tlsbin.rd: Likewise.
	* ld-i386/tlsnopic.rd: Likewise.
	* ld-i386/tlspic.rd: Likewise.
	* ld-ia64/tlsbin.rd: Likewise.
	* ld-ia64/tlspic.rd: Likewise.
	* ld-powerpc/apuinfo.rd: Likewise.
	* ld-powerpc/powerpc.exp: Likewise.
	* ld-powerpc/tlsexe32.r: Likewise.
	* ld-s390/tlsbin.rd: Likewise.
	* ld-s390/tlsbin_64.rd: Likewise.
	* ld-s390/tlspic.rd: Likewise.
	* ld-s390/tlspic_64.rd: Likewise.
	* ld-sh/tlsbin-2.d: Likewise.
	* ld-sh/tlspic-2.d: Likewise.
	* ld-sparc/tlssunbin32.rd: Likewise.
	* ld-sparc/tlssunnopic32.rd: Likewise.
	* ld-sparc/tlssunpic32.rd: Likewise.
	* ld-x86-64/tlsbin.rd: Likewise.
	* ld-x86-64/tlspic.rd: Likewise.
2005-03-16 21:52:48 +00:00
H.J. Lu af44c13841 2005-02-28 H.J. Lu <hongjiu.lu@intel.com>
PR 757
	* elf-bfd.h (_bfd_elf_merge_symbol): Add a pointer to unsigned
	int.

	* elf32-sh-symbian.c (sh_symbian_relocate_section): Pass NULL
	to _bfd_elf_merge_symbol.

	* elflink.c (_bfd_elf_merge_symbol): Use the pointer to
	unsigned int to return the alignment of the old common symbol
	in the dynamic object.
	(_bfd_elf_add_default_symbol): Pass NULL to
	_bfd_elf_merge_symbol.
	(elf_link_add_object_symbols): Pass &old_alignment to
	_bfd_elf_merge_symbol. Get the alignment of the new common
	symbol in the dynamic object.
2005-02-28 15:57:13 +00:00
Julian Brown 1f02cbd9ee * elflink.c (elf_link_add_object_symbols): Force symbols in
discarded COMDAT group sections to have default visibility.
2005-02-24 15:28:56 +00:00
Paul Brook 6768797874 2005-02-11 Paul Brook <paul@codesourcery.com>
* elf-bfd.h (struct elf_link_hash_table): Add
	is_relocatable_executable.
	* elf.c (_bfd_elf_link_hash_table_init): Initialize it.
	* elflink.c (bfd_elf_link_record_dynamic_symbol): Create local dynamic
	symbols in relocatable executables.
	(bfd_elf_record_link_assignment): Create dynamic section symbols in
	relocatable executables.
	(_bfd_elf_link_renumber_dynsyms): Ditto.
	(bfd_elf_final_link): Ditto.
	* elf32-arm.c (elf32_arm_final_link_relocate): Copy absolute
	relocations into relocatable executables.
	(elf32_arm_check_relocs): Crate dynamic sections for relocatable
	executables.  Also copy absolute relocations.
	(elf32_arm_adjust_dynamic_symbol): Don't create copy relocations
	in relocatable executables.
	(allocate_dynrelocs): Copy relocations for relocatable executables.
	Output dynamic symbols for symbols defined in linker scripts.
2005-02-11 16:41:09 +00:00
Paul Brook 6fa3860b3b 2005-02-10 Paul Brook <paul@codesourcery.com>
* elflink.c (bfd_elf_record_link_assignment): Make hidden and internal
	symbols local.
	(elf_link_renumber_hash_table_dynsyms): Ignore local symbols.
	(elf_link_renumber_local_hash_table_dynsyms): New function.
	(_bfd_elf_link_renumber_dynsyms): Number local dynamic symbols.
ld/testsuite/
	* ld-elfvsb/hidden2.s: New file
	* ld-elfvsb/hidden2.d: New file
	* ld-elfvsb/hidden2.ld: New file
2005-02-10 14:09:43 +00:00
Jakub Jelinek d457dcf698 * bfd-in.h (BFD_LINKER_CREATED): Define.
* bfd-in2.h: Rebuilt.
	* elflink.c (bfd_elf_size_dynamic_sections): Disregard
	BFD_LINKER_CREATED bfds when determining input bfds without
	.note.GNU-stack section.

	* emultempl/hppaelf.em (hppaelf_create_output_section_statements):
	Set BFD_LINKER_CREATED on the stubs bfd.
	* emultempl/ppc64elf.em (ppc_create_output_section_statements):
	Likewise.
2005-02-10 09:15:08 +00:00
Paul Brook ccf5f61012 2005-02-08 Paul Brook <paul@codesourcery.com>
* elflink.c (elf_link_input_bfd): Ignore symbols from null input
	sections.
2005-02-08 13:33:56 +00:00
Hans-Peter Nilsson 370a0e1bf4 * elflink.c (elf_link_add_object_symbols): Don't add "warning: "
prefix here.
2005-02-08 03:50:08 +00:00
Alan Modra 4ea42fb74f bfd/
* elflink.c (bfd_elf_record_link_assignment): Do "provide" symbol
	lookup here.  Set to new before calling bfd_link_repair_undef_list.
	(elf_smash_syms): Check that u.undef.weak isn't the not_needed bfd.
ld/
	emultempl/elf32.em (gld${EMULATION_NAME}_find_exp_assignment): Don't
	look up symbol for etree_provide here.
2005-02-03 14:12:54 +00:00
Alan Modra 11f25ea6ca include/
* bfdlink.h (struct bfd_link_hash_entry): Add u.undef.weak.
bfd/
	* linker.c (_bfd_generic_link_add_one_symbol): Set u.undef.weak.
	* elflink.c (elf_smash_syms): Restore symbols that were undefweak
	before the as-needed lib was loaded.  Abort on unexpected refs.
2005-02-03 03:30:49 +00:00
Alan Modra ec13b3bb1f * elflink.c (elf_smash_syms): Expand comments.
(elf_link_add_object_symbols): Only call elf_smash_syms for
	as-needed dynamic objects.
2005-02-02 02:36:35 +00:00
Alan Modra 77cfaee698 include/
* bfdlink.h (bfd_link_repair_undef_list): Declare.
bfd/
	* elf64-ppc.c (ppc64_elf_check_directives): Move undefs list fixup..
	* linker.c (bfd_link_repair_undef_list): ..to new function, but don't
	remove anything but new and undefweak.
	* elflink.c (_bfd_elf_link_create_dynamic_sections): Override any
	existing _DYNAMIC.
	(_bfd_elf_create_dynamic_sections): Formatting.
	(bfd_elf_record_link_assignment): Call bfd_link_repair_undef_list.
	(_bfd_elf_merge_symbol): Don't handle as-needed syms here.
	(struct elf_smash_data): New.
	(elf_smash_syms): New function.
	(elf_link_add_object_symbols): Call elf_smash_syms.  Don't add
	unneeded dynamic objects to loaded list.
	(elf_link_output_extsym): Don't handle as-needed here.  Strip
	bfd_link_hash_new symbols.
	* elf32-cris.c (elf_cris_discard_excess_program_dynamics): Don't
	delref when dynindx is already -1.
	* elf64-alpha.c (elf64_alpha_output_extsym): Strip bfd_link_hash_new
	symbols.
	* elfxx-mips.c (mips_elf_output_extsym): Likewise.
ld/
	* ld.texinfo: Clarify --as-needed operation.
2005-02-01 01:11:27 +00:00
Ben Elliston 0e71e4955c * aout-arm.c, aout-target.h, aoutx.h, archive.c, armnetbsd.c,
bfd-in.h, bfdio.c, coff-alpha.c, coff-arm.c, coff-h8300.c,
	coff-i860.c, coff-mcore.c, coff-or32.c, coff-ppc.c, coff-sh.c,
	coff-sparc.c, coffcode.h, coffgen.c, cofflink.c, cpu-cris.c,
	cpu-h8500.c, cpu-ns32k.c, ecoff.c, ecofflink.c, elf.c,
	elf32-dlx.c, elf32-fr30.c, elf32-frv.c, elf32-hppa.c,
	elf32-i860.c, elf32-ip2k.c, elf32-m32r.c, elf32-sh.c,
	elf32-v850.c, elf64-mips.c, elf64-sparc.c, elflink.c,
	i386aout.c, i386msdos.c, i386os9k.c, ieee.c, mach-o.c,
	nlm32-sparc.c, oasys.c, opncls.c, pdp11.c, pe-mips.c, peXXigen.c,
	pef.c, peicode.h, reloc.c, riscix.c, section.c, simple.c, som.c,
	sparclynx.c, targets.c, vms-misc.c, vms-tir.c, xsym.c, doc/chew.c,
	hosts/delta68.h, hosts/vaxbsd.h: Remove #if 0'd code
	throughout. Similarly, collapse #if 1'd code.
2005-01-31 23:13:34 +00:00
Alan Modra 7e9f086769 bfd/
* elflink.c (elf_link_add_object_symbols): Don't create link dynamic
	sections immediately when linking shared libs.  Instead, wait until
	we know a lib is needed.
	(_bfd_elf_link_create_dynstrtab): Extract from..
	(_bfd_elf_link_create_dynamic_sections_): ..here.
	(elf_add_dt_needed_tag): Call _bfd_elf_link_create_dynstrtab and
	_bfd_elf_link_create_dynamic_sections.  Add abfd param.  Allow
	for non-existent .dynamic.
	(elf_link_output_extsym): Don't complain about undefined symbols
	in as-needed dynamic libs that aren't actually linked.
ld/
	* emultempl/elf32.em (gld${EMULATION_NAME}_try_needed): Formatting.
	(gld${EMULATION_NAME}_after_open): Ignore needed libs if they were
	only needed by an as-needed lib that didn't get linked.
2005-01-25 01:40:04 +00:00
H.J. Lu 1c16dfa5fd 2005-01-19 H.J. Lu <hongjiu.lu@intel.com>
PR 679
	* elflink.c (_bfd_elf_dynamic_symbol_p): Only protected
	non-function symbols are local.
	(_bfd_elf_symbol_refs_local_p): Likewise.
2005-01-19 16:15:11 +00:00
Alan Modra a5db907e36 * elflink.c (_bfd_elf_merge_symbol): Treat old definitions from
as-needed dynamic libs as undefined.
	(elf_link_add_object_symbols): Remove DYN_AS_NEEDED from as-needed
	libs when finding they are needed.
2004-12-22 03:59:26 +00:00
Alan Modra be8dd2ca9e * elf.c (bfd_elf_sym_name): Add symtab_hdr param.
(group_signature): Update call.
	* elf-bfd.h (bfd_elf_sym_name): Update.
	* elf32-ppc.c (ppc_elf_relocate_section): Update.
	* elf64-ppc.c (ppc64_elf_edit_opd, ppc64_elf_edit_toc)
	(ppc64_elf_relocate_section): Update
	* elflink.c (elf_link_input_bfd): Update.
2004-12-10 14:04:58 +00:00
Alan Modra 0e2cfdce25 * elf.c (bfd_elf_sym_name): Rename from bfd_elf_local_sym_name.
(group_signature): Update calls.
	* elf-bfd.h (bfd_elf_sym_name): Update.
	* elf32-ppc.c (ppc_elf_relocate_section): Update.
	* elf64-ppc.c (ppc64_elf_edit_opd, ppc64_elf_edit_toc)
	(ppc64_elf_relocate_section): Update
	* elflink.c (elf_link_input_bfd): Update.
2004-12-10 13:18:40 +00:00
Paul Brook 529fcb9585 2004-12-01 Paul Brook <paul@codesourcery.com>
bfd/
	* elflink.c (elf_link_add_object_symbols): Make symbols from discarded
	sections undefined.
ld/testsuite/
	* ld-elf/group1.d: New test.
	* ld-elf/group.ld, ld-elf/group1a.s, ld-elf/group1b.s: New test.
2004-12-01 23:23:12 +00:00
Paul Brook fc0e6df64d bfd/
* elf-bfd.h (_bfd_elf_slurp_version_tables): Update prototype.
	* elf.c (_bfd_elf_print_private_bfd_data): Pass extra argument.
	(_bfd_elf_slurp_version_tables): Add extra argument.  Create extra
	default version definition for unversioned symbols.
	* elfcode.h (elf_slurp_symbol_table): Pass extra argument.
	* elflink.c (elf_link_add_object_symbols): Pass extra argument to
	_bfd_elf_slurp_version_tables.  Set default version for unversioned
	imported symbols.
include/
	* bfdlink.h (bfd_link_info): Add default_imported_symver.
ld/
	* ld.texinfo: Document --default-imported-symver.
	* ldmain.c (main): Set link_info.default_imported_symver.
	* lexsup.c (option_values): Add OPTION_DEFAULT_IMPORTED_SYMVER.
	(ld_options): Add --default-imported-symver.
	(parse_args): Handle OPTION_DEFAULT_IMPORTED_SYMVER.
2004-11-15 23:21:27 +00:00
Paul Brook b23e50e23e * elflink.c (elf_link_add_object_symbols): Don't assume version
indices are consecutive.
2004-11-15 12:39:01 +00:00
Hans-Peter Nilsson e6857c0cd5 * elflink.c (_bfd_elf_create_got_section): Hide _GLOBAL_OFFSET_SYMBOL. 2004-11-02 05:44:34 +00:00
Paul Brook 3e3b46e5c8 bfd/
* elflink.c (elf_finalize_dynstr): Skip shared aux structure.
	(bfd_elf_size_dynamic_sections): Create default version definition.
	(elf_link_output_extsym): Adjust for default symbol version.
include/
	* bfdlink.h (struct bfd_link_info): Add create_default_symver.
ld/
	* ld.texinfo: Document --default-symver.
	* ldmain.c (main): Set link_info.create_default_symver.
	* lexsup.c (enum option_values): Add OPTION_DEFAULT_SYMVER.
	(ld_options): Add default-symver.
	(parse_args): Handle OPTION_DEFAULT_SYMVER.
ld/testsuite/
	* ld-elfvers/vers.exp (build_binary): Add ldargs parameter.
	(build_vers_lib_pic_flags): New function.
	Add vers29 test.
	* ld-elfvers/vers29.c: New file.
	* ld-elfvers/vers29.dsym: New file.
	* ld-elfvers/vers29.ver: New file.
2004-10-26 13:46:05 +00:00
H.J. Lu dfeffb9fe1 bfd/
2004-10-21  H.J. Lu  <hongjiu.lu@intel.com>

	PR 463
	* aoutx.h (aout_link_input_section_std): Pass proper hash entry
	to linker reloc_overflow callback.
	(aout_link_input_section_ext): Likewise.
	(aout_link_reloc_link_order): Likewise.
	* coff-a29k.c (coff_a29k_relocate_section): Likewise.
	* coff-alpha.c (alpha_ecoff_get_relocated_section_contents):
	Likewise.
	(alpha_relocate_section): Likewise.
	* coff-arm.c (coff_arm_relocate_section): Likewise.
	* coff-h8300.c (h8300_reloc16_extra_cases): Likewise.
	* coff-h8500.c (extra_case): Likewise.
	* coff-i960.c (coff_i960_relocate_section): Likewise.
	* coff-mcore.c (coff_mcore_relocate_section): Likewise.
	* coff-mips.c (mips_relocate_section): Likewise.
	* coff-or32.c (coff_or32_relocate_section): Likewise.
	* coff-ppc.c (coff_ppc_relocate_section): Likewise.
	* coff-rs6000.c (xcoff_ppc_relocate_section): Likewise.
	* coff-sh.c (sh_relocate_section): Likewise.
	* coff-tic80.c (coff_tic80_relocate_section): Likewise.
	* coff-w65.c (w65_reloc16_extra_cases): Likewise.
	* coff-z8k.c (extra_case): Likewise.
	* coff64-rs6000.c (xcoff64_ppc_relocate_section): Likewise.
	* cofflink.c (_bfd_coff_reloc_link_order): Likewise.
	(_bfd_coff_generic_relocate_section): Likewise.
	* ecoff.c (ecoff_reloc_link_order): Likewise.
	* elf-hppa.h (elf_hppa_relocate_section): Likewise.
	* elf-m10200.c (mn10200_elf_relocate_section): Likewise.
	* elf-m10300.c (mn10300_elf_relocate_section): Likewise.
	* elf32-arm.h (elf32_arm_relocate_section): Likewise.
	* elf32-avr.c (elf32_avr_relocate_section): Likewise.
	* elf32-cr16c.c (elf32_cr16c_relocate_section): Likewise.
	* elf32-cris.c (cris_elf_relocate_section): Likewise.
	* elf32-crx.c (elf32_crx_relocate_section): Likewise.
	* elf32-d10v.c (elf32_d10v_relocate_section): Likewise.
	* elf32-fr30.c (fr30_elf_relocate_section): Likewise.
	* elf32-frv.c (elf32_frv_relocate_section): Likewise.
	* elf32-h8300.c (elf32_h8_relocate_section): Likewise.
	* elf32-hppa.c (elf32_hppa_relocate_section): Likewise.
	* elf32-i370.c (i370_elf_relocate_section): Likewise.
	* elf32-i386.c (elf_i386_relocate_section): Likewise.
	* elf32-i860.c (elf32_i860_relocate_section): Likewise.
	* elf32-ip2k.c (ip2k_elf_relocate_section): Likewise.
	* elf32-iq2000.c (iq2000_elf_relocate_section): Likewise.
	* elf32-m32r.c (m32r_elf_relocate_section): Likewise.
	* elf32-m68hc1x.c (elf32_m68hc11_relocate_section): Likewise.
	* elf32-m68k.c (elf_m68k_relocate_section): Likewise.
	* elf32-mcore.c (mcore_elf_relocate_section): Likewise.
	* elf32-msp430.c (elf32_msp430_relocate_section): Likewise.
	* elf32-openrisc.c (openrisc_elf_relocate_section): Likewise.
	* elf32-ppc.c (ppc_elf_relocate_section): Likewise.
	* elf32-s390.c (elf_s390_relocate_section): Likewise.
	* elf32-sh.c (sh_elf_relocate_section): Likewise.
	* elf32-sparc.c (elf32_sparc_relocate_section): Likewise.
	* elf32-v850.c (v850_elf_relocate_section): Likewise.
	* elf32-vax.c (elf_vax_relocate_section): Likewise.
	* elf32-xstormy16.c (xstormy16_elf_relocate_section): Likewise.
	* elf64-alpha.c (elf64_alpha_relocate_section): Likewise.
	* elf64-mmix.c (mmix_elf_relocate_section): Likewise.
	* elf64-ppc.c (ppc64_elf_relocate_section): Likewise.
	* elf64-s390.c (elf_s390_relocate_section): Likewise.
	* elf64-sh64.c (sh_elf64_relocate_section): Likewise.
	* elf64-sparc.c (sparc64_elf_relocate_section): Likewise.
	* elf64-x86-64.c (elf64_x86_64_relocate_section): Likewise.
	* elflink.c (elf_reloc_link_order): Likewise.
	* elfxx-ia64.c (elfNN_ia64_relocate_section): Likewise.
	* elfxx-mips.c (_bfd_mips_elf_relocate_section): Likewise.
	(_bfd_elf_mips_get_relocated_section_contents): Likewise.
	* linker.c (_bfd_generic_reloc_link_order): Likewise.
	* pdp11.c (pdp11_aout_link_input_section): Likewise.
	(aout_link_reloc_link_order): Likewise.
	* reloc.c (bfd_generic_get_relocated_section_contents):
	Likewise.
	* xcofflink.c (xcoff_reloc_link_order): Likewise.
	* simple.c (simple_dummy_reloc_overflow): Updated.

include/

2004-10-21  H.J. Lu  <hongjiu.lu@intel.com>

	PR 463
	* bfdlink.h (bfd_link_callbacks): Add a pointer to struct
	bfd_link_hash_entry to reloc_overflow.

ld/

2004-10-21  H.J. Lu  <hongjiu.lu@intel.com>

	PR 463
	* ldmain.c (reloc_overflow): Accept a pointer to struct
	bfd_link_hash_entry. Report symbol location for relocation
	overflow.
2004-10-21 15:28:33 +00:00
Mark Mitchell 6df4d94c68 * elfarm-nabi.c (ELF_DYNAMIC_SEC_FLAGS): Add comment.
* elflink.c (_bfd_elf_create_dynamic_sections): For a loaded PLT,
	set SEC_ALLOC and SEC_LOAD.
2004-10-19 06:02:46 +00:00
Daniel Jacobowitz b58f81aef6 bfd/
* bfd-in2.h: Regenerate.
	* bfd.c (struct bfd): Add no_export.
	* elflink.c (elf_link_add_object_symbols): Handle no_export.
ld/
	* ldlang.c (struct excluded_lib, excluded_libs, add_excluded_libs)
	(check_excluded_libs): New.
	(load_symbols): Call check_excluded_libs.
	* ldlang.h (add_excluded_libs): New prototype.
	* emultempl/elf32.em (OPTION_EXCLUDED_LIBS): Define.
	(gld${EMULATION_NAME}_add_options): Add --exclude-libs.
	(gld${EMULATION_NAME}_handle_option): Handle --exclude-libs.
	* ld.texinfo (Command Line Variables): Document --exclude-libs.
	(Options Specific to i386 PE Targets): Remove --exclude-libs.
ld/testsuite/
	* ld-elf/exclude1.s, ld-elf/exclude2.s, ld-elf/exclude.exp: New.
2004-10-16 18:13:54 +00:00
Jakub Jelinek 6d2cd2108d * elflink.c (struct already_linked_section): Removed.
(try_match_symbols_in_sections, already_linked): Removed.
	(_bfd_elf_section_already_linked): Skip ^\.gnu\.linkonce\.[^.]*\.
	prefix of section names when finding already_linked_table
	chain.  Compare section names.  Instead of calling already_linked,
	do it inline and only for sections in the same already_linked_list.
2004-10-15 05:19:19 +00:00
Alan Modra 9e66c9426b * elflink.c (enum action_discarded): New.
(elf_section_complain_discarded): Delete.
	(elf_action_discarded): New function subsuming the above and also
	controlling reloc behaviour.
	(elf_link_input_bfd): Use it.
2004-10-12 02:27:53 +00:00
Alan Modra 87e5235d04 PR 233
* elflink.c (elf_link_input_bfd): Try harder to support
	relocations against symbols in removed linkonce sections.
2004-10-11 13:29:01 +00:00
Alan Modra 029446c42d * elflink.c (elf_link_input_bfd): Revert PR 354 change. 2004-10-11 09:17:13 +00:00
Alan Modra 2ad770c380 PR 354
* elflink.c (elf_link_input_bfd): Check that relocs in SEC_ALLOC
	sections do not reference symbols in non-SEC_ALLOC sections.
2004-10-11 04:54:27 +00:00
Alan Modra 1da212d6fb PR 437
* elflink.c (elf_link_sort_relocs): Don't bomb on unusual sections.
	(_bfd_elf_link_omit_section_dynsym): Formatting.
2004-10-11 01:13:10 +00:00
Nick Clifton 8fdd7217a7 Add linker option: --warn-shared-textrel to produce warnings when adding a
DT_TEXTREL to a shared object.
2004-10-07 14:45:24 +00:00
H.J. Lu 7479dfd4de 2004-09-30 H.J. Lu <hongjiu.lu@intel.com>
PR 414
	* elflink.c (_bfd_elf_merge_symbol): Check TLS symbol.
2004-09-30 16:43:41 +00:00
Alan Modra f6e332e660 include/
* bfdlink.h (struct bfd_link_hash_entry): Move und_next into elements
	of union.
bfd/
	* ecoff.c: Update u.undef.next refs.
	* elf64-ppc.c: Likewise.
	* elflink.c: Likewise.
	* linker.c: Likewise.
	* xcofflink.c: Likewise.
ld/
	* ldexp.c (fold_name): Update u.undef.next refs.
	* emultempl/pe.em: Likewise.
	* emultempl/sunos.em: Likewise.

bfd/
	* elf-bfd.h (struct elf_link_hash_entry): Rearrange.  Add FIXME to
	dynamic_def.  Combine weakdef and elf_hash_value.  Move vtable
	fields to indirect struct.
	* elf-m10300.c: Update u.weakdef refs.
	* elf32-arm.h: Likewise.
	* elf32-cris.c: Likewise.
	* elf32-frv.c: Likewise.
	* elf32-hppa.c: Likewise.
	* elf32-i370.c: Likewise.
	* elf32-i386.c: Likewise.
	* elf32-m32r.c: Likewise.
	* elf32-m68k.c: Likewise.
	* elf32-ppc.c: Likewise.
	* elf32-s390.c: Likewise.
	* elf32-sh.c: Likewise.
	* elf32-sparc.c: Likewise.
	* elf32-vax.c: Likewise.
	* elf32-xtensa.c: Likewise.
	* elf64-alpha.c: Likewise.
	* elf64-hppa.c: Likewise.
	* elf64-ppc.c: Likewise.
	* elf64-s390.c: Likewise.
	* elf64-sh64.c: Likewise.
	* elf64-sparc.c: Likewise.
	* elf64-x86-64.c: Likewise.
	* elfxx-ia64.c: Likewise.
	* elfxx-mips.c: Likewise.
	* elflink.c: Likewise.  Also u.elf_hash_value.
	(elf_gc_propagate_vtable_entries_used): Update for h->vtable
	indirection.
	(elf_gc_smash_unused_vtentry_relocs): Likewise.
	(bfd_elf_gc_record_vtinherit): Alloc vtable.
	(bfd_elf_gc_record_vtentry): Likewise.
	* elf.c (_bfd_elf_link_hash_newfunc): Use memset.
2004-09-17 07:14:33 +00:00
Alan Modra f5385ebfb8 * elf-bfd.h (struct elf_link_hash_entry): Replace elf_link_hash_flags
with bitfields.  Make "type" and "other" bitfields too.
	(ELF_LINK_HASH_REF_REGULAR, ELF_LINK_HASH_DEF_REGULAR,
	ELF_LINK_HASH_REF_DYNAMIC, ELF_LINK_HASH_DEF_DYNAMIC,
	ELF_LINK_HASH_REF_REGULAR_NONWEAK, ELF_LINK_HASH_DYNAMIC_ADJUSTED,
	ELF_LINK_HASH_NEEDS_COPY, ELF_LINK_HASH_NEEDS_PLT, ELF_LINK_NON_ELF,
	ELF_LINK_HIDDEN, ELF_LINK_FORCED_LOCAL, ELF_LINK_HASH_MARK,
	ELF_LINK_NON_GOT_REF, ELF_LINK_DYNAMIC_DEF, ELF_LINK_DYNAMIC_WEAK,
	ELF_LINK_POINTER_EQUALITY_NEEDED): Delete.
	(ELF_COMMON_DEF_P, WILL_CALL_FINISH_DYNAMIC_SYMBOL): Update.
	* elf-hppa.h: Update all uses of elf_link_hash_flags.
	* elf-m10300.c: Likewise.
	* elf.c: Likewise.
	* elf32-arm.h: Likewise.
	* elf32-cris.c: Likewise.
	* elf32-frv.c: Likewise.
	* elf32-hppa.c: Likewise.
	* elf32-i370.c: Likewise.
	* elf32-i386.c: Likewise.
	* elf32-m32r.c: Likewise.
	* elf32-m68k.c: Likewise.
	* elf32-ppc.c: Likewise.
	* elf32-s390.c: Likewise.
	* elf32-sh-symbian.c: Likewise.
	* elf32-sh.c: Likewise.
	* elf32-sh64.c: Likewise.
	* elf32-sparc.c: Likewise.
	* elf32-vax.c: Likewise.
	* elf32-xtensa.c: Likewise.
	* elf64-alpha.c: Likewise.
	* elf64-hppa.c: Likewise.
	* elf64-ppc.c: Likewise.
	* elf64-s390.c: Likewise.
	* elf64-sh64.c: Likewise.
	* elf64-sparc.c: Likewise.
	* elf64-x86-64.c: Likewise.
	* elflink.c: Likewise.
	* elfxx-ia64.c: Likewise.
	* elfxx-mips.c: Likewise.
	* configure.in (AM_INIT_AUTOMAKE): Set version to 2.15.92.
	* configure: Regenerate.
	* aclocal.m4: Regenerate.
2004-09-16 14:52:12 +00:00
Alan Modra ee75fd9567 * elf64-ppc.c (struct ppc_link_hash_table): Add stub_globals.
(is_ppc64_elf_target): Rename from is_ppc64_target.  Update all
	callers.
	(ppc_stub_name): Remove trailing "+0" on stub name.
	(create_linkage_sections): Create relocations for
	branch lookup table when --emit-relocs as well as when --shared.
	(ppc_build_one_stub): Emit relocs for long branch stubs.  Adjust
	relbrlt test.  For --emit-stub-syms, always output a sym even when
	one already exists on a plt call stub.  Put stub type in the stub
	symbol name.
	(ppc_size_one_stub): Size long branch stub relocs.  Adjust relbrlt
	test.
	(ppc64_elf_size_stubs): Count global sym stubs added.  Zero
	reloc_count in stub sections.  Adjust relbrlt test.
	(ppc64_elf_build_stubs): Adjust relbrlt test.  Tweak stats output.
	* elflink.c (bfd_elf_size_dynamic_sections): Fix comment typo.
	(elf_link_input_bfd): Ignore symbol index zero relocs when checking
	for relocs against discarded symbols.  Fix comments.
2004-09-07 13:40:37 +00:00
Nick Clifton 9a0789ec7d (elf_link_add_object_symbols): Set the error code to bfd_error_wrong_format when
the input format does not match the output format.
2004-09-06 17:24:32 +00:00
Mark Mitchell e5a52504a5 * config.bfd (arm*-*-symbianelf*): Use OS-specific target vectors.
* configure.in (bfd_elf32_bigarm_symbian_vec): Add it.
	(bfd_elf32_littlearm_symbian_vec): Likewise.
	* configure: Regenerated.
	* elf-bfd.h (elf_backend_data): Add dynamic_sec_flags.
	* elf32-arm.h (PLT_HEADER_SIZE): Do not define.
	(PLT_ENTRY_SIZE): Likewise.
	(bfd_vma_elf32_arm_symbian_plt_entry): New
	variable.
	(elf32_arm_link_hash_table): Add plt_header_size, plt_entry_size,
	and symbian_p.
	(create_got_section): Don't create sections when generating BPABI
	objects.
	(elf32_arm_create_dynamic_sections): Tidy.
	(elf32_arm_link_hash_table_create): Set plt_header_size,
	plt_entry_size, and symbian_p.
	(elf32_arm_check_relocs): Do not mark .rel.dyn as loadable when
	generating BPABI objects.
	(allocate_dynrelocs): Use htab->plt_header_size, not
	PLT_HEADER_SIZE.  Do not add to .got.plt when
	generating BPABI objects.
	(elf32_arm_finish_dynamic_symbol): Generate Symbian OS PLTs.
	* elfarm-nabi.c: Add SymbianOS target vectors.
	* elflink.c (_bfd_elf_create_got_section): Use dynamic_sec_flags.
	(_bfd_elf_link_create_dynamic_sections): Likewise.
	* elfxx-target.h (ELF_DYNAMIC_SEC_FLAGS): New macro.
	(elfNN_bed): Use it.
	* targets.c (bfd_elf32_bigarm_symbian_vec): New variable.
	(bfd_elf32_littlearm_symbian_vec): Likewise.
	(_bfd_target_vector): Add them.

	* Makefile.am (TARG_ENV_HFILES): Add te-symbian.h.
	* Makefile.in: Regenerated.
	* configure.in: Set em for arm*-*-symbianelf*.
	* configure: Regenerated.
	* config/tc-arm.c (elf32_arm_target_format): Use Symbian target
	vectors when appropriate.
	* config/te-symbian.h: New file.

	* Makefile.am (ALL_EMULATIONS): Add earmsymbian.o.
	(earmsymbian.c): New target.
	* configure.tgt: Use armsymbian emulation for arm*-*-symbianelf*.
	* Makefile.in: Regenerated.
	* aclocal.m4: Likewise.
	* configure: Likewise.
	* emulparams/armsymbian.sh: New file.
2004-09-03 17:15:44 +00:00
Daniel Jacobowitz ea5158d820 * elflink.c (_bfd_elf_section_already_linked): Handle
SEC_LINK_DUPLICATES_SAME_CONTENTS.
2004-08-21 01:13:22 +00:00
Alan Modra a010d60faf PR 338
* elflink.c (bfd_elf_record_link_assignment): Add comment about
	changing bfd_link_hash_undefined to bfd_link_hash_new.
	* ldexp.c (fold_name): Don't call bfd_link_add_undef if the symbol
	was already on the undefs list.
2004-08-18 02:45:43 +00:00
Alan Modra 7c2c850509 * elflink.h (elf_gc_sweep): Keep non-alloc, non-load sections. 2004-08-17 08:51:07 +00:00
Alan Modra 327c1315a0 * elflink.c (elf_section_complain_discarded): Ignore .fixup. 2004-08-16 01:17:58 +00:00
Alan Modra d003868ea7 bfd/
* bfd.c (_bfd_default_error_handler): Handle %A and %B.
	(bfd_archive_filename, bfd_get_section_ident): Delete.
	* ecofflink.c (bfd_ecoff_debug_accumulate_other): Don't call
	bfd_archive_filename.
	* elflink.c (elf_link_input_bfd): Don't use callbacks->error_handler
	to warn about symbols in discarded sections.  Use _bfd_error_handler.
	* aout-adobe.c (aout_adobe_callback): See below.
	* aout-cris.c (swap_ext_reloc_in): ..
	* coff-arm.c (find_thumb_glue, find_arm_glue,
	coff_arm_relocate_section, bfd_arm_process_before_allocation,
	coff_arm_merge_private_bfd_data, _bfd_coff_arm_set_private_flags,
	coff_arm_copy_private_bfd_data): ..
	* coff-i860.c (i860_reloc_processing): ..
	* coff-mcore.c (mcore_coff_unsupported_reloc,
	coff_mcore_relocate_section): ..
	* coff-ppc.c (coff_ppc_relocate_section): ..
	* coff-rs6000.c (xcoff_create_csect_from_smclas
	* coff-sh.c (sh_relax_section, sh_relax_delete_bytes,
	sh_swap_insns, sh_relocate_section): ..
	* coff-tic54x.c (tic54x_reloc_processing): ..
	* coff-tic80.c (coff_tic80_relocate_section): ..
	* coff64-rs6000.c (xcoff64_create_csect_from_smclas): ..
	* coffcode.h (styp_to_sec_flags, coff_slurp_line_table,
	coff_slurp_symbol_table, coff_classify_symbol,
	coff_slurp_reloc_table): ..
	* coffgen.c (_bfd_coff_read_string_table): ..
	* cofflink.c (coff_link_add_symbols, _bfd_coff_link_input_bfd,
	_bfd_coff_generic_relocate_section): ..
	* cpu-arm.c (bfd_arm_merge_machines): ..
	* cpu-sh.c (sh_merge_bfd_arch): ..
	* elf-hppa.h (elf_hppa_relocate_section): ..
	* elf.c (bfd_elf_string_from_elf_section, setup_group,
	_bfd_elf_setup_group_pointers, bfd_section_from_shdr,
	assign_section_numbers, _bfd_elf_symbol_from_bfd_symbol,
	copy_private_bfd_data, _bfd_elf_validate_reloc): ..
	* elf32-arm.h (find_thumb_glue, find_arm_glue,
	bfd_elf32_arm_process_before_allocation, elf32_thumb_to_arm_stub,
	elf32_arm_to_thumb_stub, elf32_arm_final_link_relocate,
	elf32_arm_relocate_section, elf32_arm_set_private_flags,
	elf32_arm_copy_private_bfd_data, elf32_arm_merge_private_bfd_data): ..
	* elf32-cris.c (cris_elf_relocate_section, cris_elf_check_relocs,
	cris_elf_merge_private_bfd_data
	* elf32-frv.c (elf32_frv_relocate_section, elf32_frv_check_relocs): ..
	* elf32-gen.c (elf32_generic_link_add_symbols): ..
	* elf32-hppa.c (hppa_add_stub, hppa_build_one_stub,
	elf32_hppa_check_relocs, get_local_syms, final_link_relocate,
	elf32_hppa_relocate_section): ..
	* elf32-i370.c (i370_elf_merge_private_bfd_data,
	i370_elf_check_relocs, i370_elf_relocate_section): ..
	* elf32-i386.c (elf_i386_info_to_howto_rel, elf_i386_check_relocs,
	elf_i386_relocate_section): ..
	* elf32-m32r.c (m32r_elf_relocate_section,
	m32r_elf_merge_private_bfd_data): ..
	* elf32-m68hc1x.c (m68hc12_add_stub,
	_bfd_m68hc11_elf_merge_private_bfd_data): ..
	* elf32-m68k.c (elf_m68k_relocate_section): ..
	* elf32-mcore.c (mcore_elf_unsupported_reloc,
	mcore_elf_relocate_section): ..
	* elf32-ppc.c (ppc_elf_merge_private_bfd_data, bad_shared_reloc,
	ppc_elf_check_relocs, ppc_elf_relocate_section,
	ppc_elf_begin_write_processing): ..
	* elf32-s390.c (elf_s390_check_relocs, invalid_tls_insn,
	elf_s390_relocate_section): ..
	* elf32-sh-symbian.c (sh_symbian_import_as,
	sh_symbian_process_embedded_commands,
	sh_symbian_relocate_section): ..
	* elf32-sh.c (sh_elf_relax_section, sh_elf_relax_delete_bytes,
	sh_elf_swap_insns, sh_elf_relocate_section, sh_elf_check_relocs,
	sh_elf_merge_private_data): ..
	* elf32-sparc.c (elf32_sparc_check_relocs,
	elf32_sparc_relocate_section,
	elf32_sparc_merge_private_bfd_data): ..
	* elf32-v850.c (v850_elf_check_relocs,
	v850_elf_merge_private_bfd_data): ..
	* elf32-xtensa.c (elf_xtensa_check_relocs,
	elf_xtensa_relocate_section, elf_xtensa_merge_private_bfd_data): ..
	* elf64-alpha.c (elf64_alpha_relax_with_lituse,
	elf64_alpha_relax_got_load, elf64_alpha_size_got_sections,
	elf64_alpha_relocate_section_r, elf64_alpha_relocate_section): ..
	* elf64-gen.c (elf64_generic_link_add_symbols): ..
	* elf64-ppc.c (ppc64_elf_merge_private_bfd_data, ppc_add_stub,
	ppc64_elf_check_relocs, ppc64_elf_edit_opd,
	ppc64_elf_relocate_section): ..
	* elf64-s390.c (elf_s390_check_relocs, invalid_tls_insn,
	elf_s390_relocate_section): ..
	* elf64-sh64.c (sh_elf64_relocate_section): ..
	* elf64-sparc.c (sparc64_elf_check_relocs,
	sparc64_elf_add_symbol_hook, sparc64_elf_relocate_section,
	sparc64_elf_merge_private_bfd_data): ..
	* elf64-x86-64.c (elf64_x86_64_check_relocs,
	elf64_x86_64_relocate_section): ..
	* elflink.c (_bfd_elf_add_default_symbol,
	_bfd_elf_link_assign_sym_version, elf_link_read_relocs_from_section,
	_bfd_elf_link_output_relocs, elf_link_add_object_symbols,
	bfd_elf_size_dynamic_sections, elf_link_output_extsym,
	elf_get_linked_section_vma, elf_fixup_link_order,
	bfd_elf_final_link, bfd_elf_gc_record_vtinherit,
	bfd_elf_gc_record_vtinherit, _bfd_elf_section_already_linked): ..
	* elfxx-ia64.c (elfNN_ia64_relax_section,
	elfNN_ia64_relocate_section, elfNN_ia64_merge_private_bfd_data): ..
	* elfxx-mips.c (mips_elf_perform_relocation,
	_bfd_mips_elf_check_relocs,
	_bfd_mips_elf_merge_private_bfd_data): ..
	* ieee.c (ieee_slurp_external_symbols): ..
	* ihex.c (ihex_bad_byte, ihex_scan, ihex_read_section): ..
	* libbfd.c (_bfd_generic_verify_endian_match): ..
	* linker.c (_bfd_generic_link_add_one_symbol,
	_bfd_generic_section_already_linked): ..
	* pdp11.c (translate_to_native_sym_flags): ..
	* pe-mips.c (coff_pe_mips_relocate_section): ..
	* peicode.h (pe_ILF_build_a_bfd): ..
	* srec.c (srec_bad_byte): ..
	* stabs.c (_bfd_link_section_stabs): ..
	* xcofflink.c (xcoff_link_add_symbols, xcoff_link_input_bfd): ..
	Replace all uses of bfd_archive_filename and bfd_get_section_ident
	with corresponding %B and %A in _bfd_error_handler format string.
	Replace occurrences of "fprintf (stderr," with _bfd_error_handler
	calls to use %A and %B.  Fix "against symbol .. from section" and
	similar error messages.  Combine multiple _bfd_error_handler calls
	where they were separated due to bfd_archive_filename deficiencies.
	* bfd-in2.h: Regenerate.
include/
	* bfdlink.h (struct bfd_link_callbacks): Remove "error_handler".
	(LD_DEFINITION_IN_DISCARDED_SECTION): Delete.
ld/
	* ldmain.c (link_callbacks): Remove "error_handler".
	* ldmisc.c: Include elf-bfd.h.
	(vfinfo): Sort comment.  Handle %A.  Use %A instead of
	bfd_get_section_indent.
	(error_handler): Delete.
	* ldmisc.h (error_handler): Delete declaration.
2004-08-13 03:16:01 +00:00
Alan Modra 8387904def * elf-bfd.h (struct elf_backend_data): Add
elf_backend_archive_symbol_lookup.
	(_bfd_elf_archive_symbol_lookup): Declare.
	* elflink.c (_bfd_elf_archive_symbol_lookup): New function..
	(elf_link_add_archive_symbols): ..extracted from here.  Call the
	backend version.
	* elfxx-target.h (elf_backend_archive_symbol_lookup): Provide default.
	(elfNN_bed): Init new field.
	* elf64-ppc.c (elf_backend_check_directives): Define.
	(elf_backend_archive_symbol_lookup): Define.
	(struct ppc_link_hash_table): Add tls_get_add_fd.  Make tls_get_add
	a ppc_link_hash_entry pointer.
	(get_fdh): Move.
	(ppc64_elf_archive_symbol_lookup, opd_entry_value): New functions.
	(add_symbol_adjust, ppc64_elf_check_directives): New functions.
	(ppc64_elf_check_relocs, ppc64_elf_gc_mark_hook, func_desc_adjust,
	ppc64_elf_adjust_dynamic_symbol, ppc64_elf_tls_setup,
	ppc64_elf_tls_optimize, allocate_dynrelocs, ppc_type_of_stub,
	ppc_build_one_stub, ppc64_elf_size_stubs, ppc64_elf_relocate_section,
	ppc64_elf_finish_dynamic_symbol): Handle branch relocs to function
	descriptor symbols.
2004-08-09 06:02:03 +00:00
Alan Modra ccfa59eaa0 bfd/
* elf-bfd.h (_bfd_elf_gc_mark): Declare.
	* elflink.c (elf_link_input_bfd): Formatting.
	(_bfd_elf_gc_mark): Rename from elf_gc_mark and make global.  Adjust
	all callers.
	* elf64-ppc.c (struct ppc_link_hash_entry): Remove is_entry.
	(link_hash_newfunc): Don't set it.
	(ppc64_elf_copy_indirect_symbol): Nor copy it.
	(ppc64_elf_mark_entry_syms): Delete.
	(ppc64_elf_gc_mark_hook): Mark entry syms here.  Also mark opd
	sections.  Use get_opd_info.
	* elf64-ppc.h (ppc64_elf_mark_entry_syms): Delete.
ld/
	* emultempl/ppc64elf.em (ppc_after_open): Delete.
	(LDEMUL_AFTER_OPEN): Don't define.
2004-08-09 03:14:12 +00:00
H.J. Lu 185d09adc3 2004-07-30 H.J. Lu <hongjiu.lu@intel.com>
Nick Clifton  <nickc@redhat.com>

	PR 290
	* bfd.c (_bfd_default_error_handler): Make it global.

	* elf-bfd.h (elf_backend_data): Add link_order_error_handler.

	* elf.c (assign_section_numbers): Cope gracefully with sections
	which have SHF_LINK_ORDER set but no sh_link set up.
	* elflink.c (elf_get_linked_section_vma): Likewise.

	* elfxx-ia64.c (elf_backend_link_order_error_handler): New. Set
	it to NULL.

	* elfxx-target.h (elf_backend_link_order_error_handler): New.
	Set it to _bfd_default_error_handler.
	(elfNN_bed): Add elf_backend_link_order_error_handler.

	* libbfd-in.h (_bfd_default_error_handler): New.

	* libbfd.h: Regenerated.
2004-07-30 15:37:04 +00:00
H.J. Lu 3d7f7666a4 2004-07-27 H.J. Lu <hongjiu.lu@intel.com>
PR 161/251
	* elf-bfd.h (bfd_elf_section_data): Add sec_group.
	(elf_sec_group): Defined.
	(bfd_elf_match_symbols_in_sections): New prototype.
	(_bfd_elf_setup_group_pointers): Likewise.

	* elf.c (bfd_elf_discard_group): Abort.
	(bfd_elf_set_group_contents): Also include relocation sections.
	Remove zero-fill for ld -r.
	(_bfd_elf_setup_group_pointers): New function.
	(elf_sort_elf_symbol): Likewise.
	(elf_sym_name_compare): Likewise.
	(bfd_elf_match_symbols_in_sections): Likewise.

	* elfcode.h (elf_object_p): Call _bfd_elf_setup_group_pointers.

	* elflink.c (match_group_member): New.
	(elf_link_input_bfd): Check group member for discarded section.
	(try_match_symbols_in_sections): New function.
	(already_linked): Likewise.
	(_bfd_elf_section_already_linked): Support mixing comdat group
	and linkonce section.

	* libbfd-in.h (bfd_section_already_linked_table_traverse): New.
	* linker.c (bfd_section_already_linked_table_traverse): New.

	* libbfd.h: Regenerated.
2004-07-27 14:20:49 +00:00