public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* gcc and simple C compiler
@ 2021-10-03 23:48 Bill Cunningham
  2021-10-03 23:55 ` Tom Kacvinsky
  0 siblings, 1 reply; 3+ messages in thread
From: Bill Cunningham @ 2021-10-03 23:48 UTC (permalink / raw)
  To: gcc-help

Greetings I was wondering if there was a way I could compile a simple C 
only compiler, as a learning experience, and just "extract" a simple C99 
compiler. To explain better, would there be a log or pathway that gcc 
would create if I properly set the switches ec cetra to compile a C99 
compiler for the x86_64-pc-linux-gnu target and the log would show me 
all the files used and I could "move" those files to a directory and 
have a simple, smaller, gcc C compiler.

     This is for my own use to learn gcc and not to be made public.

Thx.



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

* Re: gcc and simple C compiler
  2021-10-03 23:48 gcc and simple C compiler Bill Cunningham
@ 2021-10-03 23:55 ` Tom Kacvinsky
  2021-10-04  6:36   ` Jonathan Wakely
  0 siblings, 1 reply; 3+ messages in thread
From: Tom Kacvinsky @ 2021-10-03 23:55 UTC (permalink / raw)
  To: Bill Cunningham; +Cc: gcc-help

On Sun, Oct 3, 2021 at 7:48 PM Bill Cunningham via Gcc-help <
gcc-help@gcc.gnu.org> wrote:

> Greetings I was wondering if there was a way I could compile a simple C
> only compiler, as a learning experience, and just "extract" a simple C99
> compiler. To explain better, would there be a log or pathway that gcc
> would create if I properly set the switches ec cetra to compile a C99
> compiler for the x86_64-pc-linux-gnu target and the log would show me
> all the files used and I could "move" those files to a directory and
> have a simple, smaller, gcc C compiler.
>
>      This is for my own use to learn gcc and not to be made public.


Use configure with --enable-languages=c

This means only the C compiler is built. No C++, no Fortran, Objective C,
etc...

Of course you need a working C compiler to compile GCC.  I don't know what
system you're working on, but later versions of Linux distributions should
have
a new enough GCC to compile GCC from source.

Also of note, the way GCC is currently built is such that the installation
is
relocatable.  Say you install it into /usr/local/gcc.  Then you can take the
entire contents of /usr/local/gcc and move them to /opt/gcc and what is in
the new location will Just Work (TM).

Tom

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

* Re: gcc and simple C compiler
  2021-10-03 23:55 ` Tom Kacvinsky
@ 2021-10-04  6:36   ` Jonathan Wakely
  0 siblings, 0 replies; 3+ messages in thread
From: Jonathan Wakely @ 2021-10-04  6:36 UTC (permalink / raw)
  To: Tom Kacvinsky; +Cc: Bill Cunningham, gcc-help

On Mon, 4 Oct 2021, 00:56 Tom Kacvinsky via Gcc-help, <gcc-help@gcc.gnu.org>
wrote:

> On Sun, Oct 3, 2021 at 7:48 PM Bill Cunningham via Gcc-help <
> gcc-help@gcc.gnu.org> wrote:
>
> > Greetings I was wondering if there was a way I could compile a simple C
> > only compiler, as a learning experience, and just "extract" a simple C99
> > compiler. To explain better, would there be a log or pathway that gcc
> > would create if I properly set the switches ec cetra to compile a C99
> > compiler for the x86_64-pc-linux-gnu target and the log would show me
> > all the files used and I could "move" those files to a directory and
> > have a simple, smaller, gcc C compiler.
>


No, GCC does not support doing this. You can't separate the parts needed
for C from the other languages without a lot of manual effort and
refactoring.

It's intended to be a high quality, optimising compiler, not a teaching aid.

>
> >      This is for my own use to learn gcc and not to be made public.
>
>
> Use configure with --enable-languages=c
>
> This means only the C compiler is built. No C++, no Fortran, Objective C,
> etc...
>
> Of course you need a working C compiler to compile GCC.


No, you need a working C++ compiler. GCC has been implemented in C++ for
some years now.

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

end of thread, other threads:[~2021-10-04  6:36 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-10-03 23:48 gcc and simple C compiler Bill Cunningham
2021-10-03 23:55 ` Tom Kacvinsky
2021-10-04  6:36   ` 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).