[PATCH] D108943: Fine grain control over some symbol visibility

Fangrui Song via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Sep 1 12:39:52 PDT 2021


MaskRay added a comment.

OK. The problem is the hidden `TypeId<hidden_class>::Id` symbol.

  template <typename T> struct TypeId {
    static const char Id;
  };
  template <typename T> const char TypeId<T>::Id = 0;
  
  struct __attribute__((visibility("hidden"))) SCC {
  };
  
  const char *foo() {
    // The symbol TypeId<SCC>::Id is weak hidden.
    return &TypeId<SCC>::Id;
  }

Such -fvisibility=hidden built shared objects export very few dynamic symbols (API) so may not be usable by other shared objects...
But perhaps your setup doesn't require the built libLLVM.so to be used by others.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D108943/new/

https://reviews.llvm.org/D108943



More information about the llvm-commits mailing list