I'm on an Ubuntu 22.04 x86_64 system, kernel version 6.5.0-15-generic. My current version of the GNU C Library is 2.35
The reason of my question starts with the following simple C source file :
#include <unistd.h>
int main( void ){
char* str = "Hello\n";
write(1,str,strlen(str));
return 0;
}
The target here is this write system call or to be more precise this wrapper function that makes sure that at some point the actual write system call is performed.
I've decided to download the GNU C Library 2.35 source files so that I could inspect the entire function calls chain from the definition of the write system call used in my program all to way down to the actual pure assembly files that make the actual sycall instruction for writing.
I want to point out that I don't wanna use debuggers for this purpose. I just wanna see the source files with my eyes.
Questions
Could anyone kindly show me in order all the source files and their locations in the GNU C Library 2.35 from the point where the write function I used is defined all the way down to assembly files and briefly explain what happens in this functions call chain ?
What about the printf function declared in <stdio.h> ?
Does the GNU C Library use just pure assembly files or it sometimes also uses some gcc inline assembly directly embedded in C source files ?
Then see the branches
and checkout the one you want and start browsing the files.