<html>
    <head>
      <base href="https://bugs.llvm.org/">
    </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 - mac/arm64 codegen puts jump tables in __TEXT,__const instead of __TEXT,__text, leading to ld64 warnings about direct access to global weak symbols"
   href="https://bugs.llvm.org/show_bug.cgi?id=47124">47124</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>mac/arm64 codegen puts jump tables in __TEXT,__const instead of __TEXT,__text, leading to ld64 warnings about direct access to global weak symbols
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>clang
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>unspecified
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>PC
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>Linux
          </td>
        </tr>

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

        <tr>
          <th>Severity</th>
          <td>enhancement
          </td>
        </tr>

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

        <tr>
          <th>Component</th>
          <td>LLVM Codegen
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>nicolasweber@gmx.de
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org, neeilans@live.com, richard-llvm@metafoo.co.uk
          </td>
        </tr></table>
      <p>
        <div>
        <pre>thakis@Nicos-MacBook-Pro src % cat foo.cc

enum Status { kOk, kAborted, kConfigChanged, kError };

template <int StreamType>
struct DecoderStream {
  void OnBufferReady(Status status);
};

template <int StreamType>
void DecoderStream<StreamType>::OnBufferReady(Status status) {
    switch (status) {
      case kOk:
      case kConfigChanged:
        break;
      case kAborted:
      case kError:
        break;
    }
}
template class DecoderStream<1>;

thakis@Nicos-MacBook-Pro src % ../bin/clang -c  foo.cc -std=c++14
--target=arm64-apple-macosx
thakis@Nicos-MacBook-Pro src % ../bin/clang --target=arm64-apple-macosx -shared
-o libfoo.dylib foo.o -isysroot
/Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk
ld: warning: direct access in function 'ltmp1' from file 'foo.o' to global weak
symbol 'DecoderStream<1>::OnBufferReady(Status)' from file 'foo.o' means the
weak symbol cannot be overridden at runtime. This was likely caused by
different translation units being compiled with different visibility settings.
ld: warning: direct access in function 'ltmp1' from file 'foo.o' to global weak
symbol 'DecoderStream<1>::OnBufferReady(Status)' from file 'foo.o' means the
weak symbol cannot be overridden at runtime. This was likely caused by
different translation units being compiled with different visibility settings.
ld: warning: direct access in function 'ltmp1' from file 'foo.o' to global weak
symbol 'DecoderStream<1>::OnBufferReady(Status)' from file 'foo.o' means the
weak symbol cannot be overridden at runtime. This was likely caused by
different translation units being compiled with different visibility settings.
ld: warning: direct access in function 'ltmp1' from file 'foo.o' to global weak
symbol 'DecoderStream<1>::OnBufferReady(Status)' from file 'foo.o' means the
weak symbol cannot be overridden at runtime. This was likely caused by
different translation units being compiled with different visibility settings.



This works fine with clang in Xcode 12 beta (which buts the jump tables in
__TEXT,__text instead of __TEXT,__const), but open-source clang and the clang
at <a href="http://github.com/apple/llvm-project">http://github.com/apple/llvm-project</a> don't handle this right.



Encountered in a Chromium component build (<a href="https://crbug.com/1107955">https://crbug.com/1107955</a>).</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>