Bug 231431 - multimedia/libfame: fails to link on i386 with lld as the system linker
Summary: multimedia/libfame: fails to link on i386 with lld as the system linker
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Only Me
Assignee: Thomas Zander
URL:
Keywords: patch, patch-ready
Depends on:
Blocks: 214864
  Show dependency treegraph
 
Reported: 2018-09-17 14:42 UTC by Ed Maste
Modified: 2018-10-07 17:35 UTC (History)
2 users (show)

See Also:
riggs: maintainer-feedback+
riggs: merge-quarterly+


Attachments
Fix LLD on i386 (931 bytes, patch)
2018-09-18 02:24 UTC, Nathan
no flags Details | Diff
Fix LLD on i386 (798 bytes, patch)
2018-09-18 02:26 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-09-17 14:42:48 UTC
--- libfame.la ---
/bin/sh ../libtool --mode=link cc  -O2 -pipe  -fstack-protector -fno-strict-aliasing -DHAS_BSWAP -Wall -fexpensive-optimizations -funroll-loops -ffast-math -fomit-frame-pointer -DHAS_MMX   -Wl,-znotext -fstack-protector -fuse-ld=bfd -o libfame.la -rpath /usr/local/lib -release 0.9  -version-info 1:0:0 fame.lo cpuflags.lo fame_profile_mpeg.lo  fame_profile_mpeg1.lo fame_profile_mpeg4_simple.lo  fame_profile_mpeg4_shape.lo fame_profile_stats.lo  fame_encoder_mpeg.lo fame_decoder_mpeg.lo fame_syntax_mpeg1.lo  fame_syntax_mpeg4.lo fame_shape.lo fame_rate_simple.lo  fame_rate_1param.lo fame_rate.lo fame_monitor.lo fame_motion.lo  fame_motion_none.lo fame_motion_fourstep.lo  fame_motion_pmvfast.lo fame_malloc.lo  -lm
rm -fr .libs/libfame.la .libs/libfame.* .libs/libfame-0.9.*
cc -shared  fame.lo cpuflags.lo fame_profile_mpeg.lo fame_profile_mpeg1.lo fame_profile_mpeg4_simple.lo fame_profile_mpeg4_shape.lo fame_profile_stats.lo fame_encoder_mpeg.lo fame_decoder_mpeg.lo fame_syntax_mpeg1.lo fame_syntax_mpeg4.lo fame_shape.lo fame_rate_simple.lo fame_rate_1param.lo fame_rate.lo fame_monitor.lo fame_motion.lo fame_motion_none.lo fame_motion_fourstep.lo fame_motion_pmvfast.lo fame_malloc.lo  -lm -lc  -Wl,-soname -Wl,libfame-0.9.so.1 -o .libs/libfame-0.9.so.1.0.0
/usr/bin/ld: error: can't create dynamic relocation R_386_32 against symbol: _mmx_1 in readonly segment; recompile object files with -fPIC
>>> defined in fame.lo
>>> referenced by fame_encoder_mpeg.c
>>>               fame_encoder_mpeg.lo:(mpeg_encode_intra_mb)

Note this occurs with this change to the Makefile:

diff --git a/multimedia/libfame/Makefile b/multimedia/libfame/Makefile
index c704e0b3e081..25fc1d105cfe 100644
--- a/multimedia/libfame/Makefile
+++ b/multimedia/libfame/Makefile
@@ -15,6 +15,9 @@ INSTALL_TARGET=       install-strip
 USES=          libtool
 USE_LDCONFIG=  yes
 
+LDFLAGS+=      ${LDFLAGS_${ARCH}}
+LDFLAGS_i386=  -Wl,-znotext
+
 OPTIONS_DEFINE=        MMX
 OPTIONS_DEFAULT=MMX

It appears libtool in libfame does not pass the LDFLAGS option through to the link invocation.
Comment 1 Nathan 2018-09-18 02:24:18 UTC
Created attachment 197181 [details]
Fix LLD on i386

Tested inside poudriere by mv'ing /usr/bin/ld.lld to /usr/bin/ld and compiling
Comment 2 Nathan 2018-09-18 02:26:47 UTC
Created attachment 197182 [details]
Fix LLD on i386
Comment 3 Ed Maste freebsd_committer freebsd_triage 2018-09-26 15:55:28 UTC
Patch works for me
Comment 4 commit-hook freebsd_committer freebsd_triage 2018-10-07 17:32:16 UTC
A commit references this bug:

Author: riggs
Date: Sun Oct  7 17:31:14 UTC 2018
New revision: 481465
URL: https://svnweb.freebsd.org/changeset/ports/481465

Log:
  Fix build on i386 with lld as the system linker

  PR:		231431
  Submitted by:	emaste, patch by ndowens@yahoo.com
  Reviewed by:	emaste
  MFH:		2018Q4

Changes:
  head/multimedia/libfame/Makefile
Comment 5 commit-hook freebsd_committer freebsd_triage 2018-10-07 17:34:19 UTC
A commit references this bug:

Author: riggs
Date: Sun Oct  7 17:33:59 UTC 2018
New revision: 481466
URL: https://svnweb.freebsd.org/changeset/ports/481466

Log:
  MFH: r481465

  Fix build on i386 with lld as the system linker

  PR:		231431
  Submitted by:	emaste, patch by ndowens@yahoo.com
  Reviewed by:	emaste

  Approved by:	ports-secteam (riggs)

Changes:
_U  branches/2018Q4/
  branches/2018Q4/multimedia/libfame/Makefile