New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Don't pass --allow-shlib-undefined to lld if it's not supported #5912
Don't pass --allow-shlib-undefined to lld if it's not supported #5912
Conversation
Fixes builds with llvm-mingw
def get_allow_undefined_args(self) -> typing.List[str]: | ||
if self.has_allow_shlib_undefined: | ||
return self._apply_prefix('--allow-shlib-undefined') | ||
return [] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looking at the LLVM code --allow-shlib-undefined has been implemented for ELF (so Linux, *BSD, etc) for a long time, but isn't implemented for PE/COFF. So we should do one of two things here:
- Push the
has_link_argument
method into the DynamicLinker class and invoke that instead of opencoding it with Popen. - Add the MachineInfo class into the Linker like Remove compiler type #5833 does and do somehting like:
if self.info.is_windows():
return []
return self._apply_prefix('--allow-shlib-undefined'
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I personally prefer the first approach. In general I think it's better to make less assumptions about available features.
I'll see if I can do that tomorrow.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ping
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah sorry, I got caught up in Taisei stuff. Now that we're done with a new release I'll go take a look into this now.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like this is basically implemented already; DynamicLinker
has a has_multi_arguments
method. Only problem is that it takes an Environment
object, which I don't think is accessible in this context. I see a few other methods like get_soname_args
and build_rpath_args
take Environment
as a parameter; would it be okay to do the same in get_allow_undefined_args
? Is there any reason why we don't just instantiate linkers with a permanent reference to an Environment
?
EDIT: nevermind the "already implemented" part. On closer inspection, it looks like no linker actually implements has_multi_arguments
. I guess that's what @dcbaker was talking about.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looking at the LLVM code --allow-shlib-undefined has been implemented for ELF (so Linux, *BSD, etc) for a long time, but isn't implemented for PE/COFF.
I think it cannot be implemented for PE/COFF shared libraries, as they cannot contain undefined symbols (every imported symbol is resolved to a providing library at link time).
So any shared library which actually requires undefined symbols isn't going to be simply portable to PE/COFF (see test cases/common/121 shared module for an example of the required gymnastics)
However, since we don't mark shared libraries as having undefined symbols or not (c.f. libtool -no-undefined
), I guess all we can do is not provide this flag where unsupported, and have the build fail on PE/COFF if it's actually needed.
Reviving this since it's still relevant @dcbaker unfortunately it doesn't seem easy to move the Edit: I realized that wouldn't work either, since the compiler doesn't have access to Environment :/ |
Isn't |
…orted From mesonbuild/meson#5912 This solves the -lpthread detection issue with libplacebo when compiling with LLVM for Windows.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I still don't like calling external binaries when we really do know that in the real work there's just elf, mach-o and pe/coff. But it's not the end of the world and I can fix this later if I really want to.
This broke CI, s/typing/T/ |
…orted From mesonbuild/meson#5912 This solves the -lpthread detection issue with libplacebo when compiling with LLVM for Windows. (cherry picked from commit f079504ccf7ec7ba0156adf962815dfa7da01aea) Signed-off-by: Steve Lhomme <robux4@ycbcr.xyz>
Fixes builds with llvm-mingw