Renaming gcc from source code
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. 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. Thanks in advance.
Re: Renaming gcc from source code
Thanks a lot! I'll look into it. On Wed, Mar 13, 2024 at 2:59 PM Jonathan Wakely wrote: > On Wed, 13 Mar 2024 at 09:46, Dan via Gcc 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. >
Modifying GCC source code
Hello! I am trying to slightly modify the source code of GCC to display some messages when the compiler is executed in the terminal. For example, when 'gcc source.c' is executed, I want a print message saying "Building with GCC..." and if the build is successful, "Build Successful!" should be displayed otherwise "Build Failed!" should be displayed. I have tried adding the print statements in the driver code file (gcc.cc) but haven't had any success. Adding the print statement in driver::main function breaks everything and the code doesn't even build. I have tried adding the print statements in all the major methods in the driver code such as, driver::execute, driver::finalize, driver::init_spec, driver::main, etc but the result that I get is that either the code breaks while building the GCC from source, or it builds successfully but the print statements do not get displayed. I'm uncertain how to proceed. Any guidance on how to begin and what files or functions I need to check out would be greatly appreciated. Thanks in advance!
GCC for C6x DSPs
Hello! I'm trying to compile for Texas Instruments (TI) C6000 Digital Signal Processor (DSP) using GCC. I'm aware that TI has its own compiler, but I want to use GCC. The documentation indicates that GCC has *some* support for C6x DSPs, as shown in this link: https://gcc.gnu.org/onlinedocs/gcc/C6X-Options.html However, when I run a simple command like gcc -c main.c -march=c674x -I/include -Tlinker.ld, it fails with this error: main.c:1:0: error: bad value (c674x) for -mtune= switch. I've read on forums that GCC 4.7 has *some* level of support for C6X DSPs, but even after installing GCC 4.7.4, it still doesn't work. Some forums also mentioned a GCC-based toolchain developed by CodeSourcery (later acquired by Mentor Graphics, and subsequently by Siemens EDA) that supported C6x DSPs. However, it's no longer available; I can't seem to find any download links online. Could someone please advise on which GCC version is compatible with C6X DSPs? Any guidance would be greatly appreciated. Thanks in advance!