aboutsummaryrefslogtreecommitdiff
path: root/compiler_wrapper
diff options
context:
space:
mode:
authorTobias Bosch <tbosch@google.com>2019-08-15 17:17:57 -0700
committerTobias Bosch <tbosch@google.com>2019-08-16 14:49:15 +0000
commit5f98f2d395c2888a6b659c7bf6b0ae732baacbfc (patch)
treec904c3d84e241f93cd1fba7c07b05613466d400a /compiler_wrapper
parent47f580fe94bc41a39c010559c78d918d6fabc2db (diff)
downloadtoolchain-utils-5f98f2d395c2888a6b659c7bf6b0ae732baacbfc.tar.gz
Resolve wrapper path against path env
BUG=chromium:773875 TEST=unit test Change-Id: I150eb18a5d765d43ee7a2341767ff41f6641c6ac Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/toolchain-utils/+/1757222 Tested-by: Tobias Bosch <tbosch@google.com> Reviewed-by: George Burgess <gbiv@chromium.org>
Diffstat (limited to 'compiler_wrapper')
-rw-r--r--compiler_wrapper/clang_flags.go3
-rw-r--r--compiler_wrapper/clang_flags_test.go13
-rw-r--r--compiler_wrapper/command.go11
-rw-r--r--compiler_wrapper/compiler_wrapper.go24
-rw-r--r--compiler_wrapper/cros_hardened_config_test.go20
-rw-r--r--compiler_wrapper/testdata/cros_clang_host_golden/clang_path.json37
-rw-r--r--compiler_wrapper/testdata/cros_gcc_host_golden/gcc_path.json35
-rw-r--r--compiler_wrapper/testdata/cros_hardened_golden/clang_path.json53
-rw-r--r--compiler_wrapper/testdata/cros_hardened_golden/gcc_path.json48
-rw-r--r--compiler_wrapper/testdata/cros_hardened_noccache_golden/clang_path.json46
-rw-r--r--compiler_wrapper/testdata/cros_hardened_noccache_golden/gcc_path.json42
-rw-r--r--compiler_wrapper/testdata/cros_nonhardened_golden/clang_path.json46
-rw-r--r--compiler_wrapper/testdata/cros_nonhardened_golden/gcc_path.json44
13 files changed, 387 insertions, 35 deletions
diff --git a/compiler_wrapper/clang_flags.go b/compiler_wrapper/clang_flags.go
index 1d540909..0cb10c7e 100644
--- a/compiler_wrapper/clang_flags.go
+++ b/compiler_wrapper/clang_flags.go
@@ -181,8 +181,7 @@ func getLinkerPath(env env, linkerCmd string, rootPath string) string {
// we passed '-m32' to clang. As a result, clang does not want to use the
// i686-pc-linux-gnu-ld, so we need to add this to help clang find the right
// linker.
- for _, path := range strings.Split(env.getenv("PATH"), ":") {
- linkerPath := filepath.Join(path, linkerCmd)
+ if linkerPath, err := resolveAgainstPathEnv(env, linkerCmd); err == nil {
// FIXME: We are not using filepath.EvalSymlinks to only unpack
// one layer of symlinks to match the old wrapper. Investigate
// why this is important or simplify to filepath.EvalSymlinks.
diff --git a/compiler_wrapper/clang_flags_test.go b/compiler_wrapper/clang_flags_test.go
index 6dda35f1..5fe13c31 100644
--- a/compiler_wrapper/clang_flags_test.go
+++ b/compiler_wrapper/clang_flags_test.go
@@ -66,6 +66,19 @@ func TestRelativeClangPathBasedOnRootPath(t *testing.T) {
})
}
+func TestPathEnvClangPathBasedOnRootPath(t *testing.T) {
+ withTestContext(t, func(ctx *testContext) {
+ ctx.cfg.rootRelPath = "somepath"
+ ctx.env = []string{"PATH=" + filepath.Join(ctx.tempDir, "/pathenv")}
+ ctx.writeFile(filepath.Join(ctx.tempDir, "/pathenv/x86_64-cros-linux-gnu-clang"), "")
+ cmd := ctx.must(callCompiler(ctx, ctx.cfg,
+ ctx.newCommand("x86_64-cros-linux-gnu-clang", mainCc)))
+ if err := verifyPath(cmd, filepath.Join(ctx.tempDir, "pathenv/somepath/usr/bin/clang")); err != nil {
+ t.Error(err)
+ }
+ })
+}
+
func TestClangPathForClangHostWrapper(t *testing.T) {
withTestContext(t, func(ctx *testContext) {
ctx.cfg.isHostWrapper = true
diff --git a/compiler_wrapper/command.go b/compiler_wrapper/command.go
index b20f19eb..ade12ede 100644
--- a/compiler_wrapper/command.go
+++ b/compiler_wrapper/command.go
@@ -5,6 +5,7 @@
package main
import (
+ "fmt"
"os"
"os/exec"
"path/filepath"
@@ -41,6 +42,16 @@ func ensurePathEnv(cmd *exec.Cmd) {
cmd.Env = append(cmd.Env, "PATH=")
}
+func resolveAgainstPathEnv(env env, cmd string) (string, error) {
+ for _, path := range strings.Split(env.getenv("PATH"), ":") {
+ resolvedPath := filepath.Join(path, cmd)
+ if _, err := os.Lstat(resolvedPath); err == nil {
+ return resolvedPath, nil
+ }
+ }
+ return "", fmt.Errorf("Couldn't find cmd %q in path", cmd)
+}
+
func getAbsCmdPath(env env, cmd *command) string {
path := cmd.Path
if !filepath.IsAbs(path) {
diff --git a/compiler_wrapper/compiler_wrapper.go b/compiler_wrapper/compiler_wrapper.go
index 521846c9..4aa91c6c 100644
--- a/compiler_wrapper/compiler_wrapper.go
+++ b/compiler_wrapper/compiler_wrapper.go
@@ -8,15 +8,29 @@ import (
"fmt"
"io"
"path/filepath"
+ "strings"
)
func callCompiler(env env, cfg *config, inputCmd *command) int {
- exitCode := 0
var compilerErr error
- if cfg.oldWrapperPath != "" {
- exitCode, compilerErr = callCompilerWithRunAndCompareToOldWrapper(env, cfg, inputCmd)
- } else {
- exitCode, compilerErr = callCompilerInternal(env, cfg, inputCmd)
+ if !filepath.IsAbs(inputCmd.Path) && !strings.HasPrefix(inputCmd.Path, ".") {
+ if resolvedPath, err := resolveAgainstPathEnv(env, inputCmd.Path); err == nil {
+ inputCmd = &command{
+ Path: resolvedPath,
+ Args: inputCmd.Args,
+ EnvUpdates: inputCmd.EnvUpdates,
+ }
+ } else {
+ compilerErr = err
+ }
+ }
+ exitCode := 0
+ if compilerErr == nil {
+ if cfg.oldWrapperPath != "" {
+ exitCode, compilerErr = callCompilerWithRunAndCompareToOldWrapper(env, cfg, inputCmd)
+ } else {
+ exitCode, compilerErr = callCompilerInternal(env, cfg, inputCmd)
+ }
}
if compilerErr != nil {
printCompilerError(env.stderr(), compilerErr)
diff --git a/compiler_wrapper/cros_hardened_config_test.go b/compiler_wrapper/cros_hardened_config_test.go
index b87320b5..cbce1416 100644
--- a/compiler_wrapper/cros_hardened_config_test.go
+++ b/compiler_wrapper/cros_hardened_config_test.go
@@ -193,8 +193,9 @@ func createForceDisableWErrorGoldenInputs() goldenFile {
}
func createGccPathGoldenInputs(ctx *testContext, gomaEnv string) goldenFile {
- deepPath := "a/b/c/d/e/f/g/x86_64-cros-linux-gnu-gcc"
- linkedDeepPath := "symlinked/x86_64-cros-linux-gnu-gcc"
+ deepPath := "./a/b/c/d/e/f/g/x86_64-cros-linux-gnu-gcc"
+ linkedDeepPath := "./symlinked/x86_64-cros-linux-gnu-gcc"
+ ctx.writeFile(filepath.Join(ctx.tempDir, "/pathenv/x86_64-cros-linux-gnu-gcc"), "")
ctx.symlink(deepPath, linkedDeepPath)
return goldenFile{
Name: "gcc_path.json",
@@ -219,13 +220,19 @@ func createGccPathGoldenInputs(ctx *testContext, gomaEnv string) goldenFile {
WrapperCmd: newGoldenCmd(linkedDeepPath, mainCc),
Cmds: okResults,
},
+ {
+ Env: []string{"PATH=" + filepath.Join(ctx.tempDir, "/pathenv")},
+ WrapperCmd: newGoldenCmd("x86_64-cros-linux-gnu-gcc", mainCc),
+ Cmds: okResults,
+ },
},
}
}
func createClangPathGoldenInputs(ctx *testContext, gomaEnv string) goldenFile {
- deepPath := "a/b/c/d/e/f/g/x86_64-cros-linux-gnu-clang"
- linkedDeepPath := "symlinked/x86_64-cros-linux-gnu-clang"
+ deepPath := "./a/b/c/d/e/f/g/x86_64-cros-linux-gnu-clang"
+ linkedDeepPath := "./symlinked/x86_64-cros-linux-gnu-clang"
+ ctx.writeFile(filepath.Join(ctx.tempDir, "/pathenv/x86_64-cros-linux-gnu-clang"), "")
ctx.symlink(deepPath, linkedDeepPath)
return goldenFile{
Name: "clang_path.json",
@@ -281,6 +288,11 @@ func createClangPathGoldenInputs(ctx *testContext, gomaEnv string) goldenFile {
WrapperCmd: newGoldenCmd(linkedDeepPath, mainCc),
Cmds: okResults,
},
+ {
+ Env: []string{"PATH=" + filepath.Join(ctx.tempDir, "/pathenv")},
+ WrapperCmd: newGoldenCmd("x86_64-cros-linux-gnu-clang", mainCc),
+ Cmds: okResults,
+ },
},
}
}
diff --git a/compiler_wrapper/testdata/cros_clang_host_golden/clang_path.json b/compiler_wrapper/testdata/cros_clang_host_golden/clang_path.json
index f78549a8..e72d54c6 100644
--- a/compiler_wrapper/testdata/cros_clang_host_golden/clang_path.json
+++ b/compiler_wrapper/testdata/cros_clang_host_golden/clang_path.json
@@ -289,7 +289,7 @@
"wd": "/tmp/stable",
"wrapper": {
"cmd": {
- "path": "a/b/c/d/e/f/g/x86_64-cros-linux-gnu-clang",
+ "path": "./a/b/c/d/e/f/g/x86_64-cros-linux-gnu-clang",
"args": [
"main.cc"
]
@@ -318,7 +318,7 @@
"wd": "/tmp/stable",
"wrapper": {
"cmd": {
- "path": "symlinked/x86_64-cros-linux-gnu-clang",
+ "path": "./symlinked/x86_64-cros-linux-gnu-clang",
"args": [
"main.cc"
]
@@ -342,5 +342,38 @@
}
}
]
+ },
+ {
+ "wd": "/tmp/stable",
+ "env": [
+ "PATH=/tmp/stable/pathenv"
+ ],
+ "wrapper": {
+ "cmd": {
+ "path": "x86_64-cros-linux-gnu-clang",
+ "args": [
+ "main.cc"
+ ]
+ }
+ },
+ "cmds": [
+ {
+ "cmd": {
+ "path": "/tmp/stable/pathenv/clang",
+ "args": [
+ "-Qunused-arguments",
+ "-grecord-gcc-switches",
+ "-fno-addrsig",
+ "-Wno-unused-local-typedefs",
+ "-Wno-deprecated-declarations",
+ "-Wno-implicit-int-float-conversion",
+ "-Wno-tautological-constant-compare",
+ "-Wno-tautological-unsigned-enum-zero-compare",
+ "-Wno-unknown-warning-option",
+ "main.cc"
+ ]
+ }
+ }
+ ]
}
]
diff --git a/compiler_wrapper/testdata/cros_gcc_host_golden/gcc_path.json b/compiler_wrapper/testdata/cros_gcc_host_golden/gcc_path.json
index 2b6db77f..b846d47f 100644
--- a/compiler_wrapper/testdata/cros_gcc_host_golden/gcc_path.json
+++ b/compiler_wrapper/testdata/cros_gcc_host_golden/gcc_path.json
@@ -81,7 +81,7 @@
"wd": "/tmp/stable",
"wrapper": {
"cmd": {
- "path": "a/b/c/d/e/f/g/x86_64-cros-linux-gnu-gcc",
+ "path": "./a/b/c/d/e/f/g/x86_64-cros-linux-gnu-gcc",
"args": [
"main.cc"
]
@@ -90,7 +90,7 @@
"cmds": [
{
"cmd": {
- "path": "a/b/c/d/e/f/g/x86_64-cros-linux-gnu-gcc.real",
+ "path": "./a/b/c/d/e/f/g/x86_64-cros-linux-gnu-gcc.real",
"args": [
"-Wno-maybe-uninitialized",
"-Wno-unused-local-typedefs",
@@ -105,7 +105,7 @@
"wd": "/tmp/stable",
"wrapper": {
"cmd": {
- "path": "symlinked/x86_64-cros-linux-gnu-gcc",
+ "path": "./symlinked/x86_64-cros-linux-gnu-gcc",
"args": [
"main.cc"
]
@@ -114,7 +114,34 @@
"cmds": [
{
"cmd": {
- "path": "symlinked/x86_64-cros-linux-gnu-gcc.real",
+ "path": "./symlinked/x86_64-cros-linux-gnu-gcc.real",
+ "args": [
+ "-Wno-maybe-uninitialized",
+ "-Wno-unused-local-typedefs",
+ "-Wno-deprecated-declarations",
+ "main.cc"
+ ]
+ }
+ }
+ ]
+ },
+ {
+ "wd": "/tmp/stable",
+ "env": [
+ "PATH=/tmp/stable/pathenv"
+ ],
+ "wrapper": {
+ "cmd": {
+ "path": "x86_64-cros-linux-gnu-gcc",
+ "args": [
+ "main.cc"
+ ]
+ }
+ },
+ "cmds": [
+ {
+ "cmd": {
+ "path": "/tmp/stable/pathenv/x86_64-cros-linux-gnu-gcc.real",
"args": [
"-Wno-maybe-uninitialized",
"-Wno-unused-local-typedefs",
diff --git a/compiler_wrapper/testdata/cros_hardened_golden/clang_path.json b/compiler_wrapper/testdata/cros_hardened_golden/clang_path.json
index a2a03b72..8fc8d69f 100644
--- a/compiler_wrapper/testdata/cros_hardened_golden/clang_path.json
+++ b/compiler_wrapper/testdata/cros_hardened_golden/clang_path.json
@@ -411,7 +411,7 @@
"wd": "/tmp/stable",
"wrapper": {
"cmd": {
- "path": "a/b/c/d/e/f/g/x86_64-cros-linux-gnu-clang",
+ "path": "./a/b/c/d/e/f/g/x86_64-cros-linux-gnu-clang",
"args": [
"main.cc"
]
@@ -456,7 +456,7 @@
"wd": "/tmp/stable",
"wrapper": {
"cmd": {
- "path": "symlinked/x86_64-cros-linux-gnu-clang",
+ "path": "./symlinked/x86_64-cros-linux-gnu-clang",
"args": [
"main.cc"
]
@@ -496,5 +496,54 @@
}
}
]
+ },
+ {
+ "wd": "/tmp/stable",
+ "env": [
+ "PATH=/tmp/stable/pathenv"
+ ],
+ "wrapper": {
+ "cmd": {
+ "path": "x86_64-cros-linux-gnu-clang",
+ "args": [
+ "main.cc"
+ ]
+ }
+ },
+ "cmds": [
+ {
+ "cmd": {
+ "path": "/usr/bin/ccache",
+ "args": [
+ "/usr/bin/clang",
+ "--sysroot=/usr/x86_64-cros-linux-gnu",
+ "-Qunused-arguments",
+ "-grecord-gcc-switches",
+ "-fno-addrsig",
+ "-Wno-implicit-int-float-conversion",
+ "-Wno-tautological-constant-compare",
+ "-Wno-tautological-unsigned-enum-zero-compare",
+ "-Wno-unknown-warning-option",
+ "-Wno-section",
+ "-static-libgcc",
+ "-fstack-protector-strong",
+ "-fPIE",
+ "-pie",
+ "-D_FORTIFY_SOURCE=2",
+ "-fno-omit-frame-pointer",
+ "main.cc",
+ "-B../../bin",
+ "-target",
+ "x86_64-cros-linux-gnu"
+ ],
+ "env_updates": [
+ "CCACHE_BASEDIR=/usr/x86_64-cros-linux-gnu",
+ "CCACHE_DIR=/var/cache/distfiles/ccache",
+ "CCACHE_UMASK=002",
+ "CCACHE_CPP2=yes"
+ ]
+ }
+ }
+ ]
}
]
diff --git a/compiler_wrapper/testdata/cros_hardened_golden/gcc_path.json b/compiler_wrapper/testdata/cros_hardened_golden/gcc_path.json
index 0d32ad03..24ad65ae 100644
--- a/compiler_wrapper/testdata/cros_hardened_golden/gcc_path.json
+++ b/compiler_wrapper/testdata/cros_hardened_golden/gcc_path.json
@@ -120,7 +120,7 @@
"wd": "/tmp/stable",
"wrapper": {
"cmd": {
- "path": "a/b/c/d/e/f/g/x86_64-cros-linux-gnu-gcc",
+ "path": "./a/b/c/d/e/f/g/x86_64-cros-linux-gnu-gcc",
"args": [
"main.cc"
]
@@ -131,7 +131,7 @@
"cmd": {
"path": "/usr/bin/ccache",
"args": [
- "a/b/c/d/e/f/g/x86_64-cros-linux-gnu-gcc.real",
+ "./a/b/c/d/e/f/g/x86_64-cros-linux-gnu-gcc.real",
"--sysroot=/tmp/stable/a/b/usr/x86_64-cros-linux-gnu",
"-fno-reorder-blocks-and-partition",
"-Wno-unused-local-typedefs",
@@ -157,7 +157,7 @@
"wd": "/tmp/stable",
"wrapper": {
"cmd": {
- "path": "symlinked/x86_64-cros-linux-gnu-gcc",
+ "path": "./symlinked/x86_64-cros-linux-gnu-gcc",
"args": [
"main.cc"
]
@@ -168,7 +168,7 @@
"cmd": {
"path": "/usr/bin/ccache",
"args": [
- "symlinked/x86_64-cros-linux-gnu-gcc.real",
+ "./symlinked/x86_64-cros-linux-gnu-gcc.real",
"--sysroot=/tmp/stable/a/b/usr/x86_64-cros-linux-gnu",
"-fno-reorder-blocks-and-partition",
"-Wno-unused-local-typedefs",
@@ -189,5 +189,45 @@
}
}
]
+ },
+ {
+ "wd": "/tmp/stable",
+ "env": [
+ "PATH=/tmp/stable/pathenv"
+ ],
+ "wrapper": {
+ "cmd": {
+ "path": "x86_64-cros-linux-gnu-gcc",
+ "args": [
+ "main.cc"
+ ]
+ }
+ },
+ "cmds": [
+ {
+ "cmd": {
+ "path": "/usr/bin/ccache",
+ "args": [
+ "/tmp/stable/pathenv/x86_64-cros-linux-gnu-gcc.real",
+ "--sysroot=/usr/x86_64-cros-linux-gnu",
+ "-fno-reorder-blocks-and-partition",
+ "-Wno-unused-local-typedefs",
+ "-Wno-maybe-uninitialized",
+ "-fstack-protector-strong",
+ "-fPIE",
+ "-pie",
+ "-D_FORTIFY_SOURCE=2",
+ "-fno-omit-frame-pointer",
+ "main.cc",
+ "-mno-movbe"
+ ],
+ "env_updates": [
+ "CCACHE_BASEDIR=/usr/x86_64-cros-linux-gnu",
+ "CCACHE_DIR=/var/cache/distfiles/ccache",
+ "CCACHE_UMASK=002"
+ ]
+ }
+ }
+ ]
}
]
diff --git a/compiler_wrapper/testdata/cros_hardened_noccache_golden/clang_path.json b/compiler_wrapper/testdata/cros_hardened_noccache_golden/clang_path.json
index ce07459e..a00bcc82 100644
--- a/compiler_wrapper/testdata/cros_hardened_noccache_golden/clang_path.json
+++ b/compiler_wrapper/testdata/cros_hardened_noccache_golden/clang_path.json
@@ -362,7 +362,7 @@
"wd": "/tmp/stable",
"wrapper": {
"cmd": {
- "path": "a/b/c/d/e/f/g/x86_64-cros-linux-gnu-clang",
+ "path": "./a/b/c/d/e/f/g/x86_64-cros-linux-gnu-clang",
"args": [
"main.cc"
]
@@ -400,7 +400,7 @@
"wd": "/tmp/stable",
"wrapper": {
"cmd": {
- "path": "symlinked/x86_64-cros-linux-gnu-clang",
+ "path": "./symlinked/x86_64-cros-linux-gnu-clang",
"args": [
"main.cc"
]
@@ -433,5 +433,47 @@
}
}
]
+ },
+ {
+ "wd": "/tmp/stable",
+ "env": [
+ "PATH=/tmp/stable/pathenv"
+ ],
+ "wrapper": {
+ "cmd": {
+ "path": "x86_64-cros-linux-gnu-clang",
+ "args": [
+ "main.cc"
+ ]
+ }
+ },
+ "cmds": [
+ {
+ "cmd": {
+ "path": "/usr/bin/clang",
+ "args": [
+ "--sysroot=/usr/x86_64-cros-linux-gnu",
+ "-Qunused-arguments",
+ "-grecord-gcc-switches",
+ "-fno-addrsig",
+ "-Wno-implicit-int-float-conversion",
+ "-Wno-tautological-constant-compare",
+ "-Wno-tautological-unsigned-enum-zero-compare",
+ "-Wno-unknown-warning-option",
+ "-Wno-section",
+ "-static-libgcc",
+ "-fstack-protector-strong",
+ "-fPIE",
+ "-pie",
+ "-D_FORTIFY_SOURCE=2",
+ "-fno-omit-frame-pointer",
+ "main.cc",
+ "-B../../bin",
+ "-target",
+ "x86_64-cros-linux-gnu"
+ ]
+ }
+ }
+ ]
}
]
diff --git a/compiler_wrapper/testdata/cros_hardened_noccache_golden/gcc_path.json b/compiler_wrapper/testdata/cros_hardened_noccache_golden/gcc_path.json
index 66957f5b..694b921a 100644
--- a/compiler_wrapper/testdata/cros_hardened_noccache_golden/gcc_path.json
+++ b/compiler_wrapper/testdata/cros_hardened_noccache_golden/gcc_path.json
@@ -102,7 +102,7 @@
"wd": "/tmp/stable",
"wrapper": {
"cmd": {
- "path": "a/b/c/d/e/f/g/x86_64-cros-linux-gnu-gcc",
+ "path": "./a/b/c/d/e/f/g/x86_64-cros-linux-gnu-gcc",
"args": [
"main.cc"
]
@@ -111,7 +111,7 @@
"cmds": [
{
"cmd": {
- "path": "a/b/c/d/e/f/g/x86_64-cros-linux-gnu-gcc.real",
+ "path": "./a/b/c/d/e/f/g/x86_64-cros-linux-gnu-gcc.real",
"args": [
"--sysroot=/tmp/stable/a/b/usr/x86_64-cros-linux-gnu",
"-fno-reorder-blocks-and-partition",
@@ -133,7 +133,7 @@
"wd": "/tmp/stable",
"wrapper": {
"cmd": {
- "path": "symlinked/x86_64-cros-linux-gnu-gcc",
+ "path": "./symlinked/x86_64-cros-linux-gnu-gcc",
"args": [
"main.cc"
]
@@ -142,7 +142,7 @@
"cmds": [
{
"cmd": {
- "path": "symlinked/x86_64-cros-linux-gnu-gcc.real",
+ "path": "./symlinked/x86_64-cros-linux-gnu-gcc.real",
"args": [
"--sysroot=/tmp/stable/a/b/usr/x86_64-cros-linux-gnu",
"-fno-reorder-blocks-and-partition",
@@ -159,5 +159,39 @@
}
}
]
+ },
+ {
+ "wd": "/tmp/stable",
+ "env": [
+ "PATH=/tmp/stable/pathenv"
+ ],
+ "wrapper": {
+ "cmd": {
+ "path": "x86_64-cros-linux-gnu-gcc",
+ "args": [
+ "main.cc"
+ ]
+ }
+ },
+ "cmds": [
+ {
+ "cmd": {
+ "path": "/tmp/stable/pathenv/x86_64-cros-linux-gnu-gcc.real",
+ "args": [
+ "--sysroot=/usr/x86_64-cros-linux-gnu",
+ "-fno-reorder-blocks-and-partition",
+ "-Wno-unused-local-typedefs",
+ "-Wno-maybe-uninitialized",
+ "-fstack-protector-strong",
+ "-fPIE",
+ "-pie",
+ "-D_FORTIFY_SOURCE=2",
+ "-fno-omit-frame-pointer",
+ "main.cc",
+ "-mno-movbe"
+ ]
+ }
+ }
+ ]
}
]
diff --git a/compiler_wrapper/testdata/cros_nonhardened_golden/clang_path.json b/compiler_wrapper/testdata/cros_nonhardened_golden/clang_path.json
index a2744a5f..507f10f1 100644
--- a/compiler_wrapper/testdata/cros_nonhardened_golden/clang_path.json
+++ b/compiler_wrapper/testdata/cros_nonhardened_golden/clang_path.json
@@ -355,7 +355,7 @@
"wd": "/tmp/stable",
"wrapper": {
"cmd": {
- "path": "a/b/c/d/e/f/g/x86_64-cros-linux-gnu-clang",
+ "path": "./a/b/c/d/e/f/g/x86_64-cros-linux-gnu-clang",
"args": [
"main.cc"
]
@@ -393,7 +393,7 @@
"wd": "/tmp/stable",
"wrapper": {
"cmd": {
- "path": "symlinked/x86_64-cros-linux-gnu-clang",
+ "path": "./symlinked/x86_64-cros-linux-gnu-clang",
"args": [
"main.cc"
]
@@ -426,5 +426,47 @@
}
}
]
+ },
+ {
+ "wd": "/tmp/stable",
+ "env": [
+ "PATH=/tmp/stable/pathenv"
+ ],
+ "wrapper": {
+ "cmd": {
+ "path": "x86_64-cros-linux-gnu-clang",
+ "args": [
+ "main.cc"
+ ]
+ }
+ },
+ "cmds": [
+ {
+ "cmd": {
+ "path": "/usr/bin/ccache",
+ "args": [
+ "/usr/bin/clang",
+ "--sysroot=/usr/x86_64-cros-linux-gnu",
+ "-Qunused-arguments",
+ "-Wno-implicit-int-float-conversion",
+ "-Wno-tautological-constant-compare",
+ "-Wno-tautological-unsigned-enum-zero-compare",
+ "-Wno-unknown-warning-option",
+ "-Wno-section",
+ "-static-libgcc",
+ "main.cc",
+ "-B../../bin",
+ "-target",
+ "x86_64-cros-linux-gnu"
+ ],
+ "env_updates": [
+ "CCACHE_BASEDIR=/usr/x86_64-cros-linux-gnu",
+ "CCACHE_DIR=/var/cache/distfiles/ccache",
+ "CCACHE_UMASK=002",
+ "CCACHE_CPP2=yes"
+ ]
+ }
+ }
+ ]
}
]
diff --git a/compiler_wrapper/testdata/cros_nonhardened_golden/gcc_path.json b/compiler_wrapper/testdata/cros_nonhardened_golden/gcc_path.json
index e3b5772a..92a261ce 100644
--- a/compiler_wrapper/testdata/cros_nonhardened_golden/gcc_path.json
+++ b/compiler_wrapper/testdata/cros_nonhardened_golden/gcc_path.json
@@ -108,7 +108,7 @@
"wd": "/tmp/stable",
"wrapper": {
"cmd": {
- "path": "a/b/c/d/e/f/g/x86_64-cros-linux-gnu-gcc",
+ "path": "./a/b/c/d/e/f/g/x86_64-cros-linux-gnu-gcc",
"args": [
"main.cc"
]
@@ -119,7 +119,7 @@
"cmd": {
"path": "/usr/bin/ccache",
"args": [
- "a/b/c/d/e/f/g/x86_64-cros-linux-gnu-gcc.real",
+ "./a/b/c/d/e/f/g/x86_64-cros-linux-gnu-gcc.real",
"--sysroot=/tmp/stable/a/b/usr/x86_64-cros-linux-gnu",
"-Wno-maybe-uninitialized",
"-Wno-unused-local-typedefs",
@@ -141,7 +141,7 @@
"wd": "/tmp/stable",
"wrapper": {
"cmd": {
- "path": "symlinked/x86_64-cros-linux-gnu-gcc",
+ "path": "./symlinked/x86_64-cros-linux-gnu-gcc",
"args": [
"main.cc"
]
@@ -152,7 +152,7 @@
"cmd": {
"path": "/usr/bin/ccache",
"args": [
- "symlinked/x86_64-cros-linux-gnu-gcc.real",
+ "./symlinked/x86_64-cros-linux-gnu-gcc.real",
"--sysroot=/tmp/stable/a/b/usr/x86_64-cros-linux-gnu",
"-Wno-maybe-uninitialized",
"-Wno-unused-local-typedefs",
@@ -169,5 +169,41 @@
}
}
]
+ },
+ {
+ "wd": "/tmp/stable",
+ "env": [
+ "PATH=/tmp/stable/pathenv"
+ ],
+ "wrapper": {
+ "cmd": {
+ "path": "x86_64-cros-linux-gnu-gcc",
+ "args": [
+ "main.cc"
+ ]
+ }
+ },
+ "cmds": [
+ {
+ "cmd": {
+ "path": "/usr/bin/ccache",
+ "args": [
+ "/tmp/stable/pathenv/x86_64-cros-linux-gnu-gcc.real",
+ "--sysroot=/usr/x86_64-cros-linux-gnu",
+ "-Wno-maybe-uninitialized",
+ "-Wno-unused-local-typedefs",
+ "-Wno-deprecated-declarations",
+ "-Wtrampolines",
+ "main.cc",
+ "-mno-movbe"
+ ],
+ "env_updates": [
+ "CCACHE_BASEDIR=/usr/x86_64-cros-linux-gnu",
+ "CCACHE_DIR=/var/cache/distfiles/ccache",
+ "CCACHE_UMASK=002"
+ ]
+ }
+ }
+ ]
}
]