diff options
author | Manoj Gupta <manojgupta@google.com> | 2022-01-05 14:06:42 -0800 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2022-01-05 22:34:40 +0000 |
commit | dbc8cb672a14f4a8bb136074817c71a22f743eaf (patch) | |
tree | df461649df684c45516ccf619564df284b5e98e7 | |
parent | 0274702f8b916ec2e65b069ee3b9444e3ed6dfa8 (diff) | |
download | toolchain-utils-dbc8cb672a14f4a8bb136074817c71a22f743eaf.tar.gz |
compiler_wrapper: Use ld.bfd to detect binutils path
Use ld.bfd instead of ld to detect binutils path. This is to assist
in finding packages that use GCC/Binutils ignoring portage
enviroment.
BUG=b:193847062
TEST=go test
Change-Id: I0fd8c5c13ad2227f03ec3193c58c9bdfca4e4dc6
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/toolchain-utils/+/3365636
Tested-by: Manoj Gupta <manojgupta@chromium.org>
Auto-Submit: Manoj Gupta <manojgupta@chromium.org>
Reviewed-by: George Burgess <gbiv@chromium.org>
Commit-Queue: George Burgess <gbiv@chromium.org>
-rw-r--r-- | compiler_wrapper/clang_flags.go | 2 | ||||
-rw-r--r-- | compiler_wrapper/clang_flags_test.go | 4 |
2 files changed, 3 insertions, 3 deletions
diff --git a/compiler_wrapper/clang_flags.go b/compiler_wrapper/clang_flags.go index 84149bf6..e25ed74c 100644 --- a/compiler_wrapper/clang_flags.go +++ b/compiler_wrapper/clang_flags.go @@ -126,7 +126,7 @@ func processClangFlags(builder *commandBuilder) error { // Specify the target for clang. if !builder.cfg.isHostWrapper { - linkerPath := getLinkerPath(env, builder.target.target+"-ld", builder.rootPath) + linkerPath := getLinkerPath(env, builder.target.target+"-ld.bfd", builder.rootPath) relLinkerPath, err := filepath.Rel(env.getwd(), linkerPath) if err != nil { return wrapErrorwithSourceLocf(err, "failed to make linker path %s relative to %s", diff --git a/compiler_wrapper/clang_flags_test.go b/compiler_wrapper/clang_flags_test.go index 25c13c74..23aed7ef 100644 --- a/compiler_wrapper/clang_flags_test.go +++ b/compiler_wrapper/clang_flags_test.go @@ -248,7 +248,7 @@ func TestClangArchFlags(t *testing.T) { func TestClangLinkerPathProbesBinariesOnPath(t *testing.T) { withTestContext(t, func(ctx *testContext) { linkerPath := filepath.Join(ctx.tempDir, "a/b/c") - ctx.writeFile(filepath.Join(linkerPath, "x86_64-cros-linux-gnu-ld"), "") + ctx.writeFile(filepath.Join(linkerPath, "x86_64-cros-linux-gnu-ld.bfd"), "") ctx.env = []string{"PATH=nonExistantPath:" + linkerPath} cmd := ctx.must(callCompiler(ctx, ctx.cfg, ctx.newCommand("./x86_64-cros-linux-gnu-clang", mainCc))) @@ -268,7 +268,7 @@ func TestClangLinkerPathEvaluatesSymlinksForBinariesOnPath(t *testing.T) { ctx.writeFile(realLinkerPath, "") firstLinkLinkerPath := filepath.Join(ctx.tempDir, "a/first/somelinker") ctx.symlink(realLinkerPath, firstLinkLinkerPath) - secondLinkLinkerPath := filepath.Join(ctx.tempDir, "a/second/x86_64-cros-linux-gnu-ld") + secondLinkLinkerPath := filepath.Join(ctx.tempDir, "a/second/x86_64-cros-linux-gnu-ld.bfd") ctx.symlink(firstLinkLinkerPath, secondLinkLinkerPath) ctx.env = []string{"PATH=nonExistantPath:" + filepath.Dir(secondLinkLinkerPath)} |