[OE-core] [PATCH] glibc: add -fno-builtin-strlen when not using -O2

jackie.huang at windriver.com jackie.huang at windriver.com
Mon Dec 12 05:42:15 UTC 2016


From: Jackie Huang <jackie.huang at windriver.com>

The strlen will be inlined when compile with -O, -O1 or -Os,
so there is no symbol for strlen in ld-linux-x86-64.so.2,
causing a fatal error in valgrind:

valgrind: Fatal error at startup: a function redirection
valgrind: which is mandatory for this platform-tool combination
valgrind: cannot be set up. Details of the redirection are:
valgrind:
valgrind: A must-be-redirected function
valgrind: whose name matches the pattern: strlen
valgrind: in an object with soname matching: ld-linux-x86-64.so.2

so add -fno-builtin-strlen when compile with -O, -O1 or -Os.

Signed-off-by: Jackie Huang <jackie.huang at windriver.com>
---
 meta/recipes-core/glibc/glibc.inc | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/meta/recipes-core/glibc/glibc.inc b/meta/recipes-core/glibc/glibc.inc
index e85c704..7f3e0f6 100644
--- a/meta/recipes-core/glibc/glibc.inc
+++ b/meta/recipes-core/glibc/glibc.inc
@@ -16,8 +16,8 @@ python () {
     if opt_effective == "-O0":
         bb.fatal("%s can't be built with %s, try -O1 instead" % (d.getVar('PN', True), opt_effective))
     if opt_effective in ("-O", "-O1", "-Os"):
-        bb.note("%s doesn't build cleanly with %s, adding -Wno-error to SELECTED_OPTIMIZATION" % (d.getVar('PN', True), opt_effective))
-        d.appendVar("SELECTED_OPTIMIZATION", " -Wno-error")
+        bb.note("%s doesn't build cleanly with %s, adding -Wno-error and -fno-builtin-strlen to SELECTED_OPTIMIZATION" % (d.getVar('PN', True), opt_effective))
+        d.appendVar("SELECTED_OPTIMIZATION", " -Wno-error -fno-builtin-strlen")
 }
 
 # siteconfig.bbclass runs configure which needs a working compiler
-- 
2.8.3




More information about the Openembedded-core mailing list