[cfe-dev] Is it possible to select UnknownArch through command line in clang?
Reid Kleckner
rnk at google.com
Tue May 27 18:31:44 PDT 2014
I don't see how Clang can support targeting an unknown ISA. How is it
supposed to lower sizeof(void*) without real data layout information? Or
do any record layout at all? The calling convention stuff is really just
part of it. Is there any reason you can't use the le32 target, or whatever
PNaCl uses? Why is byval struct expansion a problem for SMACK?
On Tue, May 27, 2014 at 8:30 AM, Zvonimir Rakamaric <zvonimir at cs.utah.edu>wrote:
> Ok, I invested some time looking into this issue...
>
> Here is the update I propose in clang/lib/basic/Targets.cpp:
> static TargetInfo *AllocateTarget(const llvm::Triple &Triple) {
> llvm::Triple::OSType os = Triple.getOS();
>
> switch (Triple.getArch()) {
> default:
> return NULL;
>
> // Add this case to support UnknownArch
> case llvm::Triple::UnknownArch:
> return new X86_64TargetInfo(Triple);
>
> case llvm::Triple::xcore:
> return new XCoreTargetInfo(Triple);
>
>
> Please comment... This works fine on my regressions, and I suspect it
> should work fine on clang regressions too.
>
> Now, is there any chance this update could be pushed into the main
> clang trunk so that unknown architecture is supported?
>
> This is really important to us, and releasing a patch for clang with
> SMACK verifier would be a very inconvenient solution.
>
> Thanks a lot!
>
> Best,
> -- Zvonimir
>
>
> --
> http://zvonimir.info
> http://soarlab.org/
>
>
> On Fri, May 23, 2014 at 6:36 PM, Nikola Smiljanic <popizdeh at gmail.com>
> wrote:
> > Looking at Driver.cpp, passing unknown as Arch is treated as an error.
> Not
> > sure if hacking this check would solve your problem or explode later.
> >
> >
> > On Sat, May 24, 2014 at 2:06 AM, Zvonimir Rakamaric <
> zvonimir at cs.utah.edu>
> > wrote:
> >>
> >> Not really...
> >>
> >> My question is a follow-up on this:
> >> http://lists.cs.uiuc.edu/pipermail/llvmdev/2014-May/072986.html
> >>
> >> I figured out how to turn off coercion by hacking into clang and
> >> adding one line that selects DefaultTargetCodeGenInfo (which does not
> >> do coercion) by default. Now, this is a hacky solution that requires
> >> distributing this weird patch for clang with my tool (SMACK verifier).
> >>
> >> So I wonder if the same thing could somehow be achieved through
> >> command line. I tried something like:
> >> clang --target=unknown-unknown-linux-gnu simple.c
> >> but that throws an error.
> >>
> >> Thanks!
> >>
> >>
> >> --
> >> http://zvonimir.info
> >> http://soarlab.org/
> >>
> >>
> >> On Fri, May 23, 2014 at 2:13 AM, Jonathan Roelofs
> >> <jonathan at codesourcery.com> wrote:
> >> > This might be me answering the question you're trying to ask, but not
> >> > the
> >> > one you're specifically asking.... does '-S -emit-llvm' do what you
> want
> >> > to
> >> > do?
> >> >
> >> > Jon
> >> >
> >> >
> >> > On 5/22/14, 6:12 PM, Zvonimir Rakamaric wrote:
> >> >>
> >> >> Hi all,
> >> >>
> >> >> Quick background story: I would like to select
> >> >> DefaultTargetCodeGenInfo when generating LLVM IR for a project of
> >> >> mine. And as far as I could figure out, that could be accomplished by
> >> >> selecting UnknownArch as the target architecture.
> >> >>
> >> >> What I could not figure out was how to set UnknownArch from the
> >> >> command line using --target or something like that.
> >> >>
> >> >> Invoking clang like this:
> >> >> clang --target=x86_64-unknown-linux-gnu simple.c
> >> >> is fine.
> >> >>
> >> >> But for this:
> >> >> clang --target=unknown-unknown-linux-gnu simple.c
> >> >>
> >> >> I get an error:
> >> >> error: unknown target triple 'unknown-unknown-linux-gnu', please use
> >> >> -triple or -arch
> >> >>
> >> >> It would really be awesome if UnknownArch could somehow be selected
> >> >> from the command line. Is that possible? Am I missing something?
> >> >>
> >> >> Thanks!
> >> >> -- Zvonimir
> >> >> _______________________________________________
> >> >> cfe-dev mailing list
> >> >> cfe-dev at cs.uiuc.edu
> >> >> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
> >> >>
> >> >
> >> > --
> >> > Jon Roelofs
> >> > jonathan at codesourcery.com
> >> > CodeSourcery / Mentor Embedded
> >> >
> >> _______________________________________________
> >> cfe-dev mailing list
> >> cfe-dev at cs.uiuc.edu
> >> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
> >
> >
> _______________________________________________
> cfe-dev mailing list
> cfe-dev at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20140527/59b2567f/attachment.html>
More information about the cfe-dev
mailing list