Skip to content

Commit 57641a6

Browse files
committed
Improve tcc support on C Loader.
1 parent 020dc0e commit 57641a6

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

source/loaders/c_loader/source/c_loader_impl.cpp

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1443,6 +1443,15 @@ static int c_loader_impl_discover_ast(loader_impl impl, loader_impl_c_handle_bas
14431443
return data.result;
14441444
}
14451445

1446+
static int c_loader_impl_tcc_relocate(TCCState *state)
1447+
{
1448+
#ifdef TCC_RELOCATE_AUTO
1449+
return tcc_relocate(state, TCC_RELOCATE_AUTO);
1450+
#else
1451+
return tcc_relocate(state);
1452+
#endif
1453+
}
1454+
14461455
loader_handle c_loader_impl_load_from_file(loader_impl impl, const loader_path paths[], size_t size)
14471456
{
14481457
loader_impl_c c_impl = static_cast<loader_impl_c>(loader_impl_get(impl));
@@ -1497,7 +1506,7 @@ loader_handle c_loader_impl_load_from_file(loader_impl impl, const loader_path p
14971506
}
14981507
}
14991508

1500-
if (tcc_relocate(c_handle->state) == -1)
1509+
if (c_loader_impl_tcc_relocate(c_handle->state) == -1)
15011510
{
15021511
log_write("metacall", LOG_LEVEL_ERROR, "TCC failed to relocate");
15031512
goto error;
@@ -1529,7 +1538,7 @@ loader_handle c_loader_impl_load_from_memory(loader_impl impl, const loader_name
15291538
goto error;
15301539
}
15311540

1532-
if (tcc_relocate(c_handle->state) == -1)
1541+
if (c_loader_impl_tcc_relocate(c_handle->state) == -1)
15331542
{
15341543
log_write("metacall", LOG_LEVEL_ERROR, "TCC failed to relocate");
15351544
goto error;

0 commit comments

Comments
 (0)