summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Sharjeel Khan <sharjeelkhan@google.com> 2023-08-11 18:13:38 +0000
committer Sharjeel Khan <sharjeelkhan@google.com> 2023-08-11 23:28:46 +0000
commit3c5d4c257d5647774f40638b1631ab576957a2cc (patch)
treeb1187783a945e9ec73c7440875cdd02d55b48653
parenta405301f0319e571ef48eac5101e2a50944624ea (diff)
Removed order file use flags from being passed to cflags
The orderfile use flags are unused as cflags causing warnings which becomes errors in some order file builds In addition, I fixed the test cases so it only looks at ldflags not cflags for orderfile use flags. Test: mma build/soong Output: #### build completed successfully (05:14 (mm:ss)) #### Change-Id: I2a2d846d6688fd5256cf753267c000ff054d56f1
-rw-r--r--cc/orderfile.go3
-rw-r--r--cc/orderfile_test.go31
2 files changed, 5 insertions, 29 deletions
diff --git a/cc/orderfile.go b/cc/orderfile.go
index cc1ab29d0..b64c1c7a1 100644
--- a/cc/orderfile.go
+++ b/cc/orderfile.go
@@ -121,9 +121,9 @@ func (props *OrderfileProperties) getOrderfile(ctx BaseModuleContext) android.Op
}
func (props *OrderfileProperties) addInstrumentationProfileGatherFlags(ctx ModuleContext, flags Flags) Flags {
- flags.Local.CFlags = append(flags.Local.CFlags, props.Orderfile.Cflags...)
flags.Local.CFlags = append(flags.Local.CFlags, orderfileProfileFlag)
flags.Local.CFlags = append(flags.Local.CFlags, "-mllvm -enable-order-file-instrumentation")
+ flags.Local.CFlags = append(flags.Local.CFlags, props.Orderfile.Cflags...)
flags.Local.LdFlags = append(flags.Local.LdFlags, orderfileProfileFlag)
return flags
}
@@ -140,7 +140,6 @@ func (props *OrderfileProperties) addLoadFlags(ctx ModuleContext, flags Flags) F
orderFilePath := orderFile.Path()
loadFlags := props.loadOrderfileFlags(ctx, orderFilePath.String())
- flags.Local.CFlags = append(flags.Local.CFlags, loadFlags...)
flags.Local.LdFlags = append(flags.Local.LdFlags, loadFlags...)
// Update CFlagsDeps and LdFlagsDeps so the module is rebuilt
diff --git a/cc/orderfile_test.go b/cc/orderfile_test.go
index 9e30bd2d5..f68457d32 100644
--- a/cc/orderfile_test.go
+++ b/cc/orderfile_test.go
@@ -79,12 +79,6 @@ func TestOrderfileLoadSharedLibrary(t *testing.T) {
libTest := result.ModuleForTests("libTest", "android_arm64_armv8-a_shared")
- // Check cFlags of orderfile-enabled module
- cFlags := libTest.Rule("cc").Args["cFlags"]
- if !strings.Contains(cFlags, expectedCFlag) {
- t.Errorf("Expected 'libTest' to load orderfile, but did not find %q in cflags %q", expectedCFlag, cFlags)
- }
-
// Check ldFlags of orderfile-enabled module
ldFlags := libTest.Rule("ld").Args["ldFlags"]
if !strings.Contains(ldFlags, expectedCFlag) {
@@ -150,12 +144,6 @@ func TestOrderfileLoadBinary(t *testing.T) {
test := result.ModuleForTests("test", "android_arm64_armv8-a")
- // Check cFlags of orderfile-enabled module
- cFlags := test.Rule("cc").Args["cFlags"]
- if !strings.Contains(cFlags, expectedCFlag) {
- t.Errorf("Expected 'test' to load orderfile, but did not find %q in cflags %q", expectedCFlag, cFlags)
- }
-
// Check ldFlags of orderfile-enabled module
ldFlags := test.Rule("ld").Args["ldFlags"]
if !strings.Contains(ldFlags, expectedCFlag) {
@@ -285,28 +273,17 @@ func TestOrderfileLoadPropagateStaticDeps(t *testing.T) {
expectedCFlag := "-Wl,--symbol-ordering-file=toolchain/pgo-profiles/orderfiles/test.orderfile"
- // Check cFlags of orderfile-enabled module
+ // Check ldFlags of orderfile-enabled module
libTest := result.ModuleForTests("libTest", "android_arm64_armv8-a_shared")
- cFlags := libTest.Rule("cc").Args["cFlags"]
- if !strings.Contains(cFlags, expectedCFlag) {
- t.Errorf("Expected 'libTest' to load orderfile, but did not find %q in cflags %q", expectedCFlag, cFlags)
+ ldFlags := libTest.Rule("ld").Args["ldFlags"]
+ if !strings.Contains(ldFlags, expectedCFlag) {
+ t.Errorf("Expected 'libTest' to load orderfile, but did not find %q in ldFlags %q", expectedCFlag, ldFlags)
}
- // Check cFlags of the non-orderfile variant static libraries
libFoo := result.ModuleForTests("libFoo", "android_arm64_armv8-a_static")
libBar := result.ModuleForTests("libBar", "android_arm64_armv8-a_static")
- cFlags = libFoo.Rule("cc").Args["cFlags"]
- if strings.Contains(cFlags, expectedCFlag) {
- t.Errorf("Expected 'libFoo' not load orderfile, but did find %q in cflags %q", expectedCFlag, cFlags)
- }
-
- cFlags = libBar.Rule("cc").Args["cFlags"]
- if strings.Contains(cFlags, expectedCFlag) {
- t.Errorf("Expected 'libBar' not load orderfile, but did find %q in cflags %q", expectedCFlag, cFlags)
- }
-
// Check dependency edge from orderfile-enabled module to non-orderfile variant static libraries
if !hasDirectDep(result, libTest.Module(), libFoo.Module()) {
t.Errorf("libTest missing dependency on non-orderfile variant of libFoo")