Server IP : 80.87.202.40 / Your IP : 216.73.216.169 Web Server : Apache System : Linux rospirotorg.ru 5.14.0-539.el9.x86_64 #1 SMP PREEMPT_DYNAMIC Thu Dec 5 22:26:13 UTC 2024 x86_64 User : bitrix ( 600) PHP Version : 8.2.27 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : ON Directory : /usr/src/kernels/5.14.0-570.el9.x86_64/tools/objtool/include/objtool/ |
Upload File : |
/* SPDX-License-Identifier: GPL-2.0-or-later */ /* * Copyright (C) 2015 Josh Poimboeuf <jpoimboe@redhat.com> */ #ifndef _WARN_H #define _WARN_H #include <stdlib.h> #include <string.h> #include <sys/types.h> #include <sys/stat.h> #include <fcntl.h> #include <objtool/builtin.h> #include <objtool/elf.h> extern const char *objname; static inline char *offstr(struct section *sec, unsigned long offset) { bool is_text = (sec->sh.sh_flags & SHF_EXECINSTR); struct symbol *sym = NULL; char *str; int len; if (is_text) sym = find_func_containing(sec, offset); if (!sym) sym = find_symbol_containing(sec, offset); if (sym) { str = malloc(strlen(sym->name) + strlen(sec->name) + 40); len = sprintf(str, "%s+0x%lx", sym->name, offset - sym->offset); if (opts.sec_address) sprintf(str+len, " (%s+0x%lx)", sec->name, offset); } else { str = malloc(strlen(sec->name) + 20); sprintf(str, "%s+0x%lx", sec->name, offset); } return str; } #define WARN(format, ...) \ fprintf(stderr, \ "%s: warning: objtool: " format "\n", \ objname, ##__VA_ARGS__) #define WARN_FUNC(format, sec, offset, ...) \ ({ \ char *_str = offstr(sec, offset); \ WARN("%s: " format, _str, ##__VA_ARGS__); \ free(_str); \ }) #define BT_FUNC(format, insn, ...) \ ({ \ struct instruction *_insn = (insn); \ char *_str = offstr(_insn->sec, _insn->offset); \ WARN(" %s: " format, _str, ##__VA_ARGS__); \ free(_str); \ }) #define WARN_ELF(format, ...) \ WARN(format ": %s", ##__VA_ARGS__, elf_errmsg(-1)) #endif /* _WARN_H */