<html dir="ltr">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style id="owaParaStyle" type="text/css">P {margin-top:0;margin-bottom:0;}</style>
</head>
<body ocsi="0" fpstyle="1">
<div style="direction: ltr;font-family: Tahoma;color: #000000;font-size: 10pt;">Hi<br>
<br>
I am needing to add "-fno-use-cxa-atexit" for the xcore target.<br>
What is the correct mechanism for setting default flags for a target in general?<br>
<br>
Should this be done in addClangTargetOptions() viz:<br>
<font face="Courier New"> void XCore::addClangTargetOptions(const llvm::opt::ArgList &DriverArgs,<br>
llvm::opt::ArgStringList &CC1Args) const {<br>
CC1Args.push_back("-nostdsysteminc");<br>
CC1Args.push_back("-fno-use-cxa-atexit");<br>
}<br>
</font><br>
Or in Clang::ConstructJob() viz:<br>
<font face="Courier New"> // -fuse-cxa-atexit is default.</font><br>
<font face="Courier New"> if (!Args.hasFlag(options::OPT_fuse_cxa_atexit,<br>
options::OPT_fno_use_cxa_atexit,<br>
getToolChain().getTriple().getOS() != llvm::Triple::Cygwin &&<br>
getToolChain().getTriple().getOS() != llvm::Triple::MinGW32 &&<br>
getToolChain().getArch() != llvm::Triple::hexagon &&<br>
getToolChain().getArch() != llvm::Triple::xcore) ||<br>
KernelOrKext)<br>
CmdArgs.push_back("-fno-use-cxa-atexit");<br>
<br>
</font><br>
I am guessing it depends upon the flag and how it is used.<br>
Would setting a default best done in Clang::ConstructJob(), where it can be over-ridden by input from the user?<br>
Would setting an absolute flag best be done in addClangTargetOptions()?<br>
Also, binary-flags (with a "no_" option) I imagine would tend to follow the 'default' rather than the 'absolute' rule.<br>
<br>
<br>
Thus, <font face="Courier New">"-nostdsysteminc" </font>is correctly placed in addClangTargetOptions()<br>
and <font face="Courier New">"-fno-use-cxa-atexit" </font>should be placed in Clang::ConstructJob().<br>
<br>
cheers<br>
<br>
Robert<br>
<br>
</div>
</body>
</html>