Skip to content

Commit

Permalink
[ELF] initializeSections: move SHT_LLVM_CALL_GRAPH_PROFILE check into…
Browse files Browse the repository at this point in the history
… SHF_EXCLUDE && !relocatable. NFC

Avoid a comparison in the majority of cases.
  • Loading branch information
MaskRay committed Dec 13, 2021
1 parent d29766b commit 1eaa9b4
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions lld/ELF/InputFiles.cpp
Expand Up @@ -555,13 +555,12 @@ void ObjFile<ELFT>::initializeSections(bool ignoreComdats) {
continue;
const Elf_Shdr &sec = objSections[i];

if (sec.sh_type == ELF::SHT_LLVM_CALL_GRAPH_PROFILE)
cgProfileSectionIndex = i;

// SHF_EXCLUDE'ed sections are discarded by the linker. However,
// if -r is given, we'll let the final link discard such sections.
// This is compatible with GNU.
if ((sec.sh_flags & SHF_EXCLUDE) && !config->relocatable) {
if (sec.sh_type == SHT_LLVM_CALL_GRAPH_PROFILE)
cgProfileSectionIndex = i;
if (sec.sh_type == SHT_LLVM_ADDRSIG) {
// We ignore the address-significance table if we know that the object
// file was created by objcopy or ld -r. This is because these tools
Expand Down

0 comments on commit 1eaa9b4

Please sign in to comment.