Skip to content

Conversation

@eli-schwartz
Copy link
Member

$ LDFLAGS="-fuse-ld=lld" meson setup builddir/
[...]
    linker = lld_cls(
        compiler, for_machine, comp_class.LINKER_PREFIX, override, system=system, version=v)
TypeError: LLVMDynamicLinker.__init__() got an unexpected keyword argument 'system'

Fixes regression in commit cece1a7. We pass system=system to the linker construction, which worked fine for Apple LLVM LD64 as that inherited __init__ from DynamicLinker. But non-Apple LLD had an overridden __init__ which wasn't adapted.

Even if it is thrown away and never used, since LLVM isn't an Apple linker, we still need to obey the argument contract.

```
$ LDFLAGS="-fuse-ld=lld" meson setup builddir/
[...]
    linker = lld_cls(
        compiler, for_machine, comp_class.LINKER_PREFIX, override, system=system, version=v)
TypeError: LLVMDynamicLinker.__init__() got an unexpected keyword argument 'system'
```

Fixes regression in commit cece1a7. We
pass system=system to the linker construction, which worked fine for
Apple LLVM LD64 as that inherited `__init__` from DynamicLinker. But
non-Apple LLD had an overridden `__init__` which wasn't adapted.

Even if it is thrown away and never used, since LLVM isn't an Apple
linker, we still need to obey the argument contract.
@eli-schwartz eli-schwartz requested a review from jpakkane as a code owner April 16, 2025 21:01
@eli-schwartz eli-schwartz added this to the 1.8 milestone Apr 16, 2025
@eli-schwartz
Copy link
Member Author

#14481

@bonzini looks like you introduced this while updating @freakboy3742's changes.

Also appears we don't actually test LLD on linux or this would be spotted...

@bonzini
Copy link
Collaborator

bonzini commented Apr 16, 2025

Yeah I did. Initially I had system added to all DynamicLinkers, but it broke link.exe and I didn't fix up lld. Thanks.

I will see to clean up the DynamicLinker constructors. Patch is good.

@eli-schwartz eli-schwartz merged commit 944456b into mesonbuild:master Apr 17, 2025
29 of 31 checks passed
@eli-schwartz eli-schwartz deleted the lld-linux branch April 17, 2025 02:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants