Date: Mon, 6 Apr 2026 19:58:37 +0300 From: Dima Panov <fluffy@FreeBSD.org> To: Konstantin Belousov <kib@freebsd.org> Cc: src-committers@freebsd.org, dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org Subject: git: 3a01e1e1a50c - main - msun/aarch64: convert fenv functions to proper linkage Message-ID: <ca44aaf8-59c6-4d15-875b-ad45f8ed7347@FreeBSD.org> In-Reply-To: <adPjEp0ZW5H9eEXK@kib.kiev.ua> References: <69caafbb.408c4.7b20a1e1@gitrepo.freebsd.org> <1f2ad4f0-a4ab-4f15-a779-5f1a6db9912b@FreeBSD.org> <adPaSi8u98pRvSeq@kib.kiev.ua> <8022afad-9cee-4ade-8b56-ef5b7feb6e16@FreeBSD.org> <adPjEp0ZW5H9eEXK@kib.kiev.ua>
index | next in thread | previous in thread | raw e-mail
[-- Attachment #1 --]
On 06.04.2026 19:45, Konstantin Belousov wrote:
> On Mon, Apr 06, 2026 at 07:25:18PM +0300, Dima Panov wrote:
> >
> >
> > On 06.04.2026 19:07, Konstantin Belousov wrote:
> > > On Mon, Apr 06, 2026 at 06:56:36PM +0300, Dima Panov wrote:
> > > > Hello!
> > > >
> > > > This breaks most of libm consumers
> > > >
> > > > llvm/flang:
> > > > ===============
> > > > FAILED: [code=1] bin/flang-20
> > > > : && /usr/local/libexec/ccache/c++ -O2 -pipe -fstack-protector-strong -isystem /usr/local/include -fno-strict-aliasing -isystem /usr/local/include -fPIC -fno-semantic-interposition -fvisibility-inline
> > > > s-hidden -Werror=date-time -Werror=unguarded-availability-new -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wmissing-field-initializers -pedantic -Wno-long-long -Wc++98-compat-extra-s
> > > > emi -Wimplicit-fallthrough -Wcovered-switch-default -Wno-noexcept-type -Wnon-virtual-dtor -Wdelete-non-virtual-dtor -Wsuggest-override -Wstring-conversion -Wmisleading-indentation -Wctad-maybe-unsupport
> > > > ed -fdiagnostics-color -ffunction-sections -fdata-sections -Wno-deprecated-copy -Wno-string-conversion -Wno-ctad-maybe-unsupported -Wno-unused-command-line-argument -Wstring-conversion -Wcover
> > > > ed-switch-default -Wno-nested-anon-types -O2 -pipe -fstack-protector-strong -isystem /usr/local/include -fno-strict-aliasing -isystem /usr/local/include -DNDEBUG -Wl,--color-diagnostics -Wl,--expor
> > > > t-dynamic -Wl,-z,origin -Wl,--gc-sections -Xlinker --dependency-file=tools/flang/tools/flang-driver/CMakeFiles/flang.dir/link.d tools/flang/tools/flang-driver/CMakeFiles/flang.dir/driver.cpp.o tools/
> > > > flang/tools/flang-driver/CMakeFiles/flang.dir/fc1_main.cpp.o -o bin/flang-20 -L/wrkdirs/usr/ports/devel/llvm20/work-default/.build/./lib -Wl,-rpath,"\$ORIGIN/../lib:/wrkdirs/usr/ports/devel/llvm20/work-
> > > > default/.build/./lib:/wrkdirs/usr/ports/devel/llvm20/work-default/.build/lib:" -lpthread lib/libflangFrontend.a lib/libflangFrontendTool.a lib/libFortranLower.a lib/libFortranSemantics.a lib/libFo
> > > > rtranSupport.a lib/libflangPasses.a lib/libHLFIRTransforms.a lib/libFIRTransforms.a lib/libFIROpenACCSupport.a lib/libFlangOpenMPTransforms.a lib/libFIRCodeGen.a lib/libFIRAnalysis.a lib/libFIRB
> > > > uilder.a lib/libCUFDialect.a lib/libFortranEvaluate.a lib/libFortranParser.a lib/libFortranCommon.a lib/libFortranDecimal.a lib/libFIRSupport.a lib/libHLFIRDialect.a lib/libFIRDialect.a lib/lib
> > > > FIRDialectSupport.a lib/libCUFAttrs.a lib/libclang-cpp.so.20.1 lib/libMLIR.so.20.1 lib/libLLVM.so.20.1 && :
> > > > ld: error: undefined symbol: feholdexcept
> > >
> > > This is strange. Could you show me the output of e.g.
> > > readelf --dyn_syms /lib/libm.so.5 | grep feholdexcept
> > > The best would be the output from the command like above for each missing
> > > symbol.
> >
> > missing :(
> >
> > FreeBSD 16.0-CURRENT #0 main-cf1f21572897: Mon Apr 6 13:45:02 MSK 2026
> >
> > root@aarch64:/ # readelf --dyn-syms /lib/libm.so.5 | grep feholdexcept
> > root@aarch64:/ #
> Hm, ok, perhaps I understand.
> These symbols where never exported from libm, and it just happens that
> they were compiled into the binaries itself due to extern inline.
> So the proper fix for consumers that want the symbols is to export them
> from libm.so.
>
> >
> > full list of symbols:
> >
> > Symbol table '.dynsym' contains 306 entries:
>
> It is practically impossible to get the missed symbols from the list of
> present symbols. Try this, if there is something else missed, add the
> symbols to msun/aarch64/Symbol.map. I did not even tried to (cross-)
> compile.
>
> I will think how to get the complete list to export, meantime.
> This should also be problem on any arch that provides non-standard fenv
> functions.
>
> commit 7573286180010304ca982d09ce5a980740e1e35e
> Author: Konstantin Belousov <kib@FreeBSD.org>
> Date: Mon Apr 6 19:41:23 2026 +0300
>
> lib/msun: export arch-specific fenv methods
>
> diff --git a/lib/msun/Makefile b/lib/msun/Makefile
> index 5112337f6297..b6e77fed5d9c 100644
> --- a/lib/msun/Makefile
> +++ b/lib/msun/Makefile
> @@ -115,6 +115,10 @@ LIBC_ARCH=${MACHINE_CPUARCH}
> CFLAGS+= -I${.CURDIR}/src -I${LIBC_SRCTOP}/include \
> -I${LIBC_SRCTOP}/${LIBC_ARCH}
> SYM_MAPS+= ${.CURDIR}/Symbol.map
> +ARCH_MAP= ${.CURDIR}/${LIBC_ARCH}/Symbol.map
> +.if exists(${ARCH_MAP})
> +SYM_MAPS+= ${ARCH_MAP}
> +.endif
>
> VERSION_DEF= ${LIBC_SRCTOP}/Versions.def
> SYMBOL_MAPS= ${SYM_MAPS}
> diff --git a/lib/msun/aarch64/Symbol.map b/lib/msun/aarch64/Symbol.map
> new file mode 100644
> index 000000000000..d24d7820ba98
> --- /dev/null
> +++ b/lib/msun/aarch64/Symbol.map
> @@ -0,0 +1,5 @@
> +FBSD_1.9 {
> + fegetenv;
> + feholdexcept;
> + feraiseexcept;
> +};
May be better way is repeat map from msun/arm/Symbol.map? amd64 is also equal to it here.
FBSD_1.9 {
fesetexceptflag;
feraiseexcept;
fegetenv;
feholdexcept;
feupdateenv;
feenableexcept;
fedisableexcept;
fegetexcept;
};
Started build with your diff anyway, will see on result
--
Sincerely,
Dima (fluffy@FreeBSD.org, https://t.me/FluffyBSD, @fluffy:matrix-dev.freebsd.org)
(desktop, kde, x11, office, ports-secteam)@FreeBSD team
[-- Attachment #2 --]
<html><head><meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no"></head><body><div id="CanaryBody"><br> <br>On 06.04.2026 19:45, Konstantin Belousov wrote: <br><blockquote type="cite">On Mon, Apr 06, 2026 at 07:25:18PM +0300, Dima Panov wrote: <br><blockquote type="cite"> <br> <br>On 06.04.2026 19:07, Konstantin Belousov wrote: <br><blockquote type="cite">On Mon, Apr 06, 2026 at 06:56:36PM +0300, Dima Panov wrote: <br><blockquote type="cite">Hello! <br> <br>This breaks most of libm consumers <br> <br>llvm/flang: <br>=============== <br>FAILED: [code=1] bin/flang-20 <br>: && /usr/local/libexec/ccache/c++ -O2 -pipe -fstack-protector-strong -isystem /usr/local/include -fno-strict-aliasing -isystem /usr/local/include -fPIC -fno-semantic-interposition -fvisibility-inline <br>s-hidden -Werror=date-time -Werror=unguarded-availability-new -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wmissing-field-initializers -pedantic -Wno-long-long -Wc++98-compat-extra-s <br>emi -Wimplicit-fallthrough -Wcovered-switch-default -Wno-noexcept-type -Wnon-virtual-dtor -Wdelete-non-virtual-dtor -Wsuggest-override -Wstring-conversion -Wmisleading-indentation -Wctad-maybe-unsupport <br>ed -fdiagnostics-color -ffunction-sections -fdata-sections -Wno-deprecated-copy -Wno-string-conversion -Wno-ctad-maybe-unsupported -Wno-unused-command-line-argument -Wstring-conversion -Wcover <br>ed-switch-default -Wno-nested-anon-types -O2 -pipe -fstack-protector-strong -isystem /usr/local/include -fno-strict-aliasing -isystem /usr/local/include -DNDEBUG -Wl,--color-diagnostics -Wl,--expor <br>t-dynamic -Wl,-z,origin -Wl,--gc-sections -Xlinker --dependency-file=tools/flang/tools/flang-driver/CMakeFiles/flang.dir/link.d tools/flang/tools/flang-driver/CMakeFiles/flang.dir/driver.cpp.o tools/ <br>flang/tools/flang-driver/CMakeFiles/flang.dir/fc1_main.cpp.o -o bin/flang-20 -L/wrkdirs/usr/ports/devel/llvm20/work-default/.build/./lib -Wl,-rpath,"\$ORIGIN/../lib:/wrkdirs/usr/ports/devel/llvm20/work- <br>default/.build/./lib:/wrkdirs/usr/ports/devel/llvm20/work-default/.build/lib:" -lpthread lib/libflangFrontend.a lib/libflangFrontendTool.a lib/libFortranLower.a lib/libFortranSemantics.a lib/libFo <br>rtranSupport.a lib/libflangPasses.a lib/libHLFIRTransforms.a lib/libFIRTransforms.a lib/libFIROpenACCSupport.a lib/libFlangOpenMPTransforms.a lib/libFIRCodeGen.a lib/libFIRAnalysis.a lib/libFIRB <br>uilder.a lib/libCUFDialect.a lib/libFortranEvaluate.a lib/libFortranParser.a lib/libFortranCommon.a lib/libFortranDecimal.a lib/libFIRSupport.a lib/libHLFIRDialect.a lib/libFIRDialect.a lib/lib <br>FIRDialectSupport.a lib/libCUFAttrs.a lib/libclang-cpp.so.20.1 lib/libMLIR.so.20.1 lib/libLLVM.so.20.1 && : <br>ld: error: undefined symbol: feholdexcept <br></blockquote> <br>This is strange. Could you show me the output of e.g. <br>readelf --dyn_syms /lib/libm.so.5 | grep feholdexcept <br>The best would be the output from the command like above for each missing <br>symbol. <br></blockquote> <br>missing :( <br> <br>FreeBSD 16.0-CURRENT #0 main-cf1f21572897: Mon Apr 6 13:45:02 MSK 2026 <br> <br>root@aarch64:/ # readelf --dyn-syms /lib/libm.so.5 | grep feholdexcept <br>root@aarch64:/ # <br></blockquote>Hm, ok, perhaps I understand. <br>These symbols where never exported from libm, and it just happens that <br>they were compiled into the binaries itself due to extern inline. <br>So the proper fix for consumers that want the symbols is to export them <br>from libm.so. <br> <br><blockquote type="cite"> <br>full list of symbols: <br> <br>Symbol table '.dynsym' contains 306 entries: <br></blockquote> <br>It is practically impossible to get the missed symbols from the list of <br>present symbols. Try this, if there is something else missed, add the <br>symbols to msun/aarch64/Symbol.map. I did not even tried to (cross-) <br>compile. <br> <br>I will think how to get the complete list to export, meantime. <br>This should also be problem on any arch that provides non-standard fenv <br>functions. <br> <br>commit 7573286180010304ca982d09ce5a980740e1e35e <br>Author: Konstantin Belousov <kib@FreeBSD.org> <br>Date: Mon Apr 6 19:41:23 2026 +0300 <br> <br>lib/msun: export arch-specific fenv methods <br> <br>diff --git a/lib/msun/Makefile b/lib/msun/Makefile <br>index 5112337f6297..b6e77fed5d9c 100644 <br>--- a/lib/msun/Makefile <br>+++ b/lib/msun/Makefile <br>@@ -115,6 +115,10 @@ LIBC_ARCH=${MACHINE_CPUARCH} <br>CFLAGS+= -I${.CURDIR}/src -I${LIBC_SRCTOP}/include \ <br> -I${LIBC_SRCTOP}/${LIBC_ARCH} <br>SYM_MAPS+= ${.CURDIR}/Symbol.map <br>+ARCH_MAP= ${.CURDIR}/${LIBC_ARCH}/Symbol.map <br>+.if exists(${ARCH_MAP}) <br>+SYM_MAPS+= ${ARCH_MAP} <br>+.endif <br> <br>VERSION_DEF= ${LIBC_SRCTOP}/Versions.def <br>SYMBOL_MAPS= ${SYM_MAPS} <br>diff --git a/lib/msun/aarch64/Symbol.map b/lib/msun/aarch64/Symbol.map <br>new file mode 100644 <br>index 000000000000..d24d7820ba98 <br>--- /dev/null <br>+++ b/lib/msun/aarch64/Symbol.map <br>@@ -0,0 +1,5 @@ <br>+FBSD_1.9 { <br>+ fegetenv; <br>+ feholdexcept; <br>+ feraiseexcept; <br>+}; <br></blockquote> <br>May be better way is repeat map from msun/arm/Symbol.map? amd64 is also equal to it here. <br>FBSD_1.9 { <br> fesetexceptflag; <br> feraiseexcept; <br> fegetenv; <br> feholdexcept; <br> feupdateenv; <br> feenableexcept; <br> fedisableexcept; <br> fegetexcept; <br>}; <br> <br> <br>Started build with your diff anyway, will see on result <br> <br>-- <br>Sincerely, <br>Dima (fluffy@FreeBSD.org, https://t.me/FluffyBSD, @fluffy:matrix-dev.freebsd.org) <br>(desktop, kde, x11, office, ports-secteam)@FreeBSD team <br> <br></div></body></html>
home |
help
Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?ca44aaf8-59c6-4d15-875b-ad45f8ed7347>
