Message ID | 20240317054631.848645-1-syq@gcc.gnu.org |
---|---|
State | New |
Headers |
Return-Path: <gcc-patches-bounces+patchwork=sourceware.org@gcc.gnu.org> X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id BAFA53858413 for <patchwork@sourceware.org>; Sun, 17 Mar 2024 05:47:30 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org BAFA53858413 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1710654450; bh=5OCGNzXVBIuLN1LX8Kl4F5f/qnHTjBi0EE2KQUCI+EY=; h=From:To:Cc:Subject:Date:List-Id:List-Unsubscribe:List-Archive: List-Post:List-Help:List-Subscribe:From; b=F3zttR8FU3xYJ2IhttztaNClU2NfzNXFb38/uvM9OkTmf1YshPvwzzHway5QW+jSJ 2nKGAU7Xn07uC71uPKnVYnb1VxUnq1cas6aEYfkX5E/BrltSaBNTf35W+kG5qEP9ae JrMYPVQGzVhW2jJKyeFGZ1jk8JhO+b24Ucf+6xY4= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-pl1-f171.google.com (mail-pl1-f171.google.com [209.85.214.171]) by sourceware.org (Postfix) with ESMTPS id CF6EF3858D20; Sun, 17 Mar 2024 05:46:44 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org CF6EF3858D20 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=gcc.gnu.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org CF6EF3858D20 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=209.85.214.171 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1710654407; cv=none; b=oK2PBDG4pWMRkalchPbS4cmCbH2+WM28Dz4qhJ1Dnr1b57CA8DWdXoT6F6lTg3NtaVyAKlFfacBw5bT8T5PzI99Q4+fq3G4Y94ZNf5UHxRmLZTGRakIlks6Wa2X5Cwd0MjwcZB7hrTpz4Di/5lzFRushJek+1jRMaBIQV6c+iXs= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1710654407; c=relaxed/simple; bh=dSKM73YKrym+Vcx65ald+W8xz9mD3lvHtk+WrEMIMK4=; h=From:To:Subject:Date:Message-Id:MIME-Version; b=lSCINGHrhlcbKsqTix3hAh2YcTdImoo9qEHvToEsRoJ48VRAA5xRiXe+02elqathgczDpMRoG6o68v2HGh8zUW1+QfY4WuAmV9JveSBEQkW3Av0MxdcYmXLSrhfeiHxV0F+aKsDh/lth4XeWnNr8nvlAn4Xdt90FuNa8ZmXTsgU= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-pl1-f171.google.com with SMTP id d9443c01a7336-1deffa23bb9so10037865ad.2; Sat, 16 Mar 2024 22:46:44 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1710654403; x=1711259203; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=5OCGNzXVBIuLN1LX8Kl4F5f/qnHTjBi0EE2KQUCI+EY=; b=A3YuW+2nbOX3Ng32njEyxLAmFoq0Q8m8E9HvoWlqF0K3mHjDNvJAM4hZocDWp+eE24 C0pMTEnAsdCc5wHet0pFuELvkkNxaLP++tLOKharaDQtlcJn9pPrt3pjvOWDLemKcVu0 NMHipCFqiAmPXMcO9LLQfBJMt0YEtxu0uXIX9FeDSxOuRyDh3F5zjUFuWmsU6fcWXTjk 1rBR60iyETbnyFcHAQWC7W4kZA0borigVQoHy+XzXpN/cdFQ9NgqVLhYc9K6mObK0LaA l/LaPUM5pEv9C+Vox4yjcgMQkK0CrakPJfg7zmL6xeHx83apcZyPTAlWI53W7jGP4402 2y1w== X-Gm-Message-State: AOJu0Yy6LfBzuw5BMLzGt8EK+xicqQmd/X7we4eYvbzF4d1WdKVuK7tW Wg720SgU1DqNtLOLmXViqRewVOwnD5d2ujZQ1ncDBnM8vuBVbrurRoNs0Jdxa+A= X-Google-Smtp-Source: AGHT+IG0KqITnX2JVLdeJyoCAZ0yAu4EwD3xcUcmE0yymyRJs67Tp1AvqLlkUAk2C+CJigFNzm6tKA== X-Received: by 2002:a17:903:187:b0:1de:de58:2a55 with SMTP id z7-20020a170903018700b001dede582a55mr11019906plg.26.1710654403209; Sat, 16 Mar 2024 22:46:43 -0700 (PDT) Received: from localhost.localdomain ([149.248.38.156]) by smtp.gmail.com with ESMTPSA id x7-20020a170902a38700b001dee4bd73e0sm5414184pla.59.2024.03.16.22.46.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 16 Mar 2024 22:46:42 -0700 (PDT) From: YunQiang Su <syq@gcc.gnu.org> To: gcc-patches@gcc.gnu.org Cc: pinskia@gcc.gnu.org, i@maskray.me, rguenther@suse.de Subject: [PATCH] Predefine __STRICT_ALIGN__ if STRICT_ALIGNMENT Date: Sun, 17 Mar 2024 13:46:31 +0800 Message-Id: <20240317054631.848645-1-syq@gcc.gnu.org> X-Mailer: git-send-email 2.39.2 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-11.0 required=5.0 tests=BAYES_00, FREEMAIL_FORGED_FROMDOMAIN, FREEMAIL_FROM, GIT_PATCH_0, HEADER_FROM_DIFFERENT_DOMAINS, KAM_DMARC_STATUS, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE 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: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gcc-patches mailing list <gcc-patches.gcc.gnu.org> List-Unsubscribe: <https://gcc.gnu.org/mailman/options/gcc-patches>, <mailto:gcc-patches-request@gcc.gnu.org?subject=unsubscribe> List-Archive: <https://gcc.gnu.org/pipermail/gcc-patches/> List-Post: <mailto:gcc-patches@gcc.gnu.org> List-Help: <mailto:gcc-patches-request@gcc.gnu.org?subject=help> List-Subscribe: <https://gcc.gnu.org/mailman/listinfo/gcc-patches>, <mailto:gcc-patches-request@gcc.gnu.org?subject=subscribe> Errors-To: gcc-patches-bounces+patchwork=sourceware.org@gcc.gnu.org |
Series |
Predefine __STRICT_ALIGN__ if STRICT_ALIGNMENT
|
|
Checks
Context | Check | Description |
---|---|---|
linaro-tcwg-bot/tcwg_gcc_build--master-arm | success | Testing passed |
linaro-tcwg-bot/tcwg_gcc_check--master-arm | success | Testing passed |
linaro-tcwg-bot/tcwg_gcc_build--master-aarch64 | success | Testing passed |
linaro-tcwg-bot/tcwg_gcc_check--master-aarch64 | success | Testing passed |
Commit Message
YunQiang Su
March 17, 2024, 5:46 a.m. UTC
Arm32 predefines __ARM_FEATURE_UNALIGNED if -mno-unaligned-access, and RISC-V predefines __riscv_misaligned_avoid, while other ports that support -mstrict-align/-mno-unaligned-access don't have such macro, and these backend macros are only avaiable for c-family. Note: Arm64 always predefine __ARM_FEATURE_UNALIGNED: See #111555. Let's add a generic one. __STRICT_ALIGN__ is used instead of __STRICT_ALIGNMENT__, due to that the later is used by some softwares, such as lzo2, syslinux etc. gcc * cppbuiltin.cc: Predefine __STRICT_ALIGNMENT__ if STRICT_ALIGNMENT. --- gcc/cppbuiltin.cc | 3 +++ 1 file changed, 3 insertions(+)
Comments
YunQiang Su <syq@gcc.gnu.org> writes: > Arm32 predefines __ARM_FEATURE_UNALIGNED if -mno-unaligned-access, > and RISC-V predefines __riscv_misaligned_avoid, while other ports > that support -mstrict-align/-mno-unaligned-access don't have such > macro, and these backend macros are only avaiable for c-family. > Note: Arm64 always predefine __ARM_FEATURE_UNALIGNED: See #111555. I would say tag the bug even if you're not fixing it, as it was related enough for you to cite it. > > Let's add a generic one. > > __STRICT_ALIGN__ is used instead of __STRICT_ALIGNMENT__, due to that > the later is used by some softwares, such as lzo2, syslinux etc. > > gcc > * cppbuiltin.cc: Predefine __STRICT_ALIGNMENT__ if > STRICT_ALIGNMENT. > --- > gcc/cppbuiltin.cc | 3 +++ > 1 file changed, 3 insertions(+) > > diff --git a/gcc/cppbuiltin.cc b/gcc/cppbuiltin.cc > index c4bfc2917dc..d32efdf9a07 100644 > --- a/gcc/cppbuiltin.cc > +++ b/gcc/cppbuiltin.cc > @@ -123,6 +123,9 @@ define_builtin_macros_for_compilation_flags (cpp_reader *pfile) > > cpp_define_formatted (pfile, "__FINITE_MATH_ONLY__=%d", > flag_finite_math_only); > + > + if (STRICT_ALIGNMENT) > + cpp_define (pfile, "__STRICT_ALIGNMENT__"); > }
Sam James <sam@gentoo.org> 于2024年3月17日周日 14:04写道: > > YunQiang Su <syq@gcc.gnu.org> writes: > > > Arm32 predefines __ARM_FEATURE_UNALIGNED if -mno-unaligned-access, > > and RISC-V predefines __riscv_misaligned_avoid, while other ports > > that support -mstrict-align/-mno-unaligned-access don't have such > > macro, and these backend macros are only avaiable for c-family. > > Note: Arm64 always predefine __ARM_FEATURE_UNALIGNED: See #111555. > > I would say tag the bug even if you're not fixing it, as it was related > enough for you to cite it. > I am not sure that it is a bug for aarch64. This macro may be used to determine whether hardware can support misaligned access, and maybe all of Aarch64 CPUs can support it. It should be determined by ARM people.
On Sun, 17 Mar 2024, YunQiang Su wrote: > Arm32 predefines __ARM_FEATURE_UNALIGNED if -mno-unaligned-access, > and RISC-V predefines __riscv_misaligned_avoid, while other ports > that support -mstrict-align/-mno-unaligned-access don't have such > macro, and these backend macros are only avaiable for c-family. > Note: Arm64 always predefine __ARM_FEATURE_UNALIGNED: See #111555. > > Let's add a generic one. STRICT_ALIGNMENT is supposed to be gone, it doesn't tell the full truth so exposing it will cause more confusion only. Nak. Richard. > __STRICT_ALIGN__ is used instead of __STRICT_ALIGNMENT__, due to that > the later is used by some softwares, such as lzo2, syslinux etc. > > gcc > * cppbuiltin.cc: Predefine __STRICT_ALIGNMENT__ if > STRICT_ALIGNMENT. > --- > gcc/cppbuiltin.cc | 3 +++ > 1 file changed, 3 insertions(+) > > diff --git a/gcc/cppbuiltin.cc b/gcc/cppbuiltin.cc > index c4bfc2917dc..d32efdf9a07 100644 > --- a/gcc/cppbuiltin.cc > +++ b/gcc/cppbuiltin.cc > @@ -123,6 +123,9 @@ define_builtin_macros_for_compilation_flags (cpp_reader *pfile) > > cpp_define_formatted (pfile, "__FINITE_MATH_ONLY__=%d", > flag_finite_math_only); > + > + if (STRICT_ALIGNMENT) > + cpp_define (pfile, "__STRICT_ALIGNMENT__"); > } > > >
diff --git a/gcc/cppbuiltin.cc b/gcc/cppbuiltin.cc index c4bfc2917dc..d32efdf9a07 100644 --- a/gcc/cppbuiltin.cc +++ b/gcc/cppbuiltin.cc @@ -123,6 +123,9 @@ define_builtin_macros_for_compilation_flags (cpp_reader *pfile) cpp_define_formatted (pfile, "__FINITE_MATH_ONLY__=%d", flag_finite_math_only); + + if (STRICT_ALIGNMENT) + cpp_define (pfile, "__STRICT_ALIGNMENT__"); }