From 225a37a7f06063d565627bbad6a8e3a87bcbb217 Mon Sep 17 00:00:00 2001 From: Colin Cross Date: Wed, 11 Jan 2023 14:17:39 -0800 Subject: Use the same rpaths for tests and binaries and cc and rust Rust and cc binaries currently use $ORIGIN/lib64:$ORIGIN/../lib64 as the rpath, and cc tests add $ORIGIN/../../lib64:$ORIGIN/../../../$ORIGIN:$ORIGIN. This causes problems when a binary is included as test data in out/host/linux-x86/testcases///, as the binaries can't find the libraries in out/host/linux-x86/lib64. Use the same rpath for test and binaries, and for cc and rust. Bug: 264604160 Test: m USE_HOST_MUSL=true out/host/linux-x86/testcases/acpi_tables_test_src_lib/x86_64/acpi_tables_test_src_lib && out/host/linux-x86/testcases/acpi_tables_test_src_lib/x86_64/acpi_tables_test_src_lib Test: m USE_HOST_MUSL=true out/host/linux-x86/testcases/gen_sdk_test/x86_64/gen_sdk_test && out/host/linux-x86/testcases/gen_sdk_test/x86_64/toybox Change-Id: I10fe5dc0de01d1f3c6aea8dbabbf60edab5989c3 --- rust/compiler.go | 15 ++------------- 1 file changed, 2 insertions(+), 13 deletions(-) (limited to 'rust/compiler.go') diff --git a/rust/compiler.go b/rust/compiler.go index 6055158ec..8ec42f079 100644 --- a/rust/compiler.go +++ b/rust/compiler.go @@ -15,6 +15,7 @@ package rust import ( + "android/soong/cc" "fmt" "path/filepath" "strings" @@ -307,19 +308,7 @@ func (compiler *baseCompiler) compilerFlags(ctx ModuleContext, flags Flags) Flag flags.EmitXrefs = ctx.Config().EmitXrefRules() if ctx.Host() && !ctx.Windows() { - rpathPrefix := `\$$ORIGIN/` - if ctx.Darwin() { - rpathPrefix = "@loader_path/" - } - - var rpath string - if ctx.toolchain().Is64Bit() { - rpath = "lib64" - } else { - rpath = "lib" - } - flags.LinkFlags = append(flags.LinkFlags, "-Wl,-rpath,"+rpathPrefix+rpath) - flags.LinkFlags = append(flags.LinkFlags, "-Wl,-rpath,"+rpathPrefix+"../"+rpath) + flags.LinkFlags = append(flags.LinkFlags, cc.RpathFlags(ctx)...) } return flags -- cgit v1.2.3-59-g8ed1b