Hello, I have problem to debug large avr programs (tinyos/nescc generate one large source file that is passed throught avr-gcc to avr-as). The debug information are getting corrupted if any generated section in elf is larger than 64kB. Example errors: - avr-gdb cannot find source line - "avr-objdump -Wl" / "avr-readelf -wl" outputs "Warning: The information in section .debug_line appears to be corrupt - the section is too small" I debugged avr-as. All relloc/fixup are correctly computed in BFD_RELOC_32 format (traced with DEBUG5 in gas/write.c) but there is written only first 2 bytes :-( I am not expert in code generation. M.C> --- gas/config/tc-avr.c.orig 2012-08-05 23:30:56.030369086 +0200 +++ gas/config/tc-avr.c 2012-08-10 13:00:17.610451285 +0200 @@ -1244,7 +1245,7 @@ break; case BFD_RELOC_32: - bfd_putl16 ((bfd_vma) value, where); + bfd_putl32 ((bfd_vma) value, where); break; case BFD_RELOC_16:
Created attachment 6585 [details] testcase Testcase: 1) generate large file: # rm x.c; let i=1; let j=0; while [[ $i -le 2000 ]]; do echo "int fn${i}(int i)\n{\nfn${j}(i+1);\nfn${j}(i+2);\nfn${j}(i+3);\nreturn i+4;\n}\n\n" >> x.c; let j=i; let i=i+1; done; echo "int fn0(int i) { return i; }; main() { fn${j}(0); }" >> x.c 2) compille # avr-gcc -o x -g -mmcu=atmega1281 x.c 3) test overflow # avr-readelf -S x # avr-objdump -Wl x > /dev/null avr-objdump: Warning: The information in section .debug_line appears to be corrupt - the section is too small # avr-readelf -wl x > /dev/null readelf: Warning: The information in section .debug_line appears to be corrupt - the section is too small
This seem to have been fixed already in the mainline: http://sourceware.org/cgi-bin/cvsweb.cgi/src/gas/config/tc-avr.c.diff?r1=1.79&r2=1.80&cvsroot=src&f=h