Support filegroups for version_script and related properties

Bug: 71715793
Test: m checkbuild
Change-Id: Ibf78a5ec88e743f29504c91057d2cfced667c8b4
diff --git a/cc/binary.go b/cc/binary.go
index 206237a..630a68d 100644
--- a/cc/binary.go
+++ b/cc/binary.go
@@ -158,6 +158,9 @@
 		ctx.ModuleErrorf("statically linking libc to dynamic executable, please remove libc\n" +
 			"from static libs or set static_executable: true")
 	}
+
+	android.ExtractSourceDeps(ctx, binary.Properties.Version_script)
+
 	return deps
 }
 
@@ -277,7 +280,7 @@
 func (binary *binaryDecorator) link(ctx ModuleContext,
 	flags Flags, deps PathDeps, objs Objects) android.Path {
 
-	versionScript := android.OptionalPathForModuleSrc(ctx, binary.Properties.Version_script)
+	versionScript := ctx.ExpandOptionalSource(binary.Properties.Version_script, "version_script")
 	fileName := binary.getStem(ctx) + flags.Toolchain.ExecutableSuffix()
 	outputFile := android.PathForModuleOut(ctx, fileName)
 	ret := outputFile