This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
Re: Relocating .data at 0x0
- To: binutils at sources dot redhat dot com
- Subject: Re: Relocating .data at 0x0
- From: David Robins <dbrobins at student dot math dot uwaterloo dot ca>
- Date: Thu, 31 May 2001 23:53:05 -0400 (EDT)
Regarding the previous message that I posted:
I tracked down the problem to binutils/ld/aoutx.h ~line 1010:
if (abdp && abdp->zmagic_mapped_contiguous)
{
text_pad = (obj_datasec(abfd)->vma
- obj_textsec(abfd)->vma
- obj_textsec(abfd)->_raw_size);
obj_textsec(abfd)->_raw_size += text_pad;
}
In i386linux.c, MY_zmagic_contiguous is #defined to 1 which sets
zmagic_mapped_contiguous in the aout_backend_data struct. Other targets
might not have the same problem.
Since the VMA for .text was 0x30 and .data was at 0x0, text_pad is set
negative and corrupts the .text output section's _raw_size, causing an
error (the oh-so-descriptive "bad value") in the bfd_final_link stage.
Granted, normally this problem won't occur, since most people don't need
that sort of linker script, but I just thought I'd mention it in case
perhaps someone wants to insert an assertion or check/warning, or if
someone has the same problem in the future they can read this.
Dave
Isa. 40:31