linker script symbol reference

Constantine Kousoulos wuwei@freemail.gr
Tue Apr 3 07:49:00 GMT 2007


Hello,

I'm using a linker script that includes one section with output section
descriptions like this one:

   .data ALIGN(4) : AT(ADDR(.data) - offset)
   {
     _data = .;
     *(.data)
     _edata = .;
   }

I try to reference the defined symbols in my C files by defining

line 1: extern int _data, _edata;
line 2: vm_offset_t kdata = (vm_offset_t)&_data;
line 3: vm_offset_t kedata = (vm_offset_t)&_edata;

The type of vm_offset is an unsigned int.

When i try to build my project on an i386 machine, everything compiles
alright. When i try to build it on an amd64 machine, i get the following
errors:

line 2: error: initializer element is not constant
line 3: error: initializer element is not constant

I must be missing something. Can anybody please help?

Constantine



More information about the Binutils mailing list