LLVMgold claim_file wrongly claims when version mismatch
- Dominant language
- LLVM
- Stars
- 40.5k
- Forks
- 18.7k
- PR merge metrics
- PR metrics pending
Description
If multiple LLVMgold.so from different versions are installed in bfd_plugin dir for use by binutils, the first claim_file called sets claimed even if it is the wrong version. This prevents binutils from choosing the correct plugin. An error message is inappropriate for the wrong version, it should simply not claim the file.
From a clang -flto build of binutils
$ binutils/nm-new bfd/bfd.o
bfd plugin: LLVM gold plugin has failed to create LTO module: Invalid attribute group entry (Producer: 'LLVM20.1.2' Reader: 'LLVM 16.0.6')
binutils/nm-new: bfd/bfd.o: no symbols
I happen to have multiple versions of clang installed.
$ ls -U lib/bfd-plugins
LLVMgold-15.so LLVMgold-18.so LLVMgold-19.so liblto_plugin.so LLVMgold-20.so LLVMgold-16.so
binutils tries the plugins in reverse directory order.
Contributor guide
Research direction
Start at binutils/nm-new and the bfd plugin loading path that invokes claim_file, using the multiple LLVMgold versions in lib/bfd-plugins as the reproduction setup. Trace how a version-mismatched plugin is handled and verify that it does not claim the file or emit the inappropriate error, allowing the matching plugin to be selected.
Written by the indexing model from the issue text.
Assessment
- Domain
- compilers
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100