public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] testsuite: Add a test case for PR110729
@ 2023-07-20 10:13 Kewen.Lin
  2023-07-20 12:34 ` Richard Sandiford
  0 siblings, 1 reply; 3+ messages in thread
From: Kewen.Lin @ 2023-07-20 10:13 UTC (permalink / raw)
  To: GCC Patches; +Cc: Fangrui Song, Richard Biener, Richard Sandiford

Hi,

As PR110729 reported, there was one issue for .section
__patchable_function_entries with -ffunction-sections, that
is we put the same symbol as link_to section symbol for all
functions wrongly.  The commit r13-4294 for PR99889 has
fixed this with the corresponding label LPFE* which sits in
the function_section.

As Fangrui suggested[1], this patch is to add a bit more test
coverage.  I didn't find a good way to check all linked_to
symbols are different, so I checked for LPFE[012] here.

[1] https://gcc.gnu.org/pipermail/gcc-patches/2023-July/624866.html

Tested well on x86_64-redhat-linux, powerpc64-linux-gnu
P7/P8/P9 and powerpc64le-linux-gnu P9/P10.

Is it ok for trunk?

BR,
Kewen
-----
	PR testsuite/110729

gcc/testsuite/ChangeLog:

	* gcc.dg/pr110729.c: New test.
---
 gcc/testsuite/gcc.dg/pr110729.c | 29 +++++++++++++++++++++++++++++
 1 file changed, 29 insertions(+)
 create mode 100644 gcc/testsuite/gcc.dg/pr110729.c

diff --git a/gcc/testsuite/gcc.dg/pr110729.c b/gcc/testsuite/gcc.dg/pr110729.c
new file mode 100644
index 00000000000..92dfd8ae000
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr110729.c
@@ -0,0 +1,29 @@
+/* { dg-do compile { target { ! { nvptx*-*-* visium-*-* } } } } */
+/* { dg-require-effective-target o_flag_in_section } */
+/* { dg-options "-ffunction-sections -fpatchable-function-entry=2" } */
+/* { dg-additional-options "-fno-pie" { target sparc*-*-* } } */
+
+/* Verify there are three different link_to symbols for three
+    .section __patchable_function_entries respectively.  */
+
+int
+f ()
+{
+  return 1;
+}
+
+int
+g ()
+{
+  return 2;
+}
+
+int
+h ()
+{
+  return 3;
+}
+
+/* { dg-final { scan-assembler-times {.section[\t ]*__patchable_function_entries,.*,\.LPFE0} 1 } }  */
+/* { dg-final { scan-assembler-times {.section[\t ]*__patchable_function_entries,.*,\.LPFE1} 1 } }  */
+/* { dg-final { scan-assembler-times {.section[\t ]*__patchable_function_entries,.*,\.LPFE2} 1 } }  */
--
2.39.3

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

* Re: [PATCH] testsuite: Add a test case for PR110729
  2023-07-20 10:13 [PATCH] testsuite: Add a test case for PR110729 Kewen.Lin
@ 2023-07-20 12:34 ` Richard Sandiford
  2023-07-21  5:22   ` Kewen.Lin
  0 siblings, 1 reply; 3+ messages in thread
From: Richard Sandiford @ 2023-07-20 12:34 UTC (permalink / raw)
  To: Kewen.Lin; +Cc: GCC Patches, Fangrui Song, Richard Biener

"Kewen.Lin" <linkw@linux.ibm.com> writes:
> Hi,
>
> As PR110729 reported, there was one issue for .section
> __patchable_function_entries with -ffunction-sections, that
> is we put the same symbol as link_to section symbol for all
> functions wrongly.  The commit r13-4294 for PR99889 has
> fixed this with the corresponding label LPFE* which sits in
> the function_section.
>
> As Fangrui suggested[1], this patch is to add a bit more test
> coverage.  I didn't find a good way to check all linked_to
> symbols are different, so I checked for LPFE[012] here.
>
> [1] https://gcc.gnu.org/pipermail/gcc-patches/2023-July/624866.html
>
> Tested well on x86_64-redhat-linux, powerpc64-linux-gnu
> P7/P8/P9 and powerpc64le-linux-gnu P9/P10.
>
> Is it ok for trunk?
>
> BR,
> Kewen
> -----
> 	PR testsuite/110729
>
> gcc/testsuite/ChangeLog:
>
> 	* gcc.dg/pr110729.c: New test.

OK, thanks.

Richard

> ---
>  gcc/testsuite/gcc.dg/pr110729.c | 29 +++++++++++++++++++++++++++++
>  1 file changed, 29 insertions(+)
>  create mode 100644 gcc/testsuite/gcc.dg/pr110729.c
>
> diff --git a/gcc/testsuite/gcc.dg/pr110729.c b/gcc/testsuite/gcc.dg/pr110729.c
> new file mode 100644
> index 00000000000..92dfd8ae000
> --- /dev/null
> +++ b/gcc/testsuite/gcc.dg/pr110729.c
> @@ -0,0 +1,29 @@
> +/* { dg-do compile { target { ! { nvptx*-*-* visium-*-* } } } } */
> +/* { dg-require-effective-target o_flag_in_section } */
> +/* { dg-options "-ffunction-sections -fpatchable-function-entry=2" } */
> +/* { dg-additional-options "-fno-pie" { target sparc*-*-* } } */
> +
> +/* Verify there are three different link_to symbols for three
> +    .section __patchable_function_entries respectively.  */
> +
> +int
> +f ()
> +{
> +  return 1;
> +}
> +
> +int
> +g ()
> +{
> +  return 2;
> +}
> +
> +int
> +h ()
> +{
> +  return 3;
> +}
> +
> +/* { dg-final { scan-assembler-times {.section[\t ]*__patchable_function_entries,.*,\.LPFE0} 1 } }  */
> +/* { dg-final { scan-assembler-times {.section[\t ]*__patchable_function_entries,.*,\.LPFE1} 1 } }  */
> +/* { dg-final { scan-assembler-times {.section[\t ]*__patchable_function_entries,.*,\.LPFE2} 1 } }  */
> --
> 2.39.3

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

* Re: [PATCH] testsuite: Add a test case for PR110729
  2023-07-20 12:34 ` Richard Sandiford
@ 2023-07-21  5:22   ` Kewen.Lin
  0 siblings, 0 replies; 3+ messages in thread
From: Kewen.Lin @ 2023-07-21  5:22 UTC (permalink / raw)
  To: richard.sandiford; +Cc: Fangrui Song, Richard Biener, GCC Patches

on 2023/7/20 20:34, Richard Sandiford wrote:
> "Kewen.Lin" <linkw@linux.ibm.com> writes:
>> Hi,
>>
>> As PR110729 reported, there was one issue for .section
>> __patchable_function_entries with -ffunction-sections, that
>> is we put the same symbol as link_to section symbol for all
>> functions wrongly.  The commit r13-4294 for PR99889 has
>> fixed this with the corresponding label LPFE* which sits in
>> the function_section.
>>
>> As Fangrui suggested[1], this patch is to add a bit more test
>> coverage.  I didn't find a good way to check all linked_to
>> symbols are different, so I checked for LPFE[012] here.
>>
>> [1] https://gcc.gnu.org/pipermail/gcc-patches/2023-July/624866.html
>>
>> Tested well on x86_64-redhat-linux, powerpc64-linux-gnu
>> P7/P8/P9 and powerpc64le-linux-gnu P9/P10.
>>
>> Is it ok for trunk?
>>
>> BR,
>> Kewen
>> -----
>> 	PR testsuite/110729
>>
>> gcc/testsuite/ChangeLog:
>>
>> 	* gcc.dg/pr110729.c: New test.
> 
> OK, thanks.

Thanks Richard!  Pushed as r14-2693.

BR,
Kewen

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

end of thread, other threads:[~2023-07-21  5:22 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-07-20 10:13 [PATCH] testsuite: Add a test case for PR110729 Kewen.Lin
2023-07-20 12:34 ` Richard Sandiford
2023-07-21  5:22   ` Kewen.Lin

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