Undefined reference to __bswapsi2/__bswapdi2

Dimitry Andric dim at FreeBSD.org
Thu Aug 20 19:53:15 UTC 2020


On 20 Aug 2020, at 19:52, Gleb Popov <arrowd at freebsd.org> wrote:
> 
> On Wed, Aug 19, 2020 at 10:15 PM Gleb Popov <arrowd at freebsd.org> wrote:
> 
>> Hi toolchain@
>> 
>> I'm building the latest GHC on 12.1-RELEASE i386 and having almost the
>> same problem as with atomic functions. This time the error is
>> 
>> d: error: undefined symbol: __bswapsi2
>>>>> referenced by TTY.c
>>>>>              RTS.thr_p_o:(rtsSyms) in archive
>> /wrkdirs/usr/ports/lang/ghc/work/ghc-8.10.2/rts/dist/build/libHSrts_thr_p.a
>> 
>> ld: error: undefined symbol: __bswapdi2
>>>>> referenced by TTY.c
>>>>>              RTS.thr_p_o:(rtsSyms) in archive
>> /wrkdirs/usr/ports/lang/ghc/work/ghc-8.10.2/rts/dist/build/libHSrts_thr_p.a
>> 
>> What's wrong with that? These functions seem to be present in our
>> compiler-rt.
>> 
> 
> Reading /usr/src/lib/libcompiler_rt/Makefile.inc, it seems that we don't
> compile these functions. What's the reason for this?

I'm not aware of any particular reason, except that nobody seems to have
run into this omission before. It looks like on x86, compilers usually
just emit bswap instructions instead of libcalls for these situations.

Apparently we have historically only added bswapdi and bswapsi for arm,
mips and riscv.

-Dimitry

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 223 bytes
Desc: Message signed with OpenPGP
URL: <http://lists.freebsd.org/pipermail/freebsd-toolchain/attachments/20200820/f3b10a11/attachment.sig>


More information about the freebsd-toolchain mailing list