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]

Help with arm-elf-ld and the AT directive


I always have odd problems trying to understand where the AT directive 
works and where it doesn't - it never seems to work the way I expect it to.

In my current headache I have an ARM program that needs to have a tiny 
piece of code in a vector area at physical address 0, a long way away from 
anywhere else. The entry point for the code is 0xc001c200. So I have a 
linker script as below. If I link with it, I get an error saying "no room 
for program headers, try -N". If I link with -N, both LMA and VMA for 
.vectors are set to 0, which is wrong. LMA should be 0xc001c200 + sizeof 
(.text), and VMA should be 0.

This should be a very canonical use of the AT directive, can someone tell 
me what I'm doing wrong?

SECTIONS
{
	.text 0xc001c200:
	{
         *(.init);
         . = ALIGN(4);
         *(.text);
         . = ALIGN(4);
         *(.glue_7t);
         . = ALIGN(4);
         *(.glue_7);
         . = ALIGN(4);
         *(.rdata);
         . = ALIGN(4);
         *(.fini);
         . = ALIGN(4);
         *(.rodata);
         . = ALIGN(4);
         etext  =  .;
	}

	.vectors 0 : AT (etext)
	{
		*(.vectors)
		evectors = .;
	}

	.data evectors :
	{
		datastart = .;
		__data_start__ = . ;
		*(.data)
         . = ALIGN(4);
         __data_end__ = . ;
         edata  =  .;
         _edata  =  .;
	}

	.bss edata :
	{
         __bss_start__ = . ;
         *(.bss); *(COMMON)
         __bss_end__ = . ;
	}

     end = .;
}

-- Lewin A.R.W. Edwards
Embedded Engineer, Digi-Frame Inc.
Work: http://www.digi-frame.com/
Tel (914) 937-4090 9am-6:30pm M-F ET
Personal: http://www.larwe.com/ http://www.zws.com/

"Far better it is to dare mighty things, to win glorious triumphs, even 
though checkered by failure, than to rank with those poor spirits who 
neither enjoy much nor suffer much, because they live in the gray twilight 
that knows not victory nor defeat."
(Theodore Roosevelt)



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