[llvm] [AMDGPU] Call the `FINI_ARRAY` destructors in the correct order (PR #71815)

Joseph Huber via llvm-commits llvm-commits at lists.llvm.org
Thu Nov 9 11:33:24 PST 2023


jhuber6 wrote:

> Constructor and destructor arrays must be in the same order - object A, then object B - as otherwise concatenation between translation units does not work.

There is no concatenation here. This is handled entirely by the linker and it sorts all objects in this section by priority order. For destructors we want to call things in reverse priority order so we walk it backwards. If you look at implementations of loaders that walk this section on x64 it will walk the array backwards, we are merely encoding this logic in LLVM-IR.

https://github.com/llvm/llvm-project/pull/71815


More information about the llvm-commits mailing list