From patchwork Tue Nov 26 13:54:43 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Florian Weimer X-Patchwork-Id: 36200 Received: (qmail 99405 invoked by alias); 26 Nov 2019 13:55:07 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-alpha-owner@sourceware.org Delivered-To: mailing list libc-alpha@sourceware.org Received: (qmail 99396 invoked by uid 89); 26 Nov 2019 13:55:07 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-18.4 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, SPF_PASS autolearn=ham version=3.3.1 spammy=Intel, intel, HX-Languages-Length:1859 X-HELO: us-smtp-delivery-1.mimecast.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1574776495; 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: content-transfer-encoding:content-transfer-encoding; bh=slS5speZ6ccfXfHqL9oayuQ0hFMZ2K27pwGSD9C9eDs=; b=CW+b3r4vmxULF/LGPGBW+zWNBb90nRTW4IqZTY17Yx0unf62WPzLKYJSz9T776qfPrQZx3 Cf5GfgjQuy6jHvv6Zt+8I5k9o6L3iym8oY/xPa+8hprumUwg9t1N51ICr9Pg5nqcHdieYh EUDMoewynNWh58pjjeeMQsDN59fpXOI= From: Florian Weimer To: libc-alpha@sourceware.org Cc: H.J. Lu Subject: [PATCH] x86: Assume --enable-cet if GCC defaults to CET [BZ #25225] Date: Tue, 26 Nov 2019 14:54:43 +0100 Message-ID: <875zj6d9p8.fsf@oldenburg2.str.redhat.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.2 (gnu/linux) MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 This links in CET support if GCC defaults to CET. Otherwise, __CET__ is defined, yet CET functionality is not compiled and linked into the dynamic loader, resulting in a linker failure due to undefined references to _dl_cet_check and _dl_open_check. ----- configure | 23 ++++++++++++++++++++++- configure.ac | 9 ++++++++- 2 files changed, 30 insertions(+), 2 deletions(-) diff --git a/configure b/configure index 2f44b66656..b959d2d988 100755 --- a/configure +++ b/configure @@ -3777,11 +3777,32 @@ else fi +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + +#ifndef __CET__ +#error no CET compiler support +#endif + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + libc_cv_compiler_default_cet=yes +else + libc_cv_compiler_default_cet=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + # Check whether --enable-cet was given. if test "${enable_cet+set}" = set; then : enableval=$enable_cet; enable_cet=$enableval else - enable_cet=no + enable_cet=$libc_cv_compiler_default_cet fi diff --git a/configure.ac b/configure.ac index e69c88c543..49b900c1ed 100644 --- a/configure.ac +++ b/configure.ac @@ -473,11 +473,18 @@ AC_ARG_ENABLE([mathvec], [build_mathvec=$enableval], [build_mathvec=notset]) +AC_TRY_COMPILE([], [ +#ifndef __CET__ +# error no CET compiler support +#endif], + [libc_cv_compiler_default_cet=yes], + [libc_cv_compiler_default_cet=no]) + AC_ARG_ENABLE([cet], AC_HELP_STRING([--enable-cet], [enable Intel Control-flow Enforcement Technology (CET), x86 only]), [enable_cet=$enableval], - [enable_cet=no]) + [enable_cet=$libc_cv_compiler_default_cet]) # We keep the original values in `$config_*' and never modify them, so we # can write them unchanged into config.make. Everything else uses