From af2095ec72de6429405b19b49851d6c69837a367 Mon Sep 17 00:00:00 2001 From: Gaulthier Gain Date: Mon, 11 Oct 2021 11:12:38 +0200 Subject: [PATCH] Fix bug due to unlikely sections Signed-off-by: Gaulthier Gain --- srcs/binarytool/elf64analyser/elf_analyser.go | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/srcs/binarytool/elf64analyser/elf_analyser.go b/srcs/binarytool/elf64analyser/elf_analyser.go index 17e1e9b..86e4187 100644 --- a/srcs/binarytool/elf64analyser/elf_analyser.go +++ b/srcs/binarytool/elf64analyser/elf_analyser.go @@ -89,10 +89,13 @@ func compareFunctions(elf *elf64core.ELF64File, obj *elf64core.ELF64File) (uint6 objFuncs := make([]elf64core.ELF64Function, 0) for i := len(obj.FunctionsTables) - 1; i >= 0; i-- { if strings.Compare(obj.FunctionsTables[i].Name, elf64core.BootTextSection) != 0 { - // Ignore the '.text.boot' section since it can be split through + // Ignore the '.text.boot' and '.unlikely' sections since it can be split through // different places - objFuncs = append(objFuncs, obj.FunctionsTables[i].Functions...) + if !strings.Contains(obj.FunctionsTables[i].Name, elf64core.UnlikelySection) { + objFuncs = append(objFuncs, obj.FunctionsTables[i].Functions...) + } } + } // Elf: Merge all functions table(s) in one slice for simplicity elfFuncs := make([]elf64core.ELF64Function, 0) @@ -248,4 +251,4 @@ func (analyser *ElfAnalyser) computePage(elfFile *elf64core.ELF64File, section s analyser.ElfPage = append(analyser.ElfPage, page) k++ } -} \ No newline at end of file +}