[llvm-bugs] [Bug 47124] 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

via llvm-bugs llvm-bugs at lists.llvm.org
Tue Aug 11 17:21:00 PDT 2020


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

            Bug ID: 47124
           Summary: mac/arm64 codegen puts jump tables in __TEXT,__const
                    instead of __TEXT,__text, leading to ld64 warnings
                    about direct access to global weak symbols
           Product: clang
           Version: unspecified
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: LLVM Codegen
          Assignee: unassignedclangbugs at nondot.org
          Reporter: nicolasweber at gmx.de
                CC: llvm-bugs at lists.llvm.org, neeilans at live.com,
                    richard-llvm at metafoo.co.uk

thakis at 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 at Nicos-MacBook-Pro src % ../bin/clang -c  foo.cc -std=c++14
--target=arm64-apple-macosx
thakis at 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 http://github.com/apple/llvm-project don't handle this right.



Encountered in a Chromium component build (https://crbug.com/1107955).

-- 
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/20200812/5bf22062/attachment.html>


More information about the llvm-bugs mailing list