Skip to content

Commit

Permalink
elf: support BTF map definitions using a typedef
Browse files Browse the repository at this point in the history
Accept typedef'd structs in addition to regular anonymous structs.

Fixes #1126

Signed-off-by: anjmao <[email protected]>
  • Loading branch information
anjmao authored and lmb committed Oct 10, 2023
1 parent 23be709 commit 2f65278
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion elf_reader.go
Original file line number Diff line number Diff line change
Expand Up @@ -750,7 +750,7 @@ func (ec *elfCode) loadBTFMaps() error {
}

// Each Var representing a BTF map definition contains a Struct.
mapStruct, ok := v.Type.(*btf.Struct)
mapStruct, ok := btf.UnderlyingType(v.Type).(*btf.Struct)
if !ok {
return fmt.Errorf("expected struct, got %s", v.Type)
}
Expand Down

0 comments on commit 2f65278

Please sign in to comment.