From 48d75efa6f9f690513b0a6c19f677af183bbbba0 Mon Sep 17 00:00:00 2001 From: Jiyong Park Date: Thu, 21 Nov 2019 15:11:49 +0900 Subject: [PATCH] symbols in stub library isn't affected by -fvisibility=hidden Fixing the bug that -fvisibility=hidden in a cc_library is used even when compiling stub.c file where the symbols shouldn't be hidden. Bug: 144781653 Test: add folowing to libEGL and build + stubs: { + symbol_file: "libEGL.map.txt", + versions: ["29"], + }, Change-Id: Iab70f36a4fb98737fc35827dbc9e1ca1a99d4354 --- cc/ndk_library.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/cc/ndk_library.go b/cc/ndk_library.go index b75c4c898..c47cbf077 100644 --- a/cc/ndk_library.go +++ b/cc/ndk_library.go @@ -269,6 +269,10 @@ func addStubLibraryCompilerFlags(flags Flags) Flags { // (avoids the need to link an unwinder into a fake library). "-fno-unwind-tables", ) + // All symbols in the stubs library should be visible. + if inList("-fvisibility=hidden", flags.Local.CFlags) { + flags.Local.CFlags = append(flags.Local.CFlags, "-fvisibility=default") + } return flags }