[PATCH] [libcxx] Mark local printf variants as _LIBCPP_HIDDEN to prevent them from becoming part of the DSO.

Eric Fiselier eric at efcs.ca
Thu Mar 26 21:52:11 PDT 2015


Hi mclow.lists, danalbert,

This patch marks 3 symbols as hidden. The symbols are:

1. ZNSt3__110__sscanf_lEPKcP15__locale_structS1_z
2. _ZNSt3__112__asprintf_lEPPcP15__locale_structPKcz
3. _ZNSt3__112__snprintf_lEPcmP15__locale_structPKcz

I used `_LIBCPP_HIDDEN` as opposed to `_LIBCPP_INLINE_VISIBILITY` because varargs functions cannot be inlined.

I used sym_check to ensure that these symbols are not already present in the system libraries for OS X 10.10 and FreeBSD 10.1. I don't know of any other platforms that require strict ABI compatibility. Playstation perhaps?

@danalbert: Will this change affect android? Can you check to see if these symbols have been shipped?

On linux these symbols are spuriously emitted into the DSO depending on the optimisation level.

See http://ds2.efcs.ca:8080/builders/abi-checker-debug/builds/5/steps/test.libcxx.abi.release/logs/stdio for an example of this problem.

http://reviews.llvm.org/D8651

Files:
  include/locale

Index: include/locale
===================================================================
--- include/locale
+++ include/locale
@@ -368,7 +368,7 @@
 #endif
 }
 
-inline
+inline _LIBCPP_HIDDEN
 int __snprintf_l(char *__s, size_t __n, locale_t __l, const char *__format, ...) {
   va_list __va;
   va_start(__va, __format);
@@ -382,7 +382,7 @@
   return __res;
 }
 
-inline
+inline _LIBCPP_HIDDEN
 int __asprintf_l(char **__s, locale_t __l, const char *__format, ...) {
   va_list __va;
   va_start(__va, __format);
@@ -396,7 +396,7 @@
   return __res;
 }
 
-inline
+inline _LIBCPP_HIDDEN
 int __sscanf_l(const char *__s, locale_t __l, const char *__format, ...) {
   va_list __va;
   va_start(__va, __format);

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D8651.22776.patch
Type: text/x-patch
Size: 709 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20150327/a17c2ab4/attachment.bin>


More information about the cfe-commits mailing list