-cc1 and -m64 incompatible?

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?

Also, neither -cc1 nor -m64 is mentioned in 'clang --help' or
http://clang.llvm.org/docs/UsersManual.html. Is there a definitive
guide on clang's command line flags? Many thanks,

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.

Is there a definitive
guide on clang's command line flags? Many thanks,

Just the source. We'd love to enhance the source to contain documentation strings, so that we could automatically generate a reference manual for Clang's command-line flags... but nobody's done the work.

  - Doug

Thanks for the quick replay, Doug.

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 ?

Is there a definitive
guide on clang's command line flags? Many thanks,

Just the source. We'd love to enhance the source to contain documentation strings, so that we could automatically generate a reference manual for Clang's command-line flags... but nobody's done the work.

Got it. Thanks!

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

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:

I for one would love to see this; I sometimes consider it to be a bit
of a misfeature that we support options exactly the way GCC does. In
my opinion, it might be nice to make the 'clang' driver have options
that we've worked out and then have a 'clang -gcc' driver for
compatibility, or something similar.

Sean