Skip to content

Commit 5bed6af

Browse files
authored
[BOLT][NFC] Remove unneeded if (llvm#88322)
No need need to special-case zero. Section 0 will map to section 0.
1 parent b1822ef commit 5bed6af

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

bolt/lib/Rewrite/RewriteInstance.cpp

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4419,6 +4419,7 @@ void RewriteInstance::patchELFSectionHeaderTable(ELFObjectFile<ELFT> *File) {
44194419
raw_fd_ostream &OS = Out->os();
44204420
const ELFFile<ELFT> &Obj = File->getELFFile();
44214421

4422+
// Mapping from old section indices to new ones
44224423
std::vector<uint32_t> NewSectionIndex;
44234424
std::vector<ELFShdrTy> OutputSections =
44244425
getOutputSections(File, NewSectionIndex);
@@ -4436,10 +4437,8 @@ void RewriteInstance::patchELFSectionHeaderTable(ELFObjectFile<ELFT> *File) {
44364437
// Write all section header entries while patching section references.
44374438
for (ELFShdrTy &Section : OutputSections) {
44384439
Section.sh_link = NewSectionIndex[Section.sh_link];
4439-
if (Section.sh_type == ELF::SHT_REL || Section.sh_type == ELF::SHT_RELA) {
4440-
if (Section.sh_info)
4441-
Section.sh_info = NewSectionIndex[Section.sh_info];
4442-
}
4440+
if (Section.sh_type == ELF::SHT_REL || Section.sh_type == ELF::SHT_RELA)
4441+
Section.sh_info = NewSectionIndex[Section.sh_info];
44434442
OS.write(reinterpret_cast<const char *>(&Section), sizeof(Section));
44444443
}
44454444

0 commit comments

Comments
 (0)