Skip to content

Commit 65f35e4

Browse files
committedJun 27, 2018
[ELF] Rename RF_PROGBITS_NOT_EXEC_OR_WRITE to RF_RODATA
Post commit review at D48406 llvm-svn: 335743
1 parent 1a1687f commit 65f35e4

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed
 

‎lld/ELF/Writer.cpp

+6-7
Original file line numberDiff line numberDiff line change
@@ -701,7 +701,7 @@ enum RankFlags {
701701
RF_WRITE = 1 << 15,
702702
RF_EXEC_WRITE = 1 << 14,
703703
RF_EXEC = 1 << 13,
704-
RF_PROGBITS_NOT_EXEC_OR_WRITE = 1 << 12,
704+
RF_RODATA = 1 << 12,
705705
RF_NON_TLS_BSS = 1 << 11,
706706
RF_NON_TLS_BSS_RO = 1 << 10,
707707
RF_NOT_TLS = 1 << 9,
@@ -755,15 +755,14 @@ static unsigned getSectionRank(const OutputSection *Sec) {
755755
Rank |= RF_EXEC_WRITE;
756756
else
757757
Rank |= RF_EXEC;
758-
} else {
759-
if (IsWrite)
760-
Rank |= RF_WRITE;
758+
} else if (IsWrite) {
759+
Rank |= RF_WRITE;
760+
} else if (Sec->Type == SHT_PROGBITS) {
761761
// Make non-executable and non-writable PROGBITS sections (e.g .rodata
762-
// .eh_frame) closer to .text . They likely contain PC or GOT relative
762+
// .eh_frame) closer to .text. They likely contain PC or GOT relative
763763
// relocations and there could be relocation overflow if other huge sections
764764
// (.dynstr .dynsym) were placed in between.
765-
else if (Sec->Type == SHT_PROGBITS)
766-
Rank |= RF_PROGBITS_NOT_EXEC_OR_WRITE;
765+
Rank |= RF_RODATA;
767766
}
768767

769768
// If we got here we know that both A and B are in the same PT_LOAD.

0 commit comments

Comments
 (0)
Please sign in to comment.