aboutsummaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2018-07-08 14:57:40 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2018-07-08 14:57:40 -0400
commitf5c926b99e421db13d2056bc99a624499a2be19e (patch)
tree753cdfb33e567751a750feb316e8b0dd7d77fdf8 /tools
parent124b99fb8018a7ac45558d8ab249ed758e14e618 (diff)
parent08b393d01c88aff27347ed2b1b354eb4db2f1532 (diff)
Merge branch 'core-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
Pull objtool fix from Thomas Gleixner: "A single fix for objtool to address a bug in handling the cold subfunction detection for aliased functions which was added recently. The bug causes objtool to enter an infinite loop" * 'core-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: objtool: Support GCC 8 '-fnoreorder-functions'
Diffstat (limited to 'tools')
-rw-r--r--tools/objtool/elf.c41
1 files changed, 28 insertions, 13 deletions
diff --git a/tools/objtool/elf.c b/tools/objtool/elf.c
index 4e60e105583e..0d1acb704f64 100644
--- a/tools/objtool/elf.c
+++ b/tools/objtool/elf.c
@@ -302,19 +302,34 @@ static int read_symbols(struct elf *elf)
302 continue; 302 continue;
303 sym->pfunc = sym->cfunc = sym; 303 sym->pfunc = sym->cfunc = sym;
304 coldstr = strstr(sym->name, ".cold."); 304 coldstr = strstr(sym->name, ".cold.");
305 if (coldstr) { 305 if (!coldstr)
306 coldstr[0] = '\0'; 306 continue;
307 pfunc = find_symbol_by_name(elf, sym->name); 307
308 coldstr[0] = '.'; 308 coldstr[0] = '\0';
309 309 pfunc = find_symbol_by_name(elf, sym->name);
310 if (!pfunc) { 310 coldstr[0] = '.';
311 WARN("%s(): can't find parent function", 311
312 sym->name); 312 if (!pfunc) {
313 goto err; 313 WARN("%s(): can't find parent function",
314 } 314 sym->name);
315 315 goto err;
316 sym->pfunc = pfunc; 316 }
317 pfunc->cfunc = sym; 317
318 sym->pfunc = pfunc;
319 pfunc->cfunc = sym;
320
321 /*
322 * Unfortunately, -fnoreorder-functions puts the child
323 * inside the parent. Remove the overlap so we can
324 * have sane assumptions.
325 *
326 * Note that pfunc->len now no longer matches
327 * pfunc->sym.st_size.
328 */
329 if (sym->sec == pfunc->sec &&
330 sym->offset >= pfunc->offset &&
331 sym->offset + sym->len == pfunc->offset + pfunc->len) {
332 pfunc->len -= sym->len;
318 } 333 }
319 } 334 }
320 } 335 }