d/i386: Add CET TargetInfo key and predefined version [PR118654]

Adds a new i386 d_target_info_spec entry to handle requests for
`__traits(getTargetInfo, "CET")', and add predefined target version
`GNU_CET' when the option `-fcf-protecton' is used.

Both TargetInfo key and predefined version have been added to the D
front-end documentation.

In the library, `GNU_CET' replaces the existing use of the user-defined
version flag `CET' when building libphobos.

	PR d/118654

gcc/ChangeLog:

	* config/i386/i386-d.cc (ix86_d_target_versions): Predefine GNU_CET.
	(ix86_d_handle_target_cf_protection): New.
	(ix86_d_register_target_info): Add 'CET' TargetInfo key.

gcc/d/ChangeLog:

	* implement-d.texi: Document CET version and traits key.

libphobos/ChangeLog:

	* Makefile.in: Regenerate.
	* configure: Regenerate.
	* configure.ac: Remove CET_DFLAGS.
	* libdruntime/Makefile.am: Replace CET_DFLAGS with CET_FLAGS.
	* libdruntime/Makefile.in: Regenerate.
	* libdruntime/core/thread/fiber/package.d: Replace CET with GNU_CET.
	* src/Makefile.am: Replace CET_DFLAGS with CET_FLAGS.
	* src/Makefile.in: Regenerate.
	* testsuite/Makefile.in: Regenerate.
	* testsuite/testsuite_flags.in: Replace CET_DFLAGS with CET_FLAGS.

gcc/testsuite/ChangeLog:

	* gdc.dg/target/i386/i386.exp: New test.
	* gdc.dg/target/i386/targetinfo_CET.d: New test.
This commit is contained in:
Iain Buclaw
2025-02-25 18:01:09 +01:00
parent 2d812eecc3
commit c17044e509
14 changed files with 80 additions and 20 deletions

8
libphobos/configure vendored
View File

@@ -731,7 +731,6 @@ CFLAGS_FOR_BUILD
CC_FOR_BUILD
AR
DCFG_ENABLE_CET
CET_DFLAGS
CET_FLAGS
RANLIB
MAINT
@@ -5667,18 +5666,15 @@ fi
# To ensure that runtime code for CET is compiled in, add in D version flags.
if test x$enable_cet = xyes; then :
CET_DFLAGS="$CET_FLAGS -fversion=CET"
DCFG_ENABLE_CET=true
else
CET_DFLAGS=
DCFG_ENABLE_CET=false
fi
# This should be inherited in the recursive make, but ensure it is defined.
test "$AR" || AR=ar
@@ -11867,7 +11863,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
#line 11870 "configure"
#line 11866 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -11973,7 +11969,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
#line 11976 "configure"
#line 11972 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H