[David Michael] [PATCH libgcypt 2/2] cipher/poly1305: Fix 32-bit x86 compilation
Jussi Kivilinna
jussi.kivilinna at iki.fi
Fri Jan 22 18:18:48 CET 2021
On 22.1.2021 18.28, David Michael wrote:
> On Fri, Jan 22, 2021 at 10:32 AM Jussi Kivilinna <jussi.kivilinna at iki.fi> wrote:
>> Hello,
>>
>> On 22.1.2021 13.21, Werner Koch via Gcrypt-devel wrote:
>>> ForwardedMessage.eml / David Michael <fedora.dm0 at gmail.com>:
>>>
>>> * cipher/poly1305.c [HAVE_COMPATIBLE_GCC_ARM_PLATFORM_AS]: Also
>>> conditionalize on whether __arm__ is defined.
>>>
>>> --
>>>
>>> When building for i686, configure detects that the assembler can
>>> use the different architectures, so it defined everything under the
>>> HAVE_COMPATIBLE_GCC_ARM_PLATFORM_AS conditional block. Since that
>>> block is first and the following x86 block only defines UMUL_ADD_32
>>> if it's not already defined, the lto-wrapper failed during linking
>>> with a pile of "no such instruction: umlal ..." errors. Gating on
>>> __arm__ prevents that initial defintion and fixes the errors.
>>>
>>
>> HAVE_COMPATIBLE_GCC_ARM_PLATFORM_AS should not be defined on x86/i686
>> in first place.
>
> Using i686 GCC has these in config.log:
>
> #define HAVE_COMPATIBLE_GCC_ARM_PLATFORM_AS 1
> #define HAVE_COMPATIBLE_GCC_AARCH64_PLATFORM_AS 1
> #define HAVE_COMPATIBLE_GCC_AMD64_PLATFORM_AS 1
>
>> Problem must be in 'configure.ac' in the HAVE_COMPATIBLE_GCC_ARM_PLATFORM_AS
>> check. Does this issue happen with "clang -flto"?
>
Hm, ok. Maybe the LTO/configure.ac problem manifests itself also with GCC
in some system configurations. Does attached patch help?
-Jussi
> If I set CC to i686 clang, it first fails because it doesn't undestand
> this line in jitterentropy-base.c
>
> #pragma GCC optimize ("O0")
>
> If I use -O0 in CFLAGS, then it fails due to the ARM instructions
> while linking libgcrypt.so again. It has the same HAVE_COMPATIBLE_GCC
> definitions in config.log as with GCC.
>
> <inline asm>:1:2: error: invalid instruction mnemonic 'umlal'
> umlal %ecx, %eax, %edx, %esi
> ^~~~~
> LLVM ERROR: Error parsing inline asm
>
> Thanks.
>
> David
>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-configure.ac-run-assembler-checks-through-linker-for.patch
Type: text/x-patch
Size: 19162 bytes
Desc: not available
URL: <https://lists.gnupg.org/pipermail/gcrypt-devel/attachments/20210122/89d4083a/attachment-0001.bin>
More information about the Gcrypt-devel
mailing list