Linux, GNU GCC, ld, version scripts and the ELF binary format — How does it work?

后端 未结 1 1237
迷失自我
迷失自我 2021-01-05 00:26

I\'m trying to learn more about library versioning in Linux and how to put it all to work. Here\'s the context:

-- I have two versions of a dynamic library which exp

相关标签:
1条回答
  • 2021-01-05 00:46

    Try compiling both libsome1.so and libsome2.so to add symbol versioning, each with their own version (use the --version-script option to ld). Then link the application and libmagic.so using the new libraries. Then, libsome1.so and libsome2.so should be completely separate.

    Problems can still occur if there are unversioned references to symbols. Such references can be satisfied by versioned definitions (so that it is possible to add symbol versioning to a library without breaking binary compatibility). If there are multiple symbols of the same name, it can sometimes be hard to predict which one will be used.

    Regarding tools, nm -D does not display any information about symbol versioning. Try objdump -T or readelf -s instead.

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