You copied the Doc URL to your clipboard.

__attribute__((weak)) variable attribute

The declaration of a weak variable is permitted, and acts in a similar way to __weak.

  • In GNU mode:

    extern int Variable_Attributes_weak_1 __attribute__((weak));
  • The equivalent in non-GNU mode is:

    __weak int Variable_Attributes_weak_compare;

The extern qualifier is required in GNU mode. In non-GNU mode the compiler assumes that if the variable is not extern then it is treated like any other non weak variable.


This variable attribute is a GNU compiler extension that the ARM compiler supports.