From mboxrd@z Thu Jan 1 00:00:00 1970 From: Wolfgang Denk Date: Sat, 03 Nov 2012 13:29:11 +0100 Subject: [U-Boot] [PATCH 01/10] arm: Compile cache_disable() with -O2 to avoid failure In-Reply-To: <1351813330-23741-1-git-send-email-sjg@chromium.org> References: <1351813330-23741-1-git-send-email-sjg@chromium.org> Message-ID: <20121103122911.4587A200255@gemini.denx.de> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de Dear Simon Glass, In message <1351813330-23741-1-git-send-email-sjg@chromium.org> you wrote: > It is good to have these functions written in C instead of assembler, > but with -O0 the cache_disable() function doesn't return. Rather than > revert to assembler, this fix just forces this to be built with -O2. NAK. This is vodoo programming to fix a problem which is obviously not correctly understood (and fixed), so the real cause remains unfixed. > +/* > + * Big hack warning! > + * > + * Devs like to compile with -O0 to get a nice debugging illusion. But this We don't use -O0 normally, and actually there are more places in the code that are likely to cause problems or to actually break when using -O0. > + * function does not survive that since -O0 causes the compiler to read the > + * PC back from the stack after the dcache flush. Might it be possible to fix > + * this by flushing the write buffer? > + */ "compiler to read the PC back from the stack after the dcache flush" - can you please explain what exactly this means, and which exact problem it causes? > +static void cache_disable(uint32_t cache_bit) __attribute__ ((optimize(2))); Sorry, I will not accept this. Best regards, Wolfgang Denk -- DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de backups: always in season, never out of style.