Home > Backend Development > C++ > body text

Why is `__gxx_personality_v0` Missing in My Free-Standing C Program, and How Can I Fix It?

Mary-Kate Olsen
Release: 2024-11-18 04:30:02
Original
317 people have browsed it

Why is `__gxx_personality_v0` Missing in My Free-Standing C   Program, and How Can I Fix It?

What is the Role of __gxx_personality_v0 in Free-Standing C Programs?

A persistent linker error during compilation of a stand-alone C program may relate to the missing definition of the __gxx_personality_v0 symbol in libstdc . While a simple definition can resolve the issue, it is essential to understand its purpose.

__gxx_personality_v0 is an integral part of the stack unwinding tables, as evidenced in assembly outputs. The Itanium C ABI explicitly defines its role as the Personality Routine.

By declaring __gxx_personality_v0 as a global NULL void pointer, the error is effectively addressed. However, this occurs because no exceptions are being thrown. In the event of an exception, the behavior would become evident.

To avoid such issues, consider disabling exceptions with -fno-exceptions and RTTI with -fno-rtti. Alternatively, linking with g instead of gcc will automatically add -lstdc , resolving the dependency.

The above is the detailed content of Why is `__gxx_personality_v0` Missing in My Free-Standing C Program, and How Can I Fix It?. For more information, please follow other related articles on the PHP Chinese website!

source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Articles by Author
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template