shithub: mc

Download patch

ref: 8a6221f985e1a493a163d0dde1c025231e1adafb
parent: 7637d28123d59a0508ed68b24e2f83ef678482e5
author: Ori Bernstein <ori@eigenstate.org>
date: Wed Apr 1 12:02:44 EDT 2015

Fix for OSX: Their assembler seems a bit speshul.

    - It doesn't understand .section .text/.rodata
    - It gets confused when you try to take the difference
      between a label at the end of the code and an earlier one.
      We need to insert a dummy before this.

--- a/6/gengas.c
+++ b/6/gengas.c
@@ -668,12 +668,11 @@
         genblob(fd, blob[i], globls, strtab);
     fprintf(fd, "\n");
 
-    fprintf(fd, ".section .text\n");
+    fprintf(fd, ".text\n");
     for (i = 0; i < nfn; i++)
         genfunc(fd, fn[i], globls, strtab);
     fprintf(fd, "\n");
 
-    fprintf(fd, ".section .rodata\n");
     for (i = 0; i < ntypes; i++)
         if (types[i]->isreflect && !types[i]->isimport)
             gentype(fd, types[i]);
@@ -680,6 +679,13 @@
     fprintf(fd, "\n");
 
     genstrings(fd, strtab);
+    /*
+     * workaround for label issue on OSX: we get errors
+     * complaining about how differences involving labels
+     * at the end of functions will generate a non-relocatable
+     * difference. Adding a dummy byte after will fix this.
+     */
+    fprintf(fd, "\t.byte 0 /* dummy to shut up Apple's as */\n");
     fclose(fd);
 }