Phil Tomson via llvm-dev
2015-Nov-06 18:32 UTC
[llvm-dev] How does -fPIE get passed from clang to llc when run on a .ll file?
If I create an llvm IR file (.ll) using clang like this: clang -v -emit-llvm -fPIC -O0 -S global_dat.c -o global_dat_x86_pic.ll And then take a look at the resulting .ll file, I see near the bottom: !0 = !{i32 1, !"PIC Level", i32 2} Now if I do the same, but specify -fPIE: clang -v -emit-llvm -fPIE -O0 -S global_dat.c -o global_dat_x86_pie.ll 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. However, I can see (based on the verbose output) that the PIE Level should be 2: "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 ... So if I were to pass this .ll file (global_dat_x86_pie.ll) to llc how would llc know that the PIE Level is 2? Is this an oversight, bug, or expetcted behaviour with a different workaround? -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20151106/fab24abd/attachment.html>
Tim Northover via llvm-dev
2015-Nov-06 18:46 UTC
[llvm-dev] How does -fPIE get passed from clang to llc when run on a .ll file?
On 6 November 2015 at 10:32, Phil Tomson via llvm-dev <llvm-dev at lists.llvm.org> wrote:> So if I were to pass this .ll file (global_dat_x86_pie.ll) to llc how would > llc know that the PIE Level is 2? Is this an oversight, bug, or expetcted > behaviour with a different workaround?It looks like it's the "-enable-pie" command line option, which gets hooked up to TargetOptions::PositionIndependentExecutable if you're doing it programmatically. I'm not sure of the history behind why they're different though, I'm afraid. Tim.
Phil Tomson via llvm-dev
2015-Nov-06 19:00 UTC
[llvm-dev] How does -fPIE get passed from clang to llc when run on a .ll file?
On Fri, Nov 6, 2015 at 10:46 AM, Tim Northover <t.p.northover at gmail.com> wrote:> On 6 November 2015 at 10:32, Phil Tomson via llvm-dev > <llvm-dev at lists.llvm.org> wrote: > > So if I were to pass this .ll file (global_dat_x86_pie.ll) to llc how > would > > llc know that the PIE Level is 2? Is this an oversight, bug, or expetcted > > behaviour with a different workaround? > > It looks like it's the "-enable-pie" command line option, which gets > hooked up to TargetOptions::PositionIndependentExecutable if you're > doing it programmatically. I'm not sure of the history behind why > they're different though, I'm afraid. > >With 3.6 I get an unused argument warning with -enable-pie: $ clang -v -emit-llvm -enable-pie -O0 -S global_dat.c -o global_dat_x86_pie.ll clang: warning: argument unused during compilation: '-e nable-pie' -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20151106/20e3fceb/attachment-0001.html>
Maybe Matching Threads
- How does -fPIE get passed from clang to llc when run on a .ll file?
- How does -fPIE get passed from clang to llc when run on a .ll file?
- [LLVMdev] Clang predefined macros with -fPIC and -fPIE
- [PATCH] Fix gpxe compilation when gcc is patched to compile by default with -fPIE -Wl, -pie
- [LLVMdev] Unable to call a function in GDB when build with -fPIE