On Wed, Dec 04, 2019 at 10:48:06AM +0000, Stuart Henderson wrote:
> Currently LLD_EMUL is only set for LLD_ARCHS (aarch64 amd64 arm i386).
> A diff to unbreak mupdf build on mips64 requires linking with lld and this
> variable is required. Rather than adding a custom LLD_EMUL definition in
> mupdf let's just make the arch-defines.mk one reachable.
> 
> OK?
> 
> Index: arch-defines.mk
> ===================================================================
> RCS file: /cvs/ports/infrastructure/mk/arch-defines.mk,v
> retrieving revision 1.69
> diff -u -p -1 -1 -r1.69 arch-defines.mk
> --- arch-defines.mk   9 Nov 2019 15:08:09 -0000       1.69
> +++ arch-defines.mk   4 Dec 2019 10:45:44 -0000
> @@ -57,23 +57,23 @@ DEBUG_PACKAGES =
>  DEBUG_FILES =
>  .endif
>  
>  .if ${PROPERTIES:Mclang}
>  LIBCXX = c++ c++abi pthread
>  LIBECXX = c++ c++abi pthread
>  .else
>  LIBCXX = stdc++ pthread
>  LIBECXX = estdc++>=17 pthread
>  .endif
>  
> -.if ${PROPERTIES:Mlld}
> +.if ${PROPERTIES:Mlld} || defined(USE_LLD) && ${USE_LLD:L} == yes
>  # see llvm/tools/lld/ELF/Driver.cpp
>  .  for A in aarch64.aarch64elf amd64.elf_amd64 arm.armelf i386.elf_i386 \
>              mips64.elf64btsmip mips64el.elf64ltsmip powerpc.elf32ppc \
>              sparc64.elf64_sparc
>  .    if ${MACHINE_ARCH} == ${A:R}
>  LLD_EMUL = -m${A:E}
>  .    endif
>  .  endfor
>  .else
>  LLD_EMUL =
>  .endif
> 
Would there be a downside to just always set LLD_EMUL ?

By the way, I would probably code it differently to avoid the loop and
expensive computations:
_LLD_EMUL_aarch64 = aarch64elf
...
.if defined(_LLD_EMUL_${MACHINE_ARCH})
LLD_EMUL = -m${_LLD_EMUL_${MACHINE_ARCH}}
.else
LLD_EMUL = 
.endif

Reply via email to