NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: port-macppc/54953: 5.0 binaries on 9.0_RC2 macppc dumps core in jemalloc(3)



The following reply was made to PR port-macppc/54953; it has been noted by GNATS.

From: Valery Ushakov <uwe%stderr.spb.ru@localhost>
To: gnats-bugs%netbsd.org@localhost
Cc: 
Subject: Re: port-macppc/54953: 5.0 binaries on 9.0_RC2 macppc dumps core in
 jemalloc(3)
Date: Wed, 12 Feb 2020 00:51:17 +0300

 I think I see what the problem is.  In netbsd-5 we had crt0 (so it's
 part of the old binary) that does:
 
 	/*
 	 * Initialize the Small Data Area registers.
 	 * _SDA_BASE is defined in the SVR4 ABI for PPC.
 	 * _SDA2_BASE is defined in the E[mbedded] ABI for PPC.
 	 */
 	__asm(  "lis %r13,_SDA_BASE_@ha;"
 		"addi %r13,%r13,_SDA_BASE_@l;"
 		"lis %r2,_SDA2_BASE_@ha;"
 		"addi %r2,%r2,_SDA2_BASE_@l" );
 
 But now we use %r2 for TLS!  So malloc() works fine the first few
 times that it's called from the libc init.  Then the old binary entry
 point is called (old crt0) and it overwrites TLS magic in %r2 with
 _SDA2_BASE_.  Next time malloc() is called and checks its TLS stuff,
 the %r2 contains wrong value and pop goes the weasel.
 
 -uwe
 


Home | Main Index | Thread Index | Old Index