public inbox for libc-hacker@sourceware.org
 help / color / mirror / Atom feed
From: Philip Blundell <Philip.Blundell@pobox.com>
To: libc-hacker@sources.redhat.com
Subject: patch for arm dl-machine.h
Date: Thu, 29 Apr 2004 18:53:00 -0000	[thread overview]
Message-ID: <1083264791.24915.1.camel@dixie.nexus.co.uk> (raw)

[-- Attachment #1: Type: text/plain, Size: 65 bytes --]

This patch improves the startup code for ARM a bit.

Thanks

p.


[-- Attachment #2: dl-machine.patch --]
[-- Type: text/x-patch, Size: 2404 bytes --]

2004-04-29  Philip Blundell  <pb@nexus.co.uk>

	* sysdeps/arm/dl-machine.h (RTLD_START): Avoid unnecessary GOT
	entries.

Index: sysdeps/arm/dl-machine.h
===================================================================
RCS file: /cvs/glibc/libc/sysdeps/arm/dl-machine.h,v
retrieving revision 1.47
diff -u -r1.47 dl-machine.h
--- sysdeps/arm/dl-machine.h	22 Apr 2004 07:31:08 -0000	1.47
+++ sysdeps/arm/dl-machine.h	29 Apr 2004 13:08:23 -0000
@@ -255,26 +255,27 @@
 .globl _start\n\
 .globl _dl_start_user\n\
 _start:\n\
+	@ we are PIC code, so get global offset table\n\
+	ldr	sl, .L_GET_GOT\n\
+	@ See if we were run as a command with the executable file\n\
+	@ name as an extra leading argument.\n\
+	ldr	r4, .L_SKIP_ARGS\n\
 	@ at start time, all the args are on the stack\n\
 	mov	r0, sp\n\
 	bl	_dl_start\n\
 	@ returns user entry point in r0\n\
 _dl_start_user:\n\
-	mov	r6, r0\n\
-	@ we are PIC code, so get global offset table\n\
-	ldr	sl, .L_GET_GOT\n\
 	add	sl, pc, sl\n\
 .L_GOT_GOT:\n\
-	@ See if we were run as a command with the executable file\n\
-	@ name as an extra leading argument.\n\
-	ldr	r4, .L_SKIP_ARGS\n\
 	ldr	r4, [sl, r4]\n\
 	@ get the original arg count\n\
 	ldr	r1, [sp]\n\
-	@ subtract _dl_skip_args from it\n\
-	sub	r1, r1, r4\n\
-	@ adjust the stack pointer to skip them\n\
+	@ save the entry point in another register\n\
+	mov	r6, r0\n\
+	@ adjust the stack pointer to skip the extra args\n\
 	add	sp, sp, r4, lsl #2\n\
+	@ subtract _dl_skip_args from original arg count\n\
+	sub	r1, r1, r4\n\
 	@ get the argv address\n\
 	add	r2, sp, #4\n\
 	@ store the new argc in the new stack location\n\
@@ -286,29 +287,21 @@
 	@ now we call _dl_init\n\
 	ldr	r0, .L_LOADED\n\
 	ldr	r0, [sl, r0]\n\
-	ldr	r0, [r0]\n\
 	@ call _dl_init\n\
 	bl	_dl_init_internal(PLT)\n\
-	@ clear the startup flag\n\
-	ldr	r2, .L_STARTUP_FLAG\n\
-	ldr	r1, [sl, r2]\n\
-	mov	r0, #0\n\
-	str	r0, [r1]\n\
 	@ load the finalizer function\n\
 	ldr	r0, .L_FINI_PROC\n\
-	ldr	r0, [sl, r0]\n\
+	add	r0, sl, r0\n\
 	@ jump to the user_s entry point\n\
 	mov	pc, r6\n\
 .L_GET_GOT:\n\
 	.word	_GLOBAL_OFFSET_TABLE_ - .L_GOT_GOT - 4\n\
 .L_SKIP_ARGS:\n\
 	.word	_dl_skip_args(GOTOFF)\n\
-.L_STARTUP_FLAG:\n\
-	.word	_dl_starting_up(GOT)\n\
 .L_FINI_PROC:\n\
-	.word	_dl_fini(GOT)\n\
+	.word	_dl_fini(GOTOFF)\n\
 .L_LOADED:\n\
-	.word	_rtld_local(GOT)\n\
+	.word	_rtld_local(GOTOFF)\n\
 .previous\n\
 ");
 

             reply	other threads:[~2004-04-29 18:53 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-04-29 18:53 Philip Blundell [this message]
2004-04-29 20:08 ` Roland McGrath

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1083264791.24915.1.camel@dixie.nexus.co.uk \
    --to=philip.blundell@pobox.com \
    --cc=libc-hacker@sources.redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).