gold doesn't accept object file as script
Ian Lance Taylor
iant@google.com
Tue Jan 25 15:15:00 GMT 2011
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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: foo.patch
Type: text/x-diff
Size: 922 bytes
Desc: extern
URL: <https://sourceware.org/pipermail/binutils/attachments/20110125/1a4c0c2e/attachment.bin>
More information about the Binutils
mailing list