Skip to content

Commit

Permalink
Merge pull request #5306 from evenscribe/main
Browse files Browse the repository at this point in the history
remove unnecessary non-nil == nil check
  • Loading branch information
brancz authored Dec 10, 2024
2 parents edbb83d + 28a391f commit 948987e
Showing 1 changed file with 0 additions and 11 deletions.
11 changes: 0 additions & 11 deletions pkg/symbolizer/normalize.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,24 +53,13 @@ func CalculateBase(ei profile.ExecutableInfo, m profile.Mapping, addr uint64) (u
//nolint:exhaustive
switch elf.Type(ei.ElfType) {
case elf.ET_EXEC:
if h == nil {
// Assume fixed-address executable and so no adjustment.
return 0, nil
}
return m.StartAddr - m.Offset + h.Off - h.Vaddr, nil
case elf.ET_REL:
if m.Offset != 0 {
return 0, fmt.Errorf("don't know how to handle mapping.Offset")
}
return m.StartAddr, nil
case elf.ET_DYN:
// The process mapping information, start = start of virtual address range,
// and offset = offset in the executable file of the start address, tells us
// that a runtime virtual address x maps to a file offset
// fx = x - start + offset.
if h == nil {
return m.StartAddr - m.Offset, nil
}

// The program header, if not nil, indicates the offset in the file where
// the executable segment is located (loadSegment.Off), and the base virtual
Expand Down

0 comments on commit 948987e

Please sign in to comment.