This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: [patch] Add --compress-debug-sections option to gas
On Fri, Jul 02, 2010 at 01:45:51PM -0700, Cary Coutant wrote:
> In the (room <= 0) case, I needed to use obstack_blank so that it
OK, I was confused about what obstack_blank did anyway..
> (Side question: I'm puzzled by the alignment stuff in frag_alloc() --
> it seems to be setting the alignment mask to 0 before calling
> obstack_alloc(). Doesn't that mean that the frag structure will be
> allocated on an arbitrary byte boundary?)
No. I haven't looked at this code in any detail for a long time, but
I think the idea is that the first obstack_alloc (ob, 0) call sets up
ob->next_free to the required boundary. So when you alloc the actual
frag header with the next call it will be properly aligned. The
alignment mask is zeroed for the header alloc so no padding is added
*after* the header. We want the frag literal field following
immediately after the header.
> newf = frag_alloc (ob);
> obstack_blank_fast (ob, fragP->fr_var);
> obstack_finish (ob);
>
> But I couldn't find any code that would guarantee that there was
> enough room for the obstack_blank_fast call to succeed. Am I missing
> something, or is there a potential bug there?)
I think it's a bug.
> bfd/ChangeLog:
>
> * compress.c (bfd_uncompress_section_contents): Add ATTRIBUTE_UNUSED.
> * dwarf2.c (read_and_uncompress_section): New function.
> (read_section): Call it.
> (find_line): Likewise.
>
> binutils/ChangeLog:
>
> * objdump.c (load_specific_debug_section): Decompress section contents
> before applying relocations.
> * readelf.c (load_specific_debug_section): Update section size after
> decompression.
>
> gas/ChangeLog:
>
> * Makefile.am: Add compress-debug.c and compress-debug.h.
> * Makefile.in: Regenerate.
> * config.in: Add HAVE_ZLIB_H.
> * configure.in: Check for zlib.h.
> * configure: Regenerate.
>
> * as.c (parse_args): Add --compress-debug-sections and
> --nocompress-debug-sections.
> * as.h (flag_compress_debug): New variable.
> * compress-debug.c: New file.
> * compress-debug.h: New file.
> * write.c: Include compress-debug.h.
> (compress_frag): New function.
> (compress_debug): New function.
> (write_object_file): Compress debug sections if requested.
OK.
--
Alan Modra
Australia Development Lab, IBM