Jean-Michaël Celerier via llvm-dev
2020-Oct-05 07:52 UTC
[llvm-dev] LLJIT: __{math}_finite symbols not resolved ?
Hello, when building code with -Ofast -ffinite-math-only -ffast-math, clang generates calls to "finite" variants of math functions. This has been the source of a fair amount of issues in a "normal", non-JIT pipeline, which seem to have been fixed over time - a simple fix being recompiling the target app against the new glibc. - https://bugs.llvm.org/show_bug.cgi?id=44842 - https://github.com/cms-sw/cmssw/issues/24935 - https://github.com/google/filament/issues/2146 But when going through LLJIT (tested with LLVM-10 & LLVM-11, on ArchLinux, glibc-2.32) I still get Symbols not found: [ __log_finite, __exp2_finite ] when trying to materialize my code. What could be done for that ? "Recompiling" doesn't seem to fix anything in this case so it looks like LLJIT lacks the mechanism to understand the ELF symbol indirection. Thanks, Jean-Michaël -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20201005/0909b49a/attachment.html>
Lang Hames via llvm-dev
2020-Oct-05 17:52 UTC
[llvm-dev] LLJIT: __{math}_finite symbols not resolved ?
Hi Jean-Michaël, How are you trying to provide those symbols to the JIT? Are you using a DynamicLibrarySearchGenerator to reflect process symbols (or this specific library's symbols) into the JIT? I haven't looked at ELF symbol indirection before -- I'll need to read up on that before I can provide a sensible answer. It's quite likely that RuntimeDyld doesn't support it yet though. Depending on what is required we can either try to implement it there, or aim to fix it in the newer JITLink linker -- a few people are working on an initial implementation of that at the moment. -- Lang. On Mon, Oct 5, 2020 at 12:52 AM Jean-Michaël Celerier via llvm-dev < llvm-dev at lists.llvm.org> wrote:> Hello, > when building code with -Ofast -ffinite-math-only -ffast-math, clang > generates calls to "finite" variants of math functions. > > This has been the source of a fair amount of issues in a "normal", non-JIT > pipeline, which seem to have been fixed over time - a simple fix being > recompiling the target app against the new glibc. > - https://bugs.llvm.org/show_bug.cgi?id=44842 > - https://github.com/cms-sw/cmssw/issues/24935 > - https://github.com/google/filament/issues/2146 > > But when going through LLJIT (tested with LLVM-10 & LLVM-11, on ArchLinux, > glibc-2.32) I still get > > Symbols not found: [ __log_finite, __exp2_finite ] > > when trying to materialize my code. > > What could be done for that ? "Recompiling" doesn't seem to fix anything > in this case so it looks like LLJIT lacks the mechanism to understand the > ELF symbol indirection. > > Thanks, > Jean-Michaël > _______________________________________________ > LLVM Developers mailing list > llvm-dev at lists.llvm.org > https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20201005/95c055fb/attachment.html>
Jean-Michaël Celerier via llvm-dev
2020-Oct-05 19:30 UTC
[llvm-dev] LLJIT: __{math}_finite symbols not resolved ?
Hello, Right now I am just using a Generator to look for symbols in my process (which links dynamically against libc / libm). It seems to have no trouble finding every other libc / libm / libc++ / ... symbol so I assumed that it was not necessary to specifically link against libm where these __finite symbols reside: $ nm -D /usr/lib/libm.so.6 | grep finite 0000000000050540 T __acosf128_finite at GLIBC_2.26 0000000000042f70 T __acosf_finite at GLIBC_2.15 0000000000026940 i __acos_finite at GLIBC_2.15 0000000000051000 T __acoshf128_finite at GLIBC_2.26 0000000000043240 T __acoshf_finite at GLIBC_2.15 ) but maybe it needs some help on that regard ? Thanks for your quick answer, Jean-Michaël On Mon, Oct 5, 2020 at 7:53 PM Lang Hames <lhames at gmail.com> wrote:> Hi Jean-Michaël, > > How are you trying to provide those symbols to the JIT? Are you using a > DynamicLibrarySearchGenerator to reflect process symbols (or this specific > library's symbols) into the JIT? > > I haven't looked at ELF symbol indirection before -- I'll need to read up > on that before I can provide a sensible answer. It's quite likely that > RuntimeDyld doesn't support it yet though. Depending on what is required we > can either try to implement it there, or aim to fix it in the newer JITLink > linker -- a few people are working on an initial implementation of that at > the moment. > > -- Lang. > > On Mon, Oct 5, 2020 at 12:52 AM Jean-Michaël Celerier via llvm-dev < > llvm-dev at lists.llvm.org> wrote: > >> Hello, >> when building code with -Ofast -ffinite-math-only -ffast-math, clang >> generates calls to "finite" variants of math functions. >> >> This has been the source of a fair amount of issues in a "normal", >> non-JIT pipeline, which seem to have been fixed over time - a simple fix >> being recompiling the target app against the new glibc. >> - https://bugs.llvm.org/show_bug.cgi?id=44842 >> - https://github.com/cms-sw/cmssw/issues/24935 >> - https://github.com/google/filament/issues/2146 >> >> But when going through LLJIT (tested with LLVM-10 & LLVM-11, on >> ArchLinux, glibc-2.32) I still get >> >> Symbols not found: [ __log_finite, __exp2_finite ] >> >> when trying to materialize my code. >> >> What could be done for that ? "Recompiling" doesn't seem to fix anything >> in this case so it looks like LLJIT lacks the mechanism to understand the >> ELF symbol indirection. >> >> Thanks, >> Jean-Michaël >> _______________________________________________ >> LLVM Developers mailing list >> llvm-dev at lists.llvm.org >> https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev >> >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20201005/eaf9659f/attachment.html>