[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <BLU436-SMTP410048B421910920AB4469B9750@phx.gbl>
Date: Wed, 5 Aug 2015 22:19:35 +0800
From: Chen Gang <xili_gchen_5257@...mail.com>
To: Hans-Peter Nilsson <hans-peter.nilsson@...s.com>
CC: starvik@...s.com, jespern@...s.com, linux-cris-kernel@...s.com,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH v2] cris: arch-v10: kgdb: Add volatile for static variable
is_dyn_brkp
On 8/4/15 23:01, Hans-Peter Nilsson wrote:
>> From: Chen Gang <xili_gchen_5257@...mail.com>
>> 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;
>
OK, thanks. I shall send patch v3 for it, next.
Thanks.
--
Chen Gang
Open, share, and attitude like air, water, and life which God blessed
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists