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: unassignedclangb...@nondot.org
          Reporter: nicolaswe...@gmx.de
                CC: llvm-bugs@lists.llvm.org, neeil...@live.com,
                    richard-l...@metafoo.co.uk

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 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.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to