summaryrefslogtreecommitdiff
path: root/bpf/bpf.go
diff options
context:
space:
mode:
author Connor O'Brien <connoro@google.com> 2022-11-10 20:23:28 +0000
committer Gerrit Code Review <noreply-gerritcodereview@google.com> 2022-11-10 20:23:28 +0000
commitb573f5ffd2ee078e781780e63055555965b90045 (patch)
treeffe539cec557999d37a49cacff96585ab623be30 /bpf/bpf.go
parent1bde1cb668f470053f3bc08f9a21325ad6ec738d (diff)
parent3e739cf4269a6d7160b9e98d89b61f7f0bdcc1c8 (diff)
Merge "bpf: use relative source file path in debug info"
Diffstat (limited to 'bpf/bpf.go')
-rw-r--r--bpf/bpf.go9
1 files changed, 8 insertions, 1 deletions
diff --git a/bpf/bpf.go b/bpf/bpf.go
index 60a410d7f..737675057 100644
--- a/bpf/bpf.go
+++ b/bpf/bpf.go
@@ -18,6 +18,7 @@ import (
"fmt"
"io"
"path/filepath"
+ "runtime"
"strings"
"android/soong/android"
@@ -31,6 +32,9 @@ import (
func init() {
registerBpfBuildComponents(android.InitRegistrationContext)
pctx.Import("android/soong/cc/config")
+ if runtime.GOOS != "darwin" {
+ pctx.StaticVariable("relPwd", "PWD=/proc/self/cwd")
+ }
}
var (
@@ -40,7 +44,7 @@ var (
blueprint.RuleParams{
Depfile: "${out}.d",
Deps: blueprint.DepsGCC,
- Command: "$ccCmd --target=bpf -c $cFlags -MD -MF ${out}.d -o $out $in",
+ Command: "$relPwd $ccCmd --target=bpf -c $cFlags -MD -MF ${out}.d -o $out $in",
CommandDeps: []string{"$ccCmd"},
},
"ccCmd", "cFlags")
@@ -164,6 +168,9 @@ func (bpf *bpf) GenerateAndroidBuildActions(ctx android.ModuleContext) {
if proptools.Bool(bpf.properties.Btf) {
cflags = append(cflags, "-g")
+ if runtime.GOOS != "darwin" {
+ cflags = append(cflags, "-fdebug-prefix-map=/proc/self/cwd=")
+ }
}
srcs := android.PathsForModuleSrc(ctx, bpf.properties.Srcs)