From mboxrd@z Thu Jan 1 00:00:00 1970 From: Alexander Holler Date: Tue, 21 Dec 2010 13:35:18 +0100 Subject: [U-Boot] [RFC PATCH v2] ARM: Avoid compiler optimization for usages of readb, writeb and friends. In-Reply-To: <20101221105303.4E3EDB715C@gemini.denx.de> References: <1292711230-3234-1-git-send-email-holler@ahsoftware.de> <4D0DB994.1020703@googlemail.com> <4D0DDCEF.2040806@ahsoftware.de> <4D0E643A.9040001@ahsoftware.de> <4D0EA9BB.4050002@ahsoftware.de> <4D0F8E75.2010107@ahsoftware.de> <4D105324.2080201@googlemail.com> <4D105583.8070703@free.fr> <4D1066CD.2040409@googlemail.com> <4D1083B4.2060704@free.fr> <20101221105303.4E3EDB715C@gemini.denx.de> Message-ID: <4D109F06.1040109@ahsoftware.de> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de Am 21.12.2010 11:53, schrieb Wolfgang Denk: > Dear Albert ARIBAUD, > > In message<4D1083B4.2060704@free.fr> you wrote: >> >>> And I at your suggestion tried modifying the binary changing the extra >>> ldrb to a nop and it works. >> >> Seems like a compiler issue to me, as the preprocessed C source is the >> same for the register access and does not call for a re-read (that is >> what I wanted to see in the preprocessed version), yet the ASM sequence >> does the re-read. > > I also tend to think this is a compiler problem. Searching the gcc > bugzilla entries for "ldrb" turns up quite a number of hits. I'm not > sure which of these we are running into here, but there are enough of > them so you can chose freely :-( Hmm, is there actual somethinbg which should forbid the compiler to generate such code which rereads something? It might not be nice, but I don't think that it is forbidden for a compiler to do so. So the proper way to handle such, might be to use asm to avoid that the compiler touches that register. Regards, Alexander