bug-binutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

crashes with nested archives


From: Mikulas Patocka
Subject: crashes with nested archives
Date: Sat, 24 Apr 2004 21:23:56 +0200 (CEST)

Hi

Binutils-2.14 have serious problems when processing archives containing
other archives. The problems arise usually when there are too many open
files and open file caching takes effect.

At many places in code, there are constructs like
if (bfd->my_archive) offset += bfd->origin;
and similar.

The problem with these is that if bfd->my_archive is contained in some
archive too, you add only offset of inner archive, not offset of outer
archive. Similarly, in bfd_cache_lookup_worker you do
if (abfd->my_archive) abfd = abfd->my_archive; --- now if archives are
nested, you need to get to the topmost archive.

The attached patch fixes the problems with nested archives --- it modifies
archive creating so that bfd->my_archive always points to the topmost
archive, not to the immediate descendant. With the patch, i can link large
programs with nested archives flawlessly.

Note that there is also bug in binutils, that code expects then
bfd_cache_lookup always returns non-NULL. Which might not be true, if file
disappeared during linking --- bfd crashes in such case. You should either
check, that bfd_cache_lookup returns non-NULL at every usage or make
bfd_cache_lookup_worker call abort() instead of returning NULL.

Mikulas

Attachment: PATCH-NESTED-ARCHIVES
Description: patch for binutils for nested archives


reply via email to

[Prev in Thread] Current Thread [Next in Thread]