Skip to content

Cannot compile/assemble some assembly modules as PIC #25

@wernerd

Description

@wernerd

In my fork of SIDH to add Cmake, C++ wrapper, Android, Java support I build a shared library which includes the SIDH modules. To support Android applications a shared library is a pre-requisite.

When compiling/assemble fp_x64_asm.S clang reports a problem that it cannot generate position independent code (-fpic).

The offending lines in file fp_x64_asm.S look like this

    MUL128x256_SCHOOL [reg_p1], [rip+p434p1+24], r8, r9, r10, r11, r12, r13, rcx     

The culprit here is the reference to p434p1 which is a global variable in the C-sources. The same holds for p503p1, p610p1, and p751p1 variables in their respective assembler files. Tested using clang V9.0.1.

Because I'm not familiar with x86 assembler ;-) I could not fix this and thus reverted to the generic modules to build the shared library. These are definitely slower than the optimized assembler code.

I found some other smaller issues when building the shared library, however these could be easily solved - I show them in another issue.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions