Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

objtool: Add annotype() helper

... for reading annotation types.

Acked-by: Petr Mladek <pmladek@suse.com>
Tested-by: Joe Lawrence <joe.lawrence@redhat.com>
Signed-off-by: Josh Poimboeuf <jpoimboe@kernel.org>

+18 -16
-1
tools/objtool/arch/loongarch/orc.c
··· 5 5 #include <objtool/check.h> 6 6 #include <objtool/orc.h> 7 7 #include <objtool/warn.h> 8 - #include <objtool/endianness.h> 9 8 10 9 int init_orc_entry(struct orc_entry *orc, struct cfi_state *cfi, struct instruction *insn) 11 10 {
-1
tools/objtool/arch/powerpc/decode.c
··· 7 7 #include <objtool/arch.h> 8 8 #include <objtool/warn.h> 9 9 #include <objtool/builtin.h> 10 - #include <objtool/endianness.h> 11 10 12 11 int arch_ftrace_match(const char *name) 13 12 {
-1
tools/objtool/arch/x86/decode.c
··· 19 19 #include <objtool/elf.h> 20 20 #include <objtool/arch.h> 21 21 #include <objtool/warn.h> 22 - #include <objtool/endianness.h> 23 22 #include <objtool/builtin.h> 24 23 #include <arch/elf.h> 25 24
-1
tools/objtool/arch/x86/orc.c
··· 5 5 #include <objtool/check.h> 6 6 #include <objtool/orc.h> 7 7 #include <objtool/warn.h> 8 - #include <objtool/endianness.h> 9 8 10 9 int init_orc_entry(struct orc_entry *orc, struct cfi_state *cfi, struct instruction *insn) 11 10 {
+1 -4
tools/objtool/check.c
··· 14 14 #include <objtool/check.h> 15 15 #include <objtool/special.h> 16 16 #include <objtool/warn.h> 17 - #include <objtool/endianness.h> 18 17 19 18 #include <linux/objtool_types.h> 20 19 #include <linux/hashtable.h> ··· 2272 2273 } 2273 2274 2274 2275 for_each_reloc(sec->rsec, reloc) { 2275 - type = *(u32 *)(sec->data->d_buf + (reloc_idx(reloc) * sec->sh.sh_entsize) + 4); 2276 - type = bswap_if_needed(file->elf, type); 2277 - 2276 + type = annotype(file->elf, sec, reloc); 2278 2277 offset = reloc->sym->offset + reloc_addend(reloc); 2279 2278 insn = find_insn(file, reloc->sym->sec, offset); 2280 2279
+13
tools/objtool/include/objtool/elf.h
··· 13 13 #include <linux/hashtable.h> 14 14 #include <linux/rbtree.h> 15 15 #include <linux/jhash.h> 16 + 17 + #include <objtool/endianness.h> 16 18 #include <arch/elf.h> 17 19 18 20 #define SYM_NAME_LEN 512 21 + 22 + #define bswap_if_needed(elf, val) __bswap_if_needed(&elf->ehdr, val) 19 23 20 24 #ifdef LIBELF_USE_DEPRECATED 21 25 # define elf_getshdrnum elf_getshnum ··· 403 399 __set_reloc_field(reloc, r_info, info); 404 400 405 401 mark_sec_changed(elf, reloc->sec, true); 402 + } 403 + 404 + static inline unsigned int annotype(struct elf *elf, struct section *sec, 405 + struct reloc *reloc) 406 + { 407 + unsigned int type; 408 + 409 + type = *(u32 *)(sec->data->d_buf + (reloc_idx(reloc) * 8) + 4); 410 + return bswap_if_needed(elf, type); 406 411 } 407 412 408 413 #define RELOC_JUMP_TABLE_BIT 1UL
+4 -5
tools/objtool/include/objtool/endianness.h
··· 4 4 5 5 #include <linux/kernel.h> 6 6 #include <endian.h> 7 - #include <objtool/elf.h> 8 7 9 8 /* 10 9 * Does a byte swap if target file endianness doesn't match the host, i.e. cross ··· 11 12 * To be used for multi-byte values conversion, which are read from / about 12 13 * to be written to a target native endianness ELF file. 13 14 */ 14 - static inline bool need_bswap(struct elf *elf) 15 + static inline bool need_bswap(GElf_Ehdr *ehdr) 15 16 { 16 17 return (__BYTE_ORDER == __LITTLE_ENDIAN) ^ 17 - (elf->ehdr.e_ident[EI_DATA] == ELFDATA2LSB); 18 + (ehdr->e_ident[EI_DATA] == ELFDATA2LSB); 18 19 } 19 20 20 - #define bswap_if_needed(elf, val) \ 21 + #define __bswap_if_needed(ehdr, val) \ 21 22 ({ \ 22 23 __typeof__(val) __ret; \ 23 - bool __need_bswap = need_bswap(elf); \ 24 + bool __need_bswap = need_bswap(ehdr); \ 24 25 switch (sizeof(val)) { \ 25 26 case 8: \ 26 27 __ret = __need_bswap ? bswap_64(val) : (val); break; \
-1
tools/objtool/orc_dump.c
··· 8 8 #include <objtool/objtool.h> 9 9 #include <objtool/orc.h> 10 10 #include <objtool/warn.h> 11 - #include <objtool/endianness.h> 12 11 13 12 int orc_dump(const char *filename) 14 13 {
-1
tools/objtool/orc_gen.c
··· 12 12 #include <objtool/check.h> 13 13 #include <objtool/orc.h> 14 14 #include <objtool/warn.h> 15 - #include <objtool/endianness.h> 16 15 17 16 struct orc_list_entry { 18 17 struct list_head list;
-1
tools/objtool/special.c
··· 15 15 #include <objtool/builtin.h> 16 16 #include <objtool/special.h> 17 17 #include <objtool/warn.h> 18 - #include <objtool/endianness.h> 19 18 20 19 struct special_entry { 21 20 const char *sec;