This is the mail archive of the binutils@sources.redhat.com mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: Cannot create shared library on sh-elf


On Sep 16, 2000, Nick Clifton <nickc@redhat.com> wrote:

> Hi Alexandre,
> : 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?

> : -#define ELF_MAXPAGESIZE		0x1
> : +#define ELF_MAXPAGESIZE		128

> I am not sure that this is such a good idea.  The maximum page size is
> something that is usually specified by the ABI, and changing it should
> only be done if the ABI allows it.

The point is that ld/emulparams/sh{,l}elf.sh do define MAXPAGESIZE as
128, and, by the time I debugged this, I ended up figuring it was this
inconsistency that caused the problem.  I believe it had something to
do with the lines such as:

  . = ALIGN(128) + (. & (128 - 1));

that are present in the sh{,l}elf ldscripts, and are incompatible with
a corresponding rounding done somewhere in the linker.  But that was
quite a long time ago, and I no longer recall the details :-(

> Besides this seems to me to be the wrong way to solve the problem.  If
> not enough segment headers are allocated then the real problem is with
> the algorithm that was deciding upon the number of headers, or with
> the linker map that was specifying the number of headers.

The problem was that the linker decided to start a new segment because
the next section wouldn't fit in the current page, or something alike.

> Can you investigate this problem a little further, and maybe post a
> way to reproduce the problem ?

Reproducing it was just a matter of trying to create a shared library
out of any object file.  No magic required :-)

-- 
Alexandre Oliva   Enjoy Guarana', see http://www.ic.unicamp.br/~oliva/
Red Hat GCC Developer                  aoliva@{cygnus.com, redhat.com}
CS PhD student at IC-Unicamp        oliva@{lsd.ic.unicamp.br, gnu.org}
Free Software Evangelist    *Please* write to mailing lists, not to me

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]