From b2aa3bdc60d3c28b923a6f8b02c60a0a6487bc39 Mon Sep 17 00:00:00 2001 From: Haibo Huang Date: Tue, 2 Jul 2019 19:38:20 -0700 Subject: [NDK] fix gdb 8.3 build for windows a) can not override operator new for libc++ for windows. b) libc++ needs libucrt but clang didn't add that automatically. Bug: 135839860 Bug: 62547070 Test: build Change-Id: I11b2fad66e2a66214c9a92b2b2cb32b9eba3de54 --- gdb-8.3/gdb/common/new-op.c | 6 ++++++ gdb-8.3/gdb/configure.nat | 2 ++ 2 files changed, 8 insertions(+) diff --git a/gdb-8.3/gdb/common/new-op.c b/gdb-8.3/gdb/common/new-op.c index 8c07ffac2..3d3d2c2df 100644 --- a/gdb-8.3/gdb/common/new-op.c +++ b/gdb-8.3/gdb/common/new-op.c @@ -22,6 +22,10 @@ # define __has_feature(x) 0 #endif +// ANDROID CHANGE: Can not override operator new for libc++ in WIN32. +// See b/135839860. +#if !defined(_WIN32) + #if !__has_feature(address_sanitizer) && !defined(__SANITIZE_ADDRESS__) #include "common-defs.h" #include "host-defs.h" @@ -96,3 +100,5 @@ operator new[] (std::size_t sz, const std::nothrow_t&) noexcept return ::operator new (sz, std::nothrow); } #endif + +#endif diff --git a/gdb-8.3/gdb/configure.nat b/gdb-8.3/gdb/configure.nat index 64ee101d8..0972bf2b5 100644 --- a/gdb-8.3/gdb/configure.nat +++ b/gdb-8.3/gdb/configure.nat @@ -325,6 +325,8 @@ case ${gdb_host} in case ${gdb_host_cpu} in i386) NATDEPFILES="${NATDEPFILES} amd64-windows-nat.o" + # ANDROID CHANGE: libc++ requires libucrt. See b/136093140 + LOADLIBES="-lc++ -nodefaultlibs -Wl,--start-group -lmingw32 -lgcc -lgcc_eh -lmoldname -lmingwex -lmsvcrt -lucrt -lpthread -ladvapi32 -lshell32 -luser32 -lkernel32 -lpsapi -Wl,--end-group" ;; esac ;; -- cgit v1.2.3