]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
NaCl: Call __nacl_main in preference to main. fedora/2.22/master
authorRoland McGrath <roland@hack.frob.com>
Tue, 25 Aug 2015 20:37:07 +0000 (13:37 -0700)
committerRoland McGrath <roland@hack.frob.com>
Tue, 25 Aug 2015 20:40:00 +0000 (13:40 -0700)
(cherry picked from commit f97194930886838796546646e26a49bb5899075b)

ChangeLog
sysdeps/nacl/start.c

index c2bdf59b51c39bf00edf2d401900b9901674ddd2..8230149d4a29a09e3978fe6b03c7f92e5ddac546 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2015-08-25  Roland McGrath  <roland@hack.frob.com>
+
+       * sysdeps/nacl/start.c (_start): Call __nacl_main instead of main
+       if the weak reference is not null.
+
 2015-08-19  Andrew Senkevich  <andrew.senkevich@intel.com>
 
        [BZ #18796]
index a4b6dd33d43745d10066945f4de9125ab64a2f7a..8e8bc1a05eb3a9c76b2871cc54b8cdc8532761f2 100644 (file)
 /* The application defines this, of course.  */
 extern int main (int argc, char **argv, char **envp);
 
+/* But maybe it defines this too, in which case it takes precedence.  */
+extern int __nacl_main (int argc, char **argv, char **envp)
+  __attribute__ ((weak));
+
 /* These are defined in libc.  */
 extern int __libc_csu_init (int argc, char **argv, char **envp);
 extern void __libc_csu_fini (void);
@@ -59,7 +63,7 @@ _start (uint32_t info[])
 {
   /* The generic code actually assumes that envp follows argv.  */
 
-  __libc_start_main (&main,
+  __libc_start_main (&__nacl_main ?: &main,
                     nacl_startup_argc (info),
                     nacl_startup_argv (info),
                     nacl_startup_auxv (info),