On Wed, Jul 2, 2025 at 9:12 AM H.J. Lu <hjl.to...@gmail.com> wrote:
>
> While working on
>
> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=120881
>
> I tried to use check-function-bodies to verify that
>
> 1: call mcount
>
> generated by "-pg" is placed at the function entry.  Add "^[0-9]+:" to
> check-function-bodies to allow:
>
> 1: call mcount
>
> PR testsuite/120881
> * lib/scanasm.exp (check-function-bodies): Allow "^[0-9]+:".
>
> OK for master?
>

Any comments on this simple change:

diff --git a/gcc/testsuite/lib/scanasm.exp b/gcc/testsuite/lib/scanasm.exp
index 97935cb23c3..a2311de5704 100644
--- a/gcc/testsuite/lib/scanasm.exp
+++ b/gcc/testsuite/lib/scanasm.exp
@@ -1109,6 +1109,8 @@ proc check-function-bodies { args } {
  append function_regexp ".*"
      } elseif { [regexp {^\.L} $line] } {
  append function_regexp $line "\n"
+     } elseif { [regexp {^[0-9]+:} $line] } {
+ append function_regexp $line "\n"
      } else {
  append function_regexp $config(line_prefix) $line "\n"
      }

This blocks other patches I am working on.

Thanks.

-- 
H.J.
From 8ebcd475a287188cc242d886977a17e1559861da Mon Sep 17 00:00:00 2001
From: "H.J. Lu" <hjl.to...@gmail.com>
Date: Wed, 2 Jul 2025 08:51:47 +0800
Subject: [PATCH] check-function-bodies: Support "^[0-9]+:"

While working on

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=120936

I tried to use check-function-bodies to verify that label for mcount
and __fentry__ is only generated by "-pg" if it is used by __mcount_loc
section:

1:	call	mcount
	.section __mcount_loc, "a",@progbits
	.quad 1b
	.previous

Add "^[0-9]+:" to check-function-bodies to allow:

1:	call	mcount

	PR testsuite/120881
	* lib/scanasm.exp (check-function-bodies): Allow "^[0-9]+:".

Signed-off-by: H.J. Lu <hjl.to...@gmail.com>
---
 gcc/testsuite/lib/scanasm.exp | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/gcc/testsuite/lib/scanasm.exp b/gcc/testsuite/lib/scanasm.exp
index 97935cb23c3..a2311de5704 100644
--- a/gcc/testsuite/lib/scanasm.exp
+++ b/gcc/testsuite/lib/scanasm.exp
@@ -1109,6 +1109,8 @@ proc check-function-bodies { args } {
 		append function_regexp ".*"
 	    } elseif { [regexp {^\.L} $line] } {
 		append function_regexp $line "\n"
+	    } elseif { [regexp {^[0-9]+:} $line] } {
+		append function_regexp $line "\n"
 	    } else {
 		append function_regexp $config(line_prefix) $line "\n"
 	    }
-- 
2.50.0

Reply via email to