Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
To: buildroot@busybox.net
Subject: [Buildroot] [PATCH] stella: fix bug when compiling with PPC altivec vectorization
Date: Sat, 19 Nov 2016 10:59:27 +0100	[thread overview]
Message-ID: <20161119105927.57bd516a@free-electrons.com> (raw)
In-Reply-To: <1479404832-11783-1-git-send-email-sergio.prado@e-labworks.com>

Sam,

Could you review the below patch, which is PowerPC/Altivec related, and
let us know what you think?

Thanks!

Thomas

On Thu, 17 Nov 2016 15:47:12 -0200, Sergio Prado wrote:
> PPC altivec vectorization triggers a bug when compiling with -std=c++11
> because "bool" is redefined in altivec.h.
> 
> src/emucore/Event.hxx:112:23: error: cannot convert ?bool? to ?__vector(4) __bool int? in assignment
>          myKeyTable[i] = false;
>                        ^
> 
> Acording to a bug report in GCC [1], "You need to use -std=g++11 or
> undefine bool after the include of altivec.h as context sensitive
> keywords is not part of the C++11 standard".
> 
> So let's compile with -std=gnu++11 when PPC altivec is enabled.
> 
> [1] https://gcc.gnu.org/bugzilla/show_bug.cgi?id=58241#c3
> 
> Fixes:
> http://autobuild.buildroot.net/results/0970d2c8e1787ceffc46b589522e53d52675e03c
> http://autobuild.buildroot.net/results/ec1bc57675b6e53af0cd33d7b99cd2e3bf5d9d7e
> 
> Signed-off-by: Sergio Prado <sergio.prado@e-labworks.com>
> ---
>  ...XFLAGS-so-we-can-append-values-to-user-de.patch | 40 ++++++++++++++++++++++
>  package/stella/stella.mk                           | 14 +++++++-
>  2 files changed, 53 insertions(+), 1 deletion(-)
>  create mode 100644 package/stella/0004-Override-CXXFLAGS-so-we-can-append-values-to-user-de.patch
> 
> diff --git a/package/stella/0004-Override-CXXFLAGS-so-we-can-append-values-to-user-de.patch b/package/stella/0004-Override-CXXFLAGS-so-we-can-append-values-to-user-de.patch
> new file mode 100644
> index 000000000000..7e82c571e2c1
> --- /dev/null
> +++ b/package/stella/0004-Override-CXXFLAGS-so-we-can-append-values-to-user-de.patch
> @@ -0,0 +1,40 @@
> +From f81bec4d6e523df308158d6bd6f948be4d0183ba Mon Sep 17 00:00:00 2001
> +From: Sergio Prado <sergio.prado@e-labworks.com>
> +Date: Thu, 17 Nov 2016 15:26:56 -0200
> +Subject: [PATCH] Override CXXFLAGS so we can append values to user-defined
> + CXXFLAGS.
> +
> +Signed-off-by: Sergio Prado <sergio.prado@e-labworks.com>
> +---
> + Makefile | 8 ++++----
> + 1 file changed, 4 insertions(+), 4 deletions(-)
> +
> +diff --git a/Makefile b/Makefile
> +index 6dd0129587b3..7133ca58ac49 100644
> +--- a/Makefile
> ++++ b/Makefile
> +@@ -49,17 +49,17 @@ ifdef CXXFLAGS
> + else
> +   CXXFLAGS:= -O2
> + endif
> +-CXXFLAGS+= -Wall -Wextra -Wno-unused-parameter -Wno-ignored-qualifiers
> ++override CXXFLAGS+= -Wall -Wextra -Wno-unused-parameter -Wno-ignored-qualifiers
> + ifdef HAVE_GCC
> +-  CXXFLAGS+= -Wno-multichar -Wunused -fno-rtti -Woverloaded-virtual -Wnon-virtual-dtor -std=c++11
> ++  override CXXFLAGS+= -Wno-multichar -Wunused -fno-rtti -Woverloaded-virtual -Wnon-virtual-dtor
> + endif
> + 
> + ifdef PROFILE
> +   PROF:= -g -pg -fprofile-arcs -ftest-coverage
> +-  CXXFLAGS+= $(PROF)
> ++  override CXXFLAGS+= $(PROF)
> + else
> +   ifdef HAVE_GCC
> +-    CXXFLAGS+= -fomit-frame-pointer
> ++    override CXXFLAGS+= -fomit-frame-pointer
> +   endif
> + endif
> + 
> +-- 
> +1.9.1
> +
> diff --git a/package/stella/stella.mk b/package/stella/stella.mk
> index 2e9d57b8c1ea..11cdd6adcd97 100644
> --- a/package/stella/stella.mk
> +++ b/package/stella/stella.mk
> @@ -12,11 +12,23 @@ STELLA_LICENSE_FILES = Copyright.txt License.txt
>  
>  STELLA_DEPENDENCIES = sdl2 libpng zlib
>  
> +STELLA_CXXFLAGS = $(TARGET_CFLAGS)
> +
> +# PPC altivec vectorization triggers a bug when compiling with -std=c++11
> +# so let's compile it with -std=gnu++11
> +ifeq ($(BR2_POWERPC_CPU_HAS_ALTIVEC),y)
> +STELLA_CXXFLAGS += -std=gnu++11
> +else
> +STELLA_CXXFLAGS += -std=c++11
> +endif
> +
>  STELLA_CONF_OPTS = \
>  	--host=$(GNU_TARGET_NAME) \
>  	--prefix=/usr \
>  	--with-sdl-prefix=$(STAGING_DIR)/usr
>  
> +STELLA_MAKE_OPTS += CXXFLAGS="$(STELLA_CXXFLAGS)"
> +
>  # The configure script is not autoconf based, so we use the
>  # generic-package infrastructure
>  define STELLA_CONFIGURE_CMDS
> @@ -28,7 +40,7 @@ define STELLA_CONFIGURE_CMDS
>  endef
>  
>  define STELLA_BUILD_CMDS
> -	$(TARGET_MAKE_ENV) $(MAKE) -C $(@D)
> +	$(TARGET_MAKE_ENV) $(MAKE) $(STELLA_MAKE_OPTS) -C $(@D)
>  endef
>  
>  define STELLA_INSTALL_TARGET_CMDS



-- 
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com

  reply	other threads:[~2016-11-19  9:59 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-11-17 17:47 [Buildroot] [PATCH] stella: fix bug when compiling with PPC altivec vectorization Sergio Prado
2016-11-19  9:59 ` Thomas Petazzoni [this message]
2016-11-22 23:33   ` Sam Bobroff
2016-11-23 21:59     ` Sergio Prado
2016-11-26 14:37       ` Thomas Petazzoni
2016-11-26 16:56         ` Sergio Prado
2016-11-24 20:40 ` Arnout Vandecappelle

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=20161119105927.57bd516a@free-electrons.com \
    --to=thomas.petazzoni@free-electrons.com \
    --cc=buildroot@busybox.net \
    /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