Indeed, using Triple::isOSBinFormatELF is much better.

Updated patch attached.
I think I've addressed all review comments, and I think the patch looks
good now.

Thanks,

Kristof

> -----Original Message-----
> From: Rafael Espíndola [mailto:[email protected]]
> Sent: 09 January 2014 18:19
> To: Kristof Beyls
> Cc: llvm cfe; Tim Northover
> Subject: Re: [PATCH] generate .init_array instead of .ctors sections for
> AArch64 ELF targets
> 
> On 9 January 2014 13:10, Kristof Beyls <[email protected]> wrote:
> > Thanks for the quick and insightful responses Rafael!
> >
> > I've attached a new patch taking into account your feedback.
> > The reason why I first added addClangTargetOptions to Generic_GCC
> > is that the driver always produces a Generic_GCC toolchain for
> > bare metal targets.
> > In the patch, I've adapted that so that the driver now produces a
> > Generic_ELF toolchain for bare metal targets with an environment/ABI
> > indicating an ELF-based bare metal target:
> > --- a/lib/Driver/Driver.cpp
> > +++ b/lib/Driver/Driver.cpp
> > @@ -1992,7 +1992,20 @@ const ToolChain &Driver::getToolChain(const ArgList
> &Args,
> >          TC = new toolchains::XCore(*this, Target, Args);
> >          break;
> >        }
> > -      TC = new toolchains::Generic_GCC(*this, Target, Args);
> > +      switch (Target.getEnvironment()) {
> > +      case llvm::Triple::GNU:
> > +      case llvm::Triple::GNUEABI:
> > +      case llvm::Triple::GNUEABIHF:
> > +      case llvm::Triple::GNUX32:
> > +      case llvm::Triple::EABI:
> > +      case llvm::Triple::EABIHF:
> > +      case llvm::Triple::ELF:
> > +        TC = new toolchains::Generic_ELF(*this, Target, Args);
> > +        break;
> > +      default:
> > +        TC = new toolchains::Generic_GCC(*this, Target, Args);
> > +        break;
> > +      }
> >        break;
> >      }
> >    }
> >
> > I think this is an improvement, but I'm not entirely sure if
> > Generic_ELF should be created for GNU and GNUX32.
> 
> Can you use Triple::isOSBinFormatELF?
> 
> Cheers,
> Rafael

Attachment: init_array_clang3.patch
Description: Binary data

_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits

Reply via email to