[Bug gas/12049] Unnecessary relaxation
https://sourceware.org/bugzilla/show_bug.cgi?id=12049 --- Comment #19 from cvs-commit at gcc dot gnu.org --- The master branch has been updated by Alan Modra : https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=37a5888387413a4b787468eff710eefebe134201 commit 37a5888387413a4b787468eff710eefebe134201 Author: Alan Modra Date: Fri Oct 25 19:46:24 2019 +1030 PR25125, relaxation chooses wrong branch size The patch I made for PR12049 didn't test for a "negative" branch properly. "if (target < address)" ought to have been "if (target < address + fragP->fr_fix)". Rather than making that change, this patch adds fragP->fr_fix into address earlier. The patch also avoids running into a bad interaction with the m68k md_prepare_relax_scan by returning zero growth immediately, since the adjusted target expression would result in a zero "aim". PR gas/25125 PR gas/12049 * write.c (relax_frag): Correct calculation of delta for positive branches where "stretch" would make the branch negative. Return zero immediately in that case. Correct TC_PCREL_ADJUST comment. -- You are receiving this mail because: You are on the CC list for the bug.
[Bug gas/12049] Unnecessary relaxation
http://sourceware.org/bugzilla/show_bug.cgi?id=12049 H.J. Lu hjl.tools at gmail dot com changed: What|Removed |Added Status|ASSIGNED|RESOLVED Resolution||FIXED --- Comment #18 from H.J. Lu hjl.tools at gmail dot com 2010-10-25 09:59:51 UTC --- Fixed. -- 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 http://lists.gnu.org/mailman/listinfo/bug-binutils
[Bug gas/12049] Unnecessary relaxation
http://sourceware.org/bugzilla/show_bug.cgi?id=12049 Alan Modra amodra at gmail dot com changed: What|Removed |Added Status|NEW |ASSIGNED CC||amodra at gmail dot com AssignedTo|unassigned at sources dot |amodra at gmail dot com |redhat.com | --- Comment #17 from Alan Modra amodra at gmail dot com 2010-10-23 11:58:22 UTC --- Nice testcase! The comment in my fix below explains how relax_frag went wrong. I'll apply this later, probably tomorrow sometime. Index: gas/write.c === RCS file: /cvs/src/src/gas/write.c,v retrieving revision 1.134 diff -u -p -r1.134 write.c --- gas/write.c19 Oct 2010 12:14:23 -1.134 +++ gas/write.c23 Oct 2010 11:55:01 - @@ -2163,6 +2163,13 @@ relax_frag (segT segment, fragS *fragP, if (stretch 0 || sym_frag-region == fragP-region) target += stretch; + /* If we get here we know we have a forward branch. This + relax pass may have stretched previous instructions so + far that omitting STRETCH would make the branch + negative. Don't allow this in case the negative reach is + large enough to require a larger branch instruction. */ + else if (target address) +target = fragP-fr_next-fr_address + stretch; } } -- 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 http://lists.gnu.org/mailman/listinfo/bug-binutils
[Bug gas/12049] Unnecessary relaxation
http://sourceware.org/bugzilla/show_bug.cgi?id=12049 --- Comment #9 from Rafael Ávila de Espíndola rafael.espindola at gmail dot com 2010-10-22 18:42:02 UTC --- The current binutils now gets the two previous tests right (thanks!), but it is still missing some cases. With the new testcase it encodes a je as 0f 84 02 00 00 00 That can be also encoded as 74 06 -- 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 http://lists.gnu.org/mailman/listinfo/bug-binutils
[Bug gas/12049] Unnecessary relaxation
http://sourceware.org/bugzilla/show_bug.cgi?id=12049 Rafael Ávila de Espíndola rafael.espindola at gmail dot com changed: What|Removed |Added Attachment #5024|0 |1 is obsolete|| Attachment #5025|0 |1 is obsolete|| --- Comment #10 from Rafael Ávila de Espíndola rafael.espindola at gmail dot com 2010-10-22 18:42:43 UTC --- Created attachment 5079 -- http://sourceware.org/bugzilla/attachment.cgi?id=5079 New test that still fails. -- 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 http://lists.gnu.org/mailman/listinfo/bug-binutils
[Bug gas/12049] Unnecessary relaxation
http://sourceware.org/bugzilla/show_bug.cgi?id=12049 Rafael Ávila de Espíndola rafael.espindola at gmail dot com changed: What|Removed |Added Status|RESOLVED|REOPENED Resolution|FIXED | --- Comment #11 from Rafael Ávila de Espíndola rafael.espindola at gmail dot com 2010-10-22 18:43:41 UTC --- Reopening as the new test still fails. -- 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 http://lists.gnu.org/mailman/listinfo/bug-binutils
[Bug gas/12049] Unnecessary relaxation
http://sourceware.org/bugzilla/show_bug.cgi?id=12049 H.J. Lu hjl.tools at gmail dot com changed: What|Removed |Added Status|REOPENED|RESOLVED Resolution||FIXED --- Comment #8 from H.J. Lu hjl.tools at gmail dot com 2010-10-22 18:38:59 UTC --- Fixed by http://sourceware.org/ml/binutils-cvs/2010-10/msg00108.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 http://lists.gnu.org/mailman/listinfo/bug-binutils
[Bug gas/12049] Unnecessary relaxation
http://sourceware.org/bugzilla/show_bug.cgi?id=12049 H.J. Lu hjl.tools at gmail dot com changed: What|Removed |Added Attachment #5080|application/octet-stream|text/plain mime type|| -- 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 http://lists.gnu.org/mailman/listinfo/bug-binutils
[Bug gas/12049] Unnecessary relaxation
http://sourceware.org/bugzilla/show_bug.cgi?id=12049 H.J. Lu hjl.tools at gmail dot com changed: What|Removed |Added Status|REOPENED|WAITING --- Comment #12 from H.J. Lu hjl.tools at gmail dot com 2010-10-22 19:13:15 UTC --- (In reply to comment #10) Created attachment 5079 [details] New test that still fails. This is identical to the testcase in comment 5. Did you upload the wrong testcase? -- 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 http://lists.gnu.org/mailman/listinfo/bug-binutils
[Bug gas/12049] Unnecessary relaxation
http://sourceware.org/bugzilla/show_bug.cgi?id=12049 Rafael Ávila de Espíndola rafael.espindola at gmail dot com changed: What|Removed |Added Attachment #5079|0 |1 is obsolete|| --- Comment #13 from Rafael Ávila de Espíndola rafael.espindola at gmail dot com 2010-10-22 19:24:18 UTC --- Created attachment 5080 -- http://sourceware.org/bugzilla/attachment.cgi?id=5080 The new testcase. Attached the wrong test previously. -- 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 http://lists.gnu.org/mailman/listinfo/bug-binutils
[Bug gas/12049] Unnecessary relaxation
http://sourceware.org/bugzilla/show_bug.cgi?id=12049 H.J. Lu hjl.tools at gmail dot com changed: What|Removed |Added Attachment #5079|application/octet-stream|text/plain mime type|| -- 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 http://lists.gnu.org/mailman/listinfo/bug-binutils
[Bug gas/12049] Unnecessary relaxation
http://sourceware.org/bugzilla/show_bug.cgi?id=12049 --- Comment #15 from Rafael Ávila de Espíndola rafael.espindola at gmail dot com 2010-10-22 19:37:20 UTC --- The last je is the one that fits in 8 bits: je.LBB1_17 .align16, 0x90 .LBB1_17: -- 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 http://lists.gnu.org/mailman/listinfo/bug-binutils
[Bug gas/12049] Unnecessary relaxation
http://sourceware.org/bugzilla/show_bug.cgi?id=12049 H.J. Lu hjl.tools at gmail dot com changed: What|Removed |Added Status|WAITING |NEW --- Comment #16 from H.J. Lu hjl.tools at gmail dot com 2010-10-22 19:45:48 UTC --- (In reply to comment #15) The last je is the one that fits in 8 bits: je.LBB1_17 .align16, 0x90 .LBB1_17: My fix at: http://sourceware.org/ml/binutils/2010-10/msg00281.html handles this case correctly :-). -- 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 http://lists.gnu.org/mailman/listinfo/bug-binutils
[Bug gas/12049] Unnecessary relaxation
http://sourceware.org/bugzilla/show_bug.cgi?id=12049 --- Comment #14 from H.J. Lu hjl.tools at gmail dot com 2010-10-22 19:33:46 UTC --- (In reply to comment #13) Created attachment 5080 [details] The new testcase. Attached the wrong test previously. Please tell me which branchs should have 8bit displacement. -- 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 http://lists.gnu.org/mailman/listinfo/bug-binutils
[Bug gas/12049] Unnecessary relaxation
http://sourceware.org/bugzilla/show_bug.cgi?id=12049 H.J. Lu hjl.tools at gmail dot com changed: What|Removed |Added Status|RESOLVED|REOPENED Resolution|WONTFIX | --- Comment #7 from H.J. Lu hjl.tools at gmail dot com 2010-10-16 22:29:41 UTC --- A patch is posted at http://sourceware.org/ml/binutils/2010-10/msg00253.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 http://lists.gnu.org/mailman/listinfo/bug-binutils
[Bug gas/12049] Unnecessary relaxation
http://sourceware.org/bugzilla/show_bug.cgi?id=12049 H.J. Lu hjl.tools at gmail dot com changed: What|Removed |Added Version|unspecified |2.21 (HEAD) -- 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 http://lists.gnu.org/mailman/listinfo/bug-binutils
[Bug gas/12049] Unnecessary relaxation
http://sourceware.org/bugzilla/show_bug.cgi?id=12049 H.J. Lu hjl.tools at gmail dot com changed: What|Removed |Added Status|NEW |RESOLVED Resolution||WONTFIX --- Comment #6 from H.J. Lu hjl.tools at gmail dot com 2010-10-14 13:37:11 UTC --- This is due to relaxation between alignment directives and branch instructions. There is no easy way to fix all cases. I checked in a patch to support .d32 suffix to force 32bit displacement. You can do [...@gnu-6 pr12049]$ cat test3.s .fill 56, 1, 0x90 jne.d32 .LBB0_43 .fill 10, 1, 0x90 jne .LBB0_43 .fill 5, 1, 0x90 .align 16, 0x90 .fill 118, 1, 0x90 .LBB0_43: [...@gnu-6 pr12049]$ ./as -o test3.o test3.s [...@gnu-6 pr12049]$ objdump -dw test3.o test3.o: file format elf64-x86-64 Disassembly of section .text: .text: 0:90 nop 1:90 nop 2:90 nop 3:90 nop 4:90 nop 5:90 nop 6:90 nop 7:90 nop 8:90 nop 9:90 nop a:90 nop b:90 nop c:90 nop d:90 nop e:90 nop f:90 nop 10:90 nop 11:90 nop 12:90 nop 13:90 nop 14:90 nop 15:90 nop 16:90 nop 17:90 nop 18:90 nop 19:90 nop 1a:90 nop 1b:90 nop 1c:90 nop 1d:90 nop 1e:90 nop 1f:90 nop 20:90 nop 21:90 nop 22:90 nop 23:90 nop 24:90 nop 25:90 nop 26:90 nop 27:90 nop 28:90 nop 29:90 nop 2a:90 nop 2b:90 nop 2c:90 nop 2d:90 nop 2e:90 nop 2f:90 nop 30:90 nop 31:90 nop 32:90 nop 33:90 nop 34:90 nop 35:90 nop 36:90 nop 37:90 nop 38:0f 85 88 00 00 00jne0xc6 3e:90 nop 3f:90 nop 40:90 nop 41:90 nop 42:90 nop 43:90 nop 44:90 nop 45:90 nop 46:90 nop 47:90 nop 48:75 7cjne0xc6 4a:90 nop 4b:90 nop 4c:90 nop 4d:90 nop 4e:90 nop 4f:90 nop 50:90 nop 51:90 nop 52:90 nop 53:90 nop 54:90 nop 55:90 nop 56:90 nop 57:90 nop 58:90 nop 59:90 nop 5a:90 nop 5b:90 nop 5c:90 nop 5d:90 nop 5e:90 nop 5f:90 nop 60:90 nop 61:90 nop 62:90 nop 63:90 nop 64:90 nop 65:90 nop 66:90 nop 67:90 nop 68:90 nop 69:90 nop 6a:90 nop 6b:90 nop 6c:90 nop 6d:90 nop 6e:
[Bug gas/12049] Unnecessary relaxation
--- Additional Comments From rafael dot espindola at gmail dot com 2010-10-01 14:56 --- It is a complete test. I will attach two .s files that show that the problems is likely in not correctly updating the size estimates. Run: as --64 test.s -o test.o as --64 test2.s -o test2.o objdump -d test.o test.dump objdump -d test2.o test2.dump And compare the dumps. Note that the addresses align, but in the first case we produce a 5 byte jmp in the second one we produce a 2 bytes one. -- What|Removed |Added Status|WAITING |NEW http://sourceware.org/bugzilla/show_bug.cgi?id=12049 --- You are receiving this mail because: --- You are on the CC list for the bug, or are watching someone who is. ___ bug-binutils mailing list bug-binutils@gnu.org http://lists.gnu.org/mailman/listinfo/bug-binutils
[Bug gas/12049] Unnecessary relaxation
--- Additional Comments From rafael dot espindola at gmail dot com 2010-10-01 14:57 --- Created an attachment (id=5025) -- (http://sourceware.org/bugzilla/attachment.cgi?id=5025action=view) test -- http://sourceware.org/bugzilla/show_bug.cgi?id=12049 --- You are receiving this mail because: --- You are on the CC list for the bug, or are watching someone who is. ___ bug-binutils mailing list bug-binutils@gnu.org http://lists.gnu.org/mailman/listinfo/bug-binutils
[Bug gas/12049] Unnecessary relaxation
--- Additional Comments From rafael dot espindola at gmail dot com 2010-10-01 14:57 --- Created an attachment (id=5024) -- (http://sourceware.org/bugzilla/attachment.cgi?id=5024action=view) test -- http://sourceware.org/bugzilla/show_bug.cgi?id=12049 --- You are receiving this mail because: --- You are on the CC list for the bug, or are watching someone who is. ___ bug-binutils mailing list bug-binutils@gnu.org http://lists.gnu.org/mailman/listinfo/bug-binutils
[Bug gas/12049] Unnecessary relaxation
--- Additional Comments From rafael dot espindola at gmail dot com 2010-10-01 15:39 --- A slightly more interesting testcase: .fill 56, 1, 0x90 jne .LBB0_43 .fill 10, 1, 0x90 jne .LBB0_43 .fill 5, 1, 0x90 .align 16, 0x90 .fill 118, 1, 0x90 .LBB0_43: gas is producing two 6 bytes jne. Chang the first one with a .fill 6,1,0x90 and the second one becomes a 2 bytes jne -- http://sourceware.org/bugzilla/show_bug.cgi?id=12049 --- You are receiving this mail because: --- You are on the CC list for the bug, or are watching someone who is. ___ bug-binutils mailing list bug-binutils@gnu.org http://lists.gnu.org/mailman/listinfo/bug-binutils
[Bug gas/12049] Unnecessary relaxation
--- Additional Comments From hjl dot tools at gmail dot com 2010-10-01 05:30 --- Please provide a complete testcase. The final offset depends on the address of the second jump. I can't tell what its address is. -- What|Removed |Added Status|NEW |WAITING http://sourceware.org/bugzilla/show_bug.cgi?id=12049 --- You are receiving this mail because: --- You are on the CC list for the bug, or are watching someone who is. ___ bug-binutils mailing list bug-binutils@gnu.org http://lists.gnu.org/mailman/listinfo/bug-binutils
[Bug gas/12049] Unnecessary relaxation
-- What|Removed |Added CC||hjl dot tools at gmail dot ||com http://sourceware.org/bugzilla/show_bug.cgi?id=12049 --- You are receiving this mail because: --- You are on the CC list for the bug, or are watching someone who is. ___ bug-binutils mailing list bug-binutils@gnu.org http://lists.gnu.org/mailman/listinfo/bug-binutils