[LLVMbugs] [Bug 14435] New: Firefox build failure due to hidden visibility of getc and putc

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Mon Nov 26 13:21:16 PST 2012


http://llvm.org/bugs/show_bug.cgi?id=14435

             Bug #: 14435
           Summary: Firefox build failure due to hidden visibility of getc
                    and putc
           Product: libc++
           Version: unspecified
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: All Bugs
        AssignedTo: hhinnant at apple.com
        ReportedBy: markus at trippelsdorf.de
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified


Currently Firefox fails to build with CXXFLAGS="-stdlib=libc++":

In file included from /var/tmp/mozilla-central/xpcom/base/nsDebugImpl.cpp:7:
In file included from
/var/tmp/mozilla-central/ipc/chromium/src/base/process_util.h:25:
In file included from ../../dist/stl_wrappers/string:49:
In file included from ../../dist/system_wrappers/string:2:
In file included from /usr/include/c++/v1/string:432:
In file included from ../../dist/stl_wrappers/cstdio:49:
In file included from ../../dist/system_wrappers/cstdio:2:
/usr/include/c++/v1/cstdio:108:8: error: visibility does not match previous
declaration
inline _LIBCPP_INLINE_VISIBILITY int getc(FILE* __stream) {return
__libcpp_getc(__stream);}
       ^
/usr/include/c++/v1/__config:134:51: note: expanded from macro
'_LIBCPP_INLINE_VISIBILITY'
#define _LIBCPP_INLINE_VISIBILITY __attribute__ ((__visibility__("hidden"),
__always_inline__))
                                                  ^
../../dist/system_wrappers/stdio.h:1:13: note: previous attribute is here
#pragma GCC visibility push(default)
            ^

Where system_wrappers/stdio.h reads:
#pragma GCC system_header
#pragma GCC visibility push(default)
#include_next <stdio.h>
#pragma GCC visibility pop


It turned out that this is caused by:
commit e21cf0ba9e938f0fac8e5f5552531cde51ea243b
Author: Howard Hinnant <hhinnant at apple.com>
Date:   Thu Jul 26 20:01:13 2012 +0000

    Patch by Andrew C. Morrow:  shims to work around macroized getc and putc on
linux.  On my eglibc 2.13 based Debian system 'getc' is a macro defined in
    /usr/include/stdio.h. This decision to make it a macro doesn't seem to
    be guarded by any feature test macro as far as I can see.

diff --git a/libcxx/include/cstdio b/libcxx/include/cstdio
index 2a6ec76..718d2f7 100644
--- a/libcxx/include/cstdio
+++ b/libcxx/include/cstdio
@@ -103,6 +103,18 @@ void perror(const char* s);
 #pragma GCC system_header
 #endif

+#ifdef getc
+inline _LIBCPP_INLINE_VISIBILITY int __libcpp_getc(FILE* __stream) {return
getc(__stream);}
+#undef getc
+inline _LIBCPP_INLINE_VISIBILITY int getc(FILE* __stream) {return
__libcpp_getc(__stream);}
+#endif  // getc
+
+#ifdef putc
+inline _LIBCPP_INLINE_VISIBILITY int __libcpp_putc(int __c, FILE* __stream)
{return putc(__c, __stream);}
+#undef putc
+inline _LIBCPP_INLINE_VISIBILITY int putc(int __c, FILE* __stream) {return
__libcpp_putc(__c, __stream);}
+#endif  // putc
+
 _LIBCPP_BEGIN_NAMESPACE_STD

 using ::FILE;

In include/__config one finds:
135 #define _LIBCPP_INLINE_VISIBILITY __attribute__ ((__visibility__("hidden"),
__always_inline__))


If one replaces _LIBCPP_INLINE_VISIBILITY with  
__attribute__ ((__always_inline__))  in include/cstdio, 
then Firefox builds just fine.


One solution would be to move the use of the redundant _LIBCPP_ALWAYS_INLINE
macro into _LIBCPP_INLINE_VISIBILITY and redefine _LIBCPP_ALWAYS_INLINE 
as __attribute__ ((__always_inline__)). The one could use 
_LIBCPP_ALWAYS_INLINE instead of _LIBCPP_INLINE_VISIBILITY in include/cstdio.

See also bug 12947.

-- 
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.



More information about the llvm-bugs mailing list