Bruno Haible <[email protected]> writes:

> Hi Simon,
>
> Sam James wrote:
>> $ gcc lld.c -Wl,--version-script=lld.map -fuse-ld=lld
>> ld.lld: error: version script assignment of 'VERS_1' to symbol 'sym' failed: 
>> symbol not defined
>> ld.lld: error: version script assignment of 'VERS_2' to symbol 'sym' failed: 
>> symbol not defined
>> collect2: error: ld returned 1 exit status
>> 
>> bfd accepts it (and doesn't warn), mold warns, while lld errors
>> out. It's an intentional (albeit IMO unfortunate) decision in lld. We
>> can either define `sym` in AC_LANG_PROGRAM or we can pass
>> -Wl,--undefined-version if supported by the linker.
>
> Before we think about how to modify the configure test, we need to
> think about how the packages, that make use of the gl_LD_VERSION_SCRIPT,
> shall behave with lld >= 16.
>
>   - Are these packages supposed to use -Wl,--version-script only
>     with symbol maps that contain only defined symbols?
>
>   - If no: Are these packages supposed to use -Wl,--undefined-version
>     by themselves? Or should Gnulib define a variable that contains
>     '-Wl,--undefined-version' when the linker needs this in order to
>     accept undefined symbols?

I think both 'yes' and 'no' is reasonable, and possibly even a third
mode: it will depend on the linker.

I think enforcing either 'yes' or 'no' could be an additional
configuration, but the enforcing part need not be the default behaviour
of LD_VERSION_SCRIPT.

I don't have a strong opinion on this though.  Maybe the simplest is to
fix the ld-version-script.m4 test to actually define 'syms' so the test
works better?

/Simon

> Then update doc/ld-version-script.texi and m4/ld-version-script.m4 ...
>
> Bruno
>
>
>

Attachment: signature.asc
Description: PGP signature

Reply via email to