Bug 230213 - math/p5-Math-Pari: fail to link with lld as /usr/bin/ld on i386
Summary: math/p5-Math-Pari: fail to link with lld as /usr/bin/ld on i386
Status: New
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: i386 Any
: --- Affects Only Me
Assignee: freebsd-perl mailing list
URL:
Keywords:
Depends on:
Blocks: 214864
  Show dependency treegraph
 
Reported: 2018-07-30 23:58 UTC by Ed Maste
Modified: 2019-07-24 19:29 UTC (History)
1 user (show)

See Also:
bugzilla: maintainer-feedback? (perl)


Attachments
Fix LLD on i386 (1.03 KB, patch)
2018-09-18 23:42 UTC, Nathan
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Ed Maste freebsd_committer 2018-07-30 23:58:15 UTC
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 math/p5-Math-Pari with lld fails with errors of the form:

/usr/bin/ld: error: can't create dynamic relocation R_386_32 against local symbol in readonly segment; recompile object files with -fPIC
>>> defined in mp.o
>>> referenced by mp.c
>>>               mp.o:(pari_kernel_init)

/usr/bin/ld: error: can't create dynamic relocation R_386_32 against symbol: gpmalloc in readonly segment; recompile object files with -fPIC
>>> defined in init.o
>>> referenced by mp.c
>>>               mp.o:(pari_kernel_init)

http://package18.nyi.freebsd.org/data/headi386PR214864-default/2018-07-30_18h09m59s/logs/errors/p5-Math-Pari-2.01080900.log
Comment 1 Nathan 2018-09-11 04:00:23 UTC
I added -fuse-ld=lld to LDFLAGS and it currently has LLD_UNSAFE=yes already in ports and I did not get an error in poudriere on 12-current i386
Comment 2 Ed Maste freebsd_committer 2018-09-17 15:20:36 UTC
(In reply to Nathan from comment #1)
It looks like this port does not honour LDFLAGS, so adding -fuse-ld=lld there likely has no effect.

With LLD_UNSAFE=yes and -Wl,-znotext in LDFLAGS it still fails with:

cc  -o libpari-gmp.so.2.3.5 -shared  -O2 -pipe  -I/usr/ports/math/p5-Math-Pari/work/pari-2.3.5/src/headers -I/usr/ports/math/p5-Math-Pari/work/pari-2.3.5/build -fstack-protector -fno-strict-aliasing  -Wl,-shared,-soname=libpari-gmp.so.2 mp.o mpinl.o Flx.o Qfb.o RgX.o alglin1.o alglin2.o arith1.o arith2.o base1.o base2.o base3.o base4.o base5.o bibli1.o bibli2.o buch1.o buch2.o buch3.o buch4.o galconj.o gen1.o gen2.o gen3.o ifactor1.o perm.o polarit1.o polarit2.o polarit3.o rootpol.o subcyclo.o subgroup.o trans1.o trans2.o trans3.o anal.o compat.o default.o errmsg.o es.o init.o intnum.o members.o sumiter.o aprcl.o elldata.o elliptic.o galois.o groupid.o kummer.o mpqs.o nffactor.o part.o stark.o subfield.o thue.o -lc -lm -L/usr/local/lib -lgmp 
/usr/bin/ld: error: can't create dynamic relocation R_386_32 against local symbol in readonly segment; recompile object files with -fPIC
>>> defined in mp.o
>>> referenced by mp.c
>>>               mp.o:(pari_kernel_init)
Comment 3 Nathan 2018-09-18 23:42:37 UTC
Created attachment 197219 [details]
Fix LLD on i386

Tried with and without patch on 12-i386
Comment 4 Nathan 2018-09-18 23:45:14 UTC
Just tested it on 11.2 poudriere jail successfully
Comment 5 Ed Maste freebsd_committer 2018-09-18 23:49:41 UTC
Comment on attachment 197219 [details]
Fix LLD on i386

Patch looks reasonable
Comment 6 Nathan 2018-09-18 23:52:23 UTC
(In reply to Ed Maste from comment #5)
Makefile.PL pulls the info from config/ldflags, and it had just -Wl in the script, so replaced it and worked
Comment 7 Ed Maste freebsd_committer 2018-09-26 15:25:27 UTC
Patch works for me.
Comment 8 Ed Maste freebsd_committer 2019-07-24 19:29:42 UTC
lld has been enabled as system linker for i386 on stable/12 in advance of 12.1