lkml.org 
[lkml]   [2008]   [May]   [2]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRe: huge gcc 4.1.{0,1} __weak problem
Date
On Friday 02 May 2008 15:11:32 Jakub Jelinek wrote:
> On Fri, May 02, 2008 at 03:57:08PM +0200, Sam Ravnborg wrote:
> > 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;
> > }
>
> Of course it doesn't fail to build.
[snip]
>  I doubt a runtime testcase is acceptable though for the
> kernel, as the cross compiler used to build the kernel might not be able to
> create userland executables (missing C library, etc.).

I assume the GCC testsuite has the same generic problem, which is probably why
it uses the -fdump-tree-optimized parameter to gcc. For example:

alistair@just:~$ cat test.c
void __attribute__((weak)) func(void)
{
/* no code */
}

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

alistair@just:~$ gcc -O2 -fdump-tree-optimized test.c
alistair@just:~$ rm -f a.out
alistair@just:~$ cat test.c*.optimized | egrep "func \\(\\);"
func ();

Ergo, my compiler isn't buggy. As this doesn't require a runtime test I think
it would be OK for the kernel.

Of course, whether or not it's worth it is now debatable, given the
information Sven-Haegar Koch provided (Debian's GCC version number is
actually 4.1.2).

--
Cheers,
Alistair.

137/1 Warrender Park Road, Edinburgh, UK.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2008-05-02 17:31    [W:0.040 / U:2.680 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site