Allow custom ar flags to be set.
Adds the ability to set custom flags for ar in Soong, similar to how
they can currently be set for make.
Bug: 36290748
Test: sanitize.go is able to correct set custom ar flags for CFI. CFI
enabled Soong components build and boot without issue.
Change-Id: I3212793aa84ba51df910c184d8bb376b3650376e
diff --git a/cc/builder.go b/cc/builder.go
index 9a871d5..f3a4bcb 100644
--- a/cc/builder.go
+++ b/cc/builder.go
@@ -184,6 +184,7 @@
type builderFlags struct {
globalFlags string
+ arFlags string
asFlags string
cFlags string
conlyFlags string
@@ -367,6 +368,9 @@
arCmd := gccCmd(flags.toolchain, "ar")
arFlags := "crsPD"
+ if flags.arFlags != "" {
+ arFlags += " " + flags.arFlags
+ }
ctx.ModuleBuild(pctx, android.ModuleBuildParams{
Rule: ar,