X-Git-Url: http://git.lttng.org/?a=blobdiff_plain;f=include%2Flttng%2Fust-elf.h;h=32d4ad1f16d18d33d2f2edd05b62e4f14ce7a6d1;hb=c0c0989ab70574e09b2f7e8b48c2da6af664a849;hp=41e3c9b775e10104f1e60014ba58d9922c280b9e;hpb=8e2aed3f18adc14ec586ef717e396bcac4473dd7;p=lttng-ust.git diff --git a/include/lttng/ust-elf.h b/include/lttng/ust-elf.h index 41e3c9b7..32d4ad1f 100644 --- a/include/lttng/ust-elf.h +++ b/include/lttng/ust-elf.h @@ -1,27 +1,15 @@ -#ifndef _LTTNG_UST_ELF_H -#define _LTTNG_UST_ELF_H /* - * Copyright (C) 2015 Antoine Busque - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. + * SPDX-License-Identifier: LGPL-2.1-or-later * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * Copyright (C) 2015 Antoine Busque */ +#ifndef _LTTNG_UST_ELF_H +#define _LTTNG_UST_ELF_H + #include #include #include -#include #include #include @@ -77,6 +65,7 @@ bswap((phdr).p_filesz); \ bswap((phdr).p_memsz); \ bswap((phdr).p_align); \ + bswap((phdr).p_vaddr); \ } while (0) #define bswap_shdr(shdr) \ @@ -117,6 +106,7 @@ (dst_phdr).p_filesz = (src_phdr).p_filesz; \ (dst_phdr).p_memsz = (src_phdr).p_memsz; \ (dst_phdr).p_align = (src_phdr).p_align; \ + (dst_phdr).p_vaddr = (src_phdr).p_vaddr; \ } while (0) #define copy_shdr(src_shdr, dst_shdr) \ @@ -172,6 +162,7 @@ struct lttng_ust_elf_phdr { uint64_t p_filesz; uint64_t p_memsz; uint64_t p_align; + uint64_t p_vaddr; }; struct lttng_ust_elf_shdr { @@ -195,11 +186,11 @@ struct lttng_ust_elf_nhdr { struct lttng_ust_elf { /* Offset in bytes to start of section names string table. */ - uint64_t section_names_offset; + off_t section_names_offset; /* Size in bytes of section names string table. */ - uint64_t section_names_size; + size_t section_names_size; char *path; - FILE *file; + int fd; struct lttng_ust_elf_ehdr *ehdr; uint8_t bitness; uint8_t endianness; @@ -219,6 +210,7 @@ int is_elf_native_endian(struct lttng_ust_elf *elf) 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);