<div dir="ltr"><div>If I create an llvm IR file (.ll) using clang like this:<br><br><code>  clang -v -emit-llvm -fPIC -O0 -S global_dat.c -o global_dat_x86_pic.ll<br><br></code></div><div><code><font face="arial,helvetica,sans-serif">And then take a look at the resulting .ll file, I see near the bottom:<br><br></font></code><code>  !0 = !{i32 1, !"PIC Level", i32 2}<br><br></code></div><div><code><span style="font-family:arial,helvetica,sans-serif">Now if I do the same, but specify -fPIE:</span><br><br>  </code><code>clang -v -emit-llvm -fPIE -O0 -S global_dat.c -o global_dat_x86_pie.ll
</code><code><br><br></code></div><div><code><font face="arial,helvetica,sans-serif">And then look at the resulting global_dat_x86_pie.ll file, I see it is identical to the one where I specified -fPIC (global_dat_x86_pic.ll). There's no indication of the PIE level in the .ll file. <br><br></font></code></div><div><code><font face="arial,helvetica,sans-serif">However, I can see (based on the verbose output) that the PIE Level should be 2:<br><br><span style="font-family:monospace,monospace">   "clang-3.6" -cc1 -triple xstg--linux-elf -emit-llvm -disable-free -main-file-name global_dat.c -mrelocation-model pic -pic-level 2 -pie-level 2</span> ...<br><br></font></code></div><div><code><font face="arial,helvetica,sans-serif">So if I were to pass this .ll file (</font></code><code>global_dat_x86_pie.ll) <font face="arial,helvetica,sans-serif">to llc how would llc know that the PIE Level is 2? Is this an oversight, bug, or expetcted behaviour with a different workaround? </font><br></code></div><div><code><br></code></div></div>