Skip to content

Commit a7bd4ef

Browse files
committed
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
1 parent d88b399 commit a7bd4ef

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

main.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ func (f *FilesToProcess) Add(newFile FileToProcess) {
7676

7777
// The symbol names are part of Linux's or Mac's read-only data
7878
// Their contents will be saved, if the symbol is found
79-
var constantLinuxDataSymbols = []string{"linux_banner"}
79+
var constantLinuxDataSymbols = []string{"linux_banner", "version"}
8080
var constantMacosDataSymbols = []string{"version"}
8181

8282
// 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) {
615615
var err error
616616

617617
for _, section := range file.Sections {
618-
if section.Name == ".rodata" &&
618+
if (section.Name == ".data" || section.Name == ".rodata") &&
619619
(section.Flags&elf.SHF_ALLOC) == elf.SHF_ALLOC &&
620620
section.Addr <= symbol.Value &&
621621
(section.Addr+section.Size) >= (symbol.Value+symbol.Size) {

0 commit comments

Comments
 (0)