aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/compile
diff options
context:
space:
mode:
authorkorzhao <korzhao95@gmail.com>2021-08-12 23:39:29 +0800
committerJay Conrod <jayconrod@google.com>2021-08-24 15:55:38 +0000
commitd70c69d830f873473851e37b47ac4f35b5200273 (patch)
tree61732cd3093fc2f83a76ae3c9909ebb1e8d12b56 /src/cmd/compile
parentf98b6111eb8edda63a785db5678418b9eecbc5e9 (diff)
downloadgo-d70c69d830f873473851e37b47ac4f35b5200273.tar.gz
go-d70c69d830f873473851e37b47ac4f35b5200273.zip
embed: document the maximum file size supported
Fixes #47627 Change-Id: Ia1edfb6249863ab055fab68a35666bc2bdf21dcb Reviewed-on: https://go-review.googlesource.com/c/go/+/341689 Reviewed-by: Jay Conrod <jayconrod@google.com> Trust: Michael Matloob <matloob@golang.org>
Diffstat (limited to 'src/cmd/compile')
-rw-r--r--src/cmd/compile/internal/staticdata/data.go8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/cmd/compile/internal/staticdata/data.go b/src/cmd/compile/internal/staticdata/data.go
index abb0bba646..f25d8d8ec5 100644
--- a/src/cmd/compile/internal/staticdata/data.go
+++ b/src/cmd/compile/internal/staticdata/data.go
@@ -92,6 +92,10 @@ func StringSym(pos src.XPos, s string) (data *obj.LSym) {
return symdata
}
+// maxFileSize is the maximum file size permitted by the linker
+// (see issue #9862).
+const maxFileSize = int64(2e9)
+
// fileStringSym returns a symbol for the contents and the size of file.
// If readonly is true, the symbol shares storage with any literal string
// or other file with the same content and is placed in a read-only section.
@@ -133,12 +137,12 @@ func fileStringSym(pos src.XPos, file string, readonly bool, hash []byte) (*obj.
}
return sym, size, nil
}
- if size > 2e9 {
+ if size > maxFileSize {
// ggloblsym takes an int32,
// and probably the rest of the toolchain
// can't handle such big symbols either.
// See golang.org/issue/9862.
- return nil, 0, fmt.Errorf("file too large")
+ return nil, 0, fmt.Errorf("file too large (%d bytes > %d bytes)", size, maxFileSize)
}
// File is too big to read and keep in memory.