Fix addrsig warnings
ld -r reorders symbols and invalidates the .llvm_addrsig section, which then causes warnings if the resulting object is used with ld --icf=safe. The warning is especially common when building with musl, as the clang_rt.crt* objects have .llvm_addrsig sections, are linked into libc_musl_crt* using ld -r, and are then linked into every other binary and shared library with --icf=safe. Strip the .llvm_addrsig section after ld -r to prevent the warnings. Test: m USE_HOST_MUSL=true host-native -k Change-Id: Ia52a4756b9ebbb62115898d0de9f8641e6fea705
This commit is contained in:
@@ -309,6 +309,8 @@ func (object *objectLinker) link(ctx ModuleContext,
|
||||
})
|
||||
}
|
||||
} else {
|
||||
outputAddrSig := android.PathForModuleOut(ctx, "addrsig", outputName)
|
||||
|
||||
if String(object.Properties.Prefix_symbols) != "" {
|
||||
input := android.PathForModuleOut(ctx, "unprefixed", outputName)
|
||||
transformBinaryPrefixSymbols(ctx, String(object.Properties.Prefix_symbols), input,
|
||||
@@ -316,7 +318,12 @@ func (object *objectLinker) link(ctx ModuleContext,
|
||||
output = input
|
||||
}
|
||||
|
||||
transformObjsToObj(ctx, objs.objFiles, builderFlags, output, flags.LdFlagsDeps)
|
||||
transformObjsToObj(ctx, objs.objFiles, builderFlags, outputAddrSig, flags.LdFlagsDeps)
|
||||
|
||||
// ld -r reorders symbols and invalidates the .llvm_addrsig section, which then causes warnings
|
||||
// if the resulting object is used with ld --icf=safe. Strip the .llvm_addrsig section to
|
||||
// prevent the warnings.
|
||||
transformObjectNoAddrSig(ctx, outputAddrSig, output)
|
||||
}
|
||||
|
||||
ctx.CheckbuildFile(outputFile)
|
||||
|
Reference in New Issue
Block a user