PATCH: Decompress section before applying simple relocations

H.J. Lu hjl.tools@gmail.com
Mon Dec 27 23:54:00 GMT 2010


On Fri, Dec 24, 2010 at 1:27 AM, Alan Modra <amodra@gmail.com> wrote:
> This interim fix simply kills direct use of the caller's buffer.  Yes,
> it's inefficient to not write directly, but this is safe and avoids
> the decompression code having tentacles everywhere.
>
> A proper solution would be to rewrite this code to not cache anything.
> I say that because bfd_get_full_section_contents is a replacement for
> bfd_get_section_contents at some call sites, so it ought to behave
> similarly.  bfd_get_section_contents just reads from disk, with
> caching done by its callers.  So the decompression code ought to do
> the same, even so far as to decompress each time the function is
> called.  This would likely require fixing some bugs in code that set
> rawsize, eg. merge.c, but I think you then could do without
> section->compressed_size.
>
>        * compress.c (decompress_contents): Style.
>        (bfd_get_full_section_contents): Do not decompress directly into
>        caller buffer or directly return cached section contents.
>        Check malloc return for compressed_buffer.
>

To test it, we need to turn on compression in assembler for x86 and
test the new binutils on gcc and glibc under ia32 and x86-64. We should
check all linker warnings/errors.


-- 
H.J.



More information about the Binutils mailing list