mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Dave Martin <Dave.Martin@arm.com>
To: Lino Sanfilippo <lsanfil@marvell.com>
Cc: LinoSanfilippo@gmx.de, linux@arm.linux.org.uk,
	linux-kernel@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org
Subject: Re: [RFC PATCH 0/1] Wrong structure alignment due to compiler attribute "section"
Date: Thu, 5 Mar 2015 12:26:06 +0000	[thread overview]
Message-ID: <20150305122606.GC3612@e103592.cambridge.arm.com> (raw)
In-Reply-To: <54F732DA.2050004@marvell.com>

On Wed, Mar 04, 2015 at 05:29:14PM +0100, Lino Sanfilippo wrote:
> On 04.03.2015 15:35, Dave Martin wrote:
> 
> >
> >Try
> >
> >rm drivers/clk/mvebu/kirkwood.o
> >make ARCH=arm KBUILD_CFLAGS_KERNEL=-save-temps drivers/clk/mvebu/kirkwood.o
> >
> >(abuse of KBUILD_CFLAGS_KERNEL here, but it's empty by default, and
> >I'm too lazy to copy-paste command lines...)
> >
> >
> >The compiler will split out the compiled assembly code in kirkwood.s:
> >
> >Look for ".align" directives between the start of the affected section
> >and the start of the next section (next .section directive).
> >
> >Here, we just have .align 2, which is the expected correct value
> >(i.e., align __of_table_mv88f6180_clk on a 2^2 = 4 byte boundary).
> >
> >A different value here may indicate a bug in the compiler, because
> >you observed that gcc _thinks_ that __alignof__ is 4 for the struct
> >in this section even in the failing case.
> 
> Ok, this is the result for the assembly:
> 
>         .section        __clk_of_table,"a",%progbits
>         .align  3
>         .type   __of_table_mv88f6180_clk, %object
>         .size   __of_table_mv88f6180_clk, 196
> __of_table_mv88f6180_clk:
>         .space  64

[...]

> Very interesting. It shows an .align 3 which explains alignment on
> 8 byte boundaries:
> 
> 
> c07630f8 T __clk_of_table
> c07630f8 t __of_table_fixed_factor_clk
> c07630f8 T __stop_kprobe_blacklist
> c07631c0 t __of_table_fixed_clk
> c0763288 t __of_table_gpio_gate_clk
> c0763350 t __of_table_mv88f6180_clk
> 
> So this is indeed a compiler bug, right?

It certainly looks like the compiler is causing the issue somehow.

Whether this is a bug, a bug-like feature, a configuration issue,
or a combination of these is not clear.

If you know where to find the toolchain source, it might be worth
taking a look.

Cheers
---Dave


  reply	other threads:[~2015-03-05 12:26 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-03-02 10:01 Lino Sanfilippo
2015-03-02 10:01 ` [RFC PATCH 1/1] ARM: Ensure correct structure alignment when using " Lino Sanfilippo
2015-03-03 14:41 ` [RFC PATCH 0/1] Wrong structure alignment due to " Dave Martin
2015-03-04 11:40   ` sanfilippo
2015-03-04 14:35     ` Dave Martin
2015-03-04 16:29       ` Lino Sanfilippo
2015-03-05 12:26         ` Dave Martin [this message]
2015-03-05 13:20           ` Lino Sanfilippo
2015-03-05 13:47             ` Dave Martin
2015-03-05 15:32               ` Lino Sanfilippo
2015-03-05 17:33                 ` Dave Martin
2015-03-06 14:02                   ` Lino Sanfilippo
2015-03-06 18:20                     ` Lino Sanfilippo
2015-03-22  0:56                       ` Lino Sanfilippo
2015-03-24 12:07                         ` Dave Martin

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=20150305122606.GC3612@e103592.cambridge.arm.com \
    --to=dave.martin@arm.com \
    --cc=LinoSanfilippo@gmx.de \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@arm.linux.org.uk \
    --cc=lsanfil@marvell.com \
    /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

all inboxes | Powered by JetHome®