* Makefile.am (BFD32_LIBS): Add compress.lo.
(BFD32_LIBS_CFILES): Add compress.c.
(BFD_H_FILES): Likewise.
* Makefile.in: Regenerate.
* bfd-in2.h: Regenerate.
* config.in: Add HAVE_ZLIB_H
* configure.in: Add test for libz and zlib.h
* configure: Regenerate.
* dwarf2.c (read_section): New function.
(read_indirect_string): Call new function read_section.
(read_abbrevs): Likewise.
(decode_line_info): Likewise.
(read_debug_ranges): Likewise.
(find_line): Call new function read_section when just one
.zdebug_info section is found, otherwise read and compress
multiple sections.
(_bfd_dwarf2_cleanup_debug_info): Free sec_info_ptr.
* elf.c (_bfd_elf_make_section_from_shdr): Add zdebug prefix.
(special_sections_z): New struct.
(special_sections): Refer to special_sections_z.
* elfxx-mips.c (_bfd_mips_elf_section_from_shdr): Recognize
sections named .zdebug_*.
(_bfd_mips_elf_fake_sections): Likewise.
* compress.c: New file.
(bfd_uncompress_section_contents): New function.
bfd/doc/
* Makefile.am (BFD_H_DEP): Add ../compress.c.
* Makefile.in: Regenerate.
binutils/
* config.in: Add HAVE_ZLIB_H
* configure.in: Add test for libz and zlib.h
* configure: Regenerate.
* dwarf.c (debug_displays): Add .zdebug_* strings.
* dwarf.h (struct dwarf_section): Add fields uncompressed_namd
and compressed_name.
* objdump.c (load_debug_section): Call
bfd_uncompress_section_contents when loading a compressed
section.
(dump_dwarf_section): Recognize compressed section name.
(mach_o_dwarf_sections): Rename as
mach_o_uncompressed_dwarf_sections.
(mach_o_compressed_dwarf_sections): New variable.
(generic_dwarf_section): Rename as
generic_uncompressed_dwarf_sections.
(generic_compressed_dwarf_sections): New variable.
(check_mach_o_dwarf): Save and restore
mach_o_compressed_dwarf_sections.
* readelf.c: Add #include for config.h and zlib.h
(process_section_headers): Recognize compressed section name.
(uncompress_section_contents): New function.
(load_debug_section): Call uncompress_section_contents when
loading a compressed section.
(display_debug_section): Recognize compressed section name.
binutils/testsuite:
* binutils-all/objdump.exp: Add test for objdump -s on a file
with a compressed debug section. Add test for objdump -W on a
file that contains a compressed debug section.
* binutils-all/readelf.exp: Call readelf_compressed_wa_test.
(readelf_compressed_wa_test): New function.
* binutils-all/dw2-compressed.S: New file.
* binutils-all/objdump.W: New file.
* binutils-all/objdump.s: New file.
* binutils-all/readelf.wa: New file.
display_debug_lines_raw.
(display_debug_lines_decoded): New function. Displays the
interpreted contents of a .debug_line section.
(display_debug_lines): New function: Selects either a raw dump or
a decoded dump (or both) as requested by the user.
* dwarf.h (do_debug_lines_decoded): New extern.
* readelf.c: Add support for -wL or --debug-dump=decodedline
option to display the decoded contents of a .debug_line section.
* doc/binutils.texi: Document the new option.
* NEWS: Mention the new feature.
* internal.h (Elf_Internal_Shdr): Change sh_link and sh_info from
unsigned long to unsigned int. Change sh_addralign to bfd_vma.
Order struct as for external version.
bfd/
* elf.c (_bfd_elf_make_section_from_shdr): Remove unnecessary cast.
(_bfd_elf_assign_file_position_for_section): Simplify align.
(_bfd_elf_init_reloc_shdr): Ensure shift expression wide enough
for sh_addralign.
(elf_fake_sections, swap_out_syms): Likewise.
* elflink.c (bfd_elf_final_link): Likewise.
binutils/
* readelf.c: Use %u throughout when printing sh_link or sh_info,
%lu when printing sh_addralign.
(process_version_sections): Use identical formats when printing
all offset and sh_link fields.
(display_debug_frames): Remove check in is_relocatable.
* dwarf.h (is_relocatable): Remove declaration.
* objdump.c (is_relocatable): New static definition.
* readelf.c (dump_relocations): Make the function void.
(is_32bit_abs_reloc): Add support for x86, Arc, Arm, D10V, Dlx, OR32 and Score.
(is_32bit_pcrel_reloc): Add support for x86 and Arm.
(is_16bit_abs_reloc): Add support for D10V.
(debug_apply_rela_addends): Rename to debug_apply_relocations.
Add code to support rel relocations.
(load_debug_section): Fix call to debug_apply_relocations.
(get_file_header): Remove setting of is_relocatable.
* gas/cfi/cfi-common-6.d: Allow for possible relocation of the .debug.eh_frame section.
* readelf.c (get_reloc_type): New function. Returns the reloc number extracted from the info field of a reloc.
(get_reloc_symindex): New function. Returns the symbol index
(extracted from the info field of a reloc.
(dump_relocations): Use the new functions.
(slurp_ia64_unwind_table): Use the new functions.
(slurp_hppa_unwind_table): Use the new functions.
(dump_section_as_bytes): Use the new functions.
(get_reloc_size): Delete function.
(is_32bit_abs_reloc): New function. Determines if a given reloc type is a 32-bit absolute relocation.
(is_32bit_pcrel_reloc): New function. Like is_32bit_abs_reloc but for pc-relative relocations.
(is_64bit_abs_reloc): New function. Like is_32bit_abs_reloc but for 64-bit absolute relocations.
(is_16bit_abs_reloc): New function. Like is_32bit_abs_reloc but for 32-bit absolute relocations.
(debug_apply_rela_addends): Use the new functions. Skip and warn about any unrecognised relocations.
BFD_HOST_64BIT_LONG_LONG.
* readelf.c (print_dec_vma): Don't define if BFD_HOST_64BIT_LONG_LONG.
(print_vma): Handle BFD_HOST_64BIT_LONG_LONG.
(dump_relocations): Likewise. Expand _bfd_int64_low in a
number of places.
(dump_sects, cmdline_dump_sects): Use the new type.
(options): Add --string-dump option.
(request_dump): Rename to request_dump_bynumber. Use dump_type.
(request_dump_byname): Use dump_type.
(parse_args): Parse --string-dump option.
(process_section_headers): Fix calls to request_dump.
(initialise_dumps_byname): Likewise.
(dump_section): Rename to dump_section_as_bytes.
(dump_section_as_strings): New function. Display the contents of a section as printable strings.
(process_section_contents): String dump the section if requested.
(process_object): Use dump_type.
(main): Likewise.
* Makefile.am: Add dependency for readelf.c on safe-ctype.h.
* Makefile.in: Regenerate.
* NEWS: Mention the new feature.
* doc/binutils.texi: Document the new feature.
* testsuite/binutils-all/dumptest.s: New test file.
* testsuite/binutils-all/readelf.exp: Add test of readelf's -p switch.
2007-08-16 H.J. Lu <hongjiu.lu@intel.com>
* elf.c: Revert last change.
binutils/
2007-08-16 H.J. Lu <hongjiu.lu@intel.com>
* readelf.c: Revert last change.
include/elf/
2007-08-16 H.J. Lu <hongjiu.lu@intel.com>
* common.h: Revert last change.
2007-08-16 H.J. Lu <hongjiu.lu@intel.com>
* elf.c (get_segment_type): Change PT_GNU_STACK to PT_GNU_ATTR.
(bfd_section_from_phdr): Likewise.
(get_program_header_size): Likewise. Add a PT_GNU_ATTR segment
if there is an attribute section.
(_bfd_elf_map_sections_to_segments): Likewise.
(IS_SECTION_IN_INPUT_SEGMENT): Likewise.
binutils/
2007-08-16 H.J. Lu <hongjiu.lu@intel.com>
* readelf.c (get_segment_type): Change PT_GNU_STACK to
PT_GNU_ATTR.
include/elf/
2007-08-16 H.J. Lu <hongjiu.lu@intel.com>
* common.h (PT_GNU_STACK): Renamed to ...
(PT_GNU_ATTR): This.
(PT_GNU_STACK): New. Make an alias of PT_GNU_ATTR.