Partial LTO (#1789)

* initial partial LTO example

* Add select private key related files to ignore LTO

* Apply to keystores
This commit is contained in:
Mamy Ratsimbazafy 2020-10-06 13:38:18 +02:00 committed by GitHub
parent c92d228ec8
commit 6bb6b66766
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 37 additions and 0 deletions

View File

@ -11,6 +11,7 @@ export
keystore
{.push raises: [Defect].}
{.localPassC: "-fno-lto".} # no LTO for crypto
const
keystoreFileName* = "keystore.json"

View File

@ -23,6 +23,7 @@ export
results, burnMem, writeValue, readValue
{.push raises: [Defect].}
{.localPassC: "-fno-lto".} # no LTO for crypto
type
ChecksumFunctionKind* = enum

35
nim.cfg Normal file
View File

@ -0,0 +1,35 @@
# ############################################################
#
# No LTO for crypto
#
# ############################################################
# This applies per-file compiler flags to C files
# which do not support {.localPassC: "-fno-lto".}
# Unfortunately this is filename based instead of path-based
# Assumes GCC
# BLST
server.always = "-fno-lto"
assembly.always = "-fno-lto"
# Secp256k1
secp256k1.always = "-fno-lto"
# BearSSL - only RNGs
aesctr_drbg.always = "-fno-lto"
hmac_drbg.always = "-fno-lto"
sysrng.always = "-fno-lto"
# Miracl - only ECP to derive public key from private key
ecp_BLS12381.always = "-fno-lto"
# ############################################################
#
# Spurious warnings
#
# ############################################################
# sqlite3.c: In function sqlite3SelectNew:
# vendor/nim-sqlite3-abi/sqlite3.c:124500: warning: function may return address of local variable [-Wreturn-local-addr]
sqlite3.always = "-fno-lto" # -Wno-return-local-addr