Merge tag 'kbuild-v6.7' of git://git.kernel.org/pub/scm/linux/kernel/git/masahiroy/linux-kbuild
Pull Kbuild updates from Masahiro Yamada:
- Implement the binary search in modpost for faster symbol lookup
- Respect HOSTCC when linking host programs written in Rust
- Change the binrpm-pkg target to generate kernel-devel RPM package
- Fix endianness issues for tee and ishtp MODULE_DEVICE_TABLE
- Unify vdso_install rules
- Remove unused __memexit* annotations
- Eliminate stale whitelisting for __devinit/__devexit from modpost
- Enable dummy-tools to handle the -fpatchable-function-entry flag
- Add 'userldlibs' syntax
* tag 'kbuild-v6.7' of git://git.kernel.org/pub/scm/linux/kernel/git/masahiroy/linux-kbuild: (30 commits)
kbuild: support 'userldlibs' syntax
kbuild: dummy-tools: pretend we understand -fpatchable-function-entry
kbuild: Correct missing architecture-specific hyphens
modpost: squash ALL_{INIT,EXIT}_TEXT_SECTIONS to ALL_TEXT_SECTIONS
modpost: merge sectioncheck table entries regarding init/exit sections
modpost: use ALL_INIT_SECTIONS for the section check from DATA_SECTIONS
modpost: disallow the combination of EXPORT_SYMBOL and __meminit*
modpost: remove EXIT_SECTIONS macro
modpost: remove MEM_INIT_SECTIONS macro
modpost: remove more symbol patterns from the section check whitelist
modpost: disallow *driver to reference .meminit* sections
linux/init: remove __memexit* annotations
modpost: remove ALL_EXIT_DATA_SECTIONS macro
kbuild: simplify cmd_ld_multi_m
kbuild: avoid too many execution of scripts/pahole-flags.sh
kbuild: remove ARCH_POSTLINK from module builds
kbuild: unify no-compiler-targets and no-sync-config-targets
kbuild: unify vdso_install rules
docs: kbuild: add INSTALL_DTBS_PATH
UML: remove unused cmd_vdso_install
...
This commit is contained in:
+37
-13
@@ -1,4 +1,5 @@
|
||||
/* SPDX-License-Identifier: GPL-2.0 */
|
||||
#include <byteswap.h>
|
||||
#include <stdbool.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
@@ -10,6 +11,7 @@
|
||||
#include <fcntl.h>
|
||||
#include <unistd.h>
|
||||
#include <elf.h>
|
||||
#include "../../include/linux/module_symbol.h"
|
||||
|
||||
#include "list.h"
|
||||
#include "elfconfig.h"
|
||||
@@ -50,21 +52,19 @@
|
||||
#define ELF_R_TYPE ELF64_R_TYPE
|
||||
#endif
|
||||
|
||||
#define bswap(x) \
|
||||
({ \
|
||||
_Static_assert(sizeof(x) == 1 || sizeof(x) == 2 || \
|
||||
sizeof(x) == 4 || sizeof(x) == 8, "bug"); \
|
||||
(typeof(x))(sizeof(x) == 2 ? bswap_16(x) : \
|
||||
sizeof(x) == 4 ? bswap_32(x) : \
|
||||
sizeof(x) == 8 ? bswap_64(x) : \
|
||||
x); \
|
||||
})
|
||||
|
||||
#if KERNEL_ELFDATA != HOST_ELFDATA
|
||||
|
||||
static inline void __endian(const void *src, void *dest, unsigned int size)
|
||||
{
|
||||
unsigned int i;
|
||||
for (i = 0; i < size; i++)
|
||||
((unsigned char*)dest)[i] = ((unsigned char*)src)[size - i-1];
|
||||
}
|
||||
|
||||
#define TO_NATIVE(x) \
|
||||
({ \
|
||||
typeof(x) __x; \
|
||||
__endian(&(x), &(__x), sizeof(__x)); \
|
||||
__x; \
|
||||
})
|
||||
#define TO_NATIVE(x) (bswap(x))
|
||||
|
||||
#else /* endianness matches */
|
||||
|
||||
@@ -128,6 +128,8 @@ struct elf_info {
|
||||
* take shndx from symtab_shndx_start[N] instead */
|
||||
Elf32_Word *symtab_shndx_start;
|
||||
Elf32_Word *symtab_shndx_stop;
|
||||
|
||||
struct symsearch *symsearch;
|
||||
};
|
||||
|
||||
/* Accessor for sym->st_shndx, hides ugliness of "64k sections" */
|
||||
@@ -154,6 +156,28 @@ static inline unsigned int get_secindex(const struct elf_info *info,
|
||||
return index;
|
||||
}
|
||||
|
||||
/*
|
||||
* If there's no name there, ignore it; likewise, ignore it if it's
|
||||
* one of the magic symbols emitted used by current tools.
|
||||
*
|
||||
* Internal symbols created by tools should be ignored by modpost.
|
||||
*/
|
||||
static inline bool is_valid_name(struct elf_info *elf, Elf_Sym *sym)
|
||||
{
|
||||
const char *name = elf->strtab + sym->st_name;
|
||||
|
||||
if (!name || !strlen(name))
|
||||
return false;
|
||||
return !is_mapping_symbol(name);
|
||||
}
|
||||
|
||||
/* symsearch.c */
|
||||
void symsearch_init(struct elf_info *elf);
|
||||
void symsearch_finish(struct elf_info *elf);
|
||||
Elf_Sym *symsearch_find_nearest(struct elf_info *elf, Elf_Addr addr,
|
||||
unsigned int secndx, bool allow_negative,
|
||||
Elf_Addr min_distance);
|
||||
|
||||
/* file2alias.c */
|
||||
void handle_moddevtable(struct module *mod, struct elf_info *info,
|
||||
Elf_Sym *sym, const char *symname);
|
||||
|
||||
Reference in New Issue
Block a user