From patchwork Sun Mar 17 05:46:31 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: YunQiang Su X-Patchwork-Id: 1912855 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.a=rsa-sha256 header.s=default header.b=NnW3cVr1; 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 4Ty6Sk5sRSz1yWv for ; Sun, 17 Mar 2024 16:47:18 +1100 (AEDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 2A0053858419 for ; Sun, 17 Mar 2024 05:47:16 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 2A0053858419 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1710654436; bh=5OCGNzXVBIuLN1LX8Kl4F5f/qnHTjBi0EE2KQUCI+EY=; h=From:To:Cc:Subject:Date:List-Id:List-Unsubscribe:List-Archive: List-Post:List-Help:List-Subscribe:From; b=NnW3cVr1CIKJVevR+F42b80TMk7dFgoRtAjG7IPEuGF0RhYtieToQgYFvAGCCMoRX HB0m6lGnUmhKRu1P58YOii/IRwhrqpMa9JSxXS78MRkj6exCFaupkUxYMiuGxV1Jqn TEuEwFec4VZ+vTEJ2zFn2iBjXmnGu6hukSYdCQnQ= 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 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 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 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org 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(+) 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__"); }