sprof “PLTREL not found error”

2019-05-23 10:43发布

I'm trying to profile our shared library, but whenever I have the environmental variable LD_PROFILE set, I get "PLTREL not found in object ". What gives? Is there some sort of linker flag I'm missing or what? There seems to be no information about this on the internets. The man page for sprof is about 10 words long.

标签: linux sprof
2条回答
聊天终结者
2楼-- · 2019-05-23 11:26

Found this that may be relevante for you:

Known issues with LD_AUDIT

➢ LD_AUDIT does not work with Shared Libraries with no code in them.

➢ Example ICU-4.0 “libicudata.so”

➢ Error: “no PLTREL found in object /usr/lib/libicudata.so.40”

➢ Recompile after patching libicudata by sed'ing -nostdlib etc away sed -i -- "s/-nodefaultlibs -nostdlib//" config/mh-linux

It seems the same applies for LD_PROFILE

查看更多
够拽才男人
3楼-- · 2019-05-23 11:34

According to an unanswered question on Google Groups, it looks like you aren't the very first person with this problem.

I think pltrel means plt-relative; in some 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.

And here's yet a little more:

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.

Sounds to me like there's an issue with how the shared library was compiled or assembled. Hopefully a few more searches to elf PLT section gets you on the right track.

查看更多
登录 后发表回答