summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhil Blundell <philb@gnu.org>2012-10-03 11:24:12 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2012-11-12 12:50:20 +0000
commitbc08838ddab0d16d889f81244529a0302a9240bc (patch)
treecb2e0a0eae22185c2fba2e034d193d36b1604eb5
parent960ad0998a9edbefe57d08b6f587682f0dc9d768 (diff)
downloadopenembedded-core-bc08838ddab0d16d889f81244529a0302a9240bc.tar.gz
openembedded-core-bc08838ddab0d16d889f81244529a0302a9240bc.tar.bz2
openembedded-core-bc08838ddab0d16d889f81244529a0302a9240bc.zip
insane: detect and warn about relocations in .text
Signed-off-by: Phil Blundell <pb@pbcl.net> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r--meta/classes/insane.bbclass26
1 files changed, 25 insertions, 1 deletions
diff --git a/meta/classes/insane.bbclass b/meta/classes/insane.bbclass
index d51d1a1e00..34bcd98e8d 100644
--- a/meta/classes/insane.bbclass
+++ b/meta/classes/insane.bbclass
@@ -113,7 +113,7 @@ def package_qa_get_machine_dict():
# Currently not being used by default "desktop"
-WARN_QA ?= "ldflags useless-rpaths rpaths unsafe-references-in-binaries unsafe-references-in-scripts staticdev libdir xorg-driver-abi"
+WARN_QA ?= "ldflags useless-rpaths rpaths unsafe-references-in-binaries unsafe-references-in-scripts staticdev libdir xorg-driver-abi textrel"
ERROR_QA ?= "dev-so debug-deps dev-deps debug-files arch la2 pkgconfig la perms dep-cmp"
ALL_QA = "${WARN_QA} ${ERROR_QA}"
@@ -446,6 +446,30 @@ def package_qa_check_desktop(path, name, d, elf, messages):
for l in output:
messages.append("Desktop file issue: " + l.strip())
+QAPATHTEST[textrel] = "package_qa_textrel"
+def package_qa_textrel(path, name, d, elf, messages):
+ """
+ Check if the binary contains relocations in .text
+ """
+
+ if not elf:
+ return
+
+ if os.path.islink(path):
+ return
+
+ phdrs = elf.run_objdump("-p", d)
+ sane = True
+
+ import re
+ textrel_re = re.compile("\s+TEXTREL\s+")
+ for line in phdrs.split("\n"):
+ if textrel_re.match(line):
+ sane = False
+
+ if not sane:
+ messages.append("ELF binary '%s' has relocations in .text" % path)
+
QAPATHTEST[ldflags] = "package_qa_hash_style"
def package_qa_hash_style(path, name, d, elf, messages):
"""