Some fixes for folly-oss repo.
authorSara Golemon <sgolemon@fb.com>
Mon, 6 Jan 2014 19:35:44 +0000 (11:35 -0800)
committerSara Golemon <sgolemon@fb.com>
Mon, 6 Jan 2014 19:39:35 +0000 (11:39 -0800)
Summary:
The __builtin_ia32_crc[qd]i() functions are GCC >= 4.8 specific
folly-config.h includes must be wrapped in a FOLLY_NO_CONFIG guard
FOLLY_HAVE_WEAK_SYMBOLS needs to apply to the cpp file as well as the header

Closes #44
Closes #42

Test Plan: HHVM builds with recent folly

Reviewed By: seanc@fb.com

FB internal diff: D1117181

folly/Checksum.cpp
folly/detail/Malloc.cpp
folly/detail/Malloc.h

index 788e0a19ade4249c889e0b737435e6816249d830..56e211d68cd11ac48ed4265ba4e1b77d8973f66e 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright 2013 Facebook, Inc.
+ * Copyright 2014 Facebook, Inc.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -24,7 +24,8 @@ namespace folly {
 
 namespace detail {
 
-#if defined(__x86_64__) && defined (__GNUC__)
+#if defined(__x86_64__) && defined(__GNUC__) && defined(__GNUC_MINOR__) && \
+    (((__GNUC__ * 100) + __GNUC_MINOR__) >= 408)
 
 // Fast SIMD implementation of CRC-32C for x86 with SSE 4.2
 uint32_t crc32c_hw(const uint8_t *data, size_t nbytes,
index df076d58290dd63bbcd1c5ab6f716856869c2947..64d30b544dd61d300365d7ef492b30a528e4992a 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright 2013 Facebook, Inc.
+ * Copyright 2014 Facebook, Inc.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -18,7 +18,9 @@
 
 extern "C" {
 
+#ifndef FOLLY_HAVE_WEAK_SYMBOLS
 int (*rallocm)(void**, size_t*, size_t, size_t, int) = nullptr;
 int (*allocm)(void**, size_t*, size_t, int) = nullptr;
+#endif
 
 }
index 484745c03b67f6de7d3a15a4c86640e0e0d4f801..c36591845767dd6cc62c70c89be4a0a2e42346af 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright 2013 Facebook, Inc.
+ * Copyright 2014 Facebook, Inc.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
 #define FOLLY_DETAIL_MALLOC_H
 
 #include <stdlib.h>
+
+#ifndef FOLLY_NO_CONFIG
 #include "folly/folly-config.h"
+#endif
 
 extern "C" {
 
-#if FOLLY_HAVE_WEAK_SYMBOLS
+#ifdef FOLLY_HAVE_WEAK_SYMBOLS
 int rallocm(void**, size_t*, size_t, size_t, int) __attribute__((weak));
 int allocm(void**, size_t*, size_t, int) __attribute__((weak));
 #else