Bug 234858

Summary: security/veracrypt: fails to build on i386 with lld as system linker
Product: Ports & Packages Reporter: Ed Maste <emaste>
Component: Individual Port(s)Assignee: Jose Alonso Cardenas Marquez <acm>
Status: Closed FIXED    
Severity: Affects Only Me Flags: bugzilla: maintainer-feedback? (acm)
Priority: ---    
Version: Latest   
Hardware: Any   
OS: Any   
Bug Depends on:    
Bug Blocks: 214864    

Description Ed Maste freebsd_committer 2019-01-11 14:02:17 UTC
http://package18.nyi.freebsd.org/build.html?mastername=headi386PR214864-default&build=2019-01-05_21h00m02s
http://package18.nyi.freebsd.org/data/headi386PR214864-default/2019-01-05_21h00m02s/logs/errors/veracrypt-1.23_1.log

Linking veracrypt
ld: error: can't create dynamic relocation R_386_32 against symbol: t_fn in readonly segment; recompile object files with -fPIC or pass '-Wl,-z,notext' to allow text relocations in the output
>>> defined in /wrkdirs/usr/ports/security/veracrypt/work/veracrypt-1.23_1/src/Volume/Volume.a(Aestab.o)
>>> referenced by ../Crypto/Aes_x86.asm
>>>               Aes_x86.o:(.text+0x78) in archive /wrkdirs/usr/ports/security/veracrypt/work/veracrypt-1.23_1/src/Volume/Volume.a

ld: error: can't create dynamic relocation R_386_32 against symbol: t_fn in readonly segment; recompile object files with -fPIC or pass '-Wl,-z,notext' to allow text relocations in the output
>>> defined in /wrkdirs/usr/ports/security/veracrypt/work/veracrypt-1.23_1/src/Volume/Volume.a(Aestab.o)
>>> referenced by ../Crypto/Aes_x86.asm
>>>               Aes_x86.o:(.text+0x82) in archive /wrkdirs/usr/ports/security/veracrypt/work/veracrypt-1.23_1/src/Volume/Volume.a
...

Presumably Aes_x86.asm is non-PIC code, and linking with -znotext will be a suitable workaround. This can be accomplished by adding LDFLAGS_i386=-Wl,-z,notext to the port's Makefile, if it honours LDFLAGS.
Comment 1 Ed Maste freebsd_committer 2019-07-24 19:35:11 UTC
lld has been enabled as system linker for i386 on stable/12 in advance of 12.1 (base svn r350297, a few minutes ago)
Comment 2 commit-hook freebsd_committer 2019-09-05 04:41:05 UTC
A commit references this bug:

Author: acm
Date: Thu Sep  5 04:40:35 UTC 2019
New revision: 511154
URL: https://svnweb.freebsd.org/changeset/ports/511154

Log:
  - Fix build on i386

  PR:		234858
  Reported by:	emaste

Changes:
  head/security/veracrypt/Makefile
  head/security/veracrypt/files/patch-src_Makefile