Re: huge gcc 4.1.{0,1} __weak problem

Sam Ravnborg
2008-05-02T13:56:51Z

On Fri, May 02, 2008 at 12:48:55PM +0100, Alistair John Strachan wrote:
> On Friday 02 May 2008 11:43:48 Sam Ravnborg wrote:
> [snip]
> > > > > It's __GNUC_PATCHLEVEL__, I believe.
> > > > >
> > > > > So yes, we can distinguish 4.1.2 (good, and very common) from
> > > > > 4.1.{0,1} (bad, and rather uncommon).
> > > > > And yes, considering that 4.1.1 (and even more so 4.1.0) should be
> > > > > rare to begin with, I think it's better to just not support it.
> > > > >
> > > > > Linus
> > > >
> > > > Unfortunately Debian Stable (i.e. Etch), which is relatively popular
> > > > for server use, is still using 4.1.1 :-( (The current gcc package is
> > > > gcc-4.1.1-21)
> > > >
> > > > I have not looked to see if Debian Stable's gcc-4.1.1-21 has been
> > > > patched for the currently discussed __weak bug.
> > >
> > > I checked and it has been patched in 4.1.1-21. This would make checking
> > > for 4.1.1 via __GNUC_PATCHLEVEL__ potentially invalid, as patched distro
> > > compilers may (and in this case do) have this fixed.
> >
> > Is it possible to cook up a small sample file we could build as part
> > of the kernel build. If it fails => error out.
> > If someone comes up with the code I shall try to integrate it
> > in the build system.
>
> The GCC PR has a test case for this regression which might be usable.
>
> http://gcc.gnu.org/viewcvs/branches/gcc-4_1-branch/gcc/testsuite/gcc.dg/tree-ssa/pr27781.c?view=markup&pathrev=114852

OK, can anyone confirm that this fails to build which a
buggy gcc:

void __attribute__((weak)) func(void)
{
/* no code */
}

int main()
{
func();
return 0;
}

Sam