From patchwork Fri Dec 27 21:47:56 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thiago Jung Bauermann X-Patchwork-Id: 853842 Delivered-To: patch@linaro.org Received: by 2002:a5d:4888:0:b0:385:e875:8a9e with SMTP id g8csp5435837wrq; Fri, 27 Dec 2024 13:48:25 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCVHmZ01DOxIYPhCsqos+C/Dgo9il6HQhAPvBCdBvOUWpKuuADLbcSo3rW9hJxVmE8fiYiDO+w==@linaro.org X-Google-Smtp-Source: AGHT+IESAMCPeE7ZRvoJflc9mAVmTDEpp9SKm//PXWUv/+iQki8MbOimbOgIoWMkGNfeGeszizih X-Received: by 2002:a05:622a:287:b0:467:5836:a98 with SMTP id d75a77b69052e-46a4a8cdd59mr518527331cf.19.1735336105389; Fri, 27 Dec 2024 13:48:25 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1735336105; cv=pass; d=google.com; s=arc-20240605; b=F+g+E171FBgVTVeB7YC5HXIUXyMx1G7f5w2VEtpORGBHphScXnAJqh68J+VGZZmg4R DJ10Nunuo/lD4Sv0fnSv7mzHj+2JnPMUp1KwzQkpR7CX8qC0OXpvLXukxIsUsGMhZ3jZ kIe1RUfFcRz/vxbhgH2LR/3/FVSTMaXbymmicHBik+bQwrQSBv6xGN6Uphct2f9KsMdS Xvpc1zlM/nDdgvTi2IyPy/C20csItokCHFM9rAQa+WkmbfZpRxLcTFAxr1f1WtMCfR6Y imOTykjUcTa3OuWdEePcRiE88O11WX6W6M7QRMsVvn82hLr54xfopc6QQNUi0yiwzT3B +7vg== 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:message-id:date:subject:to:from:dkim-signature :dkim-filter:arc-filter:dmarc-filter:delivered-to:dkim-filter; bh=R2xdShvN9qU0LMPZirrqkAw5rUqR9wZ/Du3RQC4Z1o0=; fh=hPrbWPhweUx4V0GV9uXJqbyAzg2ABmTz7kczrAQqMmM=; b=OAIRTzYoYmOScfvPaaUem6RdJ+0tqPNs/B6Rx+Plulu5aGSmgg3yl1FBEcEIN6g9f9 PKPe9sL0Ad7A+CwCYhEhgVOiWofBPZTb2ifxnrO3DmB52euZcSdPxPIE1W3XQTg8HsOS vsbVmV8dHoJ1xUffFY2FesdIfpnOcub2cQ9kGwgsPe1nBN2UaadVGzB9d6TbuInckema jdp88G8IeZjr9svCbTbveLxA0y7GTjoeP12xIxOFfdAywXnOf4BHZkMHGA0SFBzc2qeN 05gJipEso7VErW2EQk0Yh27tYaK9Bx8twpVMlVBsabgZG1kJI+trIzyg9CrG7sUvAD+I qAaQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=nb2YOdl+; arc=pass (i=1); spf=pass (google.com: domain of gcc-patches-bounces~patch=linaro.org@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="gcc-patches-bounces~patch=linaro.org@gcc.gnu.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 d75a77b69052e-46a3ec0655fsi230009851cf.705.2024.12.27.13.48.25 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 27 Dec 2024 13:48:25 -0800 (PST) Received-SPF: pass (google.com: domain of gcc-patches-bounces~patch=linaro.org@gcc.gnu.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=nb2YOdl+; arc=pass (i=1); spf=pass (google.com: domain of gcc-patches-bounces~patch=linaro.org@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="gcc-patches-bounces~patch=linaro.org@gcc.gnu.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 D9E583858C35 for ; Fri, 27 Dec 2024 21:48:24 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org D9E583858C35 Authentication-Results: sourceware.org; dkim=pass (2048-bit key, unprotected) header.d=linaro.org header.i=@linaro.org header.a=rsa-sha256 header.s=google header.b=nb2YOdl+ X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-pj1-x1032.google.com (mail-pj1-x1032.google.com [IPv6:2607:f8b0:4864:20::1032]) by sourceware.org (Postfix) with ESMTPS id F3D4F3858CDB for ; Fri, 27 Dec 2024 21:48:00 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org F3D4F3858CDB 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 F3D4F3858CDB Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2607:f8b0:4864:20::1032 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1735336081; cv=none; b=iTHnAvS+8eh6O9uL3tuanDY4tmsg59LQxwCxGypyKBsb99sUcFYYR4fZrlxYd7hPCWuZXUTmfixgyVX4NNCnT5ovTqHsYv4ejudNxb6abYe9JYvHvbq2a/7CB5D2vDnvLdAofCiIwIkaNplVLJyUV7mW7zzO2+VuCsl7oOf+Jqc= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1735336081; c=relaxed/simple; bh=0fCdRoK/seFoSo7vNgclmDDm0GawSeMJMg8XhwmdDOA=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=oRdZUylt3AIm8o1et2/zMi6TwPta1LIwon4pw1cR88RLm0et4501pyPtF/m3vsX7Gw4rHumZkEm77KlzpB7rY18yZufOOq+eHVWRQYFJxnoUNGoFghcTNLxXrvHpLbFrLgPcqRZlTHLZuSfuv/YPnIwQYPXK5lK+KUxzKIm5/90= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org F3D4F3858CDB Received: by mail-pj1-x1032.google.com with SMTP id 98e67ed59e1d1-2f44353649aso7660948a91.0 for ; Fri, 27 Dec 2024 13:48:00 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1735336080; x=1735940880; darn=gcc.gnu.org; h=content-transfer-encoding:mime-version:message-id:date:subject:to :from:from:to:cc:subject:date:message-id:reply-to; bh=R2xdShvN9qU0LMPZirrqkAw5rUqR9wZ/Du3RQC4Z1o0=; b=nb2YOdl+O1xagnHxeZX/uBONO8JzTKWOJ6kb/KLpQM66B1/hnCAXxmTmnev5FHy0mP 12fptQ6evKrQB87mlq+CFtzTfVbw8IjJW8R2PiHvaYCVS16FBUhidC78N21kp/U7c4Ue u68KcT/YtXQHo6ZdxEKVQUnkG1dU9/jWnJkS4mwhG+h5latiT19RBFLyZz+GhPZv3BvH wOo4nDNNKP0hyxyl794WGvHf3LVepvGv9G8TNHe4aHlmYG/+iZdt/DJZQ5hH8H99PORn /bj0dwNLlN82Va5B4KJLstRhelTfCGmx6cHJzHqrvvfIVocKlnCf7MaXt5bqPLMS7Q2D nZ2A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1735336080; x=1735940880; h=content-transfer-encoding:mime-version:message-id:date:subject:to :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=R2xdShvN9qU0LMPZirrqkAw5rUqR9wZ/Du3RQC4Z1o0=; b=J8D3QkXk/X07iWsOddEMOKSbgwGAJDtjR9pDsf1zz4qXwVHqHa9/3QmgADWXQhfzVy V9tN7gFwPN8Viqh+DeOPm3/YxhEBHrHQtLCVW2vc+W/SgoHCmup+OfK33DTPGb3pVVIJ NG1dczfNrOUlBAbS09YkaqugHBxBw8I5GBSuHQyLPY81lcABl3wUvdkkiTUB73o1PHBI 2om7glUoCiMSulhc9z1i9U8Bq17VOBu8/0j66nADtinfQCw7Pu/2ifmcx3lp5H97vUXN kVfSIXAu4Doy+P61NsQdpAhEDGRaLJFEkabg2+xWnwg+YTNopitKz7Ki0fly7Y7ZK8dF 7bRw== X-Gm-Message-State: AOJu0YxMJ1oeWuJFu6zTAtcH+7gt/VVBWjVHL4u8xQzbZoG+WKMTfM06 Nf+jPf8LZAU+LxKPKkYPCP7Avqp2lEon+L3ECyRijw/Slusw9+5n8+eqZi+oxdv65ZYp9zaeggc u X-Gm-Gg: ASbGnctyhMJmos3KIXdlZQNL+ZMWqwU9ec31IMLN9NLrWffSUYw9jDxWrgLSPNLuje+ wFDBiw/BJmRt4JnbviZBVdVdv0q4h4iUUiR+AdAFRSzrA9b5T48kDtFfXZrFiEblD0NpK/UoI0h Nicc7tud8NapicLh8Y8vZnqXQQmYxScNIdO8JPwvPLgSq0p1TYblCXwaVxwnFaBBkawezVjAPUi rpI/LoOPBqmjymxrLqsV6wRTma/ahcsDjUyHmiTRAcY8BS3JWvxwCzxWHBM3ZzCUNw= X-Received: by 2002:a17:90b:2745:b0:2ee:d824:b559 with SMTP id 98e67ed59e1d1-2f452ec7001mr38366598a91.28.1735336079934; Fri, 27 Dec 2024 13:47:59 -0800 (PST) Received: from localhost ([2804:14d:7e39:8470:a8df:ebc2:3206:ac52]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-2f4478ac93asm16243741a91.47.2024.12.27.13.47.58 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 27 Dec 2024 13:47:59 -0800 (PST) From: Thiago Jung Bauermann To: gcc-patches@gcc.gnu.org Subject: [PATCH] gcc/configure: Fix check for assembler section merging support on Arm Date: Fri, 27 Dec 2024 18:47:56 -0300 Message-ID: <20241227214756.1059146-1-thiago.bauermann@linaro.org> X-Mailer: git-send-email 2.47.1 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~patch=linaro.org@gcc.gnu.org In 32-bit Arm assembly, the @ character is the start of a comment so the section type needs to use the % character instead. configure.ac attempts to account for this difference by doing a second try when checking the assembler for section merging support. Unfortunately there is a bug: because the gcc_GAS_CHECK_FEATURE macro has a call to AC_CACHE_CHECK, it will actually skip the second try because the gcc_cv_as_shf_merge variable has already been set: checking assembler for section merging support... no checking assembler for section merging support... (cached) no Fix by using a separate variable for the second try, as is done in the check for COMDAT group support. This problem was noticed because the recent binutils commit d5cbf916be4a ("gas/ELF: also reject merge entity size being zero") caused gas to be stricter about mergeable sections without an entity size: configure:27013: checking assembler for section merging support configure:27022: /path/to/as --fatal-warnings -o conftest.o conftest.s >&5 conftest.s: Assembler messages: conftest.s:1: Warning: invalid merge / string entity size conftest.s: Error: 1 warning, treating warnings as errors configure:27025: $? = 1 configure: failed program was .section .rodata.str, "aMS", @progbits, 1 configure:27036: result: no In previous versions of gas the conftest.s program above was accepted and configure detected support for section merging. See also: https://linaro.atlassian.net/browse/GNU-1427 https://sourceware.org/bugzilla/show_bug.cgi?id=32491 Tested on armv8l-linux-gnueabihf. gcc/ChangeLog: * configure.ac: Fix check for HAVE_GAS_SHF_MERGE on Arm targets. * configure: Regenerate. --- gcc/configure | 17 +++++++++-------- gcc/configure.ac | 6 ++++-- 2 files changed, 13 insertions(+), 10 deletions(-) base-commit: d09628742bb17719360ff447a8e604f5c6801bdf diff --git a/gcc/configure b/gcc/configure index a8b531d8fae0..0bc33f0ede18 100755 --- a/gcc/configure +++ b/gcc/configure @@ -27038,12 +27038,12 @@ $as_echo "$gcc_cv_as_shf_merge" >&6; } if test $gcc_cv_as_shf_merge = no; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking assembler for section merging support" >&5 -$as_echo_n "checking assembler for section merging support... " >&6; } -if ${gcc_cv_as_shf_merge+:} false; then : + { $as_echo "$as_me:${as_lineno-$LINENO}: checking assembler for section merging support (%progbits)" >&5 +$as_echo_n "checking assembler for section merging support (%progbits)... " >&6; } +if ${gcc_cv_as_shf_merge_percent+:} false; then : $as_echo_n "(cached) " >&6 else - gcc_cv_as_shf_merge=no + gcc_cv_as_shf_merge_percent=no if test x$gcc_cv_as != x; then $as_echo '.section .rodata.str, "aMS", %progbits, 1' > conftest.s if { ac_try='$gcc_cv_as $gcc_cv_as_flags --fatal-warnings -o conftest.o conftest.s >&5' @@ -27053,7 +27053,7 @@ else $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; } then - gcc_cv_as_shf_merge=yes + gcc_cv_as_shf_merge_percent=yes else echo "configure: failed program was" >&5 cat conftest.s >&5 @@ -27061,14 +27061,15 @@ else rm -f conftest.o conftest.s fi fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gcc_cv_as_shf_merge" >&5 -$as_echo "$gcc_cv_as_shf_merge" >&6; } +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gcc_cv_as_shf_merge_percent" >&5 +$as_echo "$gcc_cv_as_shf_merge_percent" >&6; } fi cat >>confdefs.h <<_ACEOF -#define HAVE_GAS_SHF_MERGE `if test $gcc_cv_as_shf_merge = yes; then echo 1; else echo 0; fi` +#define HAVE_GAS_SHF_MERGE `if test $gcc_cv_as_shf_merge = yes \ + || test $gcc_cv_as_shf_merge_percent = yes; then echo 1; else echo 0; fi` _ACEOF diff --git a/gcc/configure.ac b/gcc/configure.ac index 77fab885a428..1407c86e355b 100644 --- a/gcc/configure.ac +++ b/gcc/configure.ac @@ -3612,12 +3612,14 @@ gcc_GAS_CHECK_FEATURE(section merging support, gcc_cv_as_shf_merge, [--fatal-warnings], [.section .rodata.str, "aMS", @progbits, 1]) if test $gcc_cv_as_shf_merge = no; then - gcc_GAS_CHECK_FEATURE(section merging support, gcc_cv_as_shf_merge, + gcc_GAS_CHECK_FEATURE(section merging support (%progbits), + gcc_cv_as_shf_merge_percent, [--fatal-warnings], [.section .rodata.str, "aMS", %progbits, 1]) fi AC_DEFINE_UNQUOTED(HAVE_GAS_SHF_MERGE, - [`if test $gcc_cv_as_shf_merge = yes; then echo 1; else echo 0; fi`], + [`if test $gcc_cv_as_shf_merge = yes \ + || test $gcc_cv_as_shf_merge_percent = yes; then echo 1; else echo 0; fi`], [Define 0/1 if your assembler supports marking sections with SHF_MERGE flag.]) gcc_GAS_CHECK_FEATURE([COMDAT group support (GNU as)],