]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
x86: Update PR 35513 tests
authorH.J. Lu <hjl.tools@gmail.com>
Thu, 10 Feb 2022 13:42:49 +0000 (05:42 -0800)
committerH.J. Lu <hjl.tools@gmail.com>
Sat, 12 Feb 2022 13:41:09 +0000 (05:41 -0800)
1. Require linker with GNU_PROPERTY_1_NEEDED support for PR 35513
run-time tests.
2. Compile pr35513-8.c to scan assembly code.

PR testsuite/104481
* g++.target/i386/pr35513-1.C: Require property_1_needed target.
* g++.target/i386/pr35513-2.C: Likewise.
* gcc.target/i386/pr35513-8.c: Change to compile.
* lib/target-supports.exp (check_compile): Support assembly code.
(check_effective_target_property_1_needed): New proc.

gcc/testsuite/g++.target/i386/pr35513-1.C
gcc/testsuite/g++.target/i386/pr35513-2.C
gcc/testsuite/gcc.target/i386/pr35513-8.c
gcc/testsuite/lib/target-supports.exp

index 6f8db37fb7c9c0a66bc57febc9c8330f6b4c7597..daa615662c5614d6b6152dc28d1cc685ad96b841 100644 (file)
@@ -1,4 +1,4 @@
-// { dg-do run }
+// { dg-do run { target property_1_needed } }
 // { dg-options "-O2 -mno-direct-extern-access" }
 
 #include <iostream>
index 9143ff3f0a5ac9911501785042134b56f880605d..ecccdaeb6664a70576800c80b512407059f2c5a6 100644 (file)
@@ -1,4 +1,4 @@
-// { dg-do run  }
+// { dg-do run { target property_1_needed } }
 // { dg-options "-O2 -mno-direct-extern-access" }
 
 class Foo 
index 7ba67de215629010487c612db15ecb2b281732c8..d51f7efb353ba3a9fbb3cf5a73e0380e2b63c57e 100644 (file)
@@ -1,4 +1,4 @@
-/* { dg-do assemble { target { *-*-linux* && { ! ia32 } } } } */
+/* { dg-do compile { target { *-*-linux* && { ! ia32 } } } } */
 /* { dg-require-effective-target maybe_x32 } */
 /* { dg-options "-mx32 -O2 -fno-pic -fexceptions -fasynchronous-unwind-tables -mno-direct-extern-access" } */
 
index 4463cc8d7ed659c48a7a5babc6037ad173682d57..9a969bfbd17797f7fe37d49a76f09cbb3fffc878 100644 (file)
@@ -30,6 +30,7 @@
 #
 # Assume by default that CONTENTS is C code.  
 # Otherwise, code should contain:
+# "/* Assembly" for assembly code,
 # "// C++" for c++,
 # "// D" for D,
 # "! Fortran" for Fortran code,
@@ -57,6 +58,7 @@ proc check_compile {basename type contents args} {
        set options ""
     }
     switch -glob -- $contents {
+       "*/* Assembly*" { set src ${basename}[pid].S }
        "*! Fortran*" { set src ${basename}[pid].f90 }
        "*// C++*" { set src ${basename}[pid].cc }
        "*// D*" { set src ${basename}[pid].d }
@@ -11758,3 +11760,38 @@ proc check_effective_target_pytest3 { } {
         return 0;
     }
 }
+
+proc check_effective_target_property_1_needed { } {
+  return [check_no_compiler_messages property_1_needed executable {
+/* Assembly code */
+#ifdef __LP64__
+# define __PROPERTY_ALIGN 3
+#else
+# define __PROPERTY_ALIGN 2
+#endif
+
+       .section ".note.gnu.property", "a"
+       .p2align __PROPERTY_ALIGN
+       .long 1f - 0f           /* name length.  */
+       .long 4f - 1f           /* data length.  */
+       /* NT_GNU_PROPERTY_TYPE_0.   */
+       .long 5                 /* note type.  */
+0:
+       .asciz "GNU"            /* vendor name.  */
+1:
+       .p2align __PROPERTY_ALIGN
+       /* GNU_PROPERTY_1_NEEDED.  */
+       .long 0xb0008000        /* pr_type.  */
+       .long 3f - 2f           /* pr_datasz.  */
+2:
+       /* GNU_PROPERTY_1_NEEDED_INDIRECT_EXTERN_ACCESS.  */
+       .long 1
+3:
+       .p2align __PROPERTY_ALIGN
+4:
+       .text
+       .globl main
+main:
+       .byte 0
+  } ""]
+}