0

I have found out that I can create global variables in the text section, for example:

section .text
    i DD 12345

Will this variable be read-only (since the text section is typically read-only)? And is there's anything wrong in creating global variables in the text section (other than the fact that they'll probably be read-only)?

John
  • 1,049
  • 1
  • 14
  • 34
  • 3
    Short answer: Yes by default. You can make the .text section writable at runtime, though. – tux3 Jan 08 '15 at 18:26
  • @tux3 What do you mean "You can make the .text section writable at runtime"? – John Jan 08 '15 at 20:57
  • Your operating system will generally allow you to change page permissions. Look for mprotect on linux and VirtualProtect on Windows. And you can set section permissions in the binary headers. – tux3 Jan 08 '15 at 20:59

0 Answers0