From 33aba632b8e22ad87dd18997682976ac51b7c62b Mon Sep 17 00:00:00 2001 From: Yedidya Feldblum Date: Tue, 28 Jan 2025 14:53:03 -0800 Subject: [PATCH] let FOLLY_KEEP also mark as used, retain Summary: Attribute `[[gnu::used]]` instructs the compiler to emit what it believes to be an unused definition, and `[[gnu::retain]]` instructs the linker to keep what it believes to be an unreferenced symbol. Reviewed By: luciang Differential Revision: D68756388 fbshipit-source-id: 4595a3a4e76582f87f22280489e87733d358c4e5 --- folly/lang/Keep.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/folly/lang/Keep.h b/folly/lang/Keep.h index 759dc8afb69..b404270df0f 100644 --- a/folly/lang/Keep.h +++ b/folly/lang/Keep.h @@ -56,7 +56,7 @@ // This way, the linker will see at least one reference to the kept section, // and so will not throw it out. #if __GNUC__ && __linux__ -#define FOLLY_KEEP [[gnu::section(".text.folly.keep")]] +#define FOLLY_KEEP [[gnu::section(".text.folly.keep"), gnu::used, gnu::retain]] #else #define FOLLY_KEEP #endif