Skip to content

Add lgamma_r and lgammaf_r to MinGW#546

Merged
Amanieu merged 1 commit into
rust-lang:masterfrom
ankane:lgamma-r-mingw
Aug 7, 2023
Merged

Add lgamma_r and lgammaf_r to MinGW#546
Amanieu merged 1 commit into
rust-lang:masterfrom
ankane:lgamma-r-mingw

Conversation

@ankane

@ankane ankane commented Jul 31, 2023

Copy link
Copy Markdown
Contributor

Sorry for the many PRs. Looks like it's missing from MinGW (*-pc-windows-gnu and *-pc-windows-gnullvm) as well (rust-lang/rust#99747 (comment)).

Another source

@workingjubilee

workingjubilee commented Jul 31, 2023

Copy link
Copy Markdown
Member

Can't we redesign this cfg so that it is available by default and then rearrange it to used an "optimized" form on some platforms instead?

@ankane

ankane commented Jul 31, 2023

Copy link
Copy Markdown
Contributor Author

I'm not exactly sure how it would work (would need to prevent duplicate symbol errors), but maybe others have ideas

@workingjubilee

Copy link
Copy Markdown
Member

Mmm, something something weak linking?

@Amanieu

Amanieu commented Aug 1, 2023

Copy link
Copy Markdown
Member

We have support for generating weak symbols (via -Z build-std-features=compiler-builtins-weak-intrinsics), but it seems to be broken on mingw: rust-lang/rust#113822

@Amanieu Amanieu merged commit 9b4c16d into rust-lang:master Aug 7, 2023
@ankane

ankane commented Aug 7, 2023

Copy link
Copy Markdown
Contributor Author

Thanks @Amanieu!

@mati865

mati865 commented Aug 8, 2023

Copy link
Copy Markdown
Member

Weak symbols on Windows with ld.bfd are a can of worms.
Generally you can expect them to rather work as long as you are combining static archives with weak symbols into one final binary/library. Trying to do the same with shared libraries might work for simplest cases but generally think of it as broken.
You may have more luck with __declspec(selectany) but it will use more COMDATs which Windows limits to 2^16.

LLD is has working weak symbols (in both static and shared cases) but we cannot use it because of another Binutils bug import libraries created by LLD break symbol table with Binutils <2.40.

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.

4 participants