Friday, January 04, 2019

Re: [stu@spacehopper.org: RFC: USE_LLD=No for default-is-lld arches]

On Wed, Jan 02, 2019 at 10:16:16PM +0000, Stuart Henderson wrote:
> On 2018/12/28 02:53, Marc Espie wrote:
> > > +.if ${_LD_PROGRAM} != ${_LD_DEFAULT}
> > > +_NONDEFAULT_LD = Yes
> > > +.else
> > > +_NONDEFAULT_LD = No
> > > +.endif
> > > +
> > What's this ? Especially where does _LD_DEFAULT come from ?
>
> That was a remnant of an earlier version from before I spotted that lld
> was in PROPERTIES. Removing that and fixing up the bug uncovered as a
> result gives this (tested on a lld and ld.bfd arches with Yes/No)::
>
> Index: bsd.port.mk
> ===================================================================
> RCS file: /cvs/ports/infrastructure/mk/bsd.port.mk,v
> retrieving revision 1.1459
> diff -u -p -r1.1459 bsd.port.mk
> --- bsd.port.mk 12 Dec 2018 16:17:30 -0000 1.1459
> +++ bsd.port.mk 2 Jan 2019 22:12:06 -0000
> @@ -393,12 +393,6 @@ BASELOCALSTATEDIR ?= ${VARBASE}
> LOCALSTATEDIR ?= ${BASELOCALSTATEDIR}
>
> RCDIR ?= /etc/rc.d
> -USE_LLD ?= No
> -.if ${USE_LLD:L} == "yes"
> -_LD_PROGRAM = /usr/bin/ld.lld
> -.else
> -_LD_PROGRAM = /usr/bin/ld
> -.endif
> USE_WXNEEDED ?= No
> .if ${USE_WXNEEDED:L} == "yes"
> _WXNEEDED_FLAGS = -z wxneeded
> @@ -798,6 +792,25 @@ CONFIGURE_ENV += ${_EXTRA_ENV}
> MAKE_ENV += ${_EXTRA_ENV}
> .endif
>
> +.if ${PROPERTIES:Mlld}
> +USE_LLD ?= Yes
> +.else
> +USE_LLD ?= No
> +.endif
> +
> +.if ${USE_LLD:L} == "yes"
> +_LD_PROGRAM = /usr/bin/ld.lld
> +. if ! ${PROPERTIES:Mlld}
> +_NONDEFAULT_LD = Yes
> +. endif
> +.else
> +_LD_PROGRAM = /usr/bin/ld.bfd
> +. if ${PROPERTIES:Mlld}
> +_NONDEFAULT_LD = Yes
> +. endif
> +.endif
> +_NONDEFAULT_LD ?= No
> +
> # setup locations of compilers from the base system or environment variables.
> # MODULES for compilers (gcc4.port.mk, clang.port.mk) also append to this,
> # used to write wrappers to WRKDIR/bin which is at the head of the PATH.
> @@ -2673,13 +2686,15 @@ ${_PATCH_COOKIE}: ${_EXTRACT_COOKIE}
>
> # Run as _pbuild
> _post-patch-finalize:
> -.if ${USE_WXNEEDED:L} == "yes" || ${USE_LLD:L} == "yes"
> +.if ${USE_WXNEEDED:L} == "yes"
> @wrktmp=`df -P ${WRKOBJDIR_${PKGPATH}} | awk 'END { print $$6 }'`; \
> if ! mount | grep -q " $${wrktmp} .*wxallowed"; then \
> echo "Fatal: ${WRKOBJDIR_${PKGPATH}} must be on a wxallowed filesystem" \
> "(in ${PKGPATH})" >&2; \
> false; \
> fi
> +.endif
> +.if ${USE_WXNEEDED:L} == "yes" || ${_NONDEFAULT_LD:L} == "yes"
> @printf '#!/bin/sh\nexec ${_LD_PROGRAM} ${_WXNEEDED_FLAGS} "$$@"\n' >${WRKDIR}/bin/ld
> @chmod 555 ${WRKDIR}/bin/ld
> .endif

Looks good. Okay for me.

No comments:

Post a Comment