All of lore.kernel.org
 help / color / mirror / Atom feed
From: Markus Ongyerth <ell@ongy.net>
To: ell@lists.01.org
Subject: Re: [PATCH 1/4] autotools: Only used -Wcast-align with gcc
Date: Thu, 15 Dec 2016 08:48:57 +0100	[thread overview]
Message-ID: <0550e404dbfde87d854d0dcf0441ae3b@localhost> (raw)
In-Reply-To: <876A9361-B751-4FA5-BF3D-245576450505@holtmann.org>

[-- Attachment #1: Type: text/plain, Size: 2758 bytes --]

Hi Marcel,

On 2016/12月/15 07:57, Marcel Holtmann wrote:
> Hi Markus,
> 
> > clang can currently not compile NLMSG_NEXT with -Wcast-align.
> > I asked about this in #llvm on irc.oftc.net, where I was told the best
> > solution is to disable -Wcast-align for now.
> 
> can we get a little bit more background on this. I had also some issues with native gcc usage on Raspberry PI. And yes, the netlink macros are some offenders.
> 
I was mostly going of an answer I got in irc, (I was told it's ok to quote):

/***************************************************************************/
2016-12-14 17:47:14	dblaikie	ongy: Judging by the docs - and this is a bit 
of a guess, GCC is more conservative with this warning, restricting it to only 
platforms where it would be an illegal instruction (I haven't actually tested 
this, because I don't have a GCC cross compiler and don't remember which 
targets have this behavior - x86 just has reduced performance)
/***************************************************************************/

The docs they reference here are probably [1] . Here the relevant lines are:

/***************************************************************************/
-Wcast-align
Warn whenever a pointer is cast such that the required alignment of the target
is increased. For example, warn if a char * is cast to an int * on machines 
where integers can only be accessed at two- or four-byte boundaries. 
/***************************************************************************/

Judging from [2] this is the case on older ARM processors.
If I read this correctly, The Raspberry PI should support unaligned access (at 
least version 2 and 3). It may be worth to see what architecture gcc targets 
and make it more specific.


[1] https://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html
[2] http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.faqs/ka15414.html
> > ---
> > acinclude.m4 | 4 +++-
> > 1 file changed, 3 insertions(+), 1 deletion(-)
> > 
> > diff --git a/acinclude.m4 b/acinclude.m4
> > index 8aab4ee..b1dbabe 100644
> > --- a/acinclude.m4
> > +++ b/acinclude.m4
> > @@ -58,6 +58,8 @@ AC_DEFUN([COMPILER_FLAGS], [
> > 		CFLAGS+=" -Wdeclaration-after-statement"
> > 		CFLAGS+=" -Wmissing-declarations"
> > 		CFLAGS+=" -Wredundant-decls"
> > -		CFLAGS+=" -Wcast-align"
> > +		if ( $CC -v 2>/dev/null | grep "gcc version" ); then
> > +			CFLAGS+=" -Wcast-align"
> > +		fi
> 
> Are you sure there is not a better autoconf macro for checking if we use gcc vs clang.

No I'm not. I'm not really familiar with autotools. This is what came up when 
I searched for compiler specific option in autotools, there may be a better 
way.

Regards,
  Markus

  reply	other threads:[~2016-12-15  7:48 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-12-14 22:51 Build ell with clang ell
2016-12-14 22:51 ` [PATCH 1/4] autotools: Only used -Wcast-align with gcc ell
2016-12-15  5:21   ` Denis Kenzior
2016-12-15  6:57   ` Marcel Holtmann
2016-12-15  7:48     ` Markus Ongyerth [this message]
2016-12-14 22:51 ` [PATCH 2/4] dbus: Make adjustments for compilation with clang ell
2016-12-14 22:51 ` [PATCH 3/4] dbus: Add missing dereference on assign ell
2016-12-14 22:51 ` [PATCH 4/4] tls-record: remove unnecessary null-pointer check ell

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=0550e404dbfde87d854d0dcf0441ae3b@localhost \
    --to=ell@ongy.net \
    --cc=ell@lists.01.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.