compiler: add aliases for many hashing packages
This commit adds support for the following packages: - crypto/md5 - crypto/sha1 - crypto/sha256 - crypto/sha512 They would normally need assembly implementations, but with these aliases they already work everywhere.
Этот коммит содержится в:
родитель
a3c4421f39
коммит
5e5ce98d42
3 изменённых файлов: 12 добавлений и 1 удалений
4
Makefile
4
Makefile
|
@ -190,6 +190,10 @@ TEST_PACKAGES = \
|
||||||
container/list \
|
container/list \
|
||||||
container/ring \
|
container/ring \
|
||||||
crypto/des \
|
crypto/des \
|
||||||
|
crypto/md5 \
|
||||||
|
crypto/sha1 \
|
||||||
|
crypto/sha256 \
|
||||||
|
crypto/sha512 \
|
||||||
encoding \
|
encoding \
|
||||||
encoding/ascii85 \
|
encoding/ascii85 \
|
||||||
encoding/base32 \
|
encoding/base32 \
|
||||||
|
|
|
@ -15,6 +15,13 @@ package compiler
|
||||||
import "tinygo.org/x/go-llvm"
|
import "tinygo.org/x/go-llvm"
|
||||||
|
|
||||||
var stdlibAliases = map[string]string{
|
var stdlibAliases = map[string]string{
|
||||||
|
// crypto packages
|
||||||
|
"crypto/md5.block": "crypto/md5.blockGeneric",
|
||||||
|
"crypto/sha1.block": "crypto/sha1.blockGeneric",
|
||||||
|
"crypto/sha1.blockAMD64": "crypto/sha1.blockGeneric",
|
||||||
|
"crypto/sha256.block": "crypto/sha256.blockGeneric",
|
||||||
|
"crypto/sha512.blockAMD64": "crypto/sha512.blockGeneric",
|
||||||
|
|
||||||
// math package
|
// math package
|
||||||
"math.Asin": "math.asin",
|
"math.Asin": "math.asin",
|
||||||
"math.Asinh": "math.asinh",
|
"math.Asinh": "math.asinh",
|
||||||
|
|
|
@ -23,7 +23,7 @@ import (
|
||||||
// Version of the compiler pacakge. Must be incremented each time the compiler
|
// Version of the compiler pacakge. Must be incremented each time the compiler
|
||||||
// package changes in a way that affects the generated LLVM module.
|
// package changes in a way that affects the generated LLVM module.
|
||||||
// This version is independent of the TinyGo version number.
|
// This version is independent of the TinyGo version number.
|
||||||
const Version = 14 // last change: add math assembly aliases
|
const Version = 15 // last change: add crypto assembly aliases
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
llvm.InitializeAllTargets()
|
llvm.InitializeAllTargets()
|
||||||
|
|
Загрузка…
Создание таблицы
Сослаться в новой задаче