Skip to content

LLVMgold claim_file wrongly claims when version mismatch #160041

@amodra

Description

@amodra

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions