FW: [PATCH] Driver modifications for cross compilation

Hi,

The help-hidden menu says ccc-host-triple simulates running on the given target.
Simulating running clang on a microcontroller like the cortex-M0 doesn’t really make sense.
It’s also under the debug/development heading, so it doesn’t seem to me like the driver should set ccc-host-triple to begin with.

From the description of ccc-host-triple I would say it should override the default host triple and if a target isn’t explicitly specified then assume the host and target are the same.

–John

Don't let yourself be confused by the name. It would actually be better
to call it "-ccc-targte-triple", since that's what it is effectively
about. It can be used for cross-compilation in combination with
--sysroot, if you have a system image located somewhere.

Joerg

Indeed, this is a topic discussed previously and we need to make the
distinction between host triple and target triple.

Furthermore, the -ccc-host-triple does not have the same effect than
"-cc1 -triple", which is yet-another way of setting host/target
options.

I don't mind setting the target triple manually and at the same time
specify cpu/fpu/etc as long as the behaviour is clear and we only have
one way of setting each.

In the past, when the same subject was discussed, the reason why we
have so many options was that Clang started as a wrapper for cc1 and
then became a full-fledged front-end with its own options but still
had (did it?) to support the old options. As with many other things in
LLVM, why not deprecate the redundant (and confusing) options? Is
there any strong reason to keep them (other than 'it'll break
builds')?

cheers,
--renato

Since -ccc-host-triple isn’t part of the normal non-hidden help docs I think it should be deprecated in favor of something like -mos which James’ patch adds.
I think having clang set the host (-ccc-host-triple, -mos) based on the executable prefix is a bad idea. A normal user wouldn’t even know what -ccc-host-triple is. They wouldn’t be aware that the host triple had changed. Forcing the host triple to something different could cause undesired behavior. The convention for prefixing the compiler executable is to show what the target is.

It makes more sense to me to have the executable prefix only set the target triple. The host triple should need to be explicitly set if another triple is needed.

hi,

why not call it -mtriple ?

hi,

why not call it -mtriple ?

I think that would be confusing if the clang used -mtriple to set the HOST & target triple and clang -cc1 used -triple to set the TARGET triple.