X-Git-Url: http://git.liburcu.org/?a=blobdiff_plain;f=liblttng-ust%2Flttng-ust-elf.c;h=346545583c3a23b399b9a71911c59e5ded6bc387;hb=444da810e491b66b873466c240202c27e0cd1adc;hp=dcae966ca2b815513b2b0a2d04c89d714174bbae;hpb=82ee1ee4a147de031957bfcb8a1908b926bac603;p=lttng-ust.git diff --git a/liblttng-ust/lttng-ust-elf.c b/liblttng-ust/lttng-ust-elf.c index dcae966c..34654558 100644 --- a/liblttng-ust/lttng-ust-elf.c +++ b/liblttng-ust/lttng-ust-elf.c @@ -16,6 +16,7 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ +#define _GNU_SOURCE #include #include #include @@ -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. */