This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
PATCH: FIx elf_object_p (Re: bug in binutils 2.11.90.0.31 strip ?)
- To: Ryan Murray <rmurray at debian dot org>
- Subject: PATCH: FIx elf_object_p (Re: bug in binutils 2.11.90.0.31 strip ?)
- From: "H . J . Lu" <hjl at lucon dot org>
- Date: Wed, 17 Oct 2001 23:12:53 -0700
- Cc: binutils at sourceware dot cygnus dot com
- References: <20011006193551.A17821@cyberhqz.com> <20011006231430.A1725@lucon.org> <20011014001418.C32135@cyberhqz.com> <20011014092728.A2374@lucon.org> <20011014130337.F32135@cyberhqz.com> <20011015000830.A2739@lucon.org> <20011015014540.A16133@cyberhqz.com> <20011015094027.A1218@lucon.org>
On Mon, Oct 15, 2001 at 09:40:27AM -0700, H . J . Lu wrote:
> On Mon, Oct 15, 2001 at 01:45:40AM -0700, Ryan Murray wrote:
> > On Mon, Oct 15, 2001 at 12:08:30AM -0700, H . J . Lu wrote:
> > > which is page aligned. I have no idea why it happens to you. If you
> > > can do
> > >
> > > # tar cfz /tmp/libobjc.tar.gz libobjc/.libs
> > >
> > > and send /tmp/libobjc.tar.gz to me, I will take a look.
> >
> > Here it is...
> >
> > Note that the Debian package builds the library twice, once with libgc support
> > and once without.
>
I finally duplicate the problem. This patch seems to workd for me. I
don't think we should care about alignment for empty sections in this
case.
H.J.
----
2001-10-17 H.J. Lu <hjl@gnu.org>
* elfcode.h (elf_object_p): Don't clear D_PAGED if the section
is empty.
Index: elfcode.h
===================================================================
RCS file: /work/cvs/gnu/binutils/bfd/elfcode.h,v
retrieving revision 1.1.1.19
diff -u -p -r1.1.1.19 elfcode.h
--- elfcode.h 2001/10/15 18:08:11 1.1.1.19
+++ elfcode.h 2001/10/18 06:11:53
@@ -656,7 +656,8 @@ elf_object_p (abfd)
/* If the section is loaded, but not page aligned, clear
D_PAGED. */
- if ((i_shdrp[shindex].sh_flags & SHF_ALLOC) != 0
+ if (i_shdrp[shindex].sh_size != 0
+ && (i_shdrp[shindex].sh_flags & SHF_ALLOC) != 0
&& i_shdrp[shindex].sh_type != SHT_NOBITS
&& (((i_shdrp[shindex].sh_addr - i_shdrp[shindex].sh_offset)
% ebd->maxpagesize)