It was thus said that the Great Michael Sokolov once stated:
spc(a)conman.org (Sean 'Captain Napalm' Conner) wrote:
Okay, figured out why my code didn't work,
and it's not due to writing to
the wrong location (although I suspect that still is a problem) but that
under Unix the code pages are marked read-only so of course it core dumped.
You do know about -N option to ld, right? That would make an OMAGIC
executable whose code is not protected.
No, I did not know about the -N option. Tried that (once I found the
correct location) and it worked. Even more surprising was when I upped the
optimization level---the compiler (in this case, GCC 2.7.2.3) *inlined* the
sort routine in sort_ascending() and sort_descending(), so even if I got the
right instruction changed, it wouldn't work because the code that was
modified was never called.
Not that I would do this, even for throw away stuff, but it's nice to know
it's there if needed.
-spc (Curious ... )