This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Re: How to write asm output file in finish_unit_callback
- From: Yuà Liu <yue dot liu at mail dot com>
- To: gcc-help at gcc dot gnu dot org
- Date: Sun, 14 Jul 2013 23:15:28 -0400
- Subject: Re: How to write asm output file in finish_unit_callback
- References: <CAJ341XT5aMPmW6KBThj=AYoZOY5qkAosu-MKSfe1u_9BnC_M0A at mail dot gmail dot com>
oh, just found i should use asm_out_file which is defined in toplev.c
On Sun, Jul 14, 2013 at 8:19 PM, Yuà Liu <yue.liu@mail.com> wrote:
> Hello,
>
> I'm writing a plugin which extract some information first then write
> them back to asm file formatted as pseudo-ops. In my design the write
> back to asm part is in finish_unit_callback. I thought at this time
> output to asm_out_file should already finished and file already
> closed, so i used
>
> fopen ( asm_file_name, "a" );
>
> and fprintf() to write my data. But I found:
>
> If I use fclose() after fprintf(), I got nothing in asm output;
> If I don't close the file I opened, I can got correct output, but if I
> write too much data, the first several chracters are truncated.
>
> I guess at the time finish_unit_callback execute the asm output file
> is still being accessed by the compiler, is it? how to append some
> pseudo-ops at the end of asm output file in a plugin?
>
> Thanks,
> Yue Liu