public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* Treat GCC cross compiler as a native compiler?
@ 2022-06-29  3:53 unlvsur unlvsur
  2022-06-29  7:44 ` Richard Sandiford
  0 siblings, 1 reply; 7+ messages in thread
From: unlvsur unlvsur @ 2022-06-29  3:53 UTC (permalink / raw)
  To: gcc-help

I want to make –host=aarch64-linux-musl –target=aarch64-linux-android to be a native compiler instead of just a cross compiler for aarch64-linux-android. Is that possible? (Since use aarch64-linux-android as host is difficult due to issues with -fPIC to stderr)

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


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Treat GCC cross compiler as a native compiler?
  2022-06-29  3:53 Treat GCC cross compiler as a native compiler? unlvsur unlvsur
@ 2022-06-29  7:44 ` Richard Sandiford
  2022-06-29 15:15   ` unlvsur unlvsur
  0 siblings, 1 reply; 7+ messages in thread
From: Richard Sandiford @ 2022-06-29  7:44 UTC (permalink / raw)
  To: unlvsur unlvsur via Gcc-help; +Cc: unlvsur unlvsur

unlvsur unlvsur via Gcc-help <gcc-help@gcc.gnu.org> writes:
> I want to make –host=aarch64-linux-musl –target=aarch64-linux-android to be a native compiler instead of just a cross compiler for aarch64-linux-android. Is that possible? (Since use aarch64-linux-android as host is difficult due to issues with -fPIC to stderr)

No, I don't think this is possible.  The usual definition of
"native compiler" is that the host and target are (exactly) the same.

It's possible (but difficult) to build a cross-native toolchain,
(build!=host, host==target).

Thanks,
Richard

^ permalink raw reply	[flat|nested] 7+ messages in thread

* RE: Treat GCC cross compiler as a native compiler?
  2022-06-29  7:44 ` Richard Sandiford
@ 2022-06-29 15:15   ` unlvsur unlvsur
  2022-06-29 16:59     ` Segher Boessenkool
  0 siblings, 1 reply; 7+ messages in thread
From: unlvsur unlvsur @ 2022-06-29 15:15 UTC (permalink / raw)
  To: Richard Sandiford, unlvsur unlvsur via Gcc-help


“cross-native” toolchain should be called canadian toolchain.


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

From: Richard Sandiford<mailto:richard.sandiford@arm.com>
Sent: Wednesday, June 29, 2022 03:44
To: unlvsur unlvsur via Gcc-help<mailto:gcc-help@gcc.gnu.org>
Cc: unlvsur unlvsur<mailto:unlvsur@live.com>
Subject: Re: Treat GCC cross compiler as a native compiler?

unlvsur unlvsur via Gcc-help <gcc-help@gcc.gnu.org> writes:
> I want to make –host=aarch64-linux-musl –target=aarch64-linux-android to be a native compiler instead of just a cross compiler for aarch64-linux-android. Is that possible? (Since use aarch64-linux-android as host is difficult due to issues with -fPIC to stderr)

No, I don't think this is possible.  The usual definition of
"native compiler" is that the host and target are (exactly) the same.

It's possible (but difficult) to build a cross-native toolchain,
(build!=host, host==target).

Thanks,
Richard


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Treat GCC cross compiler as a native compiler?
  2022-06-29 15:15   ` unlvsur unlvsur
@ 2022-06-29 16:59     ` Segher Boessenkool
  2022-06-29 17:03       ` unlvsur unlvsur
  0 siblings, 1 reply; 7+ messages in thread
From: Segher Boessenkool @ 2022-06-29 16:59 UTC (permalink / raw)
  To: unlvsur unlvsur; +Cc: Richard Sandiford, unlvsur unlvsur via Gcc-help

On Wed, Jun 29, 2022 at 03:15:27PM +0000, unlvsur unlvsur via Gcc-help wrote:
> “cross-native” toolchain should be called canadian toolchain.

build=host=target makes a "native compiler".
host=target otherwise is a "cross-built native compiler".
build=host otherwise is a "cross-compiler".
build=target otherwise is sometimes called a "cross-back compiler".
And all three of build, host, and target different is what is called a
"Canadian cross".


The main difficulty with doing cross-built native is that many checks
for native compilers only work on the systems themselves, and do not
usually have a convenient way to override that either.  It's a fight
you cannot win, just build your native compilers on the system itself,
everyone else does!


Segher

^ permalink raw reply	[flat|nested] 7+ messages in thread

* RE: Treat GCC cross compiler as a native compiler?
  2022-06-29 16:59     ` Segher Boessenkool
@ 2022-06-29 17:03       ` unlvsur unlvsur
  2022-06-29 17:52         ` Segher Boessenkool
  0 siblings, 1 reply; 7+ messages in thread
From: unlvsur unlvsur @ 2022-06-29 17:03 UTC (permalink / raw)
  To: Segher Boessenkool; +Cc: Richard Sandiford, unlvsur unlvsur via Gcc-help

[-- Attachment #1: Type: text/plain, Size: 1448 bytes --]


No. Canadian simply means build != host which is building compilers for other platforms.

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

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

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

From: Segher Boessenkool<mailto:segher@kernel.crashing.org>
Sent: Wednesday, June 29, 2022 13:00
To: unlvsur unlvsur<mailto:unlvsur@live.com>
Cc: Richard Sandiford<mailto:richard.sandiford@arm.com>; unlvsur unlvsur via Gcc-help<mailto:gcc-help@gcc.gnu.org>
Subject: Re: Treat GCC cross compiler as a native compiler?

On Wed, Jun 29, 2022 at 03:15:27PM +0000, unlvsur unlvsur via Gcc-help wrote:
> “cross-native” toolchain should be called canadian toolchain.

build=host=target makes a "native compiler".
host=target otherwise is a "cross-built native compiler".
build=host otherwise is a "cross-compiler".
build=target otherwise is sometimes called a "cross-back compiler".
And all three of build, host, and target different is what is called a
"Canadian cross".


The main difficulty with doing cross-built native is that many checks
for native compilers only work on the systems themselves, and do not
usually have a convenient way to override that either.  It's a fight
you cannot win, just build your native compilers on the system itself,
everyone else does!


Segher


[-- Attachment #2: Capture.png --]
[-- Type: image/png, Size: 67263 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Treat GCC cross compiler as a native compiler?
  2022-06-29 17:03       ` unlvsur unlvsur
@ 2022-06-29 17:52         ` Segher Boessenkool
  2022-06-29 17:58           ` unlvsur unlvsur
  0 siblings, 1 reply; 7+ messages in thread
From: Segher Boessenkool @ 2022-06-29 17:52 UTC (permalink / raw)
  To: unlvsur unlvsur; +Cc: unlvsur unlvsur via Gcc-help, Richard Sandiford

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

^ permalink raw reply	[flat|nested] 7+ messages in thread

* RE: Treat GCC cross compiler as a native compiler?
  2022-06-29 17:52         ` Segher Boessenkool
@ 2022-06-29 17:58           ` unlvsur unlvsur
  0 siblings, 0 replies; 7+ messages in thread
From: unlvsur unlvsur @ 2022-06-29 17:58 UTC (permalink / raw)
  To: Segher Boessenkool; +Cc: unlvsur unlvsur via Gcc-help, Richard Sandiford

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@kernel.crashing.org>
Sent: Wednesday, June 29, 2022 13:53
To: unlvsur unlvsur<mailto:unlvsur@live.com>
Cc: unlvsur unlvsur via Gcc-help<mailto:gcc-help@gcc.gnu.org>; Richard Sandiford<mailto:richard.sandiford@arm.com>
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


^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2022-06-29 17:58 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-29  3:53 Treat GCC cross compiler as a native compiler? unlvsur unlvsur
2022-06-29  7:44 ` Richard Sandiford
2022-06-29 15:15   ` unlvsur unlvsur
2022-06-29 16:59     ` Segher Boessenkool
2022-06-29 17:03       ` unlvsur unlvsur
2022-06-29 17:52         ` Segher Boessenkool
2022-06-29 17:58           ` unlvsur unlvsur

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).