The relocation problem again

David Robins dbrobins@student.math.uwaterloo.ca
Fri Jun 29 15:44:00 GMT 2001


With the following linker script, and the latest binutils (2.11.2), I no
longer get errors with the script, but rather the code (.text) sections
just get left right out.  Odd thing is, all the symbols are there.  Boy
was I shocked when I sent someone my code and checked their failing
binary and it had no code!

--kernel.lds--
/* OUTPUT_FORMAT("a.out-i386") */
OUTPUT_FORMAT("a.out-i386-linux")
OUTPUT_ARCH("i386")
SEARCH_DIR("lib");
SECTIONS
{
  .text 0x20 :  /* after the a.out header, which is at the base of the code */
  { 
    _btext = .;
    CREATE_OBJECT_SYMBOLS
    *(.text)
    _etext = .;

    /* ordered sequence of addresses of module initialization functions */
    . = ALIGN(0x1000);  /* page align so we can discard it later */
    _binitvec = .;
    *(.initvec)
    _einitvec = .;
    /* initialization code itself */
    _binit = .;
    *(.init)
    _einit = ALIGN(0x1000);
  }
  .data 0x0 : AT((LOADADDR(.text)+SIZEOF(.text)+0xfff)&~(0xfff))
  {
    _bdata = .;
    *(.data)
    _rdata = .;
    *(.rodata)   /* a.out has no separate read only data section */
    _edata = .;
  }
  .bss ALIGN(4) :
  {
    _bbss = .;
   *(.bss)
   *(COMMON)
   _ebss = ALIGN(4);
   _end = ALIGN(4);
  }
  /DISCARD/ :
  {
    *(.note)        /* ELF note section */
    *(.comment)     /* ELF comment section */
  }
}
--end--

Dave
Isa. 40:31



More information about the Binutils mailing list