Skip to content

Commit 2ecd74e

Browse files
committed
pkg/build: add bb-addr-map to clang builds
1 parent a16aed1 commit 2ecd74e

File tree

2 files changed

+18
-1
lines changed

2 files changed

+18
-1
lines changed

pkg/build/linux.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,7 @@ func LinuxMakeArgs(target *targets.Target, compiler, linker, ccache, buildDir st
206206
}
207207
// The standard way to build Linux with clang is to pass LLVM=1 instead of CC= and LD=.
208208
if compiler == targets.DefaultLLVMCompiler && (linker == "" || linker == targets.DefaultLLVMLinker) {
209-
args = append(args, "LLVM=1")
209+
args = append(args, "LLVM=1", "LLVM_IAS=1", "KCFLAGS=-mllvm -enable-bb-addr-map")
210210
} else {
211211
if compiler != "" {
212212
args = append(args, "CC="+compiler)

pkg/build/make_test.go

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
package build
2+
3+
import (
4+
"testing"
5+
6+
"github.com/google/syzkaller/sys/targets"
7+
"github.com/stretchr/testify/assert"
8+
)
9+
10+
func TestLinuxMakeArgsLLVM(t *testing.T) {
11+
target := targets.Get(targets.Linux, targets.AMD64)
12+
args := LinuxMakeArgs(target, "clang", "ld.lld", "", "", 1)
13+
14+
assert.Contains(t, args, "LLVM=1")
15+
assert.Contains(t, args, "LLVM_IAS=1")
16+
assert.Contains(t, args, "KCFLAGS=-mllvm -enable-bb-addr-map")
17+
}

0 commit comments

Comments
 (0)