Request for review: support building hotspot with gcc 4.6

Omair Majid omajid at
Fri Apr 29 23:34:57 UTC 2011

On 04/29/2011 07:13 PM, David Katleman wrote:
> Hi Omair!
> On 4/29/2011 3:59 PM, Omair Majid wrote:
>> Hi,
>> The patch adds support for building hotspot with gcc 4.6. gcc 4.6
>> changed how arguments are handled. It now treats -export-dynamic as it
>> treats any other -efoo option: it thinks xport-dynamic is the entry
>> point and passes this information to the linker. Since -export-dynamic
>> is not passed to the linker, not all symbols will be exported by the
>> linker. The bfd-based linker, given the invalid entry point
>> xport-dynamic, simply ignores it. The gold linker, however, crashes
>> causing the build to fail.
>> Since -export-dynamic is a linker option, the correct way to pass it
>> is using -Wl,-export-dynamic (or -Xlinker -export-dynamic). We have
>> had this patch in IcedTea6 for a while now, but it would be nice if
>> this was in OpenJDK too.
> Seems like your change should be surrounded by an ifneq that enables
> your change for 4.6 and later

While I could certainly do that, I dont understand why it's needed. The 
patch keeps things backwards compatible. With the patch applied, I can 
still build hotspot with older versions of gcc/binutils.

-export-dynamic is a linker option and has been for a (long) while now. 
I am actually not sure what the earliest version of ld that supports 
export-dynamic is, but -Wl,-export-dynamic is mentioned on which 
was last updated 2003. Surely all versions of gcc/ld that we now use 
must support this?

If you still think this needs to be conditional (although I strongly 
disagree that it needs to be), I can post another webrev.

> Example elsewhere in the file
>> 129 # Except for a few acceptable ones
>> 130 # Since GCC 4.3, -Wconversion has changed its meanings to warn
>> these implicit
>> 131 # conversions which might affect the values. To avoid that, we
>> need to turn
>> 132 # it off explicitly.
>> 133 ifneq "$(shell expr \( $(CC_VER_MAJOR) \> 4 \) \| \( \(
>> $(CC_VER_MAJOR) = 4 \) \& \( $(CC_VER_MINOR) \>= 3 \) \))" "0"
>> 134 ACCEPTABLE_WARNINGS = -Wpointer-arith -Wsign-compare
>> 135 else
>> 136 ACCEPTABLE_WARNINGS = -Wpointer-arith -Wconversion -Wsign-compare
>> 137 endif

Thanks for the example. I will keep this in mind whenever a gcc change 
needs to be conditional.


More information about the build-dev mailing list