[PATCH] generate .init_array instead of .ctors sections for AArch64 ELF targets

Kristof Beyls kristof.beyls at arm.com
Fri Jan 10 03:33:55 PST 2014


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:rafael.espindola at gmail.com]
> 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 <kristof.beyls at arm.com> 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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: init_array_clang3.patch
Type: application/octet-stream
Size: 4235 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20140110/de015f00/attachment.obj>


More information about the cfe-commits mailing list