Skip to content

Commit

Permalink
let FOLLY_KEEP also mark as used, retain
Browse files Browse the repository at this point in the history
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
  • Loading branch information
yfeldblum authored and facebook-github-bot committed Jan 28, 2025
1 parent 88cc0a3 commit 33aba63
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion folly/lang/Keep.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 33aba63

Please sign in to comment.