mirror of
https://github.com/capstone-engine/llvm-capstone.git
synced 2024-11-26 23:21:11 +00:00
[lld][NFC] Factor out isCodeSection helper. (#69193)
This commit is contained in:
parent
38f8b7cbe4
commit
f6f944e77f
@ -1403,11 +1403,7 @@ void Writer::assignAddresses() {
|
||||
|
||||
// If /FUNCTIONPADMIN is used, functions are padded in order to create a
|
||||
// hotpatchable image.
|
||||
const bool isCodeSection =
|
||||
(sec->header.Characteristics & IMAGE_SCN_CNT_CODE) &&
|
||||
(sec->header.Characteristics & IMAGE_SCN_MEM_READ) &&
|
||||
(sec->header.Characteristics & IMAGE_SCN_MEM_EXECUTE);
|
||||
uint32_t padding = isCodeSection ? config->functionPadMin : 0;
|
||||
uint32_t padding = sec->isCodeSection() ? config->functionPadMin : 0;
|
||||
|
||||
for (Chunk *c : sec->chunks) {
|
||||
if (padding && c->isHotPatchable())
|
||||
|
@ -64,6 +64,12 @@ public:
|
||||
// Used only when the name is longer than 8 bytes.
|
||||
void setStringTableOff(uint32_t v) { stringTableOff = v; }
|
||||
|
||||
bool isCodeSection() const {
|
||||
return (header.Characteristics & llvm::COFF::IMAGE_SCN_CNT_CODE) &&
|
||||
(header.Characteristics & llvm::COFF::IMAGE_SCN_MEM_READ) &&
|
||||
(header.Characteristics & llvm::COFF::IMAGE_SCN_MEM_EXECUTE);
|
||||
}
|
||||
|
||||
// N.B. The section index is one based.
|
||||
uint32_t sectionIndex = 0;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user