From patchwork Sun Nov 3 22:22:20 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lewis Hyatt X-Patchwork-Id: 2005832 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20230601 header.b=kiLpWS7d; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=2620:52:3:1:0:246e:9693:128c; helo=server2.sourceware.org; envelope-from=gcc-patches-bounces~incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=patchwork.ozlabs.org) Received: from server2.sourceware.org (server2.sourceware.org [IPv6:2620:52:3:1:0:246e:9693:128c]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4XhTm26C1Rz1xwV for ; Mon, 4 Nov 2024 09:29:03 +1100 (AEDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id C765F3857C63 for ; Sun, 3 Nov 2024 22:28:59 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-qv1-xf33.google.com (mail-qv1-xf33.google.com [IPv6:2607:f8b0:4864:20::f33]) by sourceware.org (Postfix) with ESMTPS id 391993857833 for ; Sun, 3 Nov 2024 22:23:03 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 391993857833 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 391993857833 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2607:f8b0:4864:20::f33 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1730672595; cv=none; b=RqcvV21Fi1Z4+zksFkYPlSL5Zit3ai+b0NpFevH1bXwz1w3Np/l6RjfQiLEItTwoBS2Mew7TYuVQszOZ6PF5g0WvWX2vHydabqaC6RHtFym1GjSO3CA5RxEpI2HDY7X0Juy8Lp74OWG/1pUuJ1KrwcADVlzFSgE4Z7y2JZ2NDik= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1730672595; c=relaxed/simple; bh=Tp7IufBTE4bAFbdBQfC9ZV3toPyLqUjFHxo5KieLl+M=; h=DKIM-Signature:From:To:Subject:Date:Message-Id:MIME-Version; b=MYwVAqmrj7WnyQ+aAexJMN+mbgauYpkyuvIF7zpHsR3HD6YRSj95RpzEYS2fGl3ljgYFk6cTfu53kgu+36OzhzigZ1VQ/Ux6FJXl00rVgmvflHSQn+J6BTy0/FHKDq7t2MGoLHbwCidTAu/h34ZF0aaCFvqOWhbPI4nhR4yQXlE= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-qv1-xf33.google.com with SMTP id 6a1803df08f44-6cbf0e6414aso20394126d6.1 for ; Sun, 03 Nov 2024 14:23:03 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1730672582; x=1731277382; darn=gcc.gnu.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=EdpW2EHv3bE0RnxLOpJhkvUWJxdEjv4mpVymeDKzZBY=; b=kiLpWS7dAx2T08U1j1yQkt0qCGAHUWokWJHSlShPMV67nIWcZI1tFkAx2e627FMkxP wpLahzDtqxXUcfrDh8V7o2prq39rwpjwktVpaKn1tIvxm9Vj+ZgZqw5uDYf1E99hp+Cb c7c5fDcQOlkerhdwnvjnYwpgBdsuynZDc7jcv8FTHvsQ0eHW5GHFnxhRZqJyOESDt9kl Re8302pFiaWC6JH/f4Lb5IcwAVitKXWi4EMbgg02JwQ+v74yxBGGl369OatdZt1N5Uy4 T2Faf4tniHIGLZq7zn/ysIx3e+8kFTgF7BkQmWg23zUpMK6r0O/A+lVzbNEzzff/ZoG8 VJMw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1730672582; x=1731277382; 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=EdpW2EHv3bE0RnxLOpJhkvUWJxdEjv4mpVymeDKzZBY=; b=HQ3lTGvK3rkAkop6FpzmV7qTc6V77oTX9+DF+iwyE3HdW8qiUoy9FRDlMFJNOoWGBD 1JdVIj/vGmr5xdMSFScbHQ1sHsq0FjtxQIOHBDZBaFnnCKFjsj+3FMvxg9NAM5NIMHbP cxA4PkcD23YCFY5cuwo3MuDdkMwoyIZSh2t6FATHfkecjlM/Vymv1ydbGOQhZIcchXwl SCTSWhWPWcOhd5szBcidsgOJiB6qRj7pbVHXl8t5ENtZmiffnImEctSWAbjHTXolwYaQ UOjpoXWIp5opCYToiXmz1XX8IZs+gr0X3b3r1eYIScNq5j3Zl2CWzMEWxADpHNSV0wQF C1Iw== X-Gm-Message-State: AOJu0YyLCoVl6lJx/qQofHSqhXWvSJEE2cPXLMaxIOGZRtrpB+7y7Mce AZXjGH9h7f7JHID+/lKxJwmsc7fElcv+zh29UIBt+o3+Pt7nPEwOiCuKaA== X-Google-Smtp-Source: AGHT+IEKeJs2JtI/+4wkGxyLDJ3zUptW02FimPQl1NvPpzz5NIULvW86ZLbw/xHIirzEbcL+eA4u7w== X-Received: by 2002:a05:6214:4b02:b0:6cb:afe7:1403 with SMTP id 6a1803df08f44-6d185866d2fmr471694406d6.48.1730672582492; Sun, 03 Nov 2024 14:23:02 -0800 (PST) Received: from localhost.localdomain ([173.54.240.58]) by smtp.gmail.com with ESMTPSA id 6a1803df08f44-6d35415b2fesm42025866d6.92.2024.11.03.14.23.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 03 Nov 2024 14:23:01 -0800 (PST) From: Lewis Hyatt To: gcc-patches@gcc.gnu.org Cc: Lewis Hyatt Subject: [PATCH 15/15] Support for 64-bit location_t: Configury parts Date: Sun, 3 Nov 2024 17:22:20 -0500 Message-Id: <20241103222220.933471-16-lhyatt@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241103222220.933471-1-lhyatt@gmail.com> References: <20241103222220.933471-1-lhyatt@gmail.com> MIME-Version: 1.0 X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gcc-patches-bounces~incoming=patchwork.ozlabs.org@gcc.gnu.org Add --enable-large-source-locations (off by default for now) to enable 64-bit location_t. gcc/ChangeLog: * configure.ac: Add --enable-large-source-locations. * config.in: Regenerate. * configure: Regenerate. * doc/install.texi: Document the new option. libcpp/ChangeLog: * configure.ac: Add --enable-large-source-locations. * config.in: Regenerate. * configure: Regenerate. --- libcpp/config.in | 3 +++ libcpp/configure | 17 +++++++++++++++++ libcpp/configure.ac | 11 +++++++++++ gcc/config.in | 6 ++++++ gcc/configure | 21 +++++++++++++++++++-- gcc/configure.ac | 11 +++++++++++ gcc/doc/install.texi | 15 +++++++++++++++ 7 files changed, 82 insertions(+), 2 deletions(-) diff --git a/libcpp/config.in b/libcpp/config.in index b2e2f4e842c..74ff169a322 100644 --- a/libcpp/config.in +++ b/libcpp/config.in @@ -20,6 +20,9 @@ /* Define to enable system headers canonicalization. */ #undef ENABLE_CANONICAL_SYSTEM_HEADERS +/* Define to enable 64-bit locations. */ +#undef ENABLE_LARGE_SOURCE_LOCATIONS + /* Define to 1 if translation of program messages to the user's native language is requested. */ #undef ENABLE_NLS diff --git a/libcpp/configure b/libcpp/configure index 1391081ba09..eca82ab568f 100755 --- a/libcpp/configure +++ b/libcpp/configure @@ -753,6 +753,7 @@ enable_host_shared enable_host_pie enable_cet enable_valgrind_annotations +enable_large_source_locations ' ac_precious_vars='build_alias host_alias @@ -1397,6 +1398,8 @@ Optional Features: --enable-cet enable Intel CET in host libraries [default=auto] --enable-valgrind-annotations enable valgrind runtime interaction + --enable-large-source-locations + enable 64-bit source locations Optional Packages: --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] @@ -9416,6 +9419,20 @@ $as_echo "#define ENABLE_VALGRIND_WORKAROUNDS 1" >>confdefs.h fi +# Specify whether to use 64-bit locations +# Check whether --enable-large-source-locations was given. +if test "${enable_large_source_locations+set}" = set; then : + enableval=$enable_large_source_locations; +else + enable_large_source_locations=no +fi + +if test x$enable_large_source_locations != xno; then + +$as_echo "#define ENABLE_LARGE_SOURCE_LOCATIONS 1" >>confdefs.h + +fi + # Output. ac_config_headers="$ac_config_headers config.h:config.in" diff --git a/libcpp/configure.ac b/libcpp/configure.ac index 981f97c4abd..091bbc44537 100644 --- a/libcpp/configure.ac +++ b/libcpp/configure.ac @@ -246,6 +246,17 @@ if test x$enable_valgrind_annotations != xno \ possible memory leaks because of libcpp use of interior pointers.]) fi +# Specify whether to use 64-bit locations +AC_ARG_ENABLE([large-source-locations], +[AC_HELP_STRING([--enable-large-source-locations], + [enable 64-bit source locations])], +[], +enable_large_source_locations=no) +if test x$enable_large_source_locations != xno; then + AC_DEFINE(ENABLE_LARGE_SOURCE_LOCATIONS, + 1, [Define to enable 64-bit locations.]) +fi + # Output. AC_CONFIG_HEADERS(config.h:config.in, [echo timestamp > stamp-h1]) diff --git a/gcc/config.in b/gcc/config.in index 0a506d1783a..ed779e78a12 100644 --- a/gcc/config.in +++ b/gcc/config.in @@ -206,6 +206,12 @@ #endif +/* Define to enable 64-bit locations. */ +#ifndef USED_FOR_TARGET +#undef ENABLE_LARGE_SOURCE_LOCATIONS +#endif + + /* Define if gcc should always pass --build-id to linker. */ #ifndef USED_FOR_TARGET #undef ENABLE_LD_BUILDID diff --git a/gcc/configure b/gcc/configure index 150ab616414..490f070c820 100755 --- a/gcc/configure +++ b/gcc/configure @@ -1059,6 +1059,7 @@ with_diagnostics_urls enable_default_pie enable_cet enable_s390_excess_float_precision +enable_large_source_locations ' ac_precious_vars='build_alias host_alias @@ -1832,6 +1833,8 @@ Optional Features: --enable-s390-excess-float-precision on s390 targets, evaluate float with double precision when in standards-conforming mode + --enable-large-source-locations + enable 64-bit source locations Optional Packages: --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] @@ -21454,7 +21457,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF -#line 21457 "configure" +#line 21460 "configure" #include "confdefs.h" #if HAVE_DLFCN_H @@ -21560,7 +21563,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF -#line 21563 "configure" +#line 21566 "configure" #include "confdefs.h" #if HAVE_DLFCN_H @@ -34912,6 +34915,20 @@ _ACEOF { $as_echo "$as_me:${as_lineno-$LINENO}: result: $fhardened_support" >&5 $as_echo "$fhardened_support" >&6; } +# Specify whether to use 64-bit locations +# Check whether --enable-large-source-locations was given. +if test "${enable_large_source_locations+set}" = set; then : + enableval=$enable_large_source_locations; +else + enable_large_source_locations=no +fi + +if test x$enable_large_source_locations != xno; then + +$as_echo "#define ENABLE_LARGE_SOURCE_LOCATIONS 1" >>confdefs.h + +fi + # Configure the subdirectories # AC_CONFIG_SUBDIRS($subdirs) diff --git a/gcc/configure.ac b/gcc/configure.ac index bdb22d53e2c..c742229db47 100644 --- a/gcc/configure.ac +++ b/gcc/configure.ac @@ -7951,6 +7951,17 @@ AC_DEFINE_UNQUOTED(HAVE_FHARDENED_SUPPORT, [Define 0/1 if -fhardened is supported]) AC_MSG_RESULT($fhardened_support) +# Specify whether to use 64-bit locations +AC_ARG_ENABLE([large-source-locations], +[AC_HELP_STRING([--enable-large-source-locations], + [enable 64-bit source locations])], +[], +enable_large_source_locations=no) +if test x$enable_large_source_locations != xno; then + AC_DEFINE(ENABLE_LARGE_SOURCE_LOCATIONS, + 1, [Define to enable 64-bit locations.]) +fi + # Configure the subdirectories # AC_CONFIG_SUBDIRS($subdirs) diff --git a/gcc/doc/install.texi b/gcc/doc/install.texi index b562b0f38d6..7bb643be8aa 100644 --- a/gcc/doc/install.texi +++ b/gcc/doc/install.texi @@ -2607,6 +2607,21 @@ include and lib options directly. These flags are applicable to the host platform only. When building a cross compiler, they will not be used to configure target libraries. + +@item --enable-large-source-locations +In order to reduce peak memory usage, GCC uses an optimized data +structure for storing the locations of source code it has parsed from +its input. This structure uses a 32-bit key to represent source +locations, which restricts the number of lines and columns that can be +tracked (per source file, or within one source file) for sufficiently +large source files. This can become evident as a degradation in the +quality of diagnostics; those users who want to support large source +files without encountering such issues and do not mind the extra +memory consumption may use @option{--enable-large-source-locations} +to switch to a 64-bit location type that is free of such practical +issues. This may become the default for some targets in a future +version of GCC. + @end table @subheading Cross-Compiler-Specific Options