title: Self-modifying code on Darwin 10.15 resulting in "malformed mach-o image"?
body: <p>I have a program that generates self-modifying code (see <a href="https://tigress.wtf/selfModify.html" rel="noreferrer">https://tigress.wtf/selfModify.html</a> in case you're interested). It runs on x86 Darwin and Linux. On Darwin, I compile with</p>
  
  <pre><code>gcc -g -segprot __TEXT rwx rwx self_modifying.c -o self_modifying.exe
  </code></pre>
  
  <p>Recently, this seems not to work, I get </p>
  
  <pre><code>dyld: malformed mach-o image: __TEXT segment maps start of file but is writable
  </code></pre>
  
  <p>when I run the program.</p>
  
  <p>I'm running clang version 6.0.1 on MacOS 10.15.3. Any help would be appreciated.</p>