aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHolger Hans Peter Freyther <zecke@selfish.org>2008-10-26 20:14:53 +0100
committerHolger Hans Peter Freyther <zecke@selfish.org>2008-10-26 20:14:53 +0100
commit36aadaa3b384508ee339a3712a136d41740c0da7 (patch)
tree02531dfd13d1a048e1c5a4b4cb4b45f5df4685c4
parentda39d543eb2fab7a4abeaf4b01dead640b95e44d (diff)
downloadopenembedded-36aadaa3b384508ee339a3712a136d41740c0da7.tar.gz
insane.bbclass: Detect if someone is not using our LDFLAGS
We started passing --target-style=gnu/both to the linker. If the buildsystem is not picking up our LDFLAGS it will not have this hash in the binary. E.g. this is true for busybox. Add a check to insane.bbclass to check if we have a GNU_HASH in the elf binary
-rw-r--r--classes/insane.bbclass34
1 files changed, 33 insertions, 1 deletions
diff --git a/classes/insane.bbclass b/classes/insane.bbclass
index 331fd57109..8a01d3bbed 100644
--- a/classes/insane.bbclass
+++ b/classes/insane.bbclass
@@ -325,6 +325,38 @@ def package_qa_check_desktop(path, name, d):
return sane
+def package_qa_hash_style(path, name, d):
+ """
+ Check if the binary has the right hash style...
+ """
+ import bb, os
+
+ if os.path.islink(path):
+ return True
+
+ gnu_hash = "--hash-style=gnu" in bb.data.getVar('LDFLAGS', d, True)
+ if not gnu_hash:
+ gnu_hash = "--hash-style=both" in bb.data.getVar('LDFLAGS', d, True)
+
+ objdump = bb.data.getVar('OBJDUMP', d, True)
+ env_path = bb.data.getVar('PATH', d, True)
+
+ sane = True
+ elf = False
+ # A bit hacky. We do not know if path is an elf binary or not
+ # we will search for 'Program Header' as this should be printed...
+ for line in os.popen("LC_ALL=C PATH=%s %s -p '%s' 2> /dev/null" % (env_path, objdump, path), "r"):
+ if "Program Header:" in line:
+ sane = False
+ elf = True
+ if "GNU_HASH" in line:
+ sane = True
+
+ if elf and not sane:
+ bb.note("No GNU_HASH in the elf binary: '%s'" % path)
+
+ return sane
+
def package_qa_check_staged(path,d):
"""
Check staged la and pc files for sanity
@@ -433,7 +465,7 @@ python do_package_qa () {
checks = [package_qa_check_rpath, package_qa_check_devdbg,
package_qa_check_perm, package_qa_check_arch,
- package_qa_check_desktop]
+ package_qa_check_desktop, package_qa_hash_style]
walk_sane = True
rdepends_sane = True
for package in packages.split():