All of lore.kernel.org
 help / color / mirror / Atom feed
From: Tom Rini <trini@kernel.crashing.org>
To: "Pallipadi, Venkatesh" <venkatesh.pallipadi@intel.com>
Cc: David Miller <davem@davemloft.net>,
	mingo@elte.hu, tglx@linutronix.de, hpa@zytor.com,
	akpm@linux-foundation.org, linux-kernel@vger.kernel.org, "Siddha,
	Suresh B" <suresh.b.siddha@intel.com>
Subject: Re: [PATCH] /dev/mem gcc weak function workaround
Date: Wed, 30 Apr 2008 13:15:08 -0700	[thread overview]
Message-ID: <20080430201508.GA17795@smtp.west.cox.net> (raw)
In-Reply-To: <924EFEDD5F540B4284297C4DC59F3DEEF7D18E@orsmsx423.amr.corp.intel.com>

On Wed, Apr 30, 2008 at 05:49:46AM -0700, Pallipadi, Venkatesh wrote:
>  
> 
> >-----Original Message-----
> >From: David Miller [mailto:davem@davemloft.net] 
> >Sent: Tuesday, April 29, 2008 9:29 PM
> >To: Pallipadi, Venkatesh
> >Cc: mingo@elte.hu; tglx@linutronix.de; hpa@zytor.com; 
> >akpm@linux-foundation.org; linux-kernel@vger.kernel.org
> >Subject: Re: [PATCH] /dev/mem gcc weak function workaround
> >
> >From: Venki Pallipadi <venkatesh.pallipadi@intel.com>
> >Date: Tue, 29 Apr 2008 18:31:09 -0700
> >
> >> Some flavors of gcc 4.1.0 and 4.1.1 seems to have trouble 
> >understanding
> >> weak function definitions. Calls to function from the same 
> >file where it is
> >> defined as weak _may_ get inlined, even when there is a 
> >non-weak definition of
> >> the function elsewhere. I tried using attribute 'noinline' 
> >which does not
> >> seem to help either.
> >> 
> >> One workaround for this is to have weak functions defined in 
> >different
> >> file as below. Other possible way is to not use weak 
> >functions and go back
> >> to ifdef logic.
> >> 
> >> There are few other usages in kernel that seem to depend on 
> >weak (and noinline)
> >> working correctly, which can also potentially break and 
> >needs such workarounds.
> >> Example -
> >> mach_reboot_fixups() in arch/x86/kernel/reboot.c is one such 
> >call which
> >> is getting inlined with a flavor of gcc 4.1.1.
> >> 
> >> Signed-off-by: Venkatesh Pallipadi <venkatesh.pallipadi@intel.com>
> >> Signed-off-by: Suresh Siddha <suresh.b.siddha@intel.com>
> >
> >This sounds like a bug.  And if gcc does multi-file compilation it
> >can in theory do the same mistake even if you move it to another
> >file.
> >
> >We need something more bulletproof here.
> >
> 
> The references here
> http://gcc.gnu.org/ml/gcc-bugs/2006-05/msg02801.html
> http://gcc.gnu.org/bugzilla/show_bug.cgi?id=27781
> 
> seem to suggest that the bug is only with weak definition in the same
> file.
> So, having them in a different file should be good enough workaround
> here.
> 
> Tom: Comments?

Yes, that matches my recollection.  some versions of gcc 4.1.0 (and
possibly 4.1.1, it wouldn't be hard to check) could not handle having a
regular and weak function in the same file (I hit this trying to do
some abstraction or another in kgdb, using includes) but it was correct
if in separate files.  I assume blacklisting 4.1.0 is out of the
question :)

-- 
Tom Rini

  reply	other threads:[~2008-04-30 20:28 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-04-30  1:31 [PATCH] /dev/mem gcc weak function workaround Venki Pallipadi
2008-04-30  4:28 ` David Miller
2008-04-30 12:49   ` Pallipadi, Venkatesh
2008-04-30 20:15     ` Tom Rini [this message]
2008-05-01 21:56     ` huge gcc 4.1.{0,1} __weak problem Adrian Bunk
2008-05-01 22:20       ` Andrew Morton
2008-05-01 22:27         ` Linus Torvalds
2008-05-01 22:33           ` Andrew Morton
2008-05-01 23:24             ` Tom Rini
2008-05-01 23:59               ` Andrew Morton
2008-05-02  0:21                 ` Justin Mattock
2008-05-02  7:18                 ` Vegard Nossum
2008-05-02 13:43                   ` Theodore Tso
2008-05-02  8:10                 ` Adrian Bunk
2008-05-02  9:09                 ` Andi Kleen
2008-05-01 22:35           ` Venki Pallipadi
2008-05-01 22:42             ` Andrew Morton
2008-05-01 22:49               ` Jakub Jelinek
2008-05-01 23:21               ` Tom Rini
2008-05-01 23:30                 ` Venki Pallipadi
2008-05-02  0:34                   ` Linus Torvalds
2008-05-02  0:39                     ` Suresh Siddha
2008-05-02 21:11                       ` Jeremy Fitzhardinge
2008-05-02 22:02                         ` David Miller
2008-05-01 23:23             ` Tom Rini
2008-05-01 22:51           ` David Miller
2008-06-26 10:37           ` [2.6.26 patch] #error for gcc 4.1.{0,1} Adrian Bunk
2008-05-02 21:09       ` huge gcc 4.1.{0,1} __weak problem Jeremy Fitzhardinge
2008-05-02 21:19         ` Adrian Bunk

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=20080430201508.GA17795@smtp.west.cox.net \
    --to=trini@kernel.crashing.org \
    --cc=akpm@linux-foundation.org \
    --cc=davem@davemloft.net \
    --cc=hpa@zytor.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=suresh.b.siddha@intel.com \
    --cc=tglx@linutronix.de \
    --cc=venkatesh.pallipadi@intel.com \
    /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.