diff options
| author | Dimitry Andric <dim@FreeBSD.org> | 2021-12-25 22:30:44 +0000 |
|---|---|---|
| committer | Dimitry Andric <dim@FreeBSD.org> | 2021-12-25 22:30:44 +0000 |
| commit | 77fc4c146f0870ffb09c1afb823ccbe742c5e6ff (patch) | |
| tree | 5c0eb39553003b9c75a901af6bc4ddabd6f2f28c /llvm/lib/ExecutionEngine/Orc/DebuggerSupportPlugin.cpp | |
| parent | f65dcba83ce5035ab88a85fe17628b447eb56e1b (diff) | |
Diffstat (limited to 'llvm/lib/ExecutionEngine/Orc/DebuggerSupportPlugin.cpp')
| -rw-r--r-- | llvm/lib/ExecutionEngine/Orc/DebuggerSupportPlugin.cpp | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/llvm/lib/ExecutionEngine/Orc/DebuggerSupportPlugin.cpp b/llvm/lib/ExecutionEngine/Orc/DebuggerSupportPlugin.cpp index 8479495623b8..fe62138c790c 100644 --- a/llvm/lib/ExecutionEngine/Orc/DebuggerSupportPlugin.cpp +++ b/llvm/lib/ExecutionEngine/Orc/DebuggerSupportPlugin.cpp @@ -154,8 +154,24 @@ public: } DebugSecInfos.push_back({&Sec, Sec.getName().substr(0, SepPos), Sec.getName().substr(SepPos + 1), 0, 0}); - } else + } else { NonDebugSections.push_back(&Sec); + + // If the first block in the section has a non-zero alignment offset + // then we need to add a padding block, since the section command in + // the header doesn't allow for aligment offsets. + SectionRange R(Sec); + if (!R.empty()) { + auto &FB = *R.getFirstBlock(); + if (FB.getAlignmentOffset() != 0) { + auto Padding = G.allocateBuffer(FB.getAlignmentOffset()); + memset(Padding.data(), 0, Padding.size()); + G.createContentBlock(Sec, Padding, + FB.getAddress() - FB.getAlignmentOffset(), + FB.getAlignment(), 0); + } + } + } } // Create container block. |
