]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
ref-temp1.C: Enable some tests for PE targets
authorJonathan Yong <10walls@gmail.com>
Tue, 15 Apr 2025 11:41:36 +0000 (11:41 +0000)
committerJonathan Yong <10walls@gmail.com>
Fri, 18 Apr 2025 16:43:07 +0000 (16:43 +0000)
Test for expected PE values.

Signed-off-by: Jonathan Yong <10walls@gmail.com>
gcc/testsuite/ChangeLog:

* g++.dg/abi/ref-temp1.C: Replicate some test based on
PE expectations.
* lib/target-supports.exp: New check_effective_target_pe.

gcc/testsuite/g++.dg/abi/ref-temp1.C
gcc/testsuite/lib/target-supports.exp

index 70c9a7a431c253ec59627b1a7fe6261dbd8789df..b02dcf610427671211c8c18fae7ab2dc34d94843 100644 (file)
@@ -7,11 +7,16 @@ struct B { const A (&x)[2]; };
 template <typename T> B &&b = { { { { 1, 2, 3 } }, { { 4, 5, 6 } } } };
 B &temp = b<void>;
 
-// { dg-final { scan-assembler ".weak\(_definition\)?\[ \t\]_?_ZGR1bIvE_" } }
-// { dg-final { scan-assembler ".weak\(_definition\)?\[ \t\]_?_ZGR1bIvE0_" } }
-// { dg-final { scan-assembler ".weak\(_definition\)?\[ \t\]_?_ZGR1bIvE1_" } }
-// { dg-final { scan-assembler ".weak\(_definition\)?\[ \t\]_?_ZGR1bIvE2_" } }
+// { dg-final { scan-assembler ".weak\(_definition\)?\[ \t\]_?_ZGR1bIvE_" { target { ! pe } } } }
+// { dg-final { scan-assembler ".weak\(_definition\)?\[ \t\]_?_ZGR1bIvE0_" { target { ! pe } } } }
+// { dg-final { scan-assembler ".weak\(_definition\)?\[ \t\]_?_ZGR1bIvE1_" { target { ! pe } } } }
+// { dg-final { scan-assembler ".weak\(_definition\)?\[ \t\]_?_ZGR1bIvE2_" { target { ! pe } } } }
 
+// { dg-final { scan-assembler "\.section\t\.data\\\$_ZGR1bIvE_,\"w\"\n\t\.linkonce same_size" { target pe } } }
+// { dg-final { scan-assembler "\.section\t\.rdata\\\$_ZGR1bIvE0_,\"dr\"\n\t\.linkonce same_size" { target pe } } }
+// { dg-final { scan-assembler "\.section\t\.rdata\\\$_ZGR1bIvE1_,\"dr\"\n\t\.linkonce same_size" { target pe } } }
+// { dg-final { scan-assembler "\.section\t\.rdata\\\$_ZGR1bIvE2_,\"dr\"\n\t\.linkonce same_size" { target pe } } }
+//
 // { dg-final { scan-assembler "_ZGR1bIvE_:\n\[^\n]+_ZGR1bIvE0_" } }
 // { dg-final { scan-assembler "_ZGR1bIvE0_:\n\[^\n]+_ZGR1bIvE1_" } }
 // { dg-final { scan-assembler "_ZGR1bIvE1_:\n\[^\n]+\[ \t\]1" } }
index a62f459ad7ed88c782613936ca2d81b5ac449220..869d1501c3836085eb6ebfc3f1f171490b8df9f1 100644 (file)
@@ -562,6 +562,16 @@ proc check_effective_target_elf { } {
     }
 }
 
+# Returns 1 if the target uses the PE/COFF object format, 0 otherwise.
+
+proc check_effective_target_pe { } {
+    if { [gcc_target_object_format] == "pe" } {
+        return 1;
+    } else {
+        return 0;
+    }
+}
+
 # Returns 1 if the target toolchain supports ifunc, 0 otherwise.
 
 proc check_ifunc_available { } {