diff options
| author | Dmitry Vyukov <dvyukov@google.com> | 2022-09-07 16:37:17 +0200 |
|---|---|---|
| committer | Dmitry Vyukov <dvyukov@google.com> | 2022-11-01 10:23:09 -0700 |
| commit | 75eae5a7ef67781b73f2b9038416542c7ea0612c (patch) | |
| tree | 6f4face7bb7d0343f741e759af4004129e198b92 /pkg/csource/build.go | |
| parent | edac4fd1041732ed5d430221343f99db42a99319 (diff) | |
executor: test extension points
Test that extension points keep stable interface and work.
Diffstat (limited to 'pkg/csource/build.go')
| -rw-r--r-- | pkg/csource/build.go | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/pkg/csource/build.go b/pkg/csource/build.go index 13633382e..0855dc038 100644 --- a/pkg/csource/build.go +++ b/pkg/csource/build.go @@ -17,7 +17,7 @@ import ( // Build builds a C program from source src and returns name of the resulting binary. func Build(target *prog.Target, src []byte) (string, error) { - return build(target, src, "", true) + return build(target, src, "") } // BuildNoWarn is the same as Build, but ignores all compilation warnings. @@ -25,15 +25,15 @@ func Build(target *prog.Target, src []byte) (string, error) { // using an old repro with newer compiler, or a compiler that we never seen before. // In these cases it's more important to build successfully. func BuildNoWarn(target *prog.Target, src []byte) (string, error) { - return build(target, src, "", false) + return build(target, src, "", "-fpermissive", "-w") } // BuildFile builds a C/C++ program from file src and returns name of the resulting binary. -func BuildFile(target *prog.Target, src string) (string, error) { - return build(target, nil, src, true) +func BuildFile(target *prog.Target, src string, cflags ...string) (string, error) { + return build(target, nil, src, cflags...) } -func build(target *prog.Target, src []byte, file string, warn bool) (string, error) { +func build(target *prog.Target, src []byte, file string, cflags ...string) (string, error) { sysTarget := targets.Get(target.OS, target.Arch) compiler := sysTarget.CCompiler // We call the binary syz-executor because it sometimes shows in bug titles, @@ -59,9 +59,7 @@ func build(target *prog.Target, src []byte, file string, warn bool) (string, err // We do generate uint64's for syscall arguments that overflow longs on 32-bit archs. flags = append(flags, "-Wno-overflow") } - if !warn { - flags = append(flags, "-fpermissive", "-w") - } + flags = append(flags, cflags...) cmd := osutil.Command(compiler, flags...) if file == "" { cmd.Stdin = bytes.NewReader(src) |
