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

Undefined reference to chunkmix with gcc LTO #16

Open
hmage opened this issue Apr 25, 2016 · 0 comments
Open

Undefined reference to chunkmix with gcc LTO #16

hmage opened this issue Apr 25, 2016 · 0 comments

Comments

@hmage
Copy link

hmage commented Apr 25, 2016

When I try to compile with LTO enabled, the linker suddenly suddenly can't see the assembler function bodies (LTO pass probably removes them too early).

I tried to set __attribute__((used)) on them but I failed, maybe you will find a faster way to do it.

Without LTO it compiles fine:

bujak_e@wraith:~/temp/scrypt-jane$ gcc scrypt-jane-speed.c -O3 -DSCRYPT_SHA256 -DSCRYPT_SALSA $3 -o scrypt_speed

With LTO it gives out link errors:

bujak_e@wraith:~/temp/scrypt-jane$ gcc scrypt-jane-speed.c -O3 -flto -DSCRYPT_SHA256 -DSCRYPT_SALSA $3 -o scrypt_speed
/tmp/ccK78ets.ltrans2.ltrans.o: In function `scrypt_ROMix_sse2.lto_priv.12':
ccK78ets.ltrans2.o:(.text+0x117): undefined reference to `scrypt_ChunkMix_sse2'
ccK78ets.ltrans2.o:(.text+0x149): undefined reference to `scrypt_ChunkMix_sse2'
ccK78ets.ltrans2.o:(.text+0x1b1): undefined reference to `scrypt_ChunkMix_sse2'
ccK78ets.ltrans2.o:(.text+0x1d3): undefined reference to `scrypt_ChunkMix_sse2'
/tmp/ccK78ets.ltrans2.ltrans.o: In function `scrypt_ROMix_avx.lto_priv.11':
ccK78ets.ltrans2.o:(.text+0x367): undefined reference to `scrypt_ChunkMix_avx'
ccK78ets.ltrans2.o:(.text+0x399): undefined reference to `scrypt_ChunkMix_avx'
ccK78ets.ltrans2.o:(.text+0x401): undefined reference to `scrypt_ChunkMix_avx'
ccK78ets.ltrans2.o:(.text+0x423): undefined reference to `scrypt_ChunkMix_avx'
/tmp/ccK78ets.ltrans2.ltrans.o: In function `scrypt_ROMix_xop.lto_priv.10':
ccK78ets.ltrans2.o:(.text+0x5b7): undefined reference to `scrypt_ChunkMix_xop'
ccK78ets.ltrans2.o:(.text+0x5e9): undefined reference to `scrypt_ChunkMix_xop'
ccK78ets.ltrans2.o:(.text+0x651): undefined reference to `scrypt_ChunkMix_xop'
ccK78ets.ltrans2.o:(.text+0x673): undefined reference to `scrypt_ChunkMix_xop'
collect2: error: ld returned 1 exit status

GCC version:

bujak_e@wraith:~/temp/scrypt-jane$ gcc --version
gcc (Debian 4.9.2-10) 4.9.2
Copyright (C) 2014 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant