mirror of
https://github.com/darlinghq/cctools-port.git
synced 2024-11-23 04:09:48 +00:00
Fix building with older clang compilers
This commit is contained in:
parent
a889ea66b7
commit
406ce466ac
9
cctools/configure
vendored
9
cctools/configure
vendored
@ -2693,15 +2693,6 @@ case $host_cpu in
|
||||
EXTRAFLAGS="$EXTRAFLAGS -D__arm64__"
|
||||
;;
|
||||
arm*)
|
||||
case "$CXXVERSION" in
|
||||
*clang* )
|
||||
echo "" >&2
|
||||
echo "clang is known to miscompile ld64 on arm platforms:" >&2
|
||||
echo "https://github.com/tpoechtrager/cctools-port/issues/1#issuecomment-59118615" >&2
|
||||
echo "" >&2
|
||||
sleep 2
|
||||
;;
|
||||
esac
|
||||
EXTRAFLAGS="$EXTRAFLAGS -D__arm__"
|
||||
;;
|
||||
esac
|
||||
|
@ -102,15 +102,6 @@ case $host_cpu in
|
||||
EXTRAFLAGS="$EXTRAFLAGS -D__arm64__"
|
||||
;;
|
||||
arm*)
|
||||
case "$CXXVERSION" in
|
||||
*clang* )
|
||||
echo "" >&2
|
||||
echo "clang is known to miscompile ld64 on arm platforms:" >&2
|
||||
echo "https://github.com/tpoechtrager/cctools-port/issues/1#issuecomment-59118615" >&2
|
||||
echo "" >&2
|
||||
sleep 2
|
||||
;;
|
||||
esac
|
||||
EXTRAFLAGS="$EXTRAFLAGS -D__arm__"
|
||||
;;
|
||||
esac
|
||||
|
@ -90,6 +90,45 @@
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(__clang_major__) && __clang_major__ == 3 && \
|
||||
__clang_minor__ == 4
|
||||
#ifndef __UINT8_TYPE__
|
||||
#define __UINT8_TYPE__ unsigned char
|
||||
#endif
|
||||
|
||||
#ifndef __UINT16_TYPE__
|
||||
#define __UINT16_TYPE__ unsigned __INT16_TYPE__
|
||||
#endif
|
||||
|
||||
#ifndef __UINT32_TYPE__
|
||||
#define __UINT32_TYPE__ unsigned __INT32_TYPE__
|
||||
#endif
|
||||
|
||||
#ifndef __UINT64_TYPE__
|
||||
#define __UINT64_TYPE__ unsigned __INT64_TYPE__
|
||||
#endif
|
||||
|
||||
#ifndef __UINTPTR_TYPE__
|
||||
#define __UINTPTR_TYPE__ unsigned __INTPTR_TYPE__
|
||||
#endif
|
||||
|
||||
/*
|
||||
clang 3.4:
|
||||
|
||||
$ clang -target x86_64-unknown-linux -dM -E - < /dev/null|grep __INT8_TYPE__
|
||||
#define __INT8_TYPE__ char
|
||||
|
||||
clang 3.5:
|
||||
|
||||
$ clang -target x86_64-unknown-linux -dM -E - < /dev/null|grep __INT8_TYPE__
|
||||
#define __INT8_TYPE__ signed char
|
||||
|
||||
*/
|
||||
|
||||
#undef __INT8_TYPE__
|
||||
#define __INT8_TYPE__ signed char
|
||||
#endif /* clang 3.4 */
|
||||
|
||||
#ifndef _INT8_T
|
||||
#define _INT8_T
|
||||
typedef __INT8_TYPE__ int8_t;
|
||||
|
@ -1757,6 +1757,17 @@ typename A::P::uint_t Parser<A>::realAddr(typename A::P::uint_t addr)
|
||||
return addr;
|
||||
}
|
||||
|
||||
#if !__has_builtin(__builtin_mul_overflow) // ld64-port (clang < 3.8)
|
||||
template<typename T>
|
||||
bool __builtin_mul_overflow(uint32_t a, uint32_t b, T *r)
|
||||
{
|
||||
static_assert(sizeof(T) == sizeof(uint32_t), "");
|
||||
uint64_t lr = a * b;
|
||||
*r = (T)lr;
|
||||
return lr > (uint64_t)uint32_t(-1);
|
||||
}
|
||||
#endif
|
||||
|
||||
#define STACK_ALLOC_IF_SMALL(_type, _name, _actual_count, _maxCount) \
|
||||
_type* _name = NULL; \
|
||||
uint32_t _name##_count = 1; \
|
||||
|
Loading…
Reference in New Issue
Block a user