commit:     3adc7e343f41581f05e3d52ded688bc231548658
Author:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
AuthorDate: Tue Jan  5 08:37:00 2021 +0000
Commit:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
CommitDate: Tue Jan  5 08:42:24 2021 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=3adc7e34

sys-devel/gdb: make CET optional (and disabled by default)

Reported-by: Volker Ernst
Bug: https://bugs.gentoo.org/760926
Package-Manager: Portage-3.0.12, Repoman-3.0.2
Signed-off-by: Sergei Trofimovich <slyfox <AT> gentoo.org>

 sys-devel/gdb/gdb-10.1.ebuild | 9 +++++++--
 sys-devel/gdb/gdb-9999.ebuild | 7 ++++++-
 sys-devel/gdb/metadata.xml    | 1 +
 3 files changed, 14 insertions(+), 3 deletions(-)

diff --git a/sys-devel/gdb/gdb-10.1.ebuild b/sys-devel/gdb/gdb-10.1.ebuild
index 0d958a65b3c..dc5210dbe4e 100644
--- a/sys-devel/gdb/gdb-10.1.ebuild
+++ b/sys-devel/gdb/gdb-10.1.ebuild
@@ -46,7 +46,7 @@ SLOT="0"
 if [[ ${PV} != 9999* ]] ; then
        KEYWORDS="~alpha amd64 arm arm64 ~hppa ~ia64 ~m68k ~mips ppc ppc64 
~riscv s390 sparc x86 ~x64-cygwin ~amd64-linux ~x86-linux ~x64-macos ~x86-macos 
~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris"
 fi
-IUSE="+client lzma multitarget nls +python +server source-highlight test 
vanilla xml xxhash"
+IUSE="cet +client lzma multitarget nls +python +server source-highlight test 
vanilla xml xxhash"
 REQUIRED_USE="
        python? ( ${PYTHON_REQUIRED_USE} )
        || ( client server )
@@ -131,8 +131,13 @@ src_configure() {
                --disable-{binutils,etc,gas,gold,gprof,ld}
 
                # avoid automagic dependency on (currently prefix) systems
-               # systems with debuginfod library, bgu #754753
+               # systems with debuginfod library, bug #754753
                --without-debuginfod
+
+               # Allow user to opt into CET for host libraries.
+               # Ideally we would like automagic-or-disabled here.
+               # But the check does not quite work on i686: bug #760926.
+               $(use_enable cet)
        )
        local sysroot="${EPREFIX}/usr/${CTARGET}"
        is_cross && myconf+=(

diff --git a/sys-devel/gdb/gdb-9999.ebuild b/sys-devel/gdb/gdb-9999.ebuild
index 4cb70ba29be..d35fed9fce9 100644
--- a/sys-devel/gdb/gdb-9999.ebuild
+++ b/sys-devel/gdb/gdb-9999.ebuild
@@ -46,7 +46,7 @@ SLOT="0"
 if [[ ${PV} != 9999* ]] ; then
        KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 
~riscv ~s390 ~sparc ~x86 ~x64-cygwin ~amd64-linux ~x86-linux ~x64-macos 
~x86-macos ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris"
 fi
-IUSE="+client lzma multitarget nls +python +server source-highlight test 
vanilla xml xxhash"
+IUSE="cet +client lzma multitarget nls +python +server source-highlight test 
vanilla xml xxhash"
 REQUIRED_USE="
        python? ( ${PYTHON_REQUIRED_USE} )
        || ( client server )
@@ -133,6 +133,11 @@ src_configure() {
                # avoid automagic dependency on (currently prefix) systems
                # systems with debuginfod library, bug #754753
                --without-debuginfod
+
+               # Allow user to opt into CET for host libraries.
+               # Ideally we would like automagic-or-disabled here.
+               # But the check does not quite work on i686: bug #760926.
+               $(use_enable cet)
        )
        local sysroot="${EPREFIX}/usr/${CTARGET}"
        is_cross && myconf+=(

diff --git a/sys-devel/gdb/metadata.xml b/sys-devel/gdb/metadata.xml
index c0ef0493f2a..9595bbc9f45 100644
--- a/sys-devel/gdb/metadata.xml
+++ b/sys-devel/gdb/metadata.xml
@@ -6,6 +6,7 @@
  <name>Gentoo Toolchain Project</name>
 </maintainer>
 <use>
+ <flag name="cet">Enable Intel Control-flow Enforcement Technology.</flag>
  <flag name="client">Install the main "gdb" program (most people want 
this)</flag>
  <flag name="lzma">Support lzma compression in ELF debug info</flag>
  <flag name="multitarget">Support all known targets in one gdb binary</flag>

Reply via email to