[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/13616] linker should pad executable sections with nops, not zeros
http://sourceware.org/bugzilla/show_bug.cgi?id=13616 --- Comment #3 from cvs-commit at gcc dot gnu.org cvs-commit at gcc dot gnu.org 2012-01-31 17:54:47 UTC --- CVSROOT:/cvs/src Module name:src Changes by:h...@sourceware.org2012-01-31 17:54:39 Modified files: bfd: ChangeLog archures.c bfd-in2.h configure configure.in cpu-alpha.c cpu-arc.c cpu-arm.c cpu-avr.c cpu-bfin.c cpu-cr16.c cpu-cr16c.c cpu-cris.c cpu-crx.c cpu-d10v.c cpu-d30v.c cpu-dlx.c cpu-epiphany.c cpu-fr30.c cpu-frv.c cpu-h8300.c cpu-h8500.c cpu-hppa.c cpu-i370.c cpu-i386.c cpu-i860.c cpu-i960.c cpu-ia64.c cpu-ip2k.c cpu-iq2000.c cpu-k1om.c cpu-l1om.c cpu-lm32.c cpu-m10200.c cpu-m10300.c cpu-m32c.c cpu-m32r.c cpu-m68hc11.c cpu-m68hc12.c cpu-m68k.c cpu-m88k.c cpu-mcore.c cpu-mep.c cpu-microblaze.c cpu-mips.c cpu-mmix.c cpu-moxie.c cpu-msp430.c cpu-mt.c cpu-ns32k.c cpu-openrisc.c cpu-or32.c cpu-pdp11.c cpu-pj.c cpu-plugin.c cpu-powerpc.c cpu-rl78.c cpu-rs6000.c cpu-rx.c cpu-s390.c cpu-score.c cpu-sh.c cpu-sparc.c cpu-spu.c cpu-tic30.c cpu-tic4x.c cpu-tic54x.c cpu-tic6x.c cpu-tic80.c cpu-tilegx.c cpu-tilepro.c cpu-v850.c cpu-vax.c cpu-w65.c cpu-we32k.c cpu-xc16x.c cpu-xstormy16.c cpu-xtensa.c cpu-z80.c cpu-z8k.c libbfd.h linker.c ld : ChangeLog ldlang.c ldwrite.c ld/emulparams : elf32_x86_64.sh elf_i386.sh elf_i386_be.sh elf_i386_ldso.sh elf_i386_vxworks.sh elf_k1om.sh elf_l1om.sh elf_x86_64.sh ld/scripttempl : elf.sc ld/testsuite : ChangeLog ld/testsuite/ld-i386: tlsbindesc.dd tlsnopic.dd tlspic.dd ld/testsuite/ld-x86-64: tlsbin.dd tlsbindesc.dd tlspic.dd include: ChangeLog bfdlink.h Log message: Support arch-dependent fill bfd/ 2012-01-31 H.J. Lu hongjiu...@intel.com PR ld/13616 * archures.c (bfd_arch_info): Add fill. (bfd_default_arch_struct): Add bfd_arch_default_fill. (bfd_arch_default_fill): New. * configure.in: Set bfd version to 2.22.52. * configure: Regenerated. * cpu-alpha.c: Add bfd_arch_default_fill to bfd_arch_info initializer. * cpu-arc.c: Likewise. * cpu-arm.c: Likewise. * cpu-avr.c: Likewise. * cpu-bfin.c: Likewise. * cpu-cr16.c: Likewise. * cpu-cr16c.c: Likewise. * cpu-cris.c: Likewise. * cpu-crx.c: Likewise. * cpu-d10v.c: Likewise. * cpu-d30v.c: Likewise. * cpu-dlx.c: Likewise. * cpu-epiphany.c: Likewise. * cpu-fr30.c: Likewise. * cpu-frv.c: Likewise. * cpu-h8300.c: Likewise. * cpu-h8500.c: Likewise. * cpu-hppa.c: Likewise. * cpu-i370.c: Likewise. * cpu-i860.c: Likewise. * cpu-i960.c: Likewise. * cpu-ia64.c: Likewise. * cpu-ip2k.c: Likewise. * cpu-iq2000.c: Likewise. * cpu-lm32.c: Likewise. * cpu-m10200.c: Likewise. * cpu-m10300.c: Likewise. * cpu-m32c.c: Likewise. * cpu-m32r.c: Likewise. * cpu-m68hc11.c: Likewise. * cpu-m68hc12.c: Likewise. * cpu-m68k.c: Likewise. * cpu-m88k.c: Likewise. * cpu-mcore.c: Likewise. * cpu-mep.c: Likewise. * cpu-microblaze.c: Likewise. * cpu-mips.c: Likewise. * cpu-mmix.c: Likewise. * cpu-moxie.c: Likewise. * cpu-msp430.c: Likewise. * cpu-mt.c: Likewise. * cpu-ns32k.c: Likewise. * cpu-openrisc.c: Likewise. * cpu-or32.c: Likewise. * cpu-pdp11.c: Likewise. * cpu-pj.c: Likewise. * cpu-plugin.c: Likewise. * cpu-powerpc.c: Likewise. * cpu-rl78.c: Likewise. * cpu-rs6000.c: Likewise. * cpu-rx.c: Likewise. * cpu-s390.c: Likewise. * cpu-score.c: Likewise. * cpu-sh.c: Likewise. * cpu-sparc.c: Likewise. * cpu-spu.c: Likewise. * cpu-tic30.c: Likewise. * cpu-tic4x.c: Likewise. * cpu-tic54x.c: Likewise. * cpu-tic6x.c: Likewise. * cpu-tic80.c: Likewise. * cpu-tilegx.c: Likewise. * cpu-tilepro.c: Likewise. * cpu-v850.c: Likewise. * cpu-vax.c: Likewise. * cpu-w65.c: Likewise. * cpu-we32k.c: Likewise. * cpu-xc16x.c: Likewise. * cpu-xstormy16.c: Likewise. * cpu-xtensa.c: Likewise. * cpu-z80.c: Likewise. * cpu-z8k.c: Likewise. * cpu-i386.c: Include libiberty.h. (bfd_arch_i386_fill): New. Add bfd_arch_i386_fill to bfd_arch_info initializer. * cpu-k1om.c: Add bfd_arch_i386_fill to bfd_arch_info initializer. * cpu-l1om.c: Likewise. * linker.c (default_data_link_order): Call abfd-arch_info-fill if fill size is 0. * bfd-in2.h: Regenerated. include/ 2012-01-31
[Bug ld/13616] linker should pad executable sections with nops, not zeros
http://sourceware.org/bugzilla/show_bug.cgi?id=13616 --- Comment #4 from H.J. Lu hjl.tools at gmail dot com 2012-01-31 18:58:16 UTC --- It is fixed for i386 and x86-64. -- 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