This improves the portability of the codebase and fixes compilation
with mingw-w64 7.0+.
Co-authored-by: fanquake <fanquake@gmail.com>
Zcash: We do not yet have FormatISO8601DateTime or FormatISO8601Date,
so those parts of the backport are omitted.
(cherry-picked from commit bitcoin/bitcoin@a46484c8b3)
Zcash:
- Also added it to HARDENED_CXXFLAGS so we use it by default.
- We use -Werror if --enable-werror, so don't need the second part.
(cherry picked from commit bitcoin/bitcoin@4616c825a4)
Instruct the linker to set the major & minor subsystem versions in the PE
header to 6 & 1 (NT 6.1 which corresponds to Windows 7). Similar to
macOS, the binary will now refuse to run on unsupported versions of
Windows.
(cherry picked from commit e8a8cff07c409c7eecd478d3df36c7ba92c59730)
This has been around since the introduction of autotools. However at
this point I'm not sure we'd every want to suppress all warnings when
performing a build, and given that CXX FLAGS will have been overriden
when cross-compiling for Windows (using depends), this would rarely,
if-ever be used anyways.
From https://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html:
-w
Inhibit all warning messages.
(cherry picked from commit 89fea68ffdbd97394d891177e664f896b3e7d1e6)
This flag was used when building 32-bit Windows executables, which we no-longer
do, and is not accepted by the linker for any of the hosts we currently build
for. i.e:
```bash
checking whether the linker accepts -Wl,--large-address-aware... no
```
--large-address-aware
If given, the appropriate bit in the "Characteristics" field of the COFF
header is set to indicate that this executable supports virtual addresses
greater than 2 gigabytes. This should be used in conjunction with the /3GB
or /USERVA=value megabytes switch in the "[operating systems]" section of
the BOOT .INI. Otherwise, this bit has no effect. [This option is specific
to PE targeted ports of the linker]
You can check that the appropriate bit in the COFF header of our current
Windows binaries is still be set using dumpbin. i.e:
```powershell
dumpbin /headers .\bitcoind.exe
FILE HEADER VALUES
<snip>
26 characteristics
Executable
Line numbers stripped
Application can handle large (>2GB) addresses
```
(cherry picked from commit acd644b83d789a6cdfbeda19732119534d10058e)
While cross compiling, HOST=x86_64-w64-mingw32, none of these
libs actually seem to be passed to the linker.
(cherry picked from commit 2525c096b002a89d4c561e1474800496ad8ebd7e)
Also remove all defines in many places and define it in configure stage to keep consistency.
(cherry picked from commit 1bd9ffdd44000b208d29d35451f4dc9f1ac9318f)