From: Frank K. <fbk...@co...> - 2005-07-31 01:27:30
|
Judecca wrote: > Hi! > I've gopt a problem with the nasm assembler. > I am coding a small app that needs to write in the .text section (to modify some > opcodes directly). > Then i declared my section as follow : > section .text write > > However when i try to write in the code, i got a segfault! (i precise that i'm > compiling and running it under linux and i'm using the last version of nasm of > sourceforge) > > What shall I do to make this section writeable ? Call it something besides ".text". Your problem is not strictly with Nasm, but the fact that ld "knows" the name ".text", and changes it to readonly, even if you said "write". This can be verified by doing "objdump -h myfile.o" and "objdump -h myfile". Nasm give you the flags you asked for in the .o file, but ld changes it. Call it "kode", or something... Best, Frank |