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
This commit is contained in:
parent
a405301f03
commit
3c5d4c257d
2 changed files with 5 additions and 29 deletions
|
@ -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
|
||||
|
|
|
@ -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")
|
||||
|
|
Loading…
Reference in a new issue