[llvm-bugs] [Bug 25230] New: Visibility issue in standard library

via llvm-bugs llvm-bugs at lists.llvm.org
Sat Oct 17 17:39:29 PDT 2015


https://llvm.org/bugs/show_bug.cgi?id=25230

            Bug ID: 25230
           Summary: Visibility issue in standard library
           Product: libc++
           Version: 3.7
          Hardware: Macintosh
                OS: MacOS X
            Status: NEW
          Severity: normal
          Priority: P
         Component: All Bugs
          Assignee: unassignedclangbugs at nondot.org
          Reporter: skaller at users.sourceforge.net
                CC: llvm-bugs at lists.llvm.org, mclow.lists at gmail.com
    Classification: Unclassified

The following code:

#ifdef FLX_BUILD_FOR_STATIC_LINK
static ::std::string modulenameoffilename(::std::string const &s)
{
  ::std::size_t i = s.find_last_of("\\/");
  ::std::size_t j = s.find_first_of(".",i+1);
  return s.substr (i+1,j-i-1);
}
#endif

produces this warning:

ld: warning: direct access in
flx::run::modulenameoffilename(std::__1::basic_string<char,
std::__1::char_traits<char>, std::__1::allocator<char> > const&) to global weak
symbol std::__1::char_traits<char>::eq(char, char) means the weak symbol cannot
be overridden at runtime. This was likely caused by different translation units
being compiled with different visibility settings.

When linked with this command:

[system] "clang++"  -o
"/Users/skaller/felix/build/release/host/bin/flx_build_prep"
"build/release/host/lib/rtl/flx_run_lib_static_static.o"
"build/release/host/lib/rtl/flx_run_main_static.o"
"/Users/skaller/.felix/cache/text/Users/skaller/felix/src/tools/flx_build_prep_static_link_thunk_static.o"
"/Users/skaller/.felix/cache/text/Users/skaller/felix/src/tools/flx_build_prep_static.o"
"-Lbuild/release/host/lib/rtl" "-lflx_re2_static" "-lflx_static"
"-lflx_pthread_static" "-lflx_dynlink_static" "-lflx_strutil_static"
"-lflx_gc_static" "-ljudy_static" "-lflx_exceptions_static"

All object files and all object files in libraries ending in _static are built
with a command similar to this:

"clang++" "-g" "-c" "-O1" "-fno-common" "-fno-strict-aliasing" "-std=c++11"
"-w" "-Wfatal-errors" "-Wno-return-type-c-linkage" "-Wno-invalid-offsetof"
"-O1" "-Ibuild/release/share/lib/rtl" "-Ibuild/release/host/lib/rtl"
"/Users/skaller/.felix/cache/text/Users/skaller/felix/src/tools/flx_build_prep.cpp"
-o
"/Users/skaller/.felix/cache/text/Users/skaller/felix/src/tools/flx_build_prep_static.o"

I am not sure this is a problem with the library or the compiler but since it
only occurs for this function I am guessing it's a library issue. I have no
control over the settings for the standard library char_traits<char>::eq
function.

This problem did not occur on earlier versions of clang. I am running OSX
10.10.5 however I am using binary download clang 3.7 because the Apple supplied
clang (based on 3.3svn) is badly broken for atomics.

This problem does not occur with gcc5.1 on OSX either. It does not occur on a
Linux build with gcc5.1. It also does not occur on Windows using Visual Studio
14 (2015) which has very rigid visibility control.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20151018/386da6c6/attachment.html>


More information about the llvm-bugs mailing list