[PATCH] D113167: [lld-macho] Allow exporting weak def private-extern symbols.

Shoaib Meenai via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Nov 4 13:40:08 PDT 2021


smeenai added a comment.

In D113167#3109836 <https://reviews.llvm.org/D113167#3109836>, @oontvoo wrote:

> In D113167#3109188 <https://reviews.llvm.org/D113167#3109188>, @thakis wrote:
>
>> That honestly sounds like a bug in your build config, independently of if ld64 allows it, no?
>
> I still think that LLD  shouldn't conflate the following two cases:
>
>   // hidden.cc
>   extern __attribute__((weak)) __attribute__((visibility("hidden"))) void foo()  {return 5;}
>   int bar() { return foo(); }
>
> VS
>
>   // can_be_hidden.cc (Must be C++, not C)
>   __attribute__((noinline)) inline int foo() { return 5; }
>   int bar() { return foo(); }
>
> For the `hidden.cc`, clearly we shouldn't export `foo`. (current behaviour).
> But for the latter, it should be fine

In your `can_be_hidden.cc` example, why does LLD think `foo` is privateExtern to begin with? It's not marked that way in the object file (as confirmed with `nm -m`). That potentially seems like the actual issue here.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D113167



More information about the llvm-commits mailing list