Why "relocation truncated to fit" with this linker script?

Rick Mann rmann@latencyzero.com
Wed Oct 31 00:55:00 GMT 2007


I get

arm-elf-g++ -Wl,-Map,mapfile.txt -Llib -Xlinker --gc-sections -Xlinker  
--script=link.lds -o h.elf obj/start.o obj/vectors.o src/glue.o src/ 
Assert.o src/Graphics.o src/Interrupts.o src/Particle.o src/ 
ProcUtils.o src/Util.o src/lcd.o src/main.o src/pfd/AirData.o src/pfd/ 
GraphicsUtils.o src/pfd/MiscUtils.o src/pfd/graphics/Airspeed.o src/ 
pfd/graphics/Altitude.o src/pfd/graphics/HSI.o src/pfd/graphics/HSI2.o  
src/pfd/graphics/Horizon.o src/pfd/graphics/Instrument.o src/pfd/ 
graphics/Rect.o src/pfd/graphics/Renderable.o src/pfd/graphics/ 
TapeDisplay.o  -lgui64 -lm
obj/start.o: In function `loop':
(.text+0x4c): relocation truncated to fit: R_ARM_PC24 against symbol  
`_init' defined in .init section in /usr/local/arm3/lib/gcc/arm-elf/ 
4.2.1/crti.o
obj/start.o: In function `loop':
(.text+0x54): relocation truncated to fit: R_ARM_PC24 against symbol  
`_fini' defined in .fini section in /usr/local/arm3/lib/gcc/arm-elf/ 
4.2.1/crti.o
/usr/local/arm3/lib/gcc/arm-elf/4.2.1/crtbegin.o:(.fini+0x0):  
relocation truncated to fit: R_ARM_PC24 against `__do_global_dtors_aux'
/usr/local/arm3/lib/gcc/arm-elf/4.2.1/crtbegin.o:(.init+0x0):  
relocation truncated to fit: R_ARM_PC24 against `frame_dummy'
/usr/local/arm3/lib/gcc/arm-elf/4.2.1/crtend.o:(.init+0x0): relocation  
truncated to fit: R_ARM_PC24 against `__do_global_ctors_aux'
collect2: ld returned 1 exit status



Even though my linker script puts start.o and .init & .fini sections  
all together:

SECTIONS
{
	. = 0x00000000;
	
	. = ALIGN(4);
	.text :
	{
		vectorsStart = .;
		KEEP (obj/vectors.o(.text));
		vectorsEnd = .;
	}
	
	. = 0x80008000;

	. = ALIGN(4);
	.text :
	{
		obj/start.o(.text);
		src/Interrupts.o(.text);
	}

	. = ALIGN(4);
	.text : { *(.text) }

	. = ALIGN(4);
	.init :
	{
		KEEP (*(.init))
	} = 0
	
	. = ALIGN(4);
	.fini :
	{
		KEEP (*(.fini))
	} = 0
	


If I remove the . = 0x80008000; line, it works. Obviously, this is not  
all I have to do, but this part should work for now, right?


TIA,
-- 
Rick



More information about the Binutils mailing list