Skip to content
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

PR for llvm/llvm-project#55938 #727

Merged
merged 1 commit into from
Oct 16, 2023
Merged

PR for llvm/llvm-project#55938 #727

merged 1 commit into from
Oct 16, 2023

Conversation

llvmbot
Copy link
Collaborator

@llvmbot llvmbot commented Oct 10, 2023

On MinGW targets, the .ctors section is always used for constructors.

When using the .ctors section, the constructors need to be emitted in
reverse order to get them execute in the right order. (Constructors with
a specific priority are sorted separately by the linker later.) In LLVM,
in CodeGen/AsmPrinter/AsmPrinter.cpp, there's code that reverses them
before writing them out, executed when using the .ctors section. This
logic is done whenever TM.Options.UseInitArray is set to false. Thus,
make sure to set UseInitArray to false for this target.

This fixes llvm/llvm-project#55938.

(cherry picked from commit a2b8c49c1839076b540c542c024fcfe2361a3e47)
@mstorsjo
Copy link
Member

I guess @efriedma-quic is the one to approve this backport.

@efriedma-quic
Copy link
Contributor

Looks good to backport. It fixes a significant miscompile, and very obviously only affects MinGW targets.

@tru tru merged commit f50c638 into release/17.x Oct 16, 2023
9 checks passed
@tru tru deleted the llvm-issue55938 branch October 16, 2023 08:14
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.

[MSYS2] Ordered dynamic initialization is not sequenced
4 participants