[Gc] Fwd: unable to compile GC using Apple's llvm-gcc (from XCode 4)

Asst. Prof. Dmitrii (Dima) Pasechnik dima at ntu.edu.sg
Fri Apr 8 21:21:01 PDT 2011

Dear all,
I post here my email to Hans Boehm and his reply (suggesting to post
here, among other things) to me and to Marius Schamschula.
It would be great to have a fix for this.

---------- Forwarded message ----------
From: Asst. Prof. Dmitrii (Dima) Pasechnik <dima at ntu.edu.sg>
Date: 9 April 2011 03:19
Subject: unable to compile GC using Apple's llvm-gcc (from XCode 4)
To: Hans.Boehm at hp.com

Hi there,
I am trying to build the GC using Apple's llvm-gcc (which is the
default C compiler on the latest XCode 4).
(on a 64-bit MacOSX 10.6.7)
Nether the stable version, nor the latest CVS version compile.

One place that is easy to fix is in
Namely, the workaround for LLVM 2.7 GAS is still needed (see lines
around line 111 in the CVS version),
but it needs a modification to the conditional statement
(this one does not work).

After I get past this problem, I  get
libtool: compile:  cc -DHAVE_CONFIG_H -I./include -I./include
-I./libatomic_ops/src -I./libatomic_ops/src -fexceptions -g -O2 -MT
os_dep.lo -MD -MP -MF .deps/os_dep.Tpo -c os_dep.c  -fno-common -DPIC
-o .libs/os_dep.o
register `%eax' used with `b' suffix
register `%eax' used with `b' suffix
make[1]: *** [os_dep.lo] Error 1

which I cannot figure out at all.

It seems that these two problems are related, as without the
LLVM-specific workaround working I get
libtool: compile:  cc -DHAVE_CONFIG_H -I./include -I./include
-I./libatomic_ops/src -I./libatomic_ops/src -fexceptions -g -O2 -MT
os_dep.lo -MD -MP -MF .deps/os_dep.Tpo -c os_dep.c  -fno-common -DPIC
-o .libs/os_dep.o
./libatomic_ops/src/atomic_ops/sysdeps/gcc/x86_64.h: In function
./libatomic_ops/src/atomic_ops/sysdeps/gcc/x86_64.h:117: error:
unsupported inline asm: input constraint with a matching output
constraint of incompatible type!
make[1]: *** [os_dep.lo] Error 1

Just in case you might know how to deal with this.
from    Boehm, Hans <hans.boehm at hp.com>
to      "Dmitrii V Pasechnik (Asst Prof)" <Dima at ntu.edu.sg>,
Marius Schamschula <mschamschula at gmail.com>
date    9 April 2011 04:23
subject RE: unable to compile GC using Apple's llvm-gcc (from XCode 4)

Both of you pointed out the same problem to me.  I strongly recommend
posting to gc at linux.hpl.hp.com instead, since you are much more likely
to find Mac experts there.

It looks to me like the compiler and assembler have an inconsistent
ideas of what xchgb returns, making it impossible to generate the
instruction inline.

If LLVM supports gcc's __sync_lock_test_and_set, that may be an
acceptable workaround.  It's probably safe to assume that on x86 it
includes a full fence.  I would manually verify that it indeed
generates the xchgb instruction.  But maybe that runs into the same
assembler bug?

Another plan might be to not include test_and_set_t_is_char.h on LLVM,
and instead rely on the default word-sized implementation of
test-and-set locations.  That would require some adjustment to


CONFIDENTIALITY: This email is intended solely for the person(s) named and may be confidential and/or privileged. If you are not the intended recipient, please delete it, notify us and do not copy, use, or disclose its content. Thank you.

Towards A Sustainable Earth: Print Only When Necessary

More information about the Gc mailing list