* readelf.c (CHECK_ENTSIZE_VALUES, CHECK_ENTSIZE): Define.
(process_section_headers): Use it.
(process_relocs): Don't crash if symsec is not SHT_SYMTAB
or SHT_DYNSYM.
(process_version_sections): Use sizeof (Elf_External_Versym)
instead of sh_entsize.
2005-06-17 Jan Beulich <jbeulich@novell.com>
* bfd-in2.h (elf_x86_64_reloc_type): Add BFD_RELOC_X86_64_GOTOFF64
and BFD_RELOC_X86_64_GOTPC32.
* libbfd.h (bfd_reloc_code_real_names): Likewise.
* elf64-x86-64.c (x86_64_elf_howto_table): Add entries for
R_X86_64_PC64, R_X86_64_GOTOFF64, and R_X86_64_GOTPC32.
(x86_64_reloc_map): Add entries for R_X86_64_PC64, R_X86_64_GOTOFF64,
and R_X86_64_GOTPC32.
(elf64_x86_64_info_to_howto): Adjust bounding relocation type.
(elf64_x86_64_check_relocs): Also handle R_X86_64_PC64,
R_X86_64_GOTOFF64, and R_X86_64_GOTPC32.
(elf64_x86_64_relocate_section): Likewise.
(elf64_x86_64_gc_sweep_hook): Also handle R_X86_64_PC64.
gas/
2005-06-17 Jan Beulich <jbeulich@novell.com>
* config/tc-i386.c (reloc): Also handle BFD_RELOC_64_PCREL.
(tc_i386_fix_adjustable): Include BFD_RELOC_X86_64_GOTOFF64,
BFD_RELOC_X86_64_DTPOFF64, and BFD_RELOC_X86_64_TPOFF64.
(output_disp): Do GOTPC conversion also for BFD_RELOC_X86_64_32S
and BFD_RELOC_32_PCREL. Use BFD_RELOC_X86_64_GOTPC32 instead of
aborting.
(output_imm): Do GOTPC conversion also for BFD_RELOC_X86_64_32S.
Use BFD_RELOC_X86_64_GOTPC32 instead of aborting.
(tc_gen_reloc): Do GOTPC conversion also for BFD_RELOC_32_PCREL.
Use BFD_RELOC_X86_64_GOTPC32 instead of aborting. Also handle
BFD_RELOC_X86_64_GOTOFF64, BFD_RELOC_X86_64_GOTPC32,
BFD_RELOC_X86_64_DTPOFF64, and BFD_RELOC_X86_64_TPOFF64. Also
convert 8-byte pc-relative relocations.
(lex_got): Use BFD_RELOC_X86_64_GOTOFF64 for 64-bit @gotoff.
(i386_validate_fix): Likewise.
(x86_cons): Also handle quad values in 64-bit mode.
(i386_displacement): Also handle BFD_RELOC_X86_64_GOTOFF64.
(md_apply_fix): Include BFD_RELOC_X86_64_DTPOFF64 and
BFD_RELOC_X86_64_TPOFF64 in the TLS check. Also convert BFD_RELOC_64
to pc-relative variant. Also check for BFD_RELOC_64_PCREL.
gas/testsuite/
2005-06-17 Jan Beulich <jbeulich@novell.com>
* gas/i386/x86-64-pcrel.s: Add insn requiring 64-bit pc-relative
relocation. Add insns for all widths of non-pc-relative relocations.
* gas/i386/x86-64-pcrel.d: Adjust.
include/elf/
2005-06-17 Jan Beulich <jbeulich@novell.com>
* x86-64.h (elf_x86_64_reloc_type): Adjust comment for
R_X86_64_GOTPCREL. Add R_X86_64_PC64, R_X86_64_GOTOFF64, and
R_X86_64_GOTPC32.
(smart_rename): Mark the preserve_dates parameter as possibly being unused.
resres.c (write_res_data): Prevent a potential compile time warning by casting
the return value from fwrite.
(get_data): Add nmemb argument. Return NULL if nmemb * size
overflows. If var == NULL, allocate one extra byte and
clear it.
(slurp_rela_relocs, slurp_rel_relocs, get_32bit_program_headers,
get_64bit_program_headers, get_program_headers,
get_32bit_section_headers, get_64bit_section_headers,
get_32bit_elf_symbols, get_64bit_elf_symbols, process_section_headers,
process_section_groups, process_relocs, slurp_ia64_unwind_table,
ia64_process_unwind, slurp_hppa_unwind_table, hppa_process_unwind,
get_32bit_dynamic_section, get_64bit_dynamic_section,
process_dynamic_section, process_version_sections, get_dynamic_data,
process_symbol_table, dump_section, load_debug_str, load_debug_loc,
load_debug_range, read_and_display_attr_value, process_debug_info,
get_debug_info, frame_need_space, display_debug_frames,
display_debug_section, process_mips_specific, process_gnu_liblist,
process_corefile_note_segment): Adjust get_data callers. Use
cmalloc, xcmalloc and xcrealloc instead of {m,xm,xre}alloc where
passed size is a product of 2 numbers.
* readelf.c (print_mode): Fix comment typo.
(slurp_rela_relocs, slurp_rel_relocs): Fix memory leaks.
(dump_relocations): Fix a thinko in check for invalid st_name.
(process_program_headers): Don't crash if string_table is NULL.
(process_section_headers): Don't crash if e_shstrndx is invalid.
Ensure string_table_length is 0 if string_table == NULL.
Don't return just because string_table is NULL.
(process_section_groups): Don't crash if symtab's sh_link or
symbol's st_name is invalid. Fix a memory leak. Fix check for
invalid section number entry.
(process_relocs): Don't crash if relocation or symbol section's
sh_link is invalid.
(slurp_ia64_unwind_table, slurp_hppa_unwind_table): Don't crash if
relocation section's sh_info is invalid.
(ia64_process_unwind, hppa_process_unwind): Don't crash if symbol
table's sh_link is invalid.
(process_version_sections): Don't crash on version or symbol
section's sh_link is invalid. Don't crash if symbol's st_shndx
is invalid.
(process_symbol_table): Don't crash if string table is corrupt
or symbol's st_name, st_shndx, vna_name or vda_name is invalid.
(debug_apply_rela_addends): Don't crash if relocation section's
sh_info or sh_link is invalid.
(display_debug_loc): Warn for unterminated .debug_loc section
or start offsets not within .debug_loc section boundaries.
(process_gnu_liblist): Don't crash if liblist section's sh_link
or entry's l_name is invalid.
* Makefile.in (symfile.o): Add $(exec_h).
* exec.h (exec_set_section_address): Add prototype.
* exec.c (exec_set_section_address): New function.
* symfile.c: Include "exec.h".
(struct place_section_arg, place_section): New.
(default_symfile_offsets): Call place_section for each
section of a relocatable file.
gdb/testsuite/
* gdb.base/relocate.c: Add a copyright notice.
(dummy): Remove.
* gdb.base/relocate.exp: Test printing the values of variables
from a relocatable file.
* config/tc-arm.c (find_real_start): Check S_IS_LOCAL on
symbolP as well as for names with a leading dot. Use ACONCAT.
(md_apply_fix): For branch relocations, only replace value
with fixP->fx_offset (under #ifdef OBJ_ELF) when !fixP->fx_done.
(arm_force_relocation): Remove #ifdef OBJ_ELF case.
* config/tc-arm.h (LOCAL_LABEL): Remove unnecessary parentheses.
(LOCAL_LABEL_PREFIX): Don't define.
gas/testsuite:
* gas/arm/thumb.s: Only branch to labels defined in this file.
* gas/arm/thumb.d, gas/arm/thumb32.d: Adjust expected output.
* mi/mi-main.c (register_changed_p, get_register): Use
get_selected_frame.
(mi_execute_command): Call mi_out_rewind after an error.
testsuite/
* gdb.mi/mi-syn-frame.exp, gdb.mi/mi2-syn-frame.exp: Don't expect
excess MI output after an error.