git: 4f5890a0fb08 - main - csu: test: explicitly add libm as build parameter

From: Alfredo Dal'Ava Junior <alfredo_at_FreeBSD.org>
Date: Thu, 07 Jul 2022 20:57:36 UTC
The branch main has been updated by alfredo:

URL: https://cgit.FreeBSD.org/src/commit/?id=4f5890a0fb086324a657f3cd7ba1abc57274e0db

commit 4f5890a0fb086324a657f3cd7ba1abc57274e0db
Author:     Alfredo Dal'Ava Junior <alfredo@FreeBSD.org>
AuthorDate: 2022-07-01 15:13:04 +0000
Commit:     Alfredo Dal'Ava Junior <alfredo@FreeBSD.org>
CommitDate: 2022-07-07 23:58:04 +0000

    csu: test: explicitly add libm as build parameter
    
    CSU tests build fails with '/usr/lib/libgcc_s.so: undefined reference to
    fma' when built with LLVM 14 for powerpcspe, so '-lm' is being added
    explicitly.
    
    It may be linked to https://reviews.llvm.org/D77558
    
    Reviewed by:    imp (earlier version)
    MFC after:      2 days
    Sponsored by:   Instituto de Pesquisas Eldorado (eldorado.org.br)
    Differential Revision:  https://reviews.freebsd.org/D35691
---
 lib/csu/tests/dynamic/Makefile            |  5 +++++
 lib/csu/tests/dynamic/Makefile.powerpcspe | 11 +++++++++++
 2 files changed, 16 insertions(+)

diff --git a/lib/csu/tests/dynamic/Makefile b/lib/csu/tests/dynamic/Makefile
index 266f5c5a7d0d..28fbbb3ee96a 100644
--- a/lib/csu/tests/dynamic/Makefile
+++ b/lib/csu/tests/dynamic/Makefile
@@ -2,6 +2,11 @@
 
 .PATH: ${.CURDIR:H}
 
+.if exists(./Makefile.${MACHINE_ARCH})
+.include "./Makefile.${MACHINE_ARCH}"
+.endif
+
+
 .include <src.opts.mk>
 MK_PIE=	no
 
diff --git a/lib/csu/tests/dynamic/Makefile.powerpcspe b/lib/csu/tests/dynamic/Makefile.powerpcspe
new file mode 100644
index 000000000000..1739a85e6219
--- /dev/null
+++ b/lib/csu/tests/dynamic/Makefile.powerpcspe
@@ -0,0 +1,11 @@
+# $FreeBSD$
+
+# TODO: investigate and try a better fix on compiler side
+#
+# CSU tests build fails with '/usr/lib/libgcc_s.so: undefined reference to fma'
+# when built with LLVM 14, so '-lm' is being added explicitly here. Only
+# the powerpcspe target is affected and it may be linked to
+#       https://reviews.llvm.org/D77558
+
+LDFLAGS+=	-lm
+