Here's a patch, if someone could validate on OS X for me that would be
great.
Cheers,
Simon
On 17/01/13 19:18, Johan Tibell wrote:
Reverting 520dc1d245fa5d965bdc7e97231e868de7c1dd9e fixes the problem
on my machine. Simon M, what do you want to do?
On Thu, Jan 17, 2013 at 11:08 AM, Johan Tibell <[email protected]> wrote:
I was wrong, it just take quite a bit longer to fail. Here's the trace
for a single-threaded build:
cho rts/dist/ffi/*.o rts/dist/build/Adjustor.debug_o
rts/dist/build/Arena.debug_o rts/dist/build/Capability.debug_o
rts/dist/build/ClosureFlags.debug_o
rts/dist/build/Disassembler.debug_o rts/dist/build/FileLock.debug_o
rts/dist/build/FrontPanel.debug_o rts/dist/build/Globals.debug_o
rts/dist/build/Hash.debug_o rts/dist/build/Hpc.debug_o
rts/dist/build/HsFFI.debug_o rts/dist/build/Inlines.debug_o
rts/dist/build/Interpreter.debug_o rts/dist/build/LdvProfile.debug_o
rts/dist/build/Linker.debug_o rts/dist/build/Messages.debug_o
rts/dist/build/OldARMAtomic.debug_o rts/dist/build/Papi.debug_o
rts/dist/build/Printer.debug_o rts/dist/build/ProfHeap.debug_o
rts/dist/build/Profiling.debug_o rts/dist/build/Proftimer.debug_o
rts/dist/build/RaiseAsync.debug_o
rts/dist/build/RetainerProfile.debug_o
rts/dist/build/RetainerSet.debug_o rts/dist/build/RtsAPI.debug_o
rts/dist/build/RtsDllMain.debug_o rts/dist/build/RtsFlags.debug_o
rts/dist/build/RtsMain.debug_o rts/dist/build/RtsMessages.debug_o
rts/dist/build/RtsStartup.debug_o rts/dist/build/RtsUtils.debug_o
rts/dist/build/STM.debug_o rts/dist/build/Schedule.debug_o
rts/dist/build/Sparks.debug_o rts/dist/build/Stable.debug_o
rts/dist/build/Stats.debug_o rts/dist/build/StgCRun.debug_o
rts/dist/build/StgPrimFloat.debug_o rts/dist/build/Task.debug_o
rts/dist/build/ThreadLabels.debug_o
rts/dist/build/ThreadPaused.debug_o rts/dist/build/Threads.debug_o
rts/dist/build/Ticky.debug_o rts/dist/build/Timer.debug_o
rts/dist/build/Trace.debug_o rts/dist/build/WSDeque.debug_o
rts/dist/build/Weak.debug_o rts/dist/build/hooks/FlagDefaults.debug_o
rts/dist/build/hooks/MallocFail.debug_o
rts/dist/build/hooks/OnExit.debug_o
rts/dist/build/hooks/OutOfHeap.debug_o
rts/dist/build/hooks/StackOverflow.debug_o
rts/dist/build/parallel/0Hash.debug_o
rts/dist/build/parallel/0Unpack.debug_o
rts/dist/build/parallel/Dist.debug_o
rts/dist/build/parallel/Global.debug_o
rts/dist/build/parallel/GranSim.debug_o
rts/dist/build/parallel/HLComms.debug_o
rts/dist/build/parallel/LLComms.debug_o
rts/dist/build/parallel/Pack.debug_o
rts/dist/build/parallel/ParInit.debug_o
rts/dist/build/parallel/ParTicky.debug_o
rts/dist/build/parallel/Parallel.debug_o
rts/dist/build/parallel/ParallelDebug.debug_o
rts/dist/build/parallel/RBH.debug_o
rts/dist/build/sm/BlockAlloc.debug_o rts/dist/build/sm/Compact.debug_o
rts/dist/build/sm/Evac.debug_o rts/dist/build/sm/GC.debug_o
rts/dist/build/sm/GCAux.debug_o rts/dist/build/sm/GCUtils.debug_o
rts/dist/build/sm/MBlock.debug_o rts/dist/build/sm/MarkWeak.debug_o
rts/dist/build/sm/Sanity.debug_o rts/dist/build/sm/Scav.debug_o
rts/dist/build/sm/Storage.debug_o rts/dist/build/sm/Sweep.debug_o
rts/dist/build/eventlog/EventLog.debug_o
rts/dist/build/posix/GetEnv.debug_o
rts/dist/build/posix/GetTime.debug_o
rts/dist/build/posix/Itimer.debug_o rts/dist/build/posix/OSMem.debug_o
rts/dist/build/posix/OSThreads.debug_o
rts/dist/build/posix/Select.debug_o
rts/dist/build/posix/Signals.debug_o rts/dist/build/posix/TTY.debug_o
rts/dist/build/Apply.debug_o rts/dist/build/Exception.debug_o
rts/dist/build/HeapStackCheck.debug_o rts/dist/build/PrimOps.debug_o
rts/dist/build/StgMiscClosures.debug_o
rts/dist/build/StgStartup.debug_o rts/dist/build/StgStdThunks.debug_o
rts/dist/build/Updates.debug_o rts/dist/build/AutoApply.debug_o |
"xargs" "/usr/bin/ar" clqs rts/dist/build/libHSrts_debug.a
/usr/bin/ranlib: file: rts/dist/build/libHSrts_debug.a(darwin.o) has no symbols
/usr/bin/ranlib: file: rts/dist/build/libHSrts_debug.a(ffi.o) has no symbols
/usr/bin/ranlib: file:
rts/dist/build/libHSrts_debug.a(FrontPanel.debug_o) has no symbols
/usr/bin/ranlib: file:
rts/dist/build/libHSrts_debug.a(LdvProfile.debug_o) has no symbols
/usr/bin/ranlib: file:
rts/dist/build/libHSrts_debug.a(OldARMAtomic.debug_o) has no symbols
/usr/bin/ranlib: file: rts/dist/build/libHSrts_debug.a(Papi.debug_o)
has no symbols
/usr/bin/ranlib: file:
rts/dist/build/libHSrts_debug.a(Profiling.debug_o) has no symbols
/usr/bin/ranlib: file:
rts/dist/build/libHSrts_debug.a(RetainerProfile.debug_o) has no
symbols
/usr/bin/ranlib: file:
rts/dist/build/libHSrts_debug.a(RetainerSet.debug_o) has no symbols
/usr/bin/ranlib: file:
rts/dist/build/libHSrts_debug.a(RtsDllMain.debug_o) has no symbols
/usr/bin/ranlib: file: rts/dist/build/libHSrts_debug.a(0Hash.debug_o)
has no symbols
/usr/bin/ranlib: file:
rts/dist/build/libHSrts_debug.a(0Unpack.debug_o) has no symbols
/usr/bin/ranlib: file: rts/dist/build/libHSrts_debug.a(Dist.debug_o)
has no symbols
/usr/bin/ranlib: file: rts/dist/build/libHSrts_debug.a(Global.debug_o)
has no symbols
/usr/bin/ranlib: file:
rts/dist/build/libHSrts_debug.a(GranSim.debug_o) has no symbols
/usr/bin/ranlib: file:
rts/dist/build/libHSrts_debug.a(HLComms.debug_o) has no symbols
/usr/bin/ranlib: file:
rts/dist/build/libHSrts_debug.a(LLComms.debug_o) has no symbols
/usr/bin/ranlib: file: rts/dist/build/libHSrts_debug.a(Pack.debug_o)
has no symbols
/usr/bin/ranlib: file:
rts/dist/build/libHSrts_debug.a(ParInit.debug_o) has no symbols
/usr/bin/ranlib: file:
rts/dist/build/libHSrts_debug.a(ParTicky.debug_o) has no symbols
/usr/bin/ranlib: file:
rts/dist/build/libHSrts_debug.a(Parallel.debug_o) has no symbols
/usr/bin/ranlib: file:
rts/dist/build/libHSrts_debug.a(ParallelDebug.debug_o) has no symbols
/usr/bin/ranlib: file: rts/dist/build/libHSrts_debug.a(RBH.debug_o)
has no symbols
rts_dist_HC rts/dist/build/sm/GC.thr_o
In file included from rts/sm/GC.c:25:0:
rts/sm/GCUtils.h: In function ‘recordMutableGen_GC’:
rts/sm/GCUtils.h:55:0:
error: ‘gctKey’ undeclared (first use in this function)
rts/sm/GCUtils.h:55:0:
error: (Each undeclared identifier is reported only once
rts/sm/GCUtils.h:55:0: error: for each function it appears in.)
make[1]: *** [rts/dist/build/sm/GC.thr_o] Error 1
make: *** [all] Error 2
On Thu, Jan 17, 2013 at 11:05 AM, Johan Tibell <[email protected]> wrote:
Turning of parallel builds (i.e. not passing -j to make) seems to
work, so this might be a race in the build system. Perhaps there's an
untracked dependency?
On Thu, Jan 17, 2013 at 10:55 AM, Johan Tibell <[email protected]> wrote:
Hi,
I'm currently getting the following failure on OS X:
rts_dist_HC rts/dist/build/sm/GCAux.thr_o
In file included from rts/sm/GC.c:25:0:
rts/sm/GCUtils.h: In function ‘recordMutableGen_GC’:
rts/sm/GCUtils.h:55:0:
error: ‘gctKey’ undeclared (first use in this function)
rts/sm/GCUtils.h:55:0:
error: (Each undeclared identifier is reported only once
rts/sm/GCUtils.h:55:0: error: for each function it appears in.)
make[1]: *** [rts/dist/build/sm/GC.thr_o] Error 1
make[1]: *** Waiting for unfinished jobs....
make: *** [all] Error 2
I wonder if 520dc1d245fa5d965bdc7e97231e868de7c1dd9e, which moved
around some includes in that directory, is to blame.
-- Johan
>From cc45a2c54d86fa2101896d20f1437abac30e9c34 Mon Sep 17 00:00:00 2001
From: Simon Marlow <[email protected]>
Date: Thu, 17 Jan 2013 16:42:38 +0000
Subject: [PATCH] Hopefully fix breakage on OS X w/ LLVM
Reordering of includes in GC.c broke on OS X because gctKey is
declared in Task.h and is needed in the storage manager. This is
really the wrong place for it anyway, so I've moved the gctKey pieces
to where they should be.
---
rts/Task.c | 9 ---------
rts/Task.h | 6 ------
rts/sm/GCTDecl.h | 2 +-
rts/sm/GCThread.h | 4 ++++
rts/sm/Storage.c | 7 +++++++
5 files changed, 12 insertions(+), 16 deletions(-)
diff --git a/rts/Task.c b/rts/Task.c
index 78725dd..e6781a1 100644
--- a/rts/Task.c
+++ b/rts/Task.c
@@ -54,9 +54,6 @@ __thread Task *my_task;
# else
ThreadLocalKey currentTaskKey;
# endif
-#ifdef llvm_CC_FLAVOR
-ThreadLocalKey gctKey;
-#endif
#else
Task *my_task;
#endif
@@ -78,9 +75,6 @@ initTaskManager (void)
#if !defined(MYTASK_USE_TLV)
newThreadLocalKey(¤tTaskKey);
#endif
-#if defined(llvm_CC_FLAVOR)
- newThreadLocalKey(&gctKey);
-#endif
initMutex(&all_tasks_mutex);
#endif
}
@@ -115,9 +109,6 @@ freeTaskManager (void)
#if !defined(MYTASK_USE_TLV)
freeThreadLocalKey(¤tTaskKey);
#endif
-#if defined(llvm_CC_FLAVOR)
- freeThreadLocalKey(&gctKey);
-#endif
#endif
tasksInitialized = 0;
diff --git a/rts/Task.h b/rts/Task.h
index e5b7295..f18f154 100644
--- a/rts/Task.h
+++ b/rts/Task.h
@@ -238,12 +238,6 @@ extern __thread Task *my_task;
#else
extern ThreadLocalKey currentTaskKey;
#endif
-// LLVM-based compilers do not upport the __thread attribute, so we need
-// to store the gct variable as a pthread local storage. We declare the
-// key here to keep thread local storage initialization in the same place.
-#if defined(llvm_CC_FLAVOR)
-extern ThreadLocalKey gctKey;
-#endif
#else
extern Task *my_task;
#endif
diff --git a/rts/sm/GCTDecl.h b/rts/sm/GCTDecl.h
index f9c8fcb..6eb6cc2 100644
--- a/rts/sm/GCTDecl.h
+++ b/rts/sm/GCTDecl.h
@@ -52,7 +52,7 @@ extern __thread gc_thread* gct;
// with a C compiler that uses an LLVM back end (clang or llvm-gcc) then we
// use pthread_getspecific() to handle the thread local storage for gct.
#define gct ((gc_thread *)(pthread_getspecific(gctKey)))
-#define DECLARE_GCT /* nothing */
+#define DECLARE_GCT ThreadLocalKey gctKey;
#elif defined(sparc_HOST_ARCH)
// On SPARC we can't pin gct to a register. Names like %l1 are just offsets
diff --git a/rts/sm/GCThread.h b/rts/sm/GCThread.h
index 7d163cb..59327bc 100644
--- a/rts/sm/GCThread.h
+++ b/rts/sm/GCThread.h
@@ -204,6 +204,10 @@ extern nat n_gc_threads;
extern gc_thread **gc_threads;
+#if defined(THREADED_RTS) && defined(llvm_CC_FLAVOR)
+extern ThreadLocalKey gctKey;
+#endif
+
#include "EndPrivate.h"
#endif // SM_GCTHREAD_H
diff --git a/rts/sm/Storage.c b/rts/sm/Storage.c
index ff4f172..518ae0d 100644
--- a/rts/sm/Storage.c
+++ b/rts/sm/Storage.c
@@ -229,6 +229,10 @@ void storageAddCapabilities (nat from, nat to)
}
}
+#if defined(THREADED_RTS) && defined(llvm_CC_FLAVOR)
+ newThreadLocalKey(&gctKey);
+#endif
+
initGcThreads(from, to);
}
@@ -249,6 +253,9 @@ freeStorage (rtsBool free_heap)
closeMutex(&sm_mutex);
#endif
stgFree(nurseries);
+#if defined(THREADED_RTS) && defined(llvm_CC_FLAVOR)
+ freeThreadLocalKey(&gctKey);
+#endif
freeGcThreads();
}
--
1.7.9.5
_______________________________________________
ghc-devs mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/ghc-devs