ust-elf.h should be private, with public symbols
authorMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Wed, 17 Mar 2021 20:07:10 +0000 (16:07 -0400)
committerMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Wed, 17 Mar 2021 20:10:01 +0000 (16:10 -0400)
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 <mathieu.desnoyers@efficios.com>
Change-Id: I04495249c0c8b80b251dbf2a7f5488d093a6d999

include/Makefile.am
include/lttng/ust-elf.h [deleted file]
include/ust-elf.h [new file with mode: 0644]
liblttng-ust-dl/lttng-ust-dl.c
liblttng-ust/lttng-ust-elf.c
liblttng-ust/lttng-ust-statedump.c
tests/unit/ust-elf/ust-elf.c

index 9fa16492e1cbcfa5d848bda6586c324857035cac..420ce3db171c1a8017d70b5ee3c338ce467a708b 100644 (file)
@@ -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 (file)
index 29a9426..0000000
+++ /dev/null
@@ -1,79 +0,0 @@
-/*
- * SPDX-License-Identifier: LGPL-2.1-or-later
- *
- * Copyright (C) 2015 Antoine Busque <abusque@efficios.com>
- */
-
-#ifndef _LTTNG_UST_ELF_H
-#define _LTTNG_UST_ELF_H
-
-#include <stdlib.h>
-#include <stdint.h>
-#include <stdio.h>
-
-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 (file)
index 0000000..29a9426
--- /dev/null
@@ -0,0 +1,79 @@
+/*
+ * SPDX-License-Identifier: LGPL-2.1-or-later
+ *
+ * Copyright (C) 2015 Antoine Busque <abusque@efficios.com>
+ */
+
+#ifndef _LTTNG_UST_ELF_H
+#define _LTTNG_UST_ELF_H
+
+#include <stdlib.h>
+#include <stdint.h>
+#include <stdio.h>
+
+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 */
index 7d78f1d06ef0e77cca51e3dcdbde3f06659c9e72..657c27ccc9afab4ada4373bc76c10c3c012a31fe 100644 (file)
@@ -14,7 +14,7 @@
 #include <unistd.h>
 
 #include <ust-dlfcn.h>
-#include <lttng/ust-elf.h>
+#include <ust-elf.h>
 #include <lttng/ust-events.h>
 #include <ust-helper.h>
 #include "usterr-signal-safe.h"
index fc4029c93c78377d2cb37dd80eea047d7d56eb59..ebc231e0d80b2f27d2b2a88cf0c112050578b569 100644 (file)
@@ -8,7 +8,7 @@
 #include <fcntl.h>
 #include <ust-helper.h>
 #include <lttng/align.h>
-#include <lttng/ust-elf.h>
+#include <ust-elf.h>
 #include <stdbool.h>
 #include <stdint.h>
 #include <string.h>
index 91d8e27993946a578ff4c1fdf439d16864e8ab33..98b80b35fa3a343fd85d3d6d854e61fa2eadb66f 100644 (file)
@@ -16,7 +16,7 @@
 #include <sys/types.h>
 #include <unistd.h>
 
-#include <lttng/ust-elf.h>
+#include <ust-elf.h>
 #include <ust-helper.h>
 #include "lttng-tracer-core.h"
 #include "lttng-ust-statedump.h"
index 3ab1573e54e858ce59ace68d568b35dddcc65136..a1230b206ce0ace87d5f95cbc47c3b50b3036bfc 100644 (file)
@@ -10,7 +10,7 @@
 #include <stdlib.h>
 #include <string.h>
 
-#include <lttng/ust-elf.h>
+#include <ust-elf.h>
 #include "tap.h"
 
 #define NUM_ARCH 4
This page took 0.028461 seconds and 4 git commands to generate.