Phil Tomson via llvm-dev
2015-Nov-06 19:20 UTC
[llvm-dev] How does -fPIE get passed from clang to llc when run on a .ll file?
On Fri, Nov 6, 2015 at 11:10 AM, Tim Northover <t.p.northover at gmail.com> wrote:> On 6 November 2015 at 11:00, Phil Tomson <phil.a.tomson at gmail.com> wrote: > > 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 > > Yes, it's an llc option not a Clang option. It actually looks like > Clang doesn't forward it to LLVM at all (almost certainly a bug, if > so). But that's probably OK because the only place LLVM actually uses > it at all is to determine what kind of TLS model to use > (TargetMachine.cpp), which linkers can mostly relax anyway. >In my case I'm actually working on a backend for a new architecture and need this to show up in LLVM because certain pseudo ops need to be expanded in a certain way if we're using PIE (vs. just a default static link). So are these options accessible in the Target-specific code?> > It does seem to get passed onto the linker by Clang though. >Not sure how that can work.> Cheers. > > Tim. >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20151106/6de6d45b/attachment.html>
Akira Hatanaka via llvm-dev
2015-Nov-06 19:23 UTC
[llvm-dev] How does -fPIE get passed from clang to llc when run on a .ll file?
If the target platform is linux and -fPIE is on the command line, clang sets TargetOptions::PositionIndependentExecutable in EmitAssemblyHelper::CreateTargetrMachine. On Fri, Nov 6, 2015 at 11:20 AM, Phil Tomson via llvm-dev < llvm-dev at lists.llvm.org> wrote:> > > On Fri, Nov 6, 2015 at 11:10 AM, Tim Northover <t.p.northover at gmail.com> > wrote: > >> On 6 November 2015 at 11:00, Phil Tomson <phil.a.tomson at gmail.com> wrote: >> > 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 >> >> Yes, it's an llc option not a Clang option. It actually looks like >> Clang doesn't forward it to LLVM at all (almost certainly a bug, if >> so). But that's probably OK because the only place LLVM actually uses >> it at all is to determine what kind of TLS model to use >> (TargetMachine.cpp), which linkers can mostly relax anyway. >> > > In my case I'm actually working on a backend for a new architecture and > need this to show up in LLVM because certain pseudo ops need to be expanded > in a certain way if we're using PIE (vs. just a default static link). So > are these options accessible in the Target-specific code? > >> >> It does seem to get passed onto the linker by Clang though. >> > > Not sure how that can work. > > >> Cheers. >> >> Tim. >> > > > _______________________________________________ > LLVM Developers mailing list > llvm-dev at lists.llvm.org > http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev > >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20151106/15ad9f0f/attachment.html>
Eric Christopher via llvm-dev
2015-Nov-07 18:01 UTC
[llvm-dev] How does -fPIE get passed from clang to llc when run on a .ll file?
We should probably make this a nomerge IR option. On Fri, Nov 6, 2015, 11:24 AM Akira Hatanaka via llvm-dev < llvm-dev at lists.llvm.org> wrote:> If the target platform is linux and -fPIE is on the command line, clang > sets TargetOptions::PositionIndependentExecutable in > EmitAssemblyHelper::CreateTargetrMachine. > > > On Fri, Nov 6, 2015 at 11:20 AM, Phil Tomson via llvm-dev < > llvm-dev at lists.llvm.org> wrote: > >> >> >> On Fri, Nov 6, 2015 at 11:10 AM, Tim Northover <t.p.northover at gmail.com> >> wrote: >> >>> On 6 November 2015 at 11:00, Phil Tomson <phil.a.tomson at gmail.com> >>> wrote: >>> > 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 >>> >>> Yes, it's an llc option not a Clang option. It actually looks like >>> Clang doesn't forward it to LLVM at all (almost certainly a bug, if >>> so). But that's probably OK because the only place LLVM actually uses >>> it at all is to determine what kind of TLS model to use >>> (TargetMachine.cpp), which linkers can mostly relax anyway. >>> >> >> In my case I'm actually working on a backend for a new architecture and >> need this to show up in LLVM because certain pseudo ops need to be expanded >> in a certain way if we're using PIE (vs. just a default static link). So >> are these options accessible in the Target-specific code? >> >>> >>> It does seem to get passed onto the linker by Clang though. >>> >> >> Not sure how that can work. >> >> >>> Cheers. >>> >>> Tim. >>> >> >> >> _______________________________________________ >> LLVM Developers mailing list >> llvm-dev at lists.llvm.org >> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev >> >> > _______________________________________________ > LLVM Developers mailing list > llvm-dev at lists.llvm.org > http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20151107/78ef8da9/attachment.html>
Tim Northover via llvm-dev
2015-Nov-09 04:10 UTC
[llvm-dev] How does -fPIE get passed from clang to llc when run on a .ll file?
On 6 November 2015 at 11:23, Akira Hatanaka <ahatanak at gmail.com> wrote:> If the target platform is linux and -fPIE is on the command line, clang sets > TargetOptions::PositionIndependentExecutable in > EmitAssemblyHelper::CreateTargetrMachine.I was looking in a hurry at the time, but to me it seemed that was under the "clang -cc1" execution and there was nothing on that command-line to indicate PIE. I'd swear I even set a breakpoint there and it got set wrongly. Maybe only the platforms that care have wired it up or something. Cheers. Tim.