10.71 __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.

Related reference
10.20 __weak
Non-Confidential PDF file icon PDF version ARM DUI0472J
Copyright © 2010-2013 ARM. All rights reserved.