This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
[ld]: Checks for address space overflow will reject any avr program.
- From: Georg-Johann Lay <avr at gjlay dot de>
- To: binutils at sourceware dot org
- Cc: Senthil Kumar Selvaraj <senthil_kumar dot selvaraj at atmel dot com>, Tristan Gingold <gingold at adacore dot com>
- Date: Tue, 14 Mar 2017 12:01:40 +0100
- Subject: [ld]: Checks for address space overflow will reject any avr program.
- Authentication-results: sourceware.org; auth=none
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