What is clang's equivalent to -rdynamic gcc flag?

后端 未结 3 1215
时光说笑
时光说笑 2021-01-05 10:03

I can\'t find any similar option that would include all the function names into the final release binary. Or does clang do it by default?

相关标签:
3条回答
  • 2021-01-05 10:48

    The correct answer to this question is -Wl,-export_dynamic and not -Wl,--export-dynamic.

    -Wl,--export-dynamic is only correct if you are using the GNU linker on ELF platforms.

    This question is about OS X.

    Source: http://www.opensource.apple.com/source/ld64/ld64-236.3/src/ld/Options.cpp

    ...
    else if ( strcmp(arg, "-export_dynamic") == 0 ) {
        fExportDynamic = true;
    }
    ...
    
    0 讨论(0)
  • 2021-01-05 10:49

    At least clang 3.3 seems to support -rdynamic though neither clang --help nor the manpage documents it. (If you are on OSX, -rdynamic isn't needed)

    gcc -rdynamic says "-rdynamic Pass the flag --export-dynamic to the ELF linker, on targets that support it."

    So clang should also be able to do the same with -Wl,--export-dynamic.

    0 讨论(0)
  • 2021-01-05 10:52

    My Google-fu is telling me you can replace that by

    -Wl,--export-dynamic
    

    Which is what GCC usually passes to the linker when it is passed -rdynamic. I would first try it without anything, and see if the flag was necessary.

    0 讨论(0)
提交回复
热议问题