151411f8af
This patch adds --compress-debug-sections={none|zlib|zlib-gnu|zlib-gabi} options to gas and objcopy for ELF files. They control how DWARF debug sections are compressed. --compress-debug-sections=none is equivalent to --nocompress-debug-sections. --compress-debug-sections=zlib and --compress-debug-sections=zlib-gnu are equivalent to --compress-debug-sections. --compress-debug-sections=zlib-gabi compresses DWARF debug sections with SHF_COMPRESSED from the ELF ABI. No linker changes are required to support SHF_COMPRESSED. bfd/ * archive.c (_bfd_get_elt_at_filepos): Also copy BFD_COMPRESS_GABI bit. * bfd.c (bfd::flags): Increase size to 18 bits. (BFD_COMPRESS_GABI): New. (BFD_FLAGS_SAVED): Add BFD_COMPRESS_GABI. (BFD_FLAGS_FOR_BFD_USE_MASK): Likewise. (bfd_update_compression_header): New fuction. (bfd_check_compression_header): Likewise. (bfd_get_compression_header_size): Likewise. (bfd_is_section_compressed_with_header): Likewise. * compress.c (MAX_COMPRESSION_HEADER_SIZE): New. (bfd_compress_section_contents): Return the uncompressed size if the full section contents is compressed successfully. Support converting from/to .zdebug* sections. (bfd_get_full_section_contents): Call bfd_get_compression_header_size to get compression header size. (bfd_is_section_compressed): Renamed to ... (bfd_is_section_compressed_with_header): This. Add a pointer argument to return compression header size. (bfd_is_section_compressed): Use it. (bfd_init_section_decompress_status): Call bfd_get_compression_header_size to get compression header size. Return FALSE if uncompressed section size is 0. * elf.c (_bfd_elf_make_section_from_shdr): Support converting from/to .zdebug* sections. * bfd-in2.h: Regenerated. binutils/ * objcopy.c (do_debug_sections): Add compress_zlib, compress_gnu_zlib and compress_gabi_zlib. (copy_options): Use optional_argument on compress-debug-sections. (copy_usage): Update --compress-debug-sections. (copy_file): Handle compress_zlib, compress_gnu_zlib and compress_gabi_zlib. (copy_main): Handle --compress-debug-sections={none|zlib|zlib-gnu|zlib-gabi}. * doc/binutils.texi: Document --compress-debug-sections={none|zlib|zlib-gnu|zlib-gabi}. binutils/testsuite/ * compress.exp: Add tests for --compress-debug-sections={none|zlib|zlib-gnu|zlib-gabi}. * binutils-all/dw2-3.rS: New file. * binutils-all/dw2-3.rt: Likewise. * binutils-all/libdw2-compressedgabi.out: Likewise. gas/ * as.c (show_usage): Update --compress-debug-sections. (std_longopts): Use optional_argument on compress-debug-sections. (parse_args): Handle --compress-debug-sections={none|zlib|zlib-gnu|zlib-gabi}. * as.h (compressed_debug_section_type): New. (flag_compress_debug): Change type to compressed_debug_section_type. --compress-debug-sections={none|zlib|zlib-gnu|zlib-gabi}. * write.c (compress_debug): Set BFD_COMPRESS_GABI for --compress-debug-sections=zlib-gabi. Call bfd_get_compression_header_size to get compression header size. Don't rename section name for --compress-debug-sections=zlib-gabi. * config/tc-i386.c (compressed_debug_section_type): Set to COMPRESS_DEBUG_ZLIB. * doc/as.texinfo: Document --compress-debug-sections={none|zlib|zlib-gnu|zlib-gabi}. gas/testsuite/ * gas/i386/dw2-compressed-1.d: New file. * gas/i386/dw2-compressed-2.d: Likewise. * gas/i386/dw2-compressed-3.d: Likewise. * gas/i386/x86-64-dw2-compressed-2.d: Likewise. * gas/i386/i386.exp: Run dw2-compressed-2, dw2-compressed-1, dw2-compressed-3 and x86-64-dw2-compressed-2. ld/testsuite/ * ld-elf/compress.exp: Add a test for --compress-debug-sections=zlib-gabi. (build_tests): Add 2 tests for --compress-debug-sections=zlib-gabi. (run_tests): Likewise. Verify linker output with zlib-gabi compressed debug input. * ld-elf/compressed1a.d: New file. * ld-elf/compressed1b.d: Likewise. * ld-elf/compressed1c.d: Likewise. |
||
---|---|---|
.. | ||
aarch64 | ||
arm | ||
bfin | ||
hppa | ||
i386 | ||
m68k | ||
mips | ||
vax | ||
windres | ||
x86-64 | ||
add-empty-section.d | ||
add-section.d | ||
alias-2.def | ||
alias.def | ||
ar.exp | ||
bintest.s | ||
compress.exp | ||
copy-1.d | ||
copy-1.s | ||
copy-2.d | ||
copy-3.d | ||
copy-4.d | ||
copytest.s | ||
debug_str.d | ||
debug_str.s | ||
dlltool.exp | ||
dumptest.s | ||
dw2-1.S | ||
dw2-1.W | ||
dw2-2.S | ||
dw2-3.rS | ||
dw2-3.rt | ||
dw2-3.S | ||
dw2-3.W | ||
dw2-compressed.S | ||
dw2-decodedline-1.S | ||
dw2-decodedline.S | ||
dw2-empty.S | ||
elfedit-1.d | ||
elfedit-2.d | ||
elfedit-3.d | ||
elfedit-4.d | ||
elfedit.exp | ||
empty-file | ||
empty.s | ||
exclude-1.s | ||
exclude-1a.d | ||
exclude-1b.d | ||
fastcall.def | ||
group-2.s | ||
group-3.s | ||
group-4.s | ||
group-5.d | ||
group-5.s | ||
group-6.d | ||
group-6.s | ||
group.s | ||
libdw2-compressed.out | ||
libdw2-compressedgabi.out | ||
libdw2.out | ||
link-order.s | ||
localize-hidden-1.d | ||
localize-hidden-1.s | ||
localize-hidden-2.d | ||
localize-hidden-2.s | ||
needed-by-reloc.s | ||
nm-1.s | ||
nm-elf-1.s | ||
nm.exp | ||
note-1.d | ||
objcopy.exp | ||
objdump.exp | ||
objdump.s | ||
objdump.W | ||
objdump.WL | ||
readelf.exp | ||
readelf.h | ||
readelf.n | ||
readelf.r | ||
readelf.r-64 | ||
readelf.s | ||
readelf.s-64 | ||
readelf.ss | ||
readelf.ss-64 | ||
readelf.ss-mips | ||
readelf.ss-tmips | ||
readelf.wa | ||
size.exp | ||
strip-1.d | ||
strip-2.d | ||
strip-3.d | ||
strip-4.d | ||
strip-5.d | ||
strip-6.d | ||
strip-7.d | ||
strip-8.d | ||
strip-9.d | ||
strip-10.d | ||
strip-11.d | ||
testprog.c | ||
testranges-ia64.d | ||
testranges-ia64.s | ||
testranges.d | ||
testranges.s | ||
unique.s | ||
unknown.s | ||
update-1.s | ||
update-2.s | ||
update-3.s | ||
update-4.s | ||
update-section.exp | ||
version.def | ||
version.s |