From patchwork Tue Sep 10 12:22:17 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adhemerval Zanella Netto X-Patchwork-Id: 826978 Delivered-To: patch@linaro.org Received: by 2002:adf:ab1c:0:b0:367:895a:4699 with SMTP id q28csp274615wrc; Tue, 10 Sep 2024 05:23:07 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCU//LD9xVOoFGSqQl6PtQmS2cLhHH9lcu7EPrsXHOlvMMq8GHLhdKGc5gsqd1Ajj5jv00WrCQ==@linaro.org X-Google-Smtp-Source: AGHT+IHPpEwBs+Q5GenSUPXTJYVjbzbcB4CKeBwclOBt5RKG1ULEXDIvhVOVGUhYcPS+kw2A7/rU X-Received: by 2002:a05:6214:3da1:b0:6c3:550a:c7c9 with SMTP id 6a1803df08f44-6c528511fb7mr177238916d6.50.1725970987653; Tue, 10 Sep 2024 05:23:07 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1725970987; cv=pass; d=google.com; s=arc-20240605; b=VkOa+GROVJeffD0G/Wp2qEDI4kx2FSPWT9hYKoSfSpqdVGacBjGXY7I6lJOr4hY+QI KgNu2mr9vxGc/iO61BLTAq/hSbanfg84896uYawtDfQ7pwGGPHZzX+vA0OnmgqdG90bh 5QGKJA3pW7IwCwnfddhwZgKL7ZKev0qA7AHMWjKHxqEZdNSB8N3iKoed5yY2YakSJavO BV/yAYuO6DypFxI1i/Q3aFSOqrgV1wKIZb5Kj/sw0R6R20F+hu8oeQ+2GODpbNiHntcM vGT2SsiJTTxYRXWZU1Icwa5jZpRpfn3u+W1nn6Cf46fPRY4zB98MMZKzHveBFeOcj24Z GrCw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature:arc-filter:dmarc-filter:delivered-to; bh=EzZppli2BnvgT/iaWeHdGp9ma4zFlejRE7n6olisXYc=; fh=lvhpNY6+SHq89AyVt6fa8bkVWGNbJmFPkAi6n1fTc1c=; b=ahNXmwiEdSFxHGl3a+q84BTptUjk/l3K4THMX4rAPaQ+mjCvjRLVk54DWYlhCc6rrq CCO+McKf+ganX9UFIhGRcNX/fk94OL0Fbnv91uHUujQE0jQqoPxxu33rgX16g1B6wVIS xoe33nnd7VNK/o4yXZo6gVC+l77olhUAfTjtsukmn2cIyksNvIng6TEZx+AR7BcZ+Ivk xtVpdxWPMOr96MKoC94n8BKyQOyai1DNc1BJG3lQUhXz/QM4eSFdA5XlrOxGeq9TtUc+ /0dylKdEJ6ZjMR6HLYmzwc7l7d7no+jzKmvP1R96wMaziX4/Wy9FZM6qiGt/F/P+WqFK SIsw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=fWHq5FqI; arc=pass (i=1); spf=pass (google.com: domain of libc-alpha-bounces~patch=linaro.org@sourceware.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="libc-alpha-bounces~patch=linaro.org@sourceware.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from server2.sourceware.org (server2.sourceware.org. [8.43.85.97]) by mx.google.com with ESMTPS id 6a1803df08f44-6c5347c2fadsi77200646d6.537.2024.09.10.05.23.07 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 Sep 2024 05:23:07 -0700 (PDT) Received-SPF: pass (google.com: domain of libc-alpha-bounces~patch=linaro.org@sourceware.org designates 8.43.85.97 as permitted sender) client-ip=8.43.85.97; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=fWHq5FqI; arc=pass (i=1); spf=pass (google.com: domain of libc-alpha-bounces~patch=linaro.org@sourceware.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="libc-alpha-bounces~patch=linaro.org@sourceware.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id EF5D93858435 for ; Tue, 10 Sep 2024 12:23:06 +0000 (GMT) X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from mail-pj1-x102c.google.com (mail-pj1-x102c.google.com [IPv6:2607:f8b0:4864:20::102c]) by sourceware.org (Postfix) with ESMTPS id B9803385B508 for ; Tue, 10 Sep 2024 12:22:54 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org B9803385B508 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=linaro.org ARC-Filter: OpenARC Filter v1.0.0 sourceware.org B9803385B508 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2607:f8b0:4864:20::102c ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1725970976; cv=none; b=Ipdr0Q26f7uaR+QLYEeLVUfaY+92ezqU/Y+rFV7KGZSlFrRz5tLK5FSEYl/OiG3fh0FItjq4UPGrvsbaC1zj5f7INC+dueQSsL67R+9Fkq7HZL/EiacpBXsV+KZKK5VcsLzeI3LT6bU9DZ97N58BuOnVCN5j5VpMuCs/s0/11Uk= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1725970976; c=relaxed/simple; bh=CJqHvk6qe1//nTarDUJ8FUNpsp4k+cPfsaZsMY9Amqk=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=LoM2pbdb+QS3Ks7b41tikcqit85EpVoBRvBPYckk2qJQ1xWTBHmZpF2b85gsxGLHbbChnVh9KKTvZFyFabdfxaYtYQgmCi7G9ICvBH+Ec9j+b3HH/iUUdm+ZPZ17SCGFK0aNou9C3GQ7AgtYcfOA5QwqclcMotyJLi0vKOffpcU= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-pj1-x102c.google.com with SMTP id 98e67ed59e1d1-2d8f06c2459so3519051a91.0 for ; Tue, 10 Sep 2024 05:22:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1725970973; x=1726575773; darn=sourceware.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=EzZppli2BnvgT/iaWeHdGp9ma4zFlejRE7n6olisXYc=; b=fWHq5FqIzEufEwF9t/9N+nAr+Tv5nHP1jP3UvWs1mitgLe3bvlbWX/bYwrd0i+98Ng yosKvlCeJKz0kjeci+BzFYOD4tM9lZbH9oBGVD9DMOMES8ckenBDHIx7/JDlUG3M/MhN 9pxVwO4vg8PEOTKJJfBSnNZ5S2j1Ty1PMoRky1yKveaACOQFpwLUbZGe52V4swKH82MW KPsN0LEntDvHHiCcSvKDhVu3bPnY7Sr6Ju0IQRqJybm/zCksfEs9MF2LLf0uNMVpS9bg uMDPhfl1bSOx/aB6P2jn/XGar0hQjIjNTJw+QAjNfyE+eQGz5XX0N5r84nCkIl7pUuuA +J7g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1725970973; x=1726575773; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=EzZppli2BnvgT/iaWeHdGp9ma4zFlejRE7n6olisXYc=; b=PJ8VV5K2kv8oQSXf64hcK+SN5zShzvoZbinrhzc29QX3+eRQJ6B2xhfL2EzOhi8Xvv bC7Iwp0YNqoiLo42Z71DC6g2diNJxM0ElPm+nWqzSEW7LODXdivT8Ph6yodt0pmiYhJF 2AdUpUe/PemQ+9xqVGwmp1ML+7+Xjl16fL0z1CWzANbs+S3G39VfO/rAMKj38zToQLqh 2cLFuRciK4F7wsKk9rNnnSM/FYOh7xQqCGkqt80Gfc2iWJNx6R1Hqz4Daaz891BJ4hD+ RzeKja7thbNvdbuCOo2ttOjk3Ybp8iTi7YBBZVtLPBcsKG5fK50rBkj6lgwlPhuGG78Y zpEA== X-Gm-Message-State: AOJu0YzamW1S8lQm2rvtUayDhKuJGAX6q9nLdroUJhgH8g3e2oZ+1Lx+ YAiVd7n0JdXa9an8gL0/u+cslwOrHMccCQJCsfUbyQptOSjPJPKZas6t6m2FELU5Jnm6SPLc529 t X-Received: by 2002:a17:90a:77ca:b0:2d8:8ead:f013 with SMTP id 98e67ed59e1d1-2dad4efdfa9mr13492302a91.7.1725970973332; Tue, 10 Sep 2024 05:22:53 -0700 (PDT) Received: from mandiga.. ([2804:1b3:a7c0:80ff:f471:9688:94c:da67]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-2db6dca2773sm552804a91.1.2024.09.10.05.22.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 Sep 2024 05:22:52 -0700 (PDT) From: Adhemerval Zanella To: libc-alpha@sourceware.org Cc: Simon Chopin , Matthias Klose Subject: [PATCH 1/3] Do not use -Wp to disable fortify (BZ 31928) Date: Tue, 10 Sep 2024 09:22:17 -0300 Message-ID: <20240910122244.1995107-2-adhemerval.zanella@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240910122244.1995107-1-adhemerval.zanella@linaro.org> References: <20240910122244.1995107-1-adhemerval.zanella@linaro.org> MIME-Version: 1.0 X-Spam-Status: No, score=-12.0 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libc-alpha-bounces~patch=linaro.org@sourceware.org The -Wp does not work properly if the compiler is configured to enable fortify by default, since it bypasses the compiler driver (which defines the fortify flags in this case). This patch is similar to the one used on Ubuntu [1]. I checked with a build for x86_64-linux-gnu, i686-linux-gnu, aarch64-linux-gnu, s390x-linux-gnu, and riscv64-linux-gnu with gcc-13 that enables the fortify by default. Co-authored-by: Matthias Klose [1] https://git.launchpad.net/~ubuntu-core-dev/ubuntu/+source/glibc/tree/debian/patches/ubuntu/fix-fortify-source.patch --- configure | 4 ++-- configure.ac | 4 ++-- debug/Makefile | 19 ++++++++++--------- io/Makefile | 2 +- stdio-common/Makefile | 2 +- wcsmbs/Makefile | 2 +- 6 files changed, 17 insertions(+), 16 deletions(-) diff --git a/configure b/configure index ec0b62db36..58bfb2917f 100755 --- a/configure +++ b/configure @@ -7718,7 +7718,7 @@ printf "%s\n" "#define HAVE_LIBCAP 1" >>confdefs.h fi -no_fortify_source="-Wp,-U_FORTIFY_SOURCE" +no_fortify_source="-U_FORTIFY_SOURCE" fortify_source="${no_fortify_source}" { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for maximum supported _FORTIFY_SOURCE level" >&5 @@ -7773,7 +7773,7 @@ esac if test "$libc_cv_fortify_source" = yes then : - fortify_source="${fortify_source},-D_FORTIFY_SOURCE=${enable_fortify_source}" + fortify_source="${fortify_source} -D_FORTIFY_SOURCE=${enable_fortify_source}" fi diff --git a/configure.ac b/configure.ac index 7c9b57789e..5af742ce41 100644 --- a/configure.ac +++ b/configure.ac @@ -1536,7 +1536,7 @@ dnl If not, then don't use it. dnl Note that _FORTIFY_SOURCE may have been set through FLAGS too. dnl _FORTIFY_SOURCE value will be selectively disabled for function that can't dnl support it -no_fortify_source="-Wp,-U_FORTIFY_SOURCE" +no_fortify_source="-U_FORTIFY_SOURCE" fortify_source="${no_fortify_source}" AC_CACHE_CHECK([for maximum supported _FORTIFY_SOURCE level], @@ -1555,7 +1555,7 @@ AS_CASE([$enable_fortify_source], [libc_cv_fortify_source=no]) AS_IF([test "$libc_cv_fortify_source" = yes], - [fortify_source="${fortify_source},-D_FORTIFY_SOURCE=${enable_fortify_source}"] + [fortify_source="${fortify_source} -D_FORTIFY_SOURCE=${enable_fortify_source}"] ) AC_SUBST(enable_fortify_source) diff --git a/debug/Makefile b/debug/Makefile index 3903cc97a3..89ee80bf4d 100644 --- a/debug/Makefile +++ b/debug/Makefile @@ -171,16 +171,16 @@ CFLAGS-recvfrom_chk.c += -fexceptions -fasynchronous-unwind-tables # set up for us, so keep the CFLAGS/CPPFLAGS split logical as the order is: # CFLAGS-tst-longjmp_chk.c += -fexceptions -fasynchronous-unwind-tables -CPPFLAGS-tst-longjmp_chk.c += $(no-fortify-source),-D_FORTIFY_SOURCE=1 +CPPFLAGS-tst-longjmp_chk.c += $(no-fortify-source) -D_FORTIFY_SOURCE=1 CFLAGS-tst-longjmp_chk2.c += -fexceptions -fasynchronous-unwind-tables -CPPFLAGS-tst-longjmp_chk2.c += $(no-fortify-source),-D_FORTIFY_SOURCE=1 +CPPFLAGS-tst-longjmp_chk2.c += $(no-fortify-source) -D_FORTIFY_SOURCE=1 CFLAGS-tst-longjmp_chk3.c += -fexceptions -fasynchronous-unwind-tables -CPPFLAGS-tst-longjmp_chk3.c += $(no-fortify-source),-D_FORTIFY_SOURCE=1 -CPPFLAGS-tst-realpath-chk.c += $(no-fortify-source),-D_FORTIFY_SOURCE=2 -CPPFLAGS-tst-chk-cancel.c += $(no-fortify-source),-D_FORTIFY_SOURCE=2 -CFLAGS-tst-sprintf-fortify-rdonly.c += $(no-fortify-source),-D_FORTIFY_SOURCE=2 -CFLAGS-tst-fortify-syslog.c += $(no-fortify-source),-D_FORTIFY_SOURCE=2 -CFLAGS-tst-fortify-wide.c += $(no-fortify-source),-D_FORTIFY_SOURCE=2 +CPPFLAGS-tst-longjmp_chk3.c += $(no-fortify-source) -D_FORTIFY_SOURCE=1 +CPPFLAGS-tst-realpath-chk.c += $(no-fortify-source) -D_FORTIFY_SOURCE=2 +CPPFLAGS-tst-chk-cancel.c += $(no-fortify-source) -D_FORTIFY_SOURCE=2 +CFLAGS-tst-sprintf-fortify-rdonly.c += $(no-fortify-source) -D_FORTIFY_SOURCE=2 +CFLAGS-tst-fortify-syslog.c += $(no-fortify-source) -D_FORTIFY_SOURCE=2 +CFLAGS-tst-fortify-wide.c += $(no-fortify-source) -D_FORTIFY_SOURCE=2 # _FORTIFY_SOURCE tests. # Auto-generate tests for _FORTIFY_SOURCE for different levels, compilers and @@ -218,7 +218,8 @@ src-chk-nongnu = \#undef _GNU_SOURCE # cannot be disabled via pragmas, so require -Wno-error to be used. define gen-chk-test tests-$(1)-$(4)-chk += tst-fortify-$(1)-$(2)-$(3)-$(4) -CFLAGS-tst-fortify-$(1)-$(2)-$(3)-$(4).$(1) += $(no-fortify-source),-D_FORTIFY_SOURCE=$(3) -Wno-format \ +CFLAGS-tst-fortify-$(1)-$(2)-$(3)-$(4).$(1) += $(no-fortify-source) -D_FORTIFY_SOURCE=$(3) \ + -Wno-format \ -Wno-deprecated-declarations \ -Wno-error $(eval $(call cflags-$(2),$(1),$(3),$(4))) diff --git a/io/Makefile b/io/Makefile index 47666a1deb..56de61d687 100644 --- a/io/Makefile +++ b/io/Makefile @@ -292,7 +292,7 @@ CFLAGS-read.c += -fexceptions -fasynchronous-unwind-tables $(config-cflags-wno-i CFLAGS-write.c += -fexceptions -fasynchronous-unwind-tables $(config-cflags-wno-ignored-attributes) CFLAGS-close.c += -fexceptions -fasynchronous-unwind-tables CFLAGS-lseek64.c += $(config-cflags-wno-ignored-attributes) -CFLAGS-tst-read-zero.c += $(no-fortify-source),-D_FORTIFY_SOURCE=$(supported-fortify) +CFLAGS-tst-read-zero.c += $(no-fortify-source) -D_FORTIFY_SOURCE=$(supported-fortify) CFLAGS-test-stat.c += -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE CFLAGS-test-lfs.c += -D_LARGEFILE64_SOURCE diff --git a/stdio-common/Makefile b/stdio-common/Makefile index d99e0cbfeb..f9ae48dc3b 100644 --- a/stdio-common/Makefile +++ b/stdio-common/Makefile @@ -558,7 +558,7 @@ CFLAGS-tst-gets.c += -Wno-deprecated-declarations # BZ #11319 was first fixed for regular vdprintf, then reopened because # the fortified version had the same bug. -CFLAGS-tst-bz11319-fortify2.c += $(no-fortify-source),-D_FORTIFY_SOURCE=2 +CFLAGS-tst-bz11319-fortify2.c += $(no-fortify-source) -D_FORTIFY_SOURCE=2 CFLAGS-tst-memstream-string.c += -fno-builtin-fprintf diff --git a/wcsmbs/Makefile b/wcsmbs/Makefile index 63adf0e8ef..37a44e62c3 100644 --- a/wcsmbs/Makefile +++ b/wcsmbs/Makefile @@ -264,7 +264,7 @@ CFLAGS-wcstod_l.c += $(strtox-CFLAGS) $(config-cflags-wno-ignored-attributes) CFLAGS-wcstold_l.c += $(strtox-CFLAGS) $(config-cflags-wno-ignored-attributes) CFLAGS-wcstof128_l.c += $(strtox-CFLAGS) CFLAGS-wcstof_l.c += $(strtox-CFLAGS) $(config-cflags-wno-ignored-attributes) -CPPFLAGS-tst-wchar-h.c += $(no-fortify-source),-D_FORTIFY_SOURCE=2 +CPPFLAGS-tst-wchar-h.c += $(no-fortify-source) -D_FORTIFY_SOURCE=2 CFLAGS-wcschr.c += $(config-cflags-wno-ignored-attributes) CFLAGS-wmemchr.c += $(config-cflags-wno-ignored-attributes) From patchwork Tue Sep 10 12:22:18 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adhemerval Zanella Netto X-Patchwork-Id: 826980 Delivered-To: patch@linaro.org Received: by 2002:adf:ab1c:0:b0:367:895a:4699 with SMTP id q28csp274918wrc; Tue, 10 Sep 2024 05:23:56 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWrfdqLsmTKbxopZbXI0K8bNhd1YU1fU1leQldGI3lRGcAtETVmLp2n8eG3ufhUABYwFGNrFw==@linaro.org X-Google-Smtp-Source: AGHT+IGgrhKEMZ9dqxCU1wOjhtuj7x/i7qBHVVkt0cx+OwxkLob22He/TB+EXU/Yrj0GG8+C7UN+ X-Received: by 2002:a05:6214:419c:b0:6c5:1a21:b8b9 with SMTP id 6a1803df08f44-6c5283ff6abmr171687696d6.13.1725971036221; Tue, 10 Sep 2024 05:23:56 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1725971036; cv=pass; d=google.com; s=arc-20240605; b=kUjIbU9jvZr+MC2BCG3jpMo43MQBhDdq5lHA9Nscq6b/xWNogxu/f22FTIqcIwH2z2 T+wc8yQ03qWrhq5OiArx9HmSUmw8v8c5d0TR0v38ZgwJWqDPYqpK/S/zd6jHQYVAcYOe DaVK2mRcvMtOXXYiiQPOmDzLFdi+H96XhbqieDanOB9Y5Z04sVt67fDbIkO/BXiu59+R xymhXCJWvwl5WW6eNTygpzP47D/WLGmjEqts8B46ATlAO0/+PimYpiCQSwIQZFbTR/RD YfeQD15ClIWDlWFwdvg0tKrGO7VgRkImodnbjP8u8z7clijRaXDZH0rRj3I8zuMc29Cx wCKQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature:arc-filter:dmarc-filter:delivered-to; bh=QRVI+zEg5THie28+9+L6qljVh4IQKYQx/+aJHUCVLSo=; fh=GNAnomGb44Vc67//YEj4j5r10Zx6jLxEj1JVNOU+ZEM=; b=lP9CmQ9+hdb27qN0nb44M02BWZG9lT86z5JTRlReTC6SczlrDObMPrDvdjawhD5tbF PqnguJRi+460kVbOik1zmS3qCkLUlzfUwkwijsX48pbpxGJWRBI59ZKz4ZEG/CTvJcdo BDrCsT4qEm5GnYTp23UgxEbSQaTIf0/IPyN/Md4MZjWBJzc+BHZqcFnuoKzFoRSeVdvU gll+cFcTV6DNFWhH0SPcoPQPoBYJ85XcMei1J21ODGhUpmemjkcK3I3EEuQXqt8Do002 ZwrucmXUfNmwgcoIeOTcHH35z6dxjaZ5hiPGdc2zvrC5HjpgaY6bOsTpWngb5CC1j12C hjkw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=ZkwDx8E9; arc=pass (i=1); spf=pass (google.com: domain of libc-alpha-bounces~patch=linaro.org@sourceware.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="libc-alpha-bounces~patch=linaro.org@sourceware.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from server2.sourceware.org (server2.sourceware.org. [2620:52:3:1:0:246e:9693:128c]) by mx.google.com with ESMTPS id 6a1803df08f44-6c5347c3665si75661896d6.517.2024.09.10.05.23.56 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 Sep 2024 05:23:56 -0700 (PDT) Received-SPF: pass (google.com: domain of libc-alpha-bounces~patch=linaro.org@sourceware.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) client-ip=2620:52:3:1:0:246e:9693:128c; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=ZkwDx8E9; arc=pass (i=1); spf=pass (google.com: domain of libc-alpha-bounces~patch=linaro.org@sourceware.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="libc-alpha-bounces~patch=linaro.org@sourceware.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id CD337385C6C7 for ; Tue, 10 Sep 2024 12:23:55 +0000 (GMT) X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from mail-pg1-x535.google.com (mail-pg1-x535.google.com [IPv6:2607:f8b0:4864:20::535]) by sourceware.org (Postfix) with ESMTPS id D68A43858C50 for ; Tue, 10 Sep 2024 12:22:56 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org D68A43858C50 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=linaro.org ARC-Filter: OpenARC Filter v1.0.0 sourceware.org D68A43858C50 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2607:f8b0:4864:20::535 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1725970979; cv=none; b=eHv5IIPr0ZXv6Un1XOOO3New7UUGkLSMYFgqMZ2UM96DVYFSTcnlwrw5hCclu7vCFtfByDm/AqxhUS0jYAQ7quUXjw7zSS5/5cDm4qmno8agMuJJQ/a0IYQGULjID5HPXWEq4oBISJrpLvZIEgCW6eRhKShZk5/g/flxXLw4oxQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1725970979; c=relaxed/simple; bh=jtPTy1wBAPvV4Wh0p11ckYgqXBCeHICGqzx+1OidBs4=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=UnxyrUC+xAdwD2kd9ulhzemmFhedfgl82mwaMVqnRMs73p4Yd7Q6+TMj15SHGHAqgjtQ/Ek4qPdZypVah4vS48RabND3vFzaVQ4ZtYVECGjhCLGBUnIzw9X6USVFKqW5uCuzpBuO6GBZteqPL2W3FYN/CszcO7cPepFjeNb2Z6s= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-pg1-x535.google.com with SMTP id 41be03b00d2f7-7cd8d2731d1so3763076a12.3 for ; Tue, 10 Sep 2024 05:22:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1725970975; x=1726575775; darn=sourceware.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=QRVI+zEg5THie28+9+L6qljVh4IQKYQx/+aJHUCVLSo=; b=ZkwDx8E9juxdrOXZQR4FF8qz4pMb4Xj7z6Fy2ILJiaKpgiGMDJA4d5cad7y2gpbpWf pglZQf4iT88/ZCfVrf2VD1FC8PnvoF7ynxYf/NGcrarYEFCh3QqaO8mDM3XqbPX7QVeb LRRBA+0gSu1p03tCetuF7z0fvCgxk+G0JVnNoaFw7rMfzqypPRkNtE7YvpZyBRVeGw4J R5sHzpBDizowvvctYS7UNg9Sqz1uSJ1JghhrvQZYdIfxCOAU8UEhrB1+URNnIkJSAiJi WUKb5oDkvfjyAhWCqN4+iIyGeiLOWFNfWZ4JonZMK08OblRTCczCIovm2bfcUQ3Zup18 fptA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1725970975; x=1726575775; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=QRVI+zEg5THie28+9+L6qljVh4IQKYQx/+aJHUCVLSo=; b=VlFc/zj3OA59ZTdFffFye4PHCL/SfogdKt/ZeITT0z/OWoKsw6cf8sxvnTmziMjyKD ShTiSC6GpQl6c2Dgm+2XWrom2nRbZ7HpYZ3UBW1FVwo8ooeiTP1rfnsjpsSY7aQj/BCj zWA8BQ2A4neZDD2iPW1+uBwPjRLxWEd1X7nMbmGOfbwuVV6nmcnK37WjK6SyPGguiHtl xUWydbe/MaP0lwLtLU6wXfpY59KAnfSj12EzhXdrPgOUPsp63H9F88j0isgNDE4d42tA cYnXzIc+f+QLZx5IRbiWnp9UbBbuDu9hDe+LgeOu28wkc5nlZj2Vz4Wjr1EWwyNoNUgK Q84A== X-Gm-Message-State: AOJu0Yzldp38v+ukN57EuW6w/Sb9w5ZxQiV7w6kJlmksMQgdYrBhhDEc adW6bgUahYjlvDYMdEVDFyrRUacSGBCpe6wxK1x4pkYxGLh80hzpL/O/0bt7jPsBbqHKMcTErmX w X-Received: by 2002:a05:6a21:3a46:b0:1cf:3a52:6ad2 with SMTP id adf61e73a8af0-1cf5e079ed8mr658907637.15.1725970975163; Tue, 10 Sep 2024 05:22:55 -0700 (PDT) Received: from mandiga.. ([2804:1b3:a7c0:80ff:f471:9688:94c:da67]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-2db6dca2773sm552804a91.1.2024.09.10.05.22.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 Sep 2024 05:22:54 -0700 (PDT) From: Adhemerval Zanella To: libc-alpha@sourceware.org Cc: Simon Chopin Subject: [PATCH 2/3] Disable _FILE_OFFSET_BITS if the compiler defaults to it Date: Tue, 10 Sep 2024 09:22:18 -0300 Message-ID: <20240910122244.1995107-3-adhemerval.zanella@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240910122244.1995107-1-adhemerval.zanella@linaro.org> References: <20240910122244.1995107-1-adhemerval.zanella@linaro.org> MIME-Version: 1.0 X-Spam-Status: No, score=-12.3 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libc-alpha-bounces~patch=linaro.org@sourceware.org Even though building glibc with LFS flags is not supported, and the the usual way is to patch the build system to avoid it [1]; some system do enable it by default, and it increases the requirements to build glibc in such cases (it also does not help newcomers when trying to build glibc). The conform namespace and linknamespace tests also do not expect that flag to be set by default, so disable it as well. Checked with a build/check for major ABI and some (i386, arm, mipsel, hppa) with a toolchain that has LFS flags by default. [1] https://sourceware.org/bugzilla/show_bug.cgi?id=31624 --- Makeconfig | 3 +++ configure | 32 ++++++++++++++++++++++++++++++++ configure.ac | 13 +++++++++++++ conform/Makefile | 2 +- 4 files changed, 49 insertions(+), 1 deletion(-) diff --git a/Makeconfig b/Makeconfig index a87ff7b1d3..c0c89e6685 100644 --- a/Makeconfig +++ b/Makeconfig @@ -1011,6 +1011,9 @@ else +cflags += $(no-fortify-source) endif +# Filter out LFS flags if compiler defines it by default. ++cflags += $(no-file-offset-bits-source) + # Each sysdeps directory can contain header files that both will be # used to compile and will be installed. Each can also contain an # include/ subdirectory, whose header files will be used to compile diff --git a/configure b/configure index 58bfb2917f..5b9cc51067 100755 --- a/configure +++ b/configure @@ -635,6 +635,7 @@ libc_cv_gcc_unwind_find_fde libc_extra_cppflags libc_extra_cflags libc_cv_cxx_thread_local +no_file_offset_bits_source fortify_source no_fortify_source libc_cv_fortify_source @@ -7784,6 +7785,37 @@ fi config_vars="$config_vars supported-fortify = $libc_cv_supported_fortify_source" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main (void) +{ + +#ifndef _FILE_OFFSET_BITS +# error _FILE_OFFSET_BITS not defined +#endif + ; + return 0; +} +_ACEOF +if ac_fn_c_try_cpp "$LINENO" +then : + libc_cv_compiler_default_file_offset_bits=yes +else case e in #( + e) libc_cv_compiler_default_file_offset_bits=no ;; +esac +fi +rm -f conftest.err conftest.i conftest.$ac_ext +if test "$libc_cv_compiler_default_file_offset_bits" = yes +then : + no_file_offset_bits_source="-U_FILE_OFFSET_BITS" +fi + +config_vars="$config_vars +no-file-offset-bits-source = $no_file_offset_bits_source" + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether the assembler requires one version per symbol" >&5 printf %s "checking whether the assembler requires one version per symbol... " >&6; } if test ${libc_cv_symver_needs_alias+y} diff --git a/configure.ac b/configure.ac index 5af742ce41..160c863416 100644 --- a/configure.ac +++ b/configure.ac @@ -1564,6 +1564,19 @@ AC_SUBST(no_fortify_source) AC_SUBST(fortify_source) LIBC_CONFIG_VAR([supported-fortify], [$libc_cv_supported_fortify_source]) +dnl Check if compiler define _FILE_OFFSET_BITS by default +AC_PREPROC_IFELSE([AC_LANG_PROGRAM([[]], [[ +#ifndef _FILE_OFFSET_BITS +# error _FILE_OFFSET_BITS not defined +#endif]])], + [libc_cv_compiler_default_file_offset_bits=yes], + [libc_cv_compiler_default_file_offset_bits=no]) +AS_IF([test "$libc_cv_compiler_default_file_offset_bits" = yes], + [no_file_offset_bits_source="-U_FILE_OFFSET_BITS"]) +AC_SUBST(no_file_offset_bits_source) +LIBC_CONFIG_VAR([no-file-offset-bits-source], [$no_file_offset_bits_source]) + + dnl Starting with binutils 2.35, GAS can attach multiple symbol versions dnl to one symbol (PR 23840). AC_CACHE_CHECK(whether the assembler requires one version per symbol, diff --git a/conform/Makefile b/conform/Makefile index 73a3cb6da2..50293a195b 100644 --- a/conform/Makefile +++ b/conform/Makefile @@ -372,7 +372,7 @@ test-xfail-UNIX98/ndbm.h/conform = yes test-xfail-XOPEN2K/ndbm.h/conform = yes test-xfail-XOPEN2K8/ndbm.h/conform = yes -conformtest-cc-flags = -I../include $(+sysdep-includes) $(sysincludes) -I.. +conformtest-cc-flags = -I../include $(+sysdep-includes) $(sysincludes) -I.. $(no-file-offset-bits-source) # conformtest-xfail-conds may be set by a sysdeps Makefile fragment to # a list of conditions that are considered to be true when encountered # in xfail[cond]- lines in test expectations. From patchwork Tue Sep 10 12:22:19 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adhemerval Zanella Netto X-Patchwork-Id: 826979 Delivered-To: patch@linaro.org Received: by 2002:adf:ab1c:0:b0:367:895a:4699 with SMTP id q28csp274901wrc; Tue, 10 Sep 2024 05:23:53 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCU6tSWWAuMkundvoD3ObMKFO1YXT9kMXqQZ6RwZSu/3ooYKEb4XIvsTdF7EAwdzvQvi+EOr5Q==@linaro.org X-Google-Smtp-Source: AGHT+IFd2DLtmrIGXZCZ4oVIUaegJ6Z3bl8o9nFYzMamO5X8IPPo92AYVJMQRBWwpbI/FafWIEvx X-Received: by 2002:a05:6214:2c01:b0:6c3:55c4:cc1c with SMTP id 6a1803df08f44-6c5282fd513mr142901976d6.1.1725971032929; Tue, 10 Sep 2024 05:23:52 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1725971032; cv=pass; d=google.com; s=arc-20240605; b=URa7yor42tZbhVs/rro4BEuqWh4AAN5JhqFIMd2t0DO7oBqR/9WpccmJmXuF9Pyewm QtGcAwFmSn4re+rK58RI19PcADrSdx9hgB4Oqpyq2Mot5lVTefLksyFlsWUUS7RaeKzA R+W0TNfBst/fQiS7olcx4YkzoVcyGibryszi8eiCtfoHKsQut/vq1zB5z1+RbMra2+ue 9+aMO1hxS1kCF8iicmIxdAC2NEInXfT9UA2gbZqqES8xsvAKxH7rf3oQuuer7dfCGId+ vDFeqyzn1+oen5Br3pqjWQsLOZYlXtpQiIGHduMYW37aBEeIN/qgbedyV8juD6BfOgb1 PZFQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature:arc-filter:dmarc-filter:delivered-to; bh=kK3of1X1Xqj2Q9vO53pAHy1UkKqvv0iqc5jfIrNPr0g=; fh=GNAnomGb44Vc67//YEj4j5r10Zx6jLxEj1JVNOU+ZEM=; b=N/FFDm+qLIeYWfg68LRArWbyZGH7mtaXJen6Gxie4NgwG7Q2wuXo6kQZj6WhO56/u8 5dvDM6w+YR95jYJNdIX//nHO7RSAc1qEsNxOLHqowBI2ph6ERPf0PcmJdERxuXWjlatX LrptCuu2Dl8TKy0SJD8ORvx05dZlKGFXcBJ2+Zl1+SRCTbjgsIigby5xGxUE/+Cl6D99 sSe/9P5MeukdNx85+iK25ykFsQSoFLE6EyithMN89aSDIc2B8IEb/jtYQ9X6yUsZy8pM Dkc49L3sdgX+mKWLJo8gsJjyP9GIFg9v/CqCaQLcWhLWetKOVP0NhxKkgWD+LmzXO+MR gukg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=diDLd2ST; arc=pass (i=1); spf=pass (google.com: domain of libc-alpha-bounces~patch=linaro.org@sourceware.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="libc-alpha-bounces~patch=linaro.org@sourceware.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from server2.sourceware.org (server2.sourceware.org. [8.43.85.97]) by mx.google.com with ESMTPS id 6a1803df08f44-6c534781479si78040666d6.328.2024.09.10.05.23.52 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 Sep 2024 05:23:52 -0700 (PDT) Received-SPF: pass (google.com: domain of libc-alpha-bounces~patch=linaro.org@sourceware.org designates 8.43.85.97 as permitted sender) client-ip=8.43.85.97; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=diDLd2ST; arc=pass (i=1); spf=pass (google.com: domain of libc-alpha-bounces~patch=linaro.org@sourceware.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="libc-alpha-bounces~patch=linaro.org@sourceware.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 876E3385DDC8 for ; Tue, 10 Sep 2024 12:23:52 +0000 (GMT) X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from mail-pl1-x632.google.com (mail-pl1-x632.google.com [IPv6:2607:f8b0:4864:20::632]) by sourceware.org (Postfix) with ESMTPS id 970AB3858403 for ; Tue, 10 Sep 2024 12:22:58 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 970AB3858403 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=linaro.org ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 970AB3858403 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2607:f8b0:4864:20::632 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1725970981; cv=none; b=j1dQbbN7X/8dyYROuR7TvaGSxuUcSb2Ts/ZJB+sUmguCy62NShBbxwLd5OmJ0waQhpLfSoJXzNHMSTrcrSC++ySnpaT0I4jAZYr2pf5/2HdAHt0t428UGGmlKb88XGDDQ+p6kkIXne4J9IPOxASaRVVN8gIjCmRo8e6I3+hiOSI= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1725970981; c=relaxed/simple; bh=XOZhhVcIDVolyKKCyWXIkgINfjrOXbYRD3XgdWMiYAY=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=iEKDEwOjg8hdZETd94AbHbDGpfelSQYR+92gvGI2zhbwQ6RkYn8oPZaTPIXPeYYOtPW3R+nZ/i3NCX+DMHS/iGYEbjhcvQd28CsNSOMye6n6rrV+diWS2zOPC+b+SfLlFQbJnHCwLXcGlXmLirlisNMx4qbXhOsg+Fvl76rQd4o= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-pl1-x632.google.com with SMTP id d9443c01a7336-205722ba00cso46524145ad.0 for ; Tue, 10 Sep 2024 05:22:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1725970977; x=1726575777; darn=sourceware.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=kK3of1X1Xqj2Q9vO53pAHy1UkKqvv0iqc5jfIrNPr0g=; b=diDLd2STo0tIBIfMnwTp77zsxXOUrZQ5DcF7eb+xZeIB5nivvP5TkpfN/maOJWB381 S+UIikXCRuOGktxj2ut+ByaJJvWy72d4VzX3FvquL7Bgcg8c+kUoXiwEAJx2ZXLtngO2 4agLtmvWNWAq0jmO4Yn3mCNUZ/hOIrWiWazEZhi3hXXjVcPX/hgnkduEooYB2UJAJLFo rc6wXvunNPYJ4o+OKtKAArxJi/shft0lgvAIB6eCTR+h8JHBmc+1hKJ42Cr0Jvci+Bu8 JXAFdR84DOdEsVZZKRjwzzYoHsopfCmgV7nVcpzFAuUmEWCpPU6BB1e8jiN8LQF5lXm7 W9+Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1725970977; x=1726575777; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=kK3of1X1Xqj2Q9vO53pAHy1UkKqvv0iqc5jfIrNPr0g=; b=LiMv4NxIJMvJGpYMOGIFW6xQK9WRVoch28pWTKZzVTBHDsoOsDQdTeOQ7tWMh2ZcdG a4pRpSMcPUh3Dv7t9+37+m6gmxO+8ADk2cRcmgQ/i1+wG73iDmepBuZt/PTnAvnhuxPJ J0zPPm10KLco/2HsCmatwz1yjD9GKuEJf+P/Qb0Kwjs8+b0UJ6s5+l5jhstOyeyhlfgO ErXmI0zQYK4P95cv1CkDC/GqBKjrY4SKav5g8eEsEIFQ0VeXkm2XNNclgsJezEoeLiFi m4L0KaGM3G9J+iduS1K45TgIyjCXCTdDpmhXXRG16ezlJ2AdmX51j+AMOHlx9gHWzA3l oXJg== X-Gm-Message-State: AOJu0Yw8OvIqLcw37zfGO6ZIquUdRU+UzAEPXs9NfJUrAwGCxpDE4cV8 rFFH8wxesqnEmlAtTWqRnZQO2DC8sUoA8utBmH5WOq1gstT8Fs06sSGtNyAxfiLMDV0CJs9TFcN u X-Received: by 2002:a17:90b:164c:b0:2d3:cd5c:15bb with SMTP id 98e67ed59e1d1-2dad5181bf3mr12808075a91.25.1725970976997; Tue, 10 Sep 2024 05:22:56 -0700 (PDT) Received: from mandiga.. ([2804:1b3:a7c0:80ff:f471:9688:94c:da67]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-2db6dca2773sm552804a91.1.2024.09.10.05.22.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 Sep 2024 05:22:56 -0700 (PDT) From: Adhemerval Zanella To: libc-alpha@sourceware.org Cc: Simon Chopin Subject: [PATCH 3/3] Disable _TIME_BITS if the compiler defaults to it Date: Tue, 10 Sep 2024 09:22:19 -0300 Message-ID: <20240910122244.1995107-4-adhemerval.zanella@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240910122244.1995107-1-adhemerval.zanella@linaro.org> References: <20240910122244.1995107-1-adhemerval.zanella@linaro.org> MIME-Version: 1.0 X-Spam-Status: No, score=-12.4 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libc-alpha-bounces~patch=linaro.org@sourceware.org Even though building glibc with 64 bit time_t flags is not supported, and the usual way is to patch the build system to avoid it; some systems do enable it by default, and it increases the requirements to build glibc in such cases (it also does not help newcomers when trying to build glibc). The conform namespace and linknamespace tests also do not expect that flag to be set by default, so disable it as well. Checked with a build/check for major ABI and some (i386, arm, mipsel, hppa) with a toolchain that has LFS flags by default. --- Makeconfig | 3 +++ configure | 30 ++++++++++++++++++++++++++++++ configure.ac | 11 +++++++++++ conform/Makefile | 2 +- 4 files changed, 45 insertions(+), 1 deletion(-) diff --git a/Makeconfig b/Makeconfig index c0c89e6685..a0abc2239b 100644 --- a/Makeconfig +++ b/Makeconfig @@ -1014,6 +1014,9 @@ endif # Filter out LFS flags if compiler defines it by default. +cflags += $(no-file-offset-bits-source) +# Filter out 64 bit time_t flags if compiler defines it by default. ++cflags += $(no-time-bits-source) + # Each sysdeps directory can contain header files that both will be # used to compile and will be installed. Each can also contain an # include/ subdirectory, whose header files will be used to compile diff --git a/configure b/configure index 5b9cc51067..9c0c0dce03 100755 --- a/configure +++ b/configure @@ -635,6 +635,7 @@ libc_cv_gcc_unwind_find_fde libc_extra_cppflags libc_extra_cflags libc_cv_cxx_thread_local +no_time_bits_source no_file_offset_bits_source fortify_source no_fortify_source @@ -7815,6 +7816,35 @@ fi config_vars="$config_vars no-file-offset-bits-source = $no_file_offset_bits_source" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main (void) +{ + +#ifndef _TIME_BITS +# error _TIME_BITS not defined +#endif + ; + return 0; +} +_ACEOF +if ac_fn_c_try_cpp "$LINENO" +then : + libc_cv_compiler_default_time_bits=yes +else case e in #( + e) libc_cv_compiler_default_time_bits=no ;; +esac +fi +rm -f conftest.err conftest.i conftest.$ac_ext +if test "$libc_cv_compiler_default_time_bits" = yes +then : + no_time_bits_source="-U_TIME_BITS" +fi + +config_vars="$config_vars +no-time-bits-source = $no_time_bits_source" { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether the assembler requires one version per symbol" >&5 printf %s "checking whether the assembler requires one version per symbol... " >&6; } diff --git a/configure.ac b/configure.ac index 160c863416..d5a00461ff 100644 --- a/configure.ac +++ b/configure.ac @@ -1576,6 +1576,17 @@ AS_IF([test "$libc_cv_compiler_default_file_offset_bits" = yes], AC_SUBST(no_file_offset_bits_source) LIBC_CONFIG_VAR([no-file-offset-bits-source], [$no_file_offset_bits_source]) +dnl Check if compiler define _TIME_BITS by default +AC_PREPROC_IFELSE([AC_LANG_PROGRAM([[]], [[ +#ifndef _TIME_BITS +# error _TIME_BITS not defined +#endif]])], + [libc_cv_compiler_default_time_bits=yes], + [libc_cv_compiler_default_time_bits=no]) +AS_IF([test "$libc_cv_compiler_default_time_bits" = yes], + [no_time_bits_source="-U_TIME_BITS"]) +AC_SUBST(no_time_bits_source) +LIBC_CONFIG_VAR([no-time-bits-source], [$no_time_bits_source]) dnl Starting with binutils 2.35, GAS can attach multiple symbol versions dnl to one symbol (PR 23840). diff --git a/conform/Makefile b/conform/Makefile index 50293a195b..57a1f5b546 100644 --- a/conform/Makefile +++ b/conform/Makefile @@ -372,7 +372,7 @@ test-xfail-UNIX98/ndbm.h/conform = yes test-xfail-XOPEN2K/ndbm.h/conform = yes test-xfail-XOPEN2K8/ndbm.h/conform = yes -conformtest-cc-flags = -I../include $(+sysdep-includes) $(sysincludes) -I.. $(no-file-offset-bits-source) +conformtest-cc-flags = -I../include $(+sysdep-includes) $(sysincludes) -I.. $(no-file-offset-bits-source) $(no-time-bits-source) # conformtest-xfail-conds may be set by a sysdeps Makefile fragment to # a list of conditions that are considered to be true when encountered # in xfail[cond]- lines in test expectations.