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.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, see <http://www.gnu.org/licenses/>.
21 extern const char *objname;
23 static inline char *offstr(struct section *sec, unsigned long offset)
27 unsigned long name_off;
29 func = find_containing_func(sec, offset);
32 name_off = offset - func->offset;
38 str = malloc(strlen(name) + 20);
41 sprintf(str, "%s()+0x%lx", name, name_off);
43 sprintf(str, "%s+0x%lx", name, name_off);
48 #define WARN(format, ...) \
50 "%s: warning: objtool: " format "\n", \
51 objname, ##__VA_ARGS__)
53 #define WARN_FUNC(format, sec, offset, ...) \
55 char *_str = offstr(sec, offset); \
56 WARN("%s: " format, _str, ##__VA_ARGS__); \