How To Look At GCC C Sources
-
How does one view/obtain the GCC C sources? I don’t know how to use git. I just downloaded a Windows version yesterday (haven’t installed it yet), and am studying an ebook on it. Or should I use GitHub? I don’t know anything about these things. Is there an easier way to do it? Is there an ftp site where you can just download it from without having to learn/use some complicated source code management system? I’ve nearly completed writing my own version of only what I need from the C Standard Library, and all I need from the C++ Standard Library is a String Class, and I’ve used my own for many, many years which works fine. The only thing I need yet is a full implementation of pow, and possibly exp if pow needs that, and I don’t know how to do it myself. That’s why I need to study and learn from the GCC C sources. I’m linking without the Standard Libraries so as to avoid the bloat, and using Windows. But if I’d have asked here first how to implement pow, within 1 minute of posting that question I’d have been told to look at the GCC sources, which I don’t know how to do. That’s why I’m asking for instruction here first on that. Once I’ve figured out how to get at the GCC sources, then I can tackle my pow issue. I'm not the only one baffled by this... Apparently, I downloaded the wrong program ( git ), and am studying the wrong book. Apparently I've got to learn how to use svn before I can even attempt this? This is ridiculous, in my opinion. I guess what I'm looking for is a list of all the hoops I've got to jump through to get what I want. Something like this... 1) Download and install Subversion (and hope there is a Windows version of it); 2) Buy a book that teaches how to use Subversion; 3) Figure out how to use Subversion to navigate to GCC sources; 4) Find pow or exp and figure out how it works; Is the above what I should do, or is there some other route?
-
How does one view/obtain the GCC C sources? I don’t know how to use git. I just downloaded a Windows version yesterday (haven’t installed it yet), and am studying an ebook on it. Or should I use GitHub? I don’t know anything about these things. Is there an easier way to do it? Is there an ftp site where you can just download it from without having to learn/use some complicated source code management system? I’ve nearly completed writing my own version of only what I need from the C Standard Library, and all I need from the C++ Standard Library is a String Class, and I’ve used my own for many, many years which works fine. The only thing I need yet is a full implementation of pow, and possibly exp if pow needs that, and I don’t know how to do it myself. That’s why I need to study and learn from the GCC C sources. I’m linking without the Standard Libraries so as to avoid the bloat, and using Windows. But if I’d have asked here first how to implement pow, within 1 minute of posting that question I’d have been told to look at the GCC sources, which I don’t know how to do. That’s why I’m asking for instruction here first on that. Once I’ve figured out how to get at the GCC sources, then I can tackle my pow issue. I'm not the only one baffled by this... Apparently, I downloaded the wrong program ( git ), and am studying the wrong book. Apparently I've got to learn how to use svn before I can even attempt this? This is ridiculous, in my opinion. I guess what I'm looking for is a list of all the hoops I've got to jump through to get what I want. Something like this... 1) Download and install Subversion (and hope there is a Windows version of it); 2) Buy a book that teaches how to use Subversion; 3) Figure out how to use Subversion to navigate to GCC sources; 4) Find pow or exp and figure out how it works; Is the above what I should do, or is there some other route?
-
Frederick J. Harris wrote:
This is ridiculous, in my opinion.
Many things are. However, if you want source code then you have to go and search for it. Have you tried the GNU website[^]?
I think I'm on the right track Richard. I downloaded Subversion for Windows from SourceForge, but it doesn't look like I have to use it. By replacing svn:// with http:// I can browse to sources as just ftp folders. I've gotten this far... https://gcc.gnu.org/svn/gcc/trunk/ https://gcc.gnu.org/svn/gcc/trunk/libgcc/ Perhaps I just need to spend some time searching for pow. Haven't found it yet.
-
I think I'm on the right track Richard. I downloaded Subversion for Windows from SourceForge, but it doesn't look like I have to use it. By replacing svn:// with http:// I can browse to sources as just ftp folders. I've gotten this far... https://gcc.gnu.org/svn/gcc/trunk/ https://gcc.gnu.org/svn/gcc/trunk/libgcc/ Perhaps I just need to spend some time searching for pow. Haven't found it yet.
-
How does one view/obtain the GCC C sources? I don’t know how to use git. I just downloaded a Windows version yesterday (haven’t installed it yet), and am studying an ebook on it. Or should I use GitHub? I don’t know anything about these things. Is there an easier way to do it? Is there an ftp site where you can just download it from without having to learn/use some complicated source code management system? I’ve nearly completed writing my own version of only what I need from the C Standard Library, and all I need from the C++ Standard Library is a String Class, and I’ve used my own for many, many years which works fine. The only thing I need yet is a full implementation of pow, and possibly exp if pow needs that, and I don’t know how to do it myself. That’s why I need to study and learn from the GCC C sources. I’m linking without the Standard Libraries so as to avoid the bloat, and using Windows. But if I’d have asked here first how to implement pow, within 1 minute of posting that question I’d have been told to look at the GCC sources, which I don’t know how to do. That’s why I’m asking for instruction here first on that. Once I’ve figured out how to get at the GCC sources, then I can tackle my pow issue. I'm not the only one baffled by this... Apparently, I downloaded the wrong program ( git ), and am studying the wrong book. Apparently I've got to learn how to use svn before I can even attempt this? This is ridiculous, in my opinion. I guess what I'm looking for is a list of all the hoops I've got to jump through to get what I want. Something like this... 1) Download and install Subversion (and hope there is a Windows version of it); 2) Buy a book that teaches how to use Subversion; 3) Figure out how to use Subversion to navigate to GCC sources; 4) Find pow or exp and figure out how it works; Is the above what I should do, or is there some other route?
What you are looking for are the glibc sources (the C standard library) and not the GCC sources (the GNU compiler collection). Glibc download: The GNU C Library[^]; download without using Git: Index of /gnu/glibc[^]. The
pow()
andexp()
functions are part of the math library which depends on the target platform processor. Once you have unpacked the glibc sources, these functions can be found here for x86 CPUs (file names fordouble
):- sysdeps/i386/fpu/e_pow.S: Implementation using the x87 math coprocessor.
- sysdeps/ieee754/dbl-64/e_pow.c: Implementation in plain C.
The FPU implementation is in assembler and should not need any other functions. The IEEE implementation needs other modules (at least e_exp.c) and some header files.
-
What you are looking for are the glibc sources (the C standard library) and not the GCC sources (the GNU compiler collection). Glibc download: The GNU C Library[^]; download without using Git: Index of /gnu/glibc[^]. The
pow()
andexp()
functions are part of the math library which depends on the target platform processor. Once you have unpacked the glibc sources, these functions can be found here for x86 CPUs (file names fordouble
):- sysdeps/i386/fpu/e_pow.S: Implementation using the x87 math coprocessor.
- sysdeps/ieee754/dbl-64/e_pow.c: Implementation in plain C.
The FPU implementation is in assembler and should not need any other functions. The IEEE implementation needs other modules (at least e_exp.c) and some header files.
Thanks very much Richard and Jochen. It dawned on me yesterday afternoon while taking a walk (which is how I solve most of my programming problems) that I needed libc - not GNU GCC sources. Just now before checking in here I managed to download libc in tarball format. Now I need to see if I have an app to extract tarballs. I much appreciate your help! Thanks very much!