[cfe-dev] where should target specific flags be set?
Robert Lytton
robert at xmos.com
Wed Oct 16 04:51:11 PDT 2013
Hi
I am needing to add "-fno-use-cxa-atexit" for the xcore target.
What is the correct mechanism for setting default flags for a target in general?
Should this be done in addClangTargetOptions() viz:
void XCore::addClangTargetOptions(const llvm::opt::ArgList &DriverArgs,
llvm::opt::ArgStringList &CC1Args) const {
CC1Args.push_back("-nostdsysteminc");
CC1Args.push_back("-fno-use-cxa-atexit");
}
Or in Clang::ConstructJob() viz:
// -fuse-cxa-atexit is default.
if (!Args.hasFlag(options::OPT_fuse_cxa_atexit,
options::OPT_fno_use_cxa_atexit,
getToolChain().getTriple().getOS() != llvm::Triple::Cygwin &&
getToolChain().getTriple().getOS() != llvm::Triple::MinGW32 &&
getToolChain().getArch() != llvm::Triple::hexagon &&
getToolChain().getArch() != llvm::Triple::xcore) ||
KernelOrKext)
CmdArgs.push_back("-fno-use-cxa-atexit");
I am guessing it depends upon the flag and how it is used.
Would setting a default best done in Clang::ConstructJob(), where it can be over-ridden by input from the user?
Would setting an absolute flag best be done in addClangTargetOptions()?
Also, binary-flags (with a "no_" option) I imagine would tend to follow the 'default' rather than the 'absolute' rule.
Thus, "-nostdsysteminc" is correctly placed in addClangTargetOptions()
and "-fno-use-cxa-atexit" should be placed in Clang::ConstructJob().
cheers
Robert
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20131016/6e1c8b6b/attachment.html>
More information about the cfe-dev
mailing list