RE: Treat GCC cross compiler as a native compiler?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



No.
clang does not have cross compilation. The native compiler is also cross compiler. There are no differences.

Native compilation:
clang++ -o hello hello.cc -Ofast -std=c++2b -s -flto=thin -fuse-ld=lld

“Cross” compilation
clang++ -o hello hello.cc -Ofast -std=c++2b -s -flto=thin -fuse-ld=lld –target=x86_64-windows-gnu

You just give –target to clang and it is a “cross” compiler now. It is just a compiler flag.

So for clang, it completely eliminates the idea of cross compiler.

The only thing that makes more sense is to build compilers that would run on another machine (Like building clang on linux that would run on windows). This new compiler can also do “native” or “cross” compilation with just a toggle.

So for clang, the only thing that matters is the difference between native and Canadian. Cross, Canadian cross or cross-back does not even exist for clang.


Sent from Mail<https://go.microsoft.com/fwlink/?LinkId=550986> for Windows

From: Segher Boessenkool<mailto:segher@xxxxxxxxxxxxxxxxxxx>
Sent: Wednesday, June 29, 2022 13:53
To: unlvsur unlvsur<mailto:unlvsur@xxxxxxxx>
Cc: unlvsur unlvsur via Gcc-help<mailto:gcc-help@xxxxxxxxxxx>; Richard Sandiford<mailto:richard.sandiford@xxxxxxx>
Subject: Re: Treat GCC cross compiler as a native compiler?

On Wed, Jun 29, 2022 at 05:03:17PM +0000, unlvsur unlvsur via Gcc-help wrote:
>
> No. Canadian simply means build != host which is building compilers for other platforms.

Please don't top-post.

> It does not necessarily mean it is a native or cross.

Sure it does.  <https://gcc.gnu.org/onlinedocs/gccint/Configure-Terms.html>

> And for clang, it does not differentiate native and cross at all. Clang only has native and Canadian compilation.

That is either their problem, or your misunderstanding.  This is a GCC
mailing list, we deal with GCC here.  These concepts are all older than
LLVM, I doubt they want to use different names than the well-established
ones.


Segher





[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux