[cfe-dev] Clang++ can't compile a simple hello world program.
Eric Christopher
echristo at apple.com
Sat Sep 11 13:40:58 PDT 2010
On Sep 11, 2010, at 5:32 AM, Dimitry Andric wrote:
> On 2010-09-11 13:18, Anton Korobeynikov wrote:
>>> http://llvm.org/bugs/show_bug.cgi?id=7276#c3
>>>
>>> I have no idea why this isn't committed yet...
>> Committed, thanks. For me it looks like slightly hacky, I don't pretty
>> much like OS checks in the driver.
>> Is it possible to move the check somewhere else? To some target-dependent part?
>
> Probably, but this kind of stuff is done all over in Tools.cpp:
>
> // Enable -mconstructor-aliases except on darwin, where we have to
> // work around a linker bug; see <rdar://problem/7651567>.
> if (getToolChain().getTriple().getOS() != llvm::Triple::Darwin)
> CmdArgs.push_back("-mconstructor-aliases");
>
> ...
>
> // -fms-extensions=0 is default.
> if (Args.hasFlag(options::OPT_fms_extensions, options::OPT_fno_ms_extensions,
> getToolChain().getTriple().getOS() == llvm::Triple::Win32))
> CmdArgs.push_back("-fms-extensions");
>
> ...
>
> // -fnext-runtime defaults to on Darwin and when rewriting Objective-C, and is
> // -the -cc1 default.
> bool NeXTRuntimeIsDefault =
> IsRewriter || getToolChain().getTriple().getOS() == llvm::Triple::Darwin;
> if (!Args.hasFlag(options::OPT_fnext_runtime, options::OPT_fgnu_runtime,
> NeXTRuntimeIsDefault))
> CmdArgs.push_back("-fgnu-runtime");
>
> I think it falls under the category "ugly but necessary". :)
I don't think this is quite the best method for this one in particular since it largely depends on
the target OS, but this is a good workaround for now for sure. I think, ideally, we're going to
want triple based configuration inside the driver eventually that can do things like set options etc.
Thanks for looking into this!
-eric
More information about the cfe-dev
mailing list