9.69 __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
9.51 __attribute__((weak)) function attribute
9.20 __weak
Non-ConfidentialPDF file icon PDF versionARM DUI0375F
Copyright © 2007, 2008, 2011, 2012, 2014 ARM. All rights reserved.