summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--meta/classes/insane.bbclass44
1 files changed, 33 insertions, 11 deletions
diff --git a/meta/classes/insane.bbclass b/meta/classes/insane.bbclass
index 8d5da00d16..c45f2cb4b3 100644
--- a/meta/classes/insane.bbclass
+++ b/meta/classes/insane.bbclass
@@ -92,7 +92,7 @@ def package_qa_get_machine_dict():
92 } 92 }
93 93
94 94
95WARN_QA ?= "dev-so rpaths debug-deps dev-deps debug-files arch la2 pkgconfig desktop la ldflags perms" 95WARN_QA ?= "dev-so rpaths debug-deps dev-deps debug-files arch la2 pkgconfig desktop la ldflags perms useless-rpaths"
96ERROR_QA ?= "" 96ERROR_QA ?= ""
97#ERROR_QA ?= "rpaths debug-deps dev-deps debug-files arch pkgconfig perms" 97#ERROR_QA ?= "rpaths debug-deps dev-deps debug-files arch pkgconfig perms"
98 98
@@ -141,6 +141,31 @@ def package_qa_check_rpath(file,name, d, elf, messages):
141 if dir in line: 141 if dir in line:
142 messages.append("package %s contains bad RPATH %s in file %s" % (name, line, file)) 142 messages.append("package %s contains bad RPATH %s in file %s" % (name, line, file))
143 143
144QAPATHTEST[useless-rpaths] = "package_qa_check_useless_rpaths"
145def package_qa_check_useless_rpaths(file,name, d, elf, messages):
146 """
147 Check for RPATHs that are useless but not dangerous
148 """
149 if not elf:
150 return
151
152 objdump = bb.data.getVar('OBJDUMP', d, True)
153 env_path = bb.data.getVar('PATH', d, True)
154
155 libdir = bb.data.getVar("libdir", d, True)
156 base_libdir = bb.data.getVar("base_libdir", d, True)
157
158 import re
159 rpath_re = re.compile("\s+RPATH\s+(.*)")
160 for line in os.popen("LC_ALL=C PATH=%s %s -p '%s' 2> /dev/null" % (env_path, objdump, file), "r"):
161 m = rpath_re.match(line)
162 if m:
163 rpath = m.group(1)
164 if rpath == libdir or rpath == base_libdir:
165 # The dynamic linker searches both these places anyway. There is no point in
166 # looking there again.
167 messages.append("dynamic section contains probably-redundant RPATH %s" % rpath)
168
144QAPATHTEST[dev-so] = "package_qa_check_dev" 169QAPATHTEST[dev-so] = "package_qa_check_dev"
145def package_qa_check_dev(path, name, d, elf, messages): 170def package_qa_check_dev(path, name, d, elf, messages):
146 """ 171 """
@@ -238,22 +263,19 @@ def package_qa_hash_style(path, name, d, elf, messages):
238 objdump = bb.data.getVar('OBJDUMP', d, True) 263 objdump = bb.data.getVar('OBJDUMP', d, True)
239 env_path = bb.data.getVar('PATH', d, True) 264 env_path = bb.data.getVar('PATH', d, True)
240 265
241 sane = True 266 sane = False
242 elf = False 267 has_syms = False
243 # A bit hacky. We do not know if path is an elf binary or not 268
244 # we will search for 'NEEDED' or 'INIT' as this should be printed... 269 # If this binary has symbols, we expect it to have GNU_HASH too.
245 # and come before the HASH section (guess!!!) and works on split out
246 # debug symbols too
247 for line in os.popen("LC_ALL=C PATH=%s %s -p '%s' 2> /dev/null" % (env_path, objdump, path), "r"): 270 for line in os.popen("LC_ALL=C PATH=%s %s -p '%s' 2> /dev/null" % (env_path, objdump, path), "r"):
248 if "NEEDED" in line or "INIT" in line: 271 if "SYMTAB" in line:
249 sane = False 272 has_syms = True
250 elf = True
251 if "GNU_HASH" in line: 273 if "GNU_HASH" in line:
252 sane = True 274 sane = True
253 if "[mips32]" in line or "[mips64]" in line: 275 if "[mips32]" in line or "[mips64]" in line:
254 sane = True 276 sane = True
255 277
256 if elf and not sane: 278 if has_syms and not sane:
257 messages.append("No GNU_HASH in the elf binary: '%s'" % path) 279 messages.append("No GNU_HASH in the elf binary: '%s'" % path)
258 280
259 281