|
| 1 | +Patch NSIS so that it's installer stubs, produced at NSIS build time, |
| 2 | +do not contain .reloc sections, which will exist by default when using |
| 3 | +binutils/ld 2.36+. |
| 4 | + |
| 5 | +This ultimately fixes an issue when running the installer with the |
| 6 | +"Force randomization for images (Mandatory ASLR)" setting active. |
| 7 | + |
| 8 | +This patch has not yet been sent upstream, because it's not clear if this |
| 9 | +is the best fix, for the underlying issue, which seems to be that makensis |
| 10 | +doesn't account for .reloc sections when it builds installers. |
| 11 | + |
| 12 | +The existence of a reloc section shouldn't be a problem, and, if anything, |
| 13 | +is actually a requirement for working ASLR. All other Windows binaries we |
| 14 | +produce contain them, and function correctly when under the same |
| 15 | +"Force randomization for images (Mandatory ASLR)" setting. |
| 16 | + |
| 17 | +See: |
| 18 | +https://github.com/bitcoin/bitcoin/issues/25726 |
| 19 | +https://sourceforge.net/p/nsis/bugs/1131/ |
| 20 | + |
| 21 | +--- a/SCons/Config/gnu |
| 22 | ++++ b/SCons/Config/gnu |
| 23 | +@@ -102,6 +102,7 @@ stub_env.Append(LINKFLAGS = ['-mwindows']) # build windows executables |
| 24 | + stub_env.Append(LINKFLAGS = ['$NODEFLIBS_FLAG']) # no standard libraries |
| 25 | + stub_env.Append(LINKFLAGS = ['$ALIGN_FLAG']) # 512 bytes align |
| 26 | + stub_env.Append(LINKFLAGS = ['$MAP_FLAG']) # generate map file |
| 27 | ++stub_env.Append(LINKFLAGS = ['-Wl,--disable-reloc-section']) |
| 28 | + |
| 29 | + conf = FlagsConfigure(stub_env) |
| 30 | + conf.CheckCompileFlag('-fno-tree-loop-distribute-patterns') # GCC 10: Don't generate msvcrt!memmove calls (bug #1248) |
0 commit comments