pltStubSymbols
's treatment of the .plt.got
section miscalculates the number of PLT stubs
#375
Labels
pltStubSymbols
's treatment of the .plt.got
section miscalculates the number of PLT stubs
#375
If you compile this simple C program using
clang
:You'll see that it has exactly one PLT stub in its
.plt.got
section:However,
pltStubSymbols
claims that it has more PLT stubs than this! Here is what you see if you debug-print the output ofpltStubSymbols
on this program:What is going on here?
Ultimately,
pltStubsSymbol
consults the.rela.dyn
section to figure out what the contents of the.plt.got
are. In this case,.rela.dyn
contains five entries:But only one of them (
__cxa_finalize
) is actually a PLT stub. However, their presence throws off the heuristics thatpltStubSymbols
uses.I'm not quite sure what to do about this. It would be convenient if there were a convenient mechanism to distinguish
__cxa_finalize
apart from the other entries in.got
, but I'm not sure what that would be. My first inclination was to filter out any symbols that aren't function symbols, but even that isn't enough, as__libc_start_main
is also a function symbol:It's also tempting to think that the combination of
FUNC
andWEAK
would uniquely identify PLT stubs, but that is also not true. If you call a function via a function pointer, e.g.,Then
malloc
will also be called via a PLT stub, but its function symbol will beFUNC
andGLOBAL
.The text was updated successfully, but these errors were encountered: