From a7bd4ef6cb5f8bcbe10af5a2bd931eb6deaae03a Mon Sep 17 00:00:00 2001 From: Antoine Brodin Date: Tue, 25 Jun 2024 10:01:34 +0000 Subject: [PATCH] dwarf2json: add FreeBSD kernel support FreeBSD kernel ISF can be generated the same way as Linux FreeBSD kernel has a "version" string in the ".data" section --- main.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/main.go b/main.go index 6910a01..90a33a0 100644 --- a/main.go +++ b/main.go @@ -76,7 +76,7 @@ func (f *FilesToProcess) Add(newFile FileToProcess) { // The symbol names are part of Linux's or Mac's read-only data // Their contents will be saved, if the symbol is found -var constantLinuxDataSymbols = []string{"linux_banner"} +var constantLinuxDataSymbols = []string{"linux_banner", "version"} var constantMacosDataSymbols = []string{"version"} // The compiler can add a leading underscore to symbol names in the symbol @@ -615,7 +615,7 @@ func readELFSymbol(file *elf.File, symbol elf.Symbol) ([]byte, error) { var err error for _, section := range file.Sections { - if section.Name == ".rodata" && + if (section.Name == ".data" || section.Name == ".rodata") && (section.Flags&elf.SHF_ALLOC) == elf.SHF_ALLOC && section.Addr <= symbol.Value && (section.Addr+section.Size) >= (symbol.Value+symbol.Size) {