i found an article about self modifying code and tried to do some examples, but i get always segmentation faults. As fas as i can understand, there is a violation in memory
You can also disable write-protection for the entire program by passing the switch -N to the linker. If you are invoking the linker from gcc, pass Wl,-N. If you invoke ld directly, pass -N.