From: tip-bot for Josh Poimboeuf <tipbot@zytor.com>
To: linux-tip-commits@vger.kernel.org
Cc: palves@redhat.com, akpm@linux-foundation.org,
peterz@infradead.org, chris.j.arges@canonical.com, hpa@zytor.com,
mingo@kernel.org, bernd@petrovitsch.priv.at, acme@infradead.org,
luto@kernel.org, linux-kernel@vger.kernel.org, jslaby@suse.cz,
namhyung@gmail.com, torvalds@linux-foundation.org,
acme@kernel.org, bp@alien8.de, mmarek@suse.cz,
jpoimboe@redhat.com, tglx@linutronix.de
Subject: [tip:core/objtool] objtool: Rename some variables and functions
Date: Wed, 9 Mar 2016 03:45:06 -0800 [thread overview]
Message-ID: <tip-a196e17198224cacd2d992f12cb6d81d354de82f@git.kernel.org> (raw)
In-Reply-To: <ee0eca2bba8482aa45758958c5586c00a7b71e62.1457502970.git.jpoimboe@redhat.com>
Commit-ID: a196e17198224cacd2d992f12cb6d81d354de82f
Gitweb: http://git.kernel.org/tip/a196e17198224cacd2d992f12cb6d81d354de82f
Author: Josh Poimboeuf <jpoimboe@redhat.com>
AuthorDate: Wed, 9 Mar 2016 00:06:57 -0600
Committer: Ingo Molnar <mingo@kernel.org>
CommitDate: Wed, 9 Mar 2016 10:48:09 +0100
objtool: Rename some variables and functions
Rename some list heads to distinguish them from hash node heads, which
are added later in the patch series.
Also rename the get_*() functions to add_*(), which is more descriptive:
they "add" data to the objtool_file struct.
Also rename rodata_rela and text_rela to be clearer:
- text_rela refers to a rela entry in .rela.text.
- rodata_rela refers to a rela entry in .rela.rodata.
Signed-off-by: Josh Poimboeuf <jpoimboe@redhat.com>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Andy Lutomirski <luto@kernel.org>
Cc: Arnaldo Carvalho de Melo <acme@infradead.org>
Cc: Arnaldo Carvalho de Melo <acme@kernel.org>
Cc: Bernd Petrovitsch <bernd@petrovitsch.priv.at>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Chris J Arges <chris.j.arges@canonical.com>
Cc: Jiri Slaby <jslaby@suse.cz>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Michal Marek <mmarek@suse.cz>
Cc: Namhyung Kim <namhyung@gmail.com>
Cc: Pedro Alves <palves@redhat.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: live-patching@vger.kernel.org
Link: http://lkml.kernel.org/r/ee0eca2bba8482aa45758958c5586c00a7b71e62.1457502970.git.jpoimboe@redhat.com
Signed-off-by: Ingo Molnar <mingo@kernel.org>
---
tools/objtool/builtin-check.c | 80 ++++++++++++++++++++++---------------------
tools/objtool/elf.c | 22 ++++++------
tools/objtool/elf.h | 4 +--
3 files changed, 54 insertions(+), 52 deletions(-)
diff --git a/tools/objtool/builtin-check.c b/tools/objtool/builtin-check.c
index a974f295..cdbdd7d 100644
--- a/tools/objtool/builtin-check.c
+++ b/tools/objtool/builtin-check.c
@@ -60,7 +60,7 @@ struct alternative {
struct objtool_file {
struct elf *elf;
- struct list_head insns;
+ struct list_head insn_list;
};
const char *objname;
@@ -71,7 +71,7 @@ static struct instruction *find_insn(struct objtool_file *file,
{
struct instruction *insn;
- list_for_each_entry(insn, &file->insns, list)
+ list_for_each_entry(insn, &file->insn_list, list)
if (insn->sec == sec && insn->offset == offset)
return insn;
@@ -83,18 +83,18 @@ static struct instruction *next_insn_same_sec(struct objtool_file *file,
{
struct instruction *next = list_next_entry(insn, list);
- if (&next->list == &file->insns || next->sec != insn->sec)
+ if (&next->list == &file->insn_list || next->sec != insn->sec)
return NULL;
return next;
}
#define for_each_insn(file, insn) \
- list_for_each_entry(insn, &file->insns, list)
+ list_for_each_entry(insn, &file->insn_list, list)
#define func_for_each_insn(file, func, insn) \
for (insn = find_insn(file, func->sec, func->offset); \
- insn && &insn->list != &file->insns && \
+ insn && &insn->list != &file->insn_list && \
insn->sec == func->sec && \
insn->offset < func->offset + func->len; \
insn = list_next_entry(insn, list))
@@ -117,7 +117,7 @@ static bool ignore_func(struct objtool_file *file, struct symbol *func)
/* check for STACK_FRAME_NON_STANDARD */
macro_sec = find_section_by_name(file->elf, "__func_stack_frame_non_standard");
if (macro_sec && macro_sec->rela)
- list_for_each_entry(rela, ¯o_sec->rela->relas, list)
+ list_for_each_entry(rela, ¯o_sec->rela->rela_list, list)
if (rela->sym->sec == func->sec &&
rela->addend == func->offset)
return true;
@@ -240,7 +240,7 @@ static int dead_end_function(struct objtool_file *file, struct symbol *func)
/*
* Call the arch-specific instruction decoder for all the instructions and add
- * them to the global insns list.
+ * them to the global instruction list.
*/
static int decode_instructions(struct objtool_file *file)
{
@@ -275,7 +275,7 @@ static int decode_instructions(struct objtool_file *file)
return -1;
}
- list_add_tail(&insn->list, &file->insns);
+ list_add_tail(&insn->list, &file->insn_list);
}
}
@@ -285,14 +285,14 @@ static int decode_instructions(struct objtool_file *file)
/*
* Warnings shouldn't be reported for ignored functions.
*/
-static void get_ignores(struct objtool_file *file)
+static void add_ignores(struct objtool_file *file)
{
struct instruction *insn;
struct section *sec;
struct symbol *func;
list_for_each_entry(sec, &file->elf->sections, list) {
- list_for_each_entry(func, &sec->symbols, list) {
+ list_for_each_entry(func, &sec->symbol_list, list) {
if (func->type != STT_FUNC)
continue;
@@ -308,7 +308,7 @@ static void get_ignores(struct objtool_file *file)
/*
* Find the destination instructions for all jumps.
*/
-static int get_jump_destinations(struct objtool_file *file)
+static int add_jump_destinations(struct objtool_file *file)
{
struct instruction *insn;
struct rela *rela;
@@ -365,7 +365,7 @@ static int get_jump_destinations(struct objtool_file *file)
/*
* Find the destination instructions for all calls.
*/
-static int get_call_destinations(struct objtool_file *file)
+static int add_call_destinations(struct objtool_file *file)
{
struct instruction *insn;
unsigned long dest_off;
@@ -534,7 +534,7 @@ static int handle_jump_alt(struct objtool_file *file,
* instruction(s) has them added to its insn->alts list, which will be
* traversed in validate_branch().
*/
-static int get_special_section_alts(struct objtool_file *file)
+static int add_special_section_alts(struct objtool_file *file)
{
struct list_head special_alts;
struct instruction *orig_insn, *new_insn;
@@ -604,10 +604,10 @@ out:
* section which contains a list of addresses within the function to jump to.
* This finds these jump tables and adds them to the insn->alts lists.
*/
-static int get_switch_alts(struct objtool_file *file)
+static int add_switch_table_alts(struct objtool_file *file)
{
struct instruction *insn, *alt_insn;
- struct rela *rodata_rela, *rela;
+ struct rela *rodata_rela, *text_rela;
struct section *rodata;
struct symbol *func;
struct alternative *alt;
@@ -616,9 +616,9 @@ static int get_switch_alts(struct objtool_file *file)
if (insn->type != INSN_JUMP_DYNAMIC)
continue;
- rodata_rela = find_rela_by_dest_range(insn->sec, insn->offset,
- insn->len);
- if (!rodata_rela || strcmp(rodata_rela->sym->name, ".rodata"))
+ text_rela = find_rela_by_dest_range(insn->sec, insn->offset,
+ insn->len);
+ if (!text_rela || strcmp(text_rela->sym->name, ".rodata"))
continue;
rodata = find_section_by_name(file->elf, ".rodata");
@@ -626,13 +626,13 @@ static int get_switch_alts(struct objtool_file *file)
continue;
/* common case: jmpq *[addr](,%rax,8) */
- rela = find_rela_by_dest(rodata, rodata_rela->addend);
+ rodata_rela = find_rela_by_dest(rodata, text_rela->addend);
/* rare case: jmpq *[addr](%rip) */
- if (!rela)
- rela = find_rela_by_dest(rodata,
- rodata_rela->addend + 4);
- if (!rela)
+ if (!rodata_rela)
+ rodata_rela = find_rela_by_dest(rodata,
+ text_rela->addend + 4);
+ if (!rodata_rela)
continue;
func = find_containing_func(insn->sec, insn->offset);
@@ -642,17 +642,19 @@ static int get_switch_alts(struct objtool_file *file)
return -1;
}
- list_for_each_entry_from(rela, &rodata->rela->relas, list) {
- if (rela->sym->sec != insn->sec ||
- rela->addend <= func->offset ||
- rela->addend >= func->offset + func->len)
+ list_for_each_entry_from(rodata_rela, &rodata->rela->rela_list,
+ list) {
+ if (rodata_rela->sym->sec != insn->sec ||
+ rodata_rela->addend <= func->offset ||
+ rodata_rela->addend >= func->offset + func->len)
break;
- alt_insn = find_insn(file, insn->sec, rela->addend);
+ alt_insn = find_insn(file, insn->sec,
+ rodata_rela->addend);
if (!alt_insn) {
WARN("%s: can't find instruction at %s+0x%x",
rodata->rela->name, insn->sec->name,
- rela->addend);
+ rodata_rela->addend);
return -1;
}
@@ -678,21 +680,21 @@ static int decode_sections(struct objtool_file *file)
if (ret)
return ret;
- get_ignores(file);
+ add_ignores(file);
- ret = get_jump_destinations(file);
+ ret = add_jump_destinations(file);
if (ret)
return ret;
- ret = get_call_destinations(file);
+ ret = add_call_destinations(file);
if (ret)
return ret;
- ret = get_special_section_alts(file);
+ ret = add_special_section_alts(file);
if (ret)
return ret;
- ret = get_switch_alts(file);
+ ret = add_switch_table_alts(file);
if (ret)
return ret;
@@ -901,7 +903,7 @@ static bool is_gcov_insn(struct instruction *insn)
sec = rela->sym->sec;
offset = rela->addend + insn->offset + insn->len - rela->offset;
- list_for_each_entry(sym, &sec->symbols, list) {
+ list_for_each_entry(sym, &sec->symbol_list, list) {
if (sym->type != STT_OBJECT)
continue;
@@ -968,7 +970,7 @@ static int validate_functions(struct objtool_file *file)
int ret, warnings = 0;
list_for_each_entry(sec, &file->elf->sections, list) {
- list_for_each_entry(func, &sec->symbols, list) {
+ list_for_each_entry(func, &sec->symbol_list, list) {
if (func->type != STT_FUNC)
continue;
@@ -986,7 +988,7 @@ static int validate_functions(struct objtool_file *file)
}
list_for_each_entry(sec, &file->elf->sections, list) {
- list_for_each_entry(func, &sec->symbols, list) {
+ list_for_each_entry(func, &sec->symbol_list, list) {
if (func->type != STT_FUNC)
continue;
@@ -1028,7 +1030,7 @@ static void cleanup(struct objtool_file *file)
struct instruction *insn, *tmpinsn;
struct alternative *alt, *tmpalt;
- list_for_each_entry_safe(insn, tmpinsn, &file->insns, list) {
+ list_for_each_entry_safe(insn, tmpinsn, &file->insn_list, list) {
list_for_each_entry_safe(alt, tmpalt, &insn->alts, list) {
list_del(&alt->list);
free(alt);
@@ -1067,7 +1069,7 @@ int cmd_check(int argc, const char **argv)
return 1;
}
- INIT_LIST_HEAD(&file.insns);
+ INIT_LIST_HEAD(&file.insn_list);
ret = decode_sections(&file);
if (ret < 0)
diff --git a/tools/objtool/elf.c b/tools/objtool/elf.c
index d547e3f..7de243f 100644
--- a/tools/objtool/elf.c
+++ b/tools/objtool/elf.c
@@ -59,7 +59,7 @@ static struct symbol *find_symbol_by_index(struct elf *elf, unsigned int idx)
struct symbol *sym;
list_for_each_entry(sec, &elf->sections, list)
- list_for_each_entry(sym, &sec->symbols, list)
+ list_for_each_entry(sym, &sec->symbol_list, list)
if (sym->idx == idx)
return sym;
@@ -70,7 +70,7 @@ struct symbol *find_symbol_by_offset(struct section *sec, unsigned long offset)
{
struct symbol *sym;
- list_for_each_entry(sym, &sec->symbols, list)
+ list_for_each_entry(sym, &sec->symbol_list, list)
if (sym->type != STT_SECTION &&
sym->offset == offset)
return sym;
@@ -86,7 +86,7 @@ struct rela *find_rela_by_dest_range(struct section *sec, unsigned long offset,
if (!sec->rela)
return NULL;
- list_for_each_entry(rela, &sec->rela->relas, list)
+ list_for_each_entry(rela, &sec->rela->rela_list, list)
if (rela->offset >= offset && rela->offset < offset + len)
return rela;
@@ -102,7 +102,7 @@ struct symbol *find_containing_func(struct section *sec, unsigned long offset)
{
struct symbol *func;
- list_for_each_entry(func, &sec->symbols, list)
+ list_for_each_entry(func, &sec->symbol_list, list)
if (func->type == STT_FUNC && offset >= func->offset &&
offset < func->offset + func->len)
return func;
@@ -135,8 +135,8 @@ static int read_sections(struct elf *elf)
}
memset(sec, 0, sizeof(*sec));
- INIT_LIST_HEAD(&sec->symbols);
- INIT_LIST_HEAD(&sec->relas);
+ INIT_LIST_HEAD(&sec->symbol_list);
+ INIT_LIST_HEAD(&sec->rela_list);
list_add_tail(&sec->list, &elf->sections);
@@ -244,8 +244,8 @@ static int read_symbols(struct elf *elf)
sym->len = sym->sym.st_size;
/* sorted insert into a per-section list */
- entry = &sym->sec->symbols;
- list_for_each_prev(tmp, &sym->sec->symbols) {
+ entry = &sym->sec->symbol_list;
+ list_for_each_prev(tmp, &sym->sec->symbol_list) {
struct symbol *s;
s = list_entry(tmp, struct symbol, list);
@@ -298,7 +298,7 @@ static int read_relas(struct elf *elf)
}
memset(rela, 0, sizeof(*rela));
- list_add_tail(&rela->list, &sec->relas);
+ list_add_tail(&rela->list, &sec->rela_list);
if (!gelf_getrela(sec->elf_data, i, &rela->rela)) {
perror("gelf_getrela");
@@ -382,11 +382,11 @@ void elf_close(struct elf *elf)
struct rela *rela, *tmprela;
list_for_each_entry_safe(sec, tmpsec, &elf->sections, list) {
- list_for_each_entry_safe(sym, tmpsym, &sec->symbols, list) {
+ list_for_each_entry_safe(sym, tmpsym, &sec->symbol_list, list) {
list_del(&sym->list);
free(sym);
}
- list_for_each_entry_safe(rela, tmprela, &sec->relas, list) {
+ list_for_each_entry_safe(rela, tmprela, &sec->rela_list, list) {
list_del(&rela->list);
free(rela);
}
diff --git a/tools/objtool/elf.h b/tools/objtool/elf.h
index 66919de..57e4653 100644
--- a/tools/objtool/elf.h
+++ b/tools/objtool/elf.h
@@ -25,8 +25,8 @@
struct section {
struct list_head list;
GElf_Shdr sh;
- struct list_head symbols;
- struct list_head relas;
+ struct list_head symbol_list;
+ struct list_head rela_list;
struct section *base, *rela;
struct symbol *sym;
Elf_Data *elf_data;
next prev parent reply other threads:[~2016-03-09 11:46 UTC|newest]
Thread overview: 55+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-02-29 4:22 [PATCH v19 00/10] Compile-time stack metadata validation Josh Poimboeuf
2016-02-29 4:22 ` [PATCH v19 01/10] objtool: Mark non-standard files and directories Josh Poimboeuf
2016-02-29 10:58 ` [tip:core/objtool] objtool: Mark non-standard object " tip-bot for Josh Poimboeuf
2016-02-29 4:22 ` [PATCH v19 02/10] objtool: Add STACK_FRAME_NON_STANDARD macro Josh Poimboeuf
2016-02-29 10:58 ` [tip:core/objtool] objtool: Add STACK_FRAME_NON_STANDARD() macro tip-bot for Josh Poimboeuf
2016-02-29 4:22 ` [PATCH v19 03/10] x86/xen: Mark xen_cpuid() stack frame as non-standard Josh Poimboeuf
2016-02-29 10:59 ` [tip:core/objtool] " tip-bot for Josh Poimboeuf
2016-02-29 4:22 ` [PATCH v19 04/10] bpf: Mark __bpf_prog_run() " Josh Poimboeuf
2016-02-29 10:59 ` [tip:core/objtool] " tip-bot for Josh Poimboeuf
2016-02-29 4:22 ` [PATCH v19 05/10] sched: Mark __schedule() " Josh Poimboeuf
2016-02-29 10:59 ` [tip:core/objtool] " tip-bot for Josh Poimboeuf
2016-02-29 4:22 ` [PATCH v19 06/10] sched: always inline context_switch() Josh Poimboeuf
2016-02-29 11:00 ` [tip:core/objtool] sched: Always " tip-bot for Josh Poimboeuf
2016-02-29 4:22 ` [PATCH v19 07/10] x86/kprobes: Mark kretprobe_trampoline() stack frame as non-standard Josh Poimboeuf
2016-02-29 11:00 ` [tip:core/objtool] " tip-bot for Josh Poimboeuf
2016-02-29 4:22 ` [PATCH v19 08/10] objtool: Compile-time stack metadata validation Josh Poimboeuf
2016-02-29 11:01 ` [tip:core/objtool] objtool: Add tool to perform compile-time " tip-bot for Josh Poimboeuf
2016-02-29 4:22 ` [PATCH v19 09/10] objtool: Add CONFIG_STACK_VALIDATION option Josh Poimboeuf
2016-02-29 11:01 ` [tip:core/objtool] " tip-bot for Josh Poimboeuf
2016-03-03 14:12 ` Sebastian Andrzej Siewior
2016-03-03 14:56 ` Josh Poimboeuf
2016-02-29 4:22 ` [PATCH v19 10/10] objtool: Enable stack metadata validation on x86_64 Josh Poimboeuf
2016-02-29 11:01 ` [tip:core/objtool] objtool: Enable stack metadata validation on 64-bit x86 tip-bot for Josh Poimboeuf
2016-03-08 10:37 ` [PATCH v19 00/10] Compile-time stack metadata validation Ingo Molnar
2016-03-08 12:29 ` Josh Poimboeuf
2016-03-08 13:44 ` Ingo Molnar
2016-03-08 14:21 ` Josh Poimboeuf
2016-03-08 15:15 ` Ingo Molnar
2016-03-08 15:49 ` Ingo Molnar
2016-03-09 6:06 ` [PATCH 00/11] Various objtool fixes Josh Poimboeuf
2016-03-09 6:06 ` [PATCH 01/11] objtool: Prevent infinite recursion in noreturn detection Josh Poimboeuf
2016-03-09 11:42 ` [tip:core/objtool] " tip-bot for Josh Poimboeuf
2016-03-09 6:06 ` [PATCH 02/11] objtool: Detect infinite recursion Josh Poimboeuf
2016-03-09 11:43 ` [tip:core/objtool] " tip-bot for Josh Poimboeuf
2016-03-09 6:06 ` [PATCH 03/11] objtool: Compile with debugging symbols Josh Poimboeuf
2016-03-09 11:43 ` [tip:core/objtool] " tip-bot for Josh Poimboeuf
2016-03-09 6:06 ` [PATCH 04/11] objtool: Fix false positive warnings related to sibling calls Josh Poimboeuf
2016-03-09 11:43 ` [tip:core/objtool] " tip-bot for Josh Poimboeuf
2016-03-09 6:06 ` [PATCH 05/11] objtool: Add helper macros for traversing instructions Josh Poimboeuf
2016-03-09 11:44 ` [tip:core/objtool] " tip-bot for Josh Poimboeuf
2016-03-09 6:06 ` [PATCH 06/11] objtool: Remove superflous INIT_LIST_HEAD Josh Poimboeuf
2016-03-09 11:44 ` [tip:core/objtool] " tip-bot for Josh Poimboeuf
2016-03-09 6:06 ` [PATCH 07/11] objtool: Rename some variables and functions Josh Poimboeuf
2016-03-09 11:45 ` tip-bot for Josh Poimboeuf [this message]
2016-03-09 6:06 ` [PATCH 08/11] objtool: Fix false positive warnings for functions with multiple switch statements Josh Poimboeuf
2016-03-09 11:45 ` [tip:core/objtool] " tip-bot for Josh Poimboeuf
2016-03-09 6:06 ` [PATCH 09/11] tools/objtool: Copy hashtable.h into tools directory Josh Poimboeuf
2016-03-09 9:47 ` Ingo Molnar
2016-03-09 16:09 ` Josh Poimboeuf
2016-03-09 18:39 ` Ingo Molnar
2016-03-09 11:45 ` [tip:core/objtool] tools: " tip-bot for Josh Poimboeuf
2016-03-09 6:07 ` [PATCH 10/11] objtool: Add several performance improvements Josh Poimboeuf
2016-03-09 11:46 ` [tip:core/objtool] " tip-bot for Josh Poimboeuf
2016-03-09 6:07 ` [PATCH 11/11] objtool: Only print one warning per function Josh Poimboeuf
2016-03-09 11:46 ` [tip:core/objtool] " tip-bot for Josh Poimboeuf
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=tip-a196e17198224cacd2d992f12cb6d81d354de82f@git.kernel.org \
--to=tipbot@zytor.com \
--cc=acme@infradead.org \
--cc=acme@kernel.org \
--cc=akpm@linux-foundation.org \
--cc=bernd@petrovitsch.priv.at \
--cc=bp@alien8.de \
--cc=chris.j.arges@canonical.com \
--cc=hpa@zytor.com \
--cc=jpoimboe@redhat.com \
--cc=jslaby@suse.cz \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-tip-commits@vger.kernel.org \
--cc=luto@kernel.org \
--cc=mingo@kernel.org \
--cc=mmarek@suse.cz \
--cc=namhyung@gmail.com \
--cc=palves@redhat.com \
--cc=peterz@infradead.org \
--cc=tglx@linutronix.de \
--cc=torvalds@linux-foundation.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.