<div dir="ltr"><div dir="ltr"><div dir="ltr">I don't think there's any technical reason not to add support for internal visibility. In 2015, I added the alias in clang:<div><br></div><div><div>$ git show 7737bd9f9fb5d9cfd5717f36791036fa08d57b95</div><div>commit 7737bd9f9fb5d9cfd5717f36791036fa08d57b95</div><div>Author: Reid Kleckner <<a href="mailto:rnk@google.com">rnk@google.com</a>></div><div>Date:   Wed Oct 21 22:01:02 2015 +0000</div><div><br></div><div>    [Driver] Alias -fvisibility=internal to -fvisibility=hidden</div><div><br></div><div>    The ELF symbol visibilities are:</div><div>    - internal: Not visibile across DSOs, cannot pass address across DSOs</div><div>    - hidden: Not visibile across DSOs, can be called indirectly</div><div>    - default: Usually visible across DSOs, possibly interposable</div><div>    - protected: Visible across DSOs, not interposable</div><div><br></div><div>    LLVM only supports the latter 3 visibilities. Internal visibility is in</div><div>    theory useful, as it allows you to assume that the caller is maintaining</div><div>    a PIC register for you in %ebx, or in some other pre-arranged location.</div><div>    As far as LLVM is concerned, this isn't worth the trouble. Using hidden</div><div>    visibility is always correct, so we can just do that.</div><div><br></div><div>    Resolves PR9183.</div><div><br></div><div>    llvm-svn: 250954</div></div><div><br></div><div>While I did say "As far as LLVM is concerned, this isn't worth the trouble.", but that was mostly just a reflection of the fact that I filed this bug in 2011 and it never got any attention: <a href="https://llvm.org/pr9183">https://llvm.org/pr9183</a>.</div><div><br></div><div>Given what I know about how PIC code works for PPC, it seems like it might be worth someone's time to add this visibility mode.</div></div></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Thu, Feb 7, 2019 at 2:54 PM Rafik Zurob via llvm-dev <<a href="mailto:llvm-dev@lists.llvm.org">llvm-dev@lists.llvm.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Hello<br>
<br>
In GCC on Linux on Power, -fvisibility=internal enables internal <br>
visibility.<br>
<br>
$ cat t.c<br>
int foo(int i) { return i + 1; }<br>
$ gcc t.c -c -fvisibility=internal<br>
$ readelf -s t.o | grep foo<br>
     8: 0000000000000000    60 FUNC    GLOBAL INTERNAL    1 foo<br>
$<br>
<br>
But in Clang/LLVM, GlobalValue::VisibilityTypes does not have internal <br>
visibility:<br>
<br>
  /// An enumeration for the kinds of visibility of global values.<br>
  enum VisibilityTypes {<br>
    DefaultVisibility = 0,  ///< The GV is visible<br>
    HiddenVisibility,       ///< The GV is hidden<br>
    ProtectedVisibility     ///< The GV is protected<br>
  };<br>
<br>
and using -fvisibility=internal in Clang uses the <br>
close-but-not-quite-the-same hidden visibility:<br>
<br>
$ clang t.c -c -fvisibility=internal<br>
$ readelf -s t.o | grep foo<br>
     2: 0000000000000000    36 FUNC    GLOBAL HIDDEN     2 foo<br>
$<br>
<br>
Given that -fvisibility=internal is accepted, I assume this behaviour is <br>
intentional.  Can anyone help me understand why that is, or point me to <br>
where I can find out more?<br>
<br>
Thanks<br>
<br>
Rafik<br>
<br>
_______________________________________________<br>
LLVM Developers mailing list<br>
<a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a><br>
<a href="https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev" rel="noreferrer" target="_blank">https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev</a><br>
</blockquote></div>