summaryrefslogtreecommitdiffstatshomepage
path: root/unix
diff options
context:
space:
mode:
authorPaul Sokolovsky <pfalcon@users.sourceforge.net>2014-05-28 15:37:22 +0300
committerPaul Sokolovsky <pfalcon@users.sourceforge.net>2014-05-28 15:37:22 +0300
commit1d567592b18ea9796515436754877aac3948bd29 (patch)
tree88dbcf69812b0def74e39fd0924851e68cfc44af /unix
parent168a9ce863715d32a5375553e781506de201d4cf (diff)
downloadmicropython-1d567592b18ea9796515436754877aac3948bd29.tar.gz
micropython-1d567592b18ea9796515436754877aac3948bd29.zip
unix/gccollect.c: Make Clang workaround apply only to it. Unbreaks gcc builds.
Diffstat (limited to 'unix')
-rw-r--r--unix/gccollect.c18
1 files changed, 13 insertions, 5 deletions
diff --git a/unix/gccollect.c b/unix/gccollect.c
index 1b5a38ffc6..d934f9cae2 100644
--- a/unix/gccollect.c
+++ b/unix/gccollect.c
@@ -43,17 +43,25 @@ typedef machine_uint_t regs_t[6];
void gc_helper_get_regs(regs_t arr) {
register long rbx asm ("rbx");
- asm("" : "=r"(rbx));
register long rbp asm ("rbp");
- asm("" : "=r"(rbp));
register long r12 asm ("r12");
- asm("" : "=r"(r12));
register long r13 asm ("r13");
- asm("" : "=r"(r13));
register long r14 asm ("r14");
- asm("" : "=r"(r14));
register long r15 asm ("r15");
+#ifdef __clang__
+ // TODO:
+ // This is dirty workaround for Clang. It tries to get around
+ // uncompliant (wrt to GCC) behavior of handling register variables.
+ // Application of this patch here is random, and done only to unbreak
+ // MacOS build. Better, cross-arch ways to deal with Clang issues should
+ // be found.
+ asm("" : "=r"(rbx));
+ asm("" : "=r"(rbp));
+ asm("" : "=r"(r12));
+ asm("" : "=r"(r13));
+ asm("" : "=r"(r14));
asm("" : "=r"(r15));
+#endif
arr[0] = rbx;
arr[1] = rbp;
arr[2] = r12;