Bug 226975 - x11/eaglemode: fails to link with lld as the system linker
Summary: x11/eaglemode: fails to link with lld as the system linker
Status: Closed Overcome By Events
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Only Me
Assignee: Dmitry Marakasov
URL:
Keywords:
Depends on:
Blocks: 214864
  Show dependency treegraph
 
Reported: 2018-03-27 13:21 UTC by Ed Maste
Modified: 2019-01-11 16:12 UTC (History)
2 users (show)

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


Attachments
Fix LLD build (510 bytes, patch)
2018-09-10 13:23 UTC, Nathan
no flags Details | Diff
Fix LLD (538 bytes, patch)
2018-09-10 13:29 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 freebsd_triage 2018-03-27 13:21:15 UTC
I'm working on switching to LLVM's lld linker as the FreeBSD system linker (/usr/bin/ld)[1], and the port in this PR is reported as a new failure in the exp-run, PR 214864.

An excerpt from the build log[2]:
---
/usr/bin/ld: error: cannot preempt symbol: xine_check_version
>>> defined in /usr/local/lib/libxine.so
>>> referenced by emAvServerProc_xine.c
>>>               obj/emAvServerProc_xine.o:(main)

/usr/bin/ld: error: cannot preempt symbol: xine_new
>>> defined in /usr/local/lib/libxine.so
>>> referenced by emAvServerProc_xine.c
>>>               obj/emAvServerProc_xine.o:(main)
---

Known issues in this port or in lld that affect this port:
(3) Shared library protected symbol preemption.

reeBSD 11 and later have lld available as /usr/bin/ld.lld, so one simple option for testing is to just symlink /usr/bin/ld to ld.lld (and restore it to ld.bfd).

A port Makefile knob, LLD_UNSAFE=yes, exists to indicate that a port does not work with lld, and requires either /usr/bin/ld.bfd or binutils from ports. This should work for the common case of ports written in C using GNU autoconf; it may have no effect on other ports.

[1] https://lists.freebsd.org/pipermail/freebsd-current/2018-March/068985.html
[2] http://package18.nyi.freebsd.org/data/headamd64PR214864-default/2018-03-21_17h43m11s/logs/errors/eaglemode-0.93.1.log
Comment 1 Ed Maste freebsd_committer freebsd_triage 2018-03-27 21:01:11 UTC
Via tobik@ in ports r465725, BINARY_ALIAS=ld=ld.bfd may be an effective workaround if LLD_UNSAFE does not work.
Comment 2 Ed Maste freebsd_committer freebsd_triage 2018-03-28 01:05:50 UTC
Followup, if BINARY_ALIAS is used it should be in addition to LLD_UNSAFE, so that architectures without a /usr/bin/ld.bfd (arm64) work. If possible LLD_UNSAFE=yes should imply BINARY_ALIAS=ld=ld.bfd, under discussion on the ports mailing list.
Comment 3 Walter Schwarzenfeld freebsd_triage 2018-03-28 02:34:06 UTC
Has stack-protector only from bsd.ssp.mk. Only need SSP_UNSAFE=yes.
Comment 4 Ed Maste freebsd_committer freebsd_triage 2018-04-02 15:05:13 UTC
(In reply to w.schwarzenfeld from comment #3)
The failure here does not appear to be related to bsd.ssp.mk - in that case the issue is that -fstack-protector... gets passed to the link invocation; that is not happening here.
Comment 5 Ed Maste freebsd_committer freebsd_triage 2018-04-02 15:09:30 UTC
For reference, 0 dependent ports are skipped as a result of this issue when using lld as the system linker (http://package18.nyi.freebsd.org/build.html?mastername=headamd64PR214864-default&build=2018-03-21_17h43m11s)
Comment 6 Ed Maste freebsd_committer freebsd_triage 2018-04-05 13:36:52 UTC
LLD_UNSAFE is insufficient; with it we still have:

Making directory: lib/emAv
xine-config is DEPRECATED. Use pkg-config instead.
cc -O2 -pipe -fstack-protector -fno-strict-aliasing -fexceptions -fmessage-length=0 -Wall -Winline -Wpointer-arith -Wredundant-decls -Wsign-compare -Wwrite-strings -Iinclude -I/usr/local/include -c src/emAv/emAvServerProc_xine.c -o obj/emAvServerProc_xine.o
cc -Llib -L/usr/local/lib obj/emAvServerProc_xine.o -lxine -L/usr/local/lib -lxine -lm -o lib/emAv/emAvServerProc_xine
/usr/bin/ld: error: cannot preempt symbol: xine_check_version
>>> defined in /usr/local/lib/libxine.so
>>> referenced by emAvServerProc_xine.c
>>>               obj/emAvServerProc_xine.o:(main)
...
Comment 7 Nathan 2018-09-10 11:52:15 UTC
LDFLAGS=-Wl,-z,notext didn’t work but adding -fPIC  to flags did
Comment 8 Nathan 2018-09-10 13:23:23 UTC
Created attachment 197004 [details]
Fix LLD build
Comment 9 Nathan 2018-09-10 13:29:09 UTC
Created attachment 197005 [details]
Fix LLD
Comment 10 Ed Maste freebsd_committer freebsd_triage 2018-10-02 17:52:26 UTC
Patch LGTM
Comment 11 Dmitry Marakasov freebsd_committer freebsd_triage 2018-12-28 18:19:10 UTC
Neither LLD_UNSAFE nor extra compiler flags are needed after r488328
Comment 13 Dmitry Marakasov freebsd_committer freebsd_triage 2019-01-11 16:05:44 UTC
It was fixed on Jan 8th.
Comment 14 Ed Maste freebsd_committer freebsd_triage 2019-01-11 16:12:29 UTC
(In reply to Dmitry Marakasov from comment #13)
> It was fixed on Jan 8th.

Thanks, I didn't notice the change - sorry for the false alarm.