Re: Retrieve label name

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



"Vincent R." <forumer@xxxxxxxxxxxxxxx> writes:

> We are supposed to fill an array with __try __except address, so it means
> we are generating some
> labels and after we are doing this :
>
> void
> arm_seh_rdata_gen (FILE *fp, char *name, tree decl)
> {
>   int   has_seh = cfun->has_seh;
>
>   asm_fprintf (fp, ".L%s_end:\n", name);
>   //  if (has_seh)
>   if (cfun->has_seh)
>     {
>       asm_fprintf (fp, "\t.section .rdata /* SEH SCOPE_TABLE */\n");
>       asm_fprintf (fp, ".L%s_handler_data:\n", name);
>       asm_fprintf (fp, "\t.word 1 /* Count */\n");
>       asm_fprintf (fp, "\t.word %s /* BeginAddress */\n", ?????????); /*
> begin of __try block */
>       asm_fprintf (fp, "\t.word .L%s_end /* EndAddress */\n", name);  /*
> end of __try block */
>       asm_fprintf (fp, "\t.word 0 /* HandleAddress */\n");            /*
> exception filter */
>       asm_fprintf (fp, "\t.word 0 /* JumpTarget */\n");               /* 
>     }
> }
>
> In the .rdata section we need to know the label corresponding to end of
> __try, so how are we supposed to do that ?

Unless you take extra steps, gcc is going to optimize your exception
regions.  In particular, it will in some cases eliminate them and in
some cases duplicate them.  For a trivial example, if you do
    if (0) __try { f(); } __except ...
the whole __try/__except block will be removed by the optimizers, and
there will be no label to reference in the handler data block.

Unless this is somehow incompatible with SEH, this means that you don't
want to generate your tables based on the frontend parse trees anyhow.
You want to produce exception regions, let them be converted to RTL, and
write code along the lines of except.c.  Those tables are actually
emitted by dwarf2out_frame_finish, specifically by
output_call_frame_info.  You would have to do something different but
roughly equivalent.

Ian

[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux