From: Mathieu Desnoyers Date: Wed, 17 Mar 2021 20:07:10 +0000 (-0400) Subject: ust-elf.h should be private, with public symbols X-Git-Tag: v2.13.0-rc1~255 X-Git-Url: https://git.liburcu.org/?a=commitdiff_plain;h=2adb7ad28124fdbc0ad61bcada1c7dbceb03e9ab;p=lttng-ust.git ust-elf.h should be private, with public symbols The symbols belonging to ust-elf.h need to be public, because liblttng-ust-dl uses them, but the header per se should be internal. Signed-off-by: Mathieu Desnoyers Change-Id: I04495249c0c8b80b251dbf2a7f5488d093a6d999 --- diff --git a/include/Makefile.am b/include/Makefile.am index 9fa16492..420ce3db 100644 --- a/include/Makefile.am +++ b/include/Makefile.am @@ -31,7 +31,6 @@ nobase_include_HEADERS = \ lttng/lttng-ust-tracelog.h \ lttng/ust-clock.h \ lttng/ust-getcpu.h \ - lttng/ust-elf.h \ lttng/ust-libc-wrapper.h \ lttng/urcu/pointer.h \ lttng/urcu/urcu-ust.h \ @@ -54,6 +53,7 @@ noinst_HEADERS = \ ust-bitmap.h \ ust-comm.h \ ust-compat.h \ + ust-elf.h \ ust-tid.h \ ust-bitfield.h \ ust-dlfcn.h \ diff --git a/include/lttng/ust-elf.h b/include/lttng/ust-elf.h deleted file mode 100644 index 29a9426f..00000000 --- a/include/lttng/ust-elf.h +++ /dev/null @@ -1,79 +0,0 @@ -/* - * SPDX-License-Identifier: LGPL-2.1-or-later - * - * Copyright (C) 2015 Antoine Busque - */ - -#ifndef _LTTNG_UST_ELF_H -#define _LTTNG_UST_ELF_H - -#include -#include -#include - -struct lttng_ust_elf_ehdr { - uint16_t e_type; - uint16_t e_machine; - uint32_t e_version; - uint64_t e_entry; - uint64_t e_phoff; - uint64_t e_shoff; - uint32_t e_flags; - uint16_t e_ehsize; - uint16_t e_phentsize; - uint16_t e_phnum; - uint16_t e_shentsize; - uint16_t e_shnum; - uint16_t e_shstrndx; -}; - -struct lttng_ust_elf_phdr { - uint32_t p_type; - uint64_t p_offset; - uint64_t p_filesz; - uint64_t p_memsz; - uint64_t p_align; - uint64_t p_vaddr; -}; - -struct lttng_ust_elf_shdr { - uint32_t sh_name; - uint32_t sh_type; - uint64_t sh_flags; - uint64_t sh_addr; - uint64_t sh_offset; - uint64_t sh_size; - uint32_t sh_link; - uint32_t sh_info; - uint64_t sh_addralign; - uint64_t sh_entsize; -}; - -struct lttng_ust_elf_nhdr { - uint32_t n_namesz; - uint32_t n_descsz; - uint32_t n_type; -}; - -struct lttng_ust_elf { - /* Offset in bytes to start of section names string table. */ - off_t section_names_offset; - /* Size in bytes of section names string table. */ - size_t section_names_size; - char *path; - int fd; - struct lttng_ust_elf_ehdr *ehdr; - uint8_t bitness; - uint8_t endianness; -}; - -struct lttng_ust_elf *lttng_ust_elf_create(const char *path); -void lttng_ust_elf_destroy(struct lttng_ust_elf *elf); -uint8_t lttng_ust_elf_is_pic(struct lttng_ust_elf *elf); -int lttng_ust_elf_get_memsz(struct lttng_ust_elf *elf, uint64_t *memsz); -int lttng_ust_elf_get_build_id(struct lttng_ust_elf *elf, uint8_t **build_id, - size_t *length, int *found); -int lttng_ust_elf_get_debug_link(struct lttng_ust_elf *elf, char **filename, - uint32_t *crc, int *found); - -#endif /* _LTTNG_UST_ELF_H */ diff --git a/include/ust-elf.h b/include/ust-elf.h new file mode 100644 index 00000000..29a9426f --- /dev/null +++ b/include/ust-elf.h @@ -0,0 +1,79 @@ +/* + * SPDX-License-Identifier: LGPL-2.1-or-later + * + * Copyright (C) 2015 Antoine Busque + */ + +#ifndef _LTTNG_UST_ELF_H +#define _LTTNG_UST_ELF_H + +#include +#include +#include + +struct lttng_ust_elf_ehdr { + uint16_t e_type; + uint16_t e_machine; + uint32_t e_version; + uint64_t e_entry; + uint64_t e_phoff; + uint64_t e_shoff; + uint32_t e_flags; + uint16_t e_ehsize; + uint16_t e_phentsize; + uint16_t e_phnum; + uint16_t e_shentsize; + uint16_t e_shnum; + uint16_t e_shstrndx; +}; + +struct lttng_ust_elf_phdr { + uint32_t p_type; + uint64_t p_offset; + uint64_t p_filesz; + uint64_t p_memsz; + uint64_t p_align; + uint64_t p_vaddr; +}; + +struct lttng_ust_elf_shdr { + uint32_t sh_name; + uint32_t sh_type; + uint64_t sh_flags; + uint64_t sh_addr; + uint64_t sh_offset; + uint64_t sh_size; + uint32_t sh_link; + uint32_t sh_info; + uint64_t sh_addralign; + uint64_t sh_entsize; +}; + +struct lttng_ust_elf_nhdr { + uint32_t n_namesz; + uint32_t n_descsz; + uint32_t n_type; +}; + +struct lttng_ust_elf { + /* Offset in bytes to start of section names string table. */ + off_t section_names_offset; + /* Size in bytes of section names string table. */ + size_t section_names_size; + char *path; + int fd; + struct lttng_ust_elf_ehdr *ehdr; + uint8_t bitness; + uint8_t endianness; +}; + +struct lttng_ust_elf *lttng_ust_elf_create(const char *path); +void lttng_ust_elf_destroy(struct lttng_ust_elf *elf); +uint8_t lttng_ust_elf_is_pic(struct lttng_ust_elf *elf); +int lttng_ust_elf_get_memsz(struct lttng_ust_elf *elf, uint64_t *memsz); +int lttng_ust_elf_get_build_id(struct lttng_ust_elf *elf, uint8_t **build_id, + size_t *length, int *found); +int lttng_ust_elf_get_debug_link(struct lttng_ust_elf *elf, char **filename, + uint32_t *crc, int *found); + +#endif /* _LTTNG_UST_ELF_H */ diff --git a/liblttng-ust-dl/lttng-ust-dl.c b/liblttng-ust-dl/lttng-ust-dl.c index 7d78f1d0..657c27cc 100644 --- a/liblttng-ust-dl/lttng-ust-dl.c +++ b/liblttng-ust-dl/lttng-ust-dl.c @@ -14,7 +14,7 @@ #include #include -#include +#include #include #include #include "usterr-signal-safe.h" diff --git a/liblttng-ust/lttng-ust-elf.c b/liblttng-ust/lttng-ust-elf.c index fc4029c9..ebc231e0 100644 --- a/liblttng-ust/lttng-ust-elf.c +++ b/liblttng-ust/lttng-ust-elf.c @@ -8,7 +8,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/liblttng-ust/lttng-ust-statedump.c b/liblttng-ust/lttng-ust-statedump.c index 91d8e279..98b80b35 100644 --- a/liblttng-ust/lttng-ust-statedump.c +++ b/liblttng-ust/lttng-ust-statedump.c @@ -16,7 +16,7 @@ #include #include -#include +#include #include #include "lttng-tracer-core.h" #include "lttng-ust-statedump.h" diff --git a/tests/unit/ust-elf/ust-elf.c b/tests/unit/ust-elf/ust-elf.c index 3ab1573e..a1230b20 100644 --- a/tests/unit/ust-elf/ust-elf.c +++ b/tests/unit/ust-elf/ust-elf.c @@ -10,7 +10,7 @@ #include #include -#include +#include #include "tap.h" #define NUM_ARCH 4