From 5e93939f6d8a74efeb0db65be31c9ebbf7920647 Mon Sep 17 00:00:00 2001 From: Giuliano Procida Date: Fri, 12 Mar 2021 09:19:08 +0000 Subject: [PATCH] ANDROID: Clang LTO: Only set -fvisibility=hidden for x86 Otherwise this upsets ABI monitoring as symbols are hidden and as such do not get considered for ABI analysis. Bug: 182194803 Bug: 203411090 Fixes: dc5723b02e52 ("kbuild: add support for Clang LTO") Signed-off-by: Giuliano Procida Signed-off-by: Matthias Maennich Change-Id: If6011ad739ecccd23a92cfa2f9fd43084f9a0b4f --- Makefile | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Makefile b/Makefile index c67f16fdad8d..addc04d73bcc 100644 --- a/Makefile +++ b/Makefile @@ -952,7 +952,13 @@ KBUILD_LDFLAGS += --thinlto-cache-dir=$(extmod_prefix).thinlto-cache else CC_FLAGS_LTO := -flto endif + +ifeq ($(SRCARCH),x86) +# Workaround for compiler / linker bug CC_FLAGS_LTO += -fvisibility=hidden +else +CC_FLAGS_LTO += -fvisibility=default +endif # Limit inlining across translation units to reduce binary size KBUILD_LDFLAGS += -mllvm -import-instr-limit=5