United StatesChange Country, Oracle Worldwide Web Sites Communities I am a... I want to...
JDK-7103224 : collision between __LEAF define in interfaceSupport.hpp and /usr/include/sys/cdefs.h with gcc

Details
Type:
Bug
Submit Date:
2011-10-20
Status:
Closed
Updated Date:
2014-06-26
Project Name:
JDK
Resolved Date:
2012-01-23
Component:
hotspot
OS:
solaris_10
Sub-Component:
runtime
CPU:
x86
Priority:
P4
Resolution:
Fixed
Affected Versions:
hs23
Fixed Versions:
hs23 (b06)

Related Reports
Backport:
Backport:
Backport:

Sub Tasks

Description
From: Omair Majid <###@###.###>
Subject: identifier name clash between hotspot and glibc
Date: October 20, 2011 8:36:57 AM PDT
To: ###@###.###

Hi,

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 [1])

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 [2].

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 [3], but only __LEAF is causing a problem right now.

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?

Thanks,
Omair

[1] http://koji.fedoraproject.org/koji/getfile?taskID=3442873&name=build.log
[2] http://sourceware.org/git/?p=glibc.git;a=commitdiff;h=aa78043a4aafe5db1a1a76d544a833b63b4c5f5c
[3] http://icedtea.classpath.org/~omajid/name-clash-log.01

                                    

Comments
EVALUATION

http://hg.openjdk.java.net/lambda/lambda/hotspot/rev/a6eef545f1a2
                                     
2012-03-22
EVALUATION

See main CR
                                     
2011-11-30
EVALUATION

http://hg.openjdk.java.net/hsx/hotspot-emb/hotspot/rev/a6eef545f1a2
                                     
2011-11-29
EVALUATION

http://hg.openjdk.java.net/hsx/hotspot-rt/hotspot/rev/a6eef545f1a2
                                     
2011-11-15
EVALUATION

7103224: collision between __LEAF define in interfaceSupport.hpp and /usr/include/sys/cdefs.h with gcc
Reviewed-by: never
Contributed-by: Omair Majid <###@###.###>

glibc has recently added a macro __LEAF to /usr/include/sys/cdefs.h,
which conflicts with the definition of the macro in hotspot.  The name
was updated to be more friendly along with other related ones.  I also
removed a dead definition of MAXFLOAT that was colliding on some Apple
builds.
                                     
2011-10-25
EVALUATION

http://hg.openjdk.java.net/hsx/hotspot-comp/hotspot/rev/a6eef545f1a2
                                     
2011-10-25



Hardware and Software, Engineered to Work Together