[PATCH] Fix: binutils testsuite builds status wrapper unconditionally

Anton Kolesov Anton.Kolesov@synopsys.com
Fri Sep 13 12:19:00 GMT 2013

Hi All,

I've encountered a problem with binutils test suite in a situation when libc doesn’t implement function _exit and tests are run using Dejagnu gdb-comm configuration. I'm proposing a patch that help resolves this problem in a situation, when status wrapper is not required in the first place.

binutils/testsuite/binutils-all/objcopy.exp always builds Dejagnu status wrapper and links test prog with it. Testglue wraps around function _exit regardless of its existence and if this functions doesn't exists and symbol _exit will always points to _wrap__exit. On the other hand Dejagnu gdb-comm.exp while performing execution tests sets breakpoints at functions abort() and _exit(), and of the latter one doesn't exist then at exit(). However because of status wrapper, function _exit always exists even if never called. As a result gdb-comm "waits" for an application exit at _exit() instead of exit(). As a results test fails due to timeout.

Attached patch makes objcopy.exp aware of target_info field needs_status_wrapper. This field is already used by GCC test suite. So if status wrapper is disabled for GCC it will automatically be disabled for objcopy.exp. Default behavior is unchanged, if this field is not set then status wrapper will be used.

This patch resolves problem in my setup, when function _exit doesn't exists and status wrapper is not required. It will not help with situation when _exit is not defined but status wrapper is required.

I have also created a bug report in Bugzilla: https://sourceware.org/bugzilla/show_bug.cgi?id=15951

Anton Kolesov

2013-09-13  Anton Kolesov <akolesov@synopsys.com>

    * binutils-all/objcopy.exp (copy_setup): Do not build wrapper Dejagnu
    wrapper if target_info needs_status_wrapper is set to 0 or an empty

diff -urN binutils-ref/binutils/testsuite/binutils-all/objcopy.exp binutils-2.23.52/binutils/testsuite/binutils-all/objcopy.exp
--- binutils-ref/binutils/testsuite/binutils-all/objcopy.exp	2012-03-13 04:41:22.000000000 +0400
+++ binutils-2.23.52/binutils/testsuite/binutils-all/objcopy.exp	2013-09-13 15:41:07.650678480 +0400
@@ -561,7 +561,14 @@
     global test_prog
     global host_triplet
-    set res [build_wrapper testglue.o]
+    if { [target_info exists needs_status_wrapper] == 0 || \
+         ([target_info needs_status_wrapper] != "" && \
+          [target_info needs_status_wrapper] != "0") } {
+        set res [build_wrapper testglue.o]
+    } else {
+        set res ""
+    }
     set flags { debug }
     if { [istarget *-*-uclinux*] && ![istarget tic6x-*-*] } {

More information about the Binutils mailing list