Re: Reading code of a function?



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.
.



Relevant Pages

  • Re: Why does x.ToString() throw an error if x == null?
    ... Michael C wrote: ... have initialized it and the compiler has not set aside any space for ... The actual function called depends on the actual run-time type of the ... ToString implementation. ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: I apologise perhaps for a simple question
    ... It won't do you any harm to set these changes as part of a template, ... you have to use the 'volatile' keyword so that the compiler ... knows that global data values really do change. ... lead to problems at high optimization levels, though i have to say VC2003 ...
    (microsoft.public.dotnet.languages.vc)
  • Re: Volatile for shared data protected by critical section
    ... I don't think that it optimizes register variable use across function calls. ... seeing 'volatile' used much with globals in the CE code base. ... Does the current compiler implementation not attempt to optimize variables ... You are right that the global data will be shared by multiple threads ...
    (microsoft.public.windowsce.embedded)
  • =?iso-8859-1?q?Re:_Beyond_Java_Tiger_-_Defekte_und_L=FCcken_in_Java?=
    ... > Michael Hüttermann schrieb: ... > und wonach soll der Compiler hier suchen? ... Prev by Date: ... Next by Date: ...
    (de.comp.lang.java)
  • Re: Maybe something to vote for...
    ... to compiler the way of optimization. ... stack for assignment. ... With BDS 2006 and Live Templates, we can set up a template that limits the keystrokes required to the same as the C++ version. ... I don't think Michael was talking about ease of typing. ...
    (borland.public.delphi.non-technical)