[cfe-dev] _clang_call_terminate referenced in ...; defined in discarded section

Riyaz Puthiyapurayil via cfe-dev cfe-dev at lists.llvm.org
Fri Jun 17 09:06:16 PDT 2016


I posted a variant of this query on llvm-dev and haven't got any response yet. I am looking for hints on what could be the cause for the following error:


`__clang_call_terminate' referenced in section `.text' of some_file.o: defined in discarded section `.text.__clang_call_terminate[__clang_call_terminate]' of some_file.o

The clang version is 3.8.1 running on redhat 5 and x86_64 (yes, I know...older linux kernel, but clang 3.4 works without issues on the same platform). The above error occurs only when -g is used (possibly the reference to __clang_call_terminate gets removed when optimizations are enabled). There is another issue (a run-time crash in the executable generated by clang that I am trying to debug and that is when the above error was exposed).

I see that __clang_call_terminate shows up as a weak symbol in libc++abi. The executable I am building uses -static-libgcc and -static-libstdc++ options on link line (clang++ is invoked on the link line). libc++ or libc++abi are not used.

In case, it is relevant, the clang++ compiler that I am using was first built from release_38 branch using g++ 4.8.3 and libstdc++ (libc++/c++abi are also built in this step) and then I rebuilt clang++ with the clang++ and libc++/libc++abi from the previous step. It is the clang++ in the second that we are using. I have not tried to use clang++ from the first step to compile our code.

I have tried to create a standalone test case for the above issue but has not been successful. If you can provide any hints to possible causes, it would help in coming up with a test case. Specifically, I would like to know what C++ code can result in the generation of __clang_call_terminate. I suspect it has something to do with exceptions (std::terminate??). I couldn't find any documentation on this. I can look at the clang source code but that is going to take me more time.

-Riyaz


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20160617/b05fa862/attachment.html>


More information about the cfe-dev mailing list