> From: Chen Gang <[email protected]> > Date: Fri, 10 Jul 2015 23:50:07 +0200
> Within one C file, current gcc can optimize the global static variables > according to the C code, but it will skip assembly code -- it will pass > them to gas directly. > > if the static variable is used between C code and assembly code in one C > file (e.g. is_dyn_brkp in kgdb.c), it needs volatile to let gcc know it > should not be optimized, or it may cause issue. In this case it's *mostly* a matter of taste but please avoid using volatile as a hammer when there are other tools available. > -static unsigned char is_dyn_brkp = 0; > +static volatile unsigned char is_dyn_brkp; Please instead use "__used", i.e. +static unsigned char __used is_dyn_brkp = 0; brgds, H-P -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/

