builtin-check.c (0ea5ad869c85ac604f3e022bf2c5bef54838433b) builtin-check.c (d0761e37fe3fed7810ed8d6e130b79359f0c3e13)
1/*
2 * Copyright (C) 2015 Josh Poimboeuf <jpoimboe@redhat.com>
3 *
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License
6 * as published by the Free Software Foundation; either version 2
7 * of the License, or (at your option) any later version.
8 *

--- 12 unchanged lines hidden (view full) ---

21 * This command analyzes every .o file and ensures the validity of its stack
22 * trace metadata. It enforces a set of rules on asm code and C inline
23 * assembly code so that stack traces can be reliable.
24 *
25 * For more information, see tools/objtool/Documentation/stack-validation.txt.
26 */
27
28#include <string.h>
1/*
2 * Copyright (C) 2015 Josh Poimboeuf <jpoimboe@redhat.com>
3 *
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License
6 * as published by the Free Software Foundation; either version 2
7 * of the License, or (at your option) any later version.
8 *

--- 12 unchanged lines hidden (view full) ---

21 * This command analyzes every .o file and ensures the validity of its stack
22 * trace metadata. It enforces a set of rules on asm code and C inline
23 * assembly code so that stack traces can be reliable.
24 *
25 * For more information, see tools/objtool/Documentation/stack-validation.txt.
26 */
27
28#include <string.h>
29#include <stdlib.h>
29#include <subcmd/parse-options.h>
30
31#include "builtin.h"
32#include "elf.h"
33#include "special.h"
34#include "arch.h"
35#include "warn.h"
36

--- 80 unchanged lines hidden (view full) ---

117 */
118static bool ignore_func(struct objtool_file *file, struct symbol *func)
119{
120 struct rela *rela;
121 struct instruction *insn;
122
123 /* check for STACK_FRAME_NON_STANDARD */
124 if (file->whitelist && file->whitelist->rela)
30#include <subcmd/parse-options.h>
31
32#include "builtin.h"
33#include "elf.h"
34#include "special.h"
35#include "arch.h"
36#include "warn.h"
37

--- 80 unchanged lines hidden (view full) ---

118 */
119static bool ignore_func(struct objtool_file *file, struct symbol *func)
120{
121 struct rela *rela;
122 struct instruction *insn;
123
124 /* check for STACK_FRAME_NON_STANDARD */
125 if (file->whitelist && file->whitelist->rela)
125 list_for_each_entry(rela, &file->whitelist->rela->rela_list, list) {
126 if (rela->sym->type == STT_SECTION &&
127 rela->sym->sec == func->sec &&
126 list_for_each_entry(rela, &file->whitelist->rela->rela_list, list)
127 if (rela->sym->sec == func->sec &&
128 rela->addend == func->offset)
129 return true;
128 rela->addend == func->offset)
129 return true;
130 if (rela->sym->type == STT_FUNC && rela->sym == func)
131 return true;
132 }
133
134 /* check if it has a context switching instruction */
135 func_for_each_insn(file, func, insn)
136 if (insn->type == INSN_CONTEXT_SWITCH)
137 return true;
138
139 return false;
140}

--- 1070 unchanged lines hidden ---
130
131 /* check if it has a context switching instruction */
132 func_for_each_insn(file, func, insn)
133 if (insn->type == INSN_CONTEXT_SWITCH)
134 return true;
135
136 return false;
137}

--- 1070 unchanged lines hidden ---