diff options
| author | Phil Blundell <philb@gnu.org> | 2012-10-03 11:24:12 +0100 |
|---|---|---|
| committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2012-11-12 13:36:39 +0000 |
| commit | fa73df62c690736b0a9457ef83558058a441df87 (patch) | |
| tree | bb0ae1d94ffdb0435393475cdd0764003b9b29cf | |
| parent | 210839e7a53092f3847def82cfa4a1b11723e4eb (diff) | |
| download | poky-fa73df62c690736b0a9457ef83558058a441df87.tar.gz | |
insane: detect and warn about relocations in .text
(From OE-Core rev: bc08838ddab0d16d889f81244529a0302a9240bc)
Signed-off-by: Phil Blundell <pb@pbcl.net>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
| -rw-r--r-- | meta/classes/insane.bbclass | 26 |
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(): | |||
| 113 | 113 | ||
| 114 | 114 | ||
| 115 | # Currently not being used by default "desktop" | 115 | # Currently not being used by default "desktop" |
| 116 | WARN_QA ?= "ldflags useless-rpaths rpaths unsafe-references-in-binaries unsafe-references-in-scripts staticdev libdir xorg-driver-abi" | 116 | WARN_QA ?= "ldflags useless-rpaths rpaths unsafe-references-in-binaries unsafe-references-in-scripts staticdev libdir xorg-driver-abi textrel" |
| 117 | ERROR_QA ?= "dev-so debug-deps dev-deps debug-files arch la2 pkgconfig la perms dep-cmp" | 117 | ERROR_QA ?= "dev-so debug-deps dev-deps debug-files arch la2 pkgconfig la perms dep-cmp" |
| 118 | 118 | ||
| 119 | ALL_QA = "${WARN_QA} ${ERROR_QA}" | 119 | ALL_QA = "${WARN_QA} ${ERROR_QA}" |
| @@ -446,6 +446,30 @@ def package_qa_check_desktop(path, name, d, elf, messages): | |||
| 446 | for l in output: | 446 | for l in output: |
| 447 | messages.append("Desktop file issue: " + l.strip()) | 447 | messages.append("Desktop file issue: " + l.strip()) |
| 448 | 448 | ||
| 449 | QAPATHTEST[textrel] = "package_qa_textrel" | ||
| 450 | def package_qa_textrel(path, name, d, elf, messages): | ||
| 451 | """ | ||
| 452 | Check if the binary contains relocations in .text | ||
| 453 | """ | ||
| 454 | |||
| 455 | if not elf: | ||
| 456 | return | ||
| 457 | |||
| 458 | if os.path.islink(path): | ||
| 459 | return | ||
| 460 | |||
| 461 | phdrs = elf.run_objdump("-p", d) | ||
| 462 | sane = True | ||
| 463 | |||
| 464 | import re | ||
| 465 | textrel_re = re.compile("\s+TEXTREL\s+") | ||
| 466 | for line in phdrs.split("\n"): | ||
| 467 | if textrel_re.match(line): | ||
| 468 | sane = False | ||
| 469 | |||
| 470 | if not sane: | ||
| 471 | messages.append("ELF binary '%s' has relocations in .text" % path) | ||
| 472 | |||
| 449 | QAPATHTEST[ldflags] = "package_qa_hash_style" | 473 | QAPATHTEST[ldflags] = "package_qa_hash_style" |
| 450 | def package_qa_hash_style(path, name, d, elf, messages): | 474 | def package_qa_hash_style(path, name, d, elf, messages): |
| 451 | """ | 475 | """ |
