bug-binutils
[Top][All Lists]
Advanced

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

Re: crashes with nested archives


From: Mikulas Patocka
Subject: Re: crashes with nested archives
Date: Mon, 17 May 2004 16:32:08 +0200 (CEST)


On Wed, 5 May 2004, Nick Clifton wrote:

> Hi Mikulas,
>
> >Binutils-2.14 have serious problems when processing archives containing
> >other archives.
> >
>
> Thanks for bringing this to our attention.  I hope that you do not mind,
> but there are a couple of problems with your proposed patch:
>
>   * It is not clear to me how nested archives can be successfully used.
> I tried a simplest test like this:
>
>     gcc hello-world.c -c -o file1.o
>     cp file1.o file2.o
>     cp file1.o file3.o
>     cp file1.o file4.o
>     ar cr lib1.a file1.o file2.o
>     ar cr lib2.a file3.o file4.o
>     ar cr lib3.a  lib1.a lib2.s
>    objdump -p lib3.a
>    In archive lib3.a:
>      objdump: lib1.a: File format not recognized
>      objdump: lib2.a: File format not recognized

That's problem with objdump, not bfd. bfd should handle nested archives
(it's written in bfd.info).

>   So in order to proceed with fixing this bug we definitely need a test
> case that can reproduce the problem.

I uploaded the testcase to
http://urtax.ms.mff.cuni.cz/~mikulas/bfd-bug.tgz
(run make to test it --- and rewrite gcc33 in Makefile to name of your
gcc)

Without the patch with plain 2.14 it crashes (or with your next patch for
check NULL file open it just aborts on file reopen fail, because it
tries to open filename of an inner archive).

With the patch for nested archives, that I submitted, it produces working
executable.

>   * The patch assumes that there will only be one level of nested
> archives.  Instead it should recurse until there are no more nested
> archive levels to process.

No. my_archive always points to the topmost archive, so there's no need to
recurse.

The whole bfd does not recurse on my_archive --- so there are two
possibilities --- either rewrite all usages of my_archive in bfd
(complicated) or make my_archive point to topmost archive --- which is
what I did.

>   * The patch to bfd_generic_openr_next_archived_file() puts the new
> code *after* filestart has been aligned to an even byte boundary.  It
> ought to be *before* the alignment.

I thought archive->origin is always even so it doesn't matter.

>    * It would be helpful if you could include a ChangeLog entry for the
> patch as well.

Write it after applying my patch.

> I hope that you will consider resubmitting your patch with these points
> addressed.
>
> Cheers
>   Nick

Mikulas




reply via email to

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