github.com/cilium/ebpf@v0.16.0/internal/platform.go (about)

     1  package internal
     2  
     3  import (
     4  	"runtime"
     5  )
     6  
     7  // PlatformPrefix returns the platform-dependent syscall wrapper prefix used by
     8  // the linux kernel.
     9  //
    10  // Based on https://github.com/golang/go/blob/master/src/go/build/syslist.go
    11  // and https://github.com/libbpf/libbpf/blob/master/src/libbpf.c#L10047
    12  func PlatformPrefix() string {
    13  	switch runtime.GOARCH {
    14  	case "386":
    15  		return "__ia32_"
    16  	case "amd64", "amd64p32":
    17  		return "__x64_"
    18  
    19  	case "arm", "armbe":
    20  		return "__arm_"
    21  	case "arm64", "arm64be":
    22  		return "__arm64_"
    23  
    24  	case "mips", "mipsle", "mips64", "mips64le", "mips64p32", "mips64p32le":
    25  		return "__mips_"
    26  
    27  	case "s390":
    28  		return "__s390_"
    29  	case "s390x":
    30  		return "__s390x_"
    31  
    32  	case "riscv", "riscv64":
    33  		return "__riscv_"
    34  
    35  	case "ppc":
    36  		return "__powerpc_"
    37  	case "ppc64", "ppc64le":
    38  		return "__powerpc64_"
    39  
    40  	default:
    41  		return ""
    42  	}
    43  }