Re: JIT on FreeBSD ARMv7

Поиск
Список
Период
Сортировка
От Andrew Gierth
Тема Re: JIT on FreeBSD ARMv7
Дата
Msg-id 877edngtpm.fsf@news-spur.riddles.org.uk
обсуждение исходный текст
Ответ на JIT on FreeBSD ARMv7  (Andrew Gierth <andrew@tao11.riddles.org.uk>)
Список pgsql-hackers
>>>>> "Andrew" == Andrew Gierth <andrew@tao11.riddles.org.uk> writes:

 Andrew> This seems to be the cleanest way to get a JIT build working on
 Andrew> FreeBSD on the armv7 platform. Without this, it fails because
 Andrew> the ABI functions __aeabi_ldivmod and so on are not found by
 Andrew> the symbol lookup for JITted code.

Turns out it needs more symbols, as per the attached.

-- 
Andrew (irc:RhodiumToad)

diff --git a/src/backend/jit/llvm/abi_funcs_arm.h b/src/backend/jit/llvm/abi_funcs_arm.h
new file mode 100644
index 0000000000..d2eaaa82f0
--- /dev/null
+++ b/src/backend/jit/llvm/abi_funcs_arm.h
@@ -0,0 +1,164 @@
+/*
+ * List of ARM ABI functions to forcibly import.
+ *
+ * There is intentionally no #if guard here
+ */
+
+/* LLVM compiler_rt */
+ABISYM(__absvdi2)
+ABISYM(__absvsi2)
+ABISYM(__addvdi3)
+ABISYM(__addvsi3)
+ABISYM(__ashldi3)
+ABISYM(__ashrdi3)
+ABISYM(__bswapdi2)
+ABISYM(__bswapsi2)
+ABISYM(__clzdi2)
+ABISYM(__clzsi2)
+ABISYM(__cmpdi2)
+ABISYM(__ctzdi2)
+ABISYM(__ctzsi2)
+ABISYM(__divdc3)
+ABISYM(__divdi3)
+ABISYM(__divmoddi4)
+ABISYM(__divmodsi4)
+ABISYM(__divsc3)
+ABISYM(__divsi3)
+ABISYM(__divtc3)
+ABISYM(__divxc3)
+ABISYM(__extendhfsf2)
+ABISYM(__ffsdi2)
+ABISYM(__ffssi2)
+ABISYM(__fixdfdi)
+ABISYM(__fixsfdi)
+ABISYM(__fixunsdfdi)
+ABISYM(__fixunsdfsivfp)
+ABISYM(__fixunssfdi)
+ABISYM(__fixunssfsivfp)
+ABISYM(__fixunsxfdi)
+ABISYM(__fixunsxfsi)
+ABISYM(__fixxfdi)
+ABISYM(__floatdidf)
+ABISYM(__floatdisf)
+ABISYM(__floatdixf)
+ABISYM(__floatundidf)
+ABISYM(__floatundisf)
+ABISYM(__floatundixf)
+ABISYM(__floatunsidf)
+ABISYM(__floatunsisf)
+ABISYM(__gcc_personality_v0)
+ABISYM(__gnu_f2h_ieee)
+ABISYM(__gnu_h2f_ieee)
+ABISYM(__lshrdi3)
+ABISYM(__moddi3)
+ABISYM(__modsi3)
+ABISYM(__muldc3)
+ABISYM(__muldi3)
+ABISYM(__mulodi4)
+ABISYM(__mulosi4)
+ABISYM(__mulsc3)
+ABISYM(__multc3)
+ABISYM(__mulvdi3)
+ABISYM(__mulvsi3)
+ABISYM(__mulxc3)
+ABISYM(__negdf2vfp)
+ABISYM(__negdi2)
+ABISYM(__negsf2vfp)
+ABISYM(__negvdi2)
+ABISYM(__negvsi2)
+ABISYM(__paritydi2)
+ABISYM(__paritysi2)
+ABISYM(__popcountdi2)
+ABISYM(__popcountsi2)
+ABISYM(__powidf2)
+ABISYM(__powisf2)
+ABISYM(__powixf2)
+ABISYM(__subvdi3)
+ABISYM(__subvsi3)
+ABISYM(__truncdfhf2)
+ABISYM(__truncsfhf2)
+ABISYM(__ucmpdi2)
+ABISYM(__udivdi3)
+ABISYM(__udivmoddi4)
+ABISYM(__udivmodsi4)
+ABISYM(__udivsi3)
+ABISYM(__umoddi3)
+ABISYM(__umodsi3)
+
+/* ARM EABI */
+ABISYM(__aeabi_atexit)
+ABISYM(__aeabi_cdcmpeq)
+ABISYM(__aeabi_cdcmple)
+ABISYM(__aeabi_cdrcmple)
+ABISYM(__aeabi_cfcmpeq)
+ABISYM(__aeabi_cfcmple)
+ABISYM(__aeabi_cfrcmple)
+ABISYM(__aeabi_d2f)
+ABISYM(__aeabi_d2h)
+ABISYM(__aeabi_d2iz)
+ABISYM(__aeabi_d2lz)
+ABISYM(__aeabi_d2ulz)
+ABISYM(__aeabi_dadd)
+ABISYM(__aeabi_dcmpeq)
+ABISYM(__aeabi_dcmpge)
+ABISYM(__aeabi_dcmpgt)
+ABISYM(__aeabi_dcmple)
+ABISYM(__aeabi_dcmplt)
+ABISYM(__aeabi_dcmpun)
+ABISYM(__aeabi_ddiv)
+ABISYM(__aeabi_dmul)
+ABISYM(__aeabi_dsub)
+ABISYM(__aeabi_f2d)
+ABISYM(__aeabi_f2h)
+ABISYM(__aeabi_f2iz)
+ABISYM(__aeabi_f2lz)
+ABISYM(__aeabi_f2ulz)
+ABISYM(__aeabi_fadd)
+ABISYM(__aeabi_fcmpeq)
+ABISYM(__aeabi_fcmpge)
+ABISYM(__aeabi_fcmpgt)
+ABISYM(__aeabi_fcmple)
+ABISYM(__aeabi_fcmplt)
+ABISYM(__aeabi_fcmpun)
+ABISYM(__aeabi_fdiv)
+ABISYM(__aeabi_fmul)
+ABISYM(__aeabi_fsub)
+ABISYM(__aeabi_h2f)
+ABISYM(__aeabi_i2d)
+ABISYM(__aeabi_i2f)
+ABISYM(__aeabi_idiv)
+ABISYM(__aeabi_idivmod)
+ABISYM(__aeabi_l2d)
+ABISYM(__aeabi_l2f)
+ABISYM(__aeabi_lasr)
+ABISYM(__aeabi_lcmp)
+ABISYM(__aeabi_ldivmod)
+ABISYM(__aeabi_llsl)
+ABISYM(__aeabi_llsr)
+ABISYM(__aeabi_lmul)
+ABISYM(__aeabi_memclr)
+ABISYM(__aeabi_memclr4)
+ABISYM(__aeabi_memclr8)
+ABISYM(__aeabi_memcmp)
+ABISYM(__aeabi_memcmp4)
+ABISYM(__aeabi_memcmp8)
+ABISYM(__aeabi_memcpy)
+ABISYM(__aeabi_memcpy4)
+ABISYM(__aeabi_memcpy8)
+ABISYM(__aeabi_memmove)
+ABISYM(__aeabi_memmove4)
+ABISYM(__aeabi_memmove8)
+ABISYM(__aeabi_memset)
+ABISYM(__aeabi_memset4)
+ABISYM(__aeabi_memset8)
+ABISYM(__aeabi_read_tp)
+ABISYM(__aeabi_ui2d)
+ABISYM(__aeabi_ui2f)
+ABISYM(__aeabi_uidiv)
+ABISYM(__aeabi_uidivmod)
+ABISYM(__aeabi_ul2d)
+ABISYM(__aeabi_ul2f)
+ABISYM(__aeabi_ulcmp)
+ABISYM(__aeabi_uldivmod)
+
+/* end */
diff --git a/src/backend/jit/llvm/llvmjit.c b/src/backend/jit/llvm/llvmjit.c
index 82c4afb701..b450e70c37 100644
--- a/src/backend/jit/llvm/llvmjit.c
+++ b/src/backend/jit/llvm/llvmjit.c
@@ -606,6 +606,22 @@ llvm_compile_module(LLVMJitContext *context)
              errhidecontext(true)));
 }
 
+/*
+ * Handle any ABI issues.
+ *
+ * Add more entries here for other archs as needed.
+ */
+static void
+llvm_load_abi(void)
+{
+#if (defined(__arm__) || defined(__arm)) && \
+    !(defined(__aarch64__) || defined(__aarch64))
+#define ABISYM(s) { extern void s(void); LLVMAddSymbol(#s, &s); }
+#include "abi_funcs_arm.h"
+#undef ABISYM
+#endif
+}
+
 /*
  * Per session initialization.
  */
@@ -664,6 +680,9 @@ llvm_session_initialize(void)
     LLVMDisposeMessage(features);
     features = NULL;
 
+    /* force load any ABI symbols needed by the platform */
+    llvm_load_abi();
+
     /* force symbols in main binary to be loaded */
     LLVMLoadLibraryPermanently(NULL);


В списке pgsql-hackers по дате отправления:

Предыдущее
От: Andres Freund
Дата:
Сообщение: Re: POC: converting Lists into arrays
Следующее
От: "Takahashi, Ryohei"
Дата:
Сообщение: RE: SQL statement PREPARE does not work in ECPG