Skip to content

supercop cannot be dynamically linked #20

Open
@tromer

Description

@tromer

We currently used (a subset of) supercop for the ADSNARK ppzksnark. It is fetched and compiled by prepare-depends.sh, resulting in ./depinst/lib/libsupercop.a. This is then make installed into $PREFIX/lib.

When trying to make libsnark a single libsnark.so including all dependencies, we noticed that supercop doesn't support that, because its internal qhasm routines haven't been adapted for position-independent code. We get errors like:

/usr/bin/ld: libsnark.a(sc25519_barrett.o): relocation R_X86_64_32S against crypto_sign_ed25519_amd64_51_30k_batch_MU3' can not be used when making a shared object; recompile with -fPIC
libsnark.a(sc25519_barrett.o): error adding symbols: Bad value

(See http://stackoverflow.com/a/9341970 for a discussion of such situations.)

Suggested actions:

  1. For now, Document that building a dynamic library requires either linking apps using -lsupercop or building libsnark using NO_SUPERCOP=1.
  2. In the planned makefile/CMake cleanup, have an explicit --enable-adsnark, off by default. Unless enabled, supercop is not even built.
  3. Eventually, change the supercop asm routines to be PIC-compatible (at what cost in performance?).

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions