summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Yi Kong <yikong@google.com> 2023-04-05 11:33:11 +0900
committer Yi Kong <yikong@google.com> 2023-04-05 11:49:19 +0900
commita1961e7eedf7613e208db55b9eb1fa51d11a50a7 (patch)
tree8d31a67da3155713fa2ae47c88133f8de2cb887f
parent28ba80665d90d391c6cc69f29e8dab68aa4620f8 (diff)
Prepend AFDO flags to allow overriding
This enables turnning off -fprofile-sample-accurate on a per project basis. Bug: 274725934 Bug: 273415627 Test: presubmit Change-Id: I15060950f7b55e51069cb00b66512c7e94981f1b
-rw-r--r--cc/afdo.go6
1 files changed, 3 insertions, 3 deletions
diff --git a/cc/afdo.go b/cc/afdo.go
index 4a8498bc7..be4f50adb 100644
--- a/cc/afdo.go
+++ b/cc/afdo.go
@@ -71,10 +71,10 @@ func (afdo *afdo) afdoEnabled() bool {
func (afdo *afdo) flags(ctx ModuleContext, flags Flags) Flags {
if path := afdo.Properties.FdoProfilePath; path != nil {
+ // The flags are prepended to allow overriding.
profileUseFlag := fmt.Sprintf(afdoCFlagsFormat, *path)
- flags.Local.CFlags = append(flags.Local.CFlags, profileUseFlag)
- flags.Local.LdFlags = append(flags.Local.LdFlags, profileUseFlag)
- flags.Local.LdFlags = append(flags.Local.LdFlags, "-Wl,-mllvm,-no-warn-sample-unused=true")
+ flags.Local.CFlags = append([]string{profileUseFlag}, flags.Local.CFlags...)
+ flags.Local.LdFlags = append([]string{profileUseFlag, "-Wl,-mllvm,-no-warn-sample-unused=true"}, flags.Local.LdFlags...)
// Update CFlagsDeps and LdFlagsDeps so the module is rebuilt
// if profileFile gets updated