This is the mail archive of the crossgcc@sources.redhat.com mailing list for the crossgcc project.

See the CrossGCC FAQ for lots more information.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Linker script issues


Hi,
   I am writing my own linker script to use instead of the one used by gcc. I am getting the following error when I compile a simple c file

/nfs/test/vsankara/gnuprosrc/gnupro-2.2/lib/gcc-lib/xscale-coff/3.1-xscale-021022/be/libgcc.a(__main.o): In function `__do_global_ctors':
/nfs/test/vsankara/gnuprosrc/build/gcc/../../src/gcc/libgcc2.c(.text+0xfc): undefined reference to `___CTOR_LIST__'
/nfs/test/vsankara/gnuprosrc/gnupro-2.2/lib/gcc-lib/xscale-coff/3.1-xscale-021022/be/libgcc.a(__main.o): In function `__do_global_dtors':
/nfs/test/vsankara/gnuprosrc/build/gcc/../../src/gcc/libgcc2.c(.data+0x0): undefined reference to `___DTOR_LIST__'
collect2: ld returned 1 exit status

I have used __CTOR_LIST__ and __DTOR_LIST__ in my linker script.

Here is my linker script.

ENTRY(_start)
OUTPUT_FORMAT("coff-arm-big","coff-arm-big","coff-arm-little")
SEARCH_DIR(/nfs/iadusr02/vsankara/board)
STARTUP(board-crt0.o)

SECTIONS 
{
	
	.boot 0x0 :
	{
	  *(.boot)
	}

	.text 0x10000000 :
	{
	  *(.text)
	  
	  __CTOR_LIST__ = .;

	  LONG(-1) /* Linker script does not like LONG((__CTOR_END__ - __CTOR_LIST)/4 - 2) */

	  *(.ctors)

	  LONG(0)

	  __CTOR_END__ = .;

	  __DTOR_LIST__ = .;

	  LONG(-1) /* same as above */

	  *(.dtors)

	  LONG(0)

	  __DTOR_END__ = .;	  

	  _etext = .;

	  etext = .;	  
	}

	.data :
	{
      	  __data_start__ = . ;
    	  *(.data*)
    	  *(.gcc_exc*)
    	  ___EH_FRAME_BEGIN__ = . ;
    	  *(.eh_fram*)
    	  ___EH_FRAME_END__ = . ;
    	  LONG(0);
     	  __data_end__ = . ;
     	  edata  =  .;
     	  _edata  =  .;
  	}

	.bss  SIZEOF(.data) + ADDR(.data) :
  	{
     	  __bss_start__ = . ;
	  __stack_start__ = .;
    	  azusa-crt0.o(.bss)
	  __stack_end__ = .;
	  *(.bss)
    	  *(COMMON)
     	  __bss_end__ = . ;
  	}
   	end = .;
   	_end = .;
   	__end__ = .;
  	
	.stab  0 (NOLOAD) :
  	{
    	  [ .stab ]
  	}
  	
	.stabstr  0 (NOLOAD) :
  	{
    	  [ .stabstr ]
  	}
}

__stack_size__ = __stack_end__ - __stack_start__;
__code_size__ =  SIZEOF(.text);
__RAMSIZE__ = 0x800000;
__RAM_END_ADDR__ = ADDR(.text) + __RAMSIZE__ - 1;

I have used __CTOR_LIST__ and __DTOR_LIST__ above but it seems that __main.o is not able to see it. I tried declaring the two symbols EXTERN but still it does not work. 

Also when I use the expession LONG((__CTOR_END__ - __CTOR_LIST__)/4 - 2), it looks that the parser does not like this. It keeps giving me errors as I have commented above. 

Also what is .eh_frame for, I just put it in there because other linker scripts I have seen had it.

I would really appreciate it if you could answer my questions.

Thanks
Vish


------
Want more information?  See the CrossGCC FAQ, http://www.objsw.com/CrossGCC/
Want to unsubscribe? Send a note to crossgcc-unsubscribe@sources.redhat.com


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