* gendef: Export _sigbe on 64 bit as well.
* malloc_wrapper.cc (free): In malloc_printf, call caller_return_address instead of __builtin_return_address. (malloc): Ditto. (realloc): Ditto. (calloc): Ditto. * miscfuncs.cc (__caller_return_address): New function. * miscfuncs.h (caller_return_address): New macro calling __caller_return_address. (__caller_return_address): Add prototype.
This commit is contained in:
		
							parent
							
								
									ad45d512de
								
							
						
					
					
						commit
						a62dbcd6e0
					
				| 
						 | 
				
			
			@ -1,3 +1,17 @@
 | 
			
		|||
2015-01-16  Marco Atzeri <marco.atzeri@gmail.com>
 | 
			
		||||
	    Corinna Vinschen  <corinna@vinschen.de>
 | 
			
		||||
 | 
			
		||||
	* gendef: Export _sigbe on 64 bit as well.
 | 
			
		||||
	* malloc_wrapper.cc (free): In malloc_printf, call caller_return_address
 | 
			
		||||
	instead of __builtin_return_address.
 | 
			
		||||
	(malloc): Ditto.
 | 
			
		||||
	(realloc): Ditto.
 | 
			
		||||
	(calloc): Ditto.
 | 
			
		||||
	* miscfuncs.cc (__caller_return_address): New function.
 | 
			
		||||
	* miscfuncs.h (caller_return_address): New macro calling
 | 
			
		||||
	__caller_return_address.
 | 
			
		||||
	(__caller_return_address): Add prototype.
 | 
			
		||||
 | 
			
		||||
2015-01-14  Corinna Vinschen  <corinna@vinschen.de>
 | 
			
		||||
 | 
			
		||||
	* uinfo.cc (fetch_windows_home): Disable fetching from homeDrive or
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,6 +1,6 @@
 | 
			
		|||
#!/usr/bin/perl
 | 
			
		||||
# Copyright 2003, 2004, 2005, 2006, 2008, 2009, 2010, 2011, 2012, 2013, 2014
 | 
			
		||||
# Red Hat, Inc.
 | 
			
		||||
# Copyright 2003, 2004, 2005, 2006, 2008, 2009, 2010, 2011, 2012, 2013, 2014,
 | 
			
		||||
# 2015 Red Hat, Inc.
 | 
			
		||||
#
 | 
			
		||||
# This file is part of Cygwin.
 | 
			
		||||
#
 | 
			
		||||
| 
						 | 
				
			
			@ -164,6 +164,7 @@ _sigfe:						# stack is aligned on entry!
 | 
			
		|||
	jmp	*%rax				# and jmp to it
 | 
			
		||||
	.seh_endproc
 | 
			
		||||
 | 
			
		||||
	.global _sigbe
 | 
			
		||||
	.seh_proc _sigbe
 | 
			
		||||
_sigbe:						# return here after cygwin syscall
 | 
			
		||||
						# stack is aligned on entry!
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,7 +1,7 @@
 | 
			
		|||
/* malloc_wrapper.cc
 | 
			
		||||
 | 
			
		||||
   Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
 | 
			
		||||
   2007, 2008, 2009, 2013 Red Hat, Inc.
 | 
			
		||||
   2007, 2008, 2009, 2013, 2015 Red Hat, Inc.
 | 
			
		||||
 | 
			
		||||
This file is part of Cygwin.
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -38,7 +38,7 @@ static bool internal_malloc_determined;
 | 
			
		|||
extern "C" void
 | 
			
		||||
free (void *p)
 | 
			
		||||
{
 | 
			
		||||
  malloc_printf ("(%p), called by %p", p, __builtin_return_address (0));
 | 
			
		||||
  malloc_printf ("(%p), called by %p", p, caller_return_address ());
 | 
			
		||||
  if (!use_internal)
 | 
			
		||||
    user_data->free (p);
 | 
			
		||||
  else
 | 
			
		||||
| 
						 | 
				
			
			@ -61,7 +61,8 @@ malloc (size_t size)
 | 
			
		|||
      res = dlmalloc (size);
 | 
			
		||||
      __malloc_unlock ();
 | 
			
		||||
    }
 | 
			
		||||
  malloc_printf ("(%ld) = %p, called by %p", size, res, __builtin_return_address (0));
 | 
			
		||||
  malloc_printf ("(%ld) = %p, called by %p", size, res,
 | 
			
		||||
					     caller_return_address ());
 | 
			
		||||
  return res;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -77,7 +78,8 @@ realloc (void *p, size_t size)
 | 
			
		|||
      res = dlrealloc (p, size);
 | 
			
		||||
      __malloc_unlock ();
 | 
			
		||||
    }
 | 
			
		||||
  malloc_printf ("(%p, %ld) = %p, called by %p", p, size, res, __builtin_return_address (0));
 | 
			
		||||
  malloc_printf ("(%p, %ld) = %p, called by %p", p, size, res,
 | 
			
		||||
  						 caller_return_address ());
 | 
			
		||||
  return res;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -104,7 +106,8 @@ calloc (size_t nmemb, size_t size)
 | 
			
		|||
      res = dlcalloc (nmemb, size);
 | 
			
		||||
      __malloc_unlock ();
 | 
			
		||||
    }
 | 
			
		||||
  malloc_printf ("(%ld, %ld) = %p, called by %p", nmemb, size, res, __builtin_return_address (0));
 | 
			
		||||
  malloc_printf ("(%ld, %ld) = %p, called by %p", nmemb, size, res,
 | 
			
		||||
						  caller_return_address ());
 | 
			
		||||
  return res;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,7 +1,7 @@
 | 
			
		|||
/* miscfuncs.cc: misc funcs that don't belong anywhere else
 | 
			
		||||
 | 
			
		||||
   Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
 | 
			
		||||
   2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014 Red Hat, Inc.
 | 
			
		||||
   2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015 Red Hat, Inc.
 | 
			
		||||
 | 
			
		||||
This file is part of Cygwin.
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -534,6 +534,19 @@ __import_address (void *imp)
 | 
			
		|||
  return NULL;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/* Helper function to generate the correct caller address.  For external
 | 
			
		||||
   calls, the return address on the stack is _sigbe.  In that case the
 | 
			
		||||
   actual caller return address is on the cygtls stack.  Use this function
 | 
			
		||||
   via the macro caller_return_address. */
 | 
			
		||||
extern "C" void _sigbe ();
 | 
			
		||||
 | 
			
		||||
void *
 | 
			
		||||
__caller_return_address (void *builtin_ret_addr)
 | 
			
		||||
{
 | 
			
		||||
  return builtin_ret_addr == &_sigbe
 | 
			
		||||
	 ? (void *) _my_tls.retaddr () : builtin_ret_addr;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/* CygwinCreateThread.
 | 
			
		||||
 | 
			
		||||
   Replacement function for CreateThread.  What we do here is to remove
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,7 +1,7 @@
 | 
			
		|||
/* miscfuncs.h: main Cygwin header file.
 | 
			
		||||
 | 
			
		||||
   Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
 | 
			
		||||
   2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014 Red Hat, Inc.
 | 
			
		||||
   2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015 Red Hat, Inc.
 | 
			
		||||
 | 
			
		||||
This file is part of Cygwin.
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -46,6 +46,10 @@ extern "C" void yield ();
 | 
			
		|||
 | 
			
		||||
#define import_address(x) __import_address ((void *)(x))
 | 
			
		||||
void * __reg1 __import_address (void *);
 | 
			
		||||
 
 | 
			
		||||
#define caller_return_address() \
 | 
			
		||||
		__caller_return_address (__builtin_return_address (0))
 | 
			
		||||
void * __reg1 __caller_return_address (void *);
 | 
			
		||||
 | 
			
		||||
void backslashify (const char *, char *, bool);
 | 
			
		||||
void slashify (const char *, char *, bool);
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue