aboutsummaryrefslogtreecommitdiffhomepage
path: root/compiler/llvm.go
diff options
context:
space:
mode:
authorAyke van Laethem <[email protected]>2022-01-01 19:56:40 +0100
committerRon Evans <[email protected]>2022-01-03 21:22:49 +0100
commit21b89ef327b549dbe133424a571966b77e7ef5be (patch)
treee888e149ca1417cc72de6f379ad17d190ae7a515 /compiler/llvm.go
parent39c8711332bc7b7839f9d6af49eed08fb4e6468a (diff)
downloadtinygo-21b89ef327b549dbe133424a571966b77e7ef5be.tar.gz
tinygo-21b89ef327b549dbe133424a571966b77e7ef5be.zip
compiler: fix emission of large object layouts
Large object layouts don't fit in a pointer-sized integer and therefore need to be stored in a global instead. However, the way the data was stored in these globals was not correct for buffers that don't have pointers near the end. This commit fixes this issue by using math/big FillBytes() instead of Bytes(). This gets the unicode package to compile on AVR.
Diffstat (limited to 'compiler/llvm.go')
-rw-r--r--compiler/llvm.go2
1 files changed, 1 insertions, 1 deletions
diff --git a/compiler/llvm.go b/compiler/llvm.go
index 9b5d40fc2..81bd0b1f9 100644
--- a/compiler/llvm.go
+++ b/compiler/llvm.go
@@ -147,7 +147,7 @@ func (c *compilerContext) createObjectLayout(t llvm.Type, pos token.Pos) llvm.Va
// Create the global initializer.
bitmapBytes := make([]byte, int(objectSizeWords+7)/8)
- copy(bitmapBytes, bitmap.Bytes())
+ bitmap.FillBytes(bitmapBytes)
var bitmapByteValues []llvm.Value
for _, b := range bitmapBytes {
bitmapByteValues = append(bitmapByteValues, llvm.ConstInt(c.ctx.Int8Type(), uint64(b), false))