[ld]: Checks for address space overflow will reject any avr program.

Georg-Johann Lay avr@gjlay.de
Tue Mar 14 11:01:00 GMT 2017


Hi Tristan.

Your addition to ld/ldlang.c::lang_check_section_addresses() leads
to rejection of any program by ld, for example

int x;

int main (void)
{
     return 0;
}

And compiled with

$ avr-gcc-7 main.c -Os -mmcu=atmega8 -save-temps

/INSTALL/bin/../lib/gcc/avr/7.0.1/../../../../avr/bin/ld: section .data 
VMA wraps around address space
/INSTALL/bin/../lib/gcc/avr/7.0.1/../../../../avr/bin/ld: section .bss 
VMA wraps around address space
collect2: error: ld returned 1 exit status

The generated asm is (effectively):

	.file	"main.c"
	.section	.text.startup,"ax",@progbits
.global	main
	.type	main, @function
main:
	ldi r25,0
	ldi r24,0
	ret
	.size	main, .-main
	.comm	x,2,1
	.ident	"GCC: (GNU) 7.0.1 20170314 (experimental) [trunk revision 244001]"


I didn't actually check whether it's due to your change, but as
you are active there, you'll likely know the solution.

avr is using virtual addresses in order to linearize the address
space.


If there is no obvious solution to fix this for avr, it would be
highly appreciated to have a configure option so that respective
portions of ld sources can be deactivated.

If you need more information to reproduce the issue, please let
me know.


Johann




More information about the Binutils mailing list