Skip to content

Commit 40d9899

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

File tree

2 files changed

+21
-1
lines changed

2 files changed

+21
-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: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
// Copyright 2026 syzkaller project authors. All rights reserved.
2+
// Use of this source code is governed by Apache 2 LICENSE that can be found in the LICENSE file.
3+
4+
package build
5+
6+
import (
7+
"testing"
8+
9+
"github.com/google/syzkaller/sys/targets"
10+
"github.com/stretchr/testify/assert"
11+
)
12+
13+
func TestLinuxMakeArgsLLVM(t *testing.T) {
14+
target := targets.Get(targets.Linux, targets.AMD64)
15+
args := LinuxMakeArgs(target, "clang", "ld.lld", "", "", 1)
16+
17+
assert.Contains(t, args, "LLVM=1")
18+
assert.Contains(t, args, "LLVM_IAS=1")
19+
assert.Contains(t, args, "KCFLAGS=-mllvm -enable-bb-addr-map")
20+
}

0 commit comments

Comments
 (0)