Jakub Jelinek
36af4a4e51
bfd/
...
* elflink.h (elf_link_add_object_symbols): Use !info->executable
instead of info->shared where appropriate.
(bfd_elfNN_size_dynamic_sections, elf_link_output_extsym): Likewise.
* elflink.c (_bfd_elf_create_got_section): Likewise.
(_bfd_elf_link_create_dynamic_sections): Likewise.
(_bfd_elf_link_assign_sym_version): Likewise.
* elf32-i386.c (elf_i386_size_dynamic_sections): Create .interp section
and DT_DEBUG dynamic tag even for position independent executables.
* elf32-ppc.c (ppc_elf_size_dynamic_sections): Likewise.
* elf32-s390.c (elf_s390_size_dynamic_sections: Likewise.
* elf64-ppc.c (ppc64_elf_size_dynamic_sections: Likewise.
* elf64-s390.c (elf_s390_size_dynamic_sections: Likewise.
* elf64-x86-64.c (elf64_x86_64_size_dynamic_sections: Likewise.
* elfxx-ia64.c (elfNN_ia64_size_dynamic_sections: Likewise.
* elf32-sparc.c (elf32_sparc_size_dynamic_sections: Likewise.
* elf64-alpha.c (elf64_alpha_size_dynamic_sections: Likewise.
* elf64-sparc.c (sparc64_elf_size_dynamic_sections: Likewise.
include/
* bfdlink.h (struct bfd_link_info): Add pie and executable
bits.
ld/
* lexsup.c (OPTION_PIE): Define.
(ld_options): Add -pie and --pic-executable options.
(parse_args): Handle OPTION_PIE.
* ldmain.c (main): Initialize link_info.pie and
link_info.executable.
* genscripts.sh: Generate PIE scripts.
* ld.texinfo: Document -pie and --pic-executable options.
* emultempl/elf32.em (gld${EMULATION_NAME}_after_open):
(gld${EMULATION_NAME}_place_orphan): Likewise.
(gld${EMULATION_NAME}_get_script): Include PIE scripts.
* scripttempl/elf.sc: In PIE scripts set . the same way as in
shared scripts.
* emulparams/elf_i386.sh (GENERATE_PIE_SCRIPT): Set to yes.
* emulparams/elf64_ia64.sh (GENERATE_PIE_SCRIPT): Likewise.
* emulparams/elf32ppc.sh (GENERATE_PIE_SCRIPT): Likewise.
* emulparams/elf64ppc.sh (GENERATE_PIE_SCRIPT): Likewise.
* emulparams/elf_x86_64.sh (GENERATE_PIE_SCRIPT): Likewise.
* emulparams/elf_s390.sh (GENERATE_PIE_SCRIPT): Likewise.
* emulparams/elf32_sparc.sh (GENERATE_PIE_SCRIPT): Likewise.
* emulparams/elf64_sparc.sh (GENERATE_PIE_SCRIPT): Likewise.
* emulparams/elf64alpha.sh (GENERATE_PIE_SCRIPT): Likewise.
* emulparams/elf64_s390.sh (GENERATE_PIE_SCRIPT): Likewise.
* emulparams/elf_i386.sh (GENERATE_PIE_SCRIPT): Likewise.
2003-05-30 15:50:12 +00:00
Alan Modra
45d6a902ae
* elflink.c (_bfd_elf_link_create_dynamic_sections): Move from
...
elflink.h. Replace LOG_FILE_ALIGN with bed->s->log_file_align.
(_bfd_elf_create_dynamic_sections): Use bed->s->log_file_align.
(bfd_elf_record_link_assignment): Move from elflink.h.
(_bfd_elf_merge_symbol): Likewise.
(_bfd_elf_add_default_symbol): Likewise.
(_bfd_elf_export_symbol): Likewise.
(_bfd_elf_link_find_version_dependencies): Likewise.
(_bfd_elf_link_assign_sym_version): Likewise.
(_bfd_elf_link_read_relocs): Likewise.
(_bfd_elf_link_size_reloc_section): Likewise.
(_bfd_elf_fix_symbol_flags): Likewise.
(_bfd_elf_adjust_dynamic_symbol): Likewise.
(_bfd_elf_link_sec_merge_syms): Likewise.
(elf_link_read_relocs_from_section): Likewise. Use bed->s->sizeof_rel
and bed->s->sizeof_rela.
(_bfd_elf_link_output_relocs): Likewise.
* elf-bfd.h (struct elf_size_info): Rename file_align to
log_file_align.
(struct elf_info_failed): Move from elflink.h.
(struct elf_assign_sym_version_info): Likewise.
(struct elf_find_verdep_info): Likewise.
(_bfd_elf_create_dynamic_sections): Delete duplicate declaration.
(_bfd_elf_merge_symbol, _bfd_elf_add_default_symbol,
_bfd_elf_export_symbol, _bfd_elf_link_find_version_dependencies,
_bfd_elf_link_assign_sym_version,
_bfd_elf_link_create_dynamic_sections, _bfd_elf_link_read_relocs,
_bfd_elf_link_size_reloc_section, _bfd_elf_link_output_relocs,
_bfd_elf_fix_symbol_flags, _bfd_elf_adjust_dynamic_symbol,
_bfd_elf_link_sec_merge_syms): Declare.
(bfd_elf32_link_create_dynamic_sections): Don't declare.
(_bfd_elf32_link_read_relocs): Likewise.
(bfd_elf64_link_create_dynamic_sections): Likewise.
(_bfd_elf64_link_read_relocs): Likewise.
* elflink.h: Move lots o' stuff elsewhere.
* bfd-in.h (bfd_elf32_record_link_assignment): Don't declare.
(bfd_elf64_record_link_assignment): Likewise.
(bfd_elf_record_link_assignment): Declare.
* bfd-in2.h: Regenerate.
* elfcode.h (elf_link_create_dynamic_sections): Don't declare.
(NAME(_bfd_elf,size_info)): Adjust for log_file_align.
* elf.c (_bfd_elf_init_reloc_shdr): Adjust for bed->s->log_file_align.
(assign_file_positions_for_segments): Likewise.
(assign_file_positions_except_relocs): Likewise.
(swap_out_syms, elfcore_write_note): Likewise.
* elf-m10200.c: Adjust for changed function names.
* elf-m10300.c: Likewise.
* elf32-arm.h: Likewise.
* elf32-h8300.c: Likewise.
* elf32-hppa.c: Likewise.
* elf32-ip2k.c: Likewise.
* elf32-m32r.c: Likewise.
* elf32-m68hc11.c: Likewise.
* elf32-m68hc1x.c: Likewise.
* elf32-m68k.c: Likewise.
* elf32-mips.c: Likewise.
* elf32-ppc.c: Likewise.
* elf32-sh.c: Likewise.
* elf32-v850.c: Likewise.
* elf32-xtensa.c: Likewise.
* elf64-alpha.c: Likewise.
* elf64-hppa.c: Likewise.
* elf64-mmix.c: Likewise.
* elf64-ppc.c: Likewise.
* elf64-sh64.c: Likewise.
* elfxx-ia64.c: Likewise.
* elfxx-mips.c: Likewise.
(MIPS_ELF_LOG_FILE_ALIGN): Use log_file_align.
* elf64-alpha.c (alpha_elf_size_info): Adjust for log_file_align.
* elf64-hppa.c (hppa64_elf_size_info): Likewise.
* elf64-mips.c (mips_elf64_size_info): Likewise.
* elf64-s390.c (s390_elf64_size_info): Likewise.
* elf64-sparc.c (sparc64_elf_size_info): Likewise.
2003-05-09 02:27:11 +00:00
Richard Henderson
cc13e3efe3
* elf64-alpha.c (alpha_elf_dynamic_symbol_p): Return false for an
...
executable when a symbol is defined both regular and dynamic.
2003-04-21 22:17:12 +00:00
Richard Henderson
ec1659c846
* elf64-alpha.c (elf64_alpha_relocate_section) <R_ALPHA_GPREL32>:
...
Ignore relocations against r_symndx == 0.
2003-04-09 20:08:14 +00:00
H.J. Lu
7dfb07f7c2
2003-04-09 H.J. Lu <hjl@gnu.org>
...
* elf64-alpha.c (elf64_alpha_relocate_section): Don't return
FALSE for undefined symbols.
* elfxx-ia64.c (elfNN_ia64_relocate_section): Likewise.
2003-04-09 16:19:53 +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
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
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
Richard Henderson
cc03ec8004
* elf64-alpha.c (ALPHA_ELF_LINK_HASH_PLT_LOC): New.
...
(struct alpha_elf_link_hash_entry): Add plt_old_section, plt_old_value.
(elf64_alpha_adjust_dynamic_symbol): Set them.
(elf64_alpha_size_plt_section_1): Reset them when plt entry removed.
(elf64_alpha_relax_tls_get_addr): Handle LDM relocs. Frob the
symbol index when relaxing LDM to TPREL.
(elf64_alpha_relax_section): Likewise. Allow relaxation of GD
relocs, even if the target isn't locally defined.
(elf64_alpha_check_relocs): Frob LDM reloc symndx to zero.
(elf64_alpha_relocate_section): Likewise. Force TP-relative
relocs vs symndx 0 to the tp base.
2003-01-22 00:47:58 +00:00
Richard Henderson
1bbc9cec6b
* elf64-alpha.c (alpha_dynamic_entries_for_reloc): GOTTPREL and
...
TPREL also get a reloc if shared. Remove SREL support.
(elf64_alpha_emit_dynrel): New.
(elf64_alpha_relocate_section): Use it. Resolve dynamic TPREL
and GOTTPREL relocs to local symbols against the tp base.
(elf64_alpha_finish_dynamic_symbol): Use elf64_alpha_emit_dynrel.
* elf64-alpha.c (elf64_alpha_relax_got_load): Decrement got
use count before clobbering r_type.
(elf64_alpha_relax_tls_get_addr): Don't use pos[1] if insn
ordering would mean dataflow inspection is necessary.
2003-01-21 08:59:25 +00:00
Nick Clifton
571fe01fe0
Treat elfNN_bed like other macros defined in elfxx-target.h and #undef it
...
before #define'ing it.
2003-01-20 18:06:21 +00:00
Jakub Jelinek
eecdbe5279
* elf.c (elf_sort_sections): Don't reorder .tbss.
...
(assign_file_positions_for_segments): Only adjust off/voff
for increased alignment in PT_LOAD or PT_NOTE segment,
but adjust p_filesz for .tbss too. in PT_LOAD consider
.tbss to have zero memory size.
(copy_private_bfd_data) [SECTION_SIZE]: Define.
[IS_CONTAINED_BY_VMA, IS_CONTAINED_BY_LMA]: Use it.
[INCLUDE_SECTION_IN_SEGMENT]: Only put SHF_TLS sections
into PT_TLS segment. Never put SHF_TLS sections in
segments other than PT_TLS or PT_LOAD.
* elf64-alpha.c (elf64_alpha_finish_dynamic_sections): Clear .plt
sh_entsize.
2002-12-28 21:15:35 +00:00
Alan Modra
b34976b65a
s/boolean/bfd_boolean/ s/true/TRUE/ s/false/FALSE/. Simplify
...
comparisons of bfd_boolean vars with TRUE/FALSE. Formatting.
2002-11-30 08:39:46 +00:00
Alan Modra
947216bf8f
include/elf/ChangeLog
...
* internal.h (elf32_internal_ehdr, Elf32_Internal_Ehdr,
elf64_internal_ehdr, Elf64_Internal_Ehdr, elf32_internal_phdr,
Elf32_Internal_Phdr, elf64_internal_phdr, Elf64_Internal_Phdr,
elf32_internal_shdr, Elf32_Internal_Shdr, elf64_internal_shdr,
Elf64_Internal_Shdr, elf32_internal_sym, elf64_internal_sym,
Elf32_Internal_Sym, Elf64_Internal_Sym, Elf32_Internal_Note,
elf32_internal_note, elf32_internal_rel, Elf32_Internal_Rel,
elf64_internal_rel, Elf64_Internal_Rel, elf32_internal_rela,
elf64_internal_rela, Elf32_Internal_Rela, Elf64_Internal_Rela,
elf32_internal_dyn, elf64_internal_dyn, Elf32_Internal_Dyn,
Elf64_Internal_Dyn, elf32_internal_verdef, elf64_internal_verdef,
elf32_internal_verdaux, elf64_internal_verdaux, elf32_internal_verneed,
elf64_internal_verneed, elf32_internal_vernaux, elf64_internal_vernaux,
elf32_internal_versym, elf64_internal_versym, Elf32_Internal_Verdef,
Elf64_Internal_Verdef, Elf32_Internal_Verdaux, Elf64_Internal_Verdaux,
Elf32_Internal_Verneed, Elf64_Internal_Verneed, Elf32_Internal_Vernaux,
Elf64_Internal_Vernaux, Elf32_Internal_Versym, Elf64_Internal_Versym,
Elf32_Internal_Syminfo, Elf64_Internal_Syminfo): Delete.
(Elf_Internal_Rel): Delete.
bfd/ChangeLog
* elf-bfd.h: Replace occurrences of Elf32_Internal_* and
Elf64_Internal_* with Elf_Internal_*. Replace Elf_Internal_Rel
with Elf_Internal_Rela.
* elf-hppa.h, elf-m10200.c, elf-m10300.c, elf32-arc.c, elf32-arm.h,
elf32-avr.c, elf32-cris.c, elf32-d10v.c, elf32-d30v.c, elf32-dlx.c,
elf32-fr30.c, elf32-frv.c, elf32-gen.c, elf32-h8300.c, elf32-hppa.c,
elf32-i370.c, elf32-i386.c, elf32-i860.c, elf32-i960.c, elf32-ip2k.c,
elf32-m32r.c, elf32-m68hc11.c, elf32-m68hc12.c, elf32-m68k.c,
elf32-mcore.c, elf32-mips.c, elf32-openrisc.c, elf32-or32.c,
elf32-ppc.c, elf32-s390.c, elf32-sh.c, elf32-v850.c, elf32-vax.c,
elf32-xstormy16.c, elf64-alpha.c, elf64-gen.c, elf64-hppa.c,
elf64-mips.c, elf64-mmix.c, elf64-ppc.c, elf64-s390.c, elf64-sh64.c,
elf64-sparc.c, elf64-x86-64.c, elfarm-nabi.c, elfarm-oabi.c,
elfcode.h, elflink.h, elfn32-mips.c, elfxx-ia64.c, elfxx-mips.c: Ditto.
* elf-hppa.h (elf_hppa_internal_shdr): Delete. Use Elf_Internal_Shdr
throughout instead.
* elf.c (_bfd_elf_no_info_to_howto_rel): Delete.
* elfcode.h (elf_swap_reloca_in): Pass source operand as a bfd_byte *.
Remove INLINE keyword.
(elf_swap_reloc_in): Likewise. Also clear r_addend.
(elf_swap_reloc_out, elf_swap_reloca_out): Pass destination operand
as a bfd_byte *.
(elf_write_relocs): Consolidate REL and RELA code.
(elf_slurp_reloc_table_from_section): Simplify REL code.
(NAME(_bfd_elf,size_info)): Populate reloc swap entries.
* elf-bfd.h (MAX_INT_RELS_PER_EXT_REL): Define.
* elflink.h (elf_link_read_relocs_from_section): Consolidate REL and
RELA code.
(elf_link_adjust_relocs): Likewise. Don't malloc space for temp
reloc array, use a fixed size of MAX_INT_RELS_PER_EXT_REL.
(elf_link_output_relocs): Likewise.
(elf_reloc_link_order): Likewise.
(elf_finish_pointer_linker_section): Likewise.
(struct elf_link_sort_rela): Remove union.
(elf_link_sort_cmp1): Update to suit.
(elf_link_sort_cmp2): Here too.
(elf_link_sort_relocs): Consolidate REL and RELA code. Fix memory
over-allocation for int_rels_per_ext_rel != 1 case.
* elf32-arm.h: Update all bfd_elf32_swap_reloc_out calls.
* elf32-i386.c: Likewise.
* elf32-cris.c: Likewise for bfd_elf32_swap_reloca_out.
* elf32-hppa.c, elf32-i370.c, elf32-m68k.c, elf32-ppc.c, elf32-s390.c,
elf32-sh.c, elf32-vax.c, elfxx-mips.c: Likewise.
* elf64-alpha.c: Likewise for bfd_elf64_swap_reloca_out.
* elf64-hppa.c, elf64-mips.c, elf64-ppc.c, elf64-s390.c, elf64-sh64.c,
elf64-sparc.c, elf64-x86-64.c: Likewise.
* elfxx-ia64.c: Likewise for bfd_elfNN_swap_reloca_out.
* elfxx-mips.c (sort_dynamic_relocs): Likewise for
bfd_elf32_swap_reloc_in.
* elf32-arm.h: Update elf32_arm_info_to_howto calls.
* elf32-mips.c: Likewise for mips_info_to_howto_rel.
(mips_elf64_swap_reloc_in): Zero r_addend.
(mips_elf64_be_swap_reloc_in): Likewise.
(mips_elf64_slurp_one_reloc_table): Simplify.
* elf64-alpha.c (alpha_elf_size_info): Populate reloc swap entries.
* elf64-hppa.c (hppa64_elf_size_info): Likewise.
* elf64-sparc.c (sparc64_elf_size_info): Likewise.
2002-11-28 11:55:43 +00:00
Jakub Jelinek
475c2a7e65
* elf64-alpha.c (elf64_alpha_check_relocs): Only put maybe_dynamic
...
relocs into shared lib non-allocated reloc sections.
2002-10-23 20:21:21 +00:00
Richard Henderson
2238051fb3
* Makefile.am (BFD64_BACKENDS): Remove elf64-alpha-fbsd.
...
(BFD64_BACKENDS_CFILES): Likewise.
* configure.in (bfd_elf64_alpha_freebsd_vec): Use elf64-alpha.
* elf64-alpha-fbsd.c: Remove file, move code ...
* elf64-alpha.c: ... here.
* Makefile.in, configure: Rebuild.
2002-10-15 17:14:51 +00:00
Richard Henderson
64e04ecdb7
* elf64-alpha.c (elf64_alpha_relocate_section) [BRSGP]: Increment
...
VALUE, not ADDEND.
2002-10-15 01:07:52 +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
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
562ace6b79
* elf64-alpha.c (alpha_elf_size_info): Make static.
2002-09-17 08:48:54 +00:00
David O'Brien
4ada7262d0
2002-09-16 Bruno Haible <bruno@clisp.org>
...
* elf32-i386.c: Don't defined ELF_ARCH etc. if this file is included
by a target variant implementation.
* elf64-alpha.c: Likewise.
* elf32-i386-fbsd.c: New file.
* elf64-alpha-fbsd.c: New file.
* targets.c: Support bfd_elf32_i386_freebsd_vec and
bfd_elf64_alpha_freebsd_vec.
* configure.in: Accept the vectors bfd_elf32_i386_freebsd_vec,
bfd_elf64_alpha_freebsd_vec.
* Makefile.am (BFD32_BACKENDS): Add elf32-i386-fbsd.lo.
(BFD32_BACKENDS_CFILES): Add elf32-i386-fbsd.c.
(BFD64_BACKENDS): Add elf64-alpha-fbsd.lo.
(BFD64_BACKENDS_CFILES): Add elf64-alpha-fbsd.c.
(elf32-i386-fbsd.lo, elf64-alpha-fbsd.lo): Add dependencies.
* config.bfd: For FreeBSD targets, set targ_defvec to a FreeBSD
specific targets. Define OLD_FREEBSD_ABI_LABEL if appropriate.
* config/tc-i386.h (ELF_TARGET_FORMAT): New macro.
(TARGET_FORMAT): Use ELF_TARGET_FORMAT instead of "elf32-i386".
* config/tc-i386.c (i386_target_format): Likewise.
* config/tc-alpha.h (ELF_TARGET_FORMAT): New macro.
(TARGET_FORMAT): Use ELF_TARGET_FORMAT instead of "elf64-alpha".
* emulparams/elf_i386_fbsd.sh: Set OUTPUT_FORMAT to
elf32-i386-freebsd.
* emulparams/elf64alpha_fbsd.sh: Set OUTPUT_FORMAT to
elf64-alpha-freebsd.
Approved by: Alan Modra <amodra@bigpond.net.au>
Message-ID: <20020715021113.GJ30362@bubble.sa.bigpond.net.au>
2002-09-17 02:24:40 +00:00
Jason Thorpe
c0647bfc65
* elf64-alpha.c (elf64_alpha_size_dynamic_sections): Only insert
...
DT_PLTGOT into the dynamic section if there is a PLT.
2002-07-20 04:09:30 +00:00
Alan Modra
6cdc0ccc12
* elf-bfd.h (struct elf_reloc_cookie): Remove locsym_shndx,
...
change type of locsyms.
(bfd_elf_get_elf_syms): Declare.
* elf.c (bfd_elf_get_elf_syms): New function.
(group_signature): Use bfd_elf_get_elf_syms.
(bfd_section_from_r_symndx): Likewise.
* elfcode.h (elf_slurp_symbol_table): Likewise.
* elflink.h (elf_link_is_defined_archive_symbol): Likewise.
(elf_link_add_object_symbols): Likewise. Reorganise to increase
locality of various data structures. Properly free internal relocs.
(elf_bfd_final_link): Properly free internal relocs.
(elf_link_check_versioned_symbol): Use bfd_elf_get_elf_syms.
(elf_link_input_bfd): Likewise.
(elf_gc_mark): Likewise. Properly free internal relocs.
(elf_gc_sweep): Properly free internal relocs.
(elf_reloc_symbol_deleted_p): No need to swap syms in.
(elf_bfd_discard_info): Use bfd_elf_get_elf_syms. Properly free
internal relocs.
* elf-m10200.c (mn10200_elf_relax_section): Use bfd_elf_get_elf_syms.
Properly free possibly cached info.
(mn10200_elf_relax_delete_bytes): Remove symbol swapping code.
(mn10200_elf_symbol_address_p): Pass in internal syms. Remove
symbol swapping code.
(mn10200_elf_get_relocated_section_contents): Use bfd_elf_get_elf_syms.
Properly free possibly cached info.
* elf-m10300.c (mn10300_elf_relax_section): As above for elf-m10200.c.
(mn10300_elf_relax_delete_bytes): Likewise.
(mn10300_elf_symbol_address_p): Likewise.
(mn10300_elf_get_relocated_section_contents): Likewise.
* elf32-h8300.c (elf32_h8_relax_section): As above for elf-m10200.c.
(elf32_h8_relax_delete_bytes): Likewise.
(elf32_h8_symbol_address_p): Likewise.
(elf32_h8_get_relocated_section_contents): Likewise.
* elf32-m32r.c (m32r_elf_relax_section): As above for elf-m10200.c.
(m32r_elf_relax_delete_bytes): Likewise.
(m32r_elf_get_relocated_section_contents): Likewise.
* elf32-sh.c (sh_elf_reloc_loop): Free section contents using
elf_section_data to determine whether cached.
(sh_elf_relax_section): As above for elf-m10200.c.
(sh_elf_relax_delete_bytes): Likewise.
(sh_elf_get_relocated_section_contents): Likewise.
* elf32-xstormy16.c (xstormy16_elf_relax_section): As above.
* elf64-alpha.c (elf64_alpha_relax_section): As above. Also delay
reading of local syms.
* elf64-mmix.c (mmix_elf_relax_section): Likewise.
* elf64-sh64.c (sh_elf64_get_relocated_section_contents): As above.
* elfxx-ia64.c (elfNN_ia64_relax_section): As above.
* elfxx-mips.c (_bfd_mips_elf_check_relocs): Properly free internal
relocs.
* elf32-arm.h (bfd_elf32_arm_process_before_allocation): Properly
free internal relocs and section contents. Don't read symbols.
* elf32-hppa.c (get_local_syms): Use bfd_elf_get_elf_syms.
(elf32_hppa_size_stubs): Don't free local syms.
* elf32-m68k.c (bfd_m68k_elf32_create_embedded_relocs): Delay
reading of local syms. Use bfd_elf_get_elf_syms. Properly free
possibly cached info.
* elf32-mips.c (bfd_mips_elf32_create_embedded_relocs): Likewise.
* elf64-hppa.c (elf64_hppa_check_relocs): Use bfd_elf_get_elf_syms.
* elf64-ppc.c (struct ppc_link_hash_table): Delete bfd_count and
all_local_syms.
(get_local_syms): Delete function.
(edit_opd): Use bfd_elf_get_elf_syms. Free on error exit. Cache
on exit.
(ppc64_elf_size_stubs): Use bfd_elf_get_elf_syms. Free/cache on exit.
2002-07-07 09:10:41 +00:00
Alan Modra
82e5191826
* aout-adobe.c: Don't compare against "true" or "false.
...
* aout-target.h: Likewise.
* aoutx.h: Likewise.
* archive.c: Likewise.
* bout.c: Likewise.
* cache.c: Likewise.
* coff-a29k.c: Likewise.
* coff-alpha.c: Likewise.
* coff-i386.c: Likewise.
* coff-mips.c: Likewise.
* coff-or32.c: Likewise.
* coff64-rs6000.c: Likewise.
* coffcode.h: Likewise.
* coffgen.c: Likewise.
* cpu-ns32k.c: Likewise.
* ecoff.c: Likewise.
* ecofflink.c: Likewise.
* elf.c: Likewise.
* elf32-arm.h: Likewise.
* elf32-cris.c: Likewise.
* elf32-d30v.c: Likewise.
* elf32-i386.c: Likewise.
* elf32-mcore.c: Likewise.
* elf32-ppc.c: Likewise.
* elf32-sh.c: Likewise.
* elf32-sh64.c: Likewise.
* elf32-v850.c: Likewise.
* elf64-alpha.c: Likewise.
* elf64-sh64.c: Likewise.
* elfcode.h: Likewise.
* elfcore.h: Likewise.
* elflink.h: Likewise.
* elfxx-mips.c: Likewise.
* i386os9k.c: Likewise.
* ieee.c: Likewise.
* libbfd.c: Likewise.
* linker.c: Likewise.
* mmo.c: Likewise.
* nlm32-alpha.c: Likewise.
* nlm32-i386.c: Likewise.
* nlm32-ppc.c: Likewise.
* nlm32-sparc.c: Likewise.
* nlmcode.h: Likewise.
* oasys.c: Likewise.
* pdp11.c: Likewise.
* peicode.h: Likewise.
* reloc.c: Likewise.
* som.c: Likewise.
* srec.c: Likewise.
* tekhex.c: Likewise.
* vms.c: Likewise.
* xcofflink.c: Likewise.
* elf64-sparc.c: Edit comment to not use "== false".
* aoutf1.h: Don't use "? true : false".
* ecoff.c: Likewise.
* format.c: Likewise.
* ieee.c: Likewise.
* linker.c: Likewise.
* mmo.c: Likewise.
* oasys.c: Likewise.
2002-06-25 06:21:54 +00:00
Alan Modra
9bab7074b0
Replace bfd_alloc/bfd_malloc + memset with bfd_zalloc/bfd_zmalloc
2002-06-07 15:04:49 +00:00
Alan Modra
f8ecb12b16
elf_swap_symbol_in args should be "const PTR", not "const PTR *".
2002-06-06 00:29:22 +00:00
Alan Modra
73ff0d563c
* elf-bfd.h (struct elf_size_info): Add swap_symbol_in field.
...
(bfd_elf32_swap_symbol_in): Update prototype.
(bfd_elf64_swap_symbol_in): Likewise.
* elfcode.h (elf_swap_symbol_in): Change input args to const PTR *.
(elf_slurp_symbol_table): Adjust call to elf_swap_symbol_in.
* elflink.h (elf_link_is_defined_archive_symbol): Likewise.
(elf_link_add_object_symbols): Likewise.
(elf_link_record_local_dynamic_symbol): Likewise.
(elf_link_input_bfd): Likewise.
(elf_gc_mark): Likewise.
(elf_reloc_symbol_deleted_p): Likewise.
* elf-m10200.c (mn10200_elf_relax_section): Likewise.
(mn10200_elf_relax_delete_bytes): Likewise.
(mn10200_elf_symbol_address_p): Likewise.
(mn10200_elf_get_relocated_section_contents): Likewise.
* elf-m10300.c (mn10300_elf_relax_section): Likewise.
(mn10300_elf_relax_section): Likewise.
(mn10300_elf_relax_delete_bytes): Likewise.
(mn10300_elf_symbol_address_p): Likewise.
(mn10300_elf_get_relocated_section_contents): Likewise.
* elf32-h8300.c (elf32_h8_relax_section): Likewise.
(elf32_h8_relax_delete_bytes): Likewise.
(elf32_h8_symbol_address_p): Likewise.
(elf32_h8_get_relocated_section_contents): Likewise.
* elf32-hppa.c (get_local_syms): Likewise.
* elf32-m68k.c (bfd_m68k_elf32_create_embedded_relocs): Likewise.
* elf32-mips.c (bfd_mips_elf32_create_embedded_relocs): Likewise.
* elf32-sh.c (sh_elf_relax_section): Likewise.
(sh_elf_relax_delete_bytes): Likewise.
(sh_elf_get_relocated_section_contents): Likewise.
* elf32-xstormy16.c (xstormy16_elf_relax_section): Likewise.
* elf64-alpha.c (elf64_alpha_relax_section): Likewise.
* elf64-hppa.c (elf64_hppa_check_relocs): Likewise.
* elf64-mmix.c (mmix_elf_relax_section): Likewise.
* elf64-ppc.c (get_local_syms): Likewise.
* elf64-sh64.c (sh_elf64_get_relocated_section_contents): Likewise.
* elfxx-ia64.c (elfNN_ia64_relax_section): Likewise.
* elfcode.h (NAME(_bfd_elf,size_info)): Update initialiser.
* elf64-alpha.c (alpha_elf_size_info): Likewise.
* elf64-hppa.c (hppa64_elf_size_info): Likewise.
* elf64-mips.c (mips_elf64_size_info): Likewise.
* elf64-s390.c (s390_elf64_size_info): Likewise.
* elf64-sparc.c (sparc64_elf_size_info): Likewise.
2002-06-05 13:32:02 +00:00
Alan Modra
90937f86aa
* elf.c (bfd_section_from_shdr): Make "name" const.
...
* elf-bfd.h (elf_backend_section_from_shdr): Likewise.
* elf32-i370.c (i370_elf_section_from_shdr): Likewise.
* elf32-ppc.c (ppc_elf_section_from_shdr): Likewise.
* elf32-sh64.c (sh64_backend_section_from_shdr): Likewise.
* elf32-v850.c (v850_elf_section_from_shdr): Likewise.
* elf64-alpha.c (elf64_alpha_section_from_shdr): Likewise.
* elf64-hppa.c (elf64_hppa_section_from_shdr): Likewise.
* elf64-ppc.c (ppc64_elf_section_from_shdr): Likewise.
* elfxx-ia64.c (elfNN_ia64_section_from_shdr): Likewise.
* elfxx-mips.c (_bfd_mips_elf_section_from_shdr): Likewise.
* elfxx-mips.h (_bfd_mips_elf_section_from_shdr): Likewise.
2002-06-04 00:51:08 +00:00
Kazu Hirata
cedb70c545
* elf32-arc.c: Fix formatting.
...
* elf32-arm.h: Likewise.
* elf32-cris.c: Likewise.
* elf32-dlx.c: Likewise.
* elf32-hppa.c: Likewise.
* elf32-i386.c: Likewise.
* elf32-i386qnx.c: Likewise.
* elf32-or32.c: Likewise.
* elf32-s390.c: Likewise.
* elf32-sh64.c: Likewise.
* elf32-vax.c: Likewise.
* elf32-xstormy16.c: Likewise.
* elf64-alpha.c: Likewise.
* elf64-mmix.c: Likewise.
* elf64-ppc.c: Likewise.
* elf64-s390.c: Likewise.
* elf64-sh64.c: Likewise.
* elf64-x86-64.c: Likewise.
2002-06-03 01:57:10 +00:00
Richard Henderson
048d873d69
* elf64-alpha.c (elf64_alpha_relocate_section): Don't dereference
...
null when there are no got entries for a symbol.
(elf64_alpha_relax_find_tls_segment): Rearrange to avoid
uninitialized variable warning.
2002-06-02 08:35:51 +00:00
Richard Henderson
4a67a09883
* elf64-alpha.c (elf64_alpha_relax_with_lituse): Don't test for
...
undefined symbols here.
(elf64_alpha_relax_section): Do it here. Also test for not
defined in the current module.
(elf64_alpha_relocate_section_r): Split out of ...
(elf64_alpha_relocate_section): ... here. Don't dereference
NULL when looking up local got entries.
2002-06-02 06:23:30 +00:00
Richard Henderson
f44f99a52f
* elf64-alpha.c (elf64_alpha_relax_with_lituse): Reject undefined
...
symbols from JSR relaxation.
(elf64_alpha_size_plt_section_1): New.
(elf64_alpha_calc_dynrel_sizes): Split out .rela.got bits ...
(elf64_alpha_size_rela_got_1): ... here.
(elf64_alpha_size_dynamic_sections): Split out .rela.got bits ...
(elf64_alpha_size_rela_got_section): ... here.
(elf64_alpha_size_plt_section): New.
(elf64_alpha_relax_section): Call them.
(elf64_alpha_size_got_sections): Remove output_bfd arg.
(elf64_alpha_finish_dynamic_symbol): Check gotent use_count.
2002-06-02 03:58:40 +00:00
Richard Henderson
9e756d64bb
include/elf/
...
* alpha.h (LITUSE_ALPHA_ADDR, LITUSE_ALPHA_BASE, LITUSE_ALPHA_BYTOFF,
LITUSE_ALPHA_JSR, LITUSE_ALPHA_TLSGD, LITUSE_ALPHA_TLSLDM): New.
gas/
* config/tc-alpha.c: Move LITUSE constants to "elf/alpha.h".
Rename them LITUSE_ALPHA_*.
bfd/
* elf64-alpha.c (alpha_get_dtprel_base, alpha_get_tprel_base): New.
(elf64_alpha_relocate_section): Use them. Reject LE TLS relocs
in shared libraries. Fix DTPRELHI and TPRELHI value.
(INSN_ADDQ, INSN_RDUNIQ): New.
(struct alpha_relax_info): Add symtab_hdr, tls_segment, first_gotent.
(elf64_alpha_relax_with_lituse): Return boolean. Remove irelend
argument. Reject dynamic symbols. Use LITUSE symbolic constants.
(elf64_alpha_relax_got_load): Rename from relax_without_lituse.
Handle GOTDTPREL and GOTTPREL relocations.
(elf64_alpha_relax_gprelhilo): New.
(elf64_alpha_relax_tls_get_addr): New.
(elf64_alpha_relax_find_tls_segment): New.
(elf64_alpha_relax_section): Handle TLS relocations.
(ALPHA_ELF_LINK_HASH_TLS_IE): New.
(elf64_alpha_check_relocs): Set it.
2002-06-02 02:28:45 +00:00
Richard Henderson
b646261c73
* elf64-alpha.c (elf64_alpha_relax_section): Don't store computed gp.
2002-06-01 21:56:41 +00:00
Richard Henderson
d7e41a96e6
* elf64-alpha.c: Remove dead code.
2002-06-01 21:28:59 +00:00
Richard Henderson
c853d7f69e
* elf64-alpha.c (elf64_alpha_check_relocs): Fix typo on maybe_dynamic
...
check; don't suppress dynamic relocs for non-allocated sections.
2002-06-01 21:25:33 +00:00
Richard Henderson
3765b1be13
include/elf/
...
* alpha.h (R_ALPHA_TLSGD, R_ALPHA_TLSLDM, R_ALPHA_DTPMOD64,
R_ALPHA_GOTDTPREL, R_ALPHA_DTPREL64, R_ALPHA_DTPRELHI,
R_ALPHA_DTPRELLO, R_ALPHA_DTPREL16, R_ALPHA_GOTTPREL, R_ALPHA_TPREL64,
R_ALPHA_TPRELHI, R_ALPHA_TPRELLO, R_ALPHA_TPREL16): New.
bfd/
* elf64-alpha.c (ALPHA_ELF_LINK_HASH_LU_TLSGD,
ALPHA_ELF_LINK_HASH_LU_TLSLDM, ALPHA_ELF_LINK_HASH_LU_FUNC): New.
(ALPHA_ELF_GOT_ENTRY_RELOCS_DONE): Remove.
(ALPHA_ELF_GOT_ENTRY_RELOCS_XLATED): Remove.
(struct alpha_elf_got_entry): Add reloc_type, reloc_done, reloc_xlated.
(struct alpha_elf_obj_tdata): Rename total_got_entries and
n_local_got_entries to total_got_size and local_got_size.
(elf64_alpha_howto, elf64_alpha_reloc_map): Update for TLS relocs.
(alpha_got_entry_size): New.
(elf64_alpha_relax_with_lituse): Use it.
(elf64_alpha_relax_without_lituse): Likewise.
(MAX_GOT_SIZE): Rename from MAX_GOT_ENTRIES.
(get_got_entry): New.
(elf64_alpha_check_relocs): Handle TLS relocs. Reorganize.
(elf64_alpha_adjust_dynamic_symbol): Test LU_FUNC as a mask.
(elf64_alpha_merge_ind_symbols): Check gotent->reloc_type.
(elf64_alpha_can_merge_gots, elf64_alpha_merge_gots): Likewise.
(elf64_alpha_calc_got_offsets_for_symbol): Use alpha_got_entry_size.
(elf64_alpha_calc_got_offsets): Likewise.
(alpha_dynamic_entries_for_reloc): New.
(elf64_alpha_calc_dynrel_sizes): Use it.
(elf64_alpha_size_dynamic_sections): Likewise.
(elf64_alpha_relocate_section): Handle TLS relocations.
* reloc.c: Add Alpha TLS relocations.
* bfd-in2.h, libbfd.h: Rebuild.
gas/
* expr.h (operatorT): Add O_md17..O_md32.
* config/tc-alpha.c (O_lituse_tlsgd, O_lituse_tlsldm, O_tlsgd,
O_tlsldm, O_gotdtprel, O_dtprelhi, O_dtprello, O_dtprel, O_gottprel,
O_tprelhi, O_tprello, O_tprel): New.
(USER_RELOC_P, alpha_reloc_op_tag, debug_exp): Include them.
(DUMMY_RELOC_LITUSE_TLSGD, DUMMY_RELOC_LITUSE_TLSLDM): New.
(LITUSE_TLSGD, LITUSE_TLSLDM): New.
(struct alpha_reloc_tag): Add master, saw_tlsgd, saw_tlsld,
saw_lu_tlsgd, saw_lu_tlsldm. Make multi_section_p a bit field.
(md_apply_fix3): Handle TLS relocations.
(alpha_force_relocation, alpha_fix_adjustable): Likewise.
(alpha_adjust_symtab_relocs): Sort LITERAL relocs after the
associated TLS reloc. Check lituse_tls relocs match up.
(emit_insn): Handle TLS relocations.
(ldX_op): Remove.
gas/testsuite/
* gas/alpha/elf-tls-1.s, gas/alpha/elf-tls-1.d: New.
* gas/alpha/elf-tls-2.s, gas/alpha/elf-tls-1.l: New.
* gas/alpha/elf-tls-3.s, gas/alpha/elf-tls-1.l: New.
* gas/alpha/alpha.exp: Run them.
2002-05-30 22:01:38 +00:00
Richard Henderson
84de6048cc
* elf64-alpha.c (elf64_alpha_relocate_section): Force relative relocs
...
vs SHN_UNDEF to zero.
2002-05-02 17:46:59 +00:00
Daniel Jacobowitz
e2d34d7de2
2002-04-04 Daniel Jacobowitz <drow@mvista.com>
...
* aout-adobe.c (aout_32_bfd_link_hash_table_free): Define.
* aout-target.h (MY_bfd_link_hash_table_free): Conditionally
define.
* aout-tic30.c (MY_bfd_link_hash_table_free): Likewise.
* bfd.c (bfd_link_hash_table_free): Define.
* binary.c (binary_bfd_link_hash_table_free): Define.
* bout.c (b_out_bfd_link_hash_table_free): Define.
* coff-rs6000.c (rs6000coff_vec): Include
_bfd_generic_link_hash_table_free.
(pmac_xcoff_vec): Likewise.
* coff64-rs6000.c (rs6000coff64_vec): Likewise.
(aix5coff64_vec): Likewise.
* coffcode.h (coff_bfd_link_hash_table_free): Conditionally define.
* elf-m10300.c (elf32_mn10300_link_hash_table_free): New function.
(bfd_elf32_bfd_link_hash_table_free): Define.
* elf32-hppa.c (elf32_hppa_link_hash_table_free): New function.
(bfd_elf32_bfd_link_hash_table_free): Define.
* elfxx-target.h (bfd_elfNN_bfd_link_hash_table_free): Conditionally
define.
* i386msdos.c (msdos_bfd_link_hash_table_free): Define.
* i386os9k.c (os9k_bfd_link_hash_table_free): Define.
* ieee.c (ieee_bfd_link_hash_table_free): Define.
* ihex.c (ihex_bfd_link_hash_table_free): Define.
* libbfd-in.h (_bfd_nolink_bfd_link_hash_table_free): Define.
(_bfd_generic_link_hash_table_free): Add prototype.
* libcoff-in.h (_bfd_xcoff_bfd_link_hash_table_free): Add prototype.
* libecoff.h (_bfd_ecoff_bfd_link_hash_table_free): Define.
* linker.c (_bfd_generic_link_hash_table_free): New function.
* mmo.c (mmo_bfd_link_hash_table_free): Define.
* nlm-target.h (nlm_bfd_link_hash_table_free): Define.
* oasys.c (oasys_bfd_link_hash_table_free): Define.
* ppcboot.c (ppcboot_bfd_link_hash_table_free): Define.
* som.c (som_bfd_link_hash_table_free): Define.
* srec.c (srec_bfd_link_hash_table_free): Define.
* tekhex.c (tekhex_bfd_link_hash_table_free): Define.
* versados.c (versados_bfd_link_hash_table_free): Define.
* vms.c (vms_bfd_link_hash_table_free): New function.
* xcofflink.c (_bfd_xcoff_bfd_link_hash_table_free): New function.
* coff-arm.c (coff_arm_link_hash_table_create): Use bfd_malloc
instead of bfd_alloc.
* coff-h8300.c (h8300_coff_link_hash_table_create): Likewise.
* coff-mcore.c (coff_mcore_link_hash_table_create): Likewise.
* coff-ppc.c (ppc_coff_link_hash_table_create): Likewise.
* cofflink.c (_bfd_coff_link_hash_table_create): Likewise.
* ecoff.c (_bfd_ecoff_bfd_link_hash_table_create): Likewise.
* elf-m10300.c (elf32_mn10300_link_hash_table_create): Likewise.
* elf.c (_bfd_elf_link_hash_table_create): Likewise.
* elf32-arm.h (elf32_arm_link_hash_table_create): Likewise.
* elf32-cris.c (elf_cris_link_hash_table_create): Likewise.
* elf32-hppa.c (elf32_hppa_link_hash_table_create): Likewise.
* elf32-i386.c (elf_i386_link_hash_table_create): Likewise.
* elf32-m68k.c (elf_m68k_link_hash_table_create): Likewise.
* elf32-s390.c (elf_s390_link_hash_table_create): Likewise.
* elf32-sh.c (sh_elf_link_hash_table_create): Likewise.
* elf64-alpha.c (elf64_alpha_bfd_link_hash_table_create): Likewise.
* elf64-ppc.c (ppc64_elf_link_hash_table_create): Likewise.
* elf64-s390.c (elf_s390_link_hash_table_create): Likewise.
* elf64-sh64.c (sh64_elf64_link_hash_table_create): Likewise.
* elf64-sparc.c (sparc64_elf_bfd_link_hash_table_create): Likewise.
* elf64-x86-64.c (elf64_x86_64_link_hash_table_create): Likewise.
* elfxx-mips.c (_bfd_mips_elf_link_hash_table_create): Likewise.
* linker.c (_bfd_generic_link_hash_table_create): Likewise.
* m68klinux.c (linux_link_hash_table_create): Likewise.
* sparclinux.c (linux_link_hash_table_create): Likewise.
* sunos.c (sunos_link_hash_table_create): Likewise.
* xcofflink.c (_bfd_xcoff_bfd_link_hash_table_create): Likewise.
* targets.c: Add _bfd_link_hash_table_free to xvec.
* bfd-in2.h: Regenerate.
* libbfd.h: Regenerate.
* libcoff.h: Regenerate.
2002-04-04 19:53:38 +00:00
Alan Modra
e92d460e59
* linker.c (link_action): Ignore duplicate warning syms.
...
(_bfd_generic_link_write_global_symbol): Follow warning symbol link.
* elflink.h (elf_adjust_dynstr_offsets): Likewise.
(elf_adjust_dynamic_symbol): Likewise.
(elf_export_symbol): Likewise.
(elf_link_find_version_dependencies): Likewise.
(elf_link_assign_sym_version): Likewise.
(elf_link_sec_merge_syms): Likewise.
(elf_link_output_extsym): Likewise.
(elf_gc_sweep_symbol): Likewise.
(elf_gc_propagate_vtable_entries_used): Likewise.
(elf_gc_smash_unused_vtentry_relocs): Likewise.
(elf_gc_allocate_got_offsets): Likewise.
(elf_collect_hash_codes): Likewise.
* elflink.c (elf_link_renumber_hash_table_dynsyms): Likewise.
* elf-hppa.h (elf_hppa_unmark_useless_dynamic_symbols): Likewise.
(elf_hppa_remark_useless_dynamic_symbols): Likewise.
* elf-m10300.c (elf32_mn10300_finish_hash_table_entry): Likewise.
* elf32-arm.h (elf32_arm_discard_copies): Likewise.
* elf32-cris.c (elf_cris_adjust_gotplt_to_got): Likewise.
(elf_cris_discard_excess_dso_dynamics): Likewise.
* elf32-hppa.c (clobber_millicode_symbols): Likewise.
(mark_PIC_calls): Likewise.
(allocate_plt_static): Likewise.
(allocate_dynrelocs): Likewise.
(readonly_dynrelocs): Likewise.
* elf32-i386.c (allocate_dynrelocs): Likewise.
(readonly_dynrelocs): Likewise.
* elf32-i370.c (i370_elf_adjust_dynindx): Likewise.
* elf32-m68k.c (elf_m68k_discard_copies): Likewise.
* elf32-mips.c (mips_elf_output_extsym): Likewise.
(mips_elf_sort_hash_table_f): Likewise.
(mips_elf_check_mips16_stubs): Likewise.
* elf32-s390.c (allocate_dynrelocs): Likewise.
(readonly_dynrelocs): Likewise.
* elf32-sh.c (sh_elf_discard_copies): Likewise.
* elf32-xstormy16.c (xstormy16_relax_plt_check): Likewise.
(xstormy16_relax_plt_realloc): Likewise.
* elf64-alpha.c (elf64_alpha_calc_got_offsets_for_symbol): Likewise.
(elf64_alpha_output_extsym): Likewise.
* elf64-hppa.c (elf64_hppa_mark_exported_functions): Likewise.
* elf64-mips.c (mips_elf64_sort_hash_table_f): Likewise.
(mips_elf64_check_mips16_stubs): Likewise.
(mips_elf64_output_extsym): Likewise.
* elf64-ppc.c (func_desc_adjust): Likewise.
(allocate_dynrelocs): Likewise.
(readonly_dynrelocs): Likewise.
* elf64-s390.c (allocate_dynrelocs): Likewise.
(readonly_dynrelocs): Likewise.
* elf64-sh64.c (sh64_elf64_discard_copies): Likewise.
* elf64-x86-64.c (allocate_dynrelocs): Likewise.
(readonly_dynrelocs): Likewise.
* elfxx-ia64.c (elfNN_ia64_global_dyn_sym_thunk): Likewise.
* aoutx.h (aout_link_write_other_symbol): Likewise.
* cofflink.c (_bfd_coff_write_task_globals): Likewise.
(_bfd_coff_write_global_sym): Likewise.
* i386linux.c (linux_tally_symbols): Likewise.
* m68klinux.c (linux_tally_symbols): Likewise.
* sparclinux.c (linux_tally_symbols): Likewise.
* pdp11.c (aout_link_write_other_symbol): Likewise.
* sunos.c (sunos_scan_dynamic_symbol): Likewise.
* xcofflink.c (xcoff_build_ldsyms): Likewise.
(xcoff_write_global_symbol): Likewise.
* cofflink.c (_bfd_coff_final_link): Formatting.
* cpu-mips.c (mips_compatible): Make static, prototype.
* elf32-i386.c (elf_i386_check_relocs): Formatting.
* elf32-sh.c (sh_elf_size_dynamic_sections): Likewise.
* elf64-alpha.c (elf64_alpha_output_extsym): Likewise.
* elf64-mips.c (mips_elf64_sort_hash_table): Likewise.
(mips_elf64_final_link): Likewise.
* elflink.h (elf_link_find_version_dependencies): Remove duplicate
prototype.
2002-03-28 03:27:46 +00:00
Jakub Jelinek
0bb2d96afe
* elf-eh-frame.c (_bfd_elf_discard_section_eh_frame): Enable
...
absptr -> pcrel optimization for shared libs.
Only create minimal .eh_frame_hdr if absptr FDE encoding in shared
library cannot be converted to pcrel.
(_bfd_elf_eh_frame_section_offset): Return -2 if making absptr
relative.
* elf32-i386.c (elf_i386_relocate_section): If
_bfd_elf_section_offset returned -2, skip, but make sure the
relocation is installed.
* elf32-arm.h (elf32_arm_final_link_relocate): Likewise.
* elf32-cris.c (cris_elf_relocate_section): Likewise.
* elf32-hppa.c (elf32_hppa_relocate_section): Likewise.
* elf32-i370.c (i370_elf_relocate_section): Likewise.
* elf32-m68k.c (elf_m68k_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.
* 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.
* elf64-alpha.c (elf64_alpha_relocate_section): Handle
_bfd_elf_section_offset returning -2 the same way as -1.
* elfxx-ia64.c (elfNN_ia64_install_dyn_reloc): Likewise.
* elf32-mips.c (mips_elf_create_dynamic_relocation): Add FIXME
and BFD_ASSERT.
* elf64-mips.c (mips_elf64_create_dynamic_relocation): Likewise.
2002-02-19 12:40:32 +00:00
Richard Henderson
ccf00ab6a1
* elf64-alpha.c (elf64_alpha_relocate_section) [BRSGP]: A target
...
section with no got matches any got. Simplify error generaion.
2002-02-15 21:26:05 +00:00
Alan Modra
fd96f80fc8
Support arbitrary length fill patterns.
...
* linker.c (bfd_new_link_order): Zero all fields with bfd_zalloc.
(_bfd_default_link_order): Remove bfd_fill_link_order code.
Call default_data_link_order.
(default_fill_link_order): Delete.
(default_data_link_order): New function.
* elf32-mips.c (_bfd_mips_elf_final_link): Replace occurrences
of bfd_fill_link_order with bfd_data_link_order.
* elf64-alpha.c (elf64_alpha_final_link): Likewise.
* elf64-mips.c (mips_elf64_final_link): Likewise.
2002-02-15 02:10:35 +00:00
Richard Henderson
7793f4d007
* elf64-alpha.c (elf64_alpha_howto): Add R_ALPHA_BRSGP.
...
(elf64_alpha_reloc_map, elf64_alpha_check_relocs): Likewise.
(elf64_alpha_relocate_section): Likewise.
* reloc.c (BFD_RELOC_ALPHA_BRSGP): New.
* bfd-in2.h, libbfd.h: Rebuild.
2002-02-09 22:53:53 +00:00
Richard Henderson
73896efb90
* elf64-alpha.c (elf64_alpha_check_relocs): Don't set reltext
...
for non-allocated sections.
2002-01-26 08:41:30 +00:00
Richard Henderson
8ba89f17ac
* elf64-alpha.c (elf64_alpha_adjust_dynamic_symbol): Don't suppress
...
plt entries for undefweak symbols.
2002-01-23 21:51:53 +00:00
Richard Henderson
f304919d26
* elf64-alpha.c (INSN_UNOP): Encode with RB as $sp.
2002-01-22 09:51:58 +00:00
Jakub Jelinek
ed4de5e2e0
* elf-bfd.h (elf_discarded_section): Define.
...
* elflink.h (elf_link_input_bfd): Use it.
(elf_reloc_symbol_deleted_p): Likewise.
* elf64-alpha.c (elf64_alpha_relocate_section): Don't warn about
overflows for pc relative relocs against discarded sections.
2001-12-17 22:44:12 +00:00
Alan Modra
9ad5cbcfb2
Support for more than 64k ELF sections.
...
include/elf/ChangeLog
* external.h (Elf_External_Sym_Shndx): Declare.
* internal.h (struct elf_internal_sym <st_shndx>): Make it an
unsigned int.
* common.h (SHN_BAD): Define.
bfd/ChangeLog
* configure.in: Bump bfd version.
* configure: Regenerate.
* elf-bfd.h (elf_size_info <swap_symbol_out>): Add shndx param.
(bfd_elf32_swap_symbol_in): Likewise.
(bfd_elf32_swap_symbol_out): Likewise.
(bfd_elf64_swap_symbol_in): Likewise.
(bfd_elf64_swap_symbol_out): Likewise.
(elf_reloc_cookie): Add locsym_shndx field. Make locsyms a PTR.
(elf_obj_tdata): Add num_elf_sections, symtab_shndx_hdr and
symtab_shndx_section.
(elf_numsections): Define.
(elf_symtab_shndx): Define.
* elf.c (setup_group): Use elf_numsections rather than header e_shnum.
(bfd_elf_find_section): Likewise.
(bfd_section_from_elf_index): Likewise.
(bfd_section_from_shdr): Likewise. Handle SHT_SYMTAB_SHNDX.
(bfd_section_from_r_symndx): Read symbol shndx extension, and
translate st_shndx for > SHN_HIRESERVE.
(assign_section_numbers): Skip reserved sections. Assign
symtab_shndx_section and elf_numsections. Exclude reserved
sections from e_shnum. Set up symtab_shndx_hdr.
(_bfd_elf_compute_section_file_positions): Handle symtab_shndx_hdr.
(map_sections_to_segments): Don't map eh_frame_hdr unless required.
(assign_file_positions_except_relocs): Use elf_numsections rather
than header e_shnum. Skip reserved sections and symtab_shndx_section.
(prep_headers): Set name for symtab_shndx_hdr.
(_bfd_elf_assign_file_positions_for_relocs): Use elf_numsections.
(_bfd_elf_write_object_contents): Likewise. Skip reserved sections.
(_bfd_elf_section_from_bfd_section): Check bfd_{abs,com,und}_section
first. Use elf_section_data if available. Use elf_numsections.
Start scan at index 1.
(copy_private_bfd_data ): Comment fixes.
(MAP_ONESYMTAB): Define above SHN_HIOS.
(MAP_DYNSYMTAB): Likewise.
(MAP_STRTAB): Likewise.
(MAP_SHSTRTAB): Likewise.
(MAP_SYM_SHNDX): New define.
(_bfd_elf_copy_private_symbol_data): Handle symtab_shndx_section.
(swap_out_syms): Swap out SHT_SYMTAB_SHNDX section too.
* elfcode.h (elf_swap_symbol_in): Add shndx param, and handle shndx
extension.
(elf_swap_symbol_out): Likewise.
(elf_object_p): Set elf_numsections, and use instead of e_shnum.
Initialialise reserved elf_elfsections to point at shdr[0]. Remove
redundant bfd_release calls.
(elf_slurp_symbol_table): Read symbol shndx extension, and use with
elf_swap_symbol_in. Translate st_shndx for > SHN_HIRESERVE too.
* elflink.h (elf_link_is_defined_archive_symbol): Read symbol shndx
extension, and use with elf_swap_symbol_in.
(elf_link_record_local_dynamic_symbol): Likewise.
(elf_link_add_object_symbols): Likewise. Also translate st_shndx
for elf sections > SHN_HIRESERVE.
(NAME(bfd_elf,size_dynamic_sections)): Adjust elf_swap_symbol_out
call.
(struct elf_final_link_info): Add locsym_shndx and symshndxbuf.
(elf_bfd_final_link): Allocate the above, and tidy code allocating
other buffers. Use elf_numsections instead of e_shnum. Adjust
elf_swap_symbol_out calls.
(elf_link_output_sym): Swap out symbol shndx extension too.
(elf_link_flush_output_syms): And flush them to disk.
(elf_link_output_extsym): Use SHN_BAD. Adjust elf_swap_symbol_out
calls.
(elf_gc_mark): Read symbol shndx extension, and use with
elf_swap_symbol_in.
(elf_link_input_bfd): Likewise, Translate st_shndx for elf sections
> SHN_HIRESERVE too. Use SHN_BAD.
(elf_reloc_symbol_deleted_p): Use symbol shndx extensions with
elf_swap_symbol_in. Translate st_shndx > SHN_HIRESERVE too.
(elf_bfd_discard_info): Read symbol shndx extension. Don't attempt
to continue after a bfd error.
* elf-m10200.c (mn10200_elf_relax_section): Only read local syms.
Stash them immediately to symtab_hdr->contents rather than later
in multiple places. Clean up afterwards. Read symbol shndx
extension, and use with swap_symbol_in. Translate SHN_UNDEF,
SHN_ABS, SHN_COMMON and elf sections > SHN_HIRESERVE to bfd
sections too. Remove dead code.
(mn10200_elf_relax_delete_bytes): Use symbol shndx extension
when swapping in symbols. Tidy code adjusting global syms.
Don't swap in global syms.
(mn10200_elf_symbol_address_p): Likewise. Remove extsyms param.
(mn10200_elf_get_relocated_section_contents): Read symbol shndx
extension, and use with swap_symbol_in. Rename "size" -> "amt"
to maximize code in common with other files. Translate st_shndx
for > SHN_HIRESERVE too. Remove dead code.
* elf-m10300.c (mn10300_elf_relax_section): Only read local syms.
Stash them immediately to symtab_hdr->contents rather than later
in multiple places. Clean up afterwards. Read symbol shndx
extension, and use with swap_symbol_in. Remove dead code.
(mn10300_elf_relax_delete_bytes): As for elf-m10200.c.
(mn10300_elf_symbol_address_p): Likewise.
(mn10300_elf_get_relocated_section_contents): Likewise.
* elf32-h8300.c (elf32_h8_relax_section): As for elf-m10300.c.
(elf32_h8_relax_delete_bytes): Likewise.
(elf32_h8_symbol_address_p): Likewise.
(elf32_h8_get_relocated_section_contents): Likewise.
* elf32-hppa.c (elf32_hppa_size_stubs): Read symbol shndx
extension, and use with swap_symbol_in.
* elf64-hppa.c (elf64_hppa_check_relocs): Likewise.
* elf32-i370.c (i370_elf_finish_dynamic_sections): Adjust call to
bfd_elf32_swap_symbol_out.
* elf32-m32r.c (m32r_elf_get_relocated_section_contents): Translate
elf sections > SHN_HIRESERVE too.
* elf32-m68k.c (bfd_m68k_elf32_create_embedded_relocs): Only read
local syms. Read symbol shndx extension, and use with swap_symbol_in.
* elf32-mips.c (_bfd_mips_elf_final_write_processing): Use
elf_numsections rather than header e_shnum.
* elf32-sh.c (sh_elf_relax_section): As for elf-m10300.c.
(sh_elf_relax_delete_bytes): Likewise.
(sh_elf_get_relocated_section_contents): Likewise. Only read local
symbols.
* elf32-v850.c (v850_elf_symbol_processing): Use an unsigned int to
hold section index. Use elf_numsections rather than e_shnum.
Rename "index" -> "indx" to avoid shadowing warning.
(v850_elf_add_symbol_hook): Likewise.
* elf64-alpha.c (elf64_alpha_relax_section): Only read local syms.
Read symbol shndx extension, and use with swap_symbol_in.
* elf32-xstormy16.c (xstormy16_elf_relax_section): Likewise.
Translate SHN_COMMON and elf sections > SHN_HIRESERVE too.
* elfxx-ia64.c (elfNN_ia64_relax_section): Likewise.
(elfNN_ia64_aix_add_symbol_hook): Use elf_numsections.
* elf-m10300.c (mn10300_elf_gc_mark_hook): Remove unnecessary checks
before calling bfd_section_from_elf_index on local syms.
* elf32-arm.h (elf32_arm_gc_mark_hook): Likewise.
* elf32-avr.c (elf32_avr_gc_mark_hook): Likewise.
* elf32-cris.c (cris_elf_gc_mark_hook): Likewise.
* elf32-d10v.c (elf32_d10v_gc_mark_hook): Likewise.
* elf32-fr30.c (fr30_elf_gc_mark_hook): Likewise.
* elf32-hppa.c (elf32_hppa_gc_mark_hook): Likewise.
* elf32-i386.c (elf_i386_gc_mark_hook): Likewise.
* elf32-m32r.c (m32r_elf_gc_mark_hook): Likewise.
* elf32-m68k.c (elf_m68k_gc_mark_hook): Likewise.
* elf32-mcore.c (mcore_elf_gc_mark_hook): Likewise.
* elf32-mips.c (_bfd_mips_elf_gc_mark_hook): Likewise.
* elf32-openrisc.c (openrisc_elf_gc_mark_hook): Likewise.
* elf32-ppc.c (ppc_elf_gc_mark_hook): Likewise.
* elf32-s390.c (elf_s390_gc_mark_hook): Likewise.
* elf32-sh.c (sh_elf_gc_mark_hook): Likewise.
* elf32-sparc.c (elf32_sparc_gc_mark_hook): Likewise.
* elf32-v850.c (v850_elf_gc_mark_hook): Likewise.
* elf32-xstormy16.c (xstormy16_elf_gc_mark_hook): Likewise.
* elf64-mips.c (mips_elf64_gc_mark_hook): Likewise.
* elf64-mmix.c (mmix_elf_gc_mark_hook): Likewise.
* elf64-ppc.c (ppc64_elf_gc_mark_hook): Likewise.
* elf64-s390.c (elf_s390_gc_mark_hook): Likewise.
* elf64-x86-64.c (elf64_x86_64_gc_mark_hook): Likewise.
binutils/ChangeLog
* readelf.c (symtab_shndx_hdr): New global.
(SECTION_HEADER_INDEX): Define.
(SECTION_HEADER_NUM): Define.
(SECTION_HEADER): Define.
(GET_ELF_SYMBOLS): Pass two params rather than three.
(get_32bit_elf_symbols): Take file and section args. Read and
use SHT_SYMTAB_SHNDX.
(get_64bit_elf_symbols): Likewise.
(dump_relocations): Use SECTION_HEADER to index "section_headers".
(process_section_headers): Likewise. Use SECTION_HEADER_NUM too.
Remember symtab_shdx_hdr.
(process_program_headers): Scan from index 1 for segment map.
(slurp_ia64_unwind_table): Use SECTION_HEADER to index
"section_headers".
(process_relocs): Likewise. Also adjust call to GET_ELF_SYMBOLS.
(process_unwind): Likewise.
(process_version_sections): Likewise.
(process_symbol_table): Likewise.
(display_debug_info): Likewise.
(process_dynamic_segment): Fake up a symtab section for changed
GET_ELF_SYMBOLS.
(get_symbol_index_type): Check SHN_LOOS before SHN_LORESERVE.
(process_program_headers): Kill signed/unsigned warning.
(load_debug_str): Likewise.
(display_debug_info): Likewise.
2001-12-17 00:52:35 +00:00
Jakub Jelinek
6576570080
* elf-bfd.h (enum elf_link_info_type): New.
...
(struct bfd_elf_section_data): Remove stab_info and merge_info
fields, add sec_info and sec_info_type.
(struct elf_obj_tdata): Add eh_frame_hdr field.
(_bfd_elf_discard_section_eh_frame): New prototype.
(_bfd_elf_discard_section_eh_frame_hdr): Likewise.
(_bfd_elf_eh_frame_section_offset): Likewise.
(_bfd_elf_write_section_eh_frame): Likewise.
(_bfd_elf_write_section_eh_frame_hdr): Likewise.
* Makefile.am (BFD32_BACKENDS): Add elf-eh-frame.lo.
(BFD32_BACKENDS_CFILES): Add elf-eh-frame.c.
(elf-eh-frame.lo): New.
* Makefile.in: Rebuilt.
* configure.in (elf): Add elf-eh-frame.lo.
* configure: Rebuilt.
* elf.c (_bfd_elf_print_private_bfd_data): Support PT_GNU_EH_FRAME.
(map_sections_to_segments): Create PT_GNU_EH_FRAME if requested.
(get_program_header_size): Take into account PT_GNU_EH_FRAME
segment.
(_bfd_elf_rela_local_sym): Use sec_info_type and sec_info.
(_bfd_elf_rel_local_sym): Likewise.
(_bfd_elf_section_offset): Likewise. Call
_bfd_elf_eh_frame_section_offset too.
* elfxx-ia64.c (elfNN_ia64_relocate_section): Use sec_info_type and
sec_info.
* elf64-alpha.c (elf64_alpha_relocate_section): Likewise.
* elf-eh-frame.c: New file.
* elflink.h (elf_link_add_object_symbols): Don't optimize SHF_MERGE
.stab sections. Set sec_info_type, use sec_info instead
of merge_info and stab_info.
(elf_link_create_dynamic_sections): Create .eh_frame_hdr section
if --eh-frame-hdr.
(elf_bfd_final_link): Write .eh_frame_hdr section.
(elf_link_sec_merge_syms): Use sec_info_type and sec_info.
(elf_link_input_bfd): Likewise.
Call _bfd_elf_write_section_eh_frame to write .eh_frame sections.
(elf_bfd_discard_info): Add output_bfd argument.
Call _bfd_elf_discard_section_eh_frame and
_bfd_elf_discard_section_eh_frame_hdr.
(elf_section_ignore_discarded_relocs): Use sec_info_type, not section
names.
* bfd-in.h (bfd_elf32_discard_info, bfd_elf64_discard_info): Adjust
prototypes.
* bfd-in2.h (bfd_elf32_discard_info, bfd_elf64_discard_info): Likewise.
* elf/common.h (PT_GNU_EH_FRAME): Define.
* bfdlink.h (struct bfd_link_info): Add eh_frame_hdr field.
* emultempl/elf32.em (finish): Supply output_bfd
to bfd_elf*_discard_info.
(OPTION_EH_FRAME_HDR): Define.
(longopts): Add --eh-frame-hdr.
(parse_args): Handle it.
(list_options): Add --eh-frame-hdr to help.
* emultempl/hppaelf.em (finish): Supply output_bfd
to bfd_elf*_discard_info.
* scripttempl/elf.sc (.eh_frame_hdr): Add.
* readelf.c (get_segment_type): Support PT_GNU_EH_FRAME.
2001-12-13 11:09:34 +00:00