libgcrypt clang asm configure issue.

Jacob Bachmeyer jcb62281 at gmail.com
Mon Oct 31 03:56:15 CET 2022


Dmytro Kovalov via Gnupg-users wrote:
> Hello,
>
> I found a strange libgcrypt behavior on ARM with clang built.
>
> There is a big gap in performance of libgcrypt, built by clang, in 
> comparison with gcc on my ARM target machine.
> The simple profile test shows 100-500% advantage of gcc gcrypt.
> I found an awkward workaround to beat this issue, but need your help 
> to find the best way to fix it.
>
> The root cause is next:
> Due to clang strict assembler syntax rules the unified assembler ARM 
> check doesn't pass.
> Assembler check fails while ./configure for flags:
> HAVE_COMPATIBLE_GCC_ARM_PLATFORM_AS
> HAVE_GCC_INLINE_ASM_NEON
>
> As a workaround I remove '%' from registers names in
> configure.ac <http://configure.ac/>,
> arm mips lib *.S files,
> cipher/*arm.S,*armv7-neon.S files.
>
> Could you please help with a more correct - polite way to compile 
> libgcrypt with assembler code?

I would suggest using the GNU toolchain.  :-)

The problem is that the GNU assembler traditionally expects register 
names to be prefixed with %, using a syntax based on that of the old 
AT&T assembler and known (simply enough) as "AT&T syntax" while many 
vendor assemblers use a different syntax.  Note that the configure tests 
in question are for GCC-or-strictly-compatible.  If clang does not 
support the GNU assembler syntax, then it is not fully compatible with 
GCC, and libgcrypt is being compiled correctly.

Since LLVM claims compatibility with GCC, you should direct your 
complaints there:  CLang apparently claims compatibility with the GNU 
toolchain, but does not support GNU assembler syntax.


-- Jacob



More information about the Gnupg-users mailing list