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.