Skip to content

bpf2go: bogus "type name is used multiple times" error #1638

Open
@mejedi

Description

@mejedi

Describe the bug

When (redundant) -type T option refers to a type that is already exposed because a variable of T exists, a bogus "type name is used multiple times" error is reported.

How to reproduce

//go:build ignore
// x.c
struct S {} s;
$ bpf2go --type S --go-package eee x x.c
Error: can't write /home/nickz/cilium-ebpf.git/x_bpfel.go: type name "xS" is used multiple times

The error occurs because variable's type is a copy produced in loadDataSections. We end up with two distinct objects.

Version information

v0.17.1

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions