lkml.org 
[lkml]   [2011]   [Apr]   [27]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH 2/2] fork: avoid weak function arch_dup_task_struct
Date
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 <hans.rosenfeld@amd.com>
---
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



\
 
 \ /
  Last update: 2011-04-27 16:29    [from the cache]
©2003-2011 Jasper Spaans