Questions about RedHat/Fedora - ld dynamic linker hash style
Kelly O'Hair
Kelly.Ohair at Sun.COM
Wed Jan 28 14:45:16 PST 2009
Thanks Andrew, that helps.
-kto
Andrew Haley wrote:
> Andrew Haley wrote:
>> Kelly O'Hair wrote:
>>
>>> I need some advice or information, figured this alias might be the
>>> right place to ask, probably lots of gcc/ld experts listing in here. ;^)
>>>
>>> Fedora (RedHat?) seems to have a different default dynamic linker hash
>>> style,
>>> I think basically it is:
>>> ld --hash-style=gnu ..
>>>
>>> So without using one of:
>>> --hash-style=both or --hash-style=sysv
>>>
>>> The bits created won't run on systems that don't support this new hash
>>> style, like SuSE 10.
>>>
>>> We had planned on changing our formal JDK7 builds to Fedora 9 but
>>> ran into this problem, making our built bits less portable than we
>>> would like. We need to resolve this, or change our build system
>>> choice.
>>>
>>> I'd like to just add one of the options to the link lines in the
>>> OpenJDK Makefiles, but I suspect I need to be careful to only add
>>> the option when the Linux system doing the build needs it.
>>>
>>> Anybody have any ideas on how to deal with this?
>>> I suppose if we had a './configure' step it could be figured out
>>> there, but alas, we don't.
>>>
>>> Or, can you configure gcc/ld on a system to have a different default
>>> hash style?
>> You can do that.
>>
>> $ gcc -dumpspecs > specfile
>> $ sed -i 's/hash-style=gnu/hash-style=both/' specfile
>> $ gcc -specs=specfile hello.c
>>
>> This will work regardless of whether the gcc you have defaults to
>> hash-style=gnu.
>
> Ahh, no. That will work but it's unnecessarily nasty.
>
> Try something like this instead:
>
> if ( gcc -dumpspecs | grep hash-style=gnu > /dev/null )
> then
> CC="gcc -Wl,-hash-style=both"
> else
> CC=gcc
> fi
>
> Andrew.
>
>
More information about the porters-dev
mailing list