Bug 2706 - Linking to elf32-i386 causing error "non constant expression for load base"
Summary: Linking to elf32-i386 causing error "non constant expression for load base"
Status: RESOLVED WORKSFORME
Alias: None
Product: binutils
Classification: Unclassified
Component: binutils (show other bugs)
Version: 2.16
: P2 normal
Target Milestone: ---
Assignee: unassigned
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-05-29 13:57 UTC by Architect
Modified: 2006-05-31 02:04 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Architect 2006-05-29 13:57:47 UTC
Linking to the elf32-i386 format using the following linker script gives me an
error "non constant expression for load base".

Changing the OUTPUT_FORMAT to binary however makes the script work fine.
Here is the linker script used.

OUTPUT_FORMAT("elf32-i386")
ENTRY(start)

FourKB = 0x1000;
physical = 0x100000; 	/* 1 meg */
virtual = 0xC0000000; 	/* 3 gig */

SECTIONS
{
  . = physical;
  
  .setup :
  {
    *(.setup)
  }
  
  . += virtual;

  .text : AT( ADDR(.text) - virtual )
  {
    *(.text)
    *(.rodata*)
  }

  . = ALIGN(FourKB);

  .data : AT( LOADADDR(.text) + SIZEOF(.text) )
  {

	 start_ctors = .;
	 *(.ctors*)
	 end_ctors = .;
	 
	 start_dtors = .;
	 *(.dtors)
	 end_dtors = .;

	 *(.data)
  }
  . = ALIGN(FourKB);

  .bss : AT( LOADADDR(.data) + SIZEOF(.data) )
  {
    *(.bss)
    *(COMMON)
  }
  . = ALIGN(FourKB);

}
Comment 1 Alan Modra 2006-05-31 02:04:22 UTC
Please try a recent binutils, either current mainline, 2.17 branch, or one of HJ
Lu's releases.  I think you'll find that this has been fixed.