bug-binutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Bug binutils/23460] regression: ar can not create archive containing m


From: zenith432 at users dot sourceforge.net
Subject: [Bug binutils/23460] regression: ar can not create archive containing many (>1024) lto object files
Date: Thu, 16 Aug 2018 10:01:10 +0000

https://sourceware.org/bugzilla/show_bug.cgi?id=23460

--- Comment #15 from zenith432 at users dot sourceforge.net ---
(In reply to Evangelos Foutras from comment #14)
> I believe the above error is caused by a sequence of "dlopen -> dlclose ->
> dlopen" on LLVMgold.so. (liblto_plugin.so doesn't seem to mind being
> unloaded and loaded again.)
> 
> Is the repeated dlopen expected here?

Yes, because bfd/plugin.c unloads the plugin on any input file that is not
claimed by the plugin.

I propose the following change

===== begin patch
diff --git a/bfd/plugin.c b/bfd/plugin.c
index d9b9e2f1..3b738c38 100644
--- a/bfd/plugin.c
+++ b/bfd/plugin.c
@@ -274,7 +274,7 @@ have_claim_file:
     goto err;

   if (!try_claim (abfd))
-    goto err;
+    return 0;

   abfd->plugin_format = bfd_plugin_yes;

===== end patch

On a different subject, since you're submitting commits to llvm, could you
please fix the design flaw in llvm plugin described in Comment #5?  It uses the
file descriptor fd passed to claim_file_hook() as a uniqueness-detector to
determine which input files are found in the same archive.  This is a no-no
because the plugin API disallows using the fd passed to claim_file_hook() after
it returns.  It is essential that the plugin client be free to reuse file
descriptors for input files because there may be more input files than open
descriptors allowed by the kernel.

The plugin should not really have to detect whether input files come from the
same archive, but if it must should use some other method such as...
1) Use the filename instead of descriptor as a unique key.
2) do fstat() on the file descriptor and use a <device_id,inode> pair as a
unique key.

Thanks.

-- 
You are receiving this mail because:
You are on the CC list for the bug.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]