summary refs log tree commit diff stats
path: root/results/scraper/box64/427
diff options
context:
space:
mode:
Diffstat (limited to 'results/scraper/box64/427')
-rw-r--r--results/scraper/box64/42734
1 files changed, 34 insertions, 0 deletions
diff --git a/results/scraper/box64/427 b/results/scraper/box64/427
new file mode 100644
index 000000000..ad59873d5
--- /dev/null
+++ b/results/scraper/box64/427
@@ -0,0 +1,34 @@
+Return value from main is not used as the exit code
+For example, trying to emulate this program:

+

+```c

+int

+main(void)

+{

+    return 1;

+}

+```

+

+[return-1.gz](https://github.com/ptitSeb/box64/files/9809104/return-1.gz)

+

+will result in an exit code of zero.

+

+This patch appears to fix the problem:

+

+```

+diff --git a/src/emu/x64run_private.c b/src/emu/x64run_private.c

+index 3b27f38..b7c206d 100755

+--- a/src/emu/x64run_private.c

++++ b/src/emu/x64run_private.c

+@@ -69,7 +69,7 @@ int32_t EXPORT my___libc_start_main(x64emu_t* emu, int *(main) (int, char * *, c

+         SetRBP(emu, Pop64(emu));         // restore RBP

+         emu->quit = 1;  // finished!

+     }

+-    return 0;

++    return GetEAX(emu);

+ }

+ 

+ const char* GetNativeName(void* p)

+```

+

+(I'm compiling some programs for Android by emulating the NDK, and `meson` relies on exit codes for compile-time feature checks. So far I don't think I've hit any other box64 bugs, apart from `lld` deadlocking if I don't pass `--threads=1` to disable multithreading. This is to be able to test against a Vulkan driver that doesn't have a GNU/Linux version, and also for compiling Mesa to use with waydroid.)
\ No newline at end of file