Save time delocating when not using archive inputs.

If all the inputs are given as assembly files then we can skip rewriting
symbols for the first file. If this file is bcm.s (i.e. the large
compiler output), this can save a few seconds of build time.

Change-Id: I4e4ea114acb86cd93e831b23b58f8c3401bc711c
Reviewed-on: https://boringssl-review.googlesource.com/15149
Reviewed-by: Adam Langley <agl@google.com>
This commit is contained in:
Adam Langley 2017-04-17 13:08:03 -07:00
parent 1bd689d1fc
commit 30bcb3bd28

View File

@ -413,13 +413,28 @@ func asLines(lines []string, path string, uniqueId int) ([]string, error) {
}
defer asFile.Close()
var contents []string
// localSymbols maps from the symbol name used in the input, to a
// unique symbol name.
localSymbols := make(map[string]string)
scanner := bufio.NewScanner(asFile)
var contents []string
if len(lines) == 0 {
// If this is the first assembly file, don't rewrite symbols.
// Only all-but-one file needs to be rewritten and so time can
// be saved by putting the (large) bcm.s first.
for scanner.Scan() {
lines = append(lines, scanner.Text())
}
if err := scanner.Err(); err != nil {
return nil, err
}
return lines, nil
}
for scanner.Scan() {
line := scanner.Text()
trimmed := strings.TrimSpace(line)
@ -431,7 +446,7 @@ func asLines(lines []string, path string, uniqueId int) ([]string, error) {
continue
}
contents = append(contents, scanner.Text())
contents = append(contents, line)
}
if err := scanner.Err(); err != nil {
return nil, err