[cfe-dev] -cc1 and -m64 incompatible?

Daniel Dunbar daniel at zuster.org
Thu Jan 21 08:57:59 PST 2010


I plan to write better documentation of the clang / -cc1 split for
developers at some point (definitely by 2.7, perhaps sooner). Feel
free to nag me.

As far as exposing the additional clang features at a nicer level, I
think it would probably make sense to do this via a different tool
(not clang), which implements a driver-like interface, but is designed
for targeting additional clang tools. That way we don't need to worry
about the syntax of the command line arguments and how they impact
clang/gcc. Something like:
--
$ clang-tool --action=ast-print ... the usual set of driver arguments ...
--

 - Daniel

2010/1/19 Douglas Gregor <dgregor at apple.com>:
>
> On Jan 19, 2010, at 4:11 PM, Zhanyong Wan (λx.x x) wrote:
>
>> Thanks for the quick replay, Doug.
>>
>> 2010/1/19 Douglas Gregor <dgregor at apple.com>:
>>>
>>> On Jan 19, 2010, at 3:29 PM, Zhanyong Wan (λx.x x) wrote:
>>>
>>>> Hi,
>>>>
>>>> This command works:
>>>>
>>>>  $ clang -cc1 t.cc
>>>>
>>>> So does this:
>>>>
>>>>  $ clang -m64 t.cc
>>>>
>>>> However, it doesn't work when both -cc1 and -m64 are specified:
>>>>
>>>>  $ clang -cc1 -m64 t.cc
>>>>  error: unknown argument: '-m64'
>>>>  $ clang -m64 -cc1 t.cc
>>>>  gcc: unrecognized option '-cc1'
>>>>  gcc: unrecognized option '-cc1'
>>>>
>>>> Is this expected?  How do I run the front-end in 64-bit mode?
>>>
>>> If you need to use -cc1 (which is very much an implementation detail), pass it the appropriate triple with -triple foo-bar-baz. Check out what the driver passes for the triple with, e.g.,
>>>
>>>        clang -m64 t.cc -###
>>>
>>>
>>>> Also, neither -cc1 nor -m64 is mentioned in 'clang --help' or
>>>> http://clang.llvm.org/docs/UsersManual.html.
>>>
>>> -cc1 is an implementation detail, so it shouldn't be part of the user manual. -m64, on the other hand, should be mentioned somewhere.
>>
>> So should we remove -cc1 from http://clang.llvm.org/get_started.html ?
>
>
> Hmm... it's only there for pretty-printing. I guess the right thing to do would be to expose -ast-print through the driver somehow, if we actually want to suggest that people use it as part of "Getting Started".
>
>        - Doug
>
>
> _______________________________________________
> cfe-dev mailing list
> cfe-dev at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
>




More information about the cfe-dev mailing list