This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: How to write asm output file in finish_unit_callback


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]