diff options
| author | Pavel Labath <pavel@labath.sk> | 2019-10-16 17:16:41 +0200 |
|---|---|---|
| committer | Pavel Labath <pavel@labath.sk> | 2019-10-30 14:13:21 +0100 |
| commit | f1e0ae3420b6cd554a240274c5ec77ccc4392ad3 (patch) | |
| tree | bdc7aee6058d838bfa23fda534b172a045825e7e /lldb/source/Plugins/ObjectFile/PECOFF | |
| parent | 532815dd5c54b9ee7d16cf4a437e82bab39c99ad (diff) | |
| download | bcm5719-llvm-f1e0ae3420b6cd554a240274c5ec77ccc4392ad3.tar.gz bcm5719-llvm-f1e0ae3420b6cd554a240274c5ec77ccc4392ad3.zip | |
COFF: Set section permissions
Summary:
This enables us to reason about whether a given address can be
executable, for instance during unwinding.
Reviewers: amccarth, mstorsjo
Subscribers: lldb-commits
Differential Revision: https://reviews.llvm.org/D69102
Diffstat (limited to 'lldb/source/Plugins/ObjectFile/PECOFF')
| -rw-r--r-- | lldb/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/lldb/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp b/lldb/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp index 8fa9e2000cf..fbc5be17fa6 100644 --- a/lldb/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp +++ b/lldb/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp @@ -797,6 +797,7 @@ void ObjectFilePECOFF::CreateSections(SectionList &unified_section_list) { /*file_offset*/ 0, m_coff_header_opt.header_size, m_coff_header_opt.sect_alignment, /*flags*/ 0); + header_sp->SetPermissions(ePermissionsReadable); m_sections_up->AddSection(header_sp); unified_section_list.AddSection(header_sp); @@ -919,6 +920,15 @@ void ObjectFilePECOFF::CreateSections(SectionList &unified_section_list) { m_coff_header_opt.sect_alignment, // Section alignment m_sect_headers[idx].flags)); // Flags for this section + uint32_t permissions = 0; + if (m_sect_headers[idx].flags & llvm::COFF::IMAGE_SCN_MEM_EXECUTE) + permissions |= ePermissionsExecutable; + if (m_sect_headers[idx].flags & llvm::COFF::IMAGE_SCN_MEM_READ) + permissions |= ePermissionsReadable; + if (m_sect_headers[idx].flags & llvm::COFF::IMAGE_SCN_MEM_WRITE) + permissions |= ePermissionsWritable; + section_sp->SetPermissions(permissions); + m_sections_up->AddSection(section_sp); unified_section_list.AddSection(section_sp); } |

