On 10/5/23 22:55, Detlef Riekenberg wrote:
After the comments from grischka and Michael,
i prepared a different patch to fix the build break of netbsd-curses
and also updated the patch to current mob.


`make test` works
A testapp with netbsd-curses works,
but i am away for the next 2 weeks.


Since we have a release canditate, i decided to not push my patch to mob.
I think this is not correct.
If I read the elf documentation correctly a shared lib does not have to follow DT_NEEDED.
See attached patch.

    Herman
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:
_______________________________________________
Tinycc-devel mailing list
Tinycc-devel@nongnu.org
https://lists.nongnu.org/mailman/listinfo/tinycc-devel

Reply via email to