[PATCH] generate .init_array instead of .ctors sections for AArch64 ELF targets
Rafael EspĂndola
rafael.espindola at gmail.com
Thu Jan 9 10:19:12 PST 2014
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
More information about the cfe-commits
mailing list