RFR: JDK-8217723 Switch ld from bfd to gold on gcc toolchain

Aleksey Shipilev shade at redhat.com
Thu Jan 24 13:25:00 UTC 2019


On 1/24/19 2:15 PM, Magnus Ihse Bursie wrote:
> I see now on Wikipedia that gold was added to binutils 2.19.[1] (I thought it was older still...)
> We currently have this check:
> TOOLCHAIN_MINIMUM_LD_VERSION_gcc="2.18"
> 
> As part of this fix, I ought to bump it to 2.19, so we know for sure that gold is included.

Not sure it would be compatible with all current build environments. I asked Red Hat people if this
would be problematic for them.

>> Bug: https://bugs.openjdk.java.net/browse/JDK-8217723
>> Patch inline:
>> diff --git a/make/autoconf/flags-ldflags.m4 b/make/autoconf/flags-ldflags.m4
>> --- a/make/autoconf/flags-ldflags.m4
>> +++ b/make/autoconf/flags-ldflags.m4
>> @@ -70,7 +70,7 @@
>>      fi
>>
>>      # Add -z defs, to forbid undefined symbols in object files.
>> -    BASIC_LDFLAGS="$BASIC_LDFLAGS -Wl,-z,defs"
>> +    BASIC_LDFLAGS="$BASIC_LDFLAGS -Wl,-z,defs -fuse-ld=gold"
>>
>>      BASIC_LDFLAGS_JVM_ONLY="-Wl,-O1 -Wl,-z,relro"

That'd be nice. Maybe we should check for the presence of ld.gold, though, and override LD when it
is available? That would also allow the fallback when ld.gold is misbehaving, but setting LD forcefully.

-Aleksey




More information about the build-dev mailing list