From nobody Fri Mar 14 18:04:57 2025 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4ZDsj54J45z5qXvg; Fri, 14 Mar 2025 18:05:13 +0000 (UTC) (envelope-from eduardo@freebsd.org) Received: from smtp.freebsd.org (smtp.freebsd.org [96.47.72.83]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "smtp.freebsd.org", Issuer "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4ZDsj51Cf2z3Kvw; Fri, 14 Mar 2025 18:05:13 +0000 (UTC) (envelope-from eduardo@freebsd.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1741975513; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=gn4PpIxSGTPk3a5Nej/oUS/2lp3GPZJ2YZC21O78wsU=; b=gJgDq3ADbgqoDM67VIsBUIrkkMEFYdyClDTmmWN9ezkz3v50A6DSgAi1TpbHRsP1+kyk6d /8EF9mpNlSGFVRAi0fwS9CU+iG7I2SbJGMrC4OETPJpCBd3ZH8KvoKf6kj3XNAACYhYNjR FY69/Dds/dobaAbg4oo5wSGKRWiFE3qBM5HE9Xk6YgEXNT71mMp2oEfMplWacpt33Kh2JR 06nWpfrs9z0v17vhZgKXig/MJJMchWX1/j9hDszu5bk6tBRo8xWl3xjzwdjrHyqrzeH+S5 R+tTcNX8Kz8CfkZUuX0/HB8O651CBEde3pi6yz8ajs2yo/07R6bfqDM92SU5Jw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1741975513; a=rsa-sha256; cv=none; b=BvuBqF3i07BR5Qj9UTYRMNjSLB2R89c6QSggy8Ymib1MX+v5bF0O9oZJ6v7Q8JdODdOavO p7uu7dYu10UGaq8bYJKNcDJ9DsJcgmecntCUbLtZiB1+e/TA/JJA0bbixV7LNB77TfMdep H/nitUKRsjG4kD0Of2HTQKhE3S7jRD6gAj98sXs5Vlsrvw1ktQ4cZaqDkclbppX9Xv/JdB kjYBIpHSe9tywU/etlltDVihzqUEJZugErqWFAJLk4pNY7R+IK34UdKTnNczGN5c628kt6 A0AUQwKXoz4J8FkqlBAsRHQymTsEvZydunteJ0oaHAUb2FGGluB0z6tMUAJHrw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1741975513; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=gn4PpIxSGTPk3a5Nej/oUS/2lp3GPZJ2YZC21O78wsU=; b=lPGt2fdUVRs5qEwLFG+d65AVHc7qSUprLsl//SYCs7FdWf9wu+zrxpjjkG7XwnE+CZRc+M 7n5bKMm6vyt0daBOmysyyII1VzGvb/SRJqCu7nKpgavuVpATPWSd28wE03ZYXx6sEO/9Kt tBsIRL55SoHVpByAxpzlLELY5GYk5LSiXitSgiLe/PHqoVN4SeTDRSDMJH0dDUhEJBg2jE Q9tVPUIWF7etI3OFSDu32RYQiLFFRD50ZSZ4vunNypPkw6gyPrfA7uQG1WtuaDvonmye+r 4gFQBi3O0kUotTvvsEcgbM+ha1L1ishb1xei0UJf/iqdw+GsEA8Dqj+mugNJEg== Received: from mail-qt1-f169.google.com (mail-qt1-f169.google.com [209.85.160.169]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "WR4" (verified OK)) (Authenticated sender: eduardo) by smtp.freebsd.org (Postfix) with ESMTPSA id 4ZDsj50J5yz6vG; Fri, 14 Mar 2025 18:05:13 +0000 (UTC) (envelope-from eduardo@freebsd.org) Received: by mail-qt1-f169.google.com with SMTP id d75a77b69052e-47680c117fdso1875461cf.2; Fri, 14 Mar 2025 11:05:13 -0700 (PDT) X-Forwarded-Encrypted: i=1; AJvYcCW2yLTkYGbnJ658Y1t80ALKW7s1aB7t0qYJ3/+lQQtfziFIzSLfGKxWjD22Wr37eWvkp2zXmKN352wZLsIdHn2rHOD6cqE=@freebsd.org, AJvYcCXKOhgatJXTJ/YJVj4AMR3HaRoJKszldQegka32A883W8Zl65IPlUDSR3Eb4p6RvAdDmz2+eUPfE/Lc/4xNvTNTfmAW@freebsd.org X-Gm-Message-State: AOJu0YwWFOfm0C683PyZwIl3qnyx7Agg8S6EhOFQePKwbZOcKTHEN+j3 d8MP8IbQeAGbMCwpAPhpIf4izQCjH5UF0TK9L2Kg8MJiXvymn75Sa98psvK0/1KFdxxtaZoocCc KkL9FdRZ5G6iUI0K02eIz44gyVbk= X-Google-Smtp-Source: AGHT+IHo0mzms2DNw8Tdzh01BJmtu6ziAKTiyvpww1wfsksfHuMFxWWK9os05OGuaOGJEVYiG1uE3HPia6vO4hxp40M= X-Received: by 2002:ac8:5f51:0:b0:476:add4:d2b6 with SMTP id d75a77b69052e-476c810b961mr18755291cf.1.1741975512174; Fri, 14 Mar 2025 11:05:12 -0700 (PDT) List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 References: <202503141729.52EHTYis008114@gitrepo.freebsd.org> In-Reply-To: <202503141729.52EHTYis008114@gitrepo.freebsd.org> From: Nuno Teixeira Date: Fri, 14 Mar 2025 18:04:57 +0000 X-Gmail-Original-Message-ID: X-Gm-Features: AQ5f1JqpKu_CL03k70NssnYe_9qHJCq6vXHVGNkEBK4kbS2PFCNdgyczgi-IO3I Message-ID: Subject: Re: git: 1cae7121c667 - main - Enable LLVM_BINUTILS by default To: Ed Maste Cc: src-committers@freebsd.org, dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org Content-Type: multipart/alternative; boundary="0000000000009c575b06305147fd" --0000000000009c575b06305147fd Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Hello Ed, I have a newbie question about building world/kernel with LTO. I did not found too much info googling, but I found https://wiki.freebsd.org/LinkTimeOptimization and it says: Build and link a kernel with: WITHOUT_CTF=3Dyes WITHOUT_DTRACE=3Dyes sys/conf/kern.mk -flto=3Dthin (for all clang invocations) Is this the correct way to test LTO atm? Thanks, Ed Maste escreveu (sexta, 14/03/2025 =C3=A0(s) 17:29): > The branch main has been updated by emaste: > > URL: > https://cgit.FreeBSD.org/src/commit/?id=3D1cae7121c667d9caf205832cf45fd02= af3157e6f > > commit 1cae7121c667d9caf205832cf45fd02af3157e6f > Author: Ed Maste > AuthorDate: 2021-07-12 19:32:00 +0000 > Commit: Ed Maste > CommitDate: 2025-03-14 17:29:06 +0000 > > Enable LLVM_BINUTILS by default > > Starting in 2014 FreeBSD migrated from GNU binutils to ELF Tool Chain > tools. At that time there were no usable LLVM versions of those tool= s, > but they have been developing rapidly since then. Migrate to LLVML's > tools for both functionality and maintainability reasons. > > This will eventually support the use of link-time optimization (LTO) = in > the FreeBSD base system. LTO runs optimization passes over the entir= e > executable (or library) at link time and thus allows for more effecti= ve > optimization than when performed on individual compilation units. > > When using LTO object files (.o) including those contained in static > library archives (.a) contain LLVM IR bitcode rather than target > object code. This means that utilities that operate on object files > need to support LLVM IR. > > As with ELF Tool Chain the LLVM tools aim for command line and output > format compatibility with GNU binutils, although there are a few mino= r > differences. Where these cause a material issue (breaking a port or > eliminating required functionality) we can submit LLVM bugs and work > on patches. > > PR: 258872 (exp-run) > Reviewed by: bapt > Sponsored by: The FreeBSD Foundation > Differential Revision: https://reviews.freebsd.org/D49361 > --- > UPDATING | 5 +++++ > share/man/man5/src.conf.5 | 16 ++++++++++++---- > share/mk/src.opts.mk | 2 +- > 3 files changed, 18 insertions(+), 5 deletions(-) > > diff --git a/UPDATING b/UPDATING > index 15941028c5bb..6989bb7c7f99 100644 > --- a/UPDATING > +++ b/UPDATING > @@ -27,6 +27,11 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 15.x IS SLOW: > world, or to merely disable the most expensive debugging > functionality > at runtime, run "ln -s 'abort:false,junk:false' /etc/malloc.conf"= .) > > +20250314: > + We now use LLVM's binary utilities (nm, objcopy, etc.) by default= . > + The WITHOUT_LLVM_BINUTILS src.conf(5) knob can be used to revert = to > + ELF Tool Chain tools if desired. > + > 20250303: > Commit 4a77657cbc01 changed the ABI between ipfw(8) and ipfw(4). > Please note that the old ipfw(8) binary will not work with the ne= w > diff --git a/share/man/man5/src.conf.5 b/share/man/man5/src.conf.5 > index 30b5d308724a..321eea708d04 100644 > --- a/share/man/man5/src.conf.5 > +++ b/share/man/man5/src.conf.5 > @@ -1,5 +1,5 @@ > .\" DO NOT EDIT-- this file is @generated by tools/build/options/makeman= . > -.Dd January 31, 2025 > +.Dd March 14, 2025 > .Dt SRC.CONF 5 > .Os > .Sh NAME > @@ -933,9 +933,8 @@ the build. > To be able to build the system an alternate linker must be provided via > XLD. > .It Va WITHOUT_LLVM_ASSERTIONS > Disable debugging assertions in LLVM. > -.It Va WITH_LLVM_BINUTILS > -Install LLVM's binutils (without an llvm- prefix), > -instead of ELF Tool Chain's tools. > +.It Va WITHOUT_LLVM_BINUTILS > +Install ELF Tool Chain's binary utilities instead of LLVM's. > This includes > .Xr addr2line 1 , > .Xr ar 1 , > @@ -1762,6 +1761,15 @@ When set, it enforces these options: > .It > .Va WITHOUT_LLVM_COV > .El > +.Pp > +When set, these options are also in effect: > +.Pp > +.Bl -inset -compact > +.It Va WITHOUT_LLVM_BINUTILS > +(unless > +.Va WITH_LLVM_BINUTILS > +is set explicitly) > +.El > .It Va WITH_UBSAN > Build the base system with Undefined Behavior Sanitizer (UBSan) to detec= t > various kinds of undefined behavior at runtime. > diff --git a/share/mk/src.opts.mk b/share/mk/src.opts.mk > index f3141884cd00..ef8711db713f 100644 > --- a/share/mk/src.opts.mk > +++ b/share/mk/src.opts.mk > @@ -124,6 +124,7 @@ __DEFAULT_YES_OPTIONS =3D \ > LLD \ > LLD_BOOTSTRAP \ > LLVM_ASSERTIONS \ > + LLVM_BINUTILS \ > LLVM_COV \ > LLVM_CXXFILT \ > LOADER_BIOS_TEXTONLY \ > @@ -208,7 +209,6 @@ __DEFAULT_NO_OPTIONS =3D \ > HESIOD \ > LOADER_VERBOSE \ > LOADER_VERIEXEC_PASS_MANIFEST \ > - LLVM_BINUTILS \ > LLVM_FULL_DEBUGINFO \ > MALLOC_PRODUCTION \ > OFED_EXTRA \ > > --=20 Nuno Teixeira FreeBSD UNIX: Web: https://FreeBSD.org --0000000000009c575b06305147fd Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Hello Ed,

I have a newbie qu= estion about building world/kernel with LTO.
I did not found too = much info googling, but I found https://wiki.freebsd.org/LinkTimeOptimization and it say= s:

Build and link a kernel with:

WITHOUT_CTF= =3Dyes
WITHOUT_DTRACE=3Dyes
sys/conf/kern.= mk -flto=3Dthin (for all clang invocations)

Is this the c= orrect way to test LTO atm?

Thanks,
Ed Maste <emaste@free= bsd.org> escreveu (sexta, 14/03/2025 =C3=A0(s) 17:29):
The branch main has been upda= ted by emaste:

URL: https://cgit.= FreeBSD.org/src/commit/?id=3D1cae7121c667d9caf205832cf45fd02af3157e6f
commit 1cae7121c667d9caf205832cf45fd02af3157e6f
Author:=C2=A0 =C2=A0 =C2=A0Ed Maste <emaste@FreeBSD.org>
AuthorDate: 2021-07-12 19:32:00 +0000
Commit:=C2=A0 =C2=A0 =C2=A0Ed Maste <emaste@FreeBSD.org>
CommitDate: 2025-03-14 17:29:06 +0000

=C2=A0 =C2=A0 Enable LLVM_BINUTILS by default

=C2=A0 =C2=A0 Starting in 2014 FreeBSD migrated from GNU binutils to ELF To= ol Chain
=C2=A0 =C2=A0 tools.=C2=A0 At that time there were no usable LLVM versions = of those tools,
=C2=A0 =C2=A0 but they have been developing rapidly since then.=C2=A0 Migra= te to LLVML's
=C2=A0 =C2=A0 tools for both functionality and maintainability reasons.

=C2=A0 =C2=A0 This will eventually support the use of link-time optimizatio= n (LTO) in
=C2=A0 =C2=A0 the FreeBSD base system.=C2=A0 LTO runs optimization passes o= ver the entire
=C2=A0 =C2=A0 executable (or library) at link time and thus allows for more= effective
=C2=A0 =C2=A0 optimization than when performed on individual compilation un= its.

=C2=A0 =C2=A0 When using LTO object files (.o) including those contained in= static
=C2=A0 =C2=A0 library archives (.a) contain LLVM IR bitcode rather than tar= get
=C2=A0 =C2=A0 object code.=C2=A0 This means that utilities that operate on = object files
=C2=A0 =C2=A0 need to support LLVM IR.

=C2=A0 =C2=A0 As with ELF Tool Chain the LLVM tools aim for command line an= d output
=C2=A0 =C2=A0 format compatibility with GNU binutils, although there are a = few minor
=C2=A0 =C2=A0 differences.=C2=A0 Where these cause a material issue (breaki= ng a port or
=C2=A0 =C2=A0 eliminating required functionality) we can submit LLVM bugs a= nd work
=C2=A0 =C2=A0 on patches.

=C2=A0 =C2=A0 PR:=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0258872 (ex= p-run)
=C2=A0 =C2=A0 Reviewed by:=C2=A0 =C2=A0 bapt
=C2=A0 =C2=A0 Sponsored by:=C2=A0 =C2=A0The FreeBSD Foundation
=C2=A0 =C2=A0 Differential Revision: https://reviews.freebsd.org/D= 49361
---
=C2=A0UPDATING=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 |=C2=A0 5 +++++
=C2=A0share/man/man5/src.conf.5 | 16 ++++++++++++----
=C2=A0share/mk/src.opts.mk=C2=A0 =C2=A0 =C2=A0 |=C2=A0 2 +-
=C2=A03 files changed, 18 insertions(+), 5 deletions(-)

diff --git a/UPDATING b/UPDATING
index 15941028c5bb..6989bb7c7f99 100644
--- a/UPDATING
+++ b/UPDATING
@@ -27,6 +27,11 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 15.x IS SLOW:
=C2=A0 =C2=A0 =C2=A0 =C2=A0 world, or to merely disable the most expensive = debugging functionality
=C2=A0 =C2=A0 =C2=A0 =C2=A0 at runtime, run "ln -s 'abort:false,ju= nk:false' /etc/malloc.conf".)

+20250314:
+=C2=A0 =C2=A0 =C2=A0 =C2=A0We now use LLVM's binary utilities (nm, obj= copy, etc.) by default.
+=C2=A0 =C2=A0 =C2=A0 =C2=A0The WITHOUT_LLVM_BINUTILS src.conf(5) knob can = be used to revert to
+=C2=A0 =C2=A0 =C2=A0 =C2=A0ELF Tool Chain tools if desired.
+
=C2=A020250303:
=C2=A0 =C2=A0 =C2=A0 =C2=A0 Commit 4a77657cbc01 changed the ABI between ipf= w(8) and ipfw(4).
=C2=A0 =C2=A0 =C2=A0 =C2=A0 Please note that the old ipfw(8) binary will no= t work with the new
diff --git a/share/man/man5/src.conf.5 b/share/man/man5/src.conf.5
index 30b5d308724a..321eea708d04 100644
--- a/share/man/man5/src.conf.5
+++ b/share/man/man5/src.conf.5
@@ -1,5 +1,5 @@
=C2=A0.\" DO NOT EDIT-- this file is @generated by tools/build/options= /makeman.
-.Dd January 31, 2025
+.Dd March 14, 2025
=C2=A0.Dt SRC.CONF 5
=C2=A0.Os
=C2=A0.Sh NAME
@@ -933,9 +933,8 @@ the build.
=C2=A0To be able to build the system an alternate linker must be provided v= ia XLD.
=C2=A0.It Va WITHOUT_LLVM_ASSERTIONS
=C2=A0Disable debugging assertions in LLVM.
-.It Va WITH_LLVM_BINUTILS
-Install LLVM's binutils (without an llvm- prefix),
-instead of ELF Tool Chain's tools.
+.It Va WITHOUT_LLVM_BINUTILS
+Install ELF Tool Chain's binary utilities instead of LLVM's.
=C2=A0This includes
=C2=A0.Xr addr2line 1 ,
=C2=A0.Xr ar 1 ,
@@ -1762,6 +1761,15 @@ When set, it enforces these options:
=C2=A0.It
=C2=A0.Va WITHOUT_LLVM_COV
=C2=A0.El
+.Pp
+When set, these options are also in effect:
+.Pp
+.Bl -inset -compact
+.It Va WITHOUT_LLVM_BINUTILS
+(unless
+.Va WITH_LLVM_BINUTILS
+is set explicitly)
+.El
=C2=A0.It Va WITH_UBSAN
=C2=A0Build the base system with Undefined Behavior Sanitizer (UBSan) to de= tect
=C2=A0various kinds of undefined behavior at runtime.
diff --git a/share/mk/src.opts.mk b/share/mk/src.opts.mk
index f3141884cd00..ef8711db713f 100644
--- a/share/mk/src.opts.mk
+++ b/share/mk/src.opts.mk
@@ -124,6 +124,7 @@ __DEFAULT_YES_OPTIONS =3D \
=C2=A0 =C2=A0 =C2=A0LLD \
=C2=A0 =C2=A0 =C2=A0LLD_BOOTSTRAP \
=C2=A0 =C2=A0 =C2=A0LLVM_ASSERTIONS \
+=C2=A0 =C2=A0 LLVM_BINUTILS \
=C2=A0 =C2=A0 =C2=A0LLVM_COV \
=C2=A0 =C2=A0 =C2=A0LLVM_CXXFILT \
=C2=A0 =C2=A0 =C2=A0LOADER_BIOS_TEXTONLY \
@@ -208,7 +209,6 @@ __DEFAULT_NO_OPTIONS =3D \
=C2=A0 =C2=A0 =C2=A0HESIOD \
=C2=A0 =C2=A0 =C2=A0LOADER_VERBOSE \
=C2=A0 =C2=A0 =C2=A0LOADER_VERIEXEC_PASS_MANIFEST \
-=C2=A0 =C2=A0 LLVM_BINUTILS \
=C2=A0 =C2=A0 =C2=A0LLVM_FULL_DEBUGINFO \
=C2=A0 =C2=A0 =C2=A0MALLOC_PRODUCTION \
=C2=A0 =C2=A0 =C2=A0OFED_EXTRA \



--
Nuno Teixeira
=
FreeBSD UNIX:=C2=A0 <eduardo@FreeBSD.org>=C2=A0 =C2=A0Web:=C2=A0 https://Fr= eeBSD.org
--0000000000009c575b06305147fd--