Openembedded Core Discussions
 help / color / mirror / Atom feed
From: Lei Liu <layliu@gmail.com>
To: openembedded-core@lists.openembedded.org
Subject: [PATCH] Disable building libgcc with -O0
Date: Mon, 11 Nov 2013 12:30:43 +0800	[thread overview]
Message-ID: <52805D73.4050306@gmail.com> (raw)

Link error happens for valgrind when linking unoptimized libgcc.
Libgcc requires symbol _Unwind_Resume defined in libgcc_eh which
in turn requires pulling in entire glibc.  We can't make valgrind
link with glibc due to its design.  So don't build libgcc without
optimizations, so that calls to _Unwind_Resume get eliminated.

Signed-off-by: Lei Liu <lei.liu2@windriver.com>
---
 meta/recipes-devtools/gcc/gcc-cross.inc | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/meta/recipes-devtools/gcc/gcc-cross.inc b/meta/recipes-devtools/gcc/gcc-cross.inc
index 25a3142..cf03c08 100644
--- a/meta/recipes-devtools/gcc/gcc-cross.inc
+++ b/meta/recipes-devtools/gcc/gcc-cross.inc
@@ -25,6 +25,15 @@ EXTRA_OECONF_PATHS = " \
 
 ARCH_FLAGS_FOR_TARGET += "-isystem${STAGING_DIR_TARGET}${target_includedir}"
 
+def get_optimization(d):
+    selected_optimization = d.getVar("SELECTED_OPTIMIZATION", True)
+    if base_contains("SELECTED_OPTIMIZATION", "-O0", "x", "", d) == "x":
+        bb.note("libgcc can't be built with -O0, -O2 will be used instead.")
+        return selected_optimization.replace("-O0", "-O2")
+    return selected_optimization
+
+SELECTED_OPTIMIZATION := "${@get_optimization(d)}"
+
 do_configure_prepend () {
 	sed -i 's/BUILD_INFO=info/BUILD_INFO=/' ${S}/gcc/configure
 }
--
1.8.2.1 


             reply	other threads:[~2013-11-11  4:30 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-11-11  4:30 Lei Liu [this message]
2013-11-12 15:01 ` [PATCH] Disable building libgcc with -O0 Saul Wold
2013-11-12 23:58 ` Phil Blundell
2013-11-13  3:02   ` Lei Liu
2013-11-13  7:44     ` Phil Blundell

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=52805D73.4050306@gmail.com \
    --to=layliu@gmail.com \
    --cc=openembedded-core@lists.openembedded.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox