Skip to content

Commit

Permalink
dwarf2json: add FreeBSD kernel support
Browse files Browse the repository at this point in the history
FreeBSD kernel ISF can be generated the same way as Linux
FreeBSD kernel has a "version" string in the ".data" section
  • Loading branch information
ant1 committed Jun 25, 2024
1 parent d88b399 commit a7bd4ef
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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) {
Expand Down

0 comments on commit a7bd4ef

Please sign in to comment.