From 5fec211f6064adaff361c051a627198157b2c37b Mon Sep 17 00:00:00 2001 From: Shih-wei Liao Date: Fri, 3 Aug 2012 17:44:08 -0700 Subject: [PATCH 1/3] Revert "Fix the clang build: this compiler doesn't support the gnu_inline function attribute" This reverts commit 4f1f149c3757c594f9ff987e5ddd919c3e7dba10. --- libc/include/sys/cdefs.h | 7 ------- 1 file changed, 7 deletions(-) diff --git a/libc/include/sys/cdefs.h b/libc/include/sys/cdefs.h index f088e3310..987a5e3db 100644 --- a/libc/include/sys/cdefs.h +++ b/libc/include/sys/cdefs.h @@ -502,18 +502,11 @@ #include #if defined(_FORTIFY_SOURCE) && _FORTIFY_SOURCE > 0 && defined(__OPTIMIZE__) && __OPTIMIZE__ > 0 -#if defined(__clang__) -#define __BIONIC_FORTIFY_INLINE \ - extern inline \ - __attribute__ ((always_inline)) \ - __attribute__ ((artificial)) -#else #define __BIONIC_FORTIFY_INLINE \ extern inline \ __attribute__ ((always_inline)) \ __attribute__ ((gnu_inline)) \ __attribute__ ((artificial)) -#endif #define __BIONIC_FORTIFY_UNKNOWN_SIZE ((size_t) -1) #endif From a72246d67e309de62c26aca970fff65dfb86eb7c Mon Sep 17 00:00:00 2001 From: Shih-wei Liao Date: Mon, 6 Aug 2012 09:50:56 -0700 Subject: [PATCH 2/3] When compiling with clang, don't "fortify_source" the strlen. At this point, FORTIFY_SOURCE and clang are just plain incompatible. Need to solve the underlying incompatibility first. Change-Id: I3366477d19461e1ec93b1c30e0c7e8145b391b9b --- libc/include/string.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/libc/include/string.h b/libc/include/string.h index 8e472e7c0..5259c15ec 100644 --- a/libc/include/string.h +++ b/libc/include/string.h @@ -208,6 +208,7 @@ size_t strlcat(char *dest, const char *src, size_t size) { return __strlcat_chk(dest, src, size, bos); } +#if !defined(__clang__) __purefunc extern size_t __strlen_real(const char *) __asm__(__USER_LABEL_PREFIX__ "strlen"); extern size_t __strlen_chk(const char *, size_t); @@ -223,6 +224,7 @@ size_t strlen(const char *s) { return __strlen_chk(s, bos); } +#endif /* !defined(__clang__) */ #endif /* defined(__BIONIC_FORTIFY_INLINE) */ From f4497e15b78383b06d59ce244255fc7625beaec5 Mon Sep 17 00:00:00 2001 From: Shih-wei Liao Date: Mon, 6 Aug 2012 10:57:37 -0700 Subject: [PATCH 3/3] When compiling with clang, don't "fortify_source" the strlcpy and strlcat. Change-Id: I91f58322f28e425ab9d22b51c23fcd6b772ede97 --- libc/include/string.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libc/include/string.h b/libc/include/string.h index 5259c15ec..d1dc4c41b 100644 --- a/libc/include/string.h +++ b/libc/include/string.h @@ -147,6 +147,7 @@ void *memset (void *s, int c, size_t n) { return __builtin___memset_chk(s, c, n, __builtin_object_size (s, 0)); } +#if !defined(__clang__) extern size_t __strlcpy_real(char *, const char *, size_t) __asm__(__USER_LABEL_PREFIX__ "strlcpy"); extern void __strlcpy_error() @@ -208,7 +209,6 @@ size_t strlcat(char *dest, const char *src, size_t size) { return __strlcat_chk(dest, src, size, bos); } -#if !defined(__clang__) __purefunc extern size_t __strlen_real(const char *) __asm__(__USER_LABEL_PREFIX__ "strlen"); extern size_t __strlen_chk(const char *, size_t);