<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">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></div><div>Thanks</div><div> Digger Lin</div></div>