@table @code
@item scan-assembler @var{regex} [@{ target/xfail @var{selector} @}]
-Passes if @var{regex} matches text in the test's assembler output.
+Passes if @var{regex} matches text in the test's assembler output,
+excluding LTO sections.
+
+@item scan-raw-assembler @var{regex} [@{ target/xfail @var{selector} @}]
+Passes if @var{regex} matches text in the test's assembler output,
+including LTO sections.
@item scan-assembler-not @var{regex} [@{ target/xfail @var{selector} @}]
-Passes if @var{regex} does not match text in the test's assembler output.
+Passes if @var{regex} does not match text in the test's assembler output,
+excluding LTO sections.
@item scan-assembler-times @var{regex} @var{num} [@{ target/xfail @var{selector} @}]
Passes if @var{regex} is matched exactly @var{num} times in the test's
-assembler output.
+assembler output, excluding LTO sections.
@item scan-assembler-dem @var{regex} [@{ target/xfail @var{selector} @}]
-Passes if @var{regex} matches text in the test's demangled assembler output.
+Passes if @var{regex} matches text in the test's demangled assembler output,
+excluding LTO sections.
@item scan-assembler-dem-not @var{regex} [@{ target/xfail @var{selector} @}]
Passes if @var{regex} does not match text in the test's demangled assembler
-output.
+output, excluding LTO sections.
@item scan-assembler-symbol-section @var{functions} @var{section} [@{ target/xfail @var{selector} @}]
Passes if @var{functions} are all in @var{section}. The caller needs to
}
set text [read $fd]
close $fd
+ if { [string compare -length 14 $name scan-assembler] == 0 } {
+ # Remove LTO sections.
+ # ??? Somehow, .*? is still greedy.
+ # regsub -all {(^|\n)[[:space:]]*\.section[[:space:]]*\.gnu\.lto_.*?\n(?=[[:space:]]*\.text\n)} $text {\1} text
+ regsub -all {(^|\n)[[:space:]]*\.section[[:space:]]*\.gnu\.lto_(?:[^\n]*\n(?![[:space:]]*\.(section|text|data|bss)))*[^\n]*\n} $text {\1} text
+ }
set match [regexp -- $pattern $text]
if { $match == $positive } {
set_required_options_for scan-assembler
+proc scan-raw-assembler { args } {
+ set testcase [testname-for-summary]
+ # The name might include a list of options; extract the file name.
+ set filename [lindex $testcase 0]
+ set output_file "[file rootname [file tail $filename]].s"
+ dg-scan "scan-raw-assembler" 1 $testcase $output_file $args
+}
+
+set_required_options_for scan-raw-assembler
+
# Check that a pattern is not present in the .s file produced by the
# compiler. See dg-scan for details.
set fd [open $output_file r]
set text [read $fd]
close $fd
+ regsub -all {(^|\n)[[:space:]]*\.section[[:space:]]*\.gnu\.lto_(?:[^\n]*\n(?![[:space:]]*\.(section|text|data|bss)))*[^\n]*\n} $text {\1} text
set result_count [llength [regexp -inline -all -- $pattern $text]]
if {$result_count == $times} {
set output [remote_exec host "$cxxfilt" "" "$output_file"]
set text [lindex $output 1]
+ regsub -all {(^|\n)[[:space:]]*\.section[[:space:]]*\.gnu\.lto_(?:[^\n]*\n(?![[:space:]]*\.(section|text|data|bss)))*[^\n]*\n} $text {\1} text
if [regexp -- $pattern $text] {
pass "$testcase scan-assembler-dem $pp_pattern"
set output [remote_exec host "$cxxfilt" "" "$output_file"]
set text [lindex $output 1]
+ regsub -all {(^|\n)[[:space:]]*\.section[[:space:]]*\.gnu\.lto_(?:[^\n]*\n(?![[:space:]]*\.(section|text|data|bss)))*[^\n]*\n} $text {\1} text
if ![regexp -- $pattern $text] {
pass "$testcase scan-assembler-dem-not $pp_pattern"