This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Re: where in gcc sources is foobar.o written?
- From: Mark Galeck <mark_galeck at pacbell dot net>
- To: Manuel LÃpez-IbÃÃez <lopezibanez at gmail dot com>, "gcc-help at gcc dot gnu dot org" <gcc-help at gcc dot gnu dot org>
- Date: Sat, 5 Mar 2016 12:23:45 +0000 (UTC)
- Subject: Re: where in gcc sources is foobar.o written?
- Authentication-results: sourceware.org; auth=none
- References: <56DAC865 dot 70305 at gmail dot com>
- Reply-to: Mark Galeck <mark_galeck at pacbell dot net>
Thank you for your help!
Yes with your pointer I found out that cc1 writes a .s file in the /tmp directory, and then
the assembler /usr/bin/as opens that for reading using fopen() and outputs foobar.o (without any renaming).
Still I don't know what the assembler is using to open foobar.o for writing (strace says open() but I intercept that and any variants and none of them are used, maybe the assembler is built with syscalls linked statically).
So I guess I need to understand the assembler source and/or how it links the system calls.
I can see that the assembler is not part of gcc so I guess that is where this thread ends.
Thank you for your help and if you have anything more to teach me, please do, thank you
----- Original Message -----
From: Manuel LÃpez-IbÃÃez <lopezibanez@gmail.com>
To: Mark Galeck <mark_galeck@pacbell.net>; "gcc-help@gcc.gnu.org" <gcc-help@gcc.gnu.org>
Sent: Saturday, March 5, 2016 3:52 AM
Subject: Re: where in gcc sources is foobar.o written?
On 05/03/16 11:23, Mark Galeck wrote:
> 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
The foobar.o in your command-line is created by the assembler. Append '-###' to
see all programs invoked by the gcc driver. See
https://gcc.gnu.org/wiki/DebuggingGCC
It is possible that the assembler creates the .o file in some /tmp/ directory,
then renames/moves it to the target directory.
There is a lot of useful info in https://gcc.gnu.org/wiki/GettingStarted
Unfortunately, it is badly organized. Any help in organizing it would be
appreciated.
Cheers,
Manuel.