Merge "Move gen_sorted_bss_symbols.sh to use LLVM binutils" am: 9d9e053964
am: dd19e029a5
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1659997 Change-Id: Ib07c530738d5f6e61e3c16ae692070c7ccf0a386
This commit is contained in:
commit
3ef89b207a
|
@ -599,21 +599,20 @@ var (
|
|||
_ = pctx.SourcePathVariable("genSortedBssSymbolsPath", "build/soong/scripts/gen_sorted_bss_symbols.sh")
|
||||
genSortedBssSymbols = pctx.AndroidStaticRule("gen_sorted_bss_symbols",
|
||||
blueprint.RuleParams{
|
||||
Command: "CROSS_COMPILE=$crossCompile $genSortedBssSymbolsPath ${in} ${out}",
|
||||
CommandDeps: []string{"$genSortedBssSymbolsPath", "${crossCompile}nm"},
|
||||
Command: "CLANG_BIN=${clangBin} $genSortedBssSymbolsPath ${in} ${out}",
|
||||
CommandDeps: []string{"$genSortedBssSymbolsPath", "${clangBin}/llvm-nm"},
|
||||
},
|
||||
"crossCompile")
|
||||
"clangBin")
|
||||
)
|
||||
|
||||
func (linker *baseLinker) sortBssSymbolsBySize(ctx ModuleContext, in android.Path, symbolOrderingFile android.ModuleOutPath, flags builderFlags) string {
|
||||
crossCompile := gccCmd(flags.toolchain, "")
|
||||
ctx.Build(pctx, android.BuildParams{
|
||||
Rule: genSortedBssSymbols,
|
||||
Description: "generate bss symbol order " + symbolOrderingFile.Base(),
|
||||
Output: symbolOrderingFile,
|
||||
Input: in,
|
||||
Args: map[string]string{
|
||||
"crossCompile": crossCompile,
|
||||
"clangBin": "${config.ClangBin}",
|
||||
},
|
||||
})
|
||||
return "-Wl,--symbol-ordering-file," + symbolOrderingFile.String()
|
||||
|
|
|
@ -18,11 +18,11 @@
|
|||
# their sizes.
|
||||
# Inputs:
|
||||
# Environment:
|
||||
# CROSS_COMPILE: prefix added to nm tools
|
||||
# CLANG_BIN: path to the clang bin directory
|
||||
# Arguments:
|
||||
# $1: Input ELF file
|
||||
# $2: Output symbol ordering file
|
||||
|
||||
set -o pipefail
|
||||
|
||||
${CROSS_COMPILE}nm --size-sort $1 | awk '{if ($2 == "b" || $2 == "B") print $3}' > $2
|
||||
${CLANG_BIN}/llvm-nm --size-sort $1 | awk '{if ($2 == "b" || $2 == "B") print $3}' > $2
|
||||
|
|
Loading…
Reference in New Issue