我正在尝试分析我们的共享库,但每当我设置环境变量 LD_PROFILE 时,我都会收到“PLTREL not found in object”。是什么赋予了?我缺少某种链接器标志还是什么?互联网上似乎没有关于此的信息。 sprof 的手册页大约有 10 个词长。
最佳答案
根据 an unanswered question on Google Groups ,看来您不是第一个遇到此问题的人。
我认为 pltrel 的意思是 plt-relative;在一些ELF design notes ,
There is a .plt section created in the code segment, which is an array of function stubs used to handle the run-time resolution of library calls.
和here还有一点:
The next section I want to mention is the .plt section. This contains the jump table that is used when we call functions in the shared library. By default the .plt entries are all initialized by the linker not to point to the correct target functions, but instead to point to the dynamic loader itself. Thus, the first time you call any given function, the dynamic loader looks up the function and fixes the target of the .plt so that the next time this .plt slot is used we call the correct function. After making this change, the dynamic loader calls the function itself.
在我看来,共享库的编译或组装方式存在问题。希望还有更多searches to elf PLT section让您走上正确的轨道。
关于linux - sprof "PLTREL not found error",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1240384/