This is the mail archive of the
mailing list for the binutils project.
Re: Cannot create shared library on sh-elf
- To: law at cygnus dot com
- Subject: Re: Cannot create shared library on sh-elf
- From: Nick Clifton <nickc at redhat dot com>
- Date: Mon, 18 Sep 2000 11:05:56 -0700
- CC: aoliva at redhat dot com, binutils at sources dot redhat dot com
: > Without this patch, when I try to create a shared library on sh-elf,
: > ld tries to place .text (or was it .data; I no longer recall, I wrote
: > this patch some time ago, then forgot about it) and .rodata in
: > different segments, but fails because it didn't allocate enough
: > headers. Ok to install?
: Maybe I missed the discussion, but precisely why did it try to place
: .text and .rodata into different segments? That's the bug you need to
The problem was a discrepancy in the choice of the page size for the
sh-elf port. In the shelf.sh linker file it sets the page size to
0x128, but in the elf32-sh.c bfd file it was setting it to 0x1.
The default elf linker script uses the page size value to align the
various sections (.text, .data, .rodata etc) and it was doing so at a
128 byte boundary. The elf-section placement code in the bfd library
however was detecting that there was a gap between the end of the
.text section and the start of the .rodata section that was larger
than what it thought was the maximum page size (ie 1 byte) and so it
created a new segment to hold the .rodata section. This did not match
the assumptions made by the linker, and so the problem about
insufficient space to hold all of the headers arises.
Alexandre's patch fixes this problem by unifying the two definitions
of the maximum page size value.
Of course really there are two problems here - the fact that the
maximum page size is defined in two separate places, and the fact that
the linker and the bfd library do not use the same piece of code to
decide how many segments are going to be needed to hold all of the