floodyberry / blake2b-opt

Optimized, portable implementations of BLAKE2b
24 stars 6 forks source link

cannot build shared object without `--disable-as` #4

Open WildCryptoFox opened 7 years ago

WildCryptoFox commented 7 years ago

On an Exherbo install with an i5 M-series CPU, I cannot get ./configure --pic && make shared to successfully build. I do not currently have another environment to test this on.

gcc -o bin/libblake2b.so.1 build/framework/driver/cpucycles.o build/framework/driver/cpuid.o build/app/extensions/blake2b/impl.o build/app/extensions/blake2/blake2b.o build/framework/driver/x86/driver.o build/framework/main_shared.o -shared -Wl,-soname,libblake2b.so.1 -m64

...-ld: build/app/extensions/blake2b/blake2b.o: relocation R_X86_64_32 against '.text' can not be used when making a shared object; recompile with -fPIC

Adding -fPIC did not change the error. I can however successfully build the shared library when using --disable-as; obviously not desired.

Thanks for the great optimized implementations!

(Sidenote: chacha and poly1305 implementations work without any issues; I am yet to test more)

WildCryptoFox commented 7 years ago

@cmr suggested to try --yasm, which builds successfully.

oconnor663 commented 6 years ago

I find that --yasm only helps if I don't actually have Yasm installed, because it becomes equivalent to --disable-as. If I do have Yasm installed, I get the following errors from ./configure --yasm && make:

gcc -m64 -fvisibility=hidden -DLIB_PUBLIC="__attribute__ ((visibility (\"default\")))" -O2 -DBUILDING_ASMOPT_BLAKE2B -I./app/extensions -I./app/include -I./framework/include -I./framework/driver -I./framework/driver/x86 -MMD -MF build/framework/driver/cpucycles.temp -c -o build/framework/driver/cpucycles.o framework/driver/cpucycles.c
gcc -m64 -fvisibility=hidden -DLIB_PUBLIC="__attribute__ ((visibility (\"default\")))" -O2 -DBUILDING_ASMOPT_BLAKE2B -I./app/extensions -I./app/include -I./framework/include -I./framework/driver -I./framework/driver/x86 -MMD -MF build/framework/driver/cpuid.temp -c -o build/framework/driver/cpuid.o framework/driver/cpuid.c
gcc -m64 -fvisibility=hidden -DLIB_PUBLIC="__attribute__ ((visibility (\"default\")))" -O2 -DBUILDING_ASMOPT_BLAKE2B -I./app/extensions -I./app/include -I./framework/include -I./framework/driver -I./framework/driver/x86 -MMD -MF build/app/extensions/blake2b/impl.temp -c -o build/app/extensions/blake2b/impl.o app/extensions/blake2b/impl.c
yasm -r nasm -p gas -f elf64 -I./app/extensions -I./app/include -I./framework/include -I./framework/driver -I./framework/driver/x86 -o build/app/extensions/blake2b/blake2b.o app/extensions/blake2b/blake2b.S
alignto31mod64:46: error: invalid combination of opcode and operands
alignto31mod64:53: error: invalid combination of opcode and operands
alignto31mod64:332: error: invalid combination of opcode and operands
alignto31mod64:334: error: invalid combination of opcode and operands
alignto31mod64:360: error: invalid combination of opcode and operands
alignto31mod64:381: error: invalid combination of opcode and operands
alignto31mod64:411: error: invalid combination of opcode and operands
alignto31mod64:434: error: invalid combination of opcode and operands
alignto31mod64:436: error: invalid combination of opcode and operands
alignto31mod64:444: error: invalid combination of opcode and operands
alignto31mod64:476: error: invalid combination of opcode and operands
alignto31mod64:481: error: invalid combination of opcode and operands
make: *** [Makefile:156: build/app/extensions/blake2b/blake2b.o] Error 1