[prev in list] [next in list] [prev in thread] [next in thread] 

List:       binutils
Subject:    Re: [PATCH] bfd: Don't check non-thin archive member file size
From:       Alan Modra via Binutils <binutils () sourceware ! org>
Date:       2021-12-28 8:31:21
Message-ID: YcrIifX/LnM5og7e () squeak ! grove ! modra ! org
[Download RAW message or body]

On Mon, Dec 27, 2021 at 05:31:13AM -0800, H.J. Lu wrote:
> On Sun, Dec 26, 2021 at 10:56 PM Alan Modra <amodra@gmail.com> wrote:
> >
> > On Fri, Dec 24, 2021 at 03:46:04PM -0800, H.J. Lu via Binutils wrote:
> > > There is no need to check member file size for thin archive member.
> >
> > Does it hurt to check against the file size recorded in the archive
> > header?  Did someone report a "bug", perhaps that a thin archive
> > member file was updated without running ar, and then hit an error?
> >
> 
> While debugging a GCC bootstrap bug, I copied a .o file without running
> ar on a thin archive.  Other linkers didn't complain.  There is no need to.

No doubt what you did was reasonably safe, but if an object file that
is part of a thin archive is replaced without running ar then it is
possible for the archive symbol table to be wrong.  That could lead to
linker misbehaviour.  So I'm inclined to say we should be checking
the archive header size against file size.

Such a check doesn't really belong in bfd_bread though, so please go
ahead and apply your patch.

-- 
Alan Modra
Australia Development Lab, IBM
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic