public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] x86: Add .note.GNU-stack section only for Linux
@ 2022-05-09 14:51 H.J. Lu
  2022-05-10 16:04 ` H.J. Lu
  0 siblings, 1 reply; 2+ messages in thread
From: H.J. Lu @ 2022-05-09 14:51 UTC (permalink / raw)
  To: gcc-patches

Add .note.GNU-stack section only for Linux since it may not be supported
on non-Linux OSes.  __ELF__ isn't checked since these tests can only run
on Linux/x86 ELF systems.

	PR target/105472
	* gcc.target/i386/iamcu/asm-support.S: Add .note.GNU-stack section
	only for Linux.
	* gcc.target/x86_64/abi/asm-support.S: Likewise.
	* gcc.target/x86_64/abi/avx/asm-support.S: Likewise.
	* gcc.target/x86_64/abi/avx512f/asm-support.S: Likewise.
	* gcc.target/x86_64/abi/avx512fp16/asm-support.S: Likewise.
	* gcc.target/x86_64/abi/avx512fp16/m256h/asm-support.S: Likewise.
	* gcc.target/x86_64/abi/avx512fp16/m512h/asm-support.S: Likewise.
	* gcc.target/x86_64/abi/ms-sysv/do-test.S: Likewise.
---
 gcc/testsuite/gcc.target/i386/iamcu/asm-support.S               | 2 ++
 gcc/testsuite/gcc.target/x86_64/abi/asm-support.S               | 2 ++
 gcc/testsuite/gcc.target/x86_64/abi/avx/asm-support.S           | 2 ++
 gcc/testsuite/gcc.target/x86_64/abi/avx512f/asm-support.S       | 2 ++
 gcc/testsuite/gcc.target/x86_64/abi/avx512fp16/asm-support.S    | 2 ++
 .../gcc.target/x86_64/abi/avx512fp16/m256h/asm-support.S        | 2 ++
 .../gcc.target/x86_64/abi/avx512fp16/m512h/asm-support.S        | 2 ++
 gcc/testsuite/gcc.target/x86_64/abi/ms-sysv/do-test.S           | 2 ++
 8 files changed, 16 insertions(+)

diff --git a/gcc/testsuite/gcc.target/i386/iamcu/asm-support.S b/gcc/testsuite/gcc.target/i386/iamcu/asm-support.S
index db08f52a34f..9d6be88e7d5 100644
--- a/gcc/testsuite/gcc.target/i386/iamcu/asm-support.S
+++ b/gcc/testsuite/gcc.target/i386/iamcu/asm-support.S
@@ -300,4 +300,6 @@ iamcu_noprintf:
 	.align 4
 .LCiamcu_noprintf1:
 	.long	1132527616
+#ifdef __linux__
 	.section	.note.GNU-stack,"",@progbits
+#endif
diff --git a/gcc/testsuite/gcc.target/x86_64/abi/asm-support.S b/gcc/testsuite/gcc.target/x86_64/abi/asm-support.S
index 2f8d3a09c6b..b2ad67aef87 100644
--- a/gcc/testsuite/gcc.target/x86_64/abi/asm-support.S
+++ b/gcc/testsuite/gcc.target/x86_64/abi/asm-support.S
@@ -82,4 +82,6 @@ snapshot_ret:
 	.comm	xmm_regs,256,32
 	.comm	x87_regs,128,32
 	.comm   volatile_var,8,8
+#ifdef __linux__
 	.section	.note.GNU-stack,"",@progbits
+#endif
diff --git a/gcc/testsuite/gcc.target/x86_64/abi/avx/asm-support.S b/gcc/testsuite/gcc.target/x86_64/abi/avx/asm-support.S
index 77b3480ac32..24c8b3c9023 100644
--- a/gcc/testsuite/gcc.target/x86_64/abi/avx/asm-support.S
+++ b/gcc/testsuite/gcc.target/x86_64/abi/avx/asm-support.S
@@ -79,4 +79,6 @@ snapshot_ret:
 	.comm	ymm_regs,512,32
 	.comm	x87_regs,128,32
 	.comm   volatile_var,8,8
+#ifdef __linux__
 	.section	.note.GNU-stack,"",@progbits
+#endif
diff --git a/gcc/testsuite/gcc.target/x86_64/abi/avx512f/asm-support.S b/gcc/testsuite/gcc.target/x86_64/abi/avx512f/asm-support.S
index 2e3306c44cb..86d54d11c58 100644
--- a/gcc/testsuite/gcc.target/x86_64/abi/avx512f/asm-support.S
+++ b/gcc/testsuite/gcc.target/x86_64/abi/avx512f/asm-support.S
@@ -95,4 +95,6 @@ snapshot_ret:
 	.comm	zmm_regs,2048,64
 	.comm	x87_regs,128,32
 	.comm   volatile_var,8,8
+#ifdef __linux__
 	.section	.note.GNU-stack,"",@progbits
+#endif
diff --git a/gcc/testsuite/gcc.target/x86_64/abi/avx512fp16/asm-support.S b/gcc/testsuite/gcc.target/x86_64/abi/avx512fp16/asm-support.S
index 0793acf048b..a8165d86317 100644
--- a/gcc/testsuite/gcc.target/x86_64/abi/avx512fp16/asm-support.S
+++ b/gcc/testsuite/gcc.target/x86_64/abi/avx512fp16/asm-support.S
@@ -79,4 +79,6 @@ snapshot_ret:
 	.comm	xmm_regs,256,32
 	.comm	x87_regs,128,32
 	.comm   volatile_var,8,8
+#ifdef __linux__
 	.section	.note.GNU-stack,"",@progbits
+#endif
diff --git a/gcc/testsuite/gcc.target/x86_64/abi/avx512fp16/m256h/asm-support.S b/gcc/testsuite/gcc.target/x86_64/abi/avx512fp16/m256h/asm-support.S
index 77b3480ac32..24c8b3c9023 100644
--- a/gcc/testsuite/gcc.target/x86_64/abi/avx512fp16/m256h/asm-support.S
+++ b/gcc/testsuite/gcc.target/x86_64/abi/avx512fp16/m256h/asm-support.S
@@ -79,4 +79,6 @@ snapshot_ret:
 	.comm	ymm_regs,512,32
 	.comm	x87_regs,128,32
 	.comm   volatile_var,8,8
+#ifdef __linux__
 	.section	.note.GNU-stack,"",@progbits
+#endif
diff --git a/gcc/testsuite/gcc.target/x86_64/abi/avx512fp16/m512h/asm-support.S b/gcc/testsuite/gcc.target/x86_64/abi/avx512fp16/m512h/asm-support.S
index 2e3306c44cb..86d54d11c58 100644
--- a/gcc/testsuite/gcc.target/x86_64/abi/avx512fp16/m512h/asm-support.S
+++ b/gcc/testsuite/gcc.target/x86_64/abi/avx512fp16/m512h/asm-support.S
@@ -95,4 +95,6 @@ snapshot_ret:
 	.comm	zmm_regs,2048,64
 	.comm	x87_regs,128,32
 	.comm   volatile_var,8,8
+#ifdef __linux__
 	.section	.note.GNU-stack,"",@progbits
+#endif
diff --git a/gcc/testsuite/gcc.target/x86_64/abi/ms-sysv/do-test.S b/gcc/testsuite/gcc.target/x86_64/abi/ms-sysv/do-test.S
index f5dff4c10ab..37338b23fec 100644
--- a/gcc/testsuite/gcc.target/x86_64/abi/ms-sysv/do-test.S
+++ b/gcc/testsuite/gcc.target/x86_64/abi/ms-sysv/do-test.S
@@ -30,7 +30,9 @@ see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
 #ifdef __ELF__
 # define FN_TYPE(fn) .type fn,@function
 # define FN_SIZE(fn) .size fn,.-fn
+# ifdef __linux__
 	.section	.note.GNU-stack,"",@progbits
+# endif
 #else
 # define FN_TYPE(fn)
 # define FN_SIZE(fn)
-- 
2.35.1


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] x86: Add .note.GNU-stack section only for Linux
  2022-05-09 14:51 [PATCH] x86: Add .note.GNU-stack section only for Linux H.J. Lu
@ 2022-05-10 16:04 ` H.J. Lu
  0 siblings, 0 replies; 2+ messages in thread
From: H.J. Lu @ 2022-05-10 16:04 UTC (permalink / raw)
  To: gcc-patches

On Mon, May 9, 2022 at 7:51 AM H.J. Lu <hjl.tools@gmail.com> wrote:
>
> Add .note.GNU-stack section only for Linux since it may not be supported
> on non-Linux OSes.  __ELF__ isn't checked since these tests can only run
> on Linux/x86 ELF systems.
>
>         PR target/105472
>         * gcc.target/i386/iamcu/asm-support.S: Add .note.GNU-stack section
>         only for Linux.
>         * gcc.target/x86_64/abi/asm-support.S: Likewise.
>         * gcc.target/x86_64/abi/avx/asm-support.S: Likewise.
>         * gcc.target/x86_64/abi/avx512f/asm-support.S: Likewise.
>         * gcc.target/x86_64/abi/avx512fp16/asm-support.S: Likewise.
>         * gcc.target/x86_64/abi/avx512fp16/m256h/asm-support.S: Likewise.
>         * gcc.target/x86_64/abi/avx512fp16/m512h/asm-support.S: Likewise.
>         * gcc.target/x86_64/abi/ms-sysv/do-test.S: Likewise.
> ---
>  gcc/testsuite/gcc.target/i386/iamcu/asm-support.S               | 2 ++
>  gcc/testsuite/gcc.target/x86_64/abi/asm-support.S               | 2 ++
>  gcc/testsuite/gcc.target/x86_64/abi/avx/asm-support.S           | 2 ++
>  gcc/testsuite/gcc.target/x86_64/abi/avx512f/asm-support.S       | 2 ++
>  gcc/testsuite/gcc.target/x86_64/abi/avx512fp16/asm-support.S    | 2 ++
>  .../gcc.target/x86_64/abi/avx512fp16/m256h/asm-support.S        | 2 ++
>  .../gcc.target/x86_64/abi/avx512fp16/m512h/asm-support.S        | 2 ++
>  gcc/testsuite/gcc.target/x86_64/abi/ms-sysv/do-test.S           | 2 ++
>  8 files changed, 16 insertions(+)
>
> diff --git a/gcc/testsuite/gcc.target/i386/iamcu/asm-support.S b/gcc/testsuite/gcc.target/i386/iamcu/asm-support.S
> index db08f52a34f..9d6be88e7d5 100644
> --- a/gcc/testsuite/gcc.target/i386/iamcu/asm-support.S
> +++ b/gcc/testsuite/gcc.target/i386/iamcu/asm-support.S
> @@ -300,4 +300,6 @@ iamcu_noprintf:
>         .align 4
>  .LCiamcu_noprintf1:
>         .long   1132527616
> +#ifdef __linux__
>         .section        .note.GNU-stack,"",@progbits
> +#endif
> diff --git a/gcc/testsuite/gcc.target/x86_64/abi/asm-support.S b/gcc/testsuite/gcc.target/x86_64/abi/asm-support.S
> index 2f8d3a09c6b..b2ad67aef87 100644
> --- a/gcc/testsuite/gcc.target/x86_64/abi/asm-support.S
> +++ b/gcc/testsuite/gcc.target/x86_64/abi/asm-support.S
> @@ -82,4 +82,6 @@ snapshot_ret:
>         .comm   xmm_regs,256,32
>         .comm   x87_regs,128,32
>         .comm   volatile_var,8,8
> +#ifdef __linux__
>         .section        .note.GNU-stack,"",@progbits
> +#endif
> diff --git a/gcc/testsuite/gcc.target/x86_64/abi/avx/asm-support.S b/gcc/testsuite/gcc.target/x86_64/abi/avx/asm-support.S
> index 77b3480ac32..24c8b3c9023 100644
> --- a/gcc/testsuite/gcc.target/x86_64/abi/avx/asm-support.S
> +++ b/gcc/testsuite/gcc.target/x86_64/abi/avx/asm-support.S
> @@ -79,4 +79,6 @@ snapshot_ret:
>         .comm   ymm_regs,512,32
>         .comm   x87_regs,128,32
>         .comm   volatile_var,8,8
> +#ifdef __linux__
>         .section        .note.GNU-stack,"",@progbits
> +#endif
> diff --git a/gcc/testsuite/gcc.target/x86_64/abi/avx512f/asm-support.S b/gcc/testsuite/gcc.target/x86_64/abi/avx512f/asm-support.S
> index 2e3306c44cb..86d54d11c58 100644
> --- a/gcc/testsuite/gcc.target/x86_64/abi/avx512f/asm-support.S
> +++ b/gcc/testsuite/gcc.target/x86_64/abi/avx512f/asm-support.S
> @@ -95,4 +95,6 @@ snapshot_ret:
>         .comm   zmm_regs,2048,64
>         .comm   x87_regs,128,32
>         .comm   volatile_var,8,8
> +#ifdef __linux__
>         .section        .note.GNU-stack,"",@progbits
> +#endif
> diff --git a/gcc/testsuite/gcc.target/x86_64/abi/avx512fp16/asm-support.S b/gcc/testsuite/gcc.target/x86_64/abi/avx512fp16/asm-support.S
> index 0793acf048b..a8165d86317 100644
> --- a/gcc/testsuite/gcc.target/x86_64/abi/avx512fp16/asm-support.S
> +++ b/gcc/testsuite/gcc.target/x86_64/abi/avx512fp16/asm-support.S
> @@ -79,4 +79,6 @@ snapshot_ret:
>         .comm   xmm_regs,256,32
>         .comm   x87_regs,128,32
>         .comm   volatile_var,8,8
> +#ifdef __linux__
>         .section        .note.GNU-stack,"",@progbits
> +#endif
> diff --git a/gcc/testsuite/gcc.target/x86_64/abi/avx512fp16/m256h/asm-support.S b/gcc/testsuite/gcc.target/x86_64/abi/avx512fp16/m256h/asm-support.S
> index 77b3480ac32..24c8b3c9023 100644
> --- a/gcc/testsuite/gcc.target/x86_64/abi/avx512fp16/m256h/asm-support.S
> +++ b/gcc/testsuite/gcc.target/x86_64/abi/avx512fp16/m256h/asm-support.S
> @@ -79,4 +79,6 @@ snapshot_ret:
>         .comm   ymm_regs,512,32
>         .comm   x87_regs,128,32
>         .comm   volatile_var,8,8
> +#ifdef __linux__
>         .section        .note.GNU-stack,"",@progbits
> +#endif
> diff --git a/gcc/testsuite/gcc.target/x86_64/abi/avx512fp16/m512h/asm-support.S b/gcc/testsuite/gcc.target/x86_64/abi/avx512fp16/m512h/asm-support.S
> index 2e3306c44cb..86d54d11c58 100644
> --- a/gcc/testsuite/gcc.target/x86_64/abi/avx512fp16/m512h/asm-support.S
> +++ b/gcc/testsuite/gcc.target/x86_64/abi/avx512fp16/m512h/asm-support.S
> @@ -95,4 +95,6 @@ snapshot_ret:
>         .comm   zmm_regs,2048,64
>         .comm   x87_regs,128,32
>         .comm   volatile_var,8,8
> +#ifdef __linux__
>         .section        .note.GNU-stack,"",@progbits
> +#endif
> diff --git a/gcc/testsuite/gcc.target/x86_64/abi/ms-sysv/do-test.S b/gcc/testsuite/gcc.target/x86_64/abi/ms-sysv/do-test.S
> index f5dff4c10ab..37338b23fec 100644
> --- a/gcc/testsuite/gcc.target/x86_64/abi/ms-sysv/do-test.S
> +++ b/gcc/testsuite/gcc.target/x86_64/abi/ms-sysv/do-test.S
> @@ -30,7 +30,9 @@ see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
>  #ifdef __ELF__
>  # define FN_TYPE(fn) .type fn,@function
>  # define FN_SIZE(fn) .size fn,.-fn
> +# ifdef __linux__
>         .section        .note.GNU-stack,"",@progbits
> +# endif
>  #else
>  # define FN_TYPE(fn)
>  # define FN_SIZE(fn)
> --
> 2.35.1
>

I am checking it in and backporting it to release branches.

-- 
H.J.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-05-10 16:05 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-09 14:51 [PATCH] x86: Add .note.GNU-stack section only for Linux H.J. Lu
2022-05-10 16:04 ` H.J. Lu

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).