MCPcopy Index your code
hub / github.com/cilium/ebpf / loadKconfigSection

Method loadKconfigSection

elf_reader.go:1456–1486  ·  view source on GitHub ↗

loadKconfigSection handles the 'virtual' Datasec .kconfig that doesn't have a corresponding ELF section and exist purely in BTF.

()

Source from the content-addressed store, hash-verified

1454// loadKconfigSection handles the 'virtual' Datasec .kconfig that doesn't
1455// have a corresponding ELF section and exist purely in BTF.
1456func (ec *elfCode) loadKconfigSection() error {
1457 if ec.btf == nil {
1458 return nil
1459 }
1460
1461 var ds *btf.Datasec
1462 err := ec.btf.TypeByName(".kconfig", &ds)
1463 if errors.Is(err, btf.ErrNotFound) {
1464 return nil
1465 }
1466 if err != nil {
1467 return err
1468 }
1469
1470 if ds.Size == 0 {
1471 return errors.New("zero-length .kconfig")
1472 }
1473
1474 ec.kconfig = &MapSpec{
1475 Name: ".kconfig",
1476 Type: Array,
1477 KeySize: uint32(4),
1478 ValueSize: ds.Size,
1479 MaxEntries: 1,
1480 Flags: sys.BPF_F_RDONLY_PROG,
1481 Key: &btf.Int{Size: 4},
1482 Value: ds,
1483 }
1484
1485 return nil
1486}
1487
1488// loadKsymsSection handles the 'virtual' Datasec .ksyms that doesn't
1489// have a corresponding ELF section and exist purely in BTF.

Callers 1

Calls 2

TypeByNameMethod · 0.80
IsMethod · 0.45

Tested by

no test coverage detected