Re: Incompatible change in LLD13 causing link errors?

From: Stefan Esser <se_at_freebsd.org>
Date: Wed, 17 Nov 2021 21:44:46 UTC
Am 17.11.21 um 21:20 schrieb Dimitry Andric:
> On 17 Nov 2021, at 21:07, Stefan Esser <se@freebsd.org> wrote:
>>
>> I have just received pkg-fallout for a port that has not been touched
>> for several months, specifically lang/silq.
>>
>> ld.lld: error: undefined hidden symbol: __start___minfo
>>>>> referenced by terminal.d
>>>>>              silq.o:(ldc.register_dso)
>>
>> ld.lld: error: undefined hidden symbol: __stop___minfo
>>>>> referenced by terminal.d
>>>>>              silq.o:(ldc.register_dso)
>> cc: error: linker command failed with exit code 1 (use -v to see invocation)
>> Error: /usr/bin/cc failed with status: 1
>> *** Error code 1
>>
>> This port builds correctly with LLD12 from a port, but fails with the
>> error message included above for both LLD13 from a port and LLD from
>> the FreeBSD-CURRENT base system.
> 
> See https://bugs.llvm.org/show_bug.cgi?id=52384 where this is discussed.
> Executive summary is to add -Wl,-z,nostart-stop-gc to your LDFLAGS, for
> now at least. But as you can see in the upstream PR, not everybody is
> happy with them flipping the default to on.

Hi Dimitry,

thank you for the quick reply!

Seems that the breakage of LDC had been noticed (by Jessica?) a few
weeks ago, and that a possible solution could be to build LDC with
LLVM>=13.0.0.

But apparently LDC-1.23.0 cannot be built with llvm13, and a naive
attempt to upgrade the LDC port to 1.28.0 failed (MAINTAINER in CC).

Since LDC currently depends on LLVM10 I'll just add that as a
dependency to my failing port and hard-code lld10 as the linker
to use.

A better fix could be to import the (apparently not yet completely
accepted) patch

	https://github.com/ldc-developers/ldc/pull/3850/

to explicitly define the garbage collected symbols in rt.dso into
LDC.

Anyway, my lang/silq port seems to be fixed by using llvm10 (poudriere
test builds ongoing).

Regards, STefan