All of lore.kernel.org
 help / color / mirror / Atom feed
From: "H. J. Lu" <hjl@lucon.org>
To: linux-ia64@vger.kernel.org
Subject: PATCH: Don't use weak function
Date: Fri, 13 May 2005 19:10:51 +0000	[thread overview]
Message-ID: <20050513191051.GA29540@lucon.org> (raw)

On Fri, May 13, 2005 at 11:48:35AM -0700, Lu, Hongjiu wrote:
> Hi David,
> 
> I think it is the result of the usage of weak function. I am enclosing a
> testcase to show it. The correct approach is to use comdat section group
> or linkonce section. The problem will go away. I will see if I can come
> up with a kernel patch.
> 

This patch works for me. The key here is the arch dependent file
has to come before generic one during the final link.


H.J.
---
--- linux/arch/ia64/kernel/irq.c.weak	2005-05-10 13:52:00.000000000 -0700
+++ linux/arch/ia64/kernel/irq.c	2005-05-13 12:04:34.427204360 -0700
@@ -103,7 +103,9 @@ static char irq_redir [NR_IRQS]; // = { 
  * Arch specific routine for deferred write to iosapic rte to reprogram
  * intr destination.
  */
-void proc_set_irq_affinity(unsigned int irq, cpumask_t mask_val)
+void
+__attribute__ ((__section__ (".gnu.linkonce.t.proc_set_irq_affinity")))
+proc_set_irq_affinity(unsigned int irq, cpumask_t mask_val)
 {
 	pending_irq_cpumask[irq] = mask_val;
 }
--- linux/arch/ia64/kernel/smpboot.c.weak	2005-05-10 13:52:00.000000000 -0700
+++ linux/arch/ia64/kernel/smpboot.c	2005-05-13 12:04:16.115259501 -0700
@@ -404,7 +404,9 @@ start_secondary (void *unused)
 	return 0;
 }
 
-struct pt_regs * __devinit idle_regs(struct pt_regs *regs)
+struct pt_regs *
+__devinit __attribute__ ((__section__ (".gnu.linkonce.t.idle_regs")))
+idle_regs(struct pt_regs *regs)
 {
 	return NULL;
 }
--- linux/kernel/fork.c.weak	2005-05-10 13:52:00.000000000 -0700
+++ linux/kernel/fork.c	2005-05-13 12:03:10.156710316 -0700
@@ -1148,7 +1148,9 @@ bad_fork_free:
 	goto fork_out;
 }
 
-struct pt_regs * __devinit __attribute__((weak)) idle_regs(struct pt_regs *regs)
+struct pt_regs *
+__devinit __attribute__ ((__section__ (".gnu.linkonce.t.idle_regs")))
+idle_regs(struct pt_regs *regs)
 {
 	memset(regs, 0, sizeof(struct pt_regs));
 	return regs;
--- linux/kernel/irq/proc.c.weak	2005-05-10 13:52:00.000000000 -0700
+++ linux/kernel/irq/proc.c	2005-05-13 12:02:41.095494642 -0700
@@ -19,7 +19,8 @@ static struct proc_dir_entry *root_irq_d
  */
 static struct proc_dir_entry *smp_affinity_entry[NR_IRQS];
 
-void __attribute__((weak))
+void
+__attribute__ ((__section__ (".gnu.linkonce.t.proc_set_irq_affinity")))
 proc_set_irq_affinity(unsigned int irq, cpumask_t mask_val)
 {
 	irq_affinity[irq] = mask_val;

             reply	other threads:[~2005-05-13 19:10 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-05-13 19:10 H. J. Lu [this message]
2005-05-13 20:24 ` PATCH: Don't use weak function Andreas Schwab

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20050513191051.GA29540@lucon.org \
    --to=hjl@lucon.org \
    --cc=linux-ia64@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.