Skip to content

Commit

Permalink
Resolve fmod at runtime
Browse files Browse the repository at this point in the history
Signed-off-by: Filipe Laíns <lains@riseup.net
  • Loading branch information
FFY00 committed Dec 19, 2024
1 parent 7546dc5 commit 5162d61
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions Modules/mathmodule.c
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,19 @@ raised for division by zero and mod by zero.

#include "clinic/mathmodule.c.h"

/* Resolve fmod at runtime, so that we don't have a GLIBC-versioned symbol
reference in the linker table . */
#ifdef __GNUC__
#include <dlfcn.h>

static double (*resolve_fmod(double, double))() {
return dlsym(RTLD_NEXT, "fmod");
}

__attribute__((ifunc("resolve_fmod")))
double fmod(double x, double y);
#endif

/*[clinic input]
module math
[clinic start generated code]*/
Expand Down

0 comments on commit 5162d61

Please sign in to comment.