<html>
    <head>
      <base href="https://llvm.org/bugs/" />
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW --- - Visibility issue in standard library"
   href="https://llvm.org/bugs/show_bug.cgi?id=25230">25230</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Visibility issue in standard library
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>libc++
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>3.7
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>Macintosh
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>MacOS X
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>normal
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>All Bugs
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedclangbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>skaller@users.sourceforge.net
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org, mclow.lists@gmail.com
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>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.</pre>
        </div>
      </p>
      <hr>
      <span>You are receiving this mail because:</span>
      
      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>