On Wed, 13 Mar 2024 at 09:46, Dan via Gcc <gcc@gcc.gnu.org> wrote:
>
> Hello!
>
> I'm new to open source development and am exploring the domain. I am trying
> to learn the internals of gcc and the first project that I've chosen for
> myself is to rename gcc to 'myCompiler' from the source and build it so
> that gcc is renamed in the system, and commands such as *myCompiler
> --version* are recognized by my linux system. I know there is an alternate
> way of using symbolic links but I am specifically interested in altering
> the source code.

GCC already supports doing this, using a configure option:

  --program-transform-name=PROGRAM   run sed PROGRAM on installed program names

That's not done in the source code, it's done by the build system
(configure script and makefiles). Have a look at gcc/configure and
gcc/Makefile.in and search for program_transform_name.
That is used to define GCC_INSTALL_NAME, CPP_INSTALL_NAME, GXX_INSTALL_NAME etc.

> I've downloaded the source code for gcc but I'm uncertain how to proceed.
> I'm unable to locate main files such as gcc.c or main.c that I could play
> around with. Any guidance on how to begin and what files to check out would
> be greatly appreciated.

Well for a start GCC is written in C++ these days, so you're looking
for gcc.cc in the gcc subdirectory. That's the source for the 'gcc'
driver program, but the driver binary's name is not set by the source
code, it's set by the makefiles.

I hope that gives you somewhere to start looking.

Reply via email to