<tfoot id='Zv01a'></tfoot>
    <legend id='Zv01a'><style id='Zv01a'><dir id='Zv01a'><q id='Zv01a'></q></dir></style></legend>

      <small id='Zv01a'></small><noframes id='Zv01a'>

        <i id='Zv01a'><tr id='Zv01a'><dt id='Zv01a'><q id='Zv01a'><span id='Zv01a'><b id='Zv01a'><form id='Zv01a'><ins id='Zv01a'></ins><ul id='Zv01a'></ul><sub id='Zv01a'></sub></form><legend id='Zv01a'></legend><bdo id='Zv01a'><pre id='Zv01a'><center id='Zv01a'></center></pre></bdo></b><th id='Zv01a'></th></span></q></dt></tr></i><div id='Zv01a'><tfoot id='Zv01a'></tfoot><dl id='Zv01a'><fieldset id='Zv01a'></fieldset></dl></div>
        • <bdo id='Zv01a'></bdo><ul id='Zv01a'></ul>

        __gxx_personality_v0 有什么用?

        时间:2023-09-19

            • <bdo id='Ub6JR'></bdo><ul id='Ub6JR'></ul>
            • <small id='Ub6JR'></small><noframes id='Ub6JR'>

              <i id='Ub6JR'><tr id='Ub6JR'><dt id='Ub6JR'><q id='Ub6JR'><span id='Ub6JR'><b id='Ub6JR'><form id='Ub6JR'><ins id='Ub6JR'></ins><ul id='Ub6JR'></ul><sub id='Ub6JR'></sub></form><legend id='Ub6JR'></legend><bdo id='Ub6JR'><pre id='Ub6JR'><center id='Ub6JR'></center></pre></bdo></b><th id='Ub6JR'></th></span></q></dt></tr></i><div id='Ub6JR'><tfoot id='Ub6JR'></tfoot><dl id='Ub6JR'><fieldset id='Ub6JR'></fieldset></dl></div>
            • <tfoot id='Ub6JR'></tfoot>
              <legend id='Ub6JR'><style id='Ub6JR'><dir id='Ub6JR'><q id='Ub6JR'></q></dir></style></legend>
                    <tbody id='Ub6JR'></tbody>
                  本文介绍了__gxx_personality_v0 有什么用?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                  问题描述

                  这是一个来自操作系统开发站点的二手问题,但它让我很好奇,因为我在任何地方都找不到合适的解释.

                  This is a second-hand question from an OS development site, but it made me curious since I couldn't find a decent explanation anywhere.

                  在使用 gcc 编译和链接一个独立的 C++ 程序时,有时会出现这样的链接器错误:

                  When compiling and linking a free-standing C++ program using gcc, sometimes a linker error like this occurs:

                  out/kernel.o:(.eh_frame+0x11): undefined reference to `__gxx_personality_v0'
                  

                  这显然是因为这个符号是在 libstdc++ 中定义的,它在独立环境中是缺失的.解决这个问题只需要在某处定义这个符号:

                  This is apparently because this symbol is defined in libstdc++, which is missing in a free-standing environment. Fixing the problem simply requires defining this symbol somewhere:

                  void *__gxx_personality_v0;
                  

                  这很好,但我不喜欢那些神奇的东西......所以问题是,这个符号的目的是什么?

                  Which is nice, but I don't like things that just magically work... So the question is, what is the purpose of this symbol?

                  推荐答案

                  它用于堆栈展开表,例如您可以在 我对另一个问题的回答.如该答案所述,它的使用由 Itanium C++ ABI 定义,其中它被称为个性程序.

                  It is used in the stack unwiding tables, which you can see for instance in the assembly output of my answer to another question. As mentioned on that answer, its use is defined by the Itanium C++ ABI, where it is called the Personality Routine.

                  通过将其定义为全局 NULL void 指针来工作"的原因可能是因为没有任何内容引发异常.当某些东西试图抛出异常时,你会看到它行为不端.

                  The reason it "works" by defining it as a global NULL void pointer is probably because nothing is throwing an exception. When something tries to throw an exception, then you will see it misbehave.

                  当然,如果没有使用异常,您可以使用 -fno-exceptions 禁用它们(如果没有使用 RTTI,您也可以添加 -fno-rtti>).如果您正在使用它们,则必须(正如其他答案已经指出的那样)使用 g++ 而不是 gcc 链接,这将添加 -lstdc++你.

                  Of course, if nothing is using exceptions, you can disable them with -fno-exceptions (and if nothing is using RTTI, you can also add -fno-rtti). If you are using them, you have to (as other answers already noted) link with g++ instead of gcc, which will add -lstdc++ for you.

                  这篇关于__gxx_personality_v0 有什么用?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

                  上一篇:使用 gcc 编译 C++ 程序 下一篇:实验::文件系统链接器错误

                  相关文章

                  最新文章

                  • <bdo id='GqU9L'></bdo><ul id='GqU9L'></ul>

                  <legend id='GqU9L'><style id='GqU9L'><dir id='GqU9L'><q id='GqU9L'></q></dir></style></legend>

                  <small id='GqU9L'></small><noframes id='GqU9L'>

                  <i id='GqU9L'><tr id='GqU9L'><dt id='GqU9L'><q id='GqU9L'><span id='GqU9L'><b id='GqU9L'><form id='GqU9L'><ins id='GqU9L'></ins><ul id='GqU9L'></ul><sub id='GqU9L'></sub></form><legend id='GqU9L'></legend><bdo id='GqU9L'><pre id='GqU9L'><center id='GqU9L'></center></pre></bdo></b><th id='GqU9L'></th></span></q></dt></tr></i><div id='GqU9L'><tfoot id='GqU9L'></tfoot><dl id='GqU9L'><fieldset id='GqU9L'></fieldset></dl></div>

                    1. <tfoot id='GqU9L'></tfoot>