diff options
author | 2017-03-02 16:15:51 +0100 | |
---|---|---|
committer | 2017-03-03 14:43:36 +0100 | |
commit | 0c3ed7dcda2b9a08702cd5e30d8e48f412ad62fd (patch) | |
tree | dc06f6a9d25a767536c9c5e281ccd11aa3143f1c /buildtools/pmdinfogen | |
parent | d4326699b9ff4788aed0c889a5c26a840e75a352 (diff) |
Imported Upstream version 16.11.1
Change-Id: Ib15a339c8050bb0594ce8333133e923771d2fc57
Signed-off-by: Christian Ehrhardt <christian.ehrhardt@canonical.com>
Diffstat (limited to 'buildtools/pmdinfogen')
-rw-r--r-- | buildtools/pmdinfogen/pmdinfogen.c | 15 | ||||
-rw-r--r-- | buildtools/pmdinfogen/pmdinfogen.h | 10 |
2 files changed, 15 insertions, 10 deletions
diff --git a/buildtools/pmdinfogen/pmdinfogen.c b/buildtools/pmdinfogen/pmdinfogen.c index 59ab9569..5bf08ced 100644 --- a/buildtools/pmdinfogen/pmdinfogen.c +++ b/buildtools/pmdinfogen/pmdinfogen.c @@ -226,13 +226,14 @@ static int parse_elf(struct elf_info *info, const char *filename) } if (!info->symtab_start) fprintf(stderr, "%s has no symtab?\n", filename); - - /* Fix endianness in symbols */ - for (sym = info->symtab_start; sym < info->symtab_stop; sym++) { - sym->st_shndx = TO_NATIVE(endian, 16, sym->st_shndx); - sym->st_name = TO_NATIVE(endian, 32, sym->st_name); - sym->st_value = TO_NATIVE(endian, ADDR_SIZE, sym->st_value); - sym->st_size = TO_NATIVE(endian, ADDR_SIZE, sym->st_size); + else { + /* Fix endianness in symbols */ + for (sym = info->symtab_start; sym < info->symtab_stop; sym++) { + sym->st_shndx = TO_NATIVE(endian, 16, sym->st_shndx); + sym->st_name = TO_NATIVE(endian, 32, sym->st_name); + sym->st_value = TO_NATIVE(endian, ADDR_SIZE, sym->st_value); + sym->st_size = TO_NATIVE(endian, ADDR_SIZE, sym->st_size); + } } if (symtab_shndx_idx != ~0U) { diff --git a/buildtools/pmdinfogen/pmdinfogen.h b/buildtools/pmdinfogen/pmdinfogen.h index 1da2966f..e9eabffb 100644 --- a/buildtools/pmdinfogen/pmdinfogen.h +++ b/buildtools/pmdinfogen/pmdinfogen.h @@ -16,12 +16,16 @@ #include <sys/types.h> #include <sys/stat.h> #include <sys/mman.h> +#ifdef __linux__ +#include <endian.h> +#else +#include <sys/endian.h> +#endif #include <fcntl.h> #include <unistd.h> #include <elf.h> #include <rte_config.h> #include <rte_pci.h> -#include <rte_byteorder.h> /* On BSD-alike OSes elf.h defines these according to host's word size */ #undef ELF_ST_BIND @@ -75,9 +79,9 @@ #define CONVERT_NATIVE(fend, width, x) ({ \ typeof(x) ___x; \ if ((fend) == ELFDATA2LSB) \ - ___x = rte_le_to_cpu_##width(x); \ + ___x = le##width##toh(x); \ else \ - ___x = rte_be_to_cpu_##width(x); \ + ___x = be##width##toh(x); \ ___x; \ }) |