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: New ---    
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.