This is an archive of the discontinued LLVM Phabricator instance.

Rename *.c to *.cpp to generate unwind tables for these functions.
AbandonedPublic

Authored by logan on Jan 17 2015, 12:11 AM.

Details

Summary

If we compile these *.c files with arm-linux-gnueabi-gcc, gcc won't
generate the unwind table by default. As the result, the _Unwind_Backtrace
can't unwind through itself.

This change fix the problem by renaming *.c to *.cpp.

(p.s. This is the 5/6 patch to fix the backtrace_test and libgcc support.)

Diff Detail

Event Timeline

logan updated this revision to Diff 18340.Jan 17 2015, 12:11 AM
logan retitled this revision from to Rename *.c to *.cpp to generate unwind tables for these functions..
logan updated this object.
logan edited the test plan for this revision. (Show Details)
logan added reviewers: danalbert, rengolin, jroelofs.
logan added a subscriber: Unknown Object (MLST).
rengolin edited edge metadata.Jan 20 2015, 6:21 AM

It used to always generate the EHABI tables, even in C mode, so I'm surprised it doesn't any more.

Nevertheless, I think we better use a flag to emit the tables rather than change the language, as C++isms could creep in and we want this code as simple as possible.

cheers,
--renato

jroelofs edited edge metadata.Jan 20 2015, 6:24 AM

We had a flag for it at one point. How are you building this, @logan... cmake, or buildit?

logan added a comment.Jan 21 2015, 9:05 AM

I am using cmake and clang 3.5.

An alternative solution is to add -funwind-tables to CFLAGS.

I guess that it is due to the fact that these C functions are considered as nothrow.

Yeah, I think it would be best to add -funwind-tables (back?) to the CFLAGS.

logan abandoned this revision.Jan 21 2015, 9:54 AM

OK. Please refer to D7099 for the -funwind-tables change instead.