[Bug ld/19011] Issues with ld on mingw-w64 and bad defaults
https://sourceware.org/bugzilla/show_bug.cgi?id=19011 sourceware-bugzilla at jdrake dot com changed: What|Removed |Added CC||sourceware-bugzilla@jdrake. ||com --- Comment #10 from sourceware-bugzilla at jdrake dot com --- Created attachment 12800 --> https://sourceware.org/bugzilla/attachment.cgi?id=12800&action=edit [PATCH 1/2] Add options to disable dll characteristics flags. -- You are receiving this mail because: You are on the CC list for the bug.
[Bug ld/19011] Issues with ld on mingw-w64 and bad defaults
https://sourceware.org/bugzilla/show_bug.cgi?id=19011 --- Comment #11 from sourceware-bugzilla at jdrake dot com --- Created attachment 12801 --> https://sourceware.org/bugzilla/attachment.cgi?id=12801&action=edit [PATCH 2/2] LD/PR19011: more secure default PE options. -- You are receiving this mail because: You are on the CC list for the bug.
[Bug ld/19011] Issues with ld on mingw-w64 and bad defaults
https://sourceware.org/bugzilla/show_bug.cgi?id=19011 sourceware-bugzilla at jdrake dot com changed: What|Removed |Added Attachment #12801|0 |1 is obsolete|| --- Comment #12 from sourceware-bugzilla at jdrake dot com --- Created attachment 12802 --> https://sourceware.org/bugzilla/attachment.cgi?id=12802&action=edit [PATCH 2/2] LD/PR19011: more secure default PE options. It was pointed out that the default base addresses for cygwin are not the same as the default base addresses for normal Windows binaries, so I updated the non-cygwin values to the defaults from MSVC, and came up with 0x1C000 for the auto image base range. -- You are receiving this mail because: You are on the CC list for the bug.
[Bug ld/19011] Issues with ld on mingw-w64 and bad defaults
https://sourceware.org/bugzilla/show_bug.cgi?id=19011 sourceware-bugzilla at jdrake dot com changed: What|Removed |Added Attachment #12802|0 |1 is obsolete|| --- Comment #13 from sourceware-bugzilla at jdrake dot com --- Created attachment 12804 --> https://sourceware.org/bugzilla/attachment.cgi?id=12804&action=edit [PATCH 2/2] LD/PR19011: more secure default PE options. Also needed to turn pe_dll_enable_reloc_section on by default to correspond with dynamicbase being on by default. -- You are receiving this mail because: You are on the CC list for the bug.
[Bug ld/19011] Issues with ld on mingw-w64 and bad defaults
https://sourceware.org/bugzilla/show_bug.cgi?id=19011 --- Comment #19 from sourceware-bugzilla at jdrake dot com --- Perhaps the default enabling of --enable-reloc-section should have been more limited? That was a last-minute change on my part, when I noticed the executables I built were not actually having ASLR applied to them due to lack of relocations. I did not consider non-x86 targets there. -- You are receiving this mail because: You are on the CC list for the bug.
[Bug ld/19011] Issues with ld on mingw-w64 and bad defaults
https://sourceware.org/bugzilla/show_bug.cgi?id=19011 --- Comment #24 from sourceware-bugzilla at jdrake dot com --- (In reply to cvs-com...@gcc.gnu.org from comment #14) > The master branch has been updated by Nick Clifton : > > https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git; > h=514b4e191d5f46de8e142fe216e677a35fa9c4bb > I received an email about this commit, from someone who didn't want to comment on bugzilla but said that I could copy-paste the comment, so here it is: > +@itemx --disable-tsaware > +The image is Terminal Server aware. This option is disabled by > +default. > > The /TSAWARE option is enabled by default for Windows and console > applications. > https://docs.microsoft.com/en-us/cpp/build/reference/tsaware-create-terminal-server-aware-application?view=vs-2019 > > > > +@itemx --disable-no-seh > The image does not use SEH. No SE handler may be called from > -this image. > +this image. This option is disabled by default. > > This option is mandatory for Windows certification/security. > https://code.videolan.org/videolan/vlc-winrt/-/issues/303 > -- You are receiving this mail because: You are on the CC list for the bug.
[Bug ld/19011] Issues with ld on mingw-w64 and bad defaults
https://sourceware.org/bugzilla/show_bug.cgi?id=19011 --- Comment #25 from sourceware-bugzilla at jdrake dot com --- (In reply to sourceware-bugzilla from comment #24) I'm not sure if these are recommending documentation updates or changes to defaults, but if the latter... > > +@itemx --disable-tsaware > > +The image is Terminal Server aware. This option is disabled by > > +default. > > > > The /TSAWARE option is enabled by default for Windows and console > > applications. > > https://docs.microsoft.com/en-us/cpp/build/reference/tsaware-create-terminal-server-aware-application?view=vs-2019 This option only makes sense on executables, not DLLs, so would be a little more tricky to turn on by default (though it shouldn't hurt DLLs to have it set). > > +@itemx --disable-no-seh > > The image does not use SEH. No SE handler may be called from > > -this image. > > +this image. This option is disabled by default. > > > > This option is mandatory for Windows certification/security. > > https://code.videolan.org/videolan/vlc-winrt/-/issues/303 > > Note that WACK is looking for SafeSEH, not necessarily NO SEH. I do not know what would be required for SafeSEH, but I'm sure it would be a lot more involved than just flipping a few bits in an image header. -- You are receiving this mail because: You are on the CC list for the bug.
[Bug ld/19011] Issues with ld on mingw-w64 and bad defaults
https://sourceware.org/bugzilla/show_bug.cgi?id=19011 --- Comment #26 from sourceware-bugzilla at jdrake dot com --- > #define NT_DLL_AUTO_IMAGE_MASK \ > ((bfd_vma) (${move_default_addr_high} ? 0x1LL \ >- : 0x0ffcLL)) >+ : 0x1LL)) I just noticed that I had copied the mask from the 'cygwin' move_default_addr_high case, but had done the math in my head as though it were 0x1fff. I don't know that there's a problem with it being 0x1 but thought I should point out that it wasn't what I thought it was -- You are receiving this mail because: You are on the CC list for the bug.
[Bug ld/26588] New: enable-reloc-section on .exe with no exported symbols causes segfault if requested to create implib
https://sourceware.org/bugzilla/show_bug.cgi?id=26588 Bug ID: 26588 Summary: enable-reloc-section on .exe with no exported symbols causes segfault if requested to create implib Product: binutils Version: 2.36 (HEAD) Status: UNCONFIRMED Severity: normal Priority: P2 Component: ld Assignee: unassigned at sourceware dot org Reporter: sourceware-bugzilla at jdrake dot com Target Milestone: --- Created attachment 12824 --> https://sourceware.org/bugzilla/attachment.cgi?id=12824&action=edit proposed patch PR #17321 added --enable-reloc-section, and PR #19011 made it default. However, some (misguided) tools try to create import libraries for executables, even if they don't export any symbols. This didn't cause a failure previously, but now segfaults if --enable-reloc-section is enabled. 0:000> kb # RetAddr : Args to Child : Call Site 00 7ff6`f8aa4907 : ` 0001`40023760 003c`5dbff9ec `0044 : msvcrt!strlen+0x31 01 7ff6`f898f53b : ` 7ff6`f897618a 003c`5dbff9f0 7ff6`f89680f0 : ld!xstrdup+0x17 [..\..\binutils-2.35\libiberty\xstrdup.c @ 33] 02 7ff6`f8980a08 : 01a9`af6758a0 01a9`ad6d88b0 7ff6`f8c618c0 7ff6`f89680f0 : ld!pep_dll_generate_implib+0x53 [..\..\binutils-2.35\ld\pe-dll.c @ 2822] 03 7ff6`f8975c27 : 003c`5dbffabc 000a`af68bd50 `0025 0001`0044 : ld!gld_i386pep_finish+0xb1 [ei386pep.c @ 1823] 04 7ff6`f896ab7d : `0004 7ff6`0001 ` 7ff6`f8976050 : ld!ldemul_finish+0x15 [..\..\binutils-2.35\ld\ldemul.c @ 102] 05 7ff6`f896f22e : 7ff6`f8b14608 7ff6`f8b067c0 01a9`0001 7ffc`5061 : ld!lang_process+0x6c6 [..\..\binutils-2.35\ld\ldlang.c @ 8126] 06 7ff6`f89513c1 : `0025 01a9`ad6d1b40 7ff6`f8c67398 ` : ld!main+0x795 [..\..\binutils-2.35\ld\ldmain.c @ 498] 07 7ff6`f89514f6 : ` ` ` ` : ld!__tmainCRTStartup+0x231 [D:\mingwbuild\mingw-w64-crt-git\src\mingw-w64\mingw-w64-crt\crt\crtexe.c @ 337] 08 7ffc`a86b6fd4 : ` ` ` ` : ld!mainCRTStartup+0x16 [D:\mingwbuild\mingw-w64-crt-git\src\mingw-w64\mingw-w64-crt\crt\crtexe.c @ 221] 09 7ffc`a9b1cec1 : ` ` ` ` : KERNEL32!BaseThreadInitThunk+0x14 0a ` : ` ` ` ` : ntdll!RtlUserThreadStart+0x21 This is dll_filename = (def->name) ? def->name : dll_name; dll_symname = xstrdup (dll_filename); the global dll_name is filled in if def->name is not set in generate_edata, however if (pe_def_file->num_exports == 0 && !bfd_link_pic (info)) { if (pe_dll_enable_reloc_section) { build_filler_bfd (0); pe_output_file_set_long_section_names (filler_bfd); } return; } generate_edata (abfd, info); build_filler_bfd (1); pe_output_file_set_long_section_names (filler_bfd); I'm not sure whether it would be better to call generate_edata in the no exports but enable reloc section case, or my proposed patch (attached) -- You are receiving this mail because: You are on the CC list for the bug.
[Bug ld/26588] enable-reloc-section on .exe with no exported symbols causes segfault if requested to create implib
https://sourceware.org/bugzilla/show_bug.cgi?id=26588 sourceware-bugzilla at jdrake dot com changed: What|Removed |Added Attachment #12824|0 |1 is patch|| -- You are receiving this mail because: You are on the CC list for the bug.
[Bug ld/26588] enable-reloc-section on .exe with no exported symbols causes segfault if requested to create implib
https://sourceware.org/bugzilla/show_bug.cgi?id=26588 sourceware-bugzilla at jdrake dot com changed: What|Removed |Added Depends on||17321, 19011 See Also||https://github.com/msys2/MI ||NGW-packages/issues/6107 Referenced Bugs: https://sourceware.org/bugzilla/show_bug.cgi?id=17321 [Bug 17321] add --enable-reloc-section option to generate proper relocation sections to .exes https://sourceware.org/bugzilla/show_bug.cgi?id=19011 [Bug 19011] Issues with ld on mingw-w64 and bad defaults -- You are receiving this mail because: You are on the CC list for the bug.
[Bug ld/19011] Issues with ld on mingw-w64 and bad defaults
https://sourceware.org/bugzilla/show_bug.cgi?id=19011 sourceware-bugzilla at jdrake dot com changed: What|Removed |Added Blocks||26588 Referenced Bugs: https://sourceware.org/bugzilla/show_bug.cgi?id=26588 [Bug 26588] enable-reloc-section on .exe with no exported symbols causes segfault if requested to create implib -- You are receiving this mail because: You are on the CC list for the bug.
[Bug ld/17321] add --enable-reloc-section option to generate proper relocation sections to .exes
https://sourceware.org/bugzilla/show_bug.cgi?id=17321 sourceware-bugzilla at jdrake dot com changed: What|Removed |Added Blocks||26588 Referenced Bugs: https://sourceware.org/bugzilla/show_bug.cgi?id=26588 [Bug 26588] enable-reloc-section on .exe with no exported symbols causes segfault if requested to create implib -- You are receiving this mail because: You are on the CC list for the bug.
[Bug ld/26588] enable-reloc-section on .exe with no exported symbols causes segfault if requested to create implib
https://sourceware.org/bugzilla/show_bug.cgi?id=26588 --- Comment #1 from sourceware-bugzilla at jdrake dot com --- (In reply to sourceware-bugzilla from comment #0) > I'm not sure whether it would be better to call generate_edata in the no > exports but enable reloc section case, or my proposed patch (attached) It seems that with --disable-reloc-section ld simply does not create the requested implib, so I believe my proposed patch would solve this regression. -- You are receiving this mail because: You are on the CC list for the bug.
[Bug ld/26588] enable-reloc-section on .exe with no exported symbols causes segfault if requested to create implib
https://sourceware.org/bugzilla/show_bug.cgi?id=26588 sourceware-bugzilla at jdrake dot com changed: What|Removed |Added Attachment #12824|0 |1 is obsolete|| --- Comment #2 from sourceware-bugzilla at jdrake dot com --- Created attachment 12835 --> https://sourceware.org/bugzilla/attachment.cgi?id=12835&action=edit proposed patch Updated patch, against master (instead of 2.35), git-formatted rather than bare, and fixing a copy-paste-o (pep vs pe in pe.em). -- You are receiving this mail because: You are on the CC list for the bug.
[Bug ld/19011] Issues with ld on mingw-w64 and bad defaults
https://sourceware.org/bugzilla/show_bug.cgi?id=19011 sourceware-bugzilla at jdrake dot com changed: What|Removed |Added Blocks|26588 | Depends on||26588 Referenced Bugs: https://sourceware.org/bugzilla/show_bug.cgi?id=26588 [Bug 26588] enable-reloc-section on .exe with no exported symbols causes segfault if requested to create implib -- You are receiving this mail because: You are on the CC list for the bug.
[Bug ld/17321] add --enable-reloc-section option to generate proper relocation sections to .exes
https://sourceware.org/bugzilla/show_bug.cgi?id=17321 sourceware-bugzilla at jdrake dot com changed: What|Removed |Added Blocks|26588 | Depends on||26588 Referenced Bugs: https://sourceware.org/bugzilla/show_bug.cgi?id=26588 [Bug 26588] enable-reloc-section on .exe with no exported symbols causes segfault if requested to create implib -- You are receiving this mail because: You are on the CC list for the bug.
[Bug ld/26588] enable-reloc-section on .exe with no exported symbols causes segfault if requested to create implib
https://sourceware.org/bugzilla/show_bug.cgi?id=26588 sourceware-bugzilla at jdrake dot com changed: What|Removed |Added Severity|normal |critical Target||pe Depends on|19011, 17321| Blocks||19011, 17321 Referenced Bugs: https://sourceware.org/bugzilla/show_bug.cgi?id=17321 [Bug 17321] add --enable-reloc-section option to generate proper relocation sections to .exes https://sourceware.org/bugzilla/show_bug.cgi?id=19011 [Bug 19011] Issues with ld on mingw-w64 and bad defaults -- You are receiving this mail because: You are on the CC list for the bug.
[Bug ld/26588] enable-reloc-section on .exe with no exported symbols causes segfault if requested to create implib
https://sourceware.org/bugzilla/show_bug.cgi?id=26588 --- Comment #5 from sourceware-bugzilla at jdrake dot com --- Thanks. I am confused by your ChangeLog text: "Only generate a import library if not exporting relocs." Perhaps should be more like "Only generate an import library if exporting symbols." -- You are receiving this mail because: You are on the CC list for the bug.
[Bug ld/26588] enable-reloc-section on .exe with no exported symbols causes segfault if requested to create implib
https://sourceware.org/bugzilla/show_bug.cgi?id=26588 --- Comment #6 from sourceware-bugzilla at jdrake dot com --- I've gotten a report that a DLL that exports no symbols no longer generates an import library, as previously expected. I hesitate to add more conditions to that inner if, though that's the most obvious solution. -- You are receiving this mail because: You are on the CC list for the bug.
[Bug ld/26659] x86_64 pe relocation truncated to fit: R_X86_64_PC32 against undefined symbol
https://sourceware.org/bugzilla/show_bug.cgi?id=26659 sourceware-bugzilla at jdrake dot com changed: What|Removed |Added Target||x86_64 pe See Also||https://github.com/msys2/MI ||NGW-packages/issues/6986 Blocks||19011 Referenced Bugs: https://sourceware.org/bugzilla/show_bug.cgi?id=19011 [Bug 19011] Issues with ld on mingw-w64 and bad defaults -- You are receiving this mail because: You are on the CC list for the bug.
[Bug ld/19011] Issues with ld on mingw-w64 and bad defaults
https://sourceware.org/bugzilla/show_bug.cgi?id=19011 sourceware-bugzilla at jdrake dot com changed: What|Removed |Added Depends on||26659 Referenced Bugs: https://sourceware.org/bugzilla/show_bug.cgi?id=26659 [Bug 26659] x86_64 pe relocation truncated to fit: R_X86_64_PC32 against undefined symbol -- You are receiving this mail because: You are on the CC list for the bug.
[Bug ld/26659] x86_64 pe relocation truncated to fit: R_X86_64_PC32 against undefined symbol
https://sourceware.org/bugzilla/show_bug.cgi?id=26659 sourceware-bugzilla at jdrake dot com changed: What|Removed |Added See Also||https://github.com/msys2/MI ||NGW-packages/issues/7023 -- You are receiving this mail because: You are on the CC list for the bug.
[Bug ld/26659] New: x86_64 pe relocation truncated to fit: R_X86_64_PC32 against undefined symbol
https://sourceware.org/bugzilla/show_bug.cgi?id=26659 Bug ID: 26659 Summary: x86_64 pe relocation truncated to fit: R_X86_64_PC32 against undefined symbol Product: binutils Version: 2.36 (HEAD) Status: UNCONFIRMED Severity: normal Priority: P2 Component: ld Assignee: unassigned at sourceware dot org Reporter: sourceware-bugzilla at jdrake dot com Target Milestone: --- After the change in default image base addresses in PR #19011, undefined weak symbols are resulting in the message relocation truncated to fit: R_X86_64_PC32 against undefined symbol -- You are receiving this mail because: You are on the CC list for the bug.
[Bug ld/26588] enable-reloc-section on .exe with no exported symbols causes segfault if requested to create implib
https://sourceware.org/bugzilla/show_bug.cgi?id=26588 --- Comment #7 from sourceware-bugzilla at jdrake dot com --- Created attachment 12864 --> https://sourceware.org/bugzilla/attachment.cgi?id=12864&action=edit patch allowing empty import library for dll After preventing creating an import library for an exe when there are no exports, to avoid a crash, it turned out that some projects expected to be able to create an import library for a dll with no exports, so more closely match the condition to the condition around initializing the dll name. -- You are receiving this mail because: You are on the CC list for the bug.
[Bug ld/26659] x86_64 pe relocation truncated to fit: R_X86_64_PC32 against undefined symbol
https://sourceware.org/bugzilla/show_bug.cgi?id=26659 --- Comment #2 from sourceware-bugzilla at jdrake dot com --- Created attachment 12867 --> https://sourceware.org/bugzilla/attachment.cgi?id=12867&action=edit testcase source from msys2 #6986 -- You are receiving this mail because: You are on the CC list for the bug.
[Bug ld/26659] x86_64 pe relocation truncated to fit: R_X86_64_PC32 against undefined symbol
https://sourceware.org/bugzilla/show_bug.cgi?id=26659 --- Comment #3 from sourceware-bugzilla at jdrake dot com --- Created attachment 12868 --> https://sourceware.org/bugzilla/attachment.cgi?id=12868&action=edit testcase objects from msys2 #6986 -- You are receiving this mail because: You are on the CC list for the bug.
[Bug ld/26757] Cross and Native GDB Fails to Build on Cygwin
https://sourceware.org/bugzilla/show_bug.cgi?id=26757 sourceware-bugzilla at jdrake dot com changed: What|Removed |Added CC||sourceware-bugzilla@jdrake. ||com, ||tnfchris at sourceware dot org --- Comment #8 from sourceware-bugzilla at jdrake dot com --- We seem to have run into this bug (or something similar to it) over at https://github.com/msys2/MINGW-packages/issues/8868. The fix for PR26659 got rid of the error, but its assumptions don't quite hold in this case. >One down side of this is that it does break the common convention that the > call >be to sym at 0x0. i.e. before you'd get > > 401015: 74 05 je 40101c > 401017: e8 e4 ef bf ff callq 0 > >and now you get > > 140001015: 74 05 je 14000101c > 140001017: e8 e4 ef ff bf call 1 > >since the call is PC_REL there's no way to get the range large enough to >resolve to 0. As such I have chosen to leave it as the furthest simple > range >that we can still represent. > >By only ignoring the error we leave the symbol value itself to still be 0 >such that the if() checks still work correctly. In this case, the generated code (expanded up a couple of instructions) looks like 0x7ffb2ba04818 <+24>:lea-0x60f1481f(%rip),%rax# 0x7ffacaaf 0x7ffb2ba0481f <+31>:test %rax,%rax 0x7ffb2ba04822 <+34>:je 0x7ffb2ba04829 0x7ffb2ba04824 <+36>:call 0x7ffacaaf So the fact that the compiler decided to use lea in its if() check means it was subject to the same range limitations as the call, and therefore can never evaluate 0. -- You are receiving this mail because: You are on the CC list for the bug.
[Bug ld/32675] Wine binaries built with binutils 2.44 no longer run
https://sourceware.org/bugzilla/show_bug.cgi?id=32675 sourceware-bugzilla at jdrake dot com changed: What|Removed |Added CC||sourceware-bugzilla@jdrake. ||com --- Comment #16 from sourceware-bugzilla at jdrake dot com --- I've been working on this more, including compatibility with the IMAGE_GUARD_DELAYLOAD_IAT_IN_ITS_OWN_SECTION flag. I just looked at the https://gitlab.winehq.org/wine/wine/-/merge_requests/7328 and that looks similar to what I'm trying to do in dlltool. What's different is that $5 needs to end up in its own .didat section in the output, instead of .data. I kind of got the impression that section names were limited to 8 characters. If that's not true, I could use better section names like in that merge request. Actually, I vaguely remember that section names in objects can be longer but section names in images are limited to 8 characters? -- You are receiving this mail because: You are on the CC list for the bug.
[Bug ld/14339] MinGW ld omits stubs when linking delay import library and using __declspec(dllimport)
https://sourceware.org/bugzilla/show_bug.cgi?id=14339 Jeremy Drake changed: What|Removed |Added CC||sourceware-bugzilla@jdrake. ||com --- Comment #6 from Jeremy Drake --- This bug looks like it might be fixed as a side effect of a fix for bug 32675 -- You are receiving this mail because: You are on the CC list for the bug.
[Bug ld/32675] Wine binaries built with binutils 2.44 no longer run
https://sourceware.org/bugzilla/show_bug.cgi?id=32675 --- Comment #18 from Jeremy Drake --- (In reply to Jeremy Drake from comment #16) > I've been working on this more, including compatibility with the > IMAGE_GUARD_DELAYLOAD_IAT_IN_ITS_OWN_SECTION flag. I just looked at the > https://gitlab.winehq.org/wine/wine/-/merge_requests/7328 and that looks > similar to what I'm trying to do in dlltool. What's different is that $5 > needs to end up in its own .didat section in the output, instead of .data. > > I kind of got the impression that section names were limited to 8 > characters. If that's not true, I could use better section names like in > that merge request. I tried this, and due to the wildcard `.rdata$*` matching `.rdata$didatN`, I had to put the block of delayimp stuff at the beginning of .rdata, or else the entries were not properly sorted and broke things. I think in my patch I will stick with `.didat$N` for the object file section names. -- You are receiving this mail because: You are on the CC list for the bug.
[Bug binutils/22676] dlltool produces invalid code for 32bit delayload import-lib
https://sourceware.org/bugzilla/show_bug.cgi?id=22676 Jeremy Drake changed: What|Removed |Added CC||sourceware-bugzilla@jdrake. ||com --- Comment #2 from Jeremy Drake --- I'm pretty sure this is PR14339, and should be fixed on master now in https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=3cad19db4e6b72195b22be1f93c81a2b229e4c07 -- You are receiving this mail because: You are on the CC list for the bug.