diff options
| author | Alexandre Ganea <alexandre.ganea@ubisoft.com> | 2018-10-05 12:56:46 +0000 |
|---|---|---|
| committer | Alexandre Ganea <alexandre.ganea@ubisoft.com> | 2018-10-05 12:56:46 +0000 |
| commit | 149de8de19064a599c64975b3b218e7ce5f2aaa3 (patch) | |
| tree | d7e3cac044ac91fbfedf83aa52a88b2d69461a2f /lld/COFF/Chunks.cpp | |
| parent | 3c19674facae1853aa83ddc57f0700a014dc88bc (diff) | |
| download | bcm5719-llvm-149de8de19064a599c64975b3b218e7ce5f2aaa3.tar.gz bcm5719-llvm-149de8de19064a599c64975b3b218e7ce5f2aaa3.zip | |
[LLD][COFF] Fix ordering of CRT global initializers in COMDAT sections
(patch by Benoit Rousseau)
This patch fixes a bug where the global variable initializers were sometimes not invoked in the correct order when it involved a C++ template instantiation.
Differential Revision: https://reviews.llvm.org/D52749
llvm-svn: 343847
Diffstat (limited to 'lld/COFF/Chunks.cpp')
| -rw-r--r-- | lld/COFF/Chunks.cpp | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/lld/COFF/Chunks.cpp b/lld/COFF/Chunks.cpp index eb90bd7ba77..5fb33e1190c 100644 --- a/lld/COFF/Chunks.cpp +++ b/lld/COFF/Chunks.cpp @@ -590,6 +590,13 @@ void SectionChunk::replace(SectionChunk *Other) { Other->Live = false; } +uint32_t SectionChunk::getSectionNumber() const { + DataRefImpl R; + R.p = reinterpret_cast<uintptr_t>(Header); + SectionRef S(R, File->getCOFFObj()); + return S.getIndex() + 1; +} + CommonChunk::CommonChunk(const COFFSymbolRef S) : Sym(S) { // Common symbols are aligned on natural boundaries up to 32 bytes. // This is what MSVC link.exe does. |

