Bug 246157

Summary: riscv64 llint fails to link with lld
Product: WebKit Reporter: Daniel Kolesa <dkolesa>
Component: JavaScriptCoreAssignee: Nobody <webkit-unassigned>
Status: RESOLVED FIXED    
Severity: Normal CC: webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: WebKit Local Build   
Hardware: Other   
OS: Linux   

Description Daniel Kolesa 2022-10-06 08:15:58 PDT
When using riscv64 LLint on webkitgtk or WPE 2.38 with clang+lld, linking fails:

ld: error: relocation R_RISCV_PCREL_HI20 cannot be used against symbol 'g_opcodeMap'; recompile with -fPIC

(the actual log is much longer, but the same stuff)

This is because the generated assembly uses the lla pseudoinstruction which forces PC-relative addressing but with non-local symbols. The bfd linker somehow eats it, while the lld linker does not. The fix here is to use a GOT lookup (la).
Comment 1 Daniel Kolesa 2022-10-06 08:26:09 PDT
Pull request: https://github.com/WebKit/WebKit/pull/5086
Comment 2 EWS 2022-10-08 06:11:21 PDT
Committed 255311@main (3127e0a5094b): <https://commits.webkit.org/255311@main>

Reviewed commits have been landed. Closing PR #5086 and removing active labels.
Comment 3 Radar WebKit Bug Importer 2022-10-08 06:12:16 PDT
<rdar://problem/100933102>