From mboxrd@z Thu Jan 1 00:00:00 1970 From: Albert ARIBAUD Date: Sat, 16 Feb 2013 19:20:00 +0100 Subject: [U-Boot] [PATCH v1] Refactor linker-generated arrays In-Reply-To: <510FAC65.7090301@gmail.com> References: <1359824574-32627-1-git-send-email-albert.u.boot@aribaud.net> <1359824574-32627-2-git-send-email-albert.u.boot@aribaud.net> <510FAC65.7090301@gmail.com> Message-ID: <20130216192000.7434cbdc@lilith> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de Hi Andreas, On Mon, 04 Feb 2013 13:41:09 +0100, "Andreas Bie?mann" wrote: > Hi Albert, > > On 02.02.2013 18:02, Albert ARIBAUD wrote: > > Refactor linker-generated array code so that symbols > > which were previously linker-generated are now compiler- > > generated. This causes relocation records of type > > R_ARM_ABS32 to become R_ARM_RELATIVE, which makes > > code which uses LGA able to run before relocation as > > well as after. > > > > Note: this affects more than ARM targets, as linker- > > lists span possibly all target architectures, notably > > PowerPC. > > > > Signed-off-by: Albert ARIBAUD > > Tested on avr32. The patch seems to work (basic shell testing), however > it generates an aliasing warning: > > ---8<--- > abiessmann at azuregos % PATH=$AVR32_PATH:$PATH BUILD_DIR=/tmp/build_avr32 > MAKEALL_LOGDIR=/tmp/LOG BUILD_NCPUS=4 BUILD_NBUILDS=4 ./MAKEALL atstk1002 > Configuring for atstk1002 board... > text data bss dec hex filename > 116315 8972 211900 337187 52523 /tmp/build_avr32/atstk1002/u-boot > env_callback.c: In function 'find_env_callback': > env_callback.c:47: warning: dereferencing pointer 'clbkp' does break > strict-aliasing rules > env_callback.c:44: note: initialized from here > env_callback.c:46: note: initialized from here > --->8--- > > I think it has something to do with tha fact that you re-cast the > anonymous struct 'start' here: > > ---8<--- > #define ll_entry_start(_type, _list) > ({ > static struct {} start __aligned(4) __attribute__((unused, > section(".u_boot_list_2_"#_list"_1"))); > (_type *)&start; > }) > --->8--- > > I think other gcc-4.4 users will see the same error. Currently I have no > time to dive into this. I have dug into it and found a way to avoid GCC 4.4 or below to warn about aliasing, by replacing 'struct {}' with 'char[0]' as the 0-byte-size type. I still have some warnings through, regarding some regions not being declared: avr32-ld:built in linker script:15: warning: memory region `FLASH' not declared avr32-ld:built in linker script:69: warning: memory region `CPUSRAM' not declared It appears 'normal' in that without my patch, the same error occurs; but I'd prefer that you confirm whether you have the same warnings on your side. > Best regards > > Andreas Bie?mann Amicalement, -- Albert.