Add is_pic field to statedump soinfo event
[lttng-ust.git] / liblttng-ust / lttng-ust-elf.c
index dcae966ca2b815513b2b0a2d04c89d714174bbae..346545583c3a23b399b9a71911c59e5ded6bc387 100644 (file)
@@ -16,6 +16,7 @@
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301 USA
  */
 
+#define _GNU_SOURCE
 #include <helper.h>
 #include <string.h>
 #include <lttng/align.h>
@@ -315,6 +316,18 @@ error:
        return NULL;
 }
 
+/*
+ * Test whether the ELF file is position independent code (PIC)
+ */
+uint8_t lttng_ust_elf_is_pic(struct lttng_ust_elf *elf)
+{
+       /*
+        * PIC has and e_type value of ET_DYN, see ELF specification
+        * version 1.1 p. 1-3.
+        */
+       return elf->ehdr->e_type == ET_DYN;
+}
+
 /*
  * Destroy the given lttng_ust_elf instance.
  */
This page took 0.023537 seconds and 4 git commands to generate.