gollvm: update cmake rules to sync with recent gofrontend changes

Updates to cmake rules to conform with recent gofrontend changes;
removes a couple of source files now no longer needed after switchover
from __sync_* to __atomic_* routines.

Change-Id: I196d33c8dd68db3d2488f52840b00f8d17111497
Reviewed-on: https://go-review.googlesource.com/c/160838
Reviewed-by: Cherry Zhang <cherryyz@google.com>
diff --git a/cmake/modules/ConfigSetup.cmake b/cmake/modules/ConfigSetup.cmake
index fae5dd8..b6171ca 100644
--- a/cmake/modules/ConfigSetup.cmake
+++ b/cmake/modules/ConfigSetup.cmake
@@ -7,6 +7,7 @@
 int main () {
   __atomic_load_n (&i, __ATOMIC_ACQUIRE);
   __atomic_store_n (&i, 1, __ATOMIC_RELEASE);
+  __atomic_add_fetch (&i, 1, __ATOMIC_SEQ_CST);
  return 0;
 }\n")
 
@@ -126,12 +127,8 @@
 check_function_exists(alloca HAVE_ALLOCA)
 check_function_exists(memcpy HAVE_MEMCPY)
 
-check_c_source_compiles("int main(int argc, char **argv) { return __sync_bool_compare_and_swap(&argc, argc, -argc) ? 1 : 0; }\n" HAVE_SYNC_BOOL_COMPARE_AND_SWAP_4)
 check_c_source_compiles("#include <stdint.h>\nstatic uint64_t s;\nint main(int argc, char **argv) { return __sync_bool_compare_and_swap(&s, argc, -argc) ? 0 : 1; }\n" HAVE_SYNC_BOOL_COMPARE_AND_SWAP_8)
 
-check_c_source_compiles("int main(int argc, char **argv) { return __sync_fetch_and_add(&argc, 1); }\n" HAVE_SYNC_FETCH_AND_ADD_4)
-check_c_source_compiles("#include <stdint.h>\nstatic uint64_t s;\nint main(int argc, char **argv) { return __sync_add_and_fetch(&s, 1) == s ? 0 : 1; }\n" HAVE_SYNC_ADD_AND_FETCH_8)
-
 check_c_source_compiles("int main() { __asm__(\"aesenc %xmm0, %xmm1\"); return 0; }\n" HAVE_AS_X86_AES)
 
 # Issue an error if the C compiler doesn't support -fsplit-stack
diff --git a/libgo/CMakeLists.txt b/libgo/CMakeLists.txt
index a66021b..009d1d6 100644
--- a/libgo/CMakeLists.txt
+++ b/libgo/CMakeLists.txt
@@ -421,7 +421,6 @@
   "runtime/proc.c"
   "runtime/runtime_c.c"
   "runtime/stack.c"
-  "runtime/thread.c"
   "runtime/yield.c")
 
 # C files that happen to be living in other packages.
@@ -432,7 +431,6 @@
   "go/runtime/internal/atomic/atomic.c"
   "go/internal/cpu/cpu_gccgo.c"
   "go/sync/atomic/atomic.c"
-  "go/sync/cas.c"
   "go/syscall/errno.c"
   "go/syscall/signame.c"
   "go/syscall/wait.c")
diff --git a/libgo/config.h.cmake b/libgo/config.h.cmake
index 4c90352..1f2ce2f 100644
--- a/libgo/config.h.cmake
+++ b/libgo/config.h.cmake
@@ -144,18 +144,6 @@
 /* Define to 1 if you have the `wait4' function. */
 #cmakedefine HAVE_WAIT4 1
 
-/* Define to 1 if you have '__sync_bool_compare_and_swap_4'. */
-#cmakedefine HAVE_SYNC_BOOL_COMPARE_AND_SWAP_4 1
-
-/* Define to 1 if you have '__sync_bool_compare_and_swap_8'. */
-#cmakedefine HAVE_SYNC_BOOL_COMPARE_AND_SWAP_8 1
-
-/* Define to 1 if you have '__sync_fetch_and_add_4'. */
-#cmakedefine HAVE_SYNC_FETCH_AND_ADD_4 1
-
-/* Define to 1 if you have '__sync_add_and_fetch_8'. */
-#cmakedefine HAVE_SYNC_ADD_AND_FETCH_8 1
-
 /* Define to 1 if assembler supports AES instructions. */
 #cmakedefine HAVE_AS_X86_AES 1