Subject: Bug#1016041: libasan8: Should link to libatomic on armel

From: Dmitry Shachnev <[email-masked]>
Date: Tue, 26 Jul 2022 00:07:43 +0300

Package: libasan8
Version: 12.1.0-7

Dear Maintainer,

Here is the test case:

(sid_armel-dchroot)mitya57@amdahl:~$ echo 'int main() { return 0; }' > test.c
(sid_armel-dchroot)mitya57@amdahl:~$ gcc test.c
(sid_armel-dchroot)mitya57@amdahl:~$ gcc -fsanitize=address test.c
/usr/bin/ld: /usr/lib/gcc/arm-linux-gnueabi/12/libasan.so: undefined reference to `__atomic_store_8'
/usr/bin/ld: /usr/lib/gcc/arm-linux-gnueabi/12/libasan.so: undefined reference to `__atomic_load_8'
collect2: error: ld returned 1 exit status

libasan.so seems to use symbols from libatomic, but is not linked to it:

(sid_armel-dchroot)mitya57@amdahl:~$ ldd /usr/lib/gcc/arm-linux-gnueabi/12/libasan.so
	libdl.so.2 => /lib/arm-linux-gnueabi/libdl.so.2 (0xf7282000)
	libpthread.so.0 => /lib/arm-linux-gnueabi/libpthread.so.0 (0xf724f000)
	libm.so.6 => /lib/arm-linux-gnueabi/libm.so.6 (0xf71ae000)
	libc.so.6 => /lib/arm-linux-gnueabi/libc.so.6 (0xf7045000)
	libgcc_s.so.1 => /lib/arm-linux-gnueabi/libgcc_s.so.1 (0xf7014000)
	/lib/ld-linux.so.3 (0xf788e000)

I have not seen it on architectures other than armel yet.

--
Dmitry Shachnev

---

From: Emanuele Rocca <[email-masked]>
Date: Thu, 1 Feb 2024 17:39:28 +0100

Hi,

> libasan.so seems to use symbols from libatomic, but is not linked to it:
[...]

> I have not seen it on architectures other than armel yet.

A very similar issue is known upstream, but affecting powerpc:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110553