Commit Graph

9 Commits

Author SHA1 Message Date
H.J. Lu 935bd1e079 bfd/
2009-09-24  H.J. Lu  <hongjiu.lu@intel.com>

	PR ld/10630
	* elflink.c (elf_link_output_extsym): Turn off visibility on
	local symbol.
	(bfd_elf_final_link): Turn off visibility on dynamic local
	symbol.

ld/testsuite/

2009-09-24  H.J. Lu  <hongjiu.lu@intel.com>

	PR ld/10630
	* ld-alpha/tlsbin.rd: Remove HIDDEN/.hidden on local symbols.
	* ld-alpha/tlsbinr.rd: Likewise.
	* ld-alpha/tlspic.rd: Likewise.
	* ld-cris/libdso-2.d: Likewise.
	* ld-cris/locref1.d: Likewise.
	* ld-cris/locref2.d: Likewise.
	* ld-cris/tls-e-20a.d: Likewise.
	* ld-cris/tls-e-20.d: Likewise.
	* ld-cris/tls-e-80.d: Likewise.
	* ld-cris/tls-gc-68.d: Likewise.
	* ld-cris/tls-gc-69.d: Likewise.
	* ld-cris/tls-gc-70.d: Likewise.
	* ld-cris/tls-gc-75.d: Likewise.
	* ld-cris/tls-gc-76.d: Likewise.
	* ld-cris/tls-gc-79.d: Likewise.
	* ld-cris/tls-gd-1h.d: Likewise.
	* ld-cris/tls-gd-2h.d: Likewise.
	* ld-cris/tls-ld-4.d: Likewise.
	* ld-cris/tls-ld-5.d: Likewise.
	* ld-cris/tls-ld-6.d: Likewise.
	* ld-cris/tls-ld-7.d: Likewise.
	* ld-cris/tls-ldgd-14.d: Likewise.
	* ld-cris/tls-ldgd-15.d: Likewise.
	* ld-cris/tls-local-63.d: Likewise.
	* ld-cris/tls-local-64.d: Likewise.
	* ld-elf/pr9676.rd: Likewise.
	* ld-elf/pr9679.rd: Likewise.
	* ld-elfvsb/hidden2.d: Likewise.
	* ld-i386/tlsbindesc.rd: Likewise.
	* ld-i386/tlsbin.rd: Likewise.
	* ld-i386/tlsdesc.rd: Likewise.
	* ld-i386/tlsgdesc.rd: Likewise.
	* ld-i386/tlsnopic.rd: Likewise.
	* ld-i386/tlspic.rd: Likewise.
	* ld-ia64/tlsbin.rd: Likewise.
	* ld-ia64/tlspic.rd: Likewise.
	* ld-powerpc/tlsexe32.r: Likewise.
	* ld-powerpc/tlsexe.r: Likewise.
	* ld-powerpc/tlsexetoc.r: Likewise.
	* ld-powerpc/tlsso32.r: Likewise.
	* ld-powerpc/tlsso.r: Likewise.
	* ld-powerpc/tlstocso.r: Likewise.
	* ld-s390/tlsbin_64.rd: Likewise.
	* ld-s390/tlsbin.rd: Likewise.
	* ld-s390/tlspic_64.rd: Likewise.
	* ld-s390/tlspic.rd: Likewise.
	* ld-sparc/gotop32.rd: Likewise.
	* ld-sparc/gotop64.rd: Likewise.
	* ld-sparc/tlssunbin32.rd: Likewise.
	* ld-sparc/tlssunbin64.rd: Likewise.
	* ld-sparc/tlssunnopic32.rd: Likewise.
	* ld-sparc/tlssunnopic64.rd: Likewise.
	* ld-sparc/tlssunpic32.rd: Likewise.
	* ld-sparc/tlssunpic64.rd: Likewise.
	* ld-x86-64/tlsbindesc.rd: Likewise.
	* ld-x86-64/tlsbin.rd: Likewise.
	* ld-x86-64/tlsdesc.rd: Likewise.
	* ld-x86-64/tlsgdesc.rd: Likewise.
	* ld-x86-64/tlspic.rd: Likewise.
	* ld-xtensa/tlsbin.rd: Likewise.
	* ld-xtensa/tlspic.rd: Likewise.

	* ld-elf/local1.d: New.
	* ld-elf/local1.map: Likewise.
	* ld-elf/local1.s: Likewise.
	* ld-ia64/local1.d: Likewise.
	* ld-ia64/local1.map: Likewise.
	* ld-ia64/local1.s: Likewise.
2009-09-24 15:56:52 +00:00
Alan Modra f9272224cd Tolerate some whitespace differences in readelf output. 2009-09-23 03:12:28 +00:00
Mike Frysinger c9ccd0dfa0 2007-09-29 Mike Frysinger <vapier@gentoo.org>
* ld-alpha/tlsbin.rd: Use [0-9]+ to match section header count and
	0x[0-9a-f]+ to match section header offset.  Match section indexes
	with \[[ 0-9]+\].  Use [0-9]+ to match program header count and
	0x[0-9a-f]+ to match program header offset.  Match .dynsym and
	.symtab entry counts with [0-9]+.
	* ld-alpha/tlsbinr.rd: Likewise.
	* ld-alpha/tlspic.rd: Likewise.
	* ld-i386/tlsbin.rd: Likewise.
	* ld-i386/tlsbindesc.rd: Likewise.
	* ld-i386/tlsdesc.rd: Likewise.
	* ld-i386/tlsgdesc.rd: Likewise.
	* ld-i386/tlsnopic.rd: Likewise.
	* ld-i386/tlspic.rd: Likewise.
	* ld-ia64/tlsbin.rd: Likewise.
	* ld-ia64/tlspic.rd: Likewise.
	* ld-powerpc/tlsexe.r: Likewise.
	* ld-powerpc/tlsexe32.r: Likewise.
	* ld-powerpc/tlsexetoc.r: Likewise.
	* ld-powerpc/tlsso.r: Likewise.
	* ld-powerpc/tlsso32.r: Likewise.
	* ld-powerpc/tlstocso.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-sparc/tlssunbin32.rd: Likewise.
	* ld-sparc/tlssunbin64.rd: Likewise.
	* ld-sparc/tlssunnopic32.rd: Likewise.
	* ld-sparc/tlssunnopic64.rd: Likewise.
	* ld-sparc/tlssunpic32.rd: Likewise.
	* ld-sparc/tlssunpic64.rd: Likewise.
	* ld-x86-64/tlsbin.rd: Likewise.
	* ld-x86-64/tlsbindesc.rd: Likewise.
	* ld-x86-64/tlsdesc.rd: Likewise.
	* ld-x86-64/tlsgdesc.rd: Likewise.
	* ld-x86-64/tlspic.rd: Likewise.
2007-09-30 01:33:15 +00:00
Alan Modra 74541ad4c0 bfd/
* elf-bfd.h (struct elf_link_hash_table): Reorder.  Add
	text_index_section and data_index_section.
	(struct elf_backend_data): Add elf_backend_init_index_section.
	(_bfd_elf_init_1_index_section): Declare.
	(_bfd_elf_init_2_index_sections): Declare.
	* elfxx-target.h (elf_backend_init_index_section): Define.
	(elfNN_bed): Init new field.
	* elflink.c (_bfd_elf_link_omit_section_dynsym): Keep first tls
	section and text_index_section plus data_index_section.
	(_bfd_elf_link_renumber_dynsyms): Clear dynindx on omitted sections.
	(_bfd_elf_init_1_index_section): New function.
	(_bfd_elf_init_2_index_sections): New function.
	(bfd_elf_size_dynsym_hash_dynstr): Call elf_backend_init_index_section.
	(elf_link_input_bfd): When emitting relocs, use text_index_section
	and data_index_section for removed sections.
	* elf-m10300.c (elf_backend_omit_section_dynsym): Define.
	* elf32-i386.c: Likewise.
	* elf32-m32r.c: Likewise.
	* elf32-sh.c: Likewise.
	* elf32-xstormy16.c: Likewise.
	* elf32-xtensa.c: Likewise.
	* elf64-alpha.c: Likewise.
	* elf64-hppa.c: Likewise.
	* elf64-mmix.c: Likewise.
	* elf64-sh64.c: Likewise.
	* elfxx-ia64.c: Likewise.
	* elf32-arm.c (elf32_arm_final_link_relocate): Use text_index_section
	and data_index_section sym for relocs against sections with no dynamic
	section sym.
	(elf_backend_init_index_section): Define.
	* elf32-cris.c: Similarly.
	* elf32-hppa.c: Similarly.
	* elf32-i370.c: Similarly.
	* elf32-m68k.c: Similarly.
	* elf32-mips.c: Similarly.
	* elf32-ppc.c: Similarly.
	* elf32-s390.c: Similarly.
	* elf32-sparc.c: Similarly.
	* elf32-vax.c: Similarly.
	* elf64-mips.c: Similarly.
	* elf64-ppc.c: Similarly.
	* elf64-s390.c: Similarly.
	* elf64-sparc.c: Similarly.
	* elf64-x86-64.c: Similarly.
	* elfn32-mips.c: Similarly.
	* elfxx-mips.c: Similarly.
	* elfxx-sparc.c: Similarly.
	* linker.c (fix_syms): Base symbols in removed sections on
	previous section in preference to using absolute section.

ld/
	* ldlang.c (strip_excluded_output_sections): Do strip sections
	that define syms, but don't ignore them.
	* ld.texinfo (Output Section Discarding): Revise.
	* emultempl/armcoff.em (gld${EMULATION_NAME}_finish): Always call
	finish_default.

ld/testsuite/
	Update for section sym changes.
2006-10-17 13:41:49 +00:00
Alan Modra f0b5bb34d5 bfd/
PR ld/2723
	* elflink.c (bfd_elf_final_link): Don't output section symbols
	for special ELF sections.
ld/testsuite/
Update for removal of some section syms.
2006-06-02 00:32:00 +00:00
Alan Modra 8d1d654fb4 bfd/
* elf32-cris.c (elf_cris_adjust_gotplt_to_got): Move assert later.
	* elfxx-mips.c (_bfd_mips_elf_hide_symbol): Cope with being called
	without any got section.

ld/testsuite/
	* ld-alpha/tlsbin.rd: Update.
	* ld-alpha/tlsbinr.rd: Update.
	* ld-cris/locref1.d: Update.
	* ld-cris/locref2.d: Update.
	* ld-i386/tlsbin.rd: Update.
	* ld-ia64/tlsbin.rd: Update.
	* ld-powerpc/tlsexe.r: Update.
	* ld-powerpc/tlsexe32.r: Update.
	* ld-powerpc/tlsexetoc.r: Update.
	* ld-s390/tlsbin.rd: Update.
	* ld-s390/tlsbin_64.rd: Update.
	* ld-sparc/tlssunbin32.rd: Update.
	* ld-sparc/tlssunbin64.rd: Update.
	* ld-x86-64/tlsbin.rd: Update.
2005-08-17 10:04:33 +00:00
Alan Modra 85167a847e Adjust for dynamic sym changes. 2005-08-15 15:39:48 +00:00
Jakub Jelinek 40937810e1 2005-04-14 David S. Miller <davem@davemloft.net>
bfd/
	Add TLS support for 64-bit Sparc ELF.
	*  elf64-sparc.c (sparc64_elf_dyn_relocs,
	sparc64_elf_link_hash_entry, sparc64_elf_obj_tdata): New structs.
	(GOT_UNKNOWN, GOT_NORMAL, GOT_TLD_GD, GOT_TLD_IE,
	sparc64_elf_hash_entry, sparc64_elf_tdata,
	sparc64_elf_local_got_tls_type): New defines.
	(sparc64_elf_mkobject): New function.
	(sparc64_elf_link_hash_table): Add members for dynamic linker
	sections PLT, RELPLT, DYNBSS, and RELBSS.  Add tls_ldm_got
	uion to track TLS GOT references.  Add sym_sec to cache
	mappings from local sym to section.
	(link_hash_newfunc): New function.
	(sparc64_elf_bfd_link_hash_table_create): Rename to
	sparc64_elf_link_hash_table_create for consistency.
	Pass link_hash_newfunc to _bfd_elf_link_hash_table_init.
	(sparc64_elf_create_dynamic_sections): Initialize new section
	members of sparc64_elf_link_hash_table.  Only init srelbss
	if not-shared.
	(sparc64_elf_copy_indirect_symbol, sparc64_elf_tls_transition):
	New functions.
	(SPARC_NOP): Define.
	(sparc64_elf_build_plt, sparc64_elf_plt_entry_offset,
	sparc64_elf_plt_ptr_offset): Delete.
	(sparc64_plt_entry_build): New function to build PLT entries
	gradually instread of all at once at the end of linking.
	(sparc64_elf_check_relocs): Delete dynobj, sgot, and srelgot
	local vars.  Get them from sparc64_elf_hash_table instead.
	Check early on if r_symndx is in bounds.  Handle TLS transitions.
	Account for TLS GOT references and DF_STATIC_TLS, as needed.
	For TLS relocs, record the tls_type in either
	sparc64_elf_local_got_tls_type or sparc64_elf_hash_entry as
	appropriate.  For R_SPARC_TLS_{GD,LDM}_CALL, emit a reference
	to the __tls_get_addr symbol.  For PLT relocs, track references
	via h->plt.refcount.  When R_SPARC_{PC10,PC22,PC_HH22,PC_HM10,
	PC_LM22} and h not-NULL, set h->non_got_ref.  For global data
	symbol references, count the number of relocations needed for
	that symbol.  For default switch case, don't error, this lets
	the TLS relocs not explicitly handled by this function get
	accepted.
	(sparc64_elf_gc_mark_hook, sparc64_gc_sweep_hook): New functions.
	(sparc64_elf_adjust_dynamic_symbol): Remove dynobj local var, get
	it from sparc64_elf_hash_table.  Store the real PLT offset
	in h->plt.offset, and build PLT entries one at a time.  Also
	get .dynbss section pointer from htab.
	(allocate_dynrelocs, readonly_dynrelocs,
	sparc64_omit_section_dynsym): New functions.
	(sparc64_elf_omit_section_dynsym): Use these new functions as
	helpers.
	(dtpoff_base, tpoff): New functions.
	(sparc64_elf_relocate_section): Kill dynobj, sgot, and splt
	locals, get them from sparc64_elf_hash_table.  Handle TLS
	relocations and refcounting in main relocation loop.
	(sparc64_elf_finish_dynamic_symbol): Use
	sparc64_elf_link_hash_table.  Build PLT entries as we see
	them.  Handle TLS GOT relocations.
	(sparc64_elf_finish_dynamic_sections): Get sgot and dynobj
	from sparc64_elf_hash_table.  Initialize only PLT header
	not all entries since we not build PLT entries one by one.
	(elf_backend_copy_indirect_symbol, bfd_elf64_mkobject,
	elf_backend_gc_mark_hook, elf_backend_gc_sweep_hook,
	elf_backend_can_gc_sections, elf_backend_can_refcount): Define.
ld/testsuite/
	* ld-selective/sel-dump.exp: Do not exclude sparc64-*.
	* ld-selective/selective.exp: Likewise.
	* ld-sparc/sparc.exp: Add {32,64}-bit prefix to test
	names so we know which one is failing.  Run sparc64 TLS
	tests on multi-arch sparc platforms.
	* ld-sparc/tls64.sd, ld-sparc/tlssunbin64.dd,
	ld-sparc/tlssunbin64.rd, ld/testsuite/ld-sparc/tlssunbin64.sd,
	ld-sparc/tlssunbin64.td, ld-sparc/tlssunnopic64.dd,
	ld-sparc/tlssunnopic64.rd, ld-sparc/tlssunnopic64.sd,
	ld-sparc/tlssunpic64.dd, ld-sparc/tlssunpic64.rd,
	ld-sparc/tlssunpic64.sd, ld-sparc/tlssunpic64.td): Update now
	that sparc64 ELF does support TLS.
2005-04-13 22:29:36 +00:00
Jakub Jelinek b9734f3572 bfd/
* elf32-sparc.c (_bfd_sparc_elf_howto_table): Add TLS relocs.
	(elf32_sparc_rev32_howto): New variable.
	(sparc_reloc_map): Add TLS relocs.
	(elf32_sparc_reloc_type_lookup, elf32_sparc_info_to_howto):
	Handle REV32.
	(sparc_elf_hix22_reloc, sparc_elf_lox10_reloc, elf32_sparc_mkobject):
	New functions.
	(struct elf32_sparc_dyn_relocs, struct elf32_sparc_link_hash_entry,
	struct elf32_sparc_link_hash_table):
	New structures.
	(elf32_sparc_tdata, elf32_sparc_local_got_tls_type,
	elf32_sparc_hash_table): Define.
	(link_hash_newfunc, elf32_sparc_link_hash_table_create,
	create_got_section, elf32_sparc_create_dynamic_sections,
	elf32_sparc_copy_indirect_symbol, elf32_sparc_tls_transition): New
	functions.
	(elf32_sparc_check_relocs): Handle TLS relocs.  Add dynamic reloc
	reference counting.
	(elf32_sparc_gc_sweep_hook): Likewise.
	(elf32_sparc_adjust_dynamic_symbol): Likewise.
	(elf32_sparc_size_dynamic_sections): Likewise.
	(elf32_sparc_relocate_section): Likewise.
	(allocate_dynrelocs, readonly_dynrelocs, dtpoff_base, tpoff):
	New functions.
	(elf32_sparc_object_p): Allocate backend private object data.
	(bfd_elf32_bfd_link_hash_table_create,
	elf_backend_copy_indirect_symbol, bfd_elf32_mkobject,
	elf_backend_can_refcount): Define.
	(elf_backend_create_dynamic_sections): Define to
	elf32_sparc_create_dynamic_sections.
	* reloc.c: Add SPARC TLS relocs.
	* bfd-in2.h, libbfd.h: Rebuilt.
	* elf64-sparc.c (sparc64_elf_howto_table): Add TLS relocs.
	(sparc_reloc_map): Likewise.
gas/
	* config/tc-sparc.c (sparc_ip): Handle TLS % operators.
	(tc_gen_reloc): Handle TLS relocs.
	(sparc_cons, cons_fix_new_sparc): Handle %r_tls_dtpoff.
	* config/tc-sparc.h (tc_fix_adjustable): Don't adjust TLS
	relocs.
	* config/obj-elf.c (obj_elf_section_word): Handle tls.
	(obj_elf_type): Handle tls_object.
include/
	* elf/sparc.h: Add TLS relocs.  Move R_SPARC_REV32 to 252.
ld/testsuite/
	* ld-sparc/sparc.exp: New.
	* ld-sparc/tlsg32.s: New test.
	* ld-sparc/tlsg32.sd: Likewise.
	* ld-sparc/tlsg64.s: Likewise.
	* ld-sparc/tlsg64.sd: Likewise.
	* ld-sparc/tlslib.s: Likewise.
	* ld-sparc/tlsnopic.s: Likewise.
	* ld-sparc/tlspic.s: Likewise.
	* ld-sparc/tlssunbin32.dd: Likewise.
	* ld-sparc/tlssunbin32.rd: Likewise.
	* ld-sparc/tlssunbin32.s: Likewise.
	* ld-sparc/tlssunbin32.sd: Likewise.
	* ld-sparc/tlssunbin32.td: Likewise.
	* ld-sparc/tlssunbin64.dd: Likewise.
	* ld-sparc/tlssunbin64.rd: Likewise.
	* ld-sparc/tlssunbin64.s: Likewise.
	* ld-sparc/tlssunbin64.sd: Likewise.
	* ld-sparc/tlssunbin64.td: Likewise.
	* ld-sparc/tlssunbinpic32.s: Likewise.
	* ld-sparc/tlssunbinpic64.s: Likewise.
	* ld-sparc/tlssunnopic32.dd: Likewise.
	* ld-sparc/tlssunnopic32.rd: Likewise.
	* ld-sparc/tlssunnopic32.s: Likewise.
	* ld-sparc/tlssunnopic32.sd: Likewise.
	* ld-sparc/tlssunnopic64.dd: Likewise.
	* ld-sparc/tlssunnopic64.rd: Likewise.
	* ld-sparc/tlssunnopic64.s: Likewise.
	* ld-sparc/tlssunnopic64.sd: Likewise.
	* ld-sparc/tlssunpic32.dd: Likewise.
	* ld-sparc/tlssunpic32.rd: Likewise.
	* ld-sparc/tlssunpic32.s: Likewise.
	* ld-sparc/tlssunpic32.sd: Likewise.
	* ld-sparc/tlssunpic32.td: Likewise.
	* ld-sparc/tlssunpic64.dd: Likewise.
	* ld-sparc/tlssunpic64.rd: Likewise.
	* ld-sparc/tlssunpic64.s: Likewise.
	* ld-sparc/tlssunpic64.sd: Likewise.
	* ld-sparc/tlssunpic64.td: Likewise.
2003-01-24 23:44:45 +00:00