[Bug gas/23854] 16-bit GOT access is incorrectly optimized
https://sourceware.org/bugzilla/show_bug.cgi?id=23854 --- Comment #30 from cvs-commit at gcc dot gnu.org --- The binutils-2_30-branch branch has been updated by H.J. Lu : https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=3050b43068674882b01a51351c5c39e950f0ee41 commit 3050b43068674882b01a51351c5c39e950f0ee41 Author: H.J. Lu Date: Mon Nov 5 09:01:26 2018 -0800 x86: Disable GOT relaxation with data prefix Since linker GOT relaxation isn't valid for 16-bit GOT access, we should disable GOT relaxation with data prefix. gas/ PR gas/23854 * config/tc-i386.c (output_disp): Disable GOT relaxation with data prefix. * testsuite/gas/i386/mixed-mode-reloc32.d: Updated. ld/ PR gas/23854 * testsuite/ld-i386/i386.exp: Run pr23854. * testsuite/ld-x86-64/x86-64.exp: Likewwise. * testsuite/ld-i386/pr23854.d: New file. * testsuite/ld-i386/pr23854.s: Likewwise. * testsuite/ld-i386/pr23854.d: Likewwise. * testsuite/ld-x86-64/pr23854.d: Likewwise. * testsuite/ld-x86-64/pr23854.s: Likewwise. (cherry picked from commit e60f4d3bdac25f02875afe36b7436bc2dfbbb978) -- 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 gas/23854] 16-bit GOT access is incorrectly optimized
https://sourceware.org/bugzilla/show_bug.cgi?id=23854 H.J. Lu changed: What|Removed |Added Status|NEW |RESOLVED Resolution|--- |FIXED Target Milestone|--- |2.32 --- Comment #29 from H.J. Lu --- Fixed for 2.32 and 2.31 branch. -- 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 gas/23854] 16-bit GOT access is incorrectly optimized
https://sourceware.org/bugzilla/show_bug.cgi?id=23854 --- Comment #28 from cvs-commit at gcc dot gnu.org --- The binutils-2_31-branch branch has been updated by H.J. Lu : https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=1929a39655d77686385913ef63c6c4340bb2d729 commit 1929a39655d77686385913ef63c6c4340bb2d729 Author: H.J. Lu Date: Mon Nov 5 09:01:26 2018 -0800 x86: Disable GOT relaxation with data prefix Since linker GOT relaxation isn't valid for 16-bit GOT access, we should disable GOT relaxation with data prefix. gas/ PR gas/23854 * config/tc-i386.c (output_disp): Disable GOT relaxation with data prefix. * testsuite/gas/i386/mixed-mode-reloc32.d: Updated. ld/ PR gas/23854 * testsuite/ld-i386/i386.exp: Run pr23854. * testsuite/ld-x86-64/x86-64.exp: Likewwise. * testsuite/ld-i386/pr23854.d: New file. * testsuite/ld-i386/pr23854.s: Likewwise. * testsuite/ld-i386/pr23854.d: Likewwise. * testsuite/ld-x86-64/pr23854.d: Likewwise. * testsuite/ld-x86-64/pr23854.s: Likewwise. (cherry picked from commit e60f4d3bdac25f02875afe36b7436bc2dfbbb978) -- 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 gas/23854] 16-bit GOT access is incorrectly optimized
https://sourceware.org/bugzilla/show_bug.cgi?id=23854 --- Comment #27 from Andreas Schwab --- Customize "After changing a bug" in userprefs. -- 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 gas/23854] 16-bit GOT access is incorrectly optimized
https://sourceware.org/bugzilla/show_bug.cgi?id=23854 --- Comment #26 from Stas Sergeev --- By the way, is it a feature of this bugzilla to open the entirely different bug ticket after I post any comment? This always makes me worry that I posted to wrong thread. For example, when I post to _this_ ticket, bugzilla opens ticket 14187. -- 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 gas/23854] 16-bit GOT access is incorrectly optimized
https://sourceware.org/bugzilla/show_bug.cgi?id=23854 --- Comment #25 from Stas Sergeev --- > What your code did is outside of scope of i386 psABI. Why not linker tells me so with an error msg?(In reply to H.J. Lu from comment #24) > (In reply to Stas Sergeev from comment #23) > > > What your code did is outside of scope of i386 psABI. > > > > Why not linker tells me so with an error msg? > > There are many corner cases linker doesn't check. But in this particular case, when it overwrites the instructions with something else, it _could_ have checked. :( I don't think other unchecked corner cases give that level of breakage and difficulty to debug. > You have things like > > extern void foo (void); > > short > foo_p (void) > { > return 0x400 - (int) > } > > In normal i386 case, is 32 bits, especially with PIE. BTW, > does your code work without -no-pie using ANY linkers? You mean, any other than ld, or including ld? In fact, I added -no-pie just very recently: https://github.com/stsp/dosemu2/commit/d5eb51320477f32df7deb9161fa728e12bcd06dd to get the high load address. Before that, it definitely worked with ld, and most likely also with gold (but I haven't checked gold for quite some time). Note that older ubuntu distros (and likely others) used no-pie by default. ubuntu defaulted to pie only in 18.04 or so, which started to give me the low load address again. -- 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 gas/23854] 16-bit GOT access is incorrectly optimized
https://sourceware.org/bugzilla/show_bug.cgi?id=23854 --- Comment #24 from H.J. Lu --- (In reply to Stas Sergeev from comment #23) > > What your code did is outside of scope of i386 psABI. > > Why not linker tells me so with an error msg? There are many corner cases linker doesn't check. You have things like extern void foo (void); short foo_p (void) { return 0x400 - (int) } In normal i386 case, is 32 bits, especially with PIE. BTW, does your code work without -no-pie using ANY linkers? -- 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 gas/23854] 16-bit GOT access is incorrectly optimized
https://sourceware.org/bugzilla/show_bug.cgi?id=23854 --- Comment #23 from Stas Sergeev --- > What your code did is outside of scope of i386 psABI. Why not linker tells me so with an error msg? -- 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 gas/23854] 16-bit GOT access is incorrectly optimized
https://sourceware.org/bugzilla/show_bug.cgi?id=23854 --- Comment #22 from H.J. Lu --- (In reply to Stas Sergeev from comment #20) > I disasmed and diffed the object files > without and with your patch. I see a lot of: > --- > 597,598c597,598 > < 745: 8d 74 26 00 lea0x0(%esi,%eiz,1),%esi > < 749: 8d bc 27 00 00 00 00lea0x0(%edi,%eiz,1),%edi > --- > > 745: 8d b4 26 00 00 00 00lea0x0(%esi,%eiz,1),%esi > > 74c: 8d 74 26 00 lea0x0(%esi,%eiz,1),%esi > --- > > Is this correct, that it now applies lea to > %esi twice? As %esi is used as both arg and > result, I think it will be modified twice, > and so I can't imagine those changes lead to > an equivalent code. These are NOPs. -- 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 gas/23854] 16-bit GOT access is incorrectly optimized
https://sourceware.org/bugzilla/show_bug.cgi?id=23854 --- Comment #21 from H.J. Lu --- (In reply to Stas Sergeev from comment #19) > > H.J. Lu changed: > > Your code doesn't conform to i386 psABI, which doesn't > > support only using lower 16 bits of GOT entries. > I would understand if linker writes me such an error. > Silently producing corrupted binaries is the sign of > low quality software. You can add checks, error messages, > but never let the broken output... What your code did is outside of scope of i386 psABI. -- 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 gas/23854] 16-bit GOT access is incorrectly optimized
https://sourceware.org/bugzilla/show_bug.cgi?id=23854 --- Comment #20 from Stas Sergeev --- I disasmed and diffed the object files without and with your patch. I see a lot of: --- 597,598c597,598 < 745: 8d 74 26 00 lea0x0(%esi,%eiz,1),%esi < 749: 8d bc 27 00 00 00 00lea0x0(%edi,%eiz,1),%edi --- > 745: 8d b4 26 00 00 00 00lea0x0(%esi,%eiz,1),%esi > 74c: 8d 74 26 00 lea0x0(%esi,%eiz,1),%esi --- Is this correct, that it now applies lea to %esi twice? As %esi is used as both arg and result, I think it will be modified twice, and so I can't imagine those changes lead to an equivalent code. -- 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 gas/23854] 16-bit GOT access is incorrectly optimized
https://sourceware.org/bugzilla/show_bug.cgi?id=23854 --- Comment #19 from Stas Sergeev --- > H.J. Lu changed: > Your code doesn't conform to i386 psABI, which doesn't > support only using lower 16 bits of GOT entries. I would understand if linker writes me such an error. Silently producing corrupted binaries is the sign of low quality software. You can add checks, error messages, but never let the broken output... -- 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 gas/23854] 16-bit GOT access is incorrectly optimized
https://sourceware.org/bugzilla/show_bug.cgi?id=23854 --- Comment #18 from cvs-commit at gcc dot gnu.org --- The master branch has been updated by H.J. Lu : https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=a4749e56cacefdc1a571231744a9b87a3f5458b9 commit a4749e56cacefdc1a571231744a9b87a3f5458b9 Author: H.J. Lu Date: Mon Nov 5 11:12:28 2018 -0800 Correct ChangeLog entries for PR gas/23854 commit commit e60f4d3bdac25f02875afe36b7436bc2dfbbb978 Author: H.J. Lu Date: Mon Nov 5 09:01:26 2018 -0800 x86: Disable GOT relaxation with data prefix Since linker GOT relaxation isn't valid for 16-bit GOT access, we should disable GOT relaxation with data prefix. -- 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 gas/23854] 16-bit GOT access is incorrectly optimized
https://sourceware.org/bugzilla/show_bug.cgi?id=23854 --- Comment #17 from H.J. Lu --- (In reply to Stas Sergeev from comment #16) > > H.J. Lu changed: > > Please try: > > > > https://sourceware.org/ml/binutils/2018-11/msg00021.html > > > > You need to compile with the new assembler. > Building your git now... > However. Are there really no hopes to link > these already existing objects properly? > gold have no problems with those, and if you Old binutils also didn't have this issue. > consider them "broken" to the point that it > isn't worth an efforts, then maybe at least > ld can detect the problem and error out? > Because its exactly ld that corrupted the > instructions, and I really am surprised you > didn't even put any small band-aid to stop > it from ever doing so. Your code doesn't conform to i386 psABI, which doesn't support only using lower 16 bits of GOT entries. -- 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 gas/23854] 16-bit GOT access is incorrectly optimized
https://sourceware.org/bugzilla/show_bug.cgi?id=23854 --- Comment #16 from Stas Sergeev --- > H.J. Lu changed: > Please try: > > https://sourceware.org/ml/binutils/2018-11/msg00021.html > > You need to compile with the new assembler. Building your git now... However. Are there really no hopes to link these already existing objects properly? gold have no problems with those, and if you consider them "broken" to the point that it isn't worth an efforts, then maybe at least ld can detect the problem and error out? Because its exactly ld that corrupted the instructions, and I really am surprised you didn't even put any small band-aid to stop it from ever doing so. -- 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 gas/23854] 16-bit GOT access is incorrectly optimized
https://sourceware.org/bugzilla/show_bug.cgi?id=23854 --- Comment #15 from H.J. Lu --- (In reply to Stas Sergeev from comment #14) > > H.J. Lu changed: > > > >What|Removed |Added > > > > Component|ld |gas > Sorry for being pedantic, but there is no > such problem with gold. So while gas may be gold != ld > involved too, I wonder are you sure there is > no bug in ld itself. Please try: https://sourceware.org/ml/binutils/2018-11/msg00021.html You need to compile with the new assembler. -- 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 gas/23854] 16-bit GOT access is incorrectly optimized
https://sourceware.org/bugzilla/show_bug.cgi?id=23854 --- Comment #14 from Stas Sergeev --- > H.J. Lu changed: > >What|Removed |Added > > Component|ld |gas Sorry for being pedantic, but there is no such problem with gold. So while gas may be involved too, I wonder are you sure there is no bug in ld itself. -- 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 gas/23854] 16-bit GOT access is incorrectly optimized
https://sourceware.org/bugzilla/show_bug.cgi?id=23854 H.J. Lu changed: What|Removed |Added Component|ld |gas -- 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