Re: Reading code of a function?
- From: Paul Pluzhnikov <ppluzhnikov-nsp@xxxxxxxxxxx>
- Date: Wed, 17 Jan 2007 17:38:52 -0800
Michael B Allen <mba2000@xxxxxxxxxx> writes:
What if the hash function calls a helper function that isn't part of your
clever scheme?
The function is also not allowed to access any global data, because
in PIC code such access is indirected, and the "global" pointer
will not be properly set up when function code is copied elsewhere.
Right. The hash function cannot and does not call other functions.
On platforms that maintain separate '%gp' register this function
will not be able to access any non-immediate data at all. I think
PowerPC, PA-RISC, MIPS, and ia64 will all present a problem.
dlsym sounds like the right answer for the immediate problem, but the whole
exercise still sounds ugly to me.
Yes, we've told that to Michael about 14 month ago:
http://groups.google.com/group/comp.unix.programmer/browse_frm/thread/24a35a238c9202fc
How do you decide how many bytes to copy?
err *why* can't you get the size from objdump?
Objdump doesn't understand some file formats at all, and often
gives you incorrect info on others.
You can get the size by examining disassembly, but you'll have
to repeat the exercise for each user-supplied function, for each
platform, each compiler, and each set of compilation flags.
And hope that user didn't turn on compiler and linker optimizations
which could split a single function into several "chunks" and
scattered them all over the DSO (this actually happens a lot in
x64 DLLs compiled with VS 2005, but I haven't seen this on any
UNIX yet).
Cheers,
--
In order to understand recursion you must first understand recursion.
Remove /-nsp/ for email.
.
- Follow-Ups:
- Re: Reading code of a function?
- From: Michael B Allen
- Re: Reading code of a function?
- References:
- Re: Reading code of a function?
- From: Michael B Allen
- Re: Reading code of a function?
- Prev by Date: Re: Slightly OT: Correct Nomenclature for All Unix-Like Operating Systems
- Next by Date: How to determine what process has a controlling terminal...
- Previous by thread: Re: Reading code of a function?
- Next by thread: Re: Reading code of a function?
- Index(es):
Relevant Pages
|