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
/*
- * 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.
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,
/*
- * 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.
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
}
/*
- * 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