<div dir="ltr"><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Thu, Sep 10, 2020 at 6:30 PM James Y Knight via cfe-dev <<a href="mailto:cfe-dev@lists.llvm.org">cfe-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"><div dir="auto"><div dir="ltr"><div dir="ltr">But <i>why</i> does AIX want to ignore visibility restrictions encoded via attribute? Especially by default?</div></div></div></blockquote>One reason is that AIX performs more early/less lazy symbol resolution (even with runtime linking) than, say, Linux. So, if a project goes with an export-by-default model (via attribute in some scope), they can cause link-time errors from symbol references to undefined symbols from code that would otherwise have been discarded as unreferenced by the linker. It seems such code is not uncommon (and has the questionable effect of exporting template instantiations based on "client provided" types that are not part of the "library"/"utility" code in question).</div><div class="gmail_quote"><br></div><div class="gmail_quote">Now, if someone was porting their project to AIX, it is reasonable to ask them to figure out the problem with their less-than-discriminate usage of visibility. For developers trying to use packages with such problems, they're rather less interested in fixing the projects that they're dependent on.<br><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="auto"><div dir="ltr"><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Thu, Sep 10, 2020 at 10:04 AM digger lin via cfe-dev <<a href="mailto:cfe-dev@lists.llvm.org" rel="noreferrer" target="_blank">cfe-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"><div dir="ltr"><div>Hi All,<br><br>  In IBM compiler Xlclang , there is option -fnovisibiilty. The option is description as<br>  <a href="https://www.ibm.com/support/knowledgecenter/SSGH3R_16.1.0/com.ibm.xlcpp161.aix.doc/compiler_ref/opt_visibility.html" rel="noreferrer" target="_blank">https://www.ibm.com/support/knowledgecenter/SSGH3R_16.1.0/com.ibm.xlcpp161.aix.doc/compiler_ref/opt_visibility.html</a> <br> <br>  we need to add the option -fnovisibiilty for clang in the IBM AIX OS(and the option is enabled by default in AIX OS).  <br>  I will implement the option in the other OS platform.(but the option is disabled by default in other OS).<br> <br>  For example, the file test.c<br> <br> bash-4.2$ test.c<br> __attribute__((visibility ("protected"))) int b;<br> <br> 1 In AIX OS:<br> <br> 1.1 Compiled with<br> <br><b>  clang -fnovisibility    -target powerpc-unknown-aix  -emit-llvm  -S test.c</b><br> or  <br>  <b>clang -target powerpc-unknown-aix  -emit-llvm  -S test.c </b> ( the -fnovisibility is <b>enabled</b> by default in AIX OS)<br><br> Generate IR as :<br> <br>  <b>@b = global i32 0, align 4</b><br> <br> 1.2 Compiled with<br>  (If have "-fnovisibility  -fvisibility=*" at the same time.  the compile will ignore the -fnovisibility). </div><div> <br>  <b>clang -fnovisibility  -fvisibility=default   -target powerpc-unknown-aix   -emit-llvm  -S test.c</b><br><br>Or<br><br>  <b>clang -fvisibility=default   -target powerpc-unknown-aix   -emit-llvm  -S test.c</b><br> <br>  Generate IR as :<br>  <b>@b = protected global i32 0, align 4</b><br> <br> 2. In Other OS(not AIX)<br>   2.1<b> clang -fnovisibility    -target powerpc-unknown-linux  -emit-llvm  -S test.c</b><br>   <br>    Generate IR as :<br>    <b>@b = global i32 0, align 4</b><br><br>  2.2<br>   <b> clang -target powerpc-unknown-linux  -emit-llvm  -S test.c</b> ( the -fnovisibility is <b>disabled </b>by default in not AIX OS)<br>  Or<br>    (if have "-fnovisibility  -fvisibility=*" at the same time.  the compile will ignore the -fnovisibility).<br>    <b>clang -fnovisibility  -fvisibility=default   -target powerpc-unknown-linux   -emit-llvm  -S test.c</b><br>  Or<br>    <b>clang -fvisibility=default   -target powerpc-unknown-linux   -emit-llvm  -S test.c</b><br>   <br>   Generate IR as :<br>    <b>@b = protected global i32 0, align 4 </b> </div></div>
_______________________________________________<br>
cfe-dev mailing list<br>
<a href="mailto:cfe-dev@lists.llvm.org" rel="noreferrer" target="_blank">cfe-dev@lists.llvm.org</a><br>
<a href="https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev" rel="noreferrer noreferrer" target="_blank">https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev</a><br>
</blockquote></div></div></div>
_______________________________________________<br>
cfe-dev mailing list<br>
<a href="mailto:cfe-dev@lists.llvm.org" target="_blank">cfe-dev@lists.llvm.org</a><br>
<a href="https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev" rel="noreferrer" target="_blank">https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev</a><br>
</blockquote></div></div>