diff options
Diffstat (limited to 'bxgen.c')
-rwxr-xr-x | bxgen.c | 38 |
1 files changed, 35 insertions, 3 deletions
@@ -3799,9 +3799,12 @@ void unit_write( // // Cleanup - codegen->num_rels = 0; - codegen->entry_point = 0; - linker->num_obj_files = 0; + codegen->has_entry = 0; + codegen->entry_point = 0; + codegen->num_rels = 0; + codegen->offset_code = 0; + codegen->offset_ro_data = 0; + linker->num_obj_files = 0; mem_set(codegen->rels, 0, codegen->max_num_rels * sizeof *codegen->rels); mem_set(codegen->buffer_code, 0, codegen->max_code_size); @@ -4347,6 +4350,34 @@ b8 two_plus_two(void) { return 1; } +b8 sixty_nine(void) { + i64 u = u_new(); + + i64 mainproc = p_new_entry(u); + + N_RET( + mainproc, + n_add(mainproc, n_i32(mainproc, 27), n_i32(mainproc, 42)) + ); + + u_elf_x86_64(u, "test_sixty_nine"); + + if (HOST_OS != OS_Linux) { + LOG(INFO, "Skip running the executable. Host system is not compatible."); + } else if (HO != LE) { + LOG(INFO, "Skip running the executable. Host data ordering is not compatible."); + } else { + LOG(VERBOSE, "Running the executable"); + + i32 ret = system("./test_sixty_nine"); + + if (WEXITSTATUS(ret) != 69) + return 0; + } + + return 1; +} + #endif // HELPERS i32 main(i32 argc, c8 **argv) { @@ -4368,6 +4399,7 @@ i32 main(i32 argc, c8 **argv) { #if HELPERS // RUN_TEST_(link_with_libc); RUN_TEST_(two_plus_two); + RUN_TEST_(sixty_nine); #endif #undef RUN_TEST_ |