--- rpython/rlib/clibffi.py.orig	2025-02-22 16:54:09 UTC
+++ rpython/rlib/clibffi.py
@@ -77,11 +77,16 @@ if not _WIN32:
     library_dirs = platform.library_dirs_for_libffi()
     libraries = ['ffi']
     link_files = []
-    for libdir in library_dirs:
-        candidate = os.path.join(libdir, "libffi.a")
-        if os.path.exists(candidate):
-            link_files.append(candidate)
-            libraries = []
+    #
+    # fag: linking with libffi.a yields an error on FreeBSD because it is
+    #      not compiled with -fPIC: so link with libffi.so instead. This
+    #      is also true for previous versions of pypy.
+    #
+    # for libdir in library_dirs:
+    #     candidate = os.path.join(libdir, "libffi.a")
+    #     if os.path.exists(candidate):
+    #         link_files.append(candidate)
+    #         libraries = []
 
     eci = ExternalCompilationInfo(
         pre_include_bits = pre_include_bits,
