From ea17e2b0433f78f2972004b0850fa8a440fe5333 Mon Sep 17 00:00:00 2001 From: Lucas De Marchi Date: Thu, 26 Jan 2012 01:21:17 -0200 Subject: [PATCH] elf: privately export kmod_elf_get_section() This function is used to find a certain section in ELF file. It will be used to get the modname from an ELF file. --- libkmod/libkmod-elf.c | 2 +- libkmod/libkmod-private.h | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/libkmod/libkmod-elf.c b/libkmod/libkmod-elf.c index 72e3c5f7..1f47e075 100644 --- a/libkmod/libkmod-elf.c +++ b/libkmod/libkmod-elf.c @@ -375,7 +375,7 @@ const void *kmod_elf_get_memory(const struct kmod_elf *elf) return elf->memory; } -static int kmod_elf_get_section(const struct kmod_elf *elf, const char *section, const void **buf, uint64_t *buf_size) +int kmod_elf_get_section(const struct kmod_elf *elf, const char *section, const void **buf, uint64_t *buf_size) { uint64_t nameslen; const char *names = elf_get_strings_section(elf, &nameslen); diff --git a/libkmod/libkmod-private.h b/libkmod/libkmod-private.h index 55c7206b..274cb1d0 100644 --- a/libkmod/libkmod-private.h +++ b/libkmod/libkmod-private.h @@ -164,6 +164,12 @@ int kmod_elf_get_dependency_symbols(const struct kmod_elf *elf, struct kmod_modv int kmod_elf_strip_section(struct kmod_elf *elf, const char *section) __must_check __attribute__((nonnull(1,2))); int kmod_elf_strip_vermagic(struct kmod_elf *elf) __must_check __attribute__((nonnull(1))); +/* + * Debug mock lib need to find section ".gnu.linkonce.this_module" in order to + * get modname + */ +int kmod_elf_get_section(const struct kmod_elf *elf, const char *section, const void **buf, uint64_t *buf_size) __must_check __attribute__((nonnull(1,2,3,4))); + /* util functions */ #include "libkmod-util.h" -- 2.47.2