From 718cf5bf193dc409a14baf67f688fced1b6e817e Mon Sep 17 00:00:00 2001 From: Ryan Prichard Date: Thu, 18 Jan 2024 23:57:38 -0800 Subject: Define libc++ config macros to nothing libc++[abi] always check whether one of these macros is defined, not the value the macro is defined to. With the new libc++, there is a Windows __config_site header that automatically defines _LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS and _LIBCPP_HAS_THREAD_API_WIN32 to nothing, so these definitions need to match to avoid a redefinition error. Bug: 175635923 Test: treehugger Test: m adb Change-Id: I1e48947c3b45e59804cdacd48776c7f3bd9a18c6 --- cc/stl.go | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/cc/stl.go b/cc/stl.go index 63c23d7d1..de2066f30 100644 --- a/cc/stl.go +++ b/cc/stl.go @@ -205,12 +205,14 @@ func (stl *stl) flags(ctx ModuleContext, flags Flags) Flags { flags.extraLibFlags = append(flags.extraLibFlags, "-nostdlib++") if ctx.Windows() { flags.Local.CppFlags = append(flags.Local.CppFlags, - // Disable visiblity annotations since we're using static - // libc++. - "-D_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS", - "-D_LIBCXXABI_DISABLE_VISIBILITY_ANNOTATIONS", + // These macros can also be defined by libc++'s __config + // or __config_site headers so define them the same way + // (i.e. to nothing). Disable visibility annotations since + // we're using static libc++. + "-D_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS=", + "-D_LIBCXXABI_DISABLE_VISIBILITY_ANNOTATIONS=", // Use Win32 threads in libc++. - "-D_LIBCPP_HAS_THREAD_API_WIN32") + "-D_LIBCPP_HAS_THREAD_API_WIN32=") } } case "libstdc++": -- cgit v1.2.3 From 21e2c10cd2e326cff0e3ea38f6d313f82f49a233 Mon Sep 17 00:00:00 2001 From: Ryan Prichard Date: Wed, 28 Feb 2024 18:59:30 -0800 Subject: disablePrebuilt: also clear sanitizer-dependent Srcs The new libc++ prebuilt has HWASan and non-HWASan variants for arm64. Bug: 175635923 Test: checkout use-prebuilt-libcxx topic, build libc++demangle, verify that libc++demangle-install is not a valid build target Change-Id: I34385c48aa7ad1401e2547d65d30a14fa342e304 --- cc/prebuilt.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/cc/prebuilt.go b/cc/prebuilt.go index 8f4b7df42..cbb5d58db 100644 --- a/cc/prebuilt.go +++ b/cc/prebuilt.go @@ -260,6 +260,9 @@ func (p *prebuiltLibraryLinker) nativeCoverage() bool { func (p *prebuiltLibraryLinker) disablePrebuilt() { p.properties.Srcs = nil + p.properties.Sanitized.None.Srcs = nil + p.properties.Sanitized.Address.Srcs = nil + p.properties.Sanitized.Hwaddress.Srcs = nil } // Implements versionedInterface -- cgit v1.2.3