Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(278)

Unified Diff: sysdeps/i386/dl-machine.h

Issue 7282019: Adjust for new NaCl startup ABI (Closed) Base URL: http://git.chromium.org/native_client/nacl-glibc.git@master
Patch Set: Created 9 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: sysdeps/i386/dl-machine.h
diff --git a/sysdeps/i386/dl-machine.h b/sysdeps/i386/dl-machine.h
index d895d1f1a8addef0ab2c0ddad4c563e5ac3355c4..344d52df9d20ee32c6c76d8910922727a6fbb028 100644
--- a/sysdeps/i386/dl-machine.h
+++ b/sysdeps/i386/dl-machine.h
@@ -183,6 +183,25 @@ extern ElfW(Addr) _dl_profile_fixup (struct link_map *l,
The C function `_dl_start' is the real entry point;
its return value is the user program's entry point. */
+#ifdef __native_client__
+
+/* We're started with the normal C (stack) ABI for a one-argument function.
+ But _dl_start uses regparm, so we have to fetch the argument for it.
+ Our version of _dl_start runs the user's entry point directly, rather
+ than returning it. */
+
+#define RTLD_START asm("\n\
+ .text\n\
+ .p2align NACLENTRYALIGN\n\
+.globl _start\n\
+_start:\n\
+ movl 4(%esp), %eax\n\
+ jmp _dl_start\n\
+ .previous\n\
+");
+
+#else
+
#define RTLD_START asm ("\n\
.text\n\
.p2align NACLENTRYALIGN\n\
@@ -230,6 +249,8 @@ _dl_start_user:\n\
.previous\n\
");
+#endif
+
/* Native client PLT does not save %ecx so we cannot use regparm(3). We use
regparm(2) instead. */
« make_sysd_rules.py ('K') | « make_sysd_rules.py ('k') | sysdeps/nacl/Makefile » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698