Topic: ARMCC byte alignment cannot be greater than 8 bytes warning

1. wolfSSL source code

  /* Only use alignment in wolfSSL/wolfCrypt if WOLFSSL_USE_ALIGN is set */
    #ifdef WOLFSSL_USE_ALIGN
        /* For IAR ARM the maximum variable alignment on stack is 8-bytes.
         * Variables declared outside stack (like static globals) can have
         * higher alignment. */
        #if defined(__ICCARM__)
            #define WOLFSSL_ALIGN(x) XALIGNED(8)
        #else
            #define WOLFSSL_ALIGN(x) XALIGNED(x)
        #endif
    #else
        #define WOLFSSL_ALIGN(x) /* null expansion */
    #endif

    #ifndef ALIGN8
        #define ALIGN8   WOLFSSL_ALIGN(8)
    #endif
    #ifndef ALIGN16
        #define ALIGN16  WOLFSSL_ALIGN(16)
    #endif
    #ifndef ALIGN32
        #define ALIGN32  WOLFSSL_ALIGN(32)
    #endif
    #ifndef ALIGN64
        #define ALIGN64  WOLFSSL_ALIGN(64)
    #endif
    #ifndef ALIGN128
        #define ALIGN128 WOLFSSL_ALIGN(128)
    #endif
    #ifndef ALIGN256
        #define ALIGN256 WOLFSSL_ALIGN(256)
    #endif

    #if !defined(PEDANTIC_EXTENSION)
        #if defined(__GNUC__)
            #define PEDANTIC_EXTENSION __extension__
        #else
            #define PEDANTIC_EXTENSION
        #endif
    #endif /* !PEDANTIC_EXTENSION */

2. ARMCC warning info

wolfcrypt\src\kdf.c(87): warning:  #1041-D: alignment for an auto object may not be larger than 8

3. How should I solve this warning? I can think of two ways:

a. Add recognition of ARMCC macro definition, and when it is recognized as an ARMCC compiler, perform the same behavior as the IAR ARM compiler, that is, 8-byte alignment.
b. Write a custom #define ALIGN8 macro for each byte alignment function
What should I do to deal with it reasonably and without any problems?

Share

2 (edited by douzzer 2024-06-17 21:26:22)

Re: ARMCC byte alignment cannot be greater than 8 bytes warning

We've put up a candidate fix for the problem you reported.  See https://github.com/wolfSSL/wolfssl/pull/7652

The fix is quite simple, and doesn't require anything specific to ARMCC.

Edit: this fix is now merged, so you can just clone/pull master to get it.

Share

Re: ARMCC byte alignment cannot be greater than 8 bytes warning

Has this problem been properly fixed?
planet clicker

Share