From 2bbcacf0c93984304ffa4aed26a8f3ec48fdd861 Mon Sep 17 00:00:00 2001 From: Ivan Lozano Date: Fri, 7 Aug 2020 09:00:50 -0400 Subject: [PATCH] Don't export link dirs from proc-macros. We shouldn't use exported link dirs from proc-macros as these may be libraries for the wrong architecture or OS. This doesn't cause a problem unless both the proc-macro and the dependent library share a dependency. If that's the case, in some circumstances it will cause the depdent library to fail compilation when using a library with incorrect architecture. Bug: 163088025 Test: Test case no longer colliding. Test: cd external/rust/; mma Change-Id: I46cbd850c3a89d10aa844b5c1b383e1070452d00 --- rust/rust.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/rust/rust.go b/rust/rust.go index 7ec2d736b..ff65ec634 100644 --- a/rust/rust.go +++ b/rust/rust.go @@ -807,8 +807,8 @@ func (mod *Module) depsToPaths(ctx android.ModuleContext) PathDeps { directSrcProvidersDeps = append(directSrcProvidersDeps, rustDep) } - //Append the dependencies exportedDirs - if lib, ok := rustDep.compiler.(exportedFlagsProducer); ok { + //Append the dependencies exportedDirs, except for proc-macros which target a different arch/OS + if lib, ok := rustDep.compiler.(exportedFlagsProducer); ok && depTag != procMacroDepTag { depPaths.linkDirs = append(depPaths.linkDirs, lib.exportedLinkDirs()...) depPaths.depFlags = append(depPaths.depFlags, lib.exportedDepFlags()...) }