Commit Graph

1762 Commits

Author SHA1 Message Date
Stephen Clarke 396a608385 * elf32-sh.c (elf_sh_link_hash_entry): Replace
datalabel_got_offset with union of datalabel_got
offset and refcount.
(sh_elf_link_hash_newfunc): Initialize datalabel_got.refcount.
(allocate_dynrelocs): Delete unnecessary code for
STT_DATALABEL type.  Create entry in got for
datalabel version of symbol if datalabel_got.refcount > 0.
(sh_elf_relocate_section): Use datalabel_got union.
(sh_elf_gc_sweep_hook): Pull common code to initialize
h and eh out of switch statement.  Declare seen_stt_datalabel.
Initialize it.  Decrement datalabel_got.refcount for
got relocs when seen_stt_datalabel is true.
Decrement local_got_refcounts entry for datalabel got relocs
of local symbols.
(sh_elf_copy_indirect_symbol): Copy datalabel_got field over.
(sh_elf_check_relocs): Declare seen_stt_datalabel.
Initialize it.  When seen_stt_datalabel is true, increment
datalabel_got refcount rather than got.refcount.
(sh_elf_finish_dynamic_symbol): Create relocs to
initialize got entry for datalabel version of symbol.
2002-10-14 19:29:54 +00:00
Alan Modra 6a0735efa4 * Makefile.am: Run "make dep-am".
(BFD_H_FILES): Remove version.h.
	* bfd-in.h (BFD_VERSION, BFD_VERSION_DATE, BFD_VERSION_STRING): Move..
	* version.h: ..to here.
	* configure.in (bfd_version_date): Remove.
	(AC_OUTPUT): Make bfdver.h from version.h.
	* bfd.c: #include "bfdver.h".
	* vms-hdr.c: Likewise.
	* Makefile.in: Regenerate.
	* bfd-in2.h: Regenerate.
	* configure: Regenerate.
	* po/SRC-POTFILES.in: Regenerate.
2002-10-14 12:06:04 +00:00
Alan Modra 686e4055ef * archures.c (bfd_mach_i386_i386, bfd_mach_i386_i8086,
bfd_mach_i386_i386_intel_syntax, bfd_mach_x86_64,
	bfd_mach_x86_64_intel_syntax bfd_mach_ppc, bfd_mach_ppc64,
	bfd_mach_rs6k, bfd_mach_d10v, bfd_mach_sh, bfd_mach_v850,
	bfd_mach_arc_5, bfd_mach_arc_6, bfd_mach_arc_7, bfd_mach_arc_8,
	bfd_mach_m32r, bfd_mach_frv, bfd_mach_frvsimple,
	bfd_mach_ia64_elf64, bfd_mach_ia64_elf32,
	bfd_mach_ip2022, bfd_mach_ip2022ext,
	bfd_mach_s390_31, bfd_mach_s390_64, bfd_mach_xstormy16): Renumber.
	* bfd-in2.h: Regenerate.
2002-10-14 05:16:42 +00:00
Kaz Kojima 019dca2bd0 * config.bfd (sh*eb-*-linux*, sh*-*-linux*): Add the alternative
endian vector to targ_selvecs.
2002-10-14 02:12:36 +00:00
Alexandre Oliva bce03d3da8 * elfxx-mips.c (mips_elf_calculate_relocation): Take
save_addend argument.  Don't apply the 32-bit mask to a
GPREL32 value if it's to be used in another relocation.  Don't
use forced-check computation of local_p to decide whether to
add gp0 to GPREL16 value.  Don't use only the lowest 16 bits
of the addend of a non-in-place GPREL16 relocation.
(_bfd_mips_elf_relocate_section): Pass use_saved_addend_p to
mips_elf_calculate_relocation().
2002-10-13 21:22:31 +00:00
Stephane Carrez 9b691193ef * elf32-m68hc11.c (m68hc11_elf_relax_section): Don't treat relocs
with symbols in other sections if we relaxed something;  the sections
	output offsets must be re-computed before.
2002-10-12 14:00:55 +00:00
Stephane Carrez 1f4c5b4746 * elf32-m68hc11.c (m68hc11_elf_relax_section): Update symbols
handling to use Elf_Internal_Sym.
	(m68hc11_elf_relax_delete_bytes): Likewise.
2002-10-12 13:35:25 +00:00
Kaz Kojima 5dc976556d * bfd-in2.h: Regenerate. 2002-10-11 14:28:29 +00:00
Daniel Jacobowitz af39267ef5 * Makefile.am: Run dep-am.
(BFD32_LIBS): Add simple.lo.
        (BFD32_LIBS_CFILES): Add simple.c.
        * Makefile.in: Regenerated.
        * bfd-in2.h: Regenerated.
        * simple.c: New file.
2002-10-11 13:53:33 +00:00
Alan Modra 7f6a766382 * elf64-ppc.c (edit_opd): Correct local sym adjustment. 2002-10-11 12:59:06 +00:00
Alan Modra 14a793b2f2 Fix numerous occurrences of
warning: dereferencing type-punned pointer will break strict-aliasing rules
2002-10-11 08:33:11 +00:00
Alan Modra 0be617ce13 * elf64-ppc.c (edit_opd): Only zero opd syms when function is
completely removed.
2002-10-11 04:36:13 +00:00
Stephen Clarke 0a4ef3f414 * elf32-sh.c (elf_sh_pic_plt_entry_be, elf_sh_pic_plt_entry_le):
Correct mistake in calculation of address of .got.
* elf64-sh64.c (elf_sh64_pic_plt_entry_be,
elf_sh64_pic_plt_entry_le): Likewise.
2002-10-10 21:45:14 +00:00
Stephen Clarke efacd36e84 * Makefile.am: Add entries for elf32-sh64-lin.c and
elf64-sh64-lin.c. Regenerate.
* Makefile.in: Regenerate.
* config.bfd:  Change sh64eb-*-linux* and sh64-*-linux*
to use sh64 vectors rather than sh vectors.
* configure.in: Add bfd_elf32_sh64lin_vec, bfd_elf32_sh64blin_vec,
bfd_elf64_sh64lin_vec, bfd_elf64_sh64blin_vec.
* configure: Regenerate.
* elf32-sh64-lin.c: New file.
* elf64-sh64-lin.c: New file.
* targets.c: Add bfd_elf32_sh64lin_vec, bfd_elf32_sh64blin_vec,
bfd_elf64_sh64lin_vec, bfd_elf64_sh64blin_vec.
2002-10-09 19:03:57 +00:00
H.J. Lu 299bf75951 2002-10-08 H.J. Lu <hjl@gnu.org>
* elf32-i386.c (elf_i386_relocate_section): Re-arrange the
	IE->LE transition for R_386_TLS_IE.
2002-10-08 16:11:07 +00:00
Alan Modra 51020317ee * elf64-ppc.c (edit_opd): Correct test for discarded sections. 2002-10-08 09:51:09 +00:00
Nick Clifton a8fcf37848 Don't mark relocations in excluded sections. 2002-10-07 16:27:39 +00:00
Alan Modra a6b511bd9e * elflink.h (elf_link_input_bfd): Remove BFD_VERSION_DATE dependent
code.
2002-10-07 00:14:28 +00:00
Alan Modra a16d5acb50 * elf64-ppc.c (ppc64_elf_build_stubs): Increment .glink indx. 2002-10-07 00:06:01 +00:00
Alan Modra 7c4a37eb43 * opncls.c: Formatting.
(_bfd_new_bfd): Use a smaller section hash table.
2002-10-06 09:03:06 +00:00
Alexandre Oliva 7c4ca42da5 * elfxx-mips.c (mips_elf_create_dynamic_relocation): Set the type
of the other two relocations packed with a REL32 to NONE.
2002-10-05 11:18:13 +00:00
Stephen Clarke 4989d792c8 * elf32-sh.c (elf_sh_link_hash_entry): Add gotplt_refcount.
(sh_elf_link_hash_newfunc): Initialize it.
(allocate_dynrelocs): Transfer gotplt refs from plt.refcount
to got.refcount for symbols that are forced local or when
we have direct got refs.
(sh_elf_gc_sweep_hook): Adjust gotplt_refcount.  Use it
to correctly adjust got.refcount and plt.refcount.
(sh_elf_copy_indirect_symbol): Copy gotplt_refcount across.
(sh_elf_check_relocs): Increment gotplt_refcount.
2002-10-02 21:53:40 +00:00
Jakub Jelinek 7c445aa3c8 bfd/
* elf32-i386.c (elf_i386_relocate_section): Fix
	movl foo@indntpoff, %eax IE->LE transition.
ld/testsuite/
	* ld-i386/i386.exp: Add tlsindntpoff test.
	* ld-i386/tlsindntpoff.s: New test.
	* ld-i386/tlsindntpoff.dd: New test.
2002-10-01 10:43:37 +00:00
Jakub Jelinek abcf1d5247 bfd/
* elf64-x86-64.c (elf64_x86_64_relocate_section): Change TLSGD
	sequence and its transitions.
ld/testsuite/
	* ld-x86-64/tlspic1.s: Change TLSGD sequences.
	* ld-x86-64/tlsbinpic.s: Likewise.
	* ld-x86-64/tlspic.dd: Adjust.
2002-10-01 09:15:34 +00:00
Jakub Jelinek a45bb67df2 bfd/
* elf32-i386.c (elf_i386_relocate_section): Resolve R_386_TLS_LDO_32
	to st_value + addend in non-code sections.
	* elf64-x86-64.c (elf64_x86_64_relocate_section): Resolve
	R_X86_64_DTPOFF32 to st_value + addend in non-code sections.

ld/testsuite/
	* ld-i386/i386.exp: Add tlsg test.
	* ld-i386/tlsg.s: New test.
	* ld-i386/tlsg.sd: New test.
	* ld-i386/tlsbin.dd: Change LD into LD -> LE in comments.
	* ld-i386/tlsbinpic.s: Likewise.
	* ld-x86-64/x86-64.exp: Add tlsg test.
	* ld-x86-64/tlsg.s: New test.
	* ld-x86-64/tlsg.sd: New test.
	* ld-x86-64/tlsbin.dd: Change LD into LD -> LE in comments.
	* ld-x86-64/tlsbinpic.s: Likewise.
2002-10-01 09:10:46 +00:00
Richard Sandiford 00707a0e89 [include/elf]
* mips.h (E_MIPS_MACH_4120, E_MIPS_MACH_5400, E_MIPS_MACH_5500): New.

[bfd/]
	* archures.c (bfd_mach_mips4120, bfd_mach_mips5400): New.
	(bfd_mach_mips5500): New.
	* cpu-mips.c (I_mips4120, I_mips5400, I_mips5500): New.
	(arch_info_struct): Add corresponding entries here.
	* elfxx-mips.c (_bfd_elf_mips_mach): Handle E_MIPS_MACH_4120,
	E_MIPS_MACH_5400 and E_MIPS_MACH_5500.
	(_bfd_mips_elf_final_write_processing): Handle bfd_mach_mips4120,
	bfd_mach_mips5400 and bfd_mach_mips5500.
	(_bfd_mips_elf_mach_extends_p): New function.
	(_bfd_mips_elf_merge_private_bfd_data): Use it to help merge
	the EF_MIPS_MACH flags.
	* bfd-in2.h: Regenerate.
2002-09-30 11:53:56 +00:00
Jason Thorpe 624f0b2537 * elf32-vax.c (elf_vax_size_dynamic_section): Don't strip
.got sections.
2002-09-28 23:15:50 +00:00
Alan Modra b89fe0ee4b * elf.c (map_sections_to_segments): Correct test for start of
writable section in the same page as end of read-only section.
2002-09-28 03:25:56 +00:00
Jason Thorpe b29635ba03 * elf32-vax.c (elf_vax_check_relocs): Remove unused
local_got_refcounts usage.  Remove allocation of got slot.
(elf_vax_gc_sweep_hook): Remove unused local_got_refcounts usage.
Remove de-allocation of got slot.
(elf_vax_size_dynamic_section): Fix some indentation.  Add hash
traversal for elf_vax_instantiate_got_entries.  Allow empty .got
sections to be GC'ed.
(elf_vax_instantiate_got_entries): New function.
(elf_vax_relocate_section): Simplify R_VAX_GOT32 handling.  Remove
tests that are now handled by elf_vax_instantiate_got_entries.
Assert GOT entry falls within .got section size.  Remove redundant
comparisions.  Fix comments.
2002-09-27 22:28:17 +00:00
Jakub Jelinek bffbf9406f bfd/
* reloc.c: Add x86-64 TLS relocs.
	* bfd-in2.h, libbfd.h: Rebuilt.
	* elf64-x86-64.c (x86_64_elf_howto): Fix size fields for 32-bit
	relocs.  Add TLS relocs.
	(x86_64_reloc_map): Add TLS relocs.
	(elf64_x86_64_info_to_howto): Adjust for added TLS relocs.
	(struct elf64_x86_64_link_hash_entry): Add tls_type field.
	(GOT_UNKNOWN, GOT_NORMAL, GOT_TLS_GD, GOT_TLS_IE): Define.
	(elf64_x86_64_hash_entry): Define.
	(struct elf64_x86_64_obj_tdata): New.
	(elf64_x86_64_tdata, elf64_x86_64_local_got_tls_type): Define.
	(struct elf64_x86_64_link_hash_table): Add tls_ld_got.
	(link_hash_newfunc): Initialize tls_type.
	(elf64_x86_64_link_hash_table_create): Initialize tls_ld_got.
	(elf64_x86_64_copy_indirect_symbol): Swap tls_type if necessary.
	(elf64_x86_64_mkobject): New.
	(elf64_x86_64_elf_object_p): Allocate struct elf64_x86_64_obj_tdata.
	(elf64_x86_64_tls_transition): New.
	(elf64_x86_64_check_relocs): Add r_type variable and use it.
	Handle TLS relocs.
	(elf64_x86_64_gc_sweep_hook): Handle TLS relocs.
	(allocate_dynrelocs): Allocate GOT space for TLS relocs.
	(elf64_x86_64_size_dynamic_sections): Likewise.
	(dtpoff_base, tpoff): New.
	(elf64_x86_64_relocate_section): Handle TLS relocs.
	(elf64_x86_64_finish_dynamic_symbol): Only handle non-TLS GOT
	entries.
	(bfd_elf64_mkobject): Define.

	* elf32-i386.c (elf_i386_check_relocs) [R_386_TLS_LE]: Set
	DF_STATIC_TLS if shared.
gas/
	* config/tc-i386.c (tc_i386_fix_adjustable): Add x86-64 TLS relocs.
	Define them if not BFD_ASSEMBLER.
	(lex_got): Handle @tlsgd, @dtpoff and @tpoff in 64-bit mode, add
	@tlsld.
	(md_apply_fix3): No addend for BFD_RELOC_X86_64_TLSGD,
	BFD_RELOC_X86_64_TLSLD and BFD_RELOC_X86_64_GOTTPOFF.
	(tc_gen_reloc): Handle x86-64 TLS relocs.
include/
	* elf/x86-64.h: Add TLS relocs.
ld/testsuite/
	* lib/ld-lib.exp (run_ld_link_tests): Add.
	* ld-sh/sh64/sh64.exp (run_ld_link_tests, regexp_diff,
	file_contents): Remove.
	(sh64tests): Add 6th field to the tests array.
	* ld-i386/i386.exp (run_ld_link_tests): Remove.
	* ld-x86-64/x86-64.exp: New.
	* ld-x86-64/tlsbin.dd: New test.
	* ld-x86-64/tlsbinpic.s: New test.
	* ld-x86-64/tlsbin.rd: New test.
	* ld-x86-64/tlsbin.s: New test.
	* ld-x86-64/tlsbin.sd: New test.
	* ld-x86-64/tlsbin.td: New test.
	* ld-x86-64/tlslib.s: New test.
	* ld-x86-64/tlspic1.s: New test.
	* ld-x86-64/tlspic2.s: New test.
	* ld-x86-64/tlspic.dd: New test.
	* ld-x86-64/tlspic.rd: New test.
	* ld-x86-64/tlspic.sd: New test.
	* ld-x86-64/tlspic.td: New test.
2002-09-27 19:29:18 +00:00
Thiemo Seufer 1436646065 * elfxx-mips.c (_bfd_mips_elf_fake_sections): Don't emit unneeded
empty relocation sections.
2002-09-26 09:10:57 +00:00
Alan Modra 9f951329b6 * elf64-ppc.c (ppc_build_one_stub): Don't build glink stubs here.
(ppc64_elf_build_stubs): Build them here instead.
2002-09-26 05:19:38 +00:00
Jakub Jelinek 6b3ac70943 * elf32-sparc.c (elf32_sparc_relocate_section): Put R_SPARC_RELATIVE
addend into r_addend, not *r_offset.
	(elf32_sparc_finish_dynamic_symbol): Likewise.
	* elf64-sparc.c (sparc64_elf_finish_dynamic_symbol): Clear xword at
	R_SPARC_RELATIVE's r_offset.
2002-09-24 15:54:22 +00:00
Daniel Jacobowitz 10f469bf06 Add missing ChangeLog entry 2002-09-23 21:29:27 +00:00
Nick Clifton e2f6d27741 Update to correctly decode (non-standard DWARF2) out-of-order address sequences. 2002-09-23 16:13:52 +00:00
DJ Delorie f3961b2b3d * config.bfd: For DJGPP targets, match with any cpu and any machine. 2002-09-23 11:59:34 +00:00
Alan Modra ad34bc37c1 * elf-eh-frame.c (_bfd_elf_discard_section_eh_frame): Zero relocs
for discarded FDEs.  Remove redundant assignment.
	* elflink.h (elf_bfd_discard_info): Save edited relocs.
2002-09-23 10:52:03 +00:00
H.J. Lu 82988bffc5 2002-09-22 H.J. Lu <hjl@gnu.org>
* elf64-alpha.c (elf64_alpha_merge_ind_symbols): Don't merge
	the relocation count between different .reloc sections.
2002-09-22 22:32:49 +00:00
Alan Modra 5f81912811 * elf32-ppc.c (ppc_elf_relocate_section): Allow ".sbss.*" and
".sdata.*" for R_PPC_SDAREL16, ".sbss2*" and ".sdata2*" for
	R_PPC_EMB_SDA2REL.  Similarly for R_PPC_EMB_SDA21 and
	R_PPC_EMB_RELSDA.
2002-09-21 10:09:13 +00:00
Alan Modra 5ad8645cf8 * elfcode.h (elf_slurp_reloc_table_from_section): Make "symcount"
unsigned.  Move "symcount" assignment out of loop.
	* Makefile.am: Run "make dep-am".
	* Makefile.in: Regenerate.
	* configure: Regenerate.
	* po/SRC-POTFILES.in: Regnerate.
2002-09-21 09:59:19 +00:00
Nick Clifton 759365550a (_bfd_dwarf2_find_nearest_line): If address length is zero, set it to 8 for
(non-standard) 64-bit DWARF2 formats (e.g. IRIX64).
2002-09-20 07:28:54 +00:00
H.J. Lu 2243deae67 2002-09-19 Jakub Jelinek <jakub@redhat.com>
* elf32-ppc.c (ppc_elf_finish_dynamic_symbol): Clear .got word
	even if generating R_PPC_RELATIVE reloc.
	(ppc_elf_relocate_section): Make sure relocation is performed
	if skip == -2.  Clear memory at r_offset when creating dynamic
	relocation.
2002-09-20 05:54:41 +00:00
Jakub Jelinek 37e55690c4 bfd/
* reloc.c (BFD_RELOC_386_TLS_TPOFF, BFD_RELOC_386_TLS_IE,
	BFD_RELOC_386_TLS_GOTIE): Add.
	* bfd-in2.h, libbfd.h: Rebuilt.
	* elf32-i386.c (elf_howto_table): Add R_386_TLS_TPOFF, R_386_TLS_IE
	and R_386_TLS_GOTIE.
	(elf_i386_reloc_type_lookup): Handle it.
	(struct elf_i386_link_hash_entry): Change tls_type type to unsigned
	char instead of enum, change GOT_* into defines.
	(GOT_TLS_IE_POS, GOT_TLS_IE_NEG, GOT_TLS_IE_BOTH): Define.
	(elf_i386_tls_transition): Handle R_386_TLS_IE and R_386_TLS_GOTIE.
	(elf_i386_check_relocs): Likewise.  Avoid crash if local symbol is
	accessed both as normal and TLS symbol.  Move R_386_TLS_LDM and
	R_386_PLT32 cases so that R_386_TLS_IE can fall through.
	Handle R_386_TLS_LE_32 and R_386_TLS_LE in shared libs.
	(elf_i386_gc_sweep_hook): Handle R_386_TLS_IE and R_386_TLS_GOTIE.
	Handle R_386_TLS_LE_32 and R_386_TLS_LE in shared libs.
	(allocate_dynrelocs): Allocate 2 .got and 2 .rel.got entries if
	tls_type is GOT_TLS_IE_BOTH.
	(elf_i386_size_dynamic_sections): Likewise.
	(elf_i386_relocate_section): Handle R_386_TLS_IE and R_386_TLS_GOTIE.
	Handle R_386_TLS_LE_32 and R_386_TLS_LE in shared libs.
	(elf_i386_finish_dynamic_symbol): Use tls_type & GOT_TLS_IE to catch
	all 4 GOT_TLS_* TLS types.
gas/
	* config/tc-i386.c (tc_i386_fix_adjustable): Handle
	BFD_RELOC_386_TLS_IE and BFD_RELOC_386_TLS_GOTIE.
	(BFD_RELOC_386_TLS_IE, BFD_RELOC_386_TLS_GOTIE): Define to 0
	if not defined.
	(lex_got): Handle @GOTNTPOFF and @INDNTPOFF.
	(md_apply_fix3, tc_gen_reloc): Handle BFD_RELOC_386_TLS_IE and
	BFD_RELOC_386_TLS_GOTIE.
gas/testsuite/
	* gas/i386/tlspic.s: Add tests.
	* gas/i386/tlspic.d: Regenerated.
	* gas/i386/tlsnopic.s: Add tests.
	* gas/i386/tlsnopic.d: Regenerated.
include/
	* elf/i386.h (R_386_TLS_TPOFF, R_386_TLS_IE, R_386_TLS_GOTIE):
	Define.
ld/testsuite/
	* ld-i386/i386.exp: New.
	* ld-i386/tlsbin.dd: New test.
	* ld-i386/tlsbinpic.s: New test.
	* ld-i386/tlsbin.rd: New test.
	* ld-i386/tlsbin.s: New test.
	* ld-i386/tlsbin.sd: New test.
	* ld-i386/tlsbin.td: New test.
	* ld-i386/tlslib.s: New test.
	* ld-i386/tlsnopic1.s: New test.
	* ld-i386/tlsnopic2.s: New test.
	* ld-i386/tlsnopic.dd: New test.
	* ld-i386/tlsnopic.rd: New test.
	* ld-i386/tlsnopic.sd: New test.
	* ld-i386/tlspic1.s: New test.
	* ld-i386/tlspic2.s: New test.
	* ld-i386/tlspic.dd: New test.
	* ld-i386/tlspic.rd: New test.
	* ld-i386/tlspic.sd: New test.
	* ld-i386/tlspic.td: New test.
2002-09-19 19:01:18 +00:00
Nick Clifton 8e67855b57 When examining weak symbols, follow indirect links. 2002-09-19 16:34:14 +00:00
Nick Clifton 0e327d91fa Fix error reading ECOFF information: 'ioptMax' refers to the actual *size*
of the optimization symtab, not the number of entries.
2002-09-19 15:38:36 +00:00
Nick Clifton 1c59ba3fd5 Update to correctly sign-extend 32-bit ECOFF null values (0xffffffff, -1) 2002-09-19 15:31:30 +00:00
Nick Clifton 9d7404b762 (elf32_arm_adjust_dynamic_symbol): Update ELF_LINK_HASH_NEEDS_PLT logic. 2002-09-19 14:59:51 +00:00
Jakub Jelinek ca1eb0ba30 Fix the ChangeLog entry for my last commit. 2002-09-19 11:38:22 +00:00
Daniel Jacobowitz 05a487dc8c * elfcode.h (elf_slurp_reloc_table_from_section): Check
correct relocation count.
2002-09-18 13:25:35 +00:00
Daniel Jacobowitz 1f70368c21 * bfd-in.h (bfd_get_dynamic_symcount): Define.
* bfd.c (struct _bfd): Add dynsymcount.
        * bfd-in2.h: Regenerated.
        * elf.c (_bfd_elf_canonicalize_dynamic_symtab): Set
        abfd->dynsymcount.
        * elfcode.h (elf_slurp_reloc_table_from_section): Check
        for overflow.
2002-09-18 02:39:43 +00:00