Skip to content

Commit

Permalink
NaCl: Call __nacl_main in preference to main.
Browse files Browse the repository at this point in the history
  • Loading branch information
Roland McGrath committed Aug 25, 2015
1 parent d8725b1 commit f971949
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
5 changes: 5 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -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-25 H.J. Lu <hongjiu.lu@intel.com>

* sysdeps/x86_64/strcmp.S: Remove "#if !IS_IN (libc)".
Expand Down
6 changes: 5 additions & 1 deletion sysdeps/nacl/start.c
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,10 @@
/* 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);
Expand All @@ -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),
Expand Down

0 comments on commit f971949

Please sign in to comment.