Skip to content

Commit 1eaa9b4

Browse files
committed
[ELF] initializeSections: move SHT_LLVM_CALL_GRAPH_PROFILE check into SHF_EXCLUDE && !relocatable. NFC
Avoid a comparison in the majority of cases.
1 parent d29766b commit 1eaa9b4

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

lld/ELF/InputFiles.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -555,13 +555,12 @@ void ObjFile<ELFT>::initializeSections(bool ignoreComdats) {
555555
continue;
556556
const Elf_Shdr &sec = objSections[i];
557557

558-
if (sec.sh_type == ELF::SHT_LLVM_CALL_GRAPH_PROFILE)
559-
cgProfileSectionIndex = i;
560-
561558
// SHF_EXCLUDE'ed sections are discarded by the linker. However,
562559
// if -r is given, we'll let the final link discard such sections.
563560
// This is compatible with GNU.
564561
if ((sec.sh_flags & SHF_EXCLUDE) && !config->relocatable) {
562+
if (sec.sh_type == SHT_LLVM_CALL_GRAPH_PROFILE)
563+
cgProfileSectionIndex = i;
565564
if (sec.sh_type == SHT_LLVM_ADDRSIG) {
566565
// We ignore the address-significance table if we know that the object
567566
// file was created by objcopy or ld -r. This is because these tools

0 commit comments

Comments
 (0)