gold doesn't accept object file as script
Vladimir Simonov
sv@sw.ru
Tue Jan 25 16:33:00 GMT 2011
On 01/25/2011 06:15 PM, Ian Lance Taylor wrote:
> Vladimir Simonov<sv@sw.ru> writes:
>
>> According "man ld" "If the linker cannot recognize the format
>> of an object file, it will assume that it is a linker script."
>>
>> But gold doesn't follow above. For details, see test case below.
>
> That turns out not to be the case. Gold does implement that.
>
>> Briefly, the command "gcc -fuse-ld=gold -o a.4 -shared exports.ld a.a"
>> if exports.ld is linker script leads to warning
>> "exports.ld:1:8: ignoring command OPTION; OPTION is only valid for
>> scripts specified via -T/--script" and resulted shared library
>> doesn't contain func_a.
>> exports.ld contains only EXTERN(func_a)
>
> Internally gold implements EXTERN via OPTION, and as the warning says
> gold only permits OPTION in a script specified via -T/--script. So the
> bug is that EXTERN is implemented as OPTION.
>
> Fortunately, the fix is simple, as the necessary framework was
> introduced for other reasons. Would you mind giving this patch a try to
> see if it fixes your problem?
>
> Ian
>
Perfect. The test is passed.
Thank you a lot.
Vladimir Simonov
More information about the Binutils
mailing list