Saturday, November 30, 2019

"undefined reference to `__builtin_bswap64'" on mips64el/loongson

-----BEGIN PGP SIGNATURE-----

iQIzBAEBCAAdFiEEiKQfd6o81mjI+LWALell7WOCXJMFAl3iMiAACgkQLell7WOC
XJNPmg/+MDVZV/IBBDNZ6neCTsmchgBKE+NwiKjuZiq3QlPjRrpMdmZddFwptGJ4
3qfnClg8aI2iredI90g+QVV6+x17VWiP08fQYV9gv47iIug9sDZO/KeBLzgkB9Vw
GmRzIsRUKK6+8HajZmJwZciqbMKTvbiYch004ckJ6iVc5OZtX2cErk/xUZrSymQn
YtliiSoq2aDVKtkiROXOugY7bYZ9Q2VmeSk8iuD/PeEObt8vgzIlRHCNBqArBp01
6jFQUU7byBdry10ifILabEfTsQL11QiDu3RYy4kp8f/RmFtiGRtSIR8/GdFY1gru
au/UBeOq+7z1DY9JYD9stD9GMMR5xnuma9U9btRYStYrlI8qIB3OUC5f7GnAVtQi
W7xX6tgkRSIZiqhUxHUESHSIkcrZfYob1kQ5O8GtjJTUhphHNrsD8dsw2SJ8vgyZ
ZdjFVW51TmQt2SmM9l5vsPyDOupJkiVfdRVV3hI9ZlPu1w6VrO06fp50fKqDk/sq
masBRDY+5wth+pyfS9vocR7o+wy5TLOtOtkgA9iT5ivWGJF3mUdoqf2V+LTvnavg
TPJ2K1A8Xhok53Oy/asZzqPWX2fT6tRFRmOMNdpi3qGZmuDZ2txhjU7o9QRGFaRN
b+2QiZhO4NJpMDSKgJ8ZbpEjYxcRMvWAK8a1opTLSDyHongF8fQ=
=K+Yk
-----END PGP SIGNATURE-----
Hi OpenBSD ports maintainers,

I'm having trouble building security/libnettle on mips64el/loongson
which is caused by missing symbol of "__builtin_bswap64" when linking.
It looks like this symbol is introduced since GCC 4.3[1], while mips64el
ships with GCC 4.2.1. It's interesting because I can compile with the
symbol but cannot link. Would like to hear from the ports maintainers'
opinion on how to solve this issue?

Here are some tests for showing the problem (please let me know if you
need more information):

$ uname -a
OpenBSD yeeloong.lan 6.6 GENERIC#18 loongson
$ gcc -v
Reading specs from /usr/lib/gcc-lib/mips64el-unknown-openbsd6.6/4.2.1/specs
Target: mips64el-unknown-openbsd6.6
Configured with: OpenBSD/mips64el system compiler
Thread model: posix
gcc version 4.2.1 20070719
$ cat test.c
#include <stdint.h>

int
main ()
{

uint64_t x = 17;
uint64_t y = __builtin_bswap64(x);

;
return 0;
}
$ gcc -c test.c
$ gcc test.c
/tmp//ccw1b7KO.o: In function `main':
test.c:(.text+0x2c): undefined reference to `__builtin_bswap64'
test.c:(.text+0x30): undefined reference to `__builtin_bswap64'
collect2: ld returned 1 exit status

[1] http://gcc.gnu.org/onlinedocs/gcc-4.3.0/gcc/Other-Builtins.html

No comments:

Post a Comment