]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
tests: link tests using fabs against libm explicitly
authorEvgeny Vereshchagin <evvers@ya.ru>
Thu, 26 May 2022 16:16:22 +0000 (16:16 +0000)
committerFrantisek Sumsal <frantisek@sumsal.cz>
Sun, 29 May 2022 19:05:58 +0000 (19:05 +0000)
Some compiler wrappers like honggfuzz pass -fno-builtin explicitly
and because of that the tests where fabs is used fail to compile
with something like
```
FAILED: test-bus-marshal
...
/usr/bin/ld: test-bus-marshal.p/src_libsystemd_sd-bus_test-bus-marshal.c.o: undefined reference to symbol 'fabs@@GLIBC_2.2.5'
/usr/bin/ld: /usr/lib64/libm.so.6: error adding symbols: DSO missing from command line
collect2: error: ld returned 1 exit status
```

Fun fact: it took honggfuzz less than a minute to discover
https://github.com/advisories/GHSA-gmc7-pqv9-966m used by
systemd to compress/descompress some stuff.

src/libsystemd/meson.build
src/test/meson.build

index 8a03890d8b5b8489aa6e0d6683bad0a694a8d70a..c3eef87b8404d87462c587283666e28f30f16e3f 100644 (file)
@@ -222,7 +222,8 @@ tests += [
           libglib,
           libgobject,
           libgio,
-          libdbus]],
+          libdbus,
+          libm]],
 
         [files('sd-bus/test-bus-signature.c'),
          [],
index 74da544a46eb7ce993b6565b84f5f534e19c488b..d9304d538b0848b485410172b7f41309c7b32cd8 100644 (file)
@@ -211,7 +211,9 @@ tests += [
 
         [files('test-mkdir.c')],
 
-        [files('test-json.c')],
+        [files('test-json.c'),
+         [],
+         [libm]],
 
         [files('test-modhex.c')],
 
@@ -275,7 +277,9 @@ tests += [
 
         [files('test-parse-helpers.c')],
 
-        [files('test-parse-util.c')],
+        [files('test-parse-util.c'),
+         [],
+         [libm]],
 
         [files('test-sysctl-util.c')],