public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH, testsuite]: Fix detection of ifunc support
@ 2011-07-21 22:23 Uros Bizjak
  2011-07-21 23:01 ` Uros Bizjak
  0 siblings, 1 reply; 3+ messages in thread
From: Uros Bizjak @ 2011-07-21 22:23 UTC (permalink / raw)
  To: gcc-patches; +Cc: Nathan Sidwell

Hello!

Revision 164725 [1] broke detection of ifunc support in the testsuite
[2] due to extra "#endif" without if in the test function. Attached
patch fixes this up.

2011-07-21  Uros Bizjak  <ubizjak@gmail.com>

	* lib/target-supports.exp (check_ifunc_available): Fix test function.

The patch is tested on x86_64-pc-linux-gnu, but my toolchain does not
support ifunc attribute. Can somebody please test it with ifunc
support?

OTOH, the patch is kind of obvious, so OK for mainline?

[1] http://gcc.gnu.org/viewcvs?view=revision&revision=164725
[2] http://gcc.gnu.org/viewcvs/trunk/gcc/testsuite/lib/target-supports.exp?r1=164725&r2=164724&pathrev=164725

Uros.

Index: lib/target-supports.exp
===================================================================
--- lib/target-supports.exp	(revision 176584)
+++ lib/target-supports.exp	(working copy)
@@ -381,10 +381,8 @@
 	set obj ifunc[pid].o
         verbose "check_ifunc_available  compiling testfile $src" 2
 	set f [open $src "w"]
-	puts $f "#endif"
 	puts $f "#ifdef __cplusplus\nextern \"C\"\n#endif"
-	puts $f "void g() {}"
-	puts $f "void f() __attribute__((ifunc(\"g\")));"
+	puts $f "void g() {} f() __attribute__((ifunc(\"g\")));"
 	close $f
 	set lines [${tool}_target_compile $src $obj object ""]
 	file delete $src

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

* Re: [PATCH, testsuite]: Fix detection of ifunc support
  2011-07-21 22:23 [PATCH, testsuite]: Fix detection of ifunc support Uros Bizjak
@ 2011-07-21 23:01 ` Uros Bizjak
  2011-07-22  5:52   ` Mike Stump
  0 siblings, 1 reply; 3+ messages in thread
From: Uros Bizjak @ 2011-07-21 23:01 UTC (permalink / raw)
  To: gcc-patches; +Cc: Nathan Sidwell

[-- Attachment #1: Type: text/plain, Size: 648 bytes --]

On Thu, Jul 21, 2011 at 11:56 PM, Uros Bizjak <ubizjak@gmail.com> wrote:

> Revision 164725 [1] broke detection of ifunc support in the testsuite
> [2] due to extra "#endif" without if in the test function. Attached
> patch fixes this up.

Actually, we can use existing testsuite infrastructure to simplify the
function substantially.

2011-07-21  Uros Bizjak  <ubizjak@gmail.com>

        * lib/target-supports.exp (check_ifunc_available): Rewrite.

The patch is tested on x86_64-pc-linux-gnu, but my toolchain does not
support ifunc attribute. Can somebody please test it with ifunc
support?

OK for mainline and 4.6 ?

Uros.

[-- Attachment #2: t.diff.txt --]
[-- Type: text/plain, Size: 1678 bytes --]

Index: lib/target-supports.exp
===================================================================
--- lib/target-supports.exp	(revision 176584)
+++ lib/target-supports.exp	(working copy)
@@ -361,45 +361,16 @@
     return $alias_available_saved
 }
 
-###############################
-# proc check_ifunc_available { }
-###############################
+# Returns 1 if the target supports ifunc, 0 otherwise.
 
-# Determine if the target toolchain supports the ifunc attribute.
-
-# Returns 1 if the target supports ifunc.  Returns 0 if the target
-# does not support ifunc.
-
 proc check_ifunc_available { } {
-    global ifunc_available_saved
-    global tool
-
-    if [info exists ifunc_available_saved] {
-        verbose "check_ifunc_available  returning saved $ifunc_available_saved" 2
-    } else {
-	set src ifunc[pid].c
-	set obj ifunc[pid].o
-        verbose "check_ifunc_available  compiling testfile $src" 2
-	set f [open $src "w"]
-	puts $f "#endif"
-	puts $f "#ifdef __cplusplus\nextern \"C\"\n#endif"
-	puts $f "void g() {}"
-	puts $f "void f() __attribute__((ifunc(\"g\")));"
-	close $f
-	set lines [${tool}_target_compile $src $obj object ""]
-	file delete $src
-	remote_file build delete $obj
-
-	if [string match "" $lines] then {
-	    set ifunc_available_saved 1
-	} else {
-	    set ifunc_available_saved 0
-	}
-
-	verbose "check_ifunc_available  returning $ifunc_available_saved" 2
-    }
-
-    return $ifunc_available_saved
+    return [check_no_compiler_messages ifunc_available object {
+	#ifdef __cplusplus
+	extern "C"
+	#endif
+	void g() {}
+	f() __attribute__((ifunc("g")));
+    }]
 }
 
 # Returns true if --gc-sections is supported on the target.

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

* Re: [PATCH, testsuite]: Fix detection of ifunc support
  2011-07-21 23:01 ` Uros Bizjak
@ 2011-07-22  5:52   ` Mike Stump
  0 siblings, 0 replies; 3+ messages in thread
From: Mike Stump @ 2011-07-22  5:52 UTC (permalink / raw)
  To: Uros Bizjak; +Cc: gcc-patches, Nathan Sidwell

On Jul 21, 2011, at 3:29 PM, Uros Bizjak wrote:
> Actually, we can use existing testsuite infrastructure to simplify the
> function substantially.
> 
> 2011-07-21  Uros Bizjak  <ubizjak@gmail.com>
> 
>        * lib/target-supports.exp (check_ifunc_available): Rewrite.
> 
> The patch is tested on x86_64-pc-linux-gnu, but my toolchain does not
> support ifunc attribute. Can somebody please test it with ifunc
> support?
> 
> OK for mainline and 4.6 ?

Ok.

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

end of thread, other threads:[~2011-07-22  3:45 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-07-21 22:23 [PATCH, testsuite]: Fix detection of ifunc support Uros Bizjak
2011-07-21 23:01 ` Uros Bizjak
2011-07-22  5:52   ` Mike Stump

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