identifier name clash between hotspot and glibc
tom.rodriguez at oracle.com
Thu Oct 20 11:18:15 PDT 2011
On Oct 20, 2011, at 8:36 AM, Omair Majid wrote:
> I recently ran into a build failure when building hotspot with a recent glibc:
> In file included from /builddir/build/BUILD/icedtea6-1.10.4/openjdk/hotspot/src/share/vm/prims/methodHandles.hpp:32:0,
> from /builddir/build/BUILD/icedtea6-1.10.4/openjdk/hotspot/src/share/vm/ci/ciMethod.hpp:33,
> from /builddir/build/BUILD/icedtea6-1.10.4/openjdk/hotspot/src/share/vm/code/debugInfoRec.hpp:30,
> from /builddir/build/BUILD/icedtea6-1.10.4/openjdk/hotspot/src/share/vm/ci/ciEnv.hpp:31,
> from /builddir/build/BUILD/icedtea6-1.10.4/openjdk/hotspot/src/share/vm/ci/ciUtilities.hpp:28,
> from /builddir/build/BUILD/icedtea6-1.10.4/openjdk/hotspot/src/share/vm/ci/ciNullObject.hpp:30,
> from /builddir/build/BUILD/icedtea6-1.10.4/openjdk/hotspot/src/share/vm/ci/ciConstant.hpp:29,
> from /builddir/build/BUILD/icedtea6-1.10.4/openjdk/hotspot/src/share/vm/precompiled.hpp:36:
> /builddir/build/BUILD/icedtea6-1.10.4/openjdk/hotspot/src/share/vm/runtime/interfaceSupport.hpp:426:0: error: "__LEAF" redefined [-Werror]
> /usr/include/sys/cdefs.h:43:0: note: this is the location of the previous definition
> cc1plus: all warnings being treated as errors
> (Complete build logs are available at )
> As you can guess, glibc has added a macro __LEAF to /usr/include/sys/cdefs.h, which conflicts with the definition of the macro in hotspot .
> ISO/IEC 9899:TC3 Section 7.1.3 ("Reserved Identifiers") says:
> All identifiers that begin with an underscore and either an uppercase
> letter or another underscore are always reserved for any use
> From this, it sounds like hotspot should not be using these identifiers. A search for '#define __' shows about 81 matches , but only __LEAF is causing a problem right now.
most of those are defines of __ by itself which while dubious is a widespread idiom and doesn't appear likely to clash, or at least I don't want to change it until we have to. The remaining ones seem pretty benign so I think we can leave them alone until we have problems.
> Does anyone have any thoughts on how I should go about fixing it? Does renaming __LEAF to something like VM_LEAF or even LEAF__ make sense?
VM_LEAF_BASE makes sense to me. Can you fix __ENTRY and __QUICK_ENTRY similarly? I filed 7103224 for this.
>  http://koji.fedoraproject.org/koji/getfile?taskID=3442873&name=build.log
>  http://sourceware.org/git/?p=glibc.git;a=commitdiff;h=aa78043a4aafe5db1a1a76d544a833b63b4c5f5c
>  http://icedtea.classpath.org/~omajid/name-clash-log.01
More information about the hotspot-dev