From: Aneesh V <aneesh@ti.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 2/4] arm: add %function attribute to assembly functions
Date: Thu, 23 Feb 2012 16:36:04 +0530 [thread overview]
Message-ID: <4F461D9C.7050803@ti.com> (raw)
In-Reply-To: <4F426FF8.3050307@ti.com>
On Monday 20 February 2012 09:38 PM, Aneesh V wrote:
> On Saturday 18 February 2012 10:18 PM, Albert ARIBAUD wrote:
>> Hi Aneesh,
>>
>
> [...]
>
>>>> I will get back with more details on the Linaro GCC 2012.01 later.
>>>
>>> I meant "the Linaro GCC 2012.01 tool-chain problem"
>>>
>>> This is a different problem. Some of the .rodata symbols are given an
>>> odd address although they should be aligned to at least 2-byte boundary
>>> ). In fact the data is actually put at the even address but the symbol's
>>> value is +1 of the actual address. This is the ARM convention for Thumb
>>> functions, but they have applied it here for data too. That's the
>>> problem. I see that this doesn't happen to all the .rodata in SPL.
>>> Neither could I reproduce it with a small program. But the workaround
>>> for this problem is to avoid -fdata-sections. The following patch works
>>> around it.
>>>
>>> diff --git a/config.mk b/config.mk
>>> index ddaa477..723286a 100644
>>> --- a/config.mk
>>> +++ b/config.mk
>>> @@ -190,7 +190,7 @@ CPPFLAGS := $(DBGFLAGS) $(OPTFLAGS) $(RELFLAGS) \
>>>
>>> # Enable garbage collection of un-used sections for SPL
>>> ifeq ($(CONFIG_SPL_BUILD),y)
>>> -CPPFLAGS += -ffunction-sections -fdata-sections
>>> +CPPFLAGS += -ffunction-sections
>>> LDFLAGS_FINAL += --gc-sections
>>> endif
>>>
>>> Will you take a patch to make -fdata-sections optional, that is, having
>>> it under something like CONFIG_SYS_SPL_NO_FDATA_SECTIONS?
>>
>> Hmm... considering you're seeing the issue in a fairly new toolchain
>> release, I prefer notifying the toolchain makers, rather than removing
>> the -fdata-sections from SPL even for specific boards. Can you go and
>> see why the Linaro toolchain generated odd "thumb data" at all and get
>> this fixed?
>
> I tried investigating a bit. As I mentioned earlier it doesn't happen
> with some other files that use the same compiler and linker commands.
> So, I don't know what's going on. Also, I couldn't reproduce it with a
> simple program unlike in the other cases. Anyway, I have notified
> tool-chain folks at Linaro:
>
> http://article.gmane.org/gmane.linux.linaro.toolchain/2096
Ulrich Weigand has identified the root-cause [1]. The problem was due
to __attribute__ ((packed)) used in a structure. Let me quote him:
**********************************************************************
"I can reproduce the odd addresses of .rodata symbols. However, this
occurs simply because the linker put *no* alignment requirement whatsoever
on those sections:
Section Headers:
[Nr] Name Type Addr Off Size ES Flg Lk
Inf Al
[snip]
[11] .rodata.wkup_padc PROGBITS 00000000 000100 000004 00 A 0
0 1
[12] .rodata.wkup_padc PROGBITS 00000000 000104 000048 00 A 0
0 1
[13] .rodata.wkup_padc PROGBITS 00000000 00014c 00000c 00 A 0
0 1
[14] .rodata.wkup_padc PROGBITS 00000000 000158 000004 00 A 0
0 1
Note the "Al" column values of 1. In the final executable, those sections
happen to end up immediately following a .rodata.str string section with
odd
lenght, and since they don't have any alignment requirement, they start out
at an odd address.
The reason for the lack of alignment requirement is actually in the source:
const struct pad_conf_entry core_padconf_array_essential[] = {
where
struct pad_conf_entry {
u16 offset;
u16 val;
} __attribute__ ((packed));
The "packed" attribute specifies that all struct elements ought to be
considered to have alignment requirement 1 instead of their default
alignment. Thus the whole struct ends up having alignment requirement 1;
and since the section contains only a single variable of such struct
type, this is then also the alignment requirement of the section."
**********************************************************************
I tried removing "packed" and it works. I will send an updated series
with this fix.
br,
Aneesh
[1] http://article.gmane.org/gmane.linux.linaro.toolchain/2099
next prev parent reply other threads:[~2012-02-23 11:06 UTC|newest]
Thread overview: 83+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-02-06 11:37 [U-Boot] [RFC PATCH 0/4] Enable Thumb build for ARM platforms Aneesh V
2012-02-06 11:37 ` [U-Boot] [RFC PATCH 1/4] ARM: enable Thumb build Aneesh V
2012-02-06 18:45 ` Tom Rini
2012-02-07 7:43 ` Aneesh V
2012-02-06 11:37 ` [U-Boot] [RFC PATCH 2/4] OMAP3+: fix issues with " Aneesh V
2012-02-06 21:06 ` Albert ARIBAUD
2012-02-07 7:49 ` Aneesh V
2012-02-09 8:58 ` Aneesh V
2012-02-06 11:37 ` [U-Boot] [RFC PATCH 3/4] OMAP3+: Use -march=armv7-a and thereby enable Thumb-2 Aneesh V
2012-02-06 11:37 ` [U-Boot] [RFC PATCH 4/4] OMAP4: enable Thumb build Aneesh V
2012-02-06 12:26 ` [U-Boot] [RFC PATCH 0/4] Enable Thumb build for ARM platforms Aneesh V
2012-02-06 13:22 ` Aneesh V
2012-02-15 13:57 ` [U-Boot] [PATCH " Aneesh V
2012-02-15 13:57 ` [U-Boot] [PATCH 1/4] ARM: enable Thumb build Aneesh V
2012-02-15 13:57 ` [U-Boot] [PATCH 2/4] arm: add %function attribute to assembly functions Aneesh V
2012-02-17 11:09 ` Aneesh V
2012-02-18 10:13 ` Albert ARIBAUD
2012-02-18 13:24 ` Aneesh V
2012-02-18 15:04 ` Albert ARIBAUD
2012-02-18 16:34 ` Aneesh V
2012-02-18 16:48 ` Albert ARIBAUD
2012-02-20 16:08 ` Aneesh V
2012-02-23 11:06 ` Aneesh V [this message]
2012-02-17 17:13 ` Mike Frysinger
2012-02-18 11:12 ` Aneesh V
2012-02-18 11:34 ` Albert ARIBAUD
2012-02-18 22:03 ` Simon Glass
2012-02-19 7:15 ` Mike Frysinger
2012-02-20 20:07 ` Tom Rini
2012-02-20 21:53 ` Simon Glass
2012-02-21 4:19 ` Mike Frysinger
2012-02-21 4:44 ` Simon Glass
2012-02-21 14:33 ` Tom Rini
2012-02-21 15:42 ` Mike Frysinger
2012-02-21 18:03 ` Aneesh V
2012-02-21 19:28 ` Mike Frysinger
2012-02-21 20:01 ` Aneesh V
2012-02-21 4:18 ` Mike Frysinger
2012-02-15 13:57 ` [U-Boot] [PATCH 3/4] armv7: Use -march=armv7-a and thereby enable Thumb-2 Aneesh V
2012-02-15 13:57 ` [U-Boot] [PATCH 4/4] OMAP4: enable Thumb build Aneesh V
2012-02-23 13:39 ` [U-Boot] [PATCH v2 1/5] arm: adapt asm/linkage.h from Linux Aneesh V
2012-02-23 14:01 ` Aneesh V
2012-02-23 13:39 ` [U-Boot] [PATCH v2 2/5] armv7: add appropriate headers for assembly functions Aneesh V
2012-02-23 13:39 ` [U-Boot] [PATCH v2 3/5] ARM: enable Thumb build Aneesh V
2012-02-23 14:57 ` Mike Frysinger
2012-02-23 17:28 ` Aneesh V
2012-02-23 17:34 ` Tom Rini
2012-02-23 17:49 ` Aneesh V
2012-02-23 17:51 ` Tom Rini
2012-02-23 18:09 ` Aneesh V
2012-02-23 18:13 ` Aneesh V
2012-02-23 18:05 ` Mike Frysinger
2012-02-23 18:04 ` Mike Frysinger
2012-02-23 18:12 ` Aneesh V
2012-02-23 13:39 ` [U-Boot] [PATCH v2 4/5] armv7: Use -march=armv7-a and thereby enable Thumb-2 Aneesh V
2012-02-23 13:39 ` [U-Boot] [PATCH v2 5/5] OMAP4: enable Thumb build Aneesh V
2012-02-23 14:06 ` [U-Boot] [PATCH v3 1/6] arm: adapt asm/linkage.h from Linux Aneesh V
2012-02-23 14:59 ` Mike Frysinger
2012-02-23 15:24 ` Tom Rini
2012-02-23 16:57 ` Mike Frysinger
2012-02-23 17:40 ` Aneesh V
2012-02-23 23:52 ` Mike Frysinger
2012-02-24 10:30 ` Aneesh V
2012-02-23 14:06 ` [U-Boot] [PATCH v3 2/6] armv7: add appropriate headers for assembly functions Aneesh V
2012-02-23 14:59 ` Mike Frysinger
2012-02-23 14:06 ` [U-Boot] [PATCH v3 3/6] ARM: enable Thumb build Aneesh V
2012-02-23 14:06 ` [U-Boot] [PATCH v3 4/6] armv7: Use -march=armv7-a and thereby enable Thumb-2 Aneesh V
2012-02-23 15:05 ` Mike Frysinger
2012-02-23 17:50 ` Aneesh V
2012-02-23 14:06 ` [U-Boot] [PATCH v3 5/6] omap4+: Avoid using __attribute__ ((__packed__)) Aneesh V
2012-02-23 14:21 ` Tom Rini
2012-02-23 14:56 ` Aneesh V
2012-02-23 15:03 ` Mike Frysinger
2012-02-23 15:03 ` Mike Frysinger
2012-02-23 15:42 ` Aneesh V
2012-02-23 14:06 ` [U-Boot] [PATCH v3 6/6] OMAP4: enable Thumb build Aneesh V
2012-03-08 17:10 ` [U-Boot] [PATCH 1/6] arm: adapt asm/linkage.h from Linux Aneesh V
2012-03-08 17:14 ` Aneesh V
2012-03-08 17:10 ` [U-Boot] [PATCH 2/6] armv7: add appropriate headers for assembly functions Aneesh V
2012-03-08 17:10 ` [U-Boot] [PATCH 3/6] ARM: enable Thumb build Aneesh V
2012-03-08 17:10 ` [U-Boot] [PATCH 4/6] armv7: Use -march=armv7-a and thereby enable Thumb-2 Aneesh V
2012-03-08 17:10 ` [U-Boot] [PATCH 5/6] omap4+: Avoid using __attribute__ ((__packed__)) Aneesh V
2012-03-08 17:10 ` [U-Boot] [PATCH 6/6] OMAP4: enable Thumb build Aneesh V
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4F461D9C.7050803@ti.com \
--to=aneesh@ti.com \
--cc=u-boot@lists.denx.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox