This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
Re: [PATCH] Fix place_orphan
On Fri, Jul 13, 2001 at 11:21:12PM -0700, H . J . Lu wrote:
> On Thu, Jul 12, 2001 at 09:04:56PM +0200, Jakub Jelinek wrote:
> > Hi!
> >
> > I was wondering why some glibc shared libraries have .interp sections placed
> > in between non-alloced sections, like for libBrokenLocale.so.1:
> >
> > Ok to commit? Tested on i386-redhat-linux.
> >
> > 2001-07-12 Jakub Jelinek <jakub@redhat.com>
> >
> > * emultempl/elf32.em (output_prev_sec_find): New.
> > (place_orphan): Use it.
> >
>
> I don't think it is correct. It breaks -static.
>
> # cat x.c
> main ()
> {
> }
> # gcc -static x.c
> /usr/bin/ld: BFD internal error, aborting at section.c line 970 in
> bfd_map_over_sections
>
> /usr/bin/ld: Please report this bug.
>
FYI, "make check" also failed in ld with "bootstrap -static" when
shared library is not enabled.
I checked in this patch to fix the problem. This bug is similar to
http://sources.redhat.com/ml/binutils/2001-02/msg00327.html
Basically, bfd_abs_section_ptr, bfd_com_section_ptr and
bfd_und_section_ptr may be pointed to the read-only memory area. We
shouldn't touch them. With my patch, the testcase works fine.
H.J.
----
2001-07-14 H.J. Lu <hjl@gnu.org>
* emultempl/elf32.em (output_prev_sec_find): Never return
bfd_abs_section_ptr, bfd_com_section_ptr nor
bfd_und_section_ptr.
Index: emultempl/elf32.em
===================================================================
RCS file: /work/cvs/gnu/binutils/ld/emultempl/elf32.em,v
retrieving revision 1.46
diff -u -p -r1.46 elf32.em
--- emultempl/elf32.em 2001/07/14 01:18:11 1.46
+++ emultempl/elf32.em 2001/07/14 16:33:24
@@ -1040,7 +1040,10 @@ output_prev_sec_find (os)
lookup = &u->output_section_statement;
if (lookup == os)
break;
- if (lookup->bfd_section != NULL)
+ if (lookup->bfd_section != NULL
+ && lookup->bfd_section != bfd_abs_section_ptr
+ && lookup->bfd_section != bfd_com_section_ptr
+ && lookup->bfd_section != bfd_und_section_ptr)
s = lookup->bfd_section;
}