* [PATCH] Predefine __STRICT_ALIGN__ if STRICT_ALIGNMENT
@ 2024-03-17 5:46 YunQiang Su
2024-03-17 6:04 ` Sam James
2024-03-18 7:32 ` Richard Biener
0 siblings, 2 replies; 4+ messages in thread
From: YunQiang Su @ 2024-03-17 5:46 UTC (permalink / raw)
To: gcc-patches; +Cc: pinskia, i, rguenther
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__");
}
--
2.39.2
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] Predefine __STRICT_ALIGN__ if STRICT_ALIGNMENT
2024-03-17 5:46 [PATCH] Predefine __STRICT_ALIGN__ if STRICT_ALIGNMENT YunQiang Su
@ 2024-03-17 6:04 ` Sam James
2024-03-17 7:27 ` YunQiang Su
2024-03-18 7:32 ` Richard Biener
1 sibling, 1 reply; 4+ messages in thread
From: Sam James @ 2024-03-17 6:04 UTC (permalink / raw)
To: YunQiang Su; +Cc: gcc-patches, pinskia, i, rguenther
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__");
> }
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] Predefine __STRICT_ALIGN__ if STRICT_ALIGNMENT
2024-03-17 6:04 ` Sam James
@ 2024-03-17 7:27 ` YunQiang Su
0 siblings, 0 replies; 4+ messages in thread
From: YunQiang Su @ 2024-03-17 7:27 UTC (permalink / raw)
To: Sam James; +Cc: gcc-patches, pinskia, i, rguenther
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.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] Predefine __STRICT_ALIGN__ if STRICT_ALIGNMENT
2024-03-17 5:46 [PATCH] Predefine __STRICT_ALIGN__ if STRICT_ALIGNMENT YunQiang Su
2024-03-17 6:04 ` Sam James
@ 2024-03-18 7:32 ` Richard Biener
1 sibling, 0 replies; 4+ messages in thread
From: Richard Biener @ 2024-03-18 7:32 UTC (permalink / raw)
To: YunQiang Su; +Cc: gcc-patches, pinskia, i
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__");
> }
>
>
>
--
Richard Biener <rguenther@suse.de>
SUSE Software Solutions Germany GmbH,
Frankenstrasse 146, 90461 Nuernberg, Germany;
GF: Ivo Totev, Andrew McDonald, Werner Knoblich; (HRB 36809, AG Nuernberg)
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2024-03-18 7:32 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-03-17 5:46 [PATCH] Predefine __STRICT_ALIGN__ if STRICT_ALIGNMENT YunQiang Su
2024-03-17 6:04 ` Sam James
2024-03-17 7:27 ` YunQiang Su
2024-03-18 7:32 ` Richard Biener
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).