PATCH: Fix libgloss.exp

H. J. Lu hjl@lucon.org
Tue May 13 05:26:00 GMT 2003


On Mon, May 12, 2003 at 10:21:39PM -0400, Jack Howarth wrote:
> HJ,
>    I can reproduce the problem and you did too. Look in your log...
> 
> /home/hjl/build/binutils/build-ppc-linux/binutils/binutils.log
> 
> Executing on host: gcc  -c  -o testglue.o
> /usr/share/dejagnu/testglue.c    (timeout = 300)
> Executing on host: gcc
> /home/hjl/src/binutils/binutils/binutils/testsuite/binutils-all/testprog.c testglue.o  -B/home/hjl/build/binutils/build-i686-linux/binutils/tmpdir/gas/ -Wl,-wrap,exit -Wl,-wrap,main -Wl,-wrap,abort -g  -lm   -o tmpdir/testprog    (timeout = 300)
> testglue.o(.text+0x290): In function `__wrap__exit':
> : undefined reference to `__real__exit'
> collect2: ld returned 1 exit status
> compiler exited with status 1
> output is:
> testglue.o(.text+0x290): In function `__wrap__exit':
> : undefined reference to `__real__exit'
> collect2: ld returned 1 exit status
>  
> UNTESTED: simple objcopy of executable
> UNTESTED: run objcopy of executable
> UNTESTED: run stripped executable
> UNTESTED: run stripped executable with saving a symbol
> 
> It is still happening with current binutils cvs.
> 

Another dejagnu 1.4.3 bug. No wonder why many people don't bother
with it. Here is a patch. I have no idea if it is a correct fix.


H.J.
-------------- next part --------------
2003-05-12  H.J. Lu <hongjiu.lu@intel.com>

	* lib/libgloss.exp (build_wrapper): Add -Wl,-wrap,_exit.

--- dejagnu/lib/libgloss.exp._exit	2002-08-29 20:53:40.000000000 -0700
+++ dejagnu/lib/libgloss.exp	2003-05-12 22:20:49.000000000 -0700
@@ -818,13 +818,13 @@ proc build_wrapper { gluefile } {
 	set result "";
     } elseif [target_info exists uses_underscores] {
 	set flags "additional_flags=-DUNDERSCORES";
-	set result "-Wl,-wrap,__exit -Wl,-wrap,_main -Wl,-wrap,_abort";
+	set result "-Wl,-wrap,_exit -Wl,-wrap,__exit -Wl,-wrap,_main -Wl,-wrap,_abort";
     } else {
 	set flags "";
 	if [target_info exists is_vxworks] {
 	    set flags "additional_flags=-DVXWORKS";
 	}
-	set result "-Wl,-wrap,exit -Wl,-wrap,main -Wl,-wrap,abort";
+	set result "-Wl,-wrap,exit -Wl,-wrap,_exit -Wl,-wrap,main -Wl,-wrap,abort";
     }
     if [target_info exists wrap_compile_flags] {
 	lappend flags "additional_flags=[target_info wrap_compile_flags]";


More information about the Binutils mailing list