Opened 13 years ago
Closed 13 years ago
#771 closed defect (fixed)
llvm-gcc hang on OS X 10.7
Reported by: | Jim Ursetto | Owned by: | felix winkelmann |
---|---|---|---|
Priority: | minor | Milestone: | |
Component: | compiler | Version: | 4.7.x |
Keywords: | Cc: | ||
Estimated difficulty: |
Description
ddp may have found the root cause of hanging of chicken binaries compiled with llvm-gcc: http://blog.phusion.nl/2011/12/30/xcode-4-ships-a-buggy-compiler/
The current workaround is to force gcc-4.2 during compilation. However, Xcode 4.2 (shipped in November) removes plain gcc-4.2. Since this breaks Ruby's garbage collector, I assume either Apple will provide a fix or Ruby will work around it (which fix we should adopt).
The usual solution for non-alloca platforms is to use a stub function to take the address of a local variable (requiring compiler support for noinline). If the workaround becomes necessary, I would want to target it as narrowly as possible, as it is ugly. The remaining question is how narrowly it can be targeted.
Attachments (2)
Change History (8)
comment:1 Changed 13 years ago by
comment:2 Changed 13 years ago by
Owner: | set to Jim Ursetto |
---|---|
Status: | new → assigned |
Changed 13 years ago by
Attachment: | 0001-Make-C_stack_pointer-work-with-LLVM-backend.patch added |
---|
Changed 13 years ago by
Attachment: | 0002-Use-C_stack_pointer-instead-of-C_alloc-0-when-genera.patch added |
---|
comment:3 Changed 13 years ago by
Attached two patches fix the hangs on LLVM with optimization enabled. This fix is also required on Linux (tested with Ubuntu 10.04 and their llvm-gcc-4.2 package (LLVM 2.7)); my assumption is that the build success on Linux reported by Felix was done with optimization disabled.
As an interesting data point, building Chicken after make spotless is much faster when using LLVM chicken: 123sec vs 161sec here. Considering that includes the runtime for both "chicken" and "gcc", the speedup for chicken must be significant.
comment:4 Changed 13 years ago by
Confirmed it works with clang (llvm 3.0) on OS X as well, although that wasn't really in doubt.
comment:5 Changed 13 years ago by
Owner: | changed from Jim Ursetto to felix winkelmann |
---|
comment:6 Changed 13 years ago by
Resolution: | → fixed |
---|---|
Status: | assigned → closed |
Thanks - patches are pushed. I actually forgot to sign off.
Ignore the stub function comment, it's not really right. So far I've attempted to simulate alloca(0) via retrieving the value of SP using inline assembly. This is basically what Ruby Enterprise Edition falls back to when alloca is not available or broken. However, llvm-gcc appears to treat SP and BP differently than plain gcc, so I'm not yet convinced this approach is sound.