[PATCH] D73577: [compiler-rt] Build all alias in builtin as private external on Darwin

Steven Wu via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jan 28 13:22:51 PST 2020


steven_wu created this revision.
steven_wu added reviewers: dexonsmith, arphaman, delcypher.
Herald added subscribers: Sanitizers, ributzka, jkorous, dberris.
Herald added projects: Sanitizers, LLVM.
steven_wu added a reviewer: kledzik.

For builtin compiler-rt, it is built with visibility hidden by default
to avoid the client exporting symbols from libclang static library. The
compiler option doesn't work on the alias which is created with inline
assembly. On Darwin platform, thoses aliases are exported by default if
they are reference by the client.

Fix the issue by adding ".private_extern" to all the aliases on Darwin
platform.

rdar://problem/58960296


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D73577

Files:
  compiler-rt/lib/builtins/int_lib.h


Index: compiler-rt/lib/builtins/int_lib.h
===================================================================
--- compiler-rt/lib/builtins/int_lib.h
+++ compiler-rt/lib/builtins/int_lib.h
@@ -54,6 +54,7 @@
 #elif defined(__APPLE__)
 #define COMPILER_RT_ALIAS(name, aliasname) \
   __asm__(".globl " SYMBOL_NAME(aliasname)); \
+  __asm__(".private_extern " SYMBOL_NAME(aliasname)); \
   __asm__(SYMBOL_NAME(aliasname) " = " SYMBOL_NAME(name)); \
   COMPILER_RT_ABI __typeof(name) aliasname;
 #elif defined(_WIN32)


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D73577.240979.patch
Type: text/x-patch
Size: 513 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200128/bdc6b3ab/attachment.bin>


More information about the llvm-commits mailing list