aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/bitcoin-cli.cpp12
1 files changed, 10 insertions, 2 deletions
diff --git a/src/bitcoin-cli.cpp b/src/bitcoin-cli.cpp
index 02efefe671..cdaabd6fab 100644
--- a/src/bitcoin-cli.cpp
+++ b/src/bitcoin-cli.cpp
@@ -551,11 +551,19 @@ static int CommandLineRPC(int argc, char *argv[])
return nRet;
}
-int main(int argc, char* argv[])
-{
#ifdef WIN32
+// Export main() and ensure working ASLR on Windows.
+// Exporting a symbol will prevent the linker from stripping
+// the .reloc section from the binary, which is a requirement
+// for ASLR. This is a temporary workaround until a fixed
+// version of binutils is used for releases.
+__declspec(dllexport) int main(int argc, char* argv[])
+{
util::WinCmdLineArgs winArgs;
std::tie(argc, argv) = winArgs.get();
+#else
+int main(int argc, char* argv[])
+{
#endif
SetupEnvironment();
if (!SetupNetworking()) {