The migration to the LLVM project's lld linker as the system linker (/usr/bin/ld) for FreeBSD is in progress - it is the case for arm64 and amd64 today, and i386 will switch once ports issues are addressed - see exp-run in PR214864. Linking lang/ocaml with lld as /usr/bin/ld on i386 produces errors of the form: /usr/bin/ld: error: can't create dynamic relocation R_386_32 against symbol: caml_last_return_address in readonly segment; recompile object files with -fPIC >>> defined in roots.pic.o >>> referenced by i386.pic.o:(.text+0x4) http://package18.nyi.freebsd.org/data/headi386PR214864-default/2018-07-30_18h09m59s/logs/errors/ocaml-4.02.3.log
Created attachment 197068 [details] Fixes LLD build on i386
Tested patch 12-current i386 after verifying issue and re-tested after patch to verify this fixed it
Nathan sorry I did not notice your patch before submitting review D17200 https://reviews.freebsd.org/D17200 I tried limiting the effect of the patch by setting -znotext only on i386.
(In reply to Ed Maste from comment #3) Nah it’s fine. I should have done that as well anyway just didn’t think about it when doing these :)
A commit references this bug: Author: emaste Date: Tue Sep 18 16:05:15 UTC 2018 New revision: 480033 URL: https://svnweb.freebsd.org/changeset/ports/480033 Log: lang/ocaml: add -znotext to LDFLAGS on i386, for lld Example error: /usr/bin/ld: error: can't create dynamic relocation R_386_32 against symbol: caml_last_return_address in readonly segment; recompile object files with -fPIC This port links some non-PIC code, which fails with lld as it defaults to disallowing relocations against read-only segments. For i386 we can just add -znotext unconditionally: for GNU BFD ld it just affirms BFD's existing default. PR: 214864, 230209 Approved by: bapt Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D17200 Changes: head/lang/ocaml/Makefile