Commit e000acc1 authored by Kristen Carlson Accardi's avatar Kristen Carlson Accardi Committed by Josh Poimboeuf

objtool: Do not assume order of parent/child functions

If a .cold function is examined prior to it's parent, the link
to the parent/child function can be overwritten when the parent
is examined. Only update pfunc and cfunc if they were previously
nil to prevent this from happening.

This fixes an issue seen when compiling with -ffunction-sections.
Signed-off-by: default avatarKristen Carlson Accardi <kristen@linux.intel.com>
Signed-off-by: default avatarJosh Poimboeuf <jpoimboe@redhat.com>
parent 0decf1f8
......@@ -434,7 +434,13 @@ static int read_symbols(struct elf *elf)
size_t pnamelen;
if (sym->type != STT_FUNC)
continue;
sym->pfunc = sym->cfunc = sym;
if (sym->pfunc == NULL)
sym->pfunc = sym;
if (sym->cfunc == NULL)
sym->cfunc = sym;
coldstr = strstr(sym->name, ".cold");
if (!coldstr)
continue;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment