aboutsummaryrefslogtreecommitdiffstats
path: root/pkg
diff options
context:
space:
mode:
authorDmitry Vyukov <dvyukov@google.com>2022-09-07 16:37:17 +0200
committerDmitry Vyukov <dvyukov@google.com>2022-11-01 10:23:09 -0700
commit75eae5a7ef67781b73f2b9038416542c7ea0612c (patch)
tree6f4face7bb7d0343f741e759af4004129e198b92 /pkg
parentedac4fd1041732ed5d430221343f99db42a99319 (diff)
executor: test extension points
Test that extension points keep stable interface and work.
Diffstat (limited to 'pkg')
-rw-r--r--pkg/csource/build.go14
-rw-r--r--pkg/csource/generated.go5
2 files changed, 11 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)
diff --git a/pkg/csource/generated.go b/pkg/csource/generated.go
index 2e213795a..711e74801 100644
--- a/pkg/csource/generated.go
+++ b/pkg/csource/generated.go
@@ -11220,6 +11220,11 @@ static void use_temporary_dir(void)
#error "unknown OS"
#endif
+#if SYZ_TEST_COMMON_EXT_EXAMPLE
+#include "common_ext_example.h"
+#else
+
+#endif
#if SYZ_EXECUTOR || __NR_syz_execute_func
static long syz_execute_func(volatile long text)