summaryrefslogtreecommitdiff
path: root/libnul.h
diff options
context:
space:
mode:
Diffstat (limited to 'libnul.h')
-rw-r--r--libnul.h60
1 files changed, 60 insertions, 0 deletions
diff --git a/libnul.h b/libnul.h
index b8c2f06..29f068e 100644
--- a/libnul.h
+++ b/libnul.h
@@ -384,6 +384,66 @@ void nul_dbus_invoke (nul_dbus_service_t *service,
gpointer data,
...);
+/* Elf */
+/*
+ * The ELF code is MIT licensed:
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ */
+typedef struct elf_sym_t elf_sym_t;
+typedef struct elf_file_t elf_file_t;
+
+elf_file_t * elf_file_new_from_data (const uint8_t *data,
+ size_t length);
+elf_file_t * elf_file_new (const char *filename,
+ GError **err);
+void elf_file_free (elf_file_t *parser);
+const char * elf_file_get_debug_link (elf_file_t *parser,
+ uint32_t *crc32);
+const char * elf_file_get_build_id (elf_file_t *parser);
+const uint8_t *elf_file_get_eh_frame (elf_file_t *parser);
+const uint8_t *elf_file_get_debug_frame (elf_file_t *parser);
+size_t elf_file_get_text_offset (elf_file_t *parser);
+
+
+/* Lookup a symbol in the file.
+ *
+ * The symbol returned is const, so don't free it. It is valid until
+ * elf_file_free() is called on the elf file.
+ *
+ * The address should be given in "file coordinates". This means that
+ * if the file is mapped at address m and offset o, then an address a
+ * should be looked up as "a - (m - o)". (m - o) is where the start
+ * of the file would have been mapped, so a - (m - o) is the position
+ * in the file of a.
+ */
+const elf_sym_t *elf_file_lookup_symbol (elf_file_t *parser,
+ size_t address);
+uint32_t elf_file_get_crc32 (elf_file_t *parser);
+const char * elf_file_get_sym_name (elf_file_t *parser,
+ const elf_sym_t *sym);
+size_t elf_file_get_sym_address (elf_file_t *parser,
+ const elf_sym_t *sym);
+nul_bool_t elf_file_owns_symbol (elf_file_t *parser,
+ const elf_sym_t *sym);
+
/* Implementation of the array macros */