Jakub Jelinek [Fri, 20 Apr 2012 16:47:46 +0000 (18:47 +0200)]
IMPORTANT: usage change, no works similarly to strip.
dwz file
will modify file in place (well, write to temporary, rename over),
dwz -o outfile file
will do what dwz file outfile did before.
dwz file1 file2 file3
will modify all the files in place,
dwz
will modify a.out in place,
dwz -o b.out
will modify a.out into b.out.
In addition to that this change revamps the OOM handling to just
not handle the single currently handled file, complain,
cleanup all memory and continue with the next file.
Jakub Jelinek [Fri, 20 Apr 2012 07:06:59 +0000 (09:06 +0200)]
Second part of memory management cleanups. For permanently
(well, for the duration of handling a single file) allocated objects
use a big pool allocator that doesn't unnecessarily align everything
to 16 bytes and allocates in ~ 16MB chunks rather than 4KB.
This decreases memory usage a little bit on large testcases and
speeds things a tiny bit up.
Also, avoid obstacks local to function, for memory allocation failures
if in the future we use longjmp those might not be freed.
Jakub Jelinek [Thu, 19 Apr 2012 11:43:17 +0000 (13:43 +0200)]
Use just u.p1.die_ref_hash instead of u.p1.die_hash ^ u.p1.die_ref_hash
as hash in the dup_htab hash table. die_ref_hash has die_hash iteratively
hashed in already, and on leaf DIEs is equal to die_hash, so the xor
resulted in 0 for all leaf DIEs.
Jakub Jelinek [Thu, 19 Apr 2012 11:39:48 +0000 (13:39 +0200)]
Optimize .debug_abbrev handling for .debug_types section. If
adjacent .debug_types CUs have the same .debug_abbrev offsets, just
read it once and point the others to the abbrev table owner's CU.
Jakub Jelinek [Thu, 19 Apr 2012 11:35:19 +0000 (13:35 +0200)]
Revamp die_dup/die_nextdup for easier debugging. Instead of
two separate structures where second one contains the first at the
beginning just put the die_dup/die_nextdup fields last in the
single structure and for !die_toplevel DIEs just allocate using
offsetof (struct dw_die, die_dup) size (so those two fields will be
garbage).