[llvm-commits] [patch] Change how we handle mandatory unwind tables

Duncan Sands baldrick at free.fr
Tue May 24 07:28:12 PDT 2011


Hi Rafael,

>>> One way to fix this would be to move the logic from Clang's codegen to
>>> LLVM's codegen, but we would still have problems with:
>>>
>>> $ clang -fno-asynchronous-unwind-tables -c -emit-llvm test.c
>>> $ clang test.o -o test
>>
>> can't this be fixed via better documentation?  I.e. explain that codegen options
>> don't do anything when not doing codegen (and perhaps have clang warn about
>> this), and that you should do this instead:
>>
>>    >   $ clang -c -emit-llvm test.c
>>    >   $ clang -fno-asynchronous-unwind-tables test.o -o test
>
> We would need to extend the LTO api to implement this, but it should be
> possible.
>
> That is how gcc works (or used to work at least), but IMHO it is a
> terrible idea. If without LTO I can put unwind tables in some functions
> but not others, why can't I do that with LTO?

I can buy that :)  If you are going to go this route, maybe you should make your
flag a tri-state, representing whether the user (1) said they wanted unwind
tables ("uwtables"), or (2) said they definitely did not want unwind tables
("nouwtables"), or (3) didn't specify anything one way or the other (no flag).
For example, functions in a file compiled with "-funwind-tables" would get
flag uwtables; those compiled with "-fno-unwind-tables" would get nouwtables;
and the rest wouldn't get any special flag.  The compiler is then free to do
what it likes for those with neither flag.  For example, if doing codegen at
link time (LTO; yes I know there isn't a way to specify codegen flags at link
time yet, but probably there should be) and the -funwind-tables flag was passed
to the linker then guys with no flags would get unwind tables along with
functions with the uwtables flag (but not those with the nouwtables flag);
while conversely if -fno-unwind-tables was specified at link time, then link
time codegen would only generate unwind tables for those functions with the
uwtables flag, i.e. those that were originally compiled with -funwind-tables.
Just a thought.

Ciao, Duncan.



More information about the llvm-commits mailing list