Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tinygo:ld.lld: error: undefined symbol: crypto/aes.encryptBlockAsm #2779

Closed
d33tah opened this issue Apr 15, 2022 · 8 comments
Closed

tinygo:ld.lld: error: undefined symbol: crypto/aes.encryptBlockAsm #2779

d33tah opened this issue Apr 15, 2022 · 8 comments
Labels
enhancement New feature or request

Comments

@d33tah
Copy link

d33tah commented Apr 15, 2022

I tried to give tinygo a try by building a simple "hello world" web service. Instead, I found that crypto/aes doesn't compile:

> sudo docker run --rm tinygo/tinygo:0.22.0 tinygo test crypto/aes 
tinygo:ld.lld: error: undefined symbol: crypto/aes.encryptBlockAsm
>>> referenced by cipher_asm.go:69 (/usr/local/go/src/crypto/aes/cipher_asm.go:69)
>>>               /tmp/tinygo3958504993/main.o:((*crypto/aes.aesCipherAsm).Encrypt)

tinygo:ld.lld: error: undefined symbol: crypto/aes.decryptBlockAsm
>>> referenced by cipher_asm.go:82 (/usr/local/go/src/crypto/aes/cipher_asm.go:82)
>>>               /tmp/tinygo3958504993/main.o:((*crypto/aes.aesCipherAsm).Decrypt)
failed to run tool: ld.lld
FAIL
error: failed to link /tmp/tinygo3958504993/main: exit status 1

It looks like those packages are on the list of the ones supported by TinyGo, so what's the problem?

@dkegel-fastly
Copy link
Contributor

dkegel-fastly commented Apr 15, 2022

You need to read the large type at the top of that page :-)

A PR is pending to update that page to show which packages actually pass tests, which ought to help clear up the confusion.

The tests that pass in the dev branch (which will soon become the next version, 0.23) on darwin, linux, wasi, and windows can be found by checking out that branch and typing "make report-stdlib-tests-pass". Here's what it currently says:

report.txt

Note that net/http is not in the list whose tests pass. So, you can import it, but you can't use all the functions in it yet.

fmt is also not in the list, probably because %v doesn't pass tests (because reflection is not fully supported), but it's useful otherwise.

@d33tah
Copy link
Author

d33tah commented Apr 15, 2022

Got it. Thanks for pointing that out! I guess that the issue can be closed then.

@dkegel-fastly
Copy link
Contributor

It's a real enough bug. Easier way to demonstrate it is:

C02DG0QJMD6R:tinygo dkegel$ build/tinygo test crypto/aes
tinygo:ld.lld: error: undefined symbol: _crypto/aes.encryptBlockAsm
>>> referenced by /var/folders/v0/0k9hwftd29b18z9z7s2g2sfc0000gn/T/tinygo2654768174/main.o

tinygo:ld.lld: error: undefined symbol: _crypto/aes.decryptBlockAsm
>>> referenced by /var/folders/v0/0k9hwftd29b18z9z7s2g2sfc0000gn/T/tinygo2654768174/main.o
failed to run tool: ld.lld
error: failed to link /var/folders/v0/0k9hwftd29b18z9z7s2g2sfc0000gn/T/tinygo2654768174/main: exit status 1
FAIL

You might tidy up this bug report by editing down the long log in your initial comment, though.

@dkegel-fastly
Copy link
Contributor

btw, the missing symbol comes from regular go, and isn't picked up because it is in assembly and we don't quite support that yet; #2688 may eventually fix that.

@d33tah
Copy link
Author

d33tah commented Apr 15, 2022

You might tidy up this bug report by editing down the long log in your initial comment, though.

@dkegel-fastly done. does it look OK now?

@deadprogram deadprogram added the enhancement New feature or request label Apr 16, 2022
@aykevl
Copy link
Member

aykevl commented Aug 28, 2022

This issue would be fixed with #3103.

@dkegel-fastly
Copy link
Contributor

dkegel-fastly commented Sep 20, 2022

Also affects go-jose and golang-jwt, unsurprisingly.

@dgryski
Copy link
Member

dgryski commented Oct 21, 2024

Upstream Go now has purego tags for AES (and other crypto packages) which we are able to take advantage of

~/go/src/github.com/tinygo-org/tinygo $ tinygo test crypto/aes
ok  	crypto/aes	0.533s

@dgryski dgryski closed this as completed Oct 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

5 participants