u-boot.lists.denx.de archive mirror
 help / color / mirror / Atom feed
From: "Andreas Bießmann" <andreas.devel@googlemail.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH] dlmalloc: remove manual reloc alias warning
Date: Wed, 15 Aug 2012 08:29:28 +0200	[thread overview]
Message-ID: <502B41C8.8010500@googlemail.com> (raw)
In-Reply-To: <CAPnjgZ2C5i-KAJG-qFp9zA5_pTgwwr8X53woZwUAKnKe33nDfQ@mail.gmail.com>

Dear Simon Glass,

On 15.08.12 02:15, Simon Glass wrote:
> Hi,
> 
> On Tue, Aug 14, 2012 at 1:50 AM, Andreas Bie?mann
> <andreas.devel@googlemail.com> wrote:
>> Dear all,
>>
>> On 13.08.2012 11:02, Andreas Bie?mann wrote:
>>> From: Andreas Bie?mann <biessmann@corscience.de>
>>>
>>> The avr32 architecture (and some others) require manual relocation. Due to the
>>> previous error all avr32 boards gave warnings in MAKEALL wich makes it hard to
>>> find new warnings.
>>>
>>> This patch fixes following warning:
>>> ---8<---
>>> dlmalloc.c: In function 'malloc_bin_reloc':
>>> dlmalloc.c:1493: warning: dereferencing pointer 'p' does break strict-aliasing rules
>>> dlmalloc.c:1493: warning: dereferencing pointer 'p' does break strict-aliasing rules
>>> dlmalloc.c:1490: note: initialized from here
>>> dlmalloc.c:1493: note: initialized from here
>>> --->8---
>>>
>>> Signed-off-by: Andreas Bie?mann <biessmann@corscience.de>
>>> ---
>>> A question to all the other related arches, namely m68k, mips, nds32 and
>>> sparc: Do you encounter the same warnings or is this warning due to my
>>> outdated compiler (4.4.3 currently, unfortunately atmel do not bother to send
>>> their patches mainline)?
>>>
>>>  common/dlmalloc.c |    3 ++-
>>>  1 file changed, 2 insertions(+), 1 deletion(-)
>>>
>>> diff --git a/common/dlmalloc.c b/common/dlmalloc.c
>>> index c645d73..78b1885 100644
>>> --- a/common/dlmalloc.c
>>> +++ b/common/dlmalloc.c
>>> @@ -1485,9 +1485,10 @@ static mbinptr av_[NAV * 2 + 2] = {
>>>  };
>>>
>>>  #ifdef CONFIG_NEEDS_MANUAL_RELOC
>>> +typedef unsigned long __attribute__((__may_alias__)) ulong_aliased;
>>>  void malloc_bin_reloc (void)
>>>  {
>>> -     unsigned long *p = (unsigned long *)(&av_[2]);
>>> +     ulong_aliased *p = (ulong_aliased *)(&av_[2]);
>>>       int i;
>>>       for (i=2; i<(sizeof(av_)/sizeof(mbinptr)); ++i) {
>>>               *p++ += gd->reloc_off;
>>>
>>
>> this seems to be related to
>> http://thread.gmane.org/gmane.comp.boot-loaders.u-boot/121848/focus=121849
>> can you Wolfgang and/or Simon please comment.
> 
> My only comment is that I created that patch due to errors I saw at
> the time, and still see with the toolchain I use for avr32.

So you also want to remove this annoying warning. Sorry that I didn't
test your patch from January earlier, but it is broken at runtime.

I would really like to remove the alias warning in 2012.10. My patch is
straight forward, maybe there are better solutions.
However I would like to see tested by from other affected arches (m68k,
mips, nds32 and sparc).

Best regards

Andreas Bie?mann

  reply	other threads:[~2012-08-15  6:29 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-08-13  9:02 [U-Boot] [PATCH] dlmalloc: remove manual reloc alias warning Andreas Bießmann
2012-08-13 14:54 ` Mike Frysinger
2012-08-13 15:14   ` Andreas Bießmann
2012-08-13 15:31     ` Andreas Bießmann
2012-08-14  8:50 ` Andreas Bießmann
2012-08-15  0:15   ` Simon Glass
2012-08-15  6:29     ` Andreas Bießmann [this message]
2012-09-01 10:10 ` Wolfgang Denk
2012-09-01 12:02   ` Wolfgang Denk
2012-09-01 13:20     ` Andreas Bießmann

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=502B41C8.8010500@googlemail.com \
    --to=andreas.devel@googlemail.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;
as well as URLs for NNTP newsgroup(s).