Enable safe ICF with LLD.

Support for safe ICF was added to LLD in LLVM r337429. This reduces
the size of sailfish system.img by 7.6MB.

The address-significance tables created by Clang to support LLD's
implementation of safe ICF are incompatible with ld -r. Therefore we
need to pass -fno-addrsig to the compiler to prevent it from creating
an address-significance table when building a cc_object.

Change-Id: I83e28741e6b3cdf09566447d2658ce48594f2074
This commit is contained in:
Peter Collingbourne
2018-10-25 10:53:44 -07:00
parent 1e30905f65
commit 486e42c353
2 changed files with 4 additions and 1 deletions

View File

@@ -39,6 +39,10 @@ func ObjectFactory() android.Module {
baseLinker: NewBaseLinker(nil),
}
module.compiler = NewBaseCompiler()
// Clang's address-significance tables are incompatible with ld -r.
module.compiler.appendCflags([]string{"-fno-addrsig"})
module.stl = &stl{}
return module.Init()
}