[PATCH:,hppa] Fix loading of global pointer in _start

Message ID 9A08CDD2-4A65-4272-8676-E15623435E60@bell.net
State New, archived
Headers

Commit Message

John David Anglin June 21, 2016, 10:35 p.m. UTC
  The patched change fixes a regression for executables compiled with the -p option and linked with gcrt1.o.
The executables crash on startup.

This regression was introduced in 2.22 and was noticed in the gcc testsuite.

Change has been tested on Debian Linux.

Please install if okay.

Regards,
Dave Anglin
--
John David Anglin	dave.anglin@bell.net
2016-06-21  John David Anglin  <danglin@gcc.gnu.org>

	[BZ 20277]
	* sysdeps/hppa/start.S (_start): Correct loading of global pointer
	when SHARED is defined.
  

Comments

Mike Frysinger June 30, 2016, 4:10 p.m. UTC | #1
On 21 Jun 2016 18:35, John David Anglin wrote:
> The patched change fixes a regression for executables compiled with the -p option and linked with gcrt1.o.
> The executables crash on startup.
> 
> This regression was introduced in 2.22 and was noticed in the gcc testsuite.
> 
> Change has been tested on Debian Linux.
> 
> Please install if okay.

i'm not familiar enough with the hppa ABI to say, but i know
you are prob the best expert we have here ;).  merged!
-mike
  

Patch

diff --git a/sysdeps/hppa/start.S b/sysdeps/hppa/start.S
index 90d4331..b7ab830 100644
--- a/sysdeps/hppa/start.S
+++ b/sysdeps/hppa/start.S
@@ -131,8 +131,10 @@  _start:
 	stw	%sp, -60(%sp)
 
 #ifdef SHARED
+	/* load global */
 	addil	LT'.Lp__global, %r19
 	ldw	RT'.Lp__global(%r1), %dp
+	ldw	0(%dp), %dp
 #else
 	/* load global */
 	ldil	L%$global$, %dp