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: Relocating .data at 0x0


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


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