[Bug ld/13410] [avr]: error: relocation truncated to fit: R_AVR_13_PCREL against symbol
http://sourceware.org/bugzilla/show_bug.cgi?id=13410 --- Comment #13 from Vidya Praveen childbear0 at gmail dot com 2012-02-03 08:30:31 UTC --- (In reply to comment #12) The patch reads: + /* If 'shrinkable' is FALSE, do not shrink by deleting bytes while + relaxing. Such shrinking can cause issues for the sections such + as .vectors and .jumptables. Instead the unused bytes should be + filled with nop instructions. */ + bfd_boolean shrinkable = TRUE; + + if (!strcmp (sec-name,.vectors) + || !strcmp (sec-name,.jumptables)) +shrinkable = FALSE; Shouln't this also cover .jumptables* and .progmem.gcc* ? avr-gcc puts its jumptables into .progmem.gcc_sw_table for instance. Relaxing must not do harm to them. I didn't analyze the which other sections that might require this, however I assumed such requirements will be there. This is one of the reason why I moved out the check outside the loop, so the such additions are easy and in one place. Are there any other sections that might require to be here? -- Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email --- You are receiving this mail because: --- You are on the CC list for the bug. ___ bug-binutils mailing list bug-binutils@gnu.org https://lists.gnu.org/mailman/listinfo/bug-binutils
[Bug ld/13410] [avr]: error: relocation truncated to fit: R_AVR_13_PCREL against symbol
http://sourceware.org/bugzilla/show_bug.cgi?id=13410 --- Comment #14 from Vidya Praveen childbear0 at gmail dot com 2012-02-03 08:40:08 UTC --- (In reply to comment #11) Vidya, You did fine, putting the patch in the bug report as attachment, and ChangeLog in comment. Yes, you can use your gmail account for communication, but then use your atmel account for the ChangeLog entry. Patch committed, after addition of a couple of periods at end of comment sentences. Thanks for fixing this bug, Vidya. Thanks Eric. -- Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email --- You are receiving this mail because: --- You are on the CC list for the bug. ___ bug-binutils mailing list bug-binutils@gnu.org https://lists.gnu.org/mailman/listinfo/bug-binutils
[Bug ld/13410] [avr]: error: relocation truncated to fit: R_AVR_13_PCREL against symbol
http://sourceware.org/bugzilla/show_bug.cgi?id=13410 --- Comment #15 from Georg-Johann Lay gjl at gcc dot gnu.org 2012-02-03 12:55:47 UTC --- (In reply to comment #13) (In reply to comment #12) + if (!strcmp (sec-name,.vectors) + || !strcmp (sec-name,.jumptables)) +shrinkable = FALSE; Shouln't this also cover .jumptables* and .progmem.gcc* ? avr-gcc puts its jumptables into .progmem.gcc_sw_table for instance. Relaxing must not do harm to them. I didn't analyze the which other sections that might require this, however I assumed such requirements will be there. This is one of the reason why I moved out the check outside the loop, so the such additions are easy and in one place. Are there any other sections that might require to be here? My bad, I answered too fast. Swtich-case lookup tables from avr-gcc have always 16-bit entries, even on the big devices. Sorry for the noise. -- Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email --- You are receiving this mail because: --- You are on the CC list for the bug. ___ bug-binutils mailing list bug-binutils@gnu.org https://lists.gnu.org/mailman/listinfo/bug-binutils
[Bug ld/13410] [avr]: error: relocation truncated to fit: R_AVR_13_PCREL against symbol
http://sourceware.org/bugzilla/show_bug.cgi?id=13410 --- Comment #9 from Vidya Praveen childbear0 at gmail dot com 2012-02-02 08:38:19 UTC --- Corrected the log message 2012-02-02 Vidya Praveen (vidya.prav...@atmel.com) PR bfd/13410 * bfd/elf32-avr.c (elf32_avr_relax_section): Correct the condition that qualifies the candidates for relaxation. Eric, Please let me know if the resubmission is OK. Thanks VP -- Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email --- You are receiving this mail because: --- You are on the CC list for the bug. ___ bug-binutils mailing list bug-binutils@gnu.org https://lists.gnu.org/mailman/listinfo/bug-binutils
[Bug ld/13410] [avr]: error: relocation truncated to fit: R_AVR_13_PCREL against symbol
http://sourceware.org/bugzilla/show_bug.cgi?id=13410 --- Comment #10 from cvs-commit at gcc dot gnu.org cvs-commit at gcc dot gnu.org 2012-02-02 18:02:17 UTC --- CVSROOT:/cvs/src Module name:src Changes by:ewedding...@sourceware.org2012-02-02 18:02:10 Modified files: bfd: ChangeLog elf32-avr.c Log message: 2012-02-02 Vidya Praveen (vidya.prav...@atmel.com) PR bfd/13410 * bfd/elf32-avr.c (elf32_avr_relax_section): Correct the condition that qualifies the candidates for relaxation. Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/src/bfd/ChangeLog.diff?cvsroot=srcr1=1.5598r2=1.5599 http://sourceware.org/cgi-bin/cvsweb.cgi/src/bfd/elf32-avr.c.diff?cvsroot=srcr1=1.52r2=1.53 -- Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email --- You are receiving this mail because: --- You are on the CC list for the bug. ___ bug-binutils mailing list bug-binutils@gnu.org https://lists.gnu.org/mailman/listinfo/bug-binutils
[Bug ld/13410] [avr]: error: relocation truncated to fit: R_AVR_13_PCREL against symbol
http://sourceware.org/bugzilla/show_bug.cgi?id=13410 Eric Weddington eric.weddington at atmel dot com changed: What|Removed |Added Status|ASSIGNED|RESOLVED Version|2.21|2.23 (HEAD) Resolution||FIXED --- Comment #11 from Eric Weddington eric.weddington at atmel dot com 2012-02-02 18:05:34 UTC --- Vidya, You did fine, putting the patch in the bug report as attachment, and ChangeLog in comment. Yes, you can use your gmail account for communication, but then use your atmel account for the ChangeLog entry. Patch committed, after addition of a couple of periods at end of comment sentences. Thanks for fixing this bug, Vidya. -- Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email --- You are receiving this mail because: --- You are on the CC list for the bug. ___ bug-binutils mailing list bug-binutils@gnu.org https://lists.gnu.org/mailman/listinfo/bug-binutils
[Bug ld/13410] [avr]: error: relocation truncated to fit: R_AVR_13_PCREL against symbol
http://sourceware.org/bugzilla/show_bug.cgi?id=13410 --- Comment #12 from Georg-Johann Lay gjl at gcc dot gnu.org 2012-02-02 19:29:31 UTC --- The patch reads: + /* If 'shrinkable' is FALSE, do not shrink by deleting bytes while + relaxing. Such shrinking can cause issues for the sections such + as .vectors and .jumptables. Instead the unused bytes should be + filled with nop instructions. */ + bfd_boolean shrinkable = TRUE; + + if (!strcmp (sec-name,.vectors) + || !strcmp (sec-name,.jumptables)) +shrinkable = FALSE; Shouln't this also cover .jumptables* and .progmem.gcc* ? avr-gcc puts its jumptables into .progmem.gcc_sw_table for instance. Relaxing must not do harm to them. -- Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email --- You are receiving this mail because: --- You are on the CC list for the bug. ___ bug-binutils mailing list bug-binutils@gnu.org https://lists.gnu.org/mailman/listinfo/bug-binutils
[Bug ld/13410] [avr]: error: relocation truncated to fit: R_AVR_13_PCREL against symbol
http://sourceware.org/bugzilla/show_bug.cgi?id=13410 --- Comment #6 from Eric Weddington eric.weddington at atmel dot com 2012-02-01 19:14:24 UTC --- Hi Vidya, Please resubmit patch with: - Email address in the Changelog entry set to your Atmel address. If you don't have a personal FSF contribution form signed off, then you need to submit it under your Atmel address, because we (Atmel) have a corporate FSF assignment on file. - Fix comments to be complete sentences, with capital letter on start, period at end of sentence and space after period and before the next sentence. And please attach the file to this bug report. Thanks! Eric Weddington -- Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email --- You are receiving this mail because: --- You are on the CC list for the bug. ___ bug-binutils mailing list bug-binutils@gnu.org https://lists.gnu.org/mailman/listinfo/bug-binutils
[Bug ld/13410] [avr]: error: relocation truncated to fit: R_AVR_13_PCREL against symbol
http://sourceware.org/bugzilla/show_bug.cgi?id=13410 --- Comment #7 from Vidya Praveen childbear0 at gmail dot com 2012-02-02 06:17:35 UTC --- (In reply to comment #6) Hi Vidya, Please resubmit patch with: - Email address in the Changelog entry set to your Atmel address. If you don't have a personal FSF contribution form signed off, then you need to submit it under your Atmel address, because we (Atmel) have a corporate FSF assignment on file. - Fix comments to be complete sentences, with capital letter on start, period at end of sentence and space after period and before the next sentence. And please attach the file to this bug report. Thanks! Eric Weddington Thanks Eric. But is it ok if I use this gmail address for all the communications but have the Atmel ID mentioned in the ChangeLog? I'll attach the patch to this report, but should I place the ChangeLog as comment here or should I put it in the beginning of the patch file? VP -- Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email --- You are receiving this mail because: --- You are on the CC list for the bug. ___ bug-binutils mailing list bug-binutils@gnu.org https://lists.gnu.org/mailman/listinfo/bug-binutils
[Bug ld/13410] [avr]: error: relocation truncated to fit: R_AVR_13_PCREL against symbol
http://sourceware.org/bugzilla/show_bug.cgi?id=13410 --- Comment #8 from Vidya Praveen childbear0 at gmail dot com 2012-02-02 07:46:59 UTC --- Created attachment 6188 -- http://sourceware.org/bugzilla/attachment.cgi?id=6188 Correct the condition for qualifying candidates for relaxation Log Message: 2012-02-01 Vidya Praveen (vidya.prav...@atmel.com) PR bfd/13410 * bfd/elf32-avr.c (elf32_avr_relax_section): Correct the condition for qualifying the candidates for relaxation. -- Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email --- You are receiving this mail because: --- You are on the CC list for the bug. ___ bug-binutils mailing list bug-binutils@gnu.org https://lists.gnu.org/mailman/listinfo/bug-binutils
[Bug ld/13410] [avr]: error: relocation truncated to fit: R_AVR_13_PCREL against symbol
http://sourceware.org/bugzilla/show_bug.cgi?id=13410 Vidya Praveen childbear0 at gmail dot com changed: What|Removed |Added Status|NEW |ASSIGNED CC||childbear0 at gmail dot com AssignedTo|unassigned at sourceware|childbear0 at gmail dot com |dot org | --- Comment #3 from Vidya Praveen childbear0 at gmail dot com 2012-01-31 16:26:35 UTC --- One of the two conditions that determines the candidates for relaxation (from JMP/CALL to rjmp/rcall), /* If the distance is within -4094..+4098 inclusive, then we can relax this jump/call. +4098 because the call/jump target will be closer after the relaxation. */ if ((int) gap = -4094 (int) gap = 4098) distance_short_enough = 1; checks for the range of distance -4094..+4098 inclusive. There are two issues here. The first issue is that the range should have been -4094 to +4097 (since we shrink by 2 bytes, we can consider a longer range than the original -4096 to +4095). The second issue is the primary reason for the failure reported in this PR. During the relaxation (elf32_avr_relax_section) of JMP/CALL to rjmp/rcall, some cases where we don't want to modify the ordering, 'nop's are inserted instead of deleting bytes: if (!strcmp (sec-name,.vectors) || !strcmp (sec-name,.jumptables)) { /* Let's insert a nop. */ bfd_put_8 (abfd, 0x00, contents + irel-r_offset + 2); bfd_put_8 (abfd, 0x00, contents + irel-r_offset + 3); } else { /* Delete two bytes of data. */ if (!elf32_avr_relax_delete_bytes (abfd, sec, irel-r_offset + 2, 2)) goto error_return; /* That will change things, so, we should relax again. Note that this is not required, and it may be slow. */ *again = TRUE; } While this is fine, the condition mentioned above that qualifies the candidates doesn't consider the situation where we don't shrink. That is, if the section is .vectors or .jumptables, we still check for -4094..+4098 range which assumes shrink. Causing larger offsets slipping through and which later found to be overflowing! I have fixed this issue and the following patch should fix this. I have tested with multiple testcases including the one that is presented here. OK for trunk? 2012-01-31 Vidya Praveen childbe...@gmail.com PR ld/13410 * bfd/elf32-avr.c (elf32_avr_relax_section): Correct the range for qualifying candidates for relaxation --- bfd/elf32-avr.c 2012-01-24 14:11:41.0 +0530 +++ bfd/elf32-avr.c 2012-01-31 20:30:26.0 +0530 @@ -1659,6 +1659,15 @@ Elf_Internal_Sym *isymbuf = NULL; struct elf32_avr_link_hash_table *htab; + /* if true, do not shrink by deleting bytes while relaxing.Such shrinking can +can cause issues for sections such as .vectors and .jumptables.Instead fill +with nop instructions */ + bfd_boolean shrinkable = TRUE; + + if (!strcmp (sec-name,.vectors) + || !strcmp (sec-name,.jumptables)) +shrinkable = FALSE; + if (link_info-relocatable) (*link_info-callbacks-einfo) (_(%P%F: --relax and -r may not be used together\n)); @@ -1815,10 +1824,12 @@ /* Compute the distance from this insn to the branch target. */ gap = value - dot; -/* If the distance is within -4094..+4098 inclusive, then we can - relax this jump/call. +4098 because the call/jump target +/* If the distance is within -4094..+4097 inclusive, then we can + relax this jump/call. +4097 because the call/jump target will be closer after the relaxation. */ -if ((int) gap = -4094 (int) gap = 4098) +if (!shrinkable ((int) gap = -4096 (int) gap = 4095)) + distance_short_enough = 1; +else if (shrinkable ((int) gap = -4094 (int) gap = 4097)) distance_short_enough = 1; /* Here we handle the wrap-around case. E.g. for a 16k device @@ -1895,8 +1906,7 @@ /* Check for the vector section. There we don't want to modify the ordering! */ -if (!strcmp (sec-name,.vectors) -|| !strcmp (sec-name,.jumptables)) +if (!shrinkable) { /* Let's insert a nop. */ bfd_put_8 (abfd, 0x00, contents + irel-r_offset + 2); -- Configure bugmail:
[Bug ld/13410] [avr]: error: relocation truncated to fit: R_AVR_13_PCREL against symbol
http://sourceware.org/bugzilla/show_bug.cgi?id=13410 --- Comment #4 from Vidya Praveen childbear0 at gmail dot com 2012-01-31 17:20:39 UTC --- posted the same to the mailing list with a mistake corrected in the change log (PR ld/13410 to PR bfd/13410). Sorry about the flowed format, I am trying to figure out how to disable that :-( http://cygwin.com/ml/binutils/2012-01/msg00285.html I can repost, if required. ~~~ -- Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email --- You are receiving this mail because: --- You are on the CC list for the bug. ___ bug-binutils mailing list bug-binutils@gnu.org https://lists.gnu.org/mailman/listinfo/bug-binutils
[Bug ld/13410] [avr]: error: relocation truncated to fit: R_AVR_13_PCREL against symbol
http://sourceware.org/bugzilla/show_bug.cgi?id=13410 --- Comment #5 from Vidya Praveen childbear0 at gmail dot com 2012-01-31 19:52:24 UTC --- Resubmitted: http://sourceware.org/ml/binutils/2012-01/msg00286.html -- Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email --- You are receiving this mail because: --- You are on the CC list for the bug. ___ bug-binutils mailing list bug-binutils@gnu.org https://lists.gnu.org/mailman/listinfo/bug-binutils
[Bug ld/13410] [avr]: error: relocation truncated to fit: R_AVR_13_PCREL against symbol
http://sourceware.org/bugzilla/show_bug.cgi?id=13410 Georg-Johann Lay gjl at gcc dot gnu.org changed: What|Removed |Added CC||j at uriah dot heep.sax.de --- Comment #2 from Georg-Johann Lay gjl at gcc dot gnu.org 2012-01-29 18:38:03 UTC --- CCed Jörg to ensure this is not a bug in avr-libc's startup code. -- Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email --- You are receiving this mail because: --- You are on the CC list for the bug. ___ bug-binutils mailing list bug-binutils@gnu.org https://lists.gnu.org/mailman/listinfo/bug-binutils
[Bug ld/13410] [avr]: error: relocation truncated to fit: R_AVR_13_PCREL against symbol
http://sourceware.org/bugzilla/show_bug.cgi?id=13410 --- Comment #1 from Georg-Johann Lay gjl at gcc dot gnu.org 2011-11-15 08:27:15 UTC --- == Complete error message (here with 2.21) == GNU ld (GNU Binutils) 2.21 e:/winavr/4.7.0-1/bin/../lib/gcc/avr/4.7.0/../../../../avr/lib/avr6/crtm2560.o: In function `__vectors': ../../../../../../source/avr-libc-1.7.1/crt1/gcrt1.S:53: relocation truncated to fit: R_AVR_13_PCREL against symbol `__vector_1' defined in .text section in e:/winavr/4.7.0-1/bin/../lib/gcc/avr/4.7.0/../../../../avr/lib/avr6/crtm2560.o collect2.exe: error: ld returned 1 exit status -- Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email --- You are receiving this mail because: --- You are on the CC list for the bug. ___ bug-binutils mailing list bug-binutils@gnu.org https://lists.gnu.org/mailman/listinfo/bug-binutils