Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 11 Sep 2021 12:18:08 -0400
From:      Shawn Webb <shawn.webb@hardenedbsd.org>
To:        Jessica Clarke <jrtc27@freebsd.org>
Cc:        Alex Richardson <arichardson@FreeBSD.org>, "src-committers@freebsd.org" <src-committers@FreeBSD.org>, "dev-commits-src-all@freebsd.org" <dev-commits-src-all@FreeBSD.org>, "dev-commits-src-main@freebsd.org" <dev-commits-src-main@FreeBSD.org>
Subject:   Re: git: 021385aba562 - main - Add WITH_LLVM_BINUTILS to install LLVM binutils instead of Elftoolchain
Message-ID:  <20210911161808.yui4ltlsaih3ajq5@mutt-hbsd>
In-Reply-To: <712AB9FB-E2D8-490F-B9C8-CA9A7A654856@freebsd.org>
References:  <202109060924.1869O2Dk045877@gitrepo.freebsd.org> <20210911144340.pmpxca7obksc7v5g@mutt-hbsd> <712AB9FB-E2D8-490F-B9C8-CA9A7A654856@freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help

[-- Attachment #1 --]
On Sat, Sep 11, 2021 at 03:54:59PM +0100, Jessica Clarke wrote:
> On 11 Sep 2021, at 15:43, Shawn Webb <shawn.webb@hardenedbsd.org> wrote:
> > 
> > On Mon, Sep 06, 2021 at 09:24:02AM +0000, Alex Richardson wrote:
> >> The branch main has been updated by arichardson:
> >> 
> >> URL: https://cgit.FreeBSD.org/src/commit/?id=021385aba56279febcfdcc64d23673a0106ae45d
> >> 
> >> commit 021385aba56279febcfdcc64d23673a0106ae45d
> >> Author:     Alex Richardson <arichardson@FreeBSD.org>
> >> AuthorDate: 2021-09-06 08:49:49 +0000
> >> Commit:     Alex Richardson <arichardson@FreeBSD.org>
> >> CommitDate: 2021-09-06 08:49:49 +0000
> >> 
> >>    Add WITH_LLVM_BINUTILS to install LLVM binutils instead of Elftoolchain
> >> 
> >>    When WITH_LLVM_BINUTILS is set, we will install the LLVM binutils as
> >>    ar/ranlib/nm/objcopy/etc. instead of the elftoolchain ones.
> >>    Having the LLVM binutils instead of the elftoolchain ones allows us to use
> >>    features such as LTO that depend on binutils that understand LLVM IR.
> >>    Another benefit will be an improved user-experience when compiling with
> >>    AddressSanitizer, since ASAN does not symbolize backtraces correctly if
> >>    addr2line is elftoolchain addr2line instead of llvm-symbolizer.
> >>    See https://lists.freebsd.org/archives/freebsd-toolchain/2021-July/000062.html
> >>    for more details.
> >> 
> >>    This is currently off by default but will be turned on by default at some
> >>    point in the near future.
> > 
> > Hey Alex,
> > 
> > It appears when MK_LLVM_BINUTILS is set, a strip binary/link doesn't
> > get installed. So /usr/bin/strip doesn't exist. This causes a problem
> > when building packages since even ports-mgmt/pkg relies on strip.
> > 
> > I'm working on a candidate patch to fix this right now. But if you
> > beat me to the punch, all the better. ;-)
> 
> I guess this:
> 
> diff --git a/usr.bin/clang/llvm-objcopy/Makefile b/usr.bin/clang/llvm-objcopy/Makefile
> index 2e6fc8aba356..afd03b848b19 100644
> --- a/usr.bin/clang/llvm-objcopy/Makefile
> +++ b/usr.bin/clang/llvm-objcopy/Makefile
> @@ -44,8 +44,11 @@ CLEANFILES+=	${TGHDRS} ${TGHDRS:C/$/.d/}
>  
>  LIBADD+=	z
>  
> +LINKS=		${BINDIR}/llvm-objcopy ${BINDIR}/llvm-strip
> +
>  .if ${MK_LLVM_BINUTILS} != "no"
> -LINKS=		${BINDIR}/llvm-objcopy ${BINDIR}/objcopy
> +LINKS+=		${BINDIR}/llvm-objcopy ${BINDIR}/objcopy \
> +		${BINDIR}/llvm-strip ${BINDIR}/strip
>  MLINKS=		llvm-objcopy.1 objcopy.1
>  .endif
>  
> Can’t do MLINKS yet as there’s no generated manpage for llvm-strip; not
> sure what the process is to generate them from the upstream .rst files
> other than “ask dim@ nicely”.

A patch I wrote, nearly exactly similar to yours works. I'd say just
take yours.

Thanks,

-- 
Shawn Webb
Cofounder / Security Engineer
HardenedBSD

https://git.hardenedbsd.org/hardenedbsd/pubkeys/-/raw/master/Shawn_Webb/03A4CBEBB82EA5A67D9F3853FF2E67A277F8E1FA.pub.asc

[-- Attachment #2 --]
-----BEGIN PGP SIGNATURE-----

iQIzBAABCAAdFiEEA6TL67gupaZ9nzhT/y5nonf44foFAmE81r0ACgkQ/y5nonf4
4fqC+g//RkOVOer8A/cw69Pzwt5x8U53e0CFXDy5vVuqMBEXX+nQcQg3RwaPLuGZ
j3b+Cu+nI24RM4mK36/Ey6WkaU7aYImGqjKNC7IMuw9rPXNH5vXs5Zc/G+rnK6L1
MTdNbxpn9CA2+PsjB346RTv07TRWdlf/RSYwolkwjL/kSyU3H+9nfhOKjsXaa2Kf
ccW4WO8/9s8oIOn6fbzsNGjaPbJvRs7NXHg7qHPkQod5yn+G7m9lIsTxdv3EUM9w
fy2uLsjiJjWFko6P3DeUP2qnvVTdRt1drzBvO3HIrO9O2UNfdJUzmc3Piuj04+M5
IMjSZ6Ttq8m69uI1tkUJTDx5dsWnlWIoHBYQNgfwf4pHw/HeR/grMiISpeSbDGLE
8ZbJwOiECOG6JSnKDna6PVHUgQC8yGofBoij8jXVjNCpWYnXNsA+ZRmFCraTgn+R
4/abmwtgg1UiBzZ++jBLNFujeczcQsBd3Fvdj5XXC8/CYHeac5FZFXnBTh8UW8RY
Gg+8fH9TdTHtadgIFcGnyyMY7XhrRlxeKEL4SsQiFCB1/5RTGr5kj0TsWiL3fBfZ
73P94Qbq4Q2LxCd4wke9JExZa/2UIS506P14JGa6IMeL0xqcSO777bgokVuq4/Zz
3fH26pMdjv0eOtoeLdrDes2L/Z0QVi820aq+7j0rx8VfJYGCETo=
=4u6K
-----END PGP SIGNATURE-----

Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20210911161808.yui4ltlsaih3ajq5>