On 28/03/2019 10:28, Jan Beulich wrote:
>>>> On 28.03.19 at 11:14, <andrew.coop...@citrix.com> wrote:
>> On 28/03/2019 09:55, Jan Beulich wrote:
>>>>>> On 27.03.19 at 19:45, <julien.gr...@arm.com> wrote:
>>>> Clang uses "-target" option for cross-compilation.
>>> And all possible targets are always available? I'd like to point out
>>> that CROSS_COMPILE can be used for other than actual cross
>>> compilation, e.g. building with just an alternative tool chain
>>> built for the same target. Dropping the $(CROSS_COMPILE)
>>> prefixes makes this impossible afaict. Requiring suitable wrapper
>>> scripts to be put in place would seem better to me.
>>>
>>> I also wonder why this change is needed for Arm, but wasn't
>>> needed so far for x86. But perhaps no-one ever tried using it
>>> so far ...
>> It seems that CROSS_COMPILE is a GNU-ism, which is not shared by the
>> clang world.  I can't find anything which will make you a
>> $FOO-$BAR-clang binary, whereas you do typically get clang-$X aliases
>> for the different versions of clang.
> Oh, interesting. For my own re-built tool chains I actually can't use
> CROSS_COMPILE either, because traditionally all my wrapper scripts
> have a suffix like you say clang uses too. I patch in
>
> cross-compile ?= $(CROSS_COMPILE)$(1)
>
> locally as a fallback, to then use it as
>
> AS = $(call cross-compile,as)
>
> and then override things in the build root directory .config to
> suite my actual needs, e.g. in its simplest possible form
>
> cross-compile=$(1)x
>
> But of course this doesn't fit clang either, as it's (aiui) only the
> compiler which wants to be overridden this way.
>
>> Using -target is from the Clang instructions on cross compilation, which
>> say to do it this way.  https://clang.llvm.org/docs/CrossCompilation.html 
>>
>> The targets supported will depend on the configuration Clang was
>> compiled with, but Clang specifically opposes GCC's way of requiring the
>> user to recompile for every different target.  It is expected that a
>> packager of clang will enable all of the supported targets in the
>> package they distribute.
> Are you sure a distro caring about, say, only x86 would indeed
> enable Arm and all sorts of other architectures in the compiler,
> just because it can be enabled? IOW I assume the need for an
> override to the system default clang binaries would still exist.

I've just tried, and Ubuntu 16.04's default clang-3.8 is perfectly happy
compiling Aarch64, and makes a suitable looking elf object.  (I can't
actually disassemble it because objdump chokes, but .text is the
expected length)

As the cross-compilation documentation states, this is a deliberate
design decision which, amongst other things, prevents distros from
needing to maintain per-arch packages.

~Andrew

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

Reply via email to