Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SPARC build failed #99

Open
syoyo opened this issue Jan 10, 2015 · 3 comments
Open

SPARC build failed #99

syoyo opened this issue Jan 10, 2015 · 3 comments

Comments

@syoyo
Copy link

syoyo commented Jan 10, 2015

SPARC build of iv/lv5 fails with libgc related issue.

http://qiita.com/syoyo/items/0068f514f606a6b1a91e

It looks like some file(s) are missing in CMakeList.txt when targeting SPARC architecture.

At least, with the following patch, I could get success to build libgc.

$ make
…

Building C object iv/lv5/third_party/gc/CMakeFiles/gcmt-lib.dir/thread_local_alloc.c.o
Building ASM object iv/lv5/third_party/gc/CMakeFiles/gcmt-lib.dir/src/sparc_mach_dep.S.o
Linking CXX executable gctest
Linking CXX shared library libgcmt-dll.so
Linking CXX static library libgcmt-lib.a
[100%] Built target gctest
[100%] Built target gcmt-dll
[100%] Built target gcmt-lib

$ cd test
$ ./gctest 
Completed 1 tests
Allocated 748193 collectable objects
Allocated 202 uncollectable objects
Allocated 1250000 atomic objects
Allocated 21760 stubborn objects
Finalized 2206/2206 objects - finalization is probably ok
Total number of bytes allocated is 103987300
Final heap size is 10211328 bytes
Completed 78 collections
Collector appears to work
diff --git a/iv/lv5/third_party/gc/CMakeLists.txt b/iv/lv5/third_party/gc/CMakeLists.txt
index e538f23..4cf1b9c 100644
--- a/iv/lv5/third_party/gc/CMakeLists.txt
+++ b/iv/lv5/third_party/gc/CMakeLists.txt
@@ -22,6 +22,7 @@
 #

 SET(CMAKE_LEGACY_CYGWIN_WIN32 0) # Remove when CMake >= 2.8.4 is required
+enable_language(ASM)

 PROJECT(gc)

@@ -62,7 +63,7 @@ SET(SRC alloc.c reclaim.c allchblk.c misc.c mach_dep.c os_dep.c
         mark_rts.c headers.c mark.c obj_map.c blacklst.c finalize.c
         new_hblk.c dbg_mlc.c malloc.c stubborn.c dyn_load.c
         typd_mlc.c ptr_chck.c gc_cpp.cc mallocx.c checksums.c
-        thread_local_alloc.c)
+        thread_local_alloc.c src/sparc_mach_dep.S)
 SET(LIBS)
 OPTION(enable_threads "TODO" NO)
 IF(enable_threads)
@Constellation
Copy link
Owner

Cool! I've added the support code to CMakeLists.txt. Coud you try it?
Since this CMakeLists.txt is basically derived from the original source of BoehmGC, once this issue is fixed, we can contribute BoehmGC repository to fix CMake build on SPARC :)

@syoyo
Copy link
Author

syoyo commented Jan 15, 2015

This works on our SPARC, finally!

diff --git a/iv/lv5/third_party/gc/CMakeLists.txt b/iv/lv5/third_party/gc/CMakeLists.txt
index 5e4b22f..9125c86 100644
--- a/iv/lv5/third_party/gc/CMakeLists.txt
+++ b/iv/lv5/third_party/gc/CMakeLists.txt
@@ -66,7 +66,7 @@ SET(SRC alloc.c reclaim.c allchblk.c misc.c mach_dep.c os_dep.c

 #FIXME(Yusuke Suzuki): added
 SET(ASM_NEEDED false)
-IF(CMAKE_SYSTEM_PROCESSOR MATCHES "^sparc")
+IF(CMAKE_SYSTEM_PROCESSOR MATCHES "^sparc|s64fx")
   IF(CMAKE_SYSTEM_NAME MATCHES "kNetBSD.*|NetBSD.*")
     SET(SRC ${SRC} src/sparc_netbsd_mach_dep.s)
   ELSE()

@Constellation
Copy link
Owner

@syoyo:

Great! I'll merge your change :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants