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]

Relocating .data at 0x0


I'm trying to write an ld script to have it relocate the .data segment at
0x0 (i.e., generate symbol addresses starting at 0x0 for all sections
included there).  My script looks like:

OUTPUT_FORMAT("a.out-i386-linux")
OUTPUT_ARCH("i386")
SECTIONS
{ 
  .text 0x20 :  
  { 
    CREATE_OBJECT_SYMBOLS
    *(.text)
    _etext = .;
    __etext = .;
  }
  .data 0x0 : AT(ADDR(.text)+SIZEOF(.text))
  { 
    *(.data)
    *(.rodata)   /* a.out has no separate rodata section */
    CONSTRUCTORS
  }
/* plus .bss and a /DISCARD/ pseudo-section */
}

This dies with:
/usr/local/bin/ld: final link failed: File truncated

It will die with 'Bad value' for 'File truncated' if I change the data
address to, say, 0x400.  The .text segment size is about 0xa000.

The purpose is to be able to set DS/ES/SS/FS/GS to the start of the data
segment directly, not the code segment, so that the first item in the
data segment will be DS:0, not DS:0xa000.

ld version 2.11.90.08, same BFD version, gcc is egcs-2.91.66.

Any help appreciated.

Dave
Isa. 40:31


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