From mboxrd@z Thu Jan 1 00:00:00 1970 From: Minkyu Kang Date: Mon, 10 Jan 2011 23:04:56 +0900 Subject: [U-Boot] [PATCH RFC] armv7: fixloop: don't fixup if location is NULL In-Reply-To: <20110110121453.67D51150A44@gemini.denx.de> References: <4D186A13.4080004@samsung.com> <24AA7201-FEC9-4485-837F-52CF0CBD06C4@googlemail.com> <4D284156.90305@free.fr> <20110110102052.7E30D150A44@gemini.denx.de> <20110110121453.67D51150A44@gemini.denx.de> Message-ID: List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de Dear Wolfgang Denk, On 10 January 2011 21:14, Wolfgang Denk wrote: > Dear Minkyu Kang, > > In message you wrote: >> >> >> int (*test_func)(void); >> > >> > This results in a symbol in bss segment, right? >> > >> >> And then, set to NULL at arch_cpu_init() >> > >> > Such an assignment is illegal then. Bss has not been initalized before >> > relocation, and must not be accessed (neither read nor write). >> >> Illegal? as a result, yes. > > No, illegal as an action. ?You MUST NOT access any symbols in BSS > before relocation (more precisely, before bss has been initialized). > > And you MUST NOT write any symbols in data segment before relocation, > either. > > In both cases, the result of such actions is undefined behaviour. > >> But we do many things before the reloaction as arch init, board init and so on. > > Of course, but as mentioned we must not read or write to symbols in > bss, and we must not write to symbols in data segment. > >> How about lcd_setmem function? >> panel_info is located at bss area, but lcd_setmem access this structure. >> Is it illegal? > > This must not be done before relocation. > No, please see 360 line of arch/arm/lib/board.c This function is called before relocation. And how about init_func_i2c()? This function is called twice, before the relocation and after relocation. When we use board_i2c_init function then, there is possibility that use symbols in bss because of this function is called after relocation. If we ignore this exception, it will be a big constraint. btw, there are any side effects on my patch? I think.. It is just a little safety feature. Thanks Minkyu Kang -- from. prom. www.promsoft.net