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

Ivan Maidanski ivmai at mail.ru
Sat Apr 9 01:53:28 PDT 2011


Hi Dima,

Sat, 9 Apr 2011 12:21:01 +0800 "Asst. Prof. Dmitrii (Dima) Pasechnik" <dima at ntu.edu.sg>:

> 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.
> Dmitrii
> 
> ---------- 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.

I'd tried the CVS version with llvm-gcc-2.7 and got the same problem with GAS on x86, so I've added a workaround.
I haven't tested with x64.

> 
> One place that is easy to fix is in
> libatomic_ops/src/atomic_ops/sysdeps/gcc/x86_64.h
> 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
> # ifdef AO_XCHGB_RET_WORD
> (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
> /var/folders/qW/qWY+4Ku1GF0WXrOsV+IDvk+++TM/-Tmp-//ccTVEUmt.s:427:Incorrect
> register `%eax' used with `b' suffix
> /var/folders/qW/qWY+4Ku1GF0WXrOsV+IDvk+++TM/-Tmp-//ccTVEUmt.s:767:Incorrect
> register `%eax' used with `b' suffix
> make[1]: *** [os_dep.lo] Error 1
> 
> which I cannot figure out at all.


I think using "unsigned long long" instead of "unsigned" could work. Could you try this workaround?

> 
> 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
> 'AO_test_and_set_full':
> ./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

Yes, it's known.

> 
> 
> Just in case you might know how to deal with this.
> Thanks,
> Dmitrii
> -------------------------------------------------------------------------------
> 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
> AO_test_and_set_full().
> 
> Hans
> 
> 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
> 
> _______________________________________________
> Gc mailing list
> Gc at linux.hpl.hp.com
> http://www.hpl.hp.com/hosted/linux/mail-archives/gc/



More information about the Gc mailing list