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.-- Chris
Chris Knadle
Chris.Knadle@coredump.us
--
Hi Chris,
(I fixed the corrupted CC and Reply-to: address from your email.)
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.--
Cheers,
Alistair.137/1 Warrender Park Road, Edinburgh, UK.
--
Not a problem for the Debian Stable Version, as someone already wrote, it
gcc (GCC) 4.1.2 20061115 (prerelease) (Debian 4.1.1-21)
Copyright (C) 2006 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.c'ya
sven--
The Internet treats censorship as a routing problem, and routes around
it. (John Gilmore on http://www.cygnus.com/~gnu/)
--
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.Sam
--
On Friday 02 May 2008 11:43:48 Sam Ravnborg wrote:
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/...
--
Cheers,
Alistair.137/1 Warrender Park Road, Edinburgh, UK.
--
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
--
I think the problem is that main() would have no call to func(), not
that it wouldn't build.Does making func noinline fix it? I wonder if we should make __weak
implicitly make the function noinline too.J
--
Of course it doesn't fail to build. With buggy gcc it will be optimized
to
void __attribute__((weak)) func (void)
{
}int main ()
{
return 0;
}(similarly how all recent gccs optimize this without the weak attribute)
while non-buggy gcc keeps the func call.
So, you either need to grep the assembly (that's what e.g. the GCC testcase
does), or you can e.g. use a runtime testcase:
extern void abort (void);
void __attribute__((weak)) func (void) { }
int main () { func (); abort (); }
in one compilation unit and
extern void exit (int);
void func (void) { exit (0); }
in another one. 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.).Jakub
--
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.
--
Well the package version string is 4.1.1, but the compiler thinks it's
4.1.2, at least on i386, amd64 and ia64:$ cc -v
gcc version 4.1.2 20061115 (prerelease) (Debian 4.1.1-21)A small test program agrees:
printf("%d\n", __GNUC_PATCHLEVEL__);
$ ./a.out
2Mike.
--
| Andrew Morton | -mm merge plans for 2.6.23 |
| Greg Kroah-Hartman | [PATCH 004/196] Chinese: add translation of SubmittingPatches |
| Tarkan Erimer | Re: Dual-Licensing Linux Kernel with GPL V2 and GPL V3 |
| Gabriel C | Re: [Announce] [patch] Modular Scheduler Core and Completely Fair Scheduler [CFS] |
git: | |
| Gerrit Renker | [PATCH 03/37] dccp: List management for new feature negotiation |
| David Miller | [GIT]: Networking |
| Thomas Jarosch | Re: TCP connection stalls under 2.6.24.7 |
| Jarek Poplawski | [PATCH] pkt_sched: Destroy gen estimators under rtnl_lock(). |
