Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 09f30d83 authored by Peter Zijlstra's avatar Peter Zijlstra Committed by Ingo Molnar
Browse files

objtool: Handle function aliases



Function aliases result in different symbols for the same set of
instructions; track a canonical symbol so there is a unique point of
access.

This again prepares the way for function attributes. And in particular
the need for aliases comes from how KASAN uses them.

Signed-off-by: default avatarPeter Zijlstra (Intel) <peterz@infradead.org>
Acked-by: default avatarJosh Poimboeuf <jpoimboe@redhat.com>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: default avatarIngo Molnar <mingo@kernel.org>
parent a4d09dde
Loading
Loading
Loading
Loading
+11 −4
Original line number Diff line number Diff line
@@ -219,7 +219,7 @@ static int read_sections(struct elf *elf)
static int read_symbols(struct elf *elf)
{
	struct section *symtab, *sec;
	struct symbol *sym, *pfunc;
	struct symbol *sym, *pfunc, *alias;
	struct list_head *entry, *tmp;
	int symbols_nr, i;
	char *coldstr;
@@ -239,6 +239,7 @@ static int read_symbols(struct elf *elf)
			return -1;
		}
		memset(sym, 0, sizeof(*sym));
		alias = sym;

		sym->idx = i;

@@ -288,11 +289,17 @@ static int read_symbols(struct elf *elf)
				break;
			}

			if (sym->offset == s->offset && sym->len >= s->len) {
			if (sym->offset == s->offset) {
				if (sym->len == s->len && alias == sym)
					alias = s;

				if (sym->len >= s->len) {
					entry = tmp;
					break;
				}
			}
		}
		sym->alias = alias;
		list_add(&sym->list, entry);
		hash_add(sym->sec->symbol_hash, &sym->hash, sym->idx);
	}
+1 −1
Original line number Diff line number Diff line
@@ -61,7 +61,7 @@ struct symbol {
	unsigned char bind, type;
	unsigned long offset;
	unsigned int len;
	struct symbol *pfunc, *cfunc;
	struct symbol *pfunc, *cfunc, *alias;
};

struct rela {