forked from Minki/linux
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: Kristen Carlson Accardi <kristen@linux.intel.com> Signed-off-by: Josh Poimboeuf <jpoimboe@redhat.com>
This commit is contained in:
parent
0decf1f8de
commit
e000acc145
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user