In toolchain edge cases it's possible for the RPATH of a library to be
set to something like "/usr/lib/../lib".  This should be detected as
"/usr/lib" and generate a warning.  Also clarify the warning text to
indicate potential link-time pollution from the host libraries.

Signed-off-by: Andy Ross <andy.r...@windriver.com>
---
 meta/classes/insane.bbclass | 15 +++++++++++----
 1 file changed, 11 insertions(+), 4 deletions(-)

diff --git a/meta/classes/insane.bbclass b/meta/classes/insane.bbclass
index 556a176..dfaa9dc 100644
--- a/meta/classes/insane.bbclass
+++ b/meta/classes/insane.bbclass
@@ -161,6 +161,10 @@ def package_qa_check_rpath(file,name, d, elf, messages):
             if dir in line:
                 messages.append("package %s contains bad RPATH %s in file %s" 
% (name, line, file))
 
+def rpath_eq(a, b):
+    import os.path
+    return os.path.normpath(a) == os.path.normpath(b)
+
 QAPATHTEST[useless-rpaths] = "package_qa_check_useless_rpaths"
 def package_qa_check_useless_rpaths(file, name, d, elf, messages):
     """
@@ -181,10 +185,13 @@ def package_qa_check_useless_rpaths(file, name, d, elf, 
messages):
        m = rpath_re.match(line)
        if m:
           rpath = m.group(1)
-          if rpath == libdir or rpath == base_libdir:
-             # The dynamic linker searches both these places anyway.  There is 
no point in
-             # looking there again.
-             messages.append("%s: %s contains probably-redundant RPATH %s" % 
(name, package_qa_clean_path(file, d), rpath))
+          if rpath_eq(rpath, libdir) or rpath_eq(rpath, base_libdir):
+             # The dynamic linker searches both these places anyway.
+             # There is no point in looking there again.  And it may
+             # be harmful: the RPATH may point to host directories
+             # (e.g. /usr/lib) which will be searched at link time,
+             # creating build issues.
+             messages.append("%s: %s contains probably-redundant, possibly 
host-polluted RPATH %s" % (name, package_qa_clean_path(file, d), rpath))
 
 QAPATHTEST[dev-so] = "package_qa_check_dev"
 def package_qa_check_dev(path, name, d, elf, messages):
-- 
1.7.11.2


_______________________________________________
Openembedded-core mailing list
Openembedded-core@lists.openembedded.org
http://lists.linuxtogo.org/cgi-bin/mailman/listinfo/openembedded-core

Reply via email to