Is there a way to set the elf NEEDED field at link time?

前端 未结 2 1914
Happy的楠姐
Happy的楠姐 2021-01-23 04:32

Given a executable such that:

>objdump -x someprog | grep c++
NEEDED               libstdc++.so.6

I want to change the requirement to the fu

2条回答
  •  猫巷女王i
    2021-01-23 05:28

    I think I have answered my problem though not the question I actually asked.

    RPATH is searched before LD_LIBRARY_PATH. The reason /usr/lib64/libstdc++.so.6 is being picked up rather than libstdc++.so.6.0.22 is that there is no symbolic link from /where/i/installed/libstdc++.so.6 to /where/i/installed/libstdc++.so.6.0.22

    So the rule is follow the standards for your platform (where they are sensible). In this case: Whenever you install a shared library install the expected links as well.

    I think the actual question I asked is still interesting technically so I will still accept a better answer to that if anyone has one (even years later).

提交回复
热议问题