This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] Disallow redefinition of decls etc. in __builtin_* namespace (PR c/32455)


On Wed, Nov 19, 2008 at 07:32:23AM -0800, Ian Lance Taylor wrote:
> Jakub Jelinek <jakub@redhat.com> writes:
> 
> > This is Richard's patch from February extended to complain about
> > {struct,class,union,enum} __builtin_something.
> > When Richard posted this patch, I've objected that glibc used
> > to redefine a few __builtin_* functions to add __asm redirection to them,
> > but since then glibc has been changed not to do that (apparently,
> > the __builtin_fwrite{,_unlocked} redefinition was just a workaround for 3.x
> > ERA gcc bugs and isn't needed for 4.1-4.4), so current 2.9 release
> > doesn't need it.
> 
> What would happen if a gcc with this patch were used to build an older
> version of glibc?

glibc build would fail with:

In file included from ../sysdeps/unix/sysv/linux/x86_64/../init-first.c:20,
                 from ../sysdeps/unix/sysv/linux/x86_64/init-first.c:51:
../include/stdio.h:168: error: â__builtin_fwriteâ is a reserved name
../include/stdio.h:170: error: â__builtin_fwrite_unlockedâ is a reserved name
In file included from ../nptl/sysdeps/pthread/unwind-resume.c:21:
../include/stdio.h:168: error: â__builtin_fwriteâ is a reserved name
../include/stdio.h:170: error: â__builtin_fwrite_unlockedâ is a reserved name
In file included from libc-start.c:20:
../include/stdio.h:168: error: â__builtin_fwriteâ is a reserved name
../include/stdio.h:170: error: â__builtin_fwrite_unlockedâ is a reserved name
make[2]: *** [/usr/src/libc/obj5/csu/init-first.os] Error 1
make[2]: *** Waiting for unfinished jobs....
make[2]: *** [/usr/src/libc/obj5/csu/unwind-resume.os] Error 1
make[2]: *** [/usr/src/libc/obj5/csu/libc-start.os] Error 1
make[2]: Leaving directory `/usr/src/libc/csu'
make[1]: *** [csu/subdir_lib] Error 2
make[1]: Leaving directory `/usr/src/libc'
make: *** [all] Error 2

We could mention this in gcc-4.4/changes.html if needed,
including a reference to the fix which applies
to older glibcs as well:
http://sources.redhat.com/ml/libc-hacker/2008-11/msg00001.html

I don't think this is fatal, with each GCC version there are dozens
or hundreds packages which need minor or major tweaks before they can be
successfully compiled with the new GCC version.
Accepting __builtin_fwrite and __builtin_fwrite_unlocked as an exception
for declarators in GCC and no other __builtin_* names as a workaround
would be IMHO way too ugly.

	Jakub


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]