summaryrefslogtreecommitdiff
path: root/src/util/fipstools/delocate/delocate.go
diff options
context:
space:
mode:
Diffstat (limited to 'src/util/fipstools/delocate/delocate.go')
-rw-r--r--src/util/fipstools/delocate/delocate.go16
1 files changed, 15 insertions, 1 deletions
diff --git a/src/util/fipstools/delocate/delocate.go b/src/util/fipstools/delocate/delocate.go
index 593abec3..a43b4286 100644
--- a/src/util/fipstools/delocate/delocate.go
+++ b/src/util/fipstools/delocate/delocate.go
@@ -1269,6 +1269,10 @@ func transform(w stringWriter, inputs []inputFile) error {
// maxObservedFileNumber contains the largest seen file number in a
// .file directive. Zero is not a valid number.
maxObservedFileNumber := 0
+ // fileDirectivesContainMD5 is true if the compiler is outputting MD5
+ // checksums in .file directives. If it does so, then this script needs
+ // to match that behaviour otherwise warnings result.
+ fileDirectivesContainMD5 := false
// OPENSSL_ia32cap_get will be synthesized by this script.
symbols["OPENSSL_ia32cap_get"] = struct{}{}
@@ -1328,6 +1332,12 @@ func transform(w stringWriter, inputs []inputFile) error {
if fileNo > maxObservedFileNumber {
maxObservedFileNumber = fileNo
}
+
+ for _, token := range parts[2:] {
+ if token == "md5" {
+ fileDirectivesContainMD5 = true
+ }
+ }
}, ruleStatement, ruleLocationDirective)
}
@@ -1348,7 +1358,11 @@ func transform(w stringWriter, inputs []inputFile) error {
}
w.WriteString(".text\n")
- w.WriteString(fmt.Sprintf(".file %d \"inserted_by_delocate.c\"\n", maxObservedFileNumber+1))
+ var fileTrailing string
+ if fileDirectivesContainMD5 {
+ fileTrailing = " md5 0x00000000000000000000000000000000"
+ }
+ w.WriteString(fmt.Sprintf(".file %d \"inserted_by_delocate.c\"%s\n", maxObservedFileNumber+1, fileTrailing))
w.WriteString(fmt.Sprintf(".loc %d 1 0\n", maxObservedFileNumber+1))
w.WriteString("BORINGSSL_bcm_text_start:\n")