public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* How to move gcc to compile to my own architecture?
@ 2022-09-16 16:03 Chengyin Yao
  2022-09-16 16:27 ` Jonathan Wakely
  0 siblings, 1 reply; 4+ messages in thread
From: Chengyin Yao @ 2022-09-16 16:03 UTC (permalink / raw)
  To: gcc-help

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

Yea so I'm just wondering, how to compile gcc to (my own) architecture cpu that has a completely different architecture?

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

* Re: How to move gcc to compile to my own architecture?
  2022-09-16 16:03 How to move gcc to compile to my own architecture? Chengyin Yao
@ 2022-09-16 16:27 ` Jonathan Wakely
  2022-09-16 19:50   ` Jackson Pfeffer
  0 siblings, 1 reply; 4+ messages in thread
From: Jonathan Wakely @ 2022-09-16 16:27 UTC (permalink / raw)
  To: Chengyin Yao; +Cc: gcc-help

On Fri, 16 Sept 2022 at 17:05, Chengyin Yao via Gcc-help
<gcc-help@gcc.gnu.org> wrote:
>
> Yea so I'm just wondering, how to compile gcc to (my own) architecture cpu that has a completely different architecture?

I'm not sure what you mean by "move gcc", and what is this "completely
different architecture"? The best answers depend on what you mean.

Have you created your own CPU with its own instruction set? Then you
want to "port" GCC (and binutils for the assembler and linker) to your
architecture. That's quite a lot of work. You could start by reading
https://gcc.gnu.org/onlinedocs/gccint/Back-End.html and
https://wiki.osdev.org/Porting_GCC_to_your_OS

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

* Re: How to move gcc to compile to my own architecture?
  2022-09-16 16:27 ` Jonathan Wakely
@ 2022-09-16 19:50   ` Jackson Pfeffer
  2022-09-16 20:09     ` Jonathan Wakely
  0 siblings, 1 reply; 4+ messages in thread
From: Jackson Pfeffer @ 2022-09-16 19:50 UTC (permalink / raw)
  To: Jonathan Wakely; +Cc: Chengyin Yao, gcc-help

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

I shouldn't assume (you know what happens)... But I assume they are asking
how to compile GCC from source on a machine running (for example) some ARM
chip running Linux to get an executable GCC that will run on (for example)
an Intel x64 chip running windows.

I assume (there it is again) that they are compiling on one well known
"architecture" targeting another well known (but different) "architecture".

I'm a GCC noob, but I think this basically amounts to them needing a cross
compiler. Beyond that... Is probably a question for Jonathan the great.

Jackson Pfeffer

On Fri, Sep 16, 2022, 11:28 Jonathan Wakely via Gcc-help <
gcc-help@gcc.gnu.org> wrote:

> On Fri, 16 Sept 2022 at 17:05, Chengyin Yao via Gcc-help
> <gcc-help@gcc.gnu.org> wrote:
> >
> > Yea so I'm just wondering, how to compile gcc to (my own) architecture
> cpu that has a completely different architecture?
>
> I'm not sure what you mean by "move gcc", and what is this "completely
> different architecture"? The best answers depend on what you mean.
>
> Have you created your own CPU with its own instruction set? Then you
> want to "port" GCC (and binutils for the assembler and linker) to your
> architecture. That's quite a lot of work. You could start by reading
> https://gcc.gnu.org/onlinedocs/gccint/Back-End.html and
> https://wiki.osdev.org/Porting_GCC_to_your_OS
>

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

* Re: How to move gcc to compile to my own architecture?
  2022-09-16 19:50   ` Jackson Pfeffer
@ 2022-09-16 20:09     ` Jonathan Wakely
  0 siblings, 0 replies; 4+ messages in thread
From: Jonathan Wakely @ 2022-09-16 20:09 UTC (permalink / raw)
  To: Jackson Pfeffer; +Cc: Chengyin Yao, gcc-help

On Fri, 16 Sept 2022 at 20:51, Jackson Pfeffer <crazykidjack@gmail.com> wrote:
>
> I shouldn't assume (you know what happens)... But I assume they are asking how to compile GCC from source on a machine running (for example) some ARM chip running Linux to get an executable GCC that will run on (for example) an Intel x64 chip running windows.
>
> I assume (there it is again) that they are compiling on one well known "architecture" targeting another well known (but different) "architecture".
>
> I'm a GCC noob, but I think this basically amounts to them needing a cross compiler.

Indeed, I should have said that the fist link on the osdev wiki covers
that case (which is much simpler than porting GCC to a brand new
architecture).

See https://wiki.osdev.org/GCC_Cross-Compiler for cross compiler
details. That's all you need to be able to use one type of machine to
compile code for a different type of machine.

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

end of thread, other threads:[~2022-09-16 20:09 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-09-16 16:03 How to move gcc to compile to my own architecture? Chengyin Yao
2022-09-16 16:27 ` Jonathan Wakely
2022-09-16 19:50   ` Jackson Pfeffer
2022-09-16 20:09     ` Jonathan Wakely

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).