Commit 7f5b6601 authored by Andi Kleen's avatar Andi Kleen Committed by Linus Torvalds

[PATCH] Work around gcc 3.5 offsetof bug

Current gcc 3.5 doesn't compile a x86-64 kernel, because it doesn't
recognize the offsetof used in asm-offset.c to be constant.

Use __builtin_offsetof for this instead.
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 50baf47e
...@@ -28,3 +28,7 @@ ...@@ -28,3 +28,7 @@
#if __GNUC_MINOR__ >= 4 #if __GNUC_MINOR__ >= 4
#define __must_check __attribute__((warn_unused_result)) #define __must_check __attribute__((warn_unused_result))
#endif #endif
#if __GNUC_MINOR__ >= 5
#define __compiler_offsetof(a,b) __builtin_offsetof(a,b)
#endif
#ifndef _LINUX_STDDEF_H #ifndef _LINUX_STDDEF_H
#define _LINUX_STDDEF_H #define _LINUX_STDDEF_H
#include <linux/compiler.h>
#undef NULL #undef NULL
#if defined(__cplusplus) #if defined(__cplusplus)
#define NULL 0 #define NULL 0
...@@ -9,6 +11,10 @@ ...@@ -9,6 +11,10 @@
#endif #endif
#undef offsetof #undef offsetof
#ifdef __compiler_offsetof
#define offsetof(TYPE,MEMBER) __compiler_offsetof(TYPE,MEMBER)
#else
#define offsetof(TYPE, MEMBER) ((size_t) &((TYPE *)0)->MEMBER) #define offsetof(TYPE, MEMBER) ((size_t) &((TYPE *)0)->MEMBER)
#endif
#endif #endif
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment