This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
where in gcc sources is foobar.o written?
- From: Mark Galeck <mark_galeck at pacbell dot net>
- To: "gcc-help at gcc dot gnu dot org" <gcc-help at gcc dot gnu dot org>
- Date: Sat, 5 Mar 2016 11:23:03 +0000 (UTC)
- Subject: where in gcc sources is foobar.o written?
- Authentication-results: sourceware.org; auth=none
- References: <1457176410 dot 120851 dot ezmlm at gcc dot gnu dot org>
- Reply-to: Mark Galeck <mark_galeck at pacbell dot net>
Hello,
as you know, the source of gcc is quite complex, especially for someone who managed to go through their MS in Computer Science without taking a compiler class :)
Where in the sources is the file foobar.o opened for writing in
>gcc -c foobar.c -o foobar.o
The reason why I am asking, if you care to know, is that the LD_PRELOAD trick for the above command, does intercept the open() syscall for (reading) foobar.c, but does not intercept the open() call for (writing) foobar.o .
I know some version of open() is called for writing foobar.o because that is what
>strace -fF gcc -c foobar.c -o foobar.o
says.
If the library containing open() were linked statically, then both would not show up. I also tried to intercept __open(), fopen(), creat(), and their 64-bit variants. Nothing.
So I am stumped and I need to look at the sources to understand. Or perhaps if someone knows the answer, you can explain this to me.
Thank you very much,
Mark