From 996524383f99cf513c181205cf61937faab85352 Mon Sep 17 00:00:00 2001
From: Elliott Hughes <enh@google.com>
Date: Tue, 8 Jul 2014 19:22:57 -0700
Subject: [PATCH] Don't zero r1 on entry to the dynamic linker.

There's no need: __linker_init only takes one argument.

Also remove the arm __CTOR_LIST__; we use .init_array and .fini_array instead
of .ctor and .dtor anyway, and I don't think we've ever supported the latter.

Change-Id: Ifc91a5a90c6aa39d674bf0509a7af2e1ff0beddd
---
 linker/arch/arm/begin.S    | 22 +++++++---------------
 linker/arch/arm64/begin.S  |  3 +--
 linker/arch/x86_64/begin.S |  1 -
 3 files changed, 8 insertions(+), 18 deletions(-)

diff --git a/linker/arch/arm/begin.S b/linker/arch/arm/begin.S
index e2599027a..8cb599b7c 100644
--- a/linker/arch/arm/begin.S
+++ b/linker/arch/arm/begin.S
@@ -26,20 +26,12 @@
  * SUCH DAMAGE.
  */
 
-	.text
-	.align 4
-	.type _start,#function
-	.globl _start
+#include <private/bionic_asm.h>
 
-_start:
-	mov	r0, sp
-	mov	r1, #0
-	bl	__linker_init
+ENTRY(_start)
+  mov r0, sp
+  bl __linker_init
 
-	/* linker init returns the _entry address in the main image */
-	mov	pc, r0
-
-	.section .ctors, "wa"
-	.globl __CTOR_LIST__
-__CTOR_LIST__:
-	.long -1
+  /* linker init returns the _entry address in the main image */
+  mov pc, r0
+END(_start)
diff --git a/linker/arch/arm64/begin.S b/linker/arch/arm64/begin.S
index c96ede787..a6ea583af 100644
--- a/linker/arch/arm64/begin.S
+++ b/linker/arch/arm64/begin.S
@@ -30,8 +30,7 @@
 
 ENTRY(_start)
   mov x0, sp
-  mov x1, xzr
-  bl  __linker_init
+  bl __linker_init
 
   /* linker init returns the _entry address in the main image */
   br x0
diff --git a/linker/arch/x86_64/begin.S b/linker/arch/x86_64/begin.S
index aff46600d..7945a3111 100644
--- a/linker/arch/x86_64/begin.S
+++ b/linker/arch/x86_64/begin.S
@@ -29,7 +29,6 @@
 #include <private/bionic_asm.h>
 
 ENTRY(_start)
-  /* Pass elfdata to __linker_init. */
   mov %rsp, %rdi
   call __linker_init