From 95045ae2407ab8070fd06810a6c97de21559c77c Mon Sep 17 00:00:00 2001 From: Detlef Riekenberg Date: Wed, 4 Oct 2023 22:48:48 +0200 Subject: [PATCH] tccelf: Do not load all referenced libraries when linking a library Recursive loading of all references can break linking of libraries (Example: building of netbsd-curses) Thanks grischka and Michael Matz for the comments. -- Regards ... Detlef --- tccelf.c | 15 ++------------- 1 file changed, 2 insertions(+), 13 deletions(-) diff --git a/tccelf.c b/tccelf.c index 2e3d8ac..115e4ad 100644 --- a/tccelf.c +++ b/tccelf.c @@ -3648,19 +3648,8 @@ 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; - } - } - } + /* do not load all referenced DLLs */ + /* recursive loading can break linking of libraries */ ret_success: ret = 0; -- 2.39.2