diff --git a/tccelf.c b/tccelf.c index 2e3d8ac..ed9180b 100644 --- a/tccelf.c +++ b/tccelf.c @@ -3648,18 +3648,19 @@ ST_FUNC int tcc_load_dll(TCCState *s1, int fd, const char *filename, int level) if (dt->d_tag == DT_RPATH) tcc_add_library_path(s1, dynstr + dt->d_un.d_val); - /* load all referenced DLLs */ - for(i = 0, dt = dynamic; i < nb_dts; i++, dt++) { - switch(dt->d_tag) { - case DT_NEEDED: - name = dynstr + dt->d_un.d_val; - if (tcc_add_dllref(s1, name, -1)) - continue; - if (tcc_add_dll(s1, name, AFF_REFERENCED_DLL) < 0) { - ret = tcc_error_noabort("referenced dll '%s' not found", name); - goto the_end; + if (s1->output_type != TCC_OUTPUT_DLL) + /* load all referenced DLLs */ + for(i = 0, dt = dynamic; i < nb_dts; i++, dt++) { + switch(dt->d_tag) { + case DT_NEEDED: + name = dynstr + dt->d_un.d_val; + if (tcc_add_dllref(s1, name, -1)) + continue; + if (tcc_add_dll(s1, name, AFF_REFERENCED_DLL) < 0) { + ret = tcc_error_noabort("referenced dll '%s' not found", name); + goto the_end; + } } - } } ret_success: