|
@@ -387,13 +387,15 @@ int main(int argc, char *argv[]) {
|
|
|
return 1;
|
|
|
}
|
|
|
}
|
|
|
- //res = tcc_output_file(state, IPXE_TEMP "/ipxe.o");
|
|
|
- res = tcc_relocate(state, TCC_RELOCATE_AUTO);
|
|
|
+ size_t ipxe_size = tcc_relocate(state, NULL);
|
|
|
+ void *ipxe_buf = malloc(ipxe_size);
|
|
|
+ res = tcc_relocate(state, ipxe_buf);
|
|
|
if (res) {
|
|
|
printf("tcc_relocate() failed...\n");
|
|
|
return 1;
|
|
|
}
|
|
|
printf(" done!\n");
|
|
|
+ printf("iPXE compiled to %x:%x\n", ipxe_buf, ipxe_buf + ipxe_size);
|
|
|
|
|
|
// Start iPXE in a dedicated coroutine
|
|
|
void (*main_symb)(void*) = tcc_get_symbol(state, "pre_main");
|
|
@@ -431,6 +433,7 @@ int main(int argc, char *argv[]) {
|
|
|
printf("Returning from iPXE!\n");
|
|
|
coro_destroy(coro_ipxe);
|
|
|
free_handover(&ih);
|
|
|
+ free(ipxe_buf);
|
|
|
tcc_delete(state);
|
|
|
|
|
|
return res;
|