Avoid potential gcc bug by not using a weak function for
arch_dup_task_struct. Use an #ifdef'ed static function for
archs that don't have a special arch_dup_task_struct implementation.
Signed-off-by: Hans Rosenfeld <[email protected]>
---
arch/sh/include/asm/thread_info.h | 1 +
arch/x86/include/asm/thread_info.h | 1 +
kernel/fork.c | 5 +++--
3 files changed, 5 insertions(+), 2 deletions(-)
diff --git a/arch/sh/include/asm/thread_info.h b/arch/sh/include/asm/thread_info.h
index ea2d508..2d27e1c 100644
--- a/arch/sh/include/asm/thread_info.h
+++ b/arch/sh/include/asm/thread_info.h
@@ -100,6 +100,7 @@ extern void free_thread_info(struct thread_info *ti);
extern void arch_task_cache_init(void);
#define arch_task_cache_init arch_task_cache_init
extern int arch_dup_task_struct(struct task_struct *dst, struct task_struct *src);
+#define arch_dup_task_struct arch_dup_task_struct
extern void init_thread_xstate(void);
#define __HAVE_ARCH_THREAD_INFO_ALLOCATOR
diff --git a/arch/x86/include/asm/thread_info.h b/arch/x86/include/asm/thread_info.h
index 07c8cfe..ce97947 100644
--- a/arch/x86/include/asm/thread_info.h
+++ b/arch/x86/include/asm/thread_info.h
@@ -266,6 +266,7 @@ extern void arch_task_cache_init(void);
extern void free_thread_info(struct thread_info *ti);
extern int arch_dup_task_struct(struct task_struct *dst, struct task_struct *src);
extern int arch_prealloc_fpu(struct task_struct *tsk);
+#define arch_dup_task_struct arch_dup_task_struct
#define arch_prealloc_fpu arch_prealloc_fpu
#define arch_task_cache_init arch_task_cache_init
#endif
diff --git a/kernel/fork.c b/kernel/fork.c
index e7548de..6d929d0 100644
--- a/kernel/fork.c
+++ b/kernel/fork.c
@@ -243,12 +243,13 @@ void __init fork_init(unsigned long mempages)
init_task.signal->rlim[RLIMIT_NPROC];
}
-int __attribute__((weak)) arch_dup_task_struct(struct task_struct *dst,
- struct task_struct *src)
+#ifndef arch_dup_task_struct
+static int arch_dup_task_struct(struct task_struct *dst, struct task_struct *src)
{
*dst = *src;
return 0;
}
+#endif
static struct task_struct *dup_task_struct(struct task_struct *orig)
{
--
1.5.6.5
On Wed, 27 Apr 2011 16:26:35 +0200 Hans Rosenfeld <[email protected]> wrote:
> Avoid potential gcc bug by not using a weak function for
> arch_dup_task_struct. Use an #ifdef'ed static function for
> archs that don't have a special arch_dup_task_struct implementation.
The patch is unreviewable (and hence unusable) if you don't describe
this "potential gcc bug".
On 05/01/2011 12:25 PM, Andrew Morton wrote:
> On Wed, 27 Apr 2011 16:26:35 +0200 Hans Rosenfeld <[email protected]> wrote:
>
>> Avoid potential gcc bug by not using a weak function for
>> arch_dup_task_struct. Use an #ifdef'ed static function for
>> archs that don't have a special arch_dup_task_struct implementation.
>
> The patch is unreviewable (and hence unusable) if you don't describe
> this "potential gcc bug".
>
http://lkml.indiana.edu/hypermail/linux/kernel/0804.3/3202.html
-hpa
--
H. Peter Anvin, Intel Open Source Technology Center
I work for Intel. I don't speak on their behalf.
On Sun, 01 May 2011 15:59:12 -0700 "H. Peter Anvin" <[email protected]> wrote:
> On 05/01/2011 12:25 PM, Andrew Morton wrote:
> > On Wed, 27 Apr 2011 16:26:35 +0200 Hans Rosenfeld <[email protected]> wrote:
> >
> >> Avoid potential gcc bug by not using a weak function for
> >> arch_dup_task_struct. Use an #ifdef'ed static function for
> >> archs that don't have a special arch_dup_task_struct implementation.
> >
> > The patch is unreviewable (and hence unusable) if you don't describe
> > this "potential gcc bug".
> >
>
> http://lkml.indiana.edu/hypermail/linux/kernel/0804.3/3202.html
>
gcc-4.1.0 and 4.1.1 were explicitly banned via a test in
include/linux/compiler-gcc4.h for this reason.
On 05/01/2011 05:11 PM, Andrew Morton wrote:
> On Sun, 01 May 2011 15:59:12 -0700 "H. Peter Anvin"<[email protected]> wrote:
>
>> On 05/01/2011 12:25 PM, Andrew Morton wrote:
>>> On Wed, 27 Apr 2011 16:26:35 +0200 Hans Rosenfeld<[email protected]> wrote:
>>>
>>>> Avoid potential gcc bug by not using a weak function for
>>>> arch_dup_task_struct. Use an #ifdef'ed static function for
>>>> archs that don't have a special arch_dup_task_struct implementation.
>>>
>>> The patch is unreviewable (and hence unusable) if you don't describe
>>> this "potential gcc bug".
>>
>> http://lkml.indiana.edu/hypermail/linux/kernel/0804.3/3202.html
>>
>
> gcc-4.1.0 and 4.1.1 were explicitly banned via a test in
> include/linux/compiler-gcc4.h for this reason.
>
OK, no issue then. Sorry for the noise.
-hpa