Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 844946 - dev-db/postgresql-14.3[llvm]: tests using llvm jit failed on riscv: "with fatal llvm error: Relocation type not implemented yet!"
Summary: dev-db/postgresql-14.3[llvm]: tests using llvm jit failed on riscv: "with fat...
Status: CONFIRMED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: riscv Linux
: Normal normal (vote)
Assignee: PgSQL Bugs
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: riscv-keywording
  Show dependency tree
 
Reported: 2022-05-16 02:57 UTC by Alex Fan
Modified: 2022-08-13 09:42 UTC (History)
2 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
emerge --info (emerge.info,5.38 KB, text/plain)
2022-05-16 02:58 UTC, Alex Fan
Details
build log (postgresql-14.3:20220516-003649.log.gz,55.04 KB, application/gzip)
2022-05-16 02:59 UTC, Alex Fan
Details
regression diffs (regression.diffs.gz,152.98 KB, application/gzip)
2022-05-16 02:59 UTC, Alex Fan
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Alex Fan archtester 2022-05-16 02:57:51 UTC
+FATAL:  fatal llvm error: Relocation type not implemented yet!
+server closed the connection unexpectedly
+	This probably means the server terminated abnormally
+	before or while processing the request.
+connection to server was lost


This should be specific to riscv. USE=llvm enables llvm orc jit. The llvm orc jit api is fully (or nearly) supported on riscv since llvm 14.0.1, but unfortunately in both postgresql and inside orc jit abi, it uses llvm helper function LLVMGetHostCPUFeatures to detect host cpu features (e.g. https://github.com/postgres/postgres/blob/5bcc4d09332844ae369bcf99f18ace1c982b7301/src/backend/jit/llvm/llvmjit.c#L818)

LLVMGetHostCPUFeatures is not implemented at all on riscv, therefore no feature will be enabled except the most generic ones for rv[64|32]-generic.

Reproducible: Always
Comment 1 Alex Fan archtester 2022-05-16 02:58:30 UTC
Created attachment 779168 [details]
emerge --info
Comment 2 Alex Fan archtester 2022-05-16 02:59:29 UTC
Created attachment 779171 [details]
build log
Comment 3 Alex Fan archtester 2022-05-16 02:59:55 UTC
Created attachment 779174 [details]
regression diffs
Comment 4 Alex Fan archtester 2022-05-16 04:11:43 UTC
Looking more into the code. "Relocation type not implemented yet" comes from uostream using the old jit linker RTDyldObjectLinkingLayer, which is in maintainence mode and has no riscv support. https://github.com/postgres/postgres/blob/07d683b54af854098cc559d4b8640905f9efa0ea/src/backend/jit/llvm/llvmjit.c#L1161

We need to wait upstream to upgrade to jitlink that is a newer replacement for rtdylib.