summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorUlf Hermann <ulf.hermann@theqtcompany.com>2015-08-26 15:33:02 +0200
committerUlf Hermann <ulf.hermann@theqtcompany.com>2015-09-04 17:11:01 +0300
commit2b87e45bdd2d3c16f56817c4bf6c16c7971de163 (patch)
tree96a1c4d26f110eba69e3fe25bb483624072b0b96
parent07afefa0ce07c9c76afea13313bd6f28a6e82b24 (diff)
Upgrade to elfutils 0.163
Change-Id: Ic32c74bc7b5fe864ee80db1d0932865898f5504b Reviewed-by: Christian Kandeler <christian.kandeler@theqtcompany.com>
-rw-r--r--3rdparty/elfutils/backends/aarch64_reloc.def10
-rw-r--r--3rdparty/elfutils/backends/aarch64_symbol.c15
-rw-r--r--3rdparty/elfutils/backends/arm_init.c3
-rw-r--r--3rdparty/elfutils/backends/arm_reloc.def4
-rw-r--r--3rdparty/elfutils/backends/arm_symbol.c15
-rw-r--r--3rdparty/elfutils/backends/backends.pro18
-rw-r--r--3rdparty/elfutils/backends/i386/i386.pro3
-rw-r--r--3rdparty/elfutils/backends/i386_reloc.def4
-rw-r--r--3rdparty/elfutils/backends/ia64_reloc.def4
-rw-r--r--3rdparty/elfutils/backends/linux-core-note.c24
-rw-r--r--3rdparty/elfutils/backends/ppc64_reloc.def4
-rw-r--r--3rdparty/elfutils/backends/ppc_reloc.def4
-rw-r--r--3rdparty/elfutils/backends/ppc_symbol.c3
-rw-r--r--3rdparty/elfutils/backends/s390_reloc.def4
-rw-r--r--3rdparty/elfutils/backends/sh_reloc.def4
-rw-r--r--3rdparty/elfutils/backends/sparc_reloc.def4
-rw-r--r--3rdparty/elfutils/backends/tilegx_reloc.def3
-rw-r--r--3rdparty/elfutils/backends/x32_corenote.c2
-rw-r--r--3rdparty/elfutils/backends/x86_64/x32_corenote/x32_corenote.pro7
-rw-r--r--3rdparty/elfutils/backends/x86_64/x86_64.pro4
-rw-r--r--3rdparty/elfutils/backends/x86_64/x86_64_corenote/x86_64_corenote.pro8
-rw-r--r--3rdparty/elfutils/backends/x86_64_corenote.c35
-rw-r--r--3rdparty/elfutils/backends/x86_64_init.c8
-rw-r--r--3rdparty/elfutils/backends/x86_64_reloc.def4
-rw-r--r--3rdparty/elfutils/config.h9
-rw-r--r--3rdparty/elfutils/elfutils.pri2
-rw-r--r--3rdparty/elfutils/lib/eu-config.h9
-rw-r--r--3rdparty/elfutils/libdw/cfi.c11
-rw-r--r--3rdparty/elfutils/libdw/cfi.h3
-rw-r--r--3rdparty/elfutils/libdw/dwarf.h5
-rw-r--r--3rdparty/elfutils/libdw/dwarf_aggregate_size.c2
-rw-r--r--3rdparty/elfutils/libdw/dwarf_begin_elf.c194
-rw-r--r--3rdparty/elfutils/libdw/dwarf_error.c4
-rw-r--r--3rdparty/elfutils/libdw/dwarf_formref_die.c2
-rw-r--r--3rdparty/elfutils/libdw/dwarf_func_inline.c4
-rw-r--r--3rdparty/elfutils/libdw/dwarf_getaranges.c16
-rw-r--r--3rdparty/elfutils/libdw/dwarf_getcfi_elf.c39
-rw-r--r--3rdparty/elfutils/libdw/dwarf_getfuncs.c4
-rw-r--r--3rdparty/elfutils/libdw/dwarf_getlocation.c87
-rw-r--r--3rdparty/elfutils/libdw/dwarf_getmacros.c36
-rw-r--r--3rdparty/elfutils/libdw/dwarf_getpubnames.c1
-rw-r--r--3rdparty/elfutils/libdw/dwarf_getscopes.c8
-rw-r--r--3rdparty/elfutils/libdw/dwarf_getscopes_die.c4
-rw-r--r--3rdparty/elfutils/libdw/dwarf_getsrc_die.c46
-rw-r--r--3rdparty/elfutils/libdw/dwarf_getsrcfiles.c11
-rw-r--r--3rdparty/elfutils/libdw/dwarf_getsrclines.c197
-rw-r--r--3rdparty/elfutils/libdw/dwarf_peel_type.c3
-rw-r--r--3rdparty/elfutils/libdw/dwarf_ranges.c21
-rw-r--r--3rdparty/elfutils/libdw/dwarf_siblingof.c12
-rw-r--r--3rdparty/elfutils/libdw/encoded-value.h78
-rw-r--r--3rdparty/elfutils/libdw/fde.c13
-rw-r--r--3rdparty/elfutils/libdw/known-dwarf.h1163
-rw-r--r--3rdparty/elfutils/libdw/libdw.h3
-rw-r--r--3rdparty/elfutils/libdw/libdwP.h13
-rw-r--r--3rdparty/elfutils/libdw/libdw_visit_scopes.c28
-rw-r--r--3rdparty/elfutils/libdw/memory-access.h23
-rw-r--r--3rdparty/elfutils/libdwfl/core-file.c28
-rw-r--r--3rdparty/elfutils/libdwfl/cu.c88
-rw-r--r--3rdparty/elfutils/libdwfl/derelocate.c41
-rw-r--r--3rdparty/elfutils/libdwfl/dwfl_build_id_find_elf.c26
-rw-r--r--3rdparty/elfutils/libdwfl/dwfl_error.c21
-rw-r--r--3rdparty/elfutils/libdwfl/dwfl_lineinfo.c8
-rw-r--r--3rdparty/elfutils/libdwfl/dwfl_module_build_id.c2
-rw-r--r--3rdparty/elfutils/libdwfl/dwfl_module_getdwarf.c67
-rw-r--r--3rdparty/elfutils/libdwfl/dwfl_module_getsrc.c8
-rw-r--r--3rdparty/elfutils/libdwfl/dwfl_report_elf.c2
-rw-r--r--3rdparty/elfutils/libdwfl/dwfl_segment_report_module.c76
-rw-r--r--3rdparty/elfutils/libdwfl/elf-from-memory.c59
-rw-r--r--3rdparty/elfutils/libdwfl/find-debuginfo.c41
-rw-r--r--3rdparty/elfutils/libdwfl/link_map.c59
-rw-r--r--3rdparty/elfutils/libdwfl/linux-kernel-modules.c34
-rw-r--r--3rdparty/elfutils/libdwfl/segment.c5
-rw-r--r--3rdparty/elfutils/libebl/eblcheckreloctargettype.c18
-rw-r--r--3rdparty/elfutils/libebl/eblobjnote.c19
-rw-r--r--3rdparty/elfutils/libebl/eblopenbackend.c10
-rw-r--r--3rdparty/elfutils/libebl/libebl.h15
-rw-r--r--3rdparty/elfutils/libelf/elf.h190
-rw-r--r--3rdparty/elfutils/libelf/elf32_getphdr.c18
-rw-r--r--3rdparty/elfutils/libelf/elf32_getshdr.c18
-rw-r--r--3rdparty/elfutils/libelf/elf32_newphdr.c12
-rw-r--r--3rdparty/elfutils/libelf/elf32_updatefile.c74
-rw-r--r--3rdparty/elfutils/libelf/elf32_updatenull.c22
-rw-r--r--3rdparty/elfutils/libelf/elf_begin.c162
-rw-r--r--3rdparty/elfutils/libelf/elf_getarsym.c24
-rw-r--r--3rdparty/elfutils/libelf/elf_getdata.c125
-rw-r--r--3rdparty/elfutils/libelf/elf_getdata_rawchunk.c20
-rw-r--r--3rdparty/elfutils/libelf/elf_getphdrnum.c46
-rw-r--r--3rdparty/elfutils/libelf/elf_newdata.c39
-rw-r--r--3rdparty/elfutils/libelf/elf_strptr.c51
-rw-r--r--3rdparty/elfutils/libelf/elf_update.c19
-rw-r--r--3rdparty/elfutils/libelf/gelf_getphdr.c12
-rw-r--r--3rdparty/elfutils/libelf/gelf_xlate.c5
-rw-r--r--3rdparty/elfutils/libelf/libelfP.h8
-rw-r--r--3rdparty/elfutils/libelf/nlist.c10
-rw-r--r--3rdparty/elfutils/libelf/version_xlate.h12
-rw-r--r--3rdparty/elfutils/qbs/imports/ElfUtilsProduct.qbs2
-rw-r--r--3rdparty/elfutils/version.h2
97 files changed, 2405 insertions, 1338 deletions
diff --git a/3rdparty/elfutils/backends/aarch64_reloc.def b/3rdparty/elfutils/backends/aarch64_reloc.def
index 36d29e6..f894687 100644
--- a/3rdparty/elfutils/backends/aarch64_reloc.def
+++ b/3rdparty/elfutils/backends/aarch64_reloc.def
@@ -1,5 +1,5 @@
/* List the relocation types for AArch64. -*- C -*-
- Copyright (C) 2013, 2014 Red Hat, Inc.
+ Copyright (C) 2013, 2014, 2015 Red Hat, Inc.
This file is part of elfutils.
This file is free software; you can redistribute it and/or modify
@@ -30,13 +30,13 @@
RELOC_TYPE (ABS64, REL|EXEC|DYN)
RELOC_TYPE (ABS32, REL|EXEC|DYN)
-RELOC_TYPE (COPY, EXEC)
+RELOC_TYPE (COPY, EXEC|DYN)
RELOC_TYPE (GLOB_DAT, EXEC|DYN)
RELOC_TYPE (JUMP_SLOT, EXEC|DYN)
RELOC_TYPE (RELATIVE, EXEC|DYN)
-RELOC_TYPE (TLS_DTPMOD64, EXEC|DYN)
-RELOC_TYPE (TLS_DTPREL64, EXEC|DYN)
-RELOC_TYPE (TLS_TPREL64, EXEC|DYN)
+RELOC_TYPE (TLS_DTPMOD, EXEC|DYN)
+RELOC_TYPE (TLS_DTPREL, EXEC|DYN)
+RELOC_TYPE (TLS_TPREL, EXEC|DYN)
RELOC_TYPE (TLSDESC, EXEC|DYN)
/* R_AARCH64_NONE records that the section containing the place to be
diff --git a/3rdparty/elfutils/backends/aarch64_symbol.c b/3rdparty/elfutils/backends/aarch64_symbol.c
index 3fdc9cf..76999e4 100644
--- a/3rdparty/elfutils/backends/aarch64_symbol.c
+++ b/3rdparty/elfutils/backends/aarch64_symbol.c
@@ -1,5 +1,5 @@
/* AArch64 specific symbolic name handling.
- Copyright (C) 2013 Red Hat, Inc.
+ Copyright (C) 2013, 2015 Red Hat, Inc.
This file is part of elfutils.
This file is free software; you can redistribute it and/or modify
@@ -56,8 +56,11 @@ aarch64_reloc_simple_type (Ebl *ebl __attribute__ ((unused)), int type)
}
}
-/* If this is the _GLOBAL_OFFSET_TABLE_ symbol, then it should point to
- .got[0] even if there is a .got.plt section. */
+/* If this is the _GLOBAL_OFFSET_TABLE_ symbol, then it should point in
+ the .got even if there is a .got.plt section.
+ https://sourceware.org/ml/libc-ports/2013-06/msg00057.html
+ https://bugzilla.redhat.com/show_bug.cgi?id=1201778
+ */
bool
aarch64_check_special_symbol (Elf *elf, GElf_Ehdr *ehdr, const GElf_Sym *sym,
const char *name, const GElf_Shdr *destshdr)
@@ -66,7 +69,8 @@ aarch64_check_special_symbol (Elf *elf, GElf_Ehdr *ehdr, const GElf_Sym *sym,
&& strcmp (name, "_GLOBAL_OFFSET_TABLE_") == 0)
{
const char *sname = elf_strptr (elf, ehdr->e_shstrndx, destshdr->sh_name);
- if (sname != NULL && strcmp (sname, ".got.plt") == 0)
+ if (sname != NULL
+ && (strcmp (sname, ".got") == 0 || strcmp (sname, ".got.plt") == 0))
{
Elf_Scn *scn = NULL;
while ((scn = elf_nextscn (elf, scn)) != NULL)
@@ -77,7 +81,8 @@ aarch64_check_special_symbol (Elf *elf, GElf_Ehdr *ehdr, const GElf_Sym *sym,
{
sname = elf_strptr (elf, ehdr->e_shstrndx, shdr->sh_name);
if (sname != NULL && strcmp (sname, ".got") == 0)
- return sym->st_value == shdr->sh_addr;
+ return (sym->st_value >= shdr->sh_addr
+ && sym->st_value < shdr->sh_addr + shdr->sh_size);
}
}
}
diff --git a/3rdparty/elfutils/backends/arm_init.c b/3rdparty/elfutils/backends/arm_init.c
index 3283c97..f3e5f0a 100644
--- a/3rdparty/elfutils/backends/arm_init.c
+++ b/3rdparty/elfutils/backends/arm_init.c
@@ -1,5 +1,5 @@
/* Initialization of Arm specific backend library.
- Copyright (C) 2002, 2005, 2009, 2013, 2014 Red Hat, Inc.
+ Copyright (C) 2002, 2005, 2009, 2013, 2014, 2015 Red Hat, Inc.
This file is part of elfutils.
Written by Ulrich Drepper <drepper@redhat.com>, 2002.
@@ -64,6 +64,7 @@ arm_init (elf, machine, eh, ehlen)
HOOK (eh, return_value_location);
HOOK (eh, abi_cfi);
HOOK (eh, check_reloc_target_type);
+ HOOK (eh, symbol_type_name);
/* We only unwind the core integer registers. */
eh->frame_nregs = 16;
diff --git a/3rdparty/elfutils/backends/arm_reloc.def b/3rdparty/elfutils/backends/arm_reloc.def
index 4b7894b..113648e 100644
--- a/3rdparty/elfutils/backends/arm_reloc.def
+++ b/3rdparty/elfutils/backends/arm_reloc.def
@@ -1,5 +1,5 @@
/* List the relocation types for arm. -*- C -*-
- Copyright (C) 2005-2010, 2014 Red Hat, Inc.
+ Copyright (C) 2005-2010, 2014, 2015 Red Hat, Inc.
This file is part of elfutils.
This file is free software; you can redistribute it and/or modify
@@ -48,7 +48,7 @@ RELOC_TYPE (THM_XPC22, REL)
RELOC_TYPE (TLS_DTPMOD32, EXEC|DYN)
RELOC_TYPE (TLS_DTPOFF32, EXEC|DYN)
RELOC_TYPE (TLS_TPOFF32, EXEC|DYN)
-RELOC_TYPE (COPY, EXEC)
+RELOC_TYPE (COPY, EXEC|DYN)
RELOC_TYPE (GLOB_DAT, EXEC|DYN)
RELOC_TYPE (JUMP_SLOT, EXEC|DYN)
RELOC_TYPE (RELATIVE, EXEC|DYN)
diff --git a/3rdparty/elfutils/backends/arm_symbol.c b/3rdparty/elfutils/backends/arm_symbol.c
index cd467ff..da4a50a 100644
--- a/3rdparty/elfutils/backends/arm_symbol.c
+++ b/3rdparty/elfutils/backends/arm_symbol.c
@@ -1,5 +1,5 @@
/* Arm specific symbolic name handling.
- Copyright (C) 2002-2009, 2014 Red Hat, Inc.
+ Copyright (C) 2002-2009, 2014, 2015 Red Hat, Inc.
This file is part of elfutils.
This file is free software; you can redistribute it and/or modify
@@ -129,3 +129,16 @@ arm_check_reloc_target_type (Ebl *ebl __attribute__ ((unused)), Elf64_Word sh_ty
{
return sh_type == SHT_ARM_EXIDX;
}
+
+const char *
+arm_symbol_type_name (int type,
+ char *buf __attribute__ ((unused)),
+ size_t len __attribute__ ((unused)))
+{
+ switch (type)
+ {
+ case STT_ARM_TFUNC:
+ return "ARM_TFUNC";
+ }
+ return NULL;
+}
diff --git a/3rdparty/elfutils/backends/backends.pro b/3rdparty/elfutils/backends/backends.pro
index 0d71325..bef3770 100644
--- a/3rdparty/elfutils/backends/backends.pro
+++ b/3rdparty/elfutils/backends/backends.pro
@@ -1,3 +1,19 @@
TEMPLATE = subdirs
-SUBDIRS = aarch64 alpha arm i386 ia64 ppc ppc64 s390 sh sparc tilegx x86_64
+SUBDIRS = \
+ aarch64 \
+ alpha \
+ arm \
+ i386 \
+ ia64 \
+ ppc \
+ ppc64 \
+ s390 \
+ sh \
+ sparc \
+ tilegx \
+ x86_64 \
+ x86_64/x86_64_corenote \
+ x86_64/x32_corenote
+
+x86_64.depends = x86_64/x86_64_corenote x86_64/x32_corenote
diff --git a/3rdparty/elfutils/backends/i386/i386.pro b/3rdparty/elfutils/backends/i386/i386.pro
index b9fd4c1..b4b334a 100644
--- a/3rdparty/elfutils/backends/i386/i386.pro
+++ b/3rdparty/elfutils/backends/i386/i386.pro
@@ -15,4 +15,5 @@ SOURCES += \
../i386_syscall.c
HEADERS += \
- ../i386_reloc.def
+ ../i386_reloc.def \
+ ../x86_corenote.c
diff --git a/3rdparty/elfutils/backends/i386_reloc.def b/3rdparty/elfutils/backends/i386_reloc.def
index bd273b3..de3575d 100644
--- a/3rdparty/elfutils/backends/i386_reloc.def
+++ b/3rdparty/elfutils/backends/i386_reloc.def
@@ -1,5 +1,5 @@
/* List the relocation types for i386. -*- C -*-
- Copyright (C) 2000, 2001, 2002, 2003, 2005, 2009 Red Hat, Inc.
+ Copyright (C) 2000, 2001, 2002, 2003, 2005, 2009, 2015 Red Hat, Inc.
This file is part of elfutils.
This file is free software; you can redistribute it and/or modify
@@ -29,7 +29,7 @@
/* NAME, REL|EXEC|DYN */
RELOC_TYPE (NONE, 0)
-RELOC_TYPE (COPY, EXEC)
+RELOC_TYPE (COPY, EXEC|DYN)
RELOC_TYPE (32, REL|EXEC|DYN)
RELOC_TYPE (PC32, REL|EXEC|DYN)
RELOC_TYPE (GOT32, REL)
diff --git a/3rdparty/elfutils/backends/ia64_reloc.def b/3rdparty/elfutils/backends/ia64_reloc.def
index 9e058c8..2428925 100644
--- a/3rdparty/elfutils/backends/ia64_reloc.def
+++ b/3rdparty/elfutils/backends/ia64_reloc.def
@@ -1,5 +1,5 @@
/* List the relocation types for ia64. -*- C -*-
- Copyright (C) 2005, 2006 Red Hat, Inc.
+ Copyright (C) 2005, 2006, 2015 Red Hat, Inc.
This file is part of elfutils.
This file is free software; you can redistribute it and/or modify
@@ -88,7 +88,7 @@ RELOC_TYPE (PCREL22, REL)
RELOC_TYPE (PCREL64I, REL)
RELOC_TYPE (IPLTMSB, REL|EXEC|DYN)
RELOC_TYPE (IPLTLSB, REL|EXEC|DYN)
-RELOC_TYPE (COPY, EXEC)
+RELOC_TYPE (COPY, EXEC|DYN)
RELOC_TYPE (SUB, 0)
RELOC_TYPE (LTOFF22X, REL)
RELOC_TYPE (LDXMOV, REL)
diff --git a/3rdparty/elfutils/backends/linux-core-note.c b/3rdparty/elfutils/backends/linux-core-note.c
index e3c0109..db82e85 100644
--- a/3rdparty/elfutils/backends/linux-core-note.c
+++ b/3rdparty/elfutils/backends/linux-core-note.c
@@ -1,5 +1,6 @@
/* Common core note type descriptions for Linux.
Copyright (C) 2007-2010 Red Hat, Inc.
+ Copyright (C) H.J. Lu <hjl.tools@gmail.com>, 2015.
This file is part of elfutils.
This file is free software; you can redistribute it and/or modify
@@ -42,9 +43,22 @@
#define INT int32_t
#define ALIGN_INT 4
#define TYPE_INT ELF_T_SWORD
+#ifndef PR_REG
+# define PR_REG ULONG
+#endif
#ifndef ALIGN_PR_REG
# define ALIGN_PR_REG ALIGN_ULONG
#endif
+#ifndef PRPSINFO_UID_T
+# define PRPSINFO_UID_T UID_T
+# define ALIGN_PRPSINFO_UID_T ALIGN_UID_T
+# define TYPE_PRPSINFO_UID_T TYPE_UID_T
+#endif
+#ifndef PRPSINFO_GID_T
+# define PRPSINFO_GID_T GID_T
+# define ALIGN_PRPSINFO_GID_T ALIGN_GID_T
+# define TYPE_PRPSINFO_GID_T TYPE_GID_T
+#endif
#define FIELD(type, name) type name __attribute__ ((aligned (ALIGN_##type)))
@@ -86,7 +100,7 @@ struct EBLHOOK(prstatus)
struct EBLHOOK(timeval) pr_cstime;
struct
{
- FIELD (ULONG, pr_reg[PRSTATUS_REGS_SIZE / sizeof (ULONG)]);
+ FIELD (PR_REG, pr_reg[PRSTATUS_REGS_SIZE / sizeof (PR_REG)]);
}
#ifdef ALIGN_PR_REG
__attribute__ ((aligned (ALIGN_PR_REG)))
@@ -105,8 +119,8 @@ struct EBLHOOK(prpsinfo)
FIELD (CHAR, pr_zomb);
FIELD (CHAR, pr_nice);
FIELD (ULONG, pr_flag);
- FIELD (UID_T, pr_uid);
- FIELD (GID_T, pr_gid);
+ FIELD (PRPSINFO_UID_T, pr_uid);
+ FIELD (PRPSINFO_GID_T, pr_gid);
FIELD (PID_T, pr_pid);
FIELD (PID_T, pr_ppid);
FIELD (PID_T, pr_pgrp);
@@ -170,8 +184,8 @@ static const Ebl_Core_Item prpsinfo_items[] =
FIELD (state, CHAR, zomb, 'd'),
FIELD (state, CHAR, nice, 'd'),
FIELD (state, ULONG, flag, 'x'),
- FIELD (identity, UID_T, uid, 'd'),
- FIELD (identity, GID_T, gid, 'd'),
+ FIELD (identity, PRPSINFO_UID_T, uid, 'd'),
+ FIELD (identity, PRPSINFO_GID_T, gid, 'd'),
FIELD (identity, PID_T, pid, 'd'),
FIELD (identity, PID_T, ppid, 'd'),
FIELD (identity, PID_T, pgrp, 'd'),
diff --git a/3rdparty/elfutils/backends/ppc64_reloc.def b/3rdparty/elfutils/backends/ppc64_reloc.def
index 3a693cf..15a73ba 100644
--- a/3rdparty/elfutils/backends/ppc64_reloc.def
+++ b/3rdparty/elfutils/backends/ppc64_reloc.def
@@ -1,5 +1,5 @@
/* List the relocation types for ppc64. -*- C -*-
- Copyright (C) 2005 Red Hat, Inc.
+ Copyright (C) 2005, 2015 Red Hat, Inc.
This file is part of elfutils.
This file is free software; you can redistribute it and/or modify
@@ -46,7 +46,7 @@ RELOC_TYPE (GOT16, REL)
RELOC_TYPE (GOT16_LO, REL)
RELOC_TYPE (GOT16_HI, REL)
RELOC_TYPE (GOT16_HA, REL)
-RELOC_TYPE (COPY, EXEC)
+RELOC_TYPE (COPY, EXEC|DYN)
RELOC_TYPE (GLOB_DAT, EXEC|DYN)
RELOC_TYPE (JMP_SLOT, EXEC|DYN)
RELOC_TYPE (RELATIVE, EXEC|DYN)
diff --git a/3rdparty/elfutils/backends/ppc_reloc.def b/3rdparty/elfutils/backends/ppc_reloc.def
index dc963a0..3723a9c 100644
--- a/3rdparty/elfutils/backends/ppc_reloc.def
+++ b/3rdparty/elfutils/backends/ppc_reloc.def
@@ -1,5 +1,5 @@
/* List the relocation types for ppc. -*- C -*-
- Copyright (C) 2005 Red Hat, Inc.
+ Copyright (C) 2005, 2015 Red Hat, Inc.
This file is part of elfutils.
This file is free software; you can redistribute it and/or modify
@@ -47,7 +47,7 @@ RELOC_TYPE (GOT16_LO, REL)
RELOC_TYPE (GOT16_HI, REL)
RELOC_TYPE (GOT16_HA, REL)
RELOC_TYPE (PLTREL24, REL)
-RELOC_TYPE (COPY, EXEC)
+RELOC_TYPE (COPY, EXEC|DYN)
RELOC_TYPE (GLOB_DAT, EXEC|DYN)
RELOC_TYPE (JMP_SLOT, EXEC|DYN)
RELOC_TYPE (RELATIVE, EXEC|DYN)
diff --git a/3rdparty/elfutils/backends/ppc_symbol.c b/3rdparty/elfutils/backends/ppc_symbol.c
index c17ab37..733114b 100644
--- a/3rdparty/elfutils/backends/ppc_symbol.c
+++ b/3rdparty/elfutils/backends/ppc_symbol.c
@@ -98,7 +98,8 @@ find_dyn_got (Elf *elf, GElf_Addr *addr)
GElf_Shdr shdr_mem;
GElf_Shdr *shdr = gelf_getshdr (scn, &shdr_mem);
Elf_Data *data = elf_getdata (scn, NULL);
- if (shdr != NULL && shdr->sh_type == SHT_DYNAMIC && data != NULL)
+ if (shdr != NULL && shdr->sh_type == SHT_DYNAMIC && data != NULL
+ && shdr->sh_entsize != 0)
for (unsigned int j = 0; j < shdr->sh_size / shdr->sh_entsize; ++j)
{
GElf_Dyn dyn_mem;
diff --git a/3rdparty/elfutils/backends/s390_reloc.def b/3rdparty/elfutils/backends/s390_reloc.def
index b4686a3..cdef9eb 100644
--- a/3rdparty/elfutils/backends/s390_reloc.def
+++ b/3rdparty/elfutils/backends/s390_reloc.def
@@ -1,5 +1,5 @@
/* List the relocation types for s390. -*- C -*-
- Copyright (C) 2005, 2006 Red Hat, Inc.
+ Copyright (C) 2005, 2006, 2015 Red Hat, Inc.
This file is part of elfutils.
This file is free software; you can redistribute it and/or modify
@@ -37,7 +37,7 @@ RELOC_TYPE (PC32, REL|EXEC|DYN)
RELOC_TYPE (GOT12, REL)
RELOC_TYPE (GOT32, REL)
RELOC_TYPE (PLT32, REL)
-RELOC_TYPE (COPY, EXEC)
+RELOC_TYPE (COPY, EXEC|DYN)
RELOC_TYPE (GLOB_DAT, EXEC|DYN)
RELOC_TYPE (JMP_SLOT, EXEC|DYN)
RELOC_TYPE (RELATIVE, EXEC|DYN)
diff --git a/3rdparty/elfutils/backends/sh_reloc.def b/3rdparty/elfutils/backends/sh_reloc.def
index 66a5a9d..aded361 100644
--- a/3rdparty/elfutils/backends/sh_reloc.def
+++ b/3rdparty/elfutils/backends/sh_reloc.def
@@ -1,5 +1,5 @@
/* List the relocation types for SH. -*- C -*-
- Copyright (C) 2005 Red Hat, Inc.
+ Copyright (C) 2005, 2015 Red Hat, Inc.
This file is part of elfutils.
This file is free software; you can redistribute it and/or modify
@@ -59,7 +59,7 @@ RELOC_TYPE (TLS_DTPOFF32, DYN)
RELOC_TYPE (TLS_TPOFF32, DYN)
RELOC_TYPE (GOT32, REL)
RELOC_TYPE (PLT32, REL)
-RELOC_TYPE (COPY, EXEC)
+RELOC_TYPE (COPY, EXEC|DYN)
RELOC_TYPE (GLOB_DAT, EXEC|DYN)
RELOC_TYPE (JMP_SLOT, EXEC|DYN)
RELOC_TYPE (RELATIVE, EXEC|DYN)
diff --git a/3rdparty/elfutils/backends/sparc_reloc.def b/3rdparty/elfutils/backends/sparc_reloc.def
index c39b0fa..2aeb129 100644
--- a/3rdparty/elfutils/backends/sparc_reloc.def
+++ b/3rdparty/elfutils/backends/sparc_reloc.def
@@ -1,5 +1,5 @@
/* List the relocation types for sparc. -*- C -*-
- Copyright (C) 2009 Red Hat, Inc.
+ Copyright (C) 2009, 2015 Red Hat, Inc.
This file is part of elfutils.
This file is free software; you can redistribute it and/or modify
@@ -47,7 +47,7 @@ RELOC_TYPE (GOT22, REL)
RELOC_TYPE (PC10, REL)
RELOC_TYPE (PC22, REL)
RELOC_TYPE (WPLT30, REL)
-RELOC_TYPE (COPY, EXEC)
+RELOC_TYPE (COPY, EXEC|DYN)
RELOC_TYPE (GLOB_DAT, EXEC|DYN)
RELOC_TYPE (JMP_SLOT, EXEC|DYN)
RELOC_TYPE (RELATIVE, EXEC|DYN)
diff --git a/3rdparty/elfutils/backends/tilegx_reloc.def b/3rdparty/elfutils/backends/tilegx_reloc.def
index 9736286..1018110 100644
--- a/3rdparty/elfutils/backends/tilegx_reloc.def
+++ b/3rdparty/elfutils/backends/tilegx_reloc.def
@@ -1,5 +1,6 @@
/* List the relocation types for tilegx. -*- C -*-
Copyright (C) 2012 Tilera Corporation
+ Copyright (C) 2015 Red Hat, Inc.
This file is part of elfutils.
This file is free software; you can redistribute it and/or modify
@@ -44,7 +45,7 @@ RELOC_TYPE (HW3, REL)
RELOC_TYPE (HW0_LAST, REL)
RELOC_TYPE (HW1_LAST, REL)
RELOC_TYPE (HW2_LAST, REL)
-RELOC_TYPE (COPY, EXEC)
+RELOC_TYPE (COPY, EXEC|DYN)
RELOC_TYPE (GLOB_DAT, EXEC|DYN)
RELOC_TYPE (JMP_SLOT, EXEC|DYN)
RELOC_TYPE (RELATIVE, EXEC|DYN)
diff --git a/3rdparty/elfutils/backends/x32_corenote.c b/3rdparty/elfutils/backends/x32_corenote.c
new file mode 100644
index 0000000..bd6560d
--- /dev/null
+++ b/3rdparty/elfutils/backends/x32_corenote.c
@@ -0,0 +1,2 @@
+#define BITS 32
+#include "x86_64_corenote.c"
diff --git a/3rdparty/elfutils/backends/x86_64/x32_corenote/x32_corenote.pro b/3rdparty/elfutils/backends/x86_64/x32_corenote/x32_corenote.pro
new file mode 100644
index 0000000..dbcf99e
--- /dev/null
+++ b/3rdparty/elfutils/backends/x86_64/x32_corenote/x32_corenote.pro
@@ -0,0 +1,7 @@
+TARGET = ../x32_corenote
+
+include(../../../libebl/eblheaders.pri)
+include(../../../static.pri)
+
+SOURCES += ../../x32_corenote.c
+HEADERS += ../../x86_corenote.c ../../x86_64_corenote.c
diff --git a/3rdparty/elfutils/backends/x86_64/x86_64.pro b/3rdparty/elfutils/backends/x86_64/x86_64.pro
index cd0655b..c06c724 100644
--- a/3rdparty/elfutils/backends/x86_64/x86_64.pro
+++ b/3rdparty/elfutils/backends/x86_64/x86_64.pro
@@ -1,18 +1,16 @@
TARGET = ebl_x86_64
include(../backends.pri)
-LIBS += ../../libcpu/libx86_64.a
+LIBS += ../../libcpu/libx86_64.a libx86_64_corenote.a libx32_corenote.a
SOURCES += \
../x86_64_cfi.c \
- ../x86_64_corenote.c \
../x86_64_init.c \
../x86_64_initreg.c \
../x86_64_regs.c \
../x86_64_retval.c \
../x86_64_symbol.c \
../x86_64_syscall.c \
- ../x86_corenote.c \
../i386_auxv.c # x86_64_auxv_info is an alias for i386_auxv_info
HEADERS += \
diff --git a/3rdparty/elfutils/backends/x86_64/x86_64_corenote/x86_64_corenote.pro b/3rdparty/elfutils/backends/x86_64/x86_64_corenote/x86_64_corenote.pro
new file mode 100644
index 0000000..658bd93
--- /dev/null
+++ b/3rdparty/elfutils/backends/x86_64/x86_64_corenote/x86_64_corenote.pro
@@ -0,0 +1,8 @@
+TARGET = ../x86_64_corenote
+
+include(../../../libebl/eblheaders.pri)
+include(../../../static.pri)
+
+SOURCES += ../../x86_64_corenote.c
+HEADERS += ../../x86_corenote.c
+
diff --git a/3rdparty/elfutils/backends/x86_64_corenote.c b/3rdparty/elfutils/backends/x86_64_corenote.c
index f9d8db4..1bacc60 100644
--- a/3rdparty/elfutils/backends/x86_64_corenote.c
+++ b/3rdparty/elfutils/backends/x86_64_corenote.c
@@ -1,5 +1,6 @@
/* x86-64 specific core note handling.
Copyright (C) 2005, 2007, 2008 Red Hat, Inc.
+ Copyright (C) H.J. Lu <hjl.tools@gmail.com>, 2015.
This file is part of elfutils.
This file is free software; you can redistribute it and/or modify
@@ -36,7 +37,13 @@
#include <stdio.h>
#include <sys/time.h>
-#define BACKEND x86_64_
+#ifndef BITS
+# define BITS 64
+# define BACKEND x86_64_
+#else
+# define BITS 32
+# define BACKEND x32_
+#endif
#include "libebl_CPU.h"
@@ -77,15 +84,35 @@ static const Ebl_Register_Location prstatus_regs[] =
};
#define PRSTATUS_REGS_SIZE (27 * 8)
-#define ULONG uint64_t
+#if BITS == 32
+# define ULONG uint32_t
+# define ALIGN_ULONG 4
+# define TYPE_ULONG ELF_T_WORD
+# define PRPSINFO_UID_T uint16_t
+# define ALIGN_PRPSINFO_UID_T 2
+# define TYPE_PRPSINFO_UID_T ELF_T_HALF
+# define PRPSINFO_GID_T uint16_t
+# define ALIGN_PRPSINFO_GID_T 2
+# define TYPE_PRPSINFO_GID_T ELF_T_HALF
+#else
+# define ULONG uint64_t
+# define ALIGN_ULONG 8
+# define TYPE_ULONG ELF_T_XWORD
+# define PRPSINFO_UID_T uint32_t
+# define ALIGN_PRPSINFO_UID_T 4
+# define TYPE_PRPSINFO_UID_T TYPE_UID_T
+# define PRPSINFO_GID_T uint32_t
+# define ALIGN_PRPSINFO_GID_T 4
+# define TYPE_PRPSINFO_GID_T TYPE_GID_T
+#endif
+#define PR_REG uint64_t
+#define ALIGN_PR_REG 8
#define PID_T int32_t
#define UID_T uint32_t
#define GID_T uint32_t
-#define ALIGN_ULONG 8
#define ALIGN_PID_T 4
#define ALIGN_UID_T 4
#define ALIGN_GID_T 4
-#define TYPE_ULONG ELF_T_XWORD
#define TYPE_PID_T ELF_T_SWORD
#define TYPE_UID_T ELF_T_SWORD
#define TYPE_GID_T ELF_T_SWORD
diff --git a/3rdparty/elfutils/backends/x86_64_init.c b/3rdparty/elfutils/backends/x86_64_init.c
index b885558..273eabb 100644
--- a/3rdparty/elfutils/backends/x86_64_init.c
+++ b/3rdparty/elfutils/backends/x86_64_init.c
@@ -1,5 +1,6 @@
/* Initialization of x86-64 specific backend library.
Copyright (C) 2002-2009, 2013 Red Hat, Inc.
+ Copyright (C) H.J. Lu <hjl.tools@gmail.com>, 2015.
This file is part of elfutils.
Written by Ulrich Drepper <drepper@redhat.com>, 2002.
@@ -38,6 +39,8 @@
/* This defines the common reloc hooks based on x86_64_reloc.def. */
#include "common-reloc.c"
+extern __typeof (EBLHOOK (core_note)) x32_core_note attribute_hidden;
+
const char *
x86_64_init (elf, machine, eh, ehlen)
Elf *elf __attribute__ ((unused));
@@ -53,7 +56,10 @@ x86_64_init (elf, machine, eh, ehlen)
eh->name = "AMD x86-64";
x86_64_init_reloc (eh);
HOOK (eh, reloc_simple_type);
- HOOK (eh, core_note);
+ if (eh->class == ELFCLASS32)
+ eh->core_note = x32_core_note;
+ else
+ HOOK (eh, core_note);
HOOK (eh, return_value_location);
HOOK (eh, register_info);
HOOK (eh, syscall_abi);
diff --git a/3rdparty/elfutils/backends/x86_64_reloc.def b/3rdparty/elfutils/backends/x86_64_reloc.def
index 8ed98f6..ad84efa 100644
--- a/3rdparty/elfutils/backends/x86_64_reloc.def
+++ b/3rdparty/elfutils/backends/x86_64_reloc.def
@@ -1,5 +1,5 @@
/* List the relocation types for x86-64. -*- C -*-
- Copyright (C) 2000, 2001, 2002, 2003, 2005, 2009 Red Hat, Inc.
+ Copyright (C) 2000, 2001, 2002, 2003, 2005, 2009, 2015 Red Hat, Inc.
This file is part of elfutils.
This file is free software; you can redistribute it and/or modify
@@ -33,7 +33,7 @@ RELOC_TYPE (64, REL|EXEC|DYN)
RELOC_TYPE (PC32, REL|EXEC|DYN)
RELOC_TYPE (GOT32, REL)
RELOC_TYPE (PLT32, REL)
-RELOC_TYPE (COPY, EXEC)
+RELOC_TYPE (COPY, EXEC|DYN)
RELOC_TYPE (GLOB_DAT, EXEC|DYN)
RELOC_TYPE (JUMP_SLOT, EXEC|DYN)
RELOC_TYPE (RELATIVE, EXEC|DYN)
diff --git a/3rdparty/elfutils/config.h b/3rdparty/elfutils/config.h
index fbf5f8e..b9606cb 100644
--- a/3rdparty/elfutils/config.h
+++ b/3rdparty/elfutils/config.h
@@ -1,6 +1,9 @@
/* config.h. Generated from config.h.in by configure. */
/* config.h.in. Generated from configure.ac by autoheader. */
+/* Building with -fsanitize=undefined or not */
+#define CHECK_UNDEFINED false
+
/* Should ar and ranlib use -D behavior by default? */
#define DEFAULT_AR_DETERMINISTIC false
@@ -53,7 +56,7 @@
#define PACKAGE_NAME "elfutils"
/* Define to the full name and version of this package. */
-#define PACKAGE_STRING "elfutils 0.161"
+#define PACKAGE_STRING "elfutils 0.163"
/* Define to the one symbol short name of this package. */
#define PACKAGE_TARNAME "elfutils"
@@ -62,7 +65,7 @@
#define PACKAGE_URL ""
/* Define to the version of this package. */
-#define PACKAGE_VERSION "0.161"
+#define PACKAGE_VERSION "0.163"
/* The size of `long', as computed by sizeof. */
#define SIZEOF_LONG 8
@@ -86,7 +89,7 @@
#define USE_ZLIB 1
/* Version number of package */
-#define VERSION "0.161"
+#define VERSION "0.163"
/* Define to 1 if `lex' declares `yytext' as a `char *' by default, not a
`char[]'. */
diff --git a/3rdparty/elfutils/elfutils.pri b/3rdparty/elfutils/elfutils.pri
index 3df30f3..65153b1 100644
--- a/3rdparty/elfutils/elfutils.pri
+++ b/3rdparty/elfutils/elfutils.pri
@@ -1,4 +1,4 @@
-VERSION = 0.161
+VERSION = 0.163
QMAKE_CFLAGS += -std=gnu99
DEFINES += HAVE_CONFIG_H _GNU_SOURCE
diff --git a/3rdparty/elfutils/lib/eu-config.h b/3rdparty/elfutils/lib/eu-config.h
index 3afff26..400cdc6 100644
--- a/3rdparty/elfutils/lib/eu-config.h
+++ b/3rdparty/elfutils/lib/eu-config.h
@@ -73,7 +73,8 @@
/* Define ALLOW_UNALIGNED if the architecture allows operations on
unaligned memory locations. */
-#if defined __i386__ || defined __x86_64__
+#define SANITIZE_UNDEFINED 1
+#if (defined __i386__ || defined __x86_64__) && ! CHECK_UNDEFINED
# define ALLOW_UNALIGNED 1
#else
# define ALLOW_UNALIGNED 0
@@ -163,7 +164,7 @@ asm (".section predict_data, \"aw\"; .previous\n"
#define ELFUTILS_HEADER(name) <lib##name.h>
-#ifdef SHARED
+#ifdef SYMBOL_VERSIONING
# define OLD_VERSION(name, version) \
asm (".globl _compat." #version "." #name "\n" \
"_compat." #version "." #name " = " #name "\n" \
@@ -181,8 +182,8 @@ asm (".section predict_data, \"aw\"; .previous\n"
# define OLD_VERSION(name, version) /* Nothing for static linking. */
# define NEW_VERSION(name, version) /* Nothing for static linking. */
# define COMPAT_VERSION_NEWPROTO(name, version, prefix) \
- error "should use #ifdef SHARED"
-# define COMPAT_VERSION(name, version, prefix) error "should use #ifdef SHARED"
+ error "should use #ifdef SYMBOL_VERSIONING"
+# define COMPAT_VERSION(name, version, prefix) error "should use #ifdef SYMBOL_VERSIONING"
#endif
diff --git a/3rdparty/elfutils/libdw/cfi.c b/3rdparty/elfutils/libdw/cfi.c
index 632e91d..5a6f956 100644
--- a/3rdparty/elfutils/libdw/cfi.c
+++ b/3rdparty/elfutils/libdw/cfi.c
@@ -1,5 +1,5 @@
/* CFI program execution.
- Copyright (C) 2009-2010, 2014 Red Hat, Inc.
+ Copyright (C) 2009-2010, 2014, 2015 Red Hat, Inc.
This file is part of elfutils.
This file is free software; you can redistribute it and/or modify
@@ -79,6 +79,15 @@ execute_cfi (Dwarf_CFI *cache,
Dwarf_Frame *fs = *state;
inline bool enough_registers (Dwarf_Word reg)
{
+ /* Don't allow insanely large register numbers. 268435456 registers
+ should be enough for anybody. And very large values might overflow
+ the array size and offsetof calculations below. */
+ if (unlikely (reg >= INT32_MAX / sizeof (fs->regs[0])))
+ {
+ result = DWARF_E_INVALID_CFI;
+ return false;
+ }
+
if (fs->nregs <= reg)
{
size_t size = offsetof (Dwarf_Frame, regs[reg + 1]);
diff --git a/3rdparty/elfutils/libdw/cfi.h b/3rdparty/elfutils/libdw/cfi.h
index 98ac6cf..1ebf2dc 100644
--- a/3rdparty/elfutils/libdw/cfi.h
+++ b/3rdparty/elfutils/libdw/cfi.h
@@ -1,5 +1,5 @@
/* Internal definitions for libdw CFI interpreter.
- Copyright (C) 2009-2010, 2013 Red Hat, Inc.
+ Copyright (C) 2009-2010, 2013, 2015 Red Hat, Inc.
This file is part of elfutils.
This file is free software; you can redistribute it and/or modify
@@ -103,6 +103,7 @@ struct Dwarf_CFI_s
/* Binary search table in .eh_frame_hdr section. */
const uint8_t *search_table;
+ size_t search_table_len;
Dwarf_Addr search_table_vaddr;
size_t search_table_entries;
uint8_t search_table_encoding;
diff --git a/3rdparty/elfutils/libdw/dwarf.h b/3rdparty/elfutils/libdw/dwarf.h
index da8cf3a..5b88c8f 100644
--- a/3rdparty/elfutils/libdw/dwarf.h
+++ b/3rdparty/elfutils/libdw/dwarf.h
@@ -94,6 +94,9 @@ enum
DW_TAG_rvalue_reference_type = 0x42,
DW_TAG_template_alias = 0x43,
+ /* DWARF 5. */
+ DW_TAG_atomic_type = 0x47,
+
DW_TAG_lo_user = 0x4080,
DW_TAG_MIPS_loop = 0x4081,
@@ -589,6 +592,8 @@ enum
DW_LANG_C_plus_plus_11 = 0x001a, /* ISO C++:2011 */
DW_LANG_C11 = 0x001d, /* ISO C:2011 */
DW_LANG_C_plus_plus_14 = 0x0021, /* ISO C++:2014 */
+ DW_LANG_Fortran03 = 0x0022, /* ISO/IEC 1539-1:2004 */
+ DW_LANG_Fortran08 = 0x0023, /* ISO/IEC 1539-1:2010 */
DW_LANG_lo_user = 0x8000,
diff --git a/3rdparty/elfutils/libdw/dwarf_aggregate_size.c b/3rdparty/elfutils/libdw/dwarf_aggregate_size.c
index 667c274..0247847 100644
--- a/3rdparty/elfutils/libdw/dwarf_aggregate_size.c
+++ b/3rdparty/elfutils/libdw/dwarf_aggregate_size.c
@@ -123,6 +123,8 @@ array_size (Dwarf_Die *die, Dwarf_Word *size,
case DW_LANG_Fortran77:
case DW_LANG_Fortran90:
case DW_LANG_Fortran95:
+ case DW_LANG_Fortran03:
+ case DW_LANG_Fortran08:
case DW_LANG_Pascal83:
case DW_LANG_Modula2:
case DW_LANG_PL1:
diff --git a/3rdparty/elfutils/libdw/dwarf_begin_elf.c b/3rdparty/elfutils/libdw/dwarf_begin_elf.c
index 4c49ce2..6d38946 100644
--- a/3rdparty/elfutils/libdw/dwarf_begin_elf.c
+++ b/3rdparty/elfutils/libdw/dwarf_begin_elf.c
@@ -1,5 +1,5 @@
/* Create descriptor from ELF descriptor for processing file.
- Copyright (C) 2002-2011, 2014 Red Hat, Inc.
+ Copyright (C) 2002-2011, 2014, 2015 Red Hat, Inc.
This file is part of elfutils.
Written by Ulrich Drepper <drepper@redhat.com>, 2002.
@@ -71,6 +71,70 @@ static const char dwarf_scnnames[IDX_last][18] =
};
#define ndwarf_scnnames (sizeof (dwarf_scnnames) / sizeof (dwarf_scnnames[0]))
+#if USE_ZLIB
+static Elf_Data *
+inflate_section (Elf_Data * data)
+{
+ /* There is a 12-byte header of "ZLIB" followed by
+ an 8-byte big-endian size. */
+
+ if (unlikely (data->d_size < 4 + 8)
+ || unlikely (memcmp (data->d_buf, "ZLIB", 4) != 0))
+ return NULL;
+
+ uint64_t size;
+ memcpy (&size, data->d_buf + 4, sizeof size);
+ size = be64toh (size);
+
+ /* Check for unsigned overflow so malloc always allocated
+ enough memory for both the Elf_Data header and the
+ uncompressed section data. */
+ if (unlikely (sizeof (Elf_Data) + size < size))
+ return NULL;
+
+ Elf_Data *zdata = malloc (sizeof (Elf_Data) + size);
+ if (unlikely (zdata == NULL))
+ return NULL;
+
+ zdata->d_buf = &zdata[1];
+ zdata->d_type = ELF_T_BYTE;
+ zdata->d_version = EV_CURRENT;
+ zdata->d_size = size;
+ zdata->d_off = 0;
+ zdata->d_align = 1;
+
+ z_stream z =
+ {
+ .next_in = data->d_buf + 4 + 8,
+ .avail_in = data->d_size - 4 - 8,
+ .next_out = zdata->d_buf,
+ .avail_out = zdata->d_size
+ };
+ int zrc = inflateInit (&z);
+ while (z.avail_in > 0 && likely (zrc == Z_OK))
+ {
+ z.next_out = zdata->d_buf + (zdata->d_size - z.avail_out);
+ zrc = inflate (&z, Z_FINISH);
+ if (unlikely (zrc != Z_STREAM_END))
+ {
+ zrc = Z_DATA_ERROR;
+ break;
+ }
+ zrc = inflateReset (&z);
+ }
+ if (likely (zrc == Z_OK))
+ zrc = inflateEnd (&z);
+
+ if (unlikely (zrc != Z_OK) || unlikely (z.avail_out != 0))
+ {
+ free (zdata);
+ return NULL;
+ }
+
+ return zdata;
+}
+#endif
+
static Dwarf *
check_section (Dwarf *result, GElf_Ehdr *ehdr, Elf_Scn *scn, bool inscngrp)
{
@@ -118,99 +182,60 @@ check_section (Dwarf *result, GElf_Ehdr *ehdr, Elf_Scn *scn, bool inscngrp)
/* Recognize the various sections. Most names start with .debug_. */
size_t cnt;
+ bool compressed = false;
for (cnt = 0; cnt < ndwarf_scnnames; ++cnt)
if (strcmp (scnname, dwarf_scnnames[cnt]) == 0)
- {
- /* Found it. Remember where the data is. */
- if (unlikely (result->sectiondata[cnt] != NULL))
- /* A section appears twice. That's bad. We ignore the section. */
- break;
-
- /* Get the section data. */
- Elf_Data *data = elf_getdata (scn, NULL);
- if (data != NULL && data->d_size != 0)
- /* Yep, there is actually data available. */
- result->sectiondata[cnt] = data;
-
- break;
- }
-#if USE_ZLIB
+ break;
else if (scnname[0] == '.' && scnname[1] == 'z'
&& strcmp (&scnname[2], &dwarf_scnnames[cnt][1]) == 0)
{
- /* A compressed section. */
+ compressed = true;
+ break;
+ }
- if (unlikely (result->sectiondata[cnt] != NULL))
- /* A section appears twice. That's bad. We ignore the section. */
- break;
+ if (cnt >= ndwarf_scnnames)
+ /* Not a debug section; ignore it. */
+ return result;
+
+ if (unlikely (result->sectiondata[cnt] != NULL))
+ /* A section appears twice. That's bad. We ignore the section. */
+ return result;
- /* Get the section data. */
- Elf_Data *data = elf_getdata (scn, NULL);
- if (data != NULL && data->d_size != 0)
- {
- /* There is a 12-byte header of "ZLIB" followed by
- an 8-byte big-endian size. */
-
- if (unlikely (data->d_size < 4 + 8)
- || unlikely (memcmp (data->d_buf, "ZLIB", 4) != 0))
- break;
-
- uint64_t size;
- memcpy (&size, data->d_buf + 4, sizeof size);
- size = be64toh (size);
-
- /* Check for unsigned overflow so malloc always allocated
- enough memory for both the Elf_Data header and the
- uncompressed section data. */
- if (unlikely (sizeof (Elf_Data) + size < size))
- break;
-
- Elf_Data *zdata = malloc (sizeof (Elf_Data) + size);
- if (unlikely (zdata == NULL))
- break;
-
- zdata->d_buf = &zdata[1];
- zdata->d_type = ELF_T_BYTE;
- zdata->d_version = EV_CURRENT;
- zdata->d_size = size;
- zdata->d_off = 0;
- zdata->d_align = 1;
-
- z_stream z =
- {
- .next_in = data->d_buf + 4 + 8,
- .avail_in = data->d_size - 4 - 8,
- .next_out = zdata->d_buf,
- .avail_out = zdata->d_size
- };
- int zrc = inflateInit (&z);
- while (z.avail_in > 0 && likely (zrc == Z_OK))
- {
- z.next_out = zdata->d_buf + (zdata->d_size - z.avail_out);
- zrc = inflate (&z, Z_FINISH);
- if (unlikely (zrc != Z_STREAM_END))
- {
- zrc = Z_DATA_ERROR;
- break;
- }
- zrc = inflateReset (&z);
- }
- if (likely (zrc == Z_OK))
- zrc = inflateEnd (&z);
-
- if (unlikely (zrc != Z_OK) || unlikely (z.avail_out != 0))
- free (zdata);
- else
- {
- result->sectiondata[cnt] = zdata;
- result->sectiondata_gzip_mask |= 1U << cnt;
- }
- }
+ /* Get the section data. */
+ Elf_Data *data = elf_getdata (scn, NULL);
+ if (data == NULL || data->d_size == 0)
+ /* No data actually available, ignore it. */
+ return result;
- break;
- }
+ /* We can now read the section data into results. */
+ if (!compressed)
+ result->sectiondata[cnt] = data;
+ else
+ {
+ /* A compressed section. */
+
+#if USE_ZLIB
+ Elf_Data *inflated = inflate_section(data);
+ if (inflated != NULL)
+ {
+ result->sectiondata[cnt] = inflated;
+ result->sectiondata_gzip_mask |= 1U << cnt;
+ }
#endif
+ /* If we failed to decompress the section and it's the debug_info section,
+ * then fail with specific error rather than the generic NO_DWARF. Without
+ * debug_info we can't do anything (see also valid_p()). */
+ if (result->sectiondata[cnt] == NULL && cnt == IDX_debug_info)
+ {
+ __libdw_free_zdata (result);
+ Dwarf_Sig8_Hash_free (&result->sig8_hash);
+ __libdw_seterrno (DWARF_E_COMPRESSED_ERROR);
+ free (result);
+ return NULL;
+ }
+ }
+
return result;
}
@@ -340,6 +365,7 @@ dwarf_begin_elf (elf, cmd, scngrp)
/* Default memory allocation size. */
size_t mem_default_size = sysconf (_SC_PAGESIZE) - 4 * sizeof (void *);
+ assert (sizeof (struct Dwarf) < mem_default_size);
/* Allocate the data structure. */
Dwarf *result = (Dwarf *) calloc (1, sizeof (Dwarf) + mem_default_size);
diff --git a/3rdparty/elfutils/libdw/dwarf_error.c b/3rdparty/elfutils/libdw/dwarf_error.c
index 08b691a..fe38999 100644
--- a/3rdparty/elfutils/libdw/dwarf_error.c
+++ b/3rdparty/elfutils/libdw/dwarf_error.c
@@ -1,5 +1,5 @@
/* Retrieve ELF descriptor used for DWARF access.
- Copyright (C) 2002, 2003, 2004, 2005, 2009, 2014 Red Hat, Inc.
+ Copyright (C) 2002, 2003, 2004, 2005, 2009, 2014, 2015 Red Hat, Inc.
This file is part of elfutils.
Written by Ulrich Drepper <drepper@redhat.com>, 2002.
@@ -62,6 +62,7 @@ static const char *errmsgs[] =
[DWARF_E_IO_ERROR] = N_("I/O error"),
[DWARF_E_INVALID_ELF] = N_("invalid ELF file"),
[DWARF_E_NO_DWARF] = N_("no DWARF information"),
+ [DWARF_E_COMPRESSED_ERROR] = N_("cannot decompress DWARF"),
[DWARF_E_NOELF] = N_("no ELF file"),
[DWARF_E_GETEHDR_ERROR] = N_("cannot get ELF header"),
[DWARF_E_NOMEM] = N_("out of memory"),
@@ -93,6 +94,7 @@ static const char *errmsgs[] =
[DWARF_E_INVALID_CFI] = N_("invalid CFI section"),
[DWARF_E_NO_ALT_DEBUGLINK] = N_("no alternative debug link found"),
[DWARF_E_INVALID_OPCODE] = N_("invalid opcode"),
+ [DWARF_E_NOT_CUDIE] = N_("not a CU (unit) DIE"),
};
#define nerrmsgs (sizeof (errmsgs) / sizeof (errmsgs[0]))
diff --git a/3rdparty/elfutils/libdw/dwarf_formref_die.c b/3rdparty/elfutils/libdw/dwarf_formref_die.c
index 63f6697..8b92e22 100644
--- a/3rdparty/elfutils/libdw/dwarf_formref_die.c
+++ b/3rdparty/elfutils/libdw/dwarf_formref_die.c
@@ -95,7 +95,7 @@ dwarf_formref_die (attr, result)
datap = cu->dbg->sectiondata[IDX_debug_types]->d_buf;
size = cu->dbg->sectiondata[IDX_debug_types]->d_size;
- offset = cu->type_offset;
+ offset = cu->start + cu->type_offset;
}
else
{
diff --git a/3rdparty/elfutils/libdw/dwarf_func_inline.c b/3rdparty/elfutils/libdw/dwarf_func_inline.c
index bc9db1c..1f04adf 100644
--- a/3rdparty/elfutils/libdw/dwarf_func_inline.c
+++ b/3rdparty/elfutils/libdw/dwarf_func_inline.c
@@ -1,5 +1,5 @@
/* Convenience functions for handling DWARF descriptions of inline functions.
- Copyright (C) 2005,2006 Red Hat, Inc.
+ Copyright (C) 2005,2006,2015 Red Hat, Inc.
This file is part of elfutils.
This file is free software; you can redistribute it and/or modify
@@ -97,5 +97,5 @@ dwarf_func_inline_instances (Dwarf_Die *func,
{
struct visitor_info v = { func->addr, callback, arg };
struct Dwarf_Die_Chain cu = { .die = CUDIE (func->cu), .parent = NULL };
- return __libdw_visit_scopes (0, &cu, &scope_visitor, NULL, &v);
+ return __libdw_visit_scopes (0, &cu, NULL, &scope_visitor, NULL, &v);
}
diff --git a/3rdparty/elfutils/libdw/dwarf_getaranges.c b/3rdparty/elfutils/libdw/dwarf_getaranges.c
index 4953af5..6c6169e 100644
--- a/3rdparty/elfutils/libdw/dwarf_getaranges.c
+++ b/3rdparty/elfutils/libdw/dwarf_getaranges.c
@@ -110,10 +110,16 @@ dwarf_getaranges (dbg, aranges, naranges)
5. A 1-byte unsigned integer containing the size in bytes of
a segment descriptor on the target system. */
+ if (unlikely (readp + 4 > readendp))
+ goto invalid;
+
Dwarf_Word length = read_4ubyte_unaligned_inc (dbg, readp);
unsigned int length_bytes = 4;
if (length == DWARF3_LENGTH_64_BIT)
{
+ if (unlikely (readp + 8 > readendp))
+ goto invalid;
+
length = read_8ubyte_unaligned_inc (dbg, readp);
length_bytes = 8;
}
@@ -121,6 +127,9 @@ dwarf_getaranges (dbg, aranges, naranges)
&& length <= DWARF3_LENGTH_MAX_ESCAPE_CODE))
goto invalid;
+ if (unlikely (readp + 2 > readendp))
+ goto invalid;
+
unsigned int version = read_2ubyte_unaligned_inc (dbg, readp);
if (version != 2)
{
@@ -136,14 +145,14 @@ dwarf_getaranges (dbg, aranges, naranges)
return -1;
}
- Dwarf_Word offset;
+ Dwarf_Word offset = 0;
if (__libdw_read_offset_inc (dbg,
IDX_debug_aranges, &readp,
length_bytes, &offset, IDX_debug_info, 4))
goto fail;
unsigned int address_size = *readp++;
- if (address_size != 4 && address_size != 8)
+ if (unlikely (address_size != 4 && address_size != 8))
goto invalid;
/* We don't actually support segment selectors. */
@@ -164,6 +173,9 @@ dwarf_getaranges (dbg, aranges, naranges)
address_size, &range_address))
goto fail;
+ if (readp + address_size > readendp)
+ goto invalid;
+
if (address_size == 4)
range_length = read_4ubyte_unaligned_inc (dbg, readp);
else
diff --git a/3rdparty/elfutils/libdw/dwarf_getcfi_elf.c b/3rdparty/elfutils/libdw/dwarf_getcfi_elf.c
index 61ca60d..3e611f8 100644
--- a/3rdparty/elfutils/libdw/dwarf_getcfi_elf.c
+++ b/3rdparty/elfutils/libdw/dwarf_getcfi_elf.c
@@ -1,5 +1,5 @@
/* Get CFI from ELF file's exception-handling info.
- Copyright (C) 2009-2010, 2014 Red Hat, Inc.
+ Copyright (C) 2009-2010, 2014, 2015 Red Hat, Inc.
This file is part of elfutils.
This file is free software; you can redistribute it and/or modify
@@ -76,7 +76,7 @@ parse_eh_frame_hdr (const uint8_t *hdr, size_t hdr_size, GElf_Addr hdr_vaddr,
{
const uint8_t *h = hdr;
- if (*h++ != 1) /* version */
+ if (hdr_size < 4 || *h++ != 1) /* version */
return (void *) -1l;
uint8_t eh_frame_ptr_encoding = *h++;
@@ -125,20 +125,17 @@ parse_eh_frame_hdr (const uint8_t *hdr, size_t hdr_size, GElf_Addr hdr_vaddr,
static Dwarf_CFI *
getcfi_gnu_eh_frame (Elf *elf, const GElf_Ehdr *ehdr, const GElf_Phdr *phdr)
{
- if (unlikely (phdr->p_filesz < 4))
- goto invalid;
-
Elf_Data *data = elf_getdata_rawchunk (elf, phdr->p_offset, phdr->p_filesz,
ELF_T_BYTE);
- if (data == NULL)
+ if (data == NULL || data->d_buf == NULL)
{
invalid_hdr:
- invalid:
/* XXX might be read error or corrupt phdr */
__libdw_seterrno (DWARF_E_INVALID_CFI);
return NULL;
}
+ size_t vsize, dmax;
Dwarf_Addr eh_frame_ptr;
size_t search_table_entries = 0;
uint8_t search_table_encoding = 0;
@@ -147,7 +144,15 @@ getcfi_gnu_eh_frame (Elf *elf, const GElf_Ehdr *ehdr, const GElf_Phdr *phdr)
&eh_frame_ptr,
&search_table_entries,
&search_table_encoding);
- if (search_table == (void *) -1l)
+
+ /* Make sure there is enough room for the entries in the table,
+ each entry consists of 2 encoded values. */
+ vsize = encoded_value_size (data, ehdr->e_ident, search_table_encoding,
+ NULL);
+ dmax = phdr->p_filesz - (search_table - (const uint8_t *) data->d_buf);
+ if (unlikely (search_table == (void *) -1l
+ || vsize == 0
+ || search_table_entries > (dmax / vsize) / 2))
goto invalid_hdr;
Dwarf_Off eh_frame_offset = eh_frame_ptr - phdr->p_vaddr + phdr->p_offset;
@@ -175,6 +180,7 @@ getcfi_gnu_eh_frame (Elf *elf, const GElf_Ehdr *ehdr, const GElf_Phdr *phdr)
if (search_table != NULL)
{
cfi->search_table = search_table;
+ cfi->search_table_len = phdr->p_filesz;
cfi->search_table_vaddr = phdr->p_vaddr;
cfi->search_table_encoding = search_table_encoding;
cfi->search_table_entries = search_table_entries;
@@ -211,7 +217,7 @@ getcfi_scn_eh_frame (Elf *elf, const GElf_Ehdr *ehdr,
Elf_Scn *hdr_scn, GElf_Addr hdr_vaddr)
{
Elf_Data *data = elf_rawdata (scn, NULL);
- if (data == NULL)
+ if (data == NULL || data->d_buf == NULL)
{
__libdw_seterrno (DWARF_E_INVALID_ELF);
return NULL;
@@ -223,8 +229,9 @@ getcfi_scn_eh_frame (Elf *elf, const GElf_Ehdr *ehdr,
if (hdr_scn != NULL)
{
Elf_Data *hdr_data = elf_rawdata (hdr_scn, NULL);
- if (hdr_data != NULL)
+ if (hdr_data != NULL && hdr_data->d_buf != NULL)
{
+ size_t vsize, dmax;
GElf_Addr eh_frame_vaddr;
cfi->search_table_vaddr = hdr_vaddr;
cfi->search_table
@@ -232,7 +239,17 @@ getcfi_scn_eh_frame (Elf *elf, const GElf_Ehdr *ehdr,
hdr_vaddr, ehdr, &eh_frame_vaddr,
&cfi->search_table_entries,
&cfi->search_table_encoding);
- if (cfi->search_table == (void *) -1l)
+ cfi->search_table_len = hdr_data->d_size;
+
+ /* Make sure there is enough room for the entries in the table,
+ each entry consists of 2 encoded values. */
+ vsize = encoded_value_size (hdr_data, ehdr->e_ident,
+ cfi->search_table_encoding, NULL);
+ dmax = hdr_data->d_size - (cfi->search_table
+ - (const uint8_t *) hdr_data->d_buf);
+ if (unlikely (cfi->search_table == (void *) -1l
+ || vsize == 0
+ || cfi->search_table_entries > (dmax / vsize) / 2))
{
free (cfi);
/* XXX might be read error or corrupt phdr */
diff --git a/3rdparty/elfutils/libdw/dwarf_getfuncs.c b/3rdparty/elfutils/libdw/dwarf_getfuncs.c
index f79b0a7..b95f06f 100644
--- a/3rdparty/elfutils/libdw/dwarf_getfuncs.c
+++ b/3rdparty/elfutils/libdw/dwarf_getfuncs.c
@@ -1,5 +1,5 @@
/* Get function information.
- Copyright (C) 2005, 2013 Red Hat, Inc.
+ Copyright (C) 2005, 2013, 2015 Red Hat, Inc.
This file is part of elfutils.
Written by Ulrich Drepper <drepper@redhat.com>, 2005.
@@ -109,7 +109,7 @@ dwarf_getfuncs (Dwarf_Die *cudie, int (*callback) (Dwarf_Die *, void *),
struct visitor_info v = { callback, arg, (void *) offset, NULL, c_cu };
struct Dwarf_Die_Chain chain = { .die = CUDIE (cudie->cu),
.parent = NULL };
- int res = __libdw_visit_scopes (0, &chain, &tree_visitor, NULL, &v);
+ int res = __libdw_visit_scopes (0, &chain, NULL, &tree_visitor, NULL, &v);
if (res == DWARF_CB_ABORT)
return (ptrdiff_t) v.last_addr;
diff --git a/3rdparty/elfutils/libdw/dwarf_getlocation.c b/3rdparty/elfutils/libdw/dwarf_getlocation.c
index 068f385..f1dda68 100644
--- a/3rdparty/elfutils/libdw/dwarf_getlocation.c
+++ b/3rdparty/elfutils/libdw/dwarf_getlocation.c
@@ -1,5 +1,5 @@
/* Return location expression list.
- Copyright (C) 2000-2010, 2013, 2014 Red Hat, Inc.
+ Copyright (C) 2000-2010, 2013-2015 Red Hat, Inc.
This file is part of elfutils.
Written by Ulrich Drepper <drepper@redhat.com>, 2000.
@@ -239,18 +239,28 @@ __libdw_intern_expression (Dwarf *dbg, bool other_byte_order,
struct loclist *loclist = NULL;
unsigned int n = 0;
+ /* Stack allocate at most this many locs. */
+#define MAX_STACK_LOCS 256
+ struct loclist stack_locs[MAX_STACK_LOCS];
+#define NEW_LOC() ({ struct loclist *ll; \
+ ll = (likely (n < MAX_STACK_LOCS) \
+ ? &stack_locs[n] \
+ : malloc (sizeof (struct loclist))); \
+ if (unlikely (ll == NULL)) \
+ goto nomem; \
+ n++; \
+ ll->next = loclist; \
+ loclist = ll; \
+ ll; })
+
if (cfap)
{
/* Synthesize the operation to push the CFA before the expression. */
- struct loclist *newloc;
- newloc = (struct loclist *) alloca (sizeof (struct loclist));
+ struct loclist *newloc = NEW_LOC ();
newloc->atom = DW_OP_call_frame_cfa;
newloc->number = 0;
newloc->number2 = 0;
newloc->offset = -1;
- newloc->next = loclist;
- loclist = newloc;
- ++n;
}
/* Decode the opcodes. It is possible in some situations to have a
@@ -258,28 +268,45 @@ __libdw_intern_expression (Dwarf *dbg, bool other_byte_order,
while (data < end_data)
{
struct loclist *newloc;
- newloc = (struct loclist *) alloca (sizeof (struct loclist));
+ newloc = NEW_LOC ();
newloc->number = 0;
newloc->number2 = 0;
newloc->offset = data - block->data;
- newloc->next = loclist;
- loclist = newloc;
- ++n;
switch ((newloc->atom = *data++))
{
case DW_OP_addr:
/* Address, depends on address size of CU. */
- if (__libdw_read_address_inc (dbg, sec_index, &data,
- address_size, &newloc->number))
- return -1;
+ if (dbg == NULL)
+ {
+ // XXX relocation?
+ if (address_size == 4)
+ {
+ if (unlikely (data + 4 > end_data))
+ goto invalid;
+ else
+ newloc->number = read_4ubyte_unaligned_inc (&bo, data);
+ }
+ else
+ {
+ if (unlikely (data + 8 > end_data))
+ goto invalid;
+ else
+ newloc->number = read_8ubyte_unaligned_inc (&bo, data);
+ }
+ }
+ else if (__libdw_read_address_inc (dbg, sec_index, &data,
+ address_size, &newloc->number))
+ goto invalid;
break;
case DW_OP_call_ref:
/* DW_FORM_ref_addr, depends on offset size of CU. */
- if (__libdw_read_offset_inc (dbg, sec_index, &data, ref_size,
- &newloc->number, IDX_debug_info, 0))
- return -1;
+ if (dbg == NULL || __libdw_read_offset_inc (dbg, sec_index, &data,
+ ref_size,
+ &newloc->number,
+ IDX_debug_info, 0))
+ goto invalid;
break;
case DW_OP_deref:
@@ -328,6 +355,15 @@ __libdw_intern_expression (Dwarf *dbg, bool other_byte_order,
{
invalid:
__libdw_seterrno (DWARF_E_INVALID_DWARF);
+ returnmem:
+ /* Free any dynamicly allocated loclists, if any. */
+ while (n > MAX_STACK_LOCS)
+ {
+ struct loclist *loc = loclist;
+ loclist = loc->next;
+ free (loc);
+ n--;
+ }
return -1;
}
@@ -435,9 +471,11 @@ __libdw_intern_expression (Dwarf *dbg, bool other_byte_order,
case DW_OP_GNU_implicit_pointer:
/* DW_FORM_ref_addr, depends on offset size of CU. */
- if (__libdw_read_offset_inc (dbg, sec_index, &data, ref_size,
- &newloc->number, IDX_debug_info, 0))
- return -1;
+ if (dbg == NULL || __libdw_read_offset_inc (dbg, sec_index, &data,
+ ref_size,
+ &newloc->number,
+ IDX_debug_info, 0))
+ goto invalid;
if (unlikely (data >= end_data))
goto invalid;
get_uleb128 (newloc->number2, data, end_data); /* Byte offset. */
@@ -481,15 +519,11 @@ __libdw_intern_expression (Dwarf *dbg, bool other_byte_order,
if (valuep)
{
- struct loclist *newloc;
- newloc = (struct loclist *) alloca (sizeof (struct loclist));
+ struct loclist *newloc = NEW_LOC ();
newloc->atom = DW_OP_stack_value;
newloc->number = 0;
newloc->number2 = 0;
newloc->offset = data - block->data;
- newloc->next = loclist;
- loclist = newloc;
- ++n;
}
/* Allocate the array. */
@@ -503,7 +537,7 @@ __libdw_intern_expression (Dwarf *dbg, bool other_byte_order,
{
nomem:
__libdw_seterrno (DWARF_E_NOMEM);
- return -1;
+ goto returnmem;
}
}
@@ -523,7 +557,10 @@ __libdw_intern_expression (Dwarf *dbg, bool other_byte_order,
if (result[n].atom == DW_OP_implicit_value)
store_implicit_value (dbg, cache, &result[n]);
+ struct loclist *loc = loclist;
loclist = loclist->next;
+ if (unlikely (n + 1 > MAX_STACK_LOCS))
+ free (loc);
}
while (n > 0);
diff --git a/3rdparty/elfutils/libdw/dwarf_getmacros.c b/3rdparty/elfutils/libdw/dwarf_getmacros.c
index f9f2996..a326e58 100644
--- a/3rdparty/elfutils/libdw/dwarf_getmacros.c
+++ b/3rdparty/elfutils/libdw/dwarf_getmacros.c
@@ -125,7 +125,8 @@ get_macinfo_table (Dwarf *dbg, Dwarf_Word macoff, Dwarf_Die *cudie)
= INTUSE(dwarf_attr) (cudie, DW_AT_stmt_list, &attr_mem);
Dwarf_Off line_offset = (Dwarf_Off) -1;
if (attr != NULL)
- INTUSE(dwarf_formudata) (attr, &line_offset);
+ if (unlikely (INTUSE(dwarf_formudata) (attr, &line_offset) != 0))
+ return NULL;
Dwarf_Macro_Op_Table *table = libdw_alloc (dbg, Dwarf_Macro_Op_Table,
macinfo_data_size, 1);
@@ -178,7 +179,8 @@ get_table_for_offset (Dwarf *dbg, Dwarf_Word macoff,
Dwarf_Attribute attr_mem, *attr
= INTUSE(dwarf_attr) (cudie, DW_AT_stmt_list, &attr_mem);
if (attr != NULL)
- INTUSE(dwarf_formudata) (attr, &line_offset);
+ if (unlikely (INTUSE(dwarf_formudata) (attr, &line_offset) != 0))
+ return NULL;
}
/* """The macinfo entry types defined in this standard may, but
@@ -361,7 +363,22 @@ read_macros (Dwarf *dbg, int sec_index,
.endp = (void *) endp,
};
- Dwarf_Attribute attributes[proto->nforms];
+ Dwarf_Attribute *attributes;
+ Dwarf_Attribute *attributesp = NULL;
+ Dwarf_Attribute nattributes[8];
+ if (unlikely (proto->nforms > 8))
+ {
+ attributesp = malloc (sizeof (Dwarf_Attribute) * proto->nforms);
+ if (attributesp == NULL)
+ {
+ __libdw_seterrno (DWARF_E_NOMEM);
+ return -1;
+ }
+ attributes = attributesp;
+ }
+ else
+ attributes = &nattributes[0];
+
for (Dwarf_Word i = 0; i < proto->nforms; ++i)
{
/* We pretend this is a DW_AT_GNU_macros attribute so that
@@ -373,8 +390,11 @@ read_macros (Dwarf *dbg, int sec_index,
attributes[i].cu = &fake_cu;
size_t len = __libdw_form_val_len (&fake_cu, proto->forms[i], readp);
- if (len == (size_t) -1)
- return -1;
+ if (unlikely (len == (size_t) -1))
+ {
+ free (attributesp);
+ return -1;
+ }
readp += len;
}
@@ -385,7 +405,11 @@ read_macros (Dwarf *dbg, int sec_index,
.attributes = attributes,
};
- if (callback (&macro, arg) != DWARF_CB_OK)
+ int res = callback (&macro, arg);
+ if (unlikely (attributesp != NULL))
+ free (attributesp);
+
+ if (res != DWARF_CB_OK)
return readp - startp;
}
diff --git a/3rdparty/elfutils/libdw/dwarf_getpubnames.c b/3rdparty/elfutils/libdw/dwarf_getpubnames.c
index 19f4eae..41b2407 100644
--- a/3rdparty/elfutils/libdw/dwarf_getpubnames.c
+++ b/3rdparty/elfutils/libdw/dwarf_getpubnames.c
@@ -127,6 +127,7 @@ get_offsets (Dwarf *dbg)
if (mem == NULL || cnt == 0)
{
+ free (mem);
__libdw_seterrno (DWARF_E_NO_ENTRY);
return -1;
}
diff --git a/3rdparty/elfutils/libdw/dwarf_getscopes.c b/3rdparty/elfutils/libdw/dwarf_getscopes.c
index 0ca6da0..df480d3 100644
--- a/3rdparty/elfutils/libdw/dwarf_getscopes.c
+++ b/3rdparty/elfutils/libdw/dwarf_getscopes.c
@@ -1,5 +1,5 @@
/* Return scope DIEs containing PC address.
- Copyright (C) 2005, 2007 Red Hat, Inc.
+ Copyright (C) 2005, 2007, 2015 Red Hat, Inc.
This file is part of elfutils.
This file is free software; you can redistribute it and/or modify
@@ -176,7 +176,7 @@ pc_record (unsigned int depth, struct Dwarf_Die_Chain *die, void *arg)
If we don't find it, return to search the containing scope.
If we do find it, the nonzero return value will bail us out
of the postorder traversal. */
- return __libdw_visit_scopes (depth, die, &origin_match, NULL, a);
+ return __libdw_visit_scopes (depth, die, NULL, &origin_match, NULL, a);
}
@@ -189,10 +189,10 @@ dwarf_getscopes (Dwarf_Die *cudie, Dwarf_Addr pc, Dwarf_Die **scopes)
struct Dwarf_Die_Chain cu = { .parent = NULL, .die = *cudie };
struct args a = { .pc = pc };
- int result = __libdw_visit_scopes (0, &cu, &pc_match, &pc_record, &a);
+ int result = __libdw_visit_scopes (0, &cu, NULL, &pc_match, &pc_record, &a);
if (result == 0 && a.scopes != NULL)
- result = __libdw_visit_scopes (0, &cu, &origin_match, NULL, &a);
+ result = __libdw_visit_scopes (0, &cu, NULL, &origin_match, NULL, &a);
if (result > 0)
*scopes = a.scopes;
diff --git a/3rdparty/elfutils/libdw/dwarf_getscopes_die.c b/3rdparty/elfutils/libdw/dwarf_getscopes_die.c
index d361585..8e2e41d 100644
--- a/3rdparty/elfutils/libdw/dwarf_getscopes_die.c
+++ b/3rdparty/elfutils/libdw/dwarf_getscopes_die.c
@@ -1,5 +1,5 @@
/* Return scope DIEs containing given DIE.
- Copyright (C) 2005 Red Hat, Inc.
+ Copyright (C) 2005, 2015 Red Hat, Inc.
This file is part of elfutils.
This file is free software; you can redistribute it and/or modify
@@ -67,7 +67,7 @@ dwarf_getscopes_die (Dwarf_Die *die, Dwarf_Die **scopes)
struct Dwarf_Die_Chain cu = { .die = CUDIE (die->cu), .parent = NULL };
void *info = die->addr;
- int result = __libdw_visit_scopes (1, &cu, &scope_visitor, NULL, &info);
+ int result = __libdw_visit_scopes (1, &cu, NULL, &scope_visitor, NULL, &info);
if (result > 0)
*scopes = info;
return result;
diff --git a/3rdparty/elfutils/libdw/dwarf_getsrc_die.c b/3rdparty/elfutils/libdw/dwarf_getsrc_die.c
index 1914cdf..a95179f 100644
--- a/3rdparty/elfutils/libdw/dwarf_getsrc_die.c
+++ b/3rdparty/elfutils/libdw/dwarf_getsrc_die.c
@@ -1,5 +1,5 @@
/* Find line information for address.
- Copyright (C) 2004, 2005 Red Hat, Inc.
+ Copyright (C) 2004, 2005, 2014 Red Hat, Inc.
This file is part of elfutils.
Written by Ulrich Drepper <drepper@redhat.com>, 2004.
@@ -45,32 +45,28 @@ dwarf_getsrc_die (Dwarf_Die *cudie, Dwarf_Addr addr)
return NULL;
/* The lines are sorted by address, so we can use binary search. */
- size_t l = 0, u = nlines;
- while (l < u)
- {
- size_t idx = (l + u) / 2;
- if (addr < lines->info[idx].addr)
- u = idx;
- else if (addr > lines->info[idx].addr || lines->info[idx].end_sequence)
- l = idx + 1;
- else
- return &lines->info[idx];
- }
-
if (nlines > 0)
- assert (lines->info[nlines - 1].end_sequence);
-
- /* If none were equal, the closest one below is what we want. We
- never want the last one, because it's the end-sequence marker
- with an address at the high bound of the CU's code. If the debug
- information is faulty and no end-sequence marker is present, we
- still ignore it. */
- if (u > 0 && u < nlines && addr > lines->info[u - 1].addr)
{
- while (lines->info[u - 1].end_sequence && u > 0)
- --u;
- if (u > 0)
- return &lines->info[u - 1];
+ size_t l = 0, u = nlines - 1;
+ while (l < u)
+ {
+ size_t idx = u - (u - l) / 2;
+ Dwarf_Line *line = &lines->info[idx];
+ if (addr < line->addr)
+ u = idx - 1;
+ else
+ l = idx;
+ }
+
+ /* This is guaranteed for us by libdw read_srclines. */
+ assert (lines->info[nlines - 1].end_sequence);
+
+ /* The last line which is less than or equal to addr is what we
+ want, unless it is the end_sequence which is after the
+ current line sequence. */
+ Dwarf_Line *line = &lines->info[l];
+ if (! line->end_sequence && line->addr <= addr)
+ return &lines->info[l];
}
__libdw_seterrno (DWARF_E_ADDR_OUTOFRANGE);
diff --git a/3rdparty/elfutils/libdw/dwarf_getsrcfiles.c b/3rdparty/elfutils/libdw/dwarf_getsrcfiles.c
index 4bfc34b..5af6f68 100644
--- a/3rdparty/elfutils/libdw/dwarf_getsrcfiles.c
+++ b/3rdparty/elfutils/libdw/dwarf_getsrcfiles.c
@@ -1,5 +1,5 @@
/* Return source file information of CU.
- Copyright (C) 2004, 2005, 2013 Red Hat, Inc.
+ Copyright (C) 2004, 2005, 2013, 2015 Red Hat, Inc.
This file is part of elfutils.
Written by Ulrich Drepper <drepper@redhat.com>, 2004.
@@ -39,10 +39,13 @@
int
dwarf_getsrcfiles (Dwarf_Die *cudie, Dwarf_Files **files, size_t *nfiles)
{
- if (unlikely (cudie == NULL
- || (INTUSE(dwarf_tag) (cudie) != DW_TAG_compile_unit
- && INTUSE(dwarf_tag) (cudie) != DW_TAG_partial_unit)))
+ if (cudie == NULL)
return -1;
+ if (! is_cudie (cudie))
+ {
+ __libdw_seterrno (DWARF_E_NOT_CUDIE);
+ return -1;
+ }
int res = -1;
diff --git a/3rdparty/elfutils/libdw/dwarf_getsrclines.c b/3rdparty/elfutils/libdw/dwarf_getsrclines.c
index 053b30f..389c824 100644
--- a/3rdparty/elfutils/libdw/dwarf_getsrclines.c
+++ b/3rdparty/elfutils/libdw/dwarf_getsrclines.c
@@ -1,5 +1,5 @@
/* Return line number information of CU.
- Copyright (C) 2004-2010, 2013, 2014 Red Hat, Inc.
+ Copyright (C) 2004-2010, 2013, 2014, 2015 Red Hat, Inc.
This file is part of elfutils.
Written by Ulrich Drepper <drepper@redhat.com>, 2004.
@@ -88,12 +88,36 @@ read_srclines (Dwarf *dbg,
struct linelist *linelist = NULL;
size_t nlinelist = 0;
+ size_t nfilelist = 0;
+ unsigned int ndirlist = 0;
- /* If there are a large number of lines don't blow up the stack.
- Keep track of the last malloced linelist record and free them
- through the next pointer at the end. */
+ struct filelist null_file =
+ {
+ .info =
+ {
+ .name = "???",
+ .mtime = 0,
+ .length = 0
+ },
+ .next = NULL
+ };
+ struct filelist *filelist = &null_file;
+
+ /* If there are a large number of lines, files or dirs don't blow up
+ the stack. Stack allocate some entries, only dynamically malloc
+ when more than MAX. */
#define MAX_STACK_ALLOC 4096
- struct linelist *malloc_linelist = NULL;
+#define MAX_STACK_LINES MAX_STACK_ALLOC
+#define MAX_STACK_FILES (MAX_STACK_ALLOC / 4)
+#define MAX_STACK_DIRS (MAX_STACK_ALLOC / 16)
+
+ struct dirlist
+ {
+ const char *dir;
+ size_t len;
+ };
+ struct dirlist dirstack[MAX_STACK_DIRS];
+ struct dirlist *dirarray = dirstack;
if (unlikely (linep + 4 > lineendp))
{
@@ -170,65 +194,69 @@ read_srclines (Dwarf *dbg,
/* First comes the list of directories. Add the compilation
directory first since the index zero is used for it. */
- struct dirlist
- {
- const char *dir;
- size_t len;
- struct dirlist *next;
- } comp_dir_elem =
+ struct dirlist comp_dir_elem =
{
.dir = comp_dir,
.len = comp_dir ? strlen (comp_dir) : 0,
- .next = NULL
};
- struct dirlist *dirlist = &comp_dir_elem;
- unsigned int ndirlist = 1;
+ ndirlist = 1;
- // XXX Directly construct array to conserve memory?
- while (*linep != 0)
+ /* First count the entries. */
+ const unsigned char *dirp = linep;
+ while (*dirp != 0)
{
- struct dirlist *new_dir =
- (struct dirlist *) alloca (sizeof (*new_dir));
-
- new_dir->dir = (char *) linep;
- uint8_t *endp = memchr (linep, '\0', lineendp - linep);
+ uint8_t *endp = memchr (dirp, '\0', lineendp - dirp);
if (endp == NULL)
goto invalid_data;
- new_dir->len = endp - linep;
- new_dir->next = dirlist;
- dirlist = new_dir;
++ndirlist;
+ dirp = endp + 1;
+ }
+
+ /* Arrange the list in array form. */
+ if (ndirlist >= MAX_STACK_DIRS)
+ {
+ dirarray = (struct dirlist *) malloc (ndirlist * sizeof (*dirarray));
+ if (unlikely (dirarray == NULL))
+ {
+ no_mem:
+ __libdw_seterrno (DWARF_E_NOMEM);
+ goto out;
+ }
+ }
+ dirarray[0] = comp_dir_elem;
+ for (unsigned int n = 1; n < ndirlist; n++)
+ {
+ dirarray[n].dir = (char *) linep;
+ uint8_t *endp = memchr (linep, '\0', lineendp - linep);
+ assert (endp != NULL);
+ dirarray[n].len = endp - linep;
linep = endp + 1;
}
/* Skip the final NUL byte. */
++linep;
- /* Rearrange the list in array form. */
- struct dirlist **dirarray
- = (struct dirlist **) alloca (ndirlist * sizeof (*dirarray));
- for (unsigned int n = ndirlist; n-- > 0; dirlist = dirlist->next)
- dirarray[n] = dirlist;
+ /* Allocate memory for a new file. For the first MAX_STACK_FILES
+ entries just return a slot in the preallocated stack array. */
+ struct filelist flstack[MAX_STACK_FILES];
+#define NEW_FILE() ({ \
+ struct filelist *fl = (nfilelist < MAX_STACK_FILES \
+ ? &flstack[nfilelist] \
+ : malloc (sizeof (struct filelist))); \
+ if (unlikely (fl == NULL)) \
+ goto no_mem; \
+ ++nfilelist; \
+ fl->next = filelist; \
+ filelist = fl; \
+ fl; })
/* Now read the files. */
- struct filelist null_file =
- {
- .info =
- {
- .name = "???",
- .mtime = 0,
- .length = 0
- },
- .next = NULL
- };
- struct filelist *filelist = &null_file;
- unsigned int nfilelist = 1;
+ nfilelist = 1;
if (unlikely (linep >= lineendp))
goto invalid_data;
while (*linep != 0)
{
- struct filelist *new_file =
- (struct filelist *) alloca (sizeof (*new_file));
+ struct filelist *new_file = NEW_FILE ();
/* First comes the file name. */
char *fname = (char *) linep;
@@ -255,22 +283,22 @@ read_srclines (Dwarf *dbg,
else
{
new_file->info.name = libdw_alloc (dbg, char, 1,
- dirarray[diridx]->len + 1
+ dirarray[diridx].len + 1
+ fnamelen + 1);
char *cp = new_file->info.name;
- if (dirarray[diridx]->dir != NULL)
+ if (dirarray[diridx].dir != NULL)
{
/* This value could be NULL in case the DW_AT_comp_dir
was not present. We cannot do much in this case.
The easiest thing is to convert the path in an
absolute path. */
- cp = stpcpy (cp, dirarray[diridx]->dir);
+ cp = stpcpy (cp, dirarray[diridx].dir);
}
*cp++ = '/';
strcpy (cp, fname);
assert (strlen (new_file->info.name)
- < dirarray[diridx]->len + 1 + fnamelen + 1);
+ < dirarray[diridx].len + 1 + fnamelen + 1);
}
/* Next comes the modification time. */
@@ -282,10 +310,6 @@ read_srclines (Dwarf *dbg,
if (unlikely (linep >= lineendp))
goto invalid_data;
get_uleb128 (new_file->info.length, linep, lineendp);
-
- new_file->next = filelist;
- filelist = new_file;
- ++nfilelist;
}
/* Skip the final NUL byte. */
++linep;
@@ -302,7 +326,8 @@ read_srclines (Dwarf *dbg,
Dwarf_Word addr = 0;
unsigned int op_index = 0;
unsigned int file = 1;
- int line = 1;
+ /* We only store an int, but want to check for overflow (see SET below). */
+ int64_t line = 1;
unsigned int column = 0;
uint_fast8_t is_stmt = default_is_stmt;
bool basic_block = false;
@@ -322,15 +347,16 @@ read_srclines (Dwarf *dbg,
/* Process the instructions. */
- /* Adds a new line to the matrix.
- We cannot simply define a function because we want to use alloca. */
+ /* Adds a new line to the matrix. For the first MAX_STACK_LINES
+ entries just return a slot in the preallocated stack array. */
+ struct linelist llstack[MAX_STACK_LINES];
#define NEW_LINE(end_seq) \
do { \
- struct linelist *ll = (nlinelist < MAX_STACK_ALLOC \
- ? alloca (sizeof (struct linelist)) \
+ struct linelist *ll = (nlinelist < MAX_STACK_LINES \
+ ? &llstack[nlinelist] \
: malloc (sizeof (struct linelist))); \
- if (nlinelist >= MAX_STACK_ALLOC) \
- malloc_linelist = ll; \
+ if (unlikely (ll == NULL)) \
+ goto no_mem; \
if (unlikely (add_new_line (ll, end_seq))) \
goto invalid_data; \
} while (0)
@@ -483,33 +509,29 @@ read_srclines (Dwarf *dbg,
goto invalid_data;
get_uleb128 (filelength, linep, lineendp);
- struct filelist *new_file =
- (struct filelist *) alloca (sizeof (*new_file));
+ struct filelist *new_file = NEW_FILE ();
if (fname[0] == '/')
new_file->info.name = fname;
else
{
new_file->info.name =
- libdw_alloc (dbg, char, 1, (dirarray[diridx]->len + 1
+ libdw_alloc (dbg, char, 1, (dirarray[diridx].len + 1
+ fnamelen + 1));
char *cp = new_file->info.name;
- if (dirarray[diridx]->dir != NULL)
+ if (dirarray[diridx].dir != NULL)
/* This value could be NULL in case the
DW_AT_comp_dir was not present. We
cannot do much in this case. The easiest
thing is to convert the path in an
absolute path. */
- cp = stpcpy (cp, dirarray[diridx]->dir);
+ cp = stpcpy (cp, dirarray[diridx].dir);
*cp++ = '/';
strcpy (cp, fname);
}
new_file->info.mtime = mtime;
new_file->info.length = filelength;
- new_file->next = filelist;
- filelist = new_file;
- ++nfilelist;
}
break;
@@ -687,18 +709,19 @@ read_srclines (Dwarf *dbg,
1);
const char **dirs = (void *) &files->info[nfilelist];
+ struct filelist *fileslist = filelist;
files->nfiles = nfilelist;
- while (nfilelist-- > 0)
+ for (size_t n = nfilelist; n > 0; n--)
{
- files->info[nfilelist] = filelist->info;
- filelist = filelist->next;
+ files->info[n - 1] = fileslist->info;
+ fileslist = fileslist->next;
}
- assert (filelist == NULL);
+ assert (fileslist == NULL);
/* Put all the directory strings in an array. */
files->ndirs = ndirlist;
for (unsigned int i = 0; i < ndirlist; ++i)
- dirs[i] = dirarray[i]->dir;
+ dirs[i] = dirarray[i].dir;
dirs[ndirlist] = NULL;
/* Pass the file data structure to the caller. */
@@ -718,12 +741,13 @@ read_srclines (Dwarf *dbg,
/* The list is in LIFO order and usually they come in clumps with
ascending addresses. So fill from the back to probably start with
runs already in order before we sort. */
+ struct linelist *lineslist = linelist;
for (size_t i = nlinelist; i-- > 0; )
{
- sortlines[i] = linelist;
- linelist = linelist->next;
+ sortlines[i] = lineslist;
+ lineslist = lineslist->next;
}
- assert (linelist == NULL);
+ assert (lineslist == NULL);
/* Sort by ascending address. */
qsort (sortlines, nlinelist, sizeof sortlines[0], &compare_lines);
@@ -754,11 +778,19 @@ read_srclines (Dwarf *dbg,
out:
/* Free malloced line records, if any. */
- for (size_t i = MAX_STACK_ALLOC; i < nlinelist; i++)
+ for (size_t i = MAX_STACK_LINES; i < nlinelist; i++)
+ {
+ struct linelist *ll = linelist->next;
+ free (linelist);
+ linelist = ll;
+ }
+ if (ndirlist >= MAX_STACK_DIRS)
+ free (dirarray);
+ for (size_t i = MAX_STACK_FILES; i < nfilelist; i++)
{
- struct linelist *ll = malloc_linelist->next;
- free (malloc_linelist);
- malloc_linelist = ll;
+ struct filelist *fl = filelist->next;
+ free (filelist);
+ filelist = fl;
}
return res;
@@ -838,10 +870,13 @@ __libdw_getcompdir (Dwarf_Die *cudie)
int
dwarf_getsrclines (Dwarf_Die *cudie, Dwarf_Lines **lines, size_t *nlines)
{
- if (unlikely (cudie == NULL
- || (INTUSE(dwarf_tag) (cudie) != DW_TAG_compile_unit
- && INTUSE(dwarf_tag) (cudie) != DW_TAG_partial_unit)))
+ if (cudie == NULL)
return -1;
+ if (! is_cudie (cudie))
+ {
+ __libdw_seterrno (DWARF_E_NOT_CUDIE);
+ return -1;
+ }
/* Get the information if it is not already known. */
struct Dwarf_CU *const cu = cudie->cu;
diff --git a/3rdparty/elfutils/libdw/dwarf_peel_type.c b/3rdparty/elfutils/libdw/dwarf_peel_type.c
index a110bc5..9be838d 100644
--- a/3rdparty/elfutils/libdw/dwarf_peel_type.c
+++ b/3rdparty/elfutils/libdw/dwarf_peel_type.c
@@ -51,7 +51,8 @@ dwarf_peel_type (die, result)
while (tag == DW_TAG_typedef
|| tag == DW_TAG_const_type
|| tag == DW_TAG_volatile_type
- || tag == DW_TAG_restrict_type)
+ || tag == DW_TAG_restrict_type
+ || tag == DW_TAG_atomic_type)
{
Dwarf_Attribute attr_mem;
Dwarf_Attribute *attr = INTUSE (dwarf_attr_integrate) (die, DW_AT_type,
diff --git a/3rdparty/elfutils/libdw/dwarf_ranges.c b/3rdparty/elfutils/libdw/dwarf_ranges.c
index d9b7293..4b6853d 100644
--- a/3rdparty/elfutils/libdw/dwarf_ranges.c
+++ b/3rdparty/elfutils/libdw/dwarf_ranges.c
@@ -142,14 +142,7 @@ dwarf_ranges (Dwarf_Die *die, ptrdiff_t offset, Dwarf_Addr *basep,
DW_AT_entry_pc,
&attr_mem),
basep) != 0)
- {
- if (INTUSE(dwarf_errno) () == 0)
- {
- invalid:
- __libdw_seterrno (DWARF_E_INVALID_DWARF);
- }
- return -1;
- }
+ *basep = (Dwarf_Addr) -1;
}
else
{
@@ -182,7 +175,17 @@ dwarf_ranges (Dwarf_Die *die, ptrdiff_t offset, Dwarf_Addr *basep,
return -1l;
}
- /* We have an address range entry. */
+ /* We have an address range entry. Check that we have a base. */
+ if (*basep == (Dwarf_Addr) -1)
+ {
+ if (INTUSE(dwarf_errno) () == 0)
+ {
+ invalid:
+ __libdw_seterrno (DWARF_E_INVALID_DWARF);
+ }
+ return -1;
+ }
+
*startp = *basep + begin;
*endp = *basep + end;
return readp - (unsigned char *) d->d_buf;
diff --git a/3rdparty/elfutils/libdw/dwarf_siblingof.c b/3rdparty/elfutils/libdw/dwarf_siblingof.c
index 27830ea..e598ae4 100644
--- a/3rdparty/elfutils/libdw/dwarf_siblingof.c
+++ b/3rdparty/elfutils/libdw/dwarf_siblingof.c
@@ -1,5 +1,5 @@
/* Return sibling of given DIE.
- Copyright (C) 2003-2010, 2014 Red Hat, Inc.
+ Copyright (C) 2003-2010, 2014, 2015 Red Hat, Inc.
This file is part of elfutils.
Written by Ulrich Drepper <drepper@redhat.com>, 2003.
@@ -79,6 +79,16 @@ dwarf_siblingof (die, result)
/* Something went wrong. */
return -1;
+ /* The sibling attribute should point after this DIE in the CU.
+ But not after the end of the CU. */
+ size_t size = sibattr.cu->endp - sibattr.cu->startp;
+ size_t die_off = this_die.addr - this_die.cu->startp;
+ if (unlikely (offset >= size || offset <= die_off))
+ {
+ __libdw_seterrno (DWARF_E_INVALID_DWARF);
+ return -1;
+ }
+
/* Compute the next address. */
addr = sibattr.cu->startp + offset;
}
diff --git a/3rdparty/elfutils/libdw/encoded-value.h b/3rdparty/elfutils/libdw/encoded-value.h
index ae9a38f..48d868f 100644
--- a/3rdparty/elfutils/libdw/encoded-value.h
+++ b/3rdparty/elfutils/libdw/encoded-value.h
@@ -1,5 +1,5 @@
/* DW_EH_PE_* support for libdw unwinder.
- Copyright (C) 2009-2010, 2014 Red Hat, Inc.
+ Copyright (C) 2009-2010, 2014, 2015 Red Hat, Inc.
This file is part of elfutils.
This file is free software; you can redistribute it and/or modify
@@ -32,8 +32,11 @@
#include <dwarf.h>
#include <stdlib.h>
#include "libdwP.h"
+#include "../libelf/common.h"
+/* Returns zero if the value is omitted, the encoding is unknown or
+ the (leb128) size cannot be determined. */
static size_t __attribute__ ((unused))
encoded_value_size (const Elf_Data *data, const unsigned char e_ident[],
uint8_t encoding, const uint8_t *p)
@@ -63,11 +66,11 @@ encoded_value_size (const Elf_Data *data, const unsigned char e_ident[],
}
default:
- abort ();
return 0;
}
}
+/* Returns zero when value was read successfully, minus one otherwise. */
static inline int __attribute__ ((unused))
__libdw_cfi_read_address_inc (const Dwarf_CFI *cache,
const unsigned char **addrp,
@@ -82,16 +85,32 @@ __libdw_cfi_read_address_inc (const Dwarf_CFI *cache,
/* Only .debug_frame might have relocation to consider.
Read plain values from .eh_frame data. */
+ const unsigned char *endp = cache->data->d.d_buf + cache->data->d.d_size;
+ Dwarf eh_dbg = { .other_byte_order = MY_ELFDATA != cache->e_ident[EI_DATA] };
+
if (width == 4)
- *ret = read_4ubyte_unaligned_inc (cache, *addrp);
+ {
+ if (unlikely (*addrp + 4 > endp))
+ {
+ invalid_data:
+ __libdw_seterrno (DWARF_E_INVALID_CFI);
+ return -1;
+ }
+ *ret = read_4ubyte_unaligned_inc (&eh_dbg, *addrp);
+ }
else
- *ret = read_8ubyte_unaligned_inc (cache, *addrp);
+ {
+ if (unlikely (*addrp + 8 > endp))
+ goto invalid_data;
+ *ret = read_8ubyte_unaligned_inc (&eh_dbg, *addrp);
+ }
return 0;
}
+/* Returns true on error, false otherwise. */
static bool __attribute__ ((unused))
-read_encoded_value (const Dwarf_CFI *cache, uint8_t encoding, const uint8_t **p,
- Dwarf_Addr *result)
+read_encoded_value (const Dwarf_CFI *cache, uint8_t encoding,
+ const uint8_t **p, Dwarf_Addr *result)
{
*result = 0;
switch (encoding & 0x70)
@@ -115,8 +134,11 @@ read_encoded_value (const Dwarf_CFI *cache, uint8_t encoding, const uint8_t **p,
break;
case DW_EH_PE_aligned:
{
- const size_t size = encoded_value_size (&cache->data->d, cache->e_ident,
+ const size_t size = encoded_value_size (&cache->data->d,
+ cache->e_ident,
encoding, *p);
+ if (unlikely (size == 0))
+ return true;
size_t align = ((cache->frame_vaddr
+ (*p - (const uint8_t *) cache->data->d.d_buf))
& (size - 1));
@@ -126,54 +148,63 @@ read_encoded_value (const Dwarf_CFI *cache, uint8_t encoding, const uint8_t **p,
}
default:
- abort ();
+ __libdw_seterrno (DWARF_E_INVALID_CFI);
+ return true;
}
- Dwarf_Addr value;
+ Dwarf_Addr value = 0;
+ const unsigned char *endp = cache->data->d.d_buf + cache->data->d.d_size;
switch (encoding & 0x0f)
{
case DW_EH_PE_udata2:
+ if (unlikely (*p + 2 > endp))
+ {
+ invalid_data:
+ __libdw_seterrno (DWARF_E_INVALID_CFI);
+ return true;
+ }
value = read_2ubyte_unaligned_inc (cache, *p);
break;
case DW_EH_PE_sdata2:
+ if (unlikely (*p + 2 > endp))
+ goto invalid_data;
value = read_2sbyte_unaligned_inc (cache, *p);
break;
case DW_EH_PE_udata4:
- if (__libdw_cfi_read_address_inc (cache, p, 4, &value))
+ if (unlikely (__libdw_cfi_read_address_inc (cache, p, 4, &value) != 0))
return true;
break;
case DW_EH_PE_sdata4:
- if (__libdw_cfi_read_address_inc (cache, p, 4, &value))
+ if (unlikely (__libdw_cfi_read_address_inc (cache, p, 4, &value) != 0))
return true;
value = (Dwarf_Sword) (Elf32_Sword) value; /* Sign-extend. */
break;
case DW_EH_PE_udata8:
case DW_EH_PE_sdata8:
- if (__libdw_cfi_read_address_inc (cache, p, 8, &value))
+ if (unlikely (__libdw_cfi_read_address_inc (cache, p, 8, &value) != 0))
return true;
break;
case DW_EH_PE_absptr:
- if (__libdw_cfi_read_address_inc (cache, p, 0, &value))
+ if (unlikely (__libdw_cfi_read_address_inc (cache, p, 0, &value) != 0))
return true;
break;
case DW_EH_PE_uleb128:
- // XXX we trust there is enough data.
- get_uleb128 (value, *p, *p + len_leb128 (Dwarf_Addr));
+ get_uleb128 (value, *p, endp);
break;
case DW_EH_PE_sleb128:
- // XXX we trust there is enough data.
- get_sleb128 (value, *p, *p + len_leb128 (Dwarf_Addr));
+ get_sleb128 (value, *p, endp);
break;
default:
- abort ();
+ __libdw_seterrno (DWARF_E_INVALID_CFI);
+ return true;
}
*result += value;
@@ -183,12 +214,15 @@ read_encoded_value (const Dwarf_CFI *cache, uint8_t encoding, const uint8_t **p,
if (unlikely (*result < cache->frame_vaddr))
return true;
*result -= cache->frame_vaddr;
- if (unlikely (*result > (cache->data->d.d_size
- - encoded_value_size (NULL, cache->e_ident,
- DW_EH_PE_absptr, NULL))))
+ size_t ptrsize = encoded_value_size (NULL, cache->e_ident,
+ DW_EH_PE_absptr, NULL);
+ if (unlikely (cache->data->d.d_size < ptrsize
+ || *result > (cache->data->d.d_size - ptrsize)))
return true;
const uint8_t *ptr = cache->data->d.d_buf + *result;
- return __libdw_cfi_read_address_inc (cache, &ptr, 0, result);
+ if (unlikely (__libdw_cfi_read_address_inc (cache, &ptr, 0, result)
+ != 0))
+ return true;
}
return false;
diff --git a/3rdparty/elfutils/libdw/fde.c b/3rdparty/elfutils/libdw/fde.c
index 18a522b..c8475f3 100644
--- a/3rdparty/elfutils/libdw/fde.c
+++ b/3rdparty/elfutils/libdw/fde.c
@@ -1,5 +1,5 @@
/* FDE reading.
- Copyright (C) 2009-2010, 2014 Red Hat, Inc.
+ Copyright (C) 2009-2010, 2014, 2015 Red Hat, Inc.
This file is part of elfutils.
This file is free software; you can redistribute it and/or modify
@@ -161,13 +161,22 @@ binary_search_fde (Dwarf_CFI *cache, Dwarf_Addr address)
const size_t size = 2 * encoded_value_size (&cache->data->d, cache->e_ident,
cache->search_table_encoding,
NULL);
+ if (unlikely (size == 0))
+ return (Dwarf_Off) -1l;
/* Dummy used by read_encoded_value. */
+ Elf_Data_Scn dummy_cfi_hdr_data =
+ {
+ .d = { .d_buf = (void *) cache->search_table,
+ .d_size = cache->search_table_len }
+ };
+
Dwarf_CFI dummy_cfi =
{
.e_ident = cache->e_ident,
.datarel = cache->search_table_vaddr,
.frame_vaddr = cache->search_table_vaddr,
+ .data = &dummy_cfi_hdr_data
};
size_t l = 0, u = cache->search_table_entries;
@@ -175,6 +184,8 @@ binary_search_fde (Dwarf_CFI *cache, Dwarf_Addr address)
{
size_t idx = (l + u) / 2;
+ /* Max idx * size is checked against search_table len when
+ loading eh_frame_hdr. */
const uint8_t *p = &cache->search_table[idx * size];
Dwarf_Addr start;
if (unlikely (read_encoded_value (&dummy_cfi,
diff --git a/3rdparty/elfutils/libdw/known-dwarf.h b/3rdparty/elfutils/libdw/known-dwarf.h
index 2aeada9..81537d1 100644
--- a/3rdparty/elfutils/libdw/known-dwarf.h
+++ b/3rdparty/elfutils/libdw/known-dwarf.h
@@ -1,629 +1,632 @@
/* Generated by config/known-dwarf.awk from libdw/dwarf.h contents. */
-#define ALL_KNOWN_DW_ACCESS \
- ONE_KNOWN_DW_ACCESS (private, DW_ACCESS_private) \
- ONE_KNOWN_DW_ACCESS (protected, DW_ACCESS_protected) \
- ONE_KNOWN_DW_ACCESS (public, DW_ACCESS_public) \
+#define DWARF_ALL_KNOWN_DW_ACCESS \
+ DWARF_ONE_KNOWN_DW_ACCESS (private, DW_ACCESS_private) \
+ DWARF_ONE_KNOWN_DW_ACCESS (protected, DW_ACCESS_protected) \
+ DWARF_ONE_KNOWN_DW_ACCESS (public, DW_ACCESS_public) \
/* End of DW_ACCESS_*. */
-#define ALL_KNOWN_DW_AT \
- ONE_KNOWN_DW_AT (GNU_all_call_sites, DW_AT_GNU_all_call_sites) \
- ONE_KNOWN_DW_AT (GNU_all_source_call_sites, DW_AT_GNU_all_source_call_sites) \
- ONE_KNOWN_DW_AT (GNU_all_tail_call_sites, DW_AT_GNU_all_tail_call_sites) \
- ONE_KNOWN_DW_AT (GNU_call_site_data_value, DW_AT_GNU_call_site_data_value) \
- ONE_KNOWN_DW_AT (GNU_call_site_target, DW_AT_GNU_call_site_target) \
- ONE_KNOWN_DW_AT (GNU_call_site_target_clobbered, DW_AT_GNU_call_site_target_clobbered) \
- ONE_KNOWN_DW_AT (GNU_call_site_value, DW_AT_GNU_call_site_value) \
- ONE_KNOWN_DW_AT (GNU_deleted, DW_AT_GNU_deleted) \
- ONE_KNOWN_DW_AT (GNU_exclusive_locks_required, DW_AT_GNU_exclusive_locks_required) \
- ONE_KNOWN_DW_AT (GNU_guarded, DW_AT_GNU_guarded) \
- ONE_KNOWN_DW_AT (GNU_guarded_by, DW_AT_GNU_guarded_by) \
- ONE_KNOWN_DW_AT (GNU_locks_excluded, DW_AT_GNU_locks_excluded) \
- ONE_KNOWN_DW_AT (GNU_macros, DW_AT_GNU_macros) \
- ONE_KNOWN_DW_AT (GNU_odr_signature, DW_AT_GNU_odr_signature) \
- ONE_KNOWN_DW_AT (GNU_pt_guarded, DW_AT_GNU_pt_guarded) \
- ONE_KNOWN_DW_AT (GNU_pt_guarded_by, DW_AT_GNU_pt_guarded_by) \
- ONE_KNOWN_DW_AT (GNU_shared_locks_required, DW_AT_GNU_shared_locks_required) \
- ONE_KNOWN_DW_AT (GNU_tail_call, DW_AT_GNU_tail_call) \
- ONE_KNOWN_DW_AT (GNU_template_name, DW_AT_GNU_template_name) \
- ONE_KNOWN_DW_AT (GNU_vector, DW_AT_GNU_vector) \
- ONE_KNOWN_DW_AT (MIPS_abstract_name, DW_AT_MIPS_abstract_name) \
- ONE_KNOWN_DW_AT (MIPS_allocatable_dopetype, DW_AT_MIPS_allocatable_dopetype) \
- ONE_KNOWN_DW_AT (MIPS_assumed_shape_dopetype, DW_AT_MIPS_assumed_shape_dopetype) \
- ONE_KNOWN_DW_AT (MIPS_assumed_size, DW_AT_MIPS_assumed_size) \
- ONE_KNOWN_DW_AT (MIPS_clone_origin, DW_AT_MIPS_clone_origin) \
- ONE_KNOWN_DW_AT (MIPS_epilog_begin, DW_AT_MIPS_epilog_begin) \
- ONE_KNOWN_DW_AT (MIPS_fde, DW_AT_MIPS_fde) \
- ONE_KNOWN_DW_AT (MIPS_has_inlines, DW_AT_MIPS_has_inlines) \
- ONE_KNOWN_DW_AT (MIPS_linkage_name, DW_AT_MIPS_linkage_name) \
- ONE_KNOWN_DW_AT (MIPS_loop_begin, DW_AT_MIPS_loop_begin) \
- ONE_KNOWN_DW_AT (MIPS_loop_unroll_factor, DW_AT_MIPS_loop_unroll_factor) \
- ONE_KNOWN_DW_AT (MIPS_ptr_dopetype, DW_AT_MIPS_ptr_dopetype) \
- ONE_KNOWN_DW_AT (MIPS_software_pipeline_depth, DW_AT_MIPS_software_pipeline_depth) \
- ONE_KNOWN_DW_AT (MIPS_stride, DW_AT_MIPS_stride) \
- ONE_KNOWN_DW_AT (MIPS_stride_byte, DW_AT_MIPS_stride_byte) \
- ONE_KNOWN_DW_AT (MIPS_stride_elem, DW_AT_MIPS_stride_elem) \
- ONE_KNOWN_DW_AT (MIPS_tail_loop_begin, DW_AT_MIPS_tail_loop_begin) \
- ONE_KNOWN_DW_AT (abstract_origin, DW_AT_abstract_origin) \
- ONE_KNOWN_DW_AT (accessibility, DW_AT_accessibility) \
- ONE_KNOWN_DW_AT (address_class, DW_AT_address_class) \
- ONE_KNOWN_DW_AT (allocated, DW_AT_allocated) \
- ONE_KNOWN_DW_AT (artificial, DW_AT_artificial) \
- ONE_KNOWN_DW_AT (associated, DW_AT_associated) \
- ONE_KNOWN_DW_AT (base_types, DW_AT_base_types) \
- ONE_KNOWN_DW_AT (binary_scale, DW_AT_binary_scale) \
- ONE_KNOWN_DW_AT (bit_offset, DW_AT_bit_offset) \
- ONE_KNOWN_DW_AT (bit_size, DW_AT_bit_size) \
- ONE_KNOWN_DW_AT (bit_stride, DW_AT_bit_stride) \
- ONE_KNOWN_DW_AT (body_begin, DW_AT_body_begin) \
- ONE_KNOWN_DW_AT (body_end, DW_AT_body_end) \
- ONE_KNOWN_DW_AT (byte_size, DW_AT_byte_size) \
- ONE_KNOWN_DW_AT (byte_stride, DW_AT_byte_stride) \
- ONE_KNOWN_DW_AT (call_column, DW_AT_call_column) \
- ONE_KNOWN_DW_AT (call_file, DW_AT_call_file) \
- ONE_KNOWN_DW_AT (call_line, DW_AT_call_line) \
- ONE_KNOWN_DW_AT (calling_convention, DW_AT_calling_convention) \
- ONE_KNOWN_DW_AT (common_reference, DW_AT_common_reference) \
- ONE_KNOWN_DW_AT (comp_dir, DW_AT_comp_dir) \
- ONE_KNOWN_DW_AT (const_expr, DW_AT_const_expr) \
- ONE_KNOWN_DW_AT (const_value, DW_AT_const_value) \
- ONE_KNOWN_DW_AT (containing_type, DW_AT_containing_type) \
- ONE_KNOWN_DW_AT (count, DW_AT_count) \
- ONE_KNOWN_DW_AT (data_bit_offset, DW_AT_data_bit_offset) \
- ONE_KNOWN_DW_AT (data_location, DW_AT_data_location) \
- ONE_KNOWN_DW_AT (data_member_location, DW_AT_data_member_location) \
- ONE_KNOWN_DW_AT (decimal_scale, DW_AT_decimal_scale) \
- ONE_KNOWN_DW_AT (decimal_sign, DW_AT_decimal_sign) \
- ONE_KNOWN_DW_AT (decl_column, DW_AT_decl_column) \
- ONE_KNOWN_DW_AT (decl_file, DW_AT_decl_file) \
- ONE_KNOWN_DW_AT (decl_line, DW_AT_decl_line) \
- ONE_KNOWN_DW_AT (declaration, DW_AT_declaration) \
- ONE_KNOWN_DW_AT (default_value, DW_AT_default_value) \
- ONE_KNOWN_DW_AT (description, DW_AT_description) \
- ONE_KNOWN_DW_AT (digit_count, DW_AT_digit_count) \
- ONE_KNOWN_DW_AT (discr, DW_AT_discr) \
- ONE_KNOWN_DW_AT (discr_list, DW_AT_discr_list) \
- ONE_KNOWN_DW_AT (discr_value, DW_AT_discr_value) \
- ONE_KNOWN_DW_AT (element_list, DW_AT_element_list) \
- ONE_KNOWN_DW_AT (elemental, DW_AT_elemental) \
- ONE_KNOWN_DW_AT (encoding, DW_AT_encoding) \
- ONE_KNOWN_DW_AT (endianity, DW_AT_endianity) \
- ONE_KNOWN_DW_AT (entry_pc, DW_AT_entry_pc) \
- ONE_KNOWN_DW_AT (enum_class, DW_AT_enum_class) \
- ONE_KNOWN_DW_AT (explicit, DW_AT_explicit) \
- ONE_KNOWN_DW_AT (extension, DW_AT_extension) \
- ONE_KNOWN_DW_AT (external, DW_AT_external) \
- ONE_KNOWN_DW_AT (frame_base, DW_AT_frame_base) \
- ONE_KNOWN_DW_AT (friend, DW_AT_friend) \
- ONE_KNOWN_DW_AT (high_pc, DW_AT_high_pc) \
- ONE_KNOWN_DW_AT (identifier_case, DW_AT_identifier_case) \
- ONE_KNOWN_DW_AT (import, DW_AT_import) \
- ONE_KNOWN_DW_AT (inline, DW_AT_inline) \
- ONE_KNOWN_DW_AT (is_optional, DW_AT_is_optional) \
- ONE_KNOWN_DW_AT (language, DW_AT_language) \
- ONE_KNOWN_DW_AT (linkage_name, DW_AT_linkage_name) \
- ONE_KNOWN_DW_AT (location, DW_AT_location) \
- ONE_KNOWN_DW_AT (low_pc, DW_AT_low_pc) \
- ONE_KNOWN_DW_AT (lower_bound, DW_AT_lower_bound) \
- ONE_KNOWN_DW_AT (mac_info, DW_AT_mac_info) \
- ONE_KNOWN_DW_AT (macro_info, DW_AT_macro_info) \
- ONE_KNOWN_DW_AT (main_subprogram, DW_AT_main_subprogram) \
- ONE_KNOWN_DW_AT (member, DW_AT_member) \
- ONE_KNOWN_DW_AT (mutable, DW_AT_mutable) \
- ONE_KNOWN_DW_AT (name, DW_AT_name) \
- ONE_KNOWN_DW_AT (namelist_item, DW_AT_namelist_item) \
- ONE_KNOWN_DW_AT (noreturn, DW_AT_noreturn) \
- ONE_KNOWN_DW_AT (object_pointer, DW_AT_object_pointer) \
- ONE_KNOWN_DW_AT (ordering, DW_AT_ordering) \
- ONE_KNOWN_DW_AT (picture_string, DW_AT_picture_string) \
- ONE_KNOWN_DW_AT (priority, DW_AT_priority) \
- ONE_KNOWN_DW_AT (producer, DW_AT_producer) \
- ONE_KNOWN_DW_AT (prototyped, DW_AT_prototyped) \
- ONE_KNOWN_DW_AT (pure, DW_AT_pure) \
- ONE_KNOWN_DW_AT (ranges, DW_AT_ranges) \
- ONE_KNOWN_DW_AT (recursive, DW_AT_recursive) \
- ONE_KNOWN_DW_AT (return_addr, DW_AT_return_addr) \
- ONE_KNOWN_DW_AT (segment, DW_AT_segment) \
- ONE_KNOWN_DW_AT (sf_names, DW_AT_sf_names) \
- ONE_KNOWN_DW_AT (sibling, DW_AT_sibling) \
- ONE_KNOWN_DW_AT (signature, DW_AT_signature) \
- ONE_KNOWN_DW_AT (small, DW_AT_small) \
- ONE_KNOWN_DW_AT (specification, DW_AT_specification) \
- ONE_KNOWN_DW_AT (src_coords, DW_AT_src_coords) \
- ONE_KNOWN_DW_AT (src_info, DW_AT_src_info) \
- ONE_KNOWN_DW_AT (start_scope, DW_AT_start_scope) \
- ONE_KNOWN_DW_AT (static_link, DW_AT_static_link) \
- ONE_KNOWN_DW_AT (stmt_list, DW_AT_stmt_list) \
- ONE_KNOWN_DW_AT (string_length, DW_AT_string_length) \
- ONE_KNOWN_DW_AT (subscr_data, DW_AT_subscr_data) \
- ONE_KNOWN_DW_AT (threads_scaled, DW_AT_threads_scaled) \
- ONE_KNOWN_DW_AT (trampoline, DW_AT_trampoline) \
- ONE_KNOWN_DW_AT (type, DW_AT_type) \
- ONE_KNOWN_DW_AT (upper_bound, DW_AT_upper_bound) \
- ONE_KNOWN_DW_AT (use_UTF8, DW_AT_use_UTF8) \
- ONE_KNOWN_DW_AT (use_location, DW_AT_use_location) \
- ONE_KNOWN_DW_AT (variable_parameter, DW_AT_variable_parameter) \
- ONE_KNOWN_DW_AT (virtuality, DW_AT_virtuality) \
- ONE_KNOWN_DW_AT (visibility, DW_AT_visibility) \
- ONE_KNOWN_DW_AT (vtable_elem_location, DW_AT_vtable_elem_location) \
+#define DWARF_ALL_KNOWN_DW_AT \
+ DWARF_ONE_KNOWN_DW_AT (GNU_all_call_sites, DW_AT_GNU_all_call_sites) \
+ DWARF_ONE_KNOWN_DW_AT (GNU_all_source_call_sites, DW_AT_GNU_all_source_call_sites) \
+ DWARF_ONE_KNOWN_DW_AT (GNU_all_tail_call_sites, DW_AT_GNU_all_tail_call_sites) \
+ DWARF_ONE_KNOWN_DW_AT (GNU_call_site_data_value, DW_AT_GNU_call_site_data_value) \
+ DWARF_ONE_KNOWN_DW_AT (GNU_call_site_target, DW_AT_GNU_call_site_target) \
+ DWARF_ONE_KNOWN_DW_AT (GNU_call_site_target_clobbered, DW_AT_GNU_call_site_target_clobbered) \
+ DWARF_ONE_KNOWN_DW_AT (GNU_call_site_value, DW_AT_GNU_call_site_value) \
+ DWARF_ONE_KNOWN_DW_AT (GNU_deleted, DW_AT_GNU_deleted) \
+ DWARF_ONE_KNOWN_DW_AT (GNU_exclusive_locks_required, DW_AT_GNU_exclusive_locks_required) \
+ DWARF_ONE_KNOWN_DW_AT (GNU_guarded, DW_AT_GNU_guarded) \
+ DWARF_ONE_KNOWN_DW_AT (GNU_guarded_by, DW_AT_GNU_guarded_by) \
+ DWARF_ONE_KNOWN_DW_AT (GNU_locks_excluded, DW_AT_GNU_locks_excluded) \
+ DWARF_ONE_KNOWN_DW_AT (GNU_macros, DW_AT_GNU_macros) \
+ DWARF_ONE_KNOWN_DW_AT (GNU_odr_signature, DW_AT_GNU_odr_signature) \
+ DWARF_ONE_KNOWN_DW_AT (GNU_pt_guarded, DW_AT_GNU_pt_guarded) \
+ DWARF_ONE_KNOWN_DW_AT (GNU_pt_guarded_by, DW_AT_GNU_pt_guarded_by) \
+ DWARF_ONE_KNOWN_DW_AT (GNU_shared_locks_required, DW_AT_GNU_shared_locks_required) \
+ DWARF_ONE_KNOWN_DW_AT (GNU_tail_call, DW_AT_GNU_tail_call) \
+ DWARF_ONE_KNOWN_DW_AT (GNU_template_name, DW_AT_GNU_template_name) \
+ DWARF_ONE_KNOWN_DW_AT (GNU_vector, DW_AT_GNU_vector) \
+ DWARF_ONE_KNOWN_DW_AT (MIPS_abstract_name, DW_AT_MIPS_abstract_name) \
+ DWARF_ONE_KNOWN_DW_AT (MIPS_allocatable_dopetype, DW_AT_MIPS_allocatable_dopetype) \
+ DWARF_ONE_KNOWN_DW_AT (MIPS_assumed_shape_dopetype, DW_AT_MIPS_assumed_shape_dopetype) \
+ DWARF_ONE_KNOWN_DW_AT (MIPS_assumed_size, DW_AT_MIPS_assumed_size) \
+ DWARF_ONE_KNOWN_DW_AT (MIPS_clone_origin, DW_AT_MIPS_clone_origin) \
+ DWARF_ONE_KNOWN_DW_AT (MIPS_epilog_begin, DW_AT_MIPS_epilog_begin) \
+ DWARF_ONE_KNOWN_DW_AT (MIPS_fde, DW_AT_MIPS_fde) \
+ DWARF_ONE_KNOWN_DW_AT (MIPS_has_inlines, DW_AT_MIPS_has_inlines) \
+ DWARF_ONE_KNOWN_DW_AT (MIPS_linkage_name, DW_AT_MIPS_linkage_name) \
+ DWARF_ONE_KNOWN_DW_AT (MIPS_loop_begin, DW_AT_MIPS_loop_begin) \
+ DWARF_ONE_KNOWN_DW_AT (MIPS_loop_unroll_factor, DW_AT_MIPS_loop_unroll_factor) \
+ DWARF_ONE_KNOWN_DW_AT (MIPS_ptr_dopetype, DW_AT_MIPS_ptr_dopetype) \
+ DWARF_ONE_KNOWN_DW_AT (MIPS_software_pipeline_depth, DW_AT_MIPS_software_pipeline_depth) \
+ DWARF_ONE_KNOWN_DW_AT (MIPS_stride, DW_AT_MIPS_stride) \
+ DWARF_ONE_KNOWN_DW_AT (MIPS_stride_byte, DW_AT_MIPS_stride_byte) \
+ DWARF_ONE_KNOWN_DW_AT (MIPS_stride_elem, DW_AT_MIPS_stride_elem) \
+ DWARF_ONE_KNOWN_DW_AT (MIPS_tail_loop_begin, DW_AT_MIPS_tail_loop_begin) \
+ DWARF_ONE_KNOWN_DW_AT (abstract_origin, DW_AT_abstract_origin) \
+ DWARF_ONE_KNOWN_DW_AT (accessibility, DW_AT_accessibility) \
+ DWARF_ONE_KNOWN_DW_AT (address_class, DW_AT_address_class) \
+ DWARF_ONE_KNOWN_DW_AT (allocated, DW_AT_allocated) \
+ DWARF_ONE_KNOWN_DW_AT (artificial, DW_AT_artificial) \
+ DWARF_ONE_KNOWN_DW_AT (associated, DW_AT_associated) \
+ DWARF_ONE_KNOWN_DW_AT (base_types, DW_AT_base_types) \
+ DWARF_ONE_KNOWN_DW_AT (binary_scale, DW_AT_binary_scale) \
+ DWARF_ONE_KNOWN_DW_AT (bit_offset, DW_AT_bit_offset) \
+ DWARF_ONE_KNOWN_DW_AT (bit_size, DW_AT_bit_size) \
+ DWARF_ONE_KNOWN_DW_AT (bit_stride, DW_AT_bit_stride) \
+ DWARF_ONE_KNOWN_DW_AT (body_begin, DW_AT_body_begin) \
+ DWARF_ONE_KNOWN_DW_AT (body_end, DW_AT_body_end) \
+ DWARF_ONE_KNOWN_DW_AT (byte_size, DW_AT_byte_size) \
+ DWARF_ONE_KNOWN_DW_AT (byte_stride, DW_AT_byte_stride) \
+ DWARF_ONE_KNOWN_DW_AT (call_column, DW_AT_call_column) \
+ DWARF_ONE_KNOWN_DW_AT (call_file, DW_AT_call_file) \
+ DWARF_ONE_KNOWN_DW_AT (call_line, DW_AT_call_line) \
+ DWARF_ONE_KNOWN_DW_AT (calling_convention, DW_AT_calling_convention) \
+ DWARF_ONE_KNOWN_DW_AT (common_reference, DW_AT_common_reference) \
+ DWARF_ONE_KNOWN_DW_AT (comp_dir, DW_AT_comp_dir) \
+ DWARF_ONE_KNOWN_DW_AT (const_expr, DW_AT_const_expr) \
+ DWARF_ONE_KNOWN_DW_AT (const_value, DW_AT_const_value) \
+ DWARF_ONE_KNOWN_DW_AT (containing_type, DW_AT_containing_type) \
+ DWARF_ONE_KNOWN_DW_AT (count, DW_AT_count) \
+ DWARF_ONE_KNOWN_DW_AT (data_bit_offset, DW_AT_data_bit_offset) \
+ DWARF_ONE_KNOWN_DW_AT (data_location, DW_AT_data_location) \
+ DWARF_ONE_KNOWN_DW_AT (data_member_location, DW_AT_data_member_location) \
+ DWARF_ONE_KNOWN_DW_AT (decimal_scale, DW_AT_decimal_scale) \
+ DWARF_ONE_KNOWN_DW_AT (decimal_sign, DW_AT_decimal_sign) \
+ DWARF_ONE_KNOWN_DW_AT (decl_column, DW_AT_decl_column) \
+ DWARF_ONE_KNOWN_DW_AT (decl_file, DW_AT_decl_file) \
+ DWARF_ONE_KNOWN_DW_AT (decl_line, DW_AT_decl_line) \
+ DWARF_ONE_KNOWN_DW_AT (declaration, DW_AT_declaration) \
+ DWARF_ONE_KNOWN_DW_AT (default_value, DW_AT_default_value) \
+ DWARF_ONE_KNOWN_DW_AT (description, DW_AT_description) \
+ DWARF_ONE_KNOWN_DW_AT (digit_count, DW_AT_digit_count) \
+ DWARF_ONE_KNOWN_DW_AT (discr, DW_AT_discr) \
+ DWARF_ONE_KNOWN_DW_AT (discr_list, DW_AT_discr_list) \
+ DWARF_ONE_KNOWN_DW_AT (discr_value, DW_AT_discr_value) \
+ DWARF_ONE_KNOWN_DW_AT (element_list, DW_AT_element_list) \
+ DWARF_ONE_KNOWN_DW_AT (elemental, DW_AT_elemental) \
+ DWARF_ONE_KNOWN_DW_AT (encoding, DW_AT_encoding) \
+ DWARF_ONE_KNOWN_DW_AT (endianity, DW_AT_endianity) \
+ DWARF_ONE_KNOWN_DW_AT (entry_pc, DW_AT_entry_pc) \
+ DWARF_ONE_KNOWN_DW_AT (enum_class, DW_AT_enum_class) \
+ DWARF_ONE_KNOWN_DW_AT (explicit, DW_AT_explicit) \
+ DWARF_ONE_KNOWN_DW_AT (extension, DW_AT_extension) \
+ DWARF_ONE_KNOWN_DW_AT (external, DW_AT_external) \
+ DWARF_ONE_KNOWN_DW_AT (frame_base, DW_AT_frame_base) \
+ DWARF_ONE_KNOWN_DW_AT (friend, DW_AT_friend) \
+ DWARF_ONE_KNOWN_DW_AT (high_pc, DW_AT_high_pc) \
+ DWARF_ONE_KNOWN_DW_AT (identifier_case, DW_AT_identifier_case) \
+ DWARF_ONE_KNOWN_DW_AT (import, DW_AT_import) \
+ DWARF_ONE_KNOWN_DW_AT (inline, DW_AT_inline) \
+ DWARF_ONE_KNOWN_DW_AT (is_optional, DW_AT_is_optional) \
+ DWARF_ONE_KNOWN_DW_AT (language, DW_AT_language) \
+ DWARF_ONE_KNOWN_DW_AT (linkage_name, DW_AT_linkage_name) \
+ DWARF_ONE_KNOWN_DW_AT (location, DW_AT_location) \
+ DWARF_ONE_KNOWN_DW_AT (low_pc, DW_AT_low_pc) \
+ DWARF_ONE_KNOWN_DW_AT (lower_bound, DW_AT_lower_bound) \
+ DWARF_ONE_KNOWN_DW_AT (mac_info, DW_AT_mac_info) \
+ DWARF_ONE_KNOWN_DW_AT (macro_info, DW_AT_macro_info) \
+ DWARF_ONE_KNOWN_DW_AT (main_subprogram, DW_AT_main_subprogram) \
+ DWARF_ONE_KNOWN_DW_AT (member, DW_AT_member) \
+ DWARF_ONE_KNOWN_DW_AT (mutable, DW_AT_mutable) \
+ DWARF_ONE_KNOWN_DW_AT (name, DW_AT_name) \
+ DWARF_ONE_KNOWN_DW_AT (namelist_item, DW_AT_namelist_item) \
+ DWARF_ONE_KNOWN_DW_AT (noreturn, DW_AT_noreturn) \
+ DWARF_ONE_KNOWN_DW_AT (object_pointer, DW_AT_object_pointer) \
+ DWARF_ONE_KNOWN_DW_AT (ordering, DW_AT_ordering) \
+ DWARF_ONE_KNOWN_DW_AT (picture_string, DW_AT_picture_string) \
+ DWARF_ONE_KNOWN_DW_AT (priority, DW_AT_priority) \
+ DWARF_ONE_KNOWN_DW_AT (producer, DW_AT_producer) \
+ DWARF_ONE_KNOWN_DW_AT (prototyped, DW_AT_prototyped) \
+ DWARF_ONE_KNOWN_DW_AT (pure, DW_AT_pure) \
+ DWARF_ONE_KNOWN_DW_AT (ranges, DW_AT_ranges) \
+ DWARF_ONE_KNOWN_DW_AT (recursive, DW_AT_recursive) \
+ DWARF_ONE_KNOWN_DW_AT (return_addr, DW_AT_return_addr) \
+ DWARF_ONE_KNOWN_DW_AT (segment, DW_AT_segment) \
+ DWARF_ONE_KNOWN_DW_AT (sf_names, DW_AT_sf_names) \
+ DWARF_ONE_KNOWN_DW_AT (sibling, DW_AT_sibling) \
+ DWARF_ONE_KNOWN_DW_AT (signature, DW_AT_signature) \
+ DWARF_ONE_KNOWN_DW_AT (small, DW_AT_small) \
+ DWARF_ONE_KNOWN_DW_AT (specification, DW_AT_specification) \
+ DWARF_ONE_KNOWN_DW_AT (src_coords, DW_AT_src_coords) \
+ DWARF_ONE_KNOWN_DW_AT (src_info, DW_AT_src_info) \
+ DWARF_ONE_KNOWN_DW_AT (start_scope, DW_AT_start_scope) \
+ DWARF_ONE_KNOWN_DW_AT (static_link, DW_AT_static_link) \
+ DWARF_ONE_KNOWN_DW_AT (stmt_list, DW_AT_stmt_list) \
+ DWARF_ONE_KNOWN_DW_AT (string_length, DW_AT_string_length) \
+ DWARF_ONE_KNOWN_DW_AT (subscr_data, DW_AT_subscr_data) \
+ DWARF_ONE_KNOWN_DW_AT (threads_scaled, DW_AT_threads_scaled) \
+ DWARF_ONE_KNOWN_DW_AT (trampoline, DW_AT_trampoline) \
+ DWARF_ONE_KNOWN_DW_AT (type, DW_AT_type) \
+ DWARF_ONE_KNOWN_DW_AT (upper_bound, DW_AT_upper_bound) \
+ DWARF_ONE_KNOWN_DW_AT (use_UTF8, DW_AT_use_UTF8) \
+ DWARF_ONE_KNOWN_DW_AT (use_location, DW_AT_use_location) \
+ DWARF_ONE_KNOWN_DW_AT (variable_parameter, DW_AT_variable_parameter) \
+ DWARF_ONE_KNOWN_DW_AT (virtuality, DW_AT_virtuality) \
+ DWARF_ONE_KNOWN_DW_AT (visibility, DW_AT_visibility) \
+ DWARF_ONE_KNOWN_DW_AT (vtable_elem_location, DW_AT_vtable_elem_location) \
/* End of DW_AT_*. */
-#define ALL_KNOWN_DW_ATE \
- ONE_KNOWN_DW_ATE (UTF, DW_ATE_UTF) \
- ONE_KNOWN_DW_ATE (address, DW_ATE_address) \
- ONE_KNOWN_DW_ATE (boolean, DW_ATE_boolean) \
- ONE_KNOWN_DW_ATE (complex_float, DW_ATE_complex_float) \
- ONE_KNOWN_DW_ATE (decimal_float, DW_ATE_decimal_float) \
- ONE_KNOWN_DW_ATE (edited, DW_ATE_edited) \
- ONE_KNOWN_DW_ATE (float, DW_ATE_float) \
- ONE_KNOWN_DW_ATE (imaginary_float, DW_ATE_imaginary_float) \
- ONE_KNOWN_DW_ATE (numeric_string, DW_ATE_numeric_string) \
- ONE_KNOWN_DW_ATE (packed_decimal, DW_ATE_packed_decimal) \
- ONE_KNOWN_DW_ATE (signed, DW_ATE_signed) \
- ONE_KNOWN_DW_ATE (signed_char, DW_ATE_signed_char) \
- ONE_KNOWN_DW_ATE (signed_fixed, DW_ATE_signed_fixed) \
- ONE_KNOWN_DW_ATE (unsigned, DW_ATE_unsigned) \
- ONE_KNOWN_DW_ATE (unsigned_char, DW_ATE_unsigned_char) \
- ONE_KNOWN_DW_ATE (unsigned_fixed, DW_ATE_unsigned_fixed) \
- ONE_KNOWN_DW_ATE (void, DW_ATE_void) \
+#define DWARF_ALL_KNOWN_DW_ATE \
+ DWARF_ONE_KNOWN_DW_ATE (UTF, DW_ATE_UTF) \
+ DWARF_ONE_KNOWN_DW_ATE (address, DW_ATE_address) \
+ DWARF_ONE_KNOWN_DW_ATE (boolean, DW_ATE_boolean) \
+ DWARF_ONE_KNOWN_DW_ATE (complex_float, DW_ATE_complex_float) \
+ DWARF_ONE_KNOWN_DW_ATE (decimal_float, DW_ATE_decimal_float) \
+ DWARF_ONE_KNOWN_DW_ATE (edited, DW_ATE_edited) \
+ DWARF_ONE_KNOWN_DW_ATE (float, DW_ATE_float) \
+ DWARF_ONE_KNOWN_DW_ATE (imaginary_float, DW_ATE_imaginary_float) \
+ DWARF_ONE_KNOWN_DW_ATE (numeric_string, DW_ATE_numeric_string) \
+ DWARF_ONE_KNOWN_DW_ATE (packed_decimal, DW_ATE_packed_decimal) \
+ DWARF_ONE_KNOWN_DW_ATE (signed, DW_ATE_signed) \
+ DWARF_ONE_KNOWN_DW_ATE (signed_char, DW_ATE_signed_char) \
+ DWARF_ONE_KNOWN_DW_ATE (signed_fixed, DW_ATE_signed_fixed) \
+ DWARF_ONE_KNOWN_DW_ATE (unsigned, DW_ATE_unsigned) \
+ DWARF_ONE_KNOWN_DW_ATE (unsigned_char, DW_ATE_unsigned_char) \
+ DWARF_ONE_KNOWN_DW_ATE (unsigned_fixed, DW_ATE_unsigned_fixed) \
+ DWARF_ONE_KNOWN_DW_ATE (void, DW_ATE_void) \
/* End of DW_ATE_*. */
-#define ALL_KNOWN_DW_CC \
- ONE_KNOWN_DW_CC (nocall, DW_CC_nocall) \
- ONE_KNOWN_DW_CC (normal, DW_CC_normal) \
- ONE_KNOWN_DW_CC (program, DW_CC_program) \
+#define DWARF_ALL_KNOWN_DW_CC \
+ DWARF_ONE_KNOWN_DW_CC (nocall, DW_CC_nocall) \
+ DWARF_ONE_KNOWN_DW_CC (normal, DW_CC_normal) \
+ DWARF_ONE_KNOWN_DW_CC (program, DW_CC_program) \
/* End of DW_CC_*. */
-#define ALL_KNOWN_DW_CFA \
- ONE_KNOWN_DW_CFA (GNU_args_size, DW_CFA_GNU_args_size) \
- ONE_KNOWN_DW_CFA (GNU_negative_offset_extended, DW_CFA_GNU_negative_offset_extended) \
- ONE_KNOWN_DW_CFA (GNU_window_save, DW_CFA_GNU_window_save) \
- ONE_KNOWN_DW_CFA (MIPS_advance_loc8, DW_CFA_MIPS_advance_loc8) \
- ONE_KNOWN_DW_CFA (advance_loc, DW_CFA_advance_loc) \
- ONE_KNOWN_DW_CFA (advance_loc1, DW_CFA_advance_loc1) \
- ONE_KNOWN_DW_CFA (advance_loc2, DW_CFA_advance_loc2) \
- ONE_KNOWN_DW_CFA (advance_loc4, DW_CFA_advance_loc4) \
- ONE_KNOWN_DW_CFA (def_cfa, DW_CFA_def_cfa) \
- ONE_KNOWN_DW_CFA (def_cfa_expression, DW_CFA_def_cfa_expression) \
- ONE_KNOWN_DW_CFA (def_cfa_offset, DW_CFA_def_cfa_offset) \
- ONE_KNOWN_DW_CFA (def_cfa_offset_sf, DW_CFA_def_cfa_offset_sf) \
- ONE_KNOWN_DW_CFA (def_cfa_register, DW_CFA_def_cfa_register) \
- ONE_KNOWN_DW_CFA (def_cfa_sf, DW_CFA_def_cfa_sf) \
- ONE_KNOWN_DW_CFA (expression, DW_CFA_expression) \
- ONE_KNOWN_DW_CFA (extended, DW_CFA_extended) \
- ONE_KNOWN_DW_CFA (nop, DW_CFA_nop) \
- ONE_KNOWN_DW_CFA (offset, DW_CFA_offset) \
- ONE_KNOWN_DW_CFA (offset_extended, DW_CFA_offset_extended) \
- ONE_KNOWN_DW_CFA (offset_extended_sf, DW_CFA_offset_extended_sf) \
- ONE_KNOWN_DW_CFA (register, DW_CFA_register) \
- ONE_KNOWN_DW_CFA (remember_state, DW_CFA_remember_state) \
- ONE_KNOWN_DW_CFA (restore, DW_CFA_restore) \
- ONE_KNOWN_DW_CFA (restore_extended, DW_CFA_restore_extended) \
- ONE_KNOWN_DW_CFA (restore_state, DW_CFA_restore_state) \
- ONE_KNOWN_DW_CFA (same_value, DW_CFA_same_value) \
- ONE_KNOWN_DW_CFA (set_loc, DW_CFA_set_loc) \
- ONE_KNOWN_DW_CFA (undefined, DW_CFA_undefined) \
- ONE_KNOWN_DW_CFA (val_expression, DW_CFA_val_expression) \
- ONE_KNOWN_DW_CFA (val_offset, DW_CFA_val_offset) \
- ONE_KNOWN_DW_CFA (val_offset_sf, DW_CFA_val_offset_sf) \
+#define DWARF_ALL_KNOWN_DW_CFA \
+ DWARF_ONE_KNOWN_DW_CFA (GNU_args_size, DW_CFA_GNU_args_size) \
+ DWARF_ONE_KNOWN_DW_CFA (GNU_negative_offset_extended, DW_CFA_GNU_negative_offset_extended) \
+ DWARF_ONE_KNOWN_DW_CFA (GNU_window_save, DW_CFA_GNU_window_save) \
+ DWARF_ONE_KNOWN_DW_CFA (MIPS_advance_loc8, DW_CFA_MIPS_advance_loc8) \
+ DWARF_ONE_KNOWN_DW_CFA (advance_loc, DW_CFA_advance_loc) \
+ DWARF_ONE_KNOWN_DW_CFA (advance_loc1, DW_CFA_advance_loc1) \
+ DWARF_ONE_KNOWN_DW_CFA (advance_loc2, DW_CFA_advance_loc2) \
+ DWARF_ONE_KNOWN_DW_CFA (advance_loc4, DW_CFA_advance_loc4) \
+ DWARF_ONE_KNOWN_DW_CFA (def_cfa, DW_CFA_def_cfa) \
+ DWARF_ONE_KNOWN_DW_CFA (def_cfa_expression, DW_CFA_def_cfa_expression) \
+ DWARF_ONE_KNOWN_DW_CFA (def_cfa_offset, DW_CFA_def_cfa_offset) \
+ DWARF_ONE_KNOWN_DW_CFA (def_cfa_offset_sf, DW_CFA_def_cfa_offset_sf) \
+ DWARF_ONE_KNOWN_DW_CFA (def_cfa_register, DW_CFA_def_cfa_register) \
+ DWARF_ONE_KNOWN_DW_CFA (def_cfa_sf, DW_CFA_def_cfa_sf) \
+ DWARF_ONE_KNOWN_DW_CFA (expression, DW_CFA_expression) \
+ DWARF_ONE_KNOWN_DW_CFA (extended, DW_CFA_extended) \
+ DWARF_ONE_KNOWN_DW_CFA (nop, DW_CFA_nop) \
+ DWARF_ONE_KNOWN_DW_CFA (offset, DW_CFA_offset) \
+ DWARF_ONE_KNOWN_DW_CFA (offset_extended, DW_CFA_offset_extended) \
+ DWARF_ONE_KNOWN_DW_CFA (offset_extended_sf, DW_CFA_offset_extended_sf) \
+ DWARF_ONE_KNOWN_DW_CFA (register, DW_CFA_register) \
+ DWARF_ONE_KNOWN_DW_CFA (remember_state, DW_CFA_remember_state) \
+ DWARF_ONE_KNOWN_DW_CFA (restore, DW_CFA_restore) \
+ DWARF_ONE_KNOWN_DW_CFA (restore_extended, DW_CFA_restore_extended) \
+ DWARF_ONE_KNOWN_DW_CFA (restore_state, DW_CFA_restore_state) \
+ DWARF_ONE_KNOWN_DW_CFA (same_value, DW_CFA_same_value) \
+ DWARF_ONE_KNOWN_DW_CFA (set_loc, DW_CFA_set_loc) \
+ DWARF_ONE_KNOWN_DW_CFA (undefined, DW_CFA_undefined) \
+ DWARF_ONE_KNOWN_DW_CFA (val_expression, DW_CFA_val_expression) \
+ DWARF_ONE_KNOWN_DW_CFA (val_offset, DW_CFA_val_offset) \
+ DWARF_ONE_KNOWN_DW_CFA (val_offset_sf, DW_CFA_val_offset_sf) \
/* End of DW_CFA_*. */
-#define ALL_KNOWN_DW_CHILDREN \
- ONE_KNOWN_DW_CHILDREN (no, DW_CHILDREN_no) \
- ONE_KNOWN_DW_CHILDREN (yes, DW_CHILDREN_yes) \
+#define DWARF_ALL_KNOWN_DW_CHILDREN \
+ DWARF_ONE_KNOWN_DW_CHILDREN (no, DW_CHILDREN_no) \
+ DWARF_ONE_KNOWN_DW_CHILDREN (yes, DW_CHILDREN_yes) \
/* End of DW_CHILDREN_*. */
-#define ALL_KNOWN_DW_CIE_ID \
- ONE_KNOWN_DW_CIE_ID_DESC (32, DW_CIE_ID_32, "In 32-bit format CIE header.") \
- ONE_KNOWN_DW_CIE_ID_DESC (64, DW_CIE_ID_64, "In 64-bit format CIE header.") \
+#define DWARF_ALL_KNOWN_DW_CIE_ID \
+ DWARF_ONE_KNOWN_DW_CIE_ID (32, DW_CIE_ID_32) \
+ DWARF_ONE_KNOWN_DW_CIE_ID (64, DW_CIE_ID_64) \
/* End of DW_CIE_ID_*. */
-#define ALL_KNOWN_DW_DS \
- ONE_KNOWN_DW_DS (leading_overpunch, DW_DS_leading_overpunch) \
- ONE_KNOWN_DW_DS (leading_separate, DW_DS_leading_separate) \
- ONE_KNOWN_DW_DS (trailing_overpunch, DW_DS_trailing_overpunch) \
- ONE_KNOWN_DW_DS (trailing_separate, DW_DS_trailing_separate) \
- ONE_KNOWN_DW_DS (unsigned, DW_DS_unsigned) \
+#define DWARF_ALL_KNOWN_DW_DS \
+ DWARF_ONE_KNOWN_DW_DS (leading_overpunch, DW_DS_leading_overpunch) \
+ DWARF_ONE_KNOWN_DW_DS (leading_separate, DW_DS_leading_separate) \
+ DWARF_ONE_KNOWN_DW_DS (trailing_overpunch, DW_DS_trailing_overpunch) \
+ DWARF_ONE_KNOWN_DW_DS (trailing_separate, DW_DS_trailing_separate) \
+ DWARF_ONE_KNOWN_DW_DS (unsigned, DW_DS_unsigned) \
/* End of DW_DS_*. */
-#define ALL_KNOWN_DW_DSC \
- ONE_KNOWN_DW_DSC (label, DW_DSC_label) \
- ONE_KNOWN_DW_DSC (range, DW_DSC_range) \
+#define DWARF_ALL_KNOWN_DW_DSC \
+ DWARF_ONE_KNOWN_DW_DSC (label, DW_DSC_label) \
+ DWARF_ONE_KNOWN_DW_DSC (range, DW_DSC_range) \
/* End of DW_DSC_*. */
-#define ALL_KNOWN_DW_EH_PE \
- ONE_KNOWN_DW_EH_PE (absptr, DW_EH_PE_absptr) \
- ONE_KNOWN_DW_EH_PE (aligned, DW_EH_PE_aligned) \
- ONE_KNOWN_DW_EH_PE (datarel, DW_EH_PE_datarel) \
- ONE_KNOWN_DW_EH_PE (funcrel, DW_EH_PE_funcrel) \
- ONE_KNOWN_DW_EH_PE (indirect, DW_EH_PE_indirect) \
- ONE_KNOWN_DW_EH_PE (omit, DW_EH_PE_omit) \
- ONE_KNOWN_DW_EH_PE (pcrel, DW_EH_PE_pcrel) \
- ONE_KNOWN_DW_EH_PE (sdata2, DW_EH_PE_sdata2) \
- ONE_KNOWN_DW_EH_PE (sdata4, DW_EH_PE_sdata4) \
- ONE_KNOWN_DW_EH_PE (sdata8, DW_EH_PE_sdata8) \
- ONE_KNOWN_DW_EH_PE (signed, DW_EH_PE_signed) \
- ONE_KNOWN_DW_EH_PE (sleb128, DW_EH_PE_sleb128) \
- ONE_KNOWN_DW_EH_PE (textrel, DW_EH_PE_textrel) \
- ONE_KNOWN_DW_EH_PE (udata2, DW_EH_PE_udata2) \
- ONE_KNOWN_DW_EH_PE (udata4, DW_EH_PE_udata4) \
- ONE_KNOWN_DW_EH_PE (udata8, DW_EH_PE_udata8) \
- ONE_KNOWN_DW_EH_PE (uleb128, DW_EH_PE_uleb128) \
+#define DWARF_ALL_KNOWN_DW_EH_PE \
+ DWARF_ONE_KNOWN_DW_EH_PE (absptr, DW_EH_PE_absptr) \
+ DWARF_ONE_KNOWN_DW_EH_PE (aligned, DW_EH_PE_aligned) \
+ DWARF_ONE_KNOWN_DW_EH_PE (datarel, DW_EH_PE_datarel) \
+ DWARF_ONE_KNOWN_DW_EH_PE (funcrel, DW_EH_PE_funcrel) \
+ DWARF_ONE_KNOWN_DW_EH_PE (indirect, DW_EH_PE_indirect) \
+ DWARF_ONE_KNOWN_DW_EH_PE (omit, DW_EH_PE_omit) \
+ DWARF_ONE_KNOWN_DW_EH_PE (pcrel, DW_EH_PE_pcrel) \
+ DWARF_ONE_KNOWN_DW_EH_PE (sdata2, DW_EH_PE_sdata2) \
+ DWARF_ONE_KNOWN_DW_EH_PE (sdata4, DW_EH_PE_sdata4) \
+ DWARF_ONE_KNOWN_DW_EH_PE (sdata8, DW_EH_PE_sdata8) \
+ DWARF_ONE_KNOWN_DW_EH_PE (signed, DW_EH_PE_signed) \
+ DWARF_ONE_KNOWN_DW_EH_PE (sleb128, DW_EH_PE_sleb128) \
+ DWARF_ONE_KNOWN_DW_EH_PE (textrel, DW_EH_PE_textrel) \
+ DWARF_ONE_KNOWN_DW_EH_PE (udata2, DW_EH_PE_udata2) \
+ DWARF_ONE_KNOWN_DW_EH_PE (udata4, DW_EH_PE_udata4) \
+ DWARF_ONE_KNOWN_DW_EH_PE (udata8, DW_EH_PE_udata8) \
+ DWARF_ONE_KNOWN_DW_EH_PE (uleb128, DW_EH_PE_uleb128) \
/* End of DW_EH_PE_*. */
-#define ALL_KNOWN_DW_END \
- ONE_KNOWN_DW_END (big, DW_END_big) \
- ONE_KNOWN_DW_END (default, DW_END_default) \
- ONE_KNOWN_DW_END (little, DW_END_little) \
+#define DWARF_ALL_KNOWN_DW_END \
+ DWARF_ONE_KNOWN_DW_END (big, DW_END_big) \
+ DWARF_ONE_KNOWN_DW_END (default, DW_END_default) \
+ DWARF_ONE_KNOWN_DW_END (little, DW_END_little) \
/* End of DW_END_*. */
-#define ALL_KNOWN_DW_FORM \
- ONE_KNOWN_DW_FORM_DESC (GNU_ref_alt, DW_FORM_GNU_ref_alt, "offset in alternate .debuginfo.") \
- ONE_KNOWN_DW_FORM_DESC (GNU_strp_alt, DW_FORM_GNU_strp_alt, "offset in alternate .debug_str.") \
- ONE_KNOWN_DW_FORM (addr, DW_FORM_addr) \
- ONE_KNOWN_DW_FORM (block, DW_FORM_block) \
- ONE_KNOWN_DW_FORM (block1, DW_FORM_block1) \
- ONE_KNOWN_DW_FORM (block2, DW_FORM_block2) \
- ONE_KNOWN_DW_FORM (block4, DW_FORM_block4) \
- ONE_KNOWN_DW_FORM (data1, DW_FORM_data1) \
- ONE_KNOWN_DW_FORM (data2, DW_FORM_data2) \
- ONE_KNOWN_DW_FORM (data4, DW_FORM_data4) \
- ONE_KNOWN_DW_FORM (data8, DW_FORM_data8) \
- ONE_KNOWN_DW_FORM (exprloc, DW_FORM_exprloc) \
- ONE_KNOWN_DW_FORM (flag, DW_FORM_flag) \
- ONE_KNOWN_DW_FORM (flag_present, DW_FORM_flag_present) \
- ONE_KNOWN_DW_FORM (indirect, DW_FORM_indirect) \
- ONE_KNOWN_DW_FORM (ref1, DW_FORM_ref1) \
- ONE_KNOWN_DW_FORM (ref2, DW_FORM_ref2) \
- ONE_KNOWN_DW_FORM (ref4, DW_FORM_ref4) \
- ONE_KNOWN_DW_FORM (ref8, DW_FORM_ref8) \
- ONE_KNOWN_DW_FORM (ref_addr, DW_FORM_ref_addr) \
- ONE_KNOWN_DW_FORM (ref_sig8, DW_FORM_ref_sig8) \
- ONE_KNOWN_DW_FORM (ref_udata, DW_FORM_ref_udata) \
- ONE_KNOWN_DW_FORM (sdata, DW_FORM_sdata) \
- ONE_KNOWN_DW_FORM (sec_offset, DW_FORM_sec_offset) \
- ONE_KNOWN_DW_FORM (string, DW_FORM_string) \
- ONE_KNOWN_DW_FORM (strp, DW_FORM_strp) \
- ONE_KNOWN_DW_FORM (udata, DW_FORM_udata) \
+#define DWARF_ALL_KNOWN_DW_FORM \
+ DWARF_ONE_KNOWN_DW_FORM (GNU_ref_alt, DW_FORM_GNU_ref_alt) \
+ DWARF_ONE_KNOWN_DW_FORM (GNU_strp_alt, DW_FORM_GNU_strp_alt) \
+ DWARF_ONE_KNOWN_DW_FORM (addr, DW_FORM_addr) \
+ DWARF_ONE_KNOWN_DW_FORM (block, DW_FORM_block) \
+ DWARF_ONE_KNOWN_DW_FORM (block1, DW_FORM_block1) \
+ DWARF_ONE_KNOWN_DW_FORM (block2, DW_FORM_block2) \
+ DWARF_ONE_KNOWN_DW_FORM (block4, DW_FORM_block4) \
+ DWARF_ONE_KNOWN_DW_FORM (data1, DW_FORM_data1) \
+ DWARF_ONE_KNOWN_DW_FORM (data2, DW_FORM_data2) \
+ DWARF_ONE_KNOWN_DW_FORM (data4, DW_FORM_data4) \
+ DWARF_ONE_KNOWN_DW_FORM (data8, DW_FORM_data8) \
+ DWARF_ONE_KNOWN_DW_FORM (exprloc, DW_FORM_exprloc) \
+ DWARF_ONE_KNOWN_DW_FORM (flag, DW_FORM_flag) \
+ DWARF_ONE_KNOWN_DW_FORM (flag_present, DW_FORM_flag_present) \
+ DWARF_ONE_KNOWN_DW_FORM (indirect, DW_FORM_indirect) \
+ DWARF_ONE_KNOWN_DW_FORM (ref1, DW_FORM_ref1) \
+ DWARF_ONE_KNOWN_DW_FORM (ref2, DW_FORM_ref2) \
+ DWARF_ONE_KNOWN_DW_FORM (ref4, DW_FORM_ref4) \
+ DWARF_ONE_KNOWN_DW_FORM (ref8, DW_FORM_ref8) \
+ DWARF_ONE_KNOWN_DW_FORM (ref_addr, DW_FORM_ref_addr) \
+ DWARF_ONE_KNOWN_DW_FORM (ref_sig8, DW_FORM_ref_sig8) \
+ DWARF_ONE_KNOWN_DW_FORM (ref_udata, DW_FORM_ref_udata) \
+ DWARF_ONE_KNOWN_DW_FORM (sdata, DW_FORM_sdata) \
+ DWARF_ONE_KNOWN_DW_FORM (sec_offset, DW_FORM_sec_offset) \
+ DWARF_ONE_KNOWN_DW_FORM (string, DW_FORM_string) \
+ DWARF_ONE_KNOWN_DW_FORM (strp, DW_FORM_strp) \
+ DWARF_ONE_KNOWN_DW_FORM (udata, DW_FORM_udata) \
/* End of DW_FORM_*. */
-#define ALL_KNOWN_DW_ID \
- ONE_KNOWN_DW_ID (case_insensitive, DW_ID_case_insensitive) \
- ONE_KNOWN_DW_ID (case_sensitive, DW_ID_case_sensitive) \
- ONE_KNOWN_DW_ID (down_case, DW_ID_down_case) \
- ONE_KNOWN_DW_ID (up_case, DW_ID_up_case) \
+#define DWARF_ALL_KNOWN_DW_ID \
+ DWARF_ONE_KNOWN_DW_ID (case_insensitive, DW_ID_case_insensitive) \
+ DWARF_ONE_KNOWN_DW_ID (case_sensitive, DW_ID_case_sensitive) \
+ DWARF_ONE_KNOWN_DW_ID (down_case, DW_ID_down_case) \
+ DWARF_ONE_KNOWN_DW_ID (up_case, DW_ID_up_case) \
/* End of DW_ID_*. */
-#define ALL_KNOWN_DW_INL \
- ONE_KNOWN_DW_INL (declared_inlined, DW_INL_declared_inlined) \
- ONE_KNOWN_DW_INL (declared_not_inlined, DW_INL_declared_not_inlined) \
- ONE_KNOWN_DW_INL (inlined, DW_INL_inlined) \
- ONE_KNOWN_DW_INL (not_inlined, DW_INL_not_inlined) \
+#define DWARF_ALL_KNOWN_DW_INL \
+ DWARF_ONE_KNOWN_DW_INL (declared_inlined, DW_INL_declared_inlined) \
+ DWARF_ONE_KNOWN_DW_INL (declared_not_inlined, DW_INL_declared_not_inlined) \
+ DWARF_ONE_KNOWN_DW_INL (inlined, DW_INL_inlined) \
+ DWARF_ONE_KNOWN_DW_INL (not_inlined, DW_INL_not_inlined) \
/* End of DW_INL_*. */
-#define ALL_KNOWN_DW_LANG \
- ONE_KNOWN_DW_LANG_DESC (Ada83, DW_LANG_Ada83, "ISO Ada:1983") \
- ONE_KNOWN_DW_LANG_DESC (Ada95, DW_LANG_Ada95, "ISO Ada:1995") \
- ONE_KNOWN_DW_LANG_DESC (C, DW_LANG_C, "C") \
- ONE_KNOWN_DW_LANG_DESC (C11, DW_LANG_C11, "ISO C:2011") \
- ONE_KNOWN_DW_LANG_DESC (C89, DW_LANG_C89, "ISO C:1989") \
- ONE_KNOWN_DW_LANG_DESC (C99, DW_LANG_C99, "ISO C:1999") \
- ONE_KNOWN_DW_LANG_DESC (C_plus_plus, DW_LANG_C_plus_plus, "ISO C++:1998") \
- ONE_KNOWN_DW_LANG_DESC (C_plus_plus_11, DW_LANG_C_plus_plus_11, "ISO C++:2011") \
- ONE_KNOWN_DW_LANG_DESC (C_plus_plus_14, DW_LANG_C_plus_plus_14, "ISO C++:2014") \
- ONE_KNOWN_DW_LANG_DESC (Cobol74, DW_LANG_Cobol74, "ISO Cobol:1974") \
- ONE_KNOWN_DW_LANG_DESC (Cobol85, DW_LANG_Cobol85, "ISO Cobol:1985") \
- ONE_KNOWN_DW_LANG_DESC (D, DW_LANG_D, "D") \
- ONE_KNOWN_DW_LANG_DESC (Fortran77, DW_LANG_Fortran77, "ISO FORTRAN 77") \
- ONE_KNOWN_DW_LANG_DESC (Fortran90, DW_LANG_Fortran90, "ISO Fortran 90") \
- ONE_KNOWN_DW_LANG_DESC (Fortran95, DW_LANG_Fortran95, "ISO Fortran 95") \
- ONE_KNOWN_DW_LANG_DESC (Go, DW_LANG_Go, "Go") \
- ONE_KNOWN_DW_LANG_DESC (Java, DW_LANG_Java, "Java") \
- ONE_KNOWN_DW_LANG_DESC (Mips_Assembler, DW_LANG_Mips_Assembler, "Assembler") \
- ONE_KNOWN_DW_LANG_DESC (Modula2, DW_LANG_Modula2, "ISO Modula-2:1996") \
- ONE_KNOWN_DW_LANG_DESC (ObjC, DW_LANG_ObjC, "Objective-C") \
- ONE_KNOWN_DW_LANG_DESC (ObjC_plus_plus, DW_LANG_ObjC_plus_plus, "Objective-C++") \
- ONE_KNOWN_DW_LANG_DESC (PL1, DW_LANG_PL1, "ISO PL/1:1976") \
- ONE_KNOWN_DW_LANG_DESC (Pascal83, DW_LANG_Pascal83, "ISO Pascal:1983") \
- ONE_KNOWN_DW_LANG_DESC (Python, DW_LANG_Python, "Python") \
- ONE_KNOWN_DW_LANG_DESC (UPC, DW_LANG_UPC, "Unified Parallel C") \
+#define DWARF_ALL_KNOWN_DW_LANG \
+ DWARF_ONE_KNOWN_DW_LANG (Ada83, DW_LANG_Ada83) \
+ DWARF_ONE_KNOWN_DW_LANG (Ada95, DW_LANG_Ada95) \
+ DWARF_ONE_KNOWN_DW_LANG (C, DW_LANG_C) \
+ DWARF_ONE_KNOWN_DW_LANG (C11, DW_LANG_C11) \
+ DWARF_ONE_KNOWN_DW_LANG (C89, DW_LANG_C89) \
+ DWARF_ONE_KNOWN_DW_LANG (C99, DW_LANG_C99) \
+ DWARF_ONE_KNOWN_DW_LANG (C_plus_plus, DW_LANG_C_plus_plus) \
+ DWARF_ONE_KNOWN_DW_LANG (C_plus_plus_11, DW_LANG_C_plus_plus_11) \
+ DWARF_ONE_KNOWN_DW_LANG (C_plus_plus_14, DW_LANG_C_plus_plus_14) \
+ DWARF_ONE_KNOWN_DW_LANG (Cobol74, DW_LANG_Cobol74) \
+ DWARF_ONE_KNOWN_DW_LANG (Cobol85, DW_LANG_Cobol85) \
+ DWARF_ONE_KNOWN_DW_LANG (D, DW_LANG_D) \
+ DWARF_ONE_KNOWN_DW_LANG (Fortran03, DW_LANG_Fortran03) \
+ DWARF_ONE_KNOWN_DW_LANG (Fortran08, DW_LANG_Fortran08) \
+ DWARF_ONE_KNOWN_DW_LANG (Fortran77, DW_LANG_Fortran77) \
+ DWARF_ONE_KNOWN_DW_LANG (Fortran90, DW_LANG_Fortran90) \
+ DWARF_ONE_KNOWN_DW_LANG (Fortran95, DW_LANG_Fortran95) \
+ DWARF_ONE_KNOWN_DW_LANG (Go, DW_LANG_Go) \
+ DWARF_ONE_KNOWN_DW_LANG (Java, DW_LANG_Java) \
+ DWARF_ONE_KNOWN_DW_LANG (Mips_Assembler, DW_LANG_Mips_Assembler) \
+ DWARF_ONE_KNOWN_DW_LANG (Modula2, DW_LANG_Modula2) \
+ DWARF_ONE_KNOWN_DW_LANG (ObjC, DW_LANG_ObjC) \
+ DWARF_ONE_KNOWN_DW_LANG (ObjC_plus_plus, DW_LANG_ObjC_plus_plus) \
+ DWARF_ONE_KNOWN_DW_LANG (PL1, DW_LANG_PL1) \
+ DWARF_ONE_KNOWN_DW_LANG (Pascal83, DW_LANG_Pascal83) \
+ DWARF_ONE_KNOWN_DW_LANG (Python, DW_LANG_Python) \
+ DWARF_ONE_KNOWN_DW_LANG (UPC, DW_LANG_UPC) \
/* End of DW_LANG_*. */
-#define ALL_KNOWN_DW_LNE \
- ONE_KNOWN_DW_LNE (define_file, DW_LNE_define_file) \
- ONE_KNOWN_DW_LNE (end_sequence, DW_LNE_end_sequence) \
- ONE_KNOWN_DW_LNE (set_address, DW_LNE_set_address) \
- ONE_KNOWN_DW_LNE (set_discriminator, DW_LNE_set_discriminator) \
+#define DWARF_ALL_KNOWN_DW_LNE \
+ DWARF_ONE_KNOWN_DW_LNE (define_file, DW_LNE_define_file) \
+ DWARF_ONE_KNOWN_DW_LNE (end_sequence, DW_LNE_end_sequence) \
+ DWARF_ONE_KNOWN_DW_LNE (set_address, DW_LNE_set_address) \
+ DWARF_ONE_KNOWN_DW_LNE (set_discriminator, DW_LNE_set_discriminator) \
/* End of DW_LNE_*. */
-#define ALL_KNOWN_DW_LNS \
- ONE_KNOWN_DW_LNS (advance_line, DW_LNS_advance_line) \
- ONE_KNOWN_DW_LNS (advance_pc, DW_LNS_advance_pc) \
- ONE_KNOWN_DW_LNS (const_add_pc, DW_LNS_const_add_pc) \
- ONE_KNOWN_DW_LNS (copy, DW_LNS_copy) \
- ONE_KNOWN_DW_LNS (fixed_advance_pc, DW_LNS_fixed_advance_pc) \
- ONE_KNOWN_DW_LNS (negate_stmt, DW_LNS_negate_stmt) \
- ONE_KNOWN_DW_LNS (set_basic_block, DW_LNS_set_basic_block) \
- ONE_KNOWN_DW_LNS (set_column, DW_LNS_set_column) \
- ONE_KNOWN_DW_LNS (set_epilogue_begin, DW_LNS_set_epilogue_begin) \
- ONE_KNOWN_DW_LNS (set_file, DW_LNS_set_file) \
- ONE_KNOWN_DW_LNS (set_isa, DW_LNS_set_isa) \
- ONE_KNOWN_DW_LNS (set_prologue_end, DW_LNS_set_prologue_end) \
+#define DWARF_ALL_KNOWN_DW_LNS \
+ DWARF_ONE_KNOWN_DW_LNS (advance_line, DW_LNS_advance_line) \
+ DWARF_ONE_KNOWN_DW_LNS (advance_pc, DW_LNS_advance_pc) \
+ DWARF_ONE_KNOWN_DW_LNS (const_add_pc, DW_LNS_const_add_pc) \
+ DWARF_ONE_KNOWN_DW_LNS (copy, DW_LNS_copy) \
+ DWARF_ONE_KNOWN_DW_LNS (fixed_advance_pc, DW_LNS_fixed_advance_pc) \
+ DWARF_ONE_KNOWN_DW_LNS (negate_stmt, DW_LNS_negate_stmt) \
+ DWARF_ONE_KNOWN_DW_LNS (set_basic_block, DW_LNS_set_basic_block) \
+ DWARF_ONE_KNOWN_DW_LNS (set_column, DW_LNS_set_column) \
+ DWARF_ONE_KNOWN_DW_LNS (set_epilogue_begin, DW_LNS_set_epilogue_begin) \
+ DWARF_ONE_KNOWN_DW_LNS (set_file, DW_LNS_set_file) \
+ DWARF_ONE_KNOWN_DW_LNS (set_isa, DW_LNS_set_isa) \
+ DWARF_ONE_KNOWN_DW_LNS (set_prologue_end, DW_LNS_set_prologue_end) \
/* End of DW_LNS_*. */
-#define ALL_KNOWN_DW_MACINFO \
- ONE_KNOWN_DW_MACINFO (define, DW_MACINFO_define) \
- ONE_KNOWN_DW_MACINFO (end_file, DW_MACINFO_end_file) \
- ONE_KNOWN_DW_MACINFO (start_file, DW_MACINFO_start_file) \
- ONE_KNOWN_DW_MACINFO (undef, DW_MACINFO_undef) \
- ONE_KNOWN_DW_MACINFO (vendor_ext, DW_MACINFO_vendor_ext) \
+#define DWARF_ALL_KNOWN_DW_MACINFO \
+ DWARF_ONE_KNOWN_DW_MACINFO (define, DW_MACINFO_define) \
+ DWARF_ONE_KNOWN_DW_MACINFO (end_file, DW_MACINFO_end_file) \
+ DWARF_ONE_KNOWN_DW_MACINFO (start_file, DW_MACINFO_start_file) \
+ DWARF_ONE_KNOWN_DW_MACINFO (undef, DW_MACINFO_undef) \
+ DWARF_ONE_KNOWN_DW_MACINFO (vendor_ext, DW_MACINFO_vendor_ext) \
/* End of DW_MACINFO_*. */
-#define ALL_KNOWN_DW_MACRO_GNU \
- ONE_KNOWN_DW_MACRO_GNU (define, DW_MACRO_GNU_define) \
- ONE_KNOWN_DW_MACRO_GNU (define_indirect, DW_MACRO_GNU_define_indirect) \
- ONE_KNOWN_DW_MACRO_GNU (end_file, DW_MACRO_GNU_end_file) \
- ONE_KNOWN_DW_MACRO_GNU (start_file, DW_MACRO_GNU_start_file) \
- ONE_KNOWN_DW_MACRO_GNU (transparent_include, DW_MACRO_GNU_transparent_include) \
- ONE_KNOWN_DW_MACRO_GNU (undef, DW_MACRO_GNU_undef) \
- ONE_KNOWN_DW_MACRO_GNU (undef_indirect, DW_MACRO_GNU_undef_indirect) \
+#define DWARF_ALL_KNOWN_DW_MACRO_GNU \
+ DWARF_ONE_KNOWN_DW_MACRO_GNU (define, DW_MACRO_GNU_define) \
+ DWARF_ONE_KNOWN_DW_MACRO_GNU (define_indirect, DW_MACRO_GNU_define_indirect) \
+ DWARF_ONE_KNOWN_DW_MACRO_GNU (end_file, DW_MACRO_GNU_end_file) \
+ DWARF_ONE_KNOWN_DW_MACRO_GNU (start_file, DW_MACRO_GNU_start_file) \
+ DWARF_ONE_KNOWN_DW_MACRO_GNU (transparent_include, DW_MACRO_GNU_transparent_include) \
+ DWARF_ONE_KNOWN_DW_MACRO_GNU (undef, DW_MACRO_GNU_undef) \
+ DWARF_ONE_KNOWN_DW_MACRO_GNU (undef_indirect, DW_MACRO_GNU_undef_indirect) \
/* End of DW_MACRO_GNU_*. */
-#define ALL_KNOWN_DW_OP \
- ONE_KNOWN_DW_OP (GNU_const_type, DW_OP_GNU_const_type) \
- ONE_KNOWN_DW_OP (GNU_convert, DW_OP_GNU_convert) \
- ONE_KNOWN_DW_OP (GNU_deref_type, DW_OP_GNU_deref_type) \
- ONE_KNOWN_DW_OP (GNU_encoded_addr, DW_OP_GNU_encoded_addr) \
- ONE_KNOWN_DW_OP (GNU_entry_value, DW_OP_GNU_entry_value) \
- ONE_KNOWN_DW_OP (GNU_implicit_pointer, DW_OP_GNU_implicit_pointer) \
- ONE_KNOWN_DW_OP (GNU_parameter_ref, DW_OP_GNU_parameter_ref) \
- ONE_KNOWN_DW_OP (GNU_push_tls_address, DW_OP_GNU_push_tls_address) \
- ONE_KNOWN_DW_OP (GNU_regval_type, DW_OP_GNU_regval_type) \
- ONE_KNOWN_DW_OP (GNU_reinterpret, DW_OP_GNU_reinterpret) \
- ONE_KNOWN_DW_OP (GNU_uninit, DW_OP_GNU_uninit) \
- ONE_KNOWN_DW_OP (abs, DW_OP_abs) \
- ONE_KNOWN_DW_OP_DESC (addr, DW_OP_addr, "Constant address.") \
- ONE_KNOWN_DW_OP (and, DW_OP_and) \
- ONE_KNOWN_DW_OP_DESC (bit_piece, DW_OP_bit_piece, "ULEB128 size and ULEB128 offset in bits.") \
- ONE_KNOWN_DW_OP_DESC (bra, DW_OP_bra, "Signed 2-byte constant.") \
- ONE_KNOWN_DW_OP_DESC (breg0, DW_OP_breg0, "Base register 0.") \
- ONE_KNOWN_DW_OP_DESC (breg1, DW_OP_breg1, "Base register 1.") \
- ONE_KNOWN_DW_OP_DESC (breg10, DW_OP_breg10, "Base register 10.") \
- ONE_KNOWN_DW_OP_DESC (breg11, DW_OP_breg11, "Base register 11.") \
- ONE_KNOWN_DW_OP_DESC (breg12, DW_OP_breg12, "Base register 12.") \
- ONE_KNOWN_DW_OP_DESC (breg13, DW_OP_breg13, "Base register 13.") \
- ONE_KNOWN_DW_OP_DESC (breg14, DW_OP_breg14, "Base register 14.") \
- ONE_KNOWN_DW_OP_DESC (breg15, DW_OP_breg15, "Base register 15.") \
- ONE_KNOWN_DW_OP_DESC (breg16, DW_OP_breg16, "Base register 16.") \
- ONE_KNOWN_DW_OP_DESC (breg17, DW_OP_breg17, "Base register 17.") \
- ONE_KNOWN_DW_OP_DESC (breg18, DW_OP_breg18, "Base register 18.") \
- ONE_KNOWN_DW_OP_DESC (breg19, DW_OP_breg19, "Base register 19.") \
- ONE_KNOWN_DW_OP_DESC (breg2, DW_OP_breg2, "Base register 2.") \
- ONE_KNOWN_DW_OP_DESC (breg20, DW_OP_breg20, "Base register 20.") \
- ONE_KNOWN_DW_OP_DESC (breg21, DW_OP_breg21, "Base register 21.") \
- ONE_KNOWN_DW_OP_DESC (breg22, DW_OP_breg22, "Base register 22.") \
- ONE_KNOWN_DW_OP_DESC (breg23, DW_OP_breg23, "Base register 23.") \
- ONE_KNOWN_DW_OP_DESC (breg24, DW_OP_breg24, "Base register 24.") \
- ONE_KNOWN_DW_OP_DESC (breg25, DW_OP_breg25, "Base register 25.") \
- ONE_KNOWN_DW_OP_DESC (breg26, DW_OP_breg26, "Base register 26.") \
- ONE_KNOWN_DW_OP_DESC (breg27, DW_OP_breg27, "Base register 27.") \
- ONE_KNOWN_DW_OP_DESC (breg28, DW_OP_breg28, "Base register 28.") \
- ONE_KNOWN_DW_OP_DESC (breg29, DW_OP_breg29, "Base register 29.") \
- ONE_KNOWN_DW_OP_DESC (breg3, DW_OP_breg3, "Base register 3.") \
- ONE_KNOWN_DW_OP_DESC (breg30, DW_OP_breg30, "Base register 30.") \
- ONE_KNOWN_DW_OP_DESC (breg31, DW_OP_breg31, "Base register 31.") \
- ONE_KNOWN_DW_OP_DESC (breg4, DW_OP_breg4, "Base register 4.") \
- ONE_KNOWN_DW_OP_DESC (breg5, DW_OP_breg5, "Base register 5.") \
- ONE_KNOWN_DW_OP_DESC (breg6, DW_OP_breg6, "Base register 6.") \
- ONE_KNOWN_DW_OP_DESC (breg7, DW_OP_breg7, "Base register 7.") \
- ONE_KNOWN_DW_OP_DESC (breg8, DW_OP_breg8, "Base register 8.") \
- ONE_KNOWN_DW_OP_DESC (breg9, DW_OP_breg9, "Base register 9.") \
- ONE_KNOWN_DW_OP_DESC (bregx, DW_OP_bregx, "ULEB128 register followed by SLEB128 off.") \
- ONE_KNOWN_DW_OP (call2, DW_OP_call2) \
- ONE_KNOWN_DW_OP (call4, DW_OP_call4) \
- ONE_KNOWN_DW_OP (call_frame_cfa, DW_OP_call_frame_cfa) \
- ONE_KNOWN_DW_OP (call_ref, DW_OP_call_ref) \
- ONE_KNOWN_DW_OP_DESC (const1s, DW_OP_const1s, "Signed 1-byte constant.") \
- ONE_KNOWN_DW_OP_DESC (const1u, DW_OP_const1u, "Unsigned 1-byte constant.") \
- ONE_KNOWN_DW_OP_DESC (const2s, DW_OP_const2s, "Signed 2-byte constant.") \
- ONE_KNOWN_DW_OP_DESC (const2u, DW_OP_const2u, "Unsigned 2-byte constant.") \
- ONE_KNOWN_DW_OP_DESC (const4s, DW_OP_const4s, "Signed 4-byte constant.") \
- ONE_KNOWN_DW_OP_DESC (const4u, DW_OP_const4u, "Unsigned 4-byte constant.") \
- ONE_KNOWN_DW_OP_DESC (const8s, DW_OP_const8s, "Signed 8-byte constant.") \
- ONE_KNOWN_DW_OP_DESC (const8u, DW_OP_const8u, "Unsigned 8-byte constant.") \
- ONE_KNOWN_DW_OP_DESC (consts, DW_OP_consts, "Signed LEB128 constant.") \
- ONE_KNOWN_DW_OP_DESC (constu, DW_OP_constu, "Unsigned LEB128 constant.") \
- ONE_KNOWN_DW_OP (deref, DW_OP_deref) \
- ONE_KNOWN_DW_OP_DESC (deref_size, DW_OP_deref_size, "1-byte size of data retrieved.") \
- ONE_KNOWN_DW_OP (div, DW_OP_div) \
- ONE_KNOWN_DW_OP (drop, DW_OP_drop) \
- ONE_KNOWN_DW_OP (dup, DW_OP_dup) \
- ONE_KNOWN_DW_OP (eq, DW_OP_eq) \
- ONE_KNOWN_DW_OP_DESC (fbreg, DW_OP_fbreg, "Signed LEB128 offset.") \
- ONE_KNOWN_DW_OP (form_tls_address, DW_OP_form_tls_address) \
- ONE_KNOWN_DW_OP (ge, DW_OP_ge) \
- ONE_KNOWN_DW_OP (gt, DW_OP_gt) \
- ONE_KNOWN_DW_OP_DESC (implicit_value, DW_OP_implicit_value, "DW_FORM_block follows opcode.") \
- ONE_KNOWN_DW_OP (le, DW_OP_le) \
- ONE_KNOWN_DW_OP_DESC (lit0, DW_OP_lit0, "Literal 0.") \
- ONE_KNOWN_DW_OP_DESC (lit1, DW_OP_lit1, "Literal 1.") \
- ONE_KNOWN_DW_OP_DESC (lit10, DW_OP_lit10, "Literal 10.") \
- ONE_KNOWN_DW_OP_DESC (lit11, DW_OP_lit11, "Literal 11.") \
- ONE_KNOWN_DW_OP_DESC (lit12, DW_OP_lit12, "Literal 12.") \
- ONE_KNOWN_DW_OP_DESC (lit13, DW_OP_lit13, "Literal 13.") \
- ONE_KNOWN_DW_OP_DESC (lit14, DW_OP_lit14, "Literal 14.") \
- ONE_KNOWN_DW_OP_DESC (lit15, DW_OP_lit15, "Literal 15.") \
- ONE_KNOWN_DW_OP_DESC (lit16, DW_OP_lit16, "Literal 16.") \
- ONE_KNOWN_DW_OP_DESC (lit17, DW_OP_lit17, "Literal 17.") \
- ONE_KNOWN_DW_OP_DESC (lit18, DW_OP_lit18, "Literal 18.") \
- ONE_KNOWN_DW_OP_DESC (lit19, DW_OP_lit19, "Literal 19.") \
- ONE_KNOWN_DW_OP_DESC (lit2, DW_OP_lit2, "Literal 2.") \
- ONE_KNOWN_DW_OP_DESC (lit20, DW_OP_lit20, "Literal 20.") \
- ONE_KNOWN_DW_OP_DESC (lit21, DW_OP_lit21, "Literal 21.") \
- ONE_KNOWN_DW_OP_DESC (lit22, DW_OP_lit22, "Literal 22.") \
- ONE_KNOWN_DW_OP_DESC (lit23, DW_OP_lit23, "Literal 23.") \
- ONE_KNOWN_DW_OP_DESC (lit24, DW_OP_lit24, "Literal 24.") \
- ONE_KNOWN_DW_OP_DESC (lit25, DW_OP_lit25, "Literal 25.") \
- ONE_KNOWN_DW_OP_DESC (lit26, DW_OP_lit26, "Literal 26.") \
- ONE_KNOWN_DW_OP_DESC (lit27, DW_OP_lit27, "Literal 27.") \
- ONE_KNOWN_DW_OP_DESC (lit28, DW_OP_lit28, "Literal 28.") \
- ONE_KNOWN_DW_OP_DESC (lit29, DW_OP_lit29, "Literal 29.") \
- ONE_KNOWN_DW_OP_DESC (lit3, DW_OP_lit3, "Literal 3.") \
- ONE_KNOWN_DW_OP_DESC (lit30, DW_OP_lit30, "Literal 30.") \
- ONE_KNOWN_DW_OP_DESC (lit31, DW_OP_lit31, "Literal 31.") \
- ONE_KNOWN_DW_OP_DESC (lit4, DW_OP_lit4, "Literal 4.") \
- ONE_KNOWN_DW_OP_DESC (lit5, DW_OP_lit5, "Literal 5.") \
- ONE_KNOWN_DW_OP_DESC (lit6, DW_OP_lit6, "Literal 6.") \
- ONE_KNOWN_DW_OP_DESC (lit7, DW_OP_lit7, "Literal 7.") \
- ONE_KNOWN_DW_OP_DESC (lit8, DW_OP_lit8, "Literal 8.") \
- ONE_KNOWN_DW_OP_DESC (lit9, DW_OP_lit9, "Literal 9.") \
- ONE_KNOWN_DW_OP (lt, DW_OP_lt) \
- ONE_KNOWN_DW_OP (minus, DW_OP_minus) \
- ONE_KNOWN_DW_OP (mod, DW_OP_mod) \
- ONE_KNOWN_DW_OP (mul, DW_OP_mul) \
- ONE_KNOWN_DW_OP (ne, DW_OP_ne) \
- ONE_KNOWN_DW_OP (neg, DW_OP_neg) \
- ONE_KNOWN_DW_OP (nop, DW_OP_nop) \
- ONE_KNOWN_DW_OP (not, DW_OP_not) \
- ONE_KNOWN_DW_OP (or, DW_OP_or) \
- ONE_KNOWN_DW_OP (over, DW_OP_over) \
- ONE_KNOWN_DW_OP_DESC (pick, DW_OP_pick, "1-byte stack index.") \
- ONE_KNOWN_DW_OP_DESC (piece, DW_OP_piece, "ULEB128 size of piece addressed.") \
- ONE_KNOWN_DW_OP (plus, DW_OP_plus) \
- ONE_KNOWN_DW_OP_DESC (plus_uconst, DW_OP_plus_uconst, "Unsigned LEB128 addend.") \
- ONE_KNOWN_DW_OP (push_object_address, DW_OP_push_object_address) \
- ONE_KNOWN_DW_OP_DESC (reg0, DW_OP_reg0, "Register 0.") \
- ONE_KNOWN_DW_OP_DESC (reg1, DW_OP_reg1, "Register 1.") \
- ONE_KNOWN_DW_OP_DESC (reg10, DW_OP_reg10, "Register 10.") \
- ONE_KNOWN_DW_OP_DESC (reg11, DW_OP_reg11, "Register 11.") \
- ONE_KNOWN_DW_OP_DESC (reg12, DW_OP_reg12, "Register 12.") \
- ONE_KNOWN_DW_OP_DESC (reg13, DW_OP_reg13, "Register 13.") \
- ONE_KNOWN_DW_OP_DESC (reg14, DW_OP_reg14, "Register 14.") \
- ONE_KNOWN_DW_OP_DESC (reg15, DW_OP_reg15, "Register 15.") \
- ONE_KNOWN_DW_OP_DESC (reg16, DW_OP_reg16, "Register 16.") \
- ONE_KNOWN_DW_OP_DESC (reg17, DW_OP_reg17, "Register 17.") \
- ONE_KNOWN_DW_OP_DESC (reg18, DW_OP_reg18, "Register 18.") \
- ONE_KNOWN_DW_OP_DESC (reg19, DW_OP_reg19, "Register 19.") \
- ONE_KNOWN_DW_OP_DESC (reg2, DW_OP_reg2, "Register 2.") \
- ONE_KNOWN_DW_OP_DESC (reg20, DW_OP_reg20, "Register 20.") \
- ONE_KNOWN_DW_OP_DESC (reg21, DW_OP_reg21, "Register 21.") \
- ONE_KNOWN_DW_OP_DESC (reg22, DW_OP_reg22, "Register 22.") \
- ONE_KNOWN_DW_OP_DESC (reg23, DW_OP_reg23, "Register 24.") \
- ONE_KNOWN_DW_OP_DESC (reg24, DW_OP_reg24, "Register 24.") \
- ONE_KNOWN_DW_OP_DESC (reg25, DW_OP_reg25, "Register 25.") \
- ONE_KNOWN_DW_OP_DESC (reg26, DW_OP_reg26, "Register 26.") \
- ONE_KNOWN_DW_OP_DESC (reg27, DW_OP_reg27, "Register 27.") \
- ONE_KNOWN_DW_OP_DESC (reg28, DW_OP_reg28, "Register 28.") \
- ONE_KNOWN_DW_OP_DESC (reg29, DW_OP_reg29, "Register 29.") \
- ONE_KNOWN_DW_OP_DESC (reg3, DW_OP_reg3, "Register 3.") \
- ONE_KNOWN_DW_OP_DESC (reg30, DW_OP_reg30, "Register 30.") \
- ONE_KNOWN_DW_OP_DESC (reg31, DW_OP_reg31, "Register 31.") \
- ONE_KNOWN_DW_OP_DESC (reg4, DW_OP_reg4, "Register 4.") \
- ONE_KNOWN_DW_OP_DESC (reg5, DW_OP_reg5, "Register 5.") \
- ONE_KNOWN_DW_OP_DESC (reg6, DW_OP_reg6, "Register 6.") \
- ONE_KNOWN_DW_OP_DESC (reg7, DW_OP_reg7, "Register 7.") \
- ONE_KNOWN_DW_OP_DESC (reg8, DW_OP_reg8, "Register 8.") \
- ONE_KNOWN_DW_OP_DESC (reg9, DW_OP_reg9, "Register 9.") \
- ONE_KNOWN_DW_OP_DESC (regx, DW_OP_regx, "Unsigned LEB128 register.") \
- ONE_KNOWN_DW_OP (rot, DW_OP_rot) \
- ONE_KNOWN_DW_OP (shl, DW_OP_shl) \
- ONE_KNOWN_DW_OP (shr, DW_OP_shr) \
- ONE_KNOWN_DW_OP (shra, DW_OP_shra) \
- ONE_KNOWN_DW_OP_DESC (skip, DW_OP_skip, "Signed 2-byte constant.") \
- ONE_KNOWN_DW_OP_DESC (stack_value, DW_OP_stack_value, "No operands, special like DW_OP_piece.") \
- ONE_KNOWN_DW_OP (swap, DW_OP_swap) \
- ONE_KNOWN_DW_OP (xderef, DW_OP_xderef) \
- ONE_KNOWN_DW_OP_DESC (xderef_size, DW_OP_xderef_size, "1-byte size of data retrieved.") \
- ONE_KNOWN_DW_OP (xor, DW_OP_xor) \
+#define DWARF_ALL_KNOWN_DW_OP \
+ DWARF_ONE_KNOWN_DW_OP (GNU_const_type, DW_OP_GNU_const_type) \
+ DWARF_ONE_KNOWN_DW_OP (GNU_convert, DW_OP_GNU_convert) \
+ DWARF_ONE_KNOWN_DW_OP (GNU_deref_type, DW_OP_GNU_deref_type) \
+ DWARF_ONE_KNOWN_DW_OP (GNU_encoded_addr, DW_OP_GNU_encoded_addr) \
+ DWARF_ONE_KNOWN_DW_OP (GNU_entry_value, DW_OP_GNU_entry_value) \
+ DWARF_ONE_KNOWN_DW_OP (GNU_implicit_pointer, DW_OP_GNU_implicit_pointer) \
+ DWARF_ONE_KNOWN_DW_OP (GNU_parameter_ref, DW_OP_GNU_parameter_ref) \
+ DWARF_ONE_KNOWN_DW_OP (GNU_push_tls_address, DW_OP_GNU_push_tls_address) \
+ DWARF_ONE_KNOWN_DW_OP (GNU_regval_type, DW_OP_GNU_regval_type) \
+ DWARF_ONE_KNOWN_DW_OP (GNU_reinterpret, DW_OP_GNU_reinterpret) \
+ DWARF_ONE_KNOWN_DW_OP (GNU_uninit, DW_OP_GNU_uninit) \
+ DWARF_ONE_KNOWN_DW_OP (abs, DW_OP_abs) \
+ DWARF_ONE_KNOWN_DW_OP (addr, DW_OP_addr) \
+ DWARF_ONE_KNOWN_DW_OP (and, DW_OP_and) \
+ DWARF_ONE_KNOWN_DW_OP (bit_piece, DW_OP_bit_piece) \
+ DWARF_ONE_KNOWN_DW_OP (bra, DW_OP_bra) \
+ DWARF_ONE_KNOWN_DW_OP (breg0, DW_OP_breg0) \
+ DWARF_ONE_KNOWN_DW_OP (breg1, DW_OP_breg1) \
+ DWARF_ONE_KNOWN_DW_OP (breg10, DW_OP_breg10) \
+ DWARF_ONE_KNOWN_DW_OP (breg11, DW_OP_breg11) \
+ DWARF_ONE_KNOWN_DW_OP (breg12, DW_OP_breg12) \
+ DWARF_ONE_KNOWN_DW_OP (breg13, DW_OP_breg13) \
+ DWARF_ONE_KNOWN_DW_OP (breg14, DW_OP_breg14) \
+ DWARF_ONE_KNOWN_DW_OP (breg15, DW_OP_breg15) \
+ DWARF_ONE_KNOWN_DW_OP (breg16, DW_OP_breg16) \
+ DWARF_ONE_KNOWN_DW_OP (breg17, DW_OP_breg17) \
+ DWARF_ONE_KNOWN_DW_OP (breg18, DW_OP_breg18) \
+ DWARF_ONE_KNOWN_DW_OP (breg19, DW_OP_breg19) \
+ DWARF_ONE_KNOWN_DW_OP (breg2, DW_OP_breg2) \
+ DWARF_ONE_KNOWN_DW_OP (breg20, DW_OP_breg20) \
+ DWARF_ONE_KNOWN_DW_OP (breg21, DW_OP_breg21) \
+ DWARF_ONE_KNOWN_DW_OP (breg22, DW_OP_breg22) \
+ DWARF_ONE_KNOWN_DW_OP (breg23, DW_OP_breg23) \
+ DWARF_ONE_KNOWN_DW_OP (breg24, DW_OP_breg24) \
+ DWARF_ONE_KNOWN_DW_OP (breg25, DW_OP_breg25) \
+ DWARF_ONE_KNOWN_DW_OP (breg26, DW_OP_breg26) \
+ DWARF_ONE_KNOWN_DW_OP (breg27, DW_OP_breg27) \
+ DWARF_ONE_KNOWN_DW_OP (breg28, DW_OP_breg28) \
+ DWARF_ONE_KNOWN_DW_OP (breg29, DW_OP_breg29) \
+ DWARF_ONE_KNOWN_DW_OP (breg3, DW_OP_breg3) \
+ DWARF_ONE_KNOWN_DW_OP (breg30, DW_OP_breg30) \
+ DWARF_ONE_KNOWN_DW_OP (breg31, DW_OP_breg31) \
+ DWARF_ONE_KNOWN_DW_OP (breg4, DW_OP_breg4) \
+ DWARF_ONE_KNOWN_DW_OP (breg5, DW_OP_breg5) \
+ DWARF_ONE_KNOWN_DW_OP (breg6, DW_OP_breg6) \
+ DWARF_ONE_KNOWN_DW_OP (breg7, DW_OP_breg7) \
+ DWARF_ONE_KNOWN_DW_OP (breg8, DW_OP_breg8) \
+ DWARF_ONE_KNOWN_DW_OP (breg9, DW_OP_breg9) \
+ DWARF_ONE_KNOWN_DW_OP (bregx, DW_OP_bregx) \
+ DWARF_ONE_KNOWN_DW_OP (call2, DW_OP_call2) \
+ DWARF_ONE_KNOWN_DW_OP (call4, DW_OP_call4) \
+ DWARF_ONE_KNOWN_DW_OP (call_frame_cfa, DW_OP_call_frame_cfa) \
+ DWARF_ONE_KNOWN_DW_OP (call_ref, DW_OP_call_ref) \
+ DWARF_ONE_KNOWN_DW_OP (const1s, DW_OP_const1s) \
+ DWARF_ONE_KNOWN_DW_OP (const1u, DW_OP_const1u) \
+ DWARF_ONE_KNOWN_DW_OP (const2s, DW_OP_const2s) \
+ DWARF_ONE_KNOWN_DW_OP (const2u, DW_OP_const2u) \
+ DWARF_ONE_KNOWN_DW_OP (const4s, DW_OP_const4s) \
+ DWARF_ONE_KNOWN_DW_OP (const4u, DW_OP_const4u) \
+ DWARF_ONE_KNOWN_DW_OP (const8s, DW_OP_const8s) \
+ DWARF_ONE_KNOWN_DW_OP (const8u, DW_OP_const8u) \
+ DWARF_ONE_KNOWN_DW_OP (consts, DW_OP_consts) \
+ DWARF_ONE_KNOWN_DW_OP (constu, DW_OP_constu) \
+ DWARF_ONE_KNOWN_DW_OP (deref, DW_OP_deref) \
+ DWARF_ONE_KNOWN_DW_OP (deref_size, DW_OP_deref_size) \
+ DWARF_ONE_KNOWN_DW_OP (div, DW_OP_div) \
+ DWARF_ONE_KNOWN_DW_OP (drop, DW_OP_drop) \
+ DWARF_ONE_KNOWN_DW_OP (dup, DW_OP_dup) \
+ DWARF_ONE_KNOWN_DW_OP (eq, DW_OP_eq) \
+ DWARF_ONE_KNOWN_DW_OP (fbreg, DW_OP_fbreg) \
+ DWARF_ONE_KNOWN_DW_OP (form_tls_address, DW_OP_form_tls_address) \
+ DWARF_ONE_KNOWN_DW_OP (ge, DW_OP_ge) \
+ DWARF_ONE_KNOWN_DW_OP (gt, DW_OP_gt) \
+ DWARF_ONE_KNOWN_DW_OP (implicit_value, DW_OP_implicit_value) \
+ DWARF_ONE_KNOWN_DW_OP (le, DW_OP_le) \
+ DWARF_ONE_KNOWN_DW_OP (lit0, DW_OP_lit0) \
+ DWARF_ONE_KNOWN_DW_OP (lit1, DW_OP_lit1) \
+ DWARF_ONE_KNOWN_DW_OP (lit10, DW_OP_lit10) \
+ DWARF_ONE_KNOWN_DW_OP (lit11, DW_OP_lit11) \
+ DWARF_ONE_KNOWN_DW_OP (lit12, DW_OP_lit12) \
+ DWARF_ONE_KNOWN_DW_OP (lit13, DW_OP_lit13) \
+ DWARF_ONE_KNOWN_DW_OP (lit14, DW_OP_lit14) \
+ DWARF_ONE_KNOWN_DW_OP (lit15, DW_OP_lit15) \
+ DWARF_ONE_KNOWN_DW_OP (lit16, DW_OP_lit16) \
+ DWARF_ONE_KNOWN_DW_OP (lit17, DW_OP_lit17) \
+ DWARF_ONE_KNOWN_DW_OP (lit18, DW_OP_lit18) \
+ DWARF_ONE_KNOWN_DW_OP (lit19, DW_OP_lit19) \
+ DWARF_ONE_KNOWN_DW_OP (lit2, DW_OP_lit2) \
+ DWARF_ONE_KNOWN_DW_OP (lit20, DW_OP_lit20) \
+ DWARF_ONE_KNOWN_DW_OP (lit21, DW_OP_lit21) \
+ DWARF_ONE_KNOWN_DW_OP (lit22, DW_OP_lit22) \
+ DWARF_ONE_KNOWN_DW_OP (lit23, DW_OP_lit23) \
+ DWARF_ONE_KNOWN_DW_OP (lit24, DW_OP_lit24) \
+ DWARF_ONE_KNOWN_DW_OP (lit25, DW_OP_lit25) \
+ DWARF_ONE_KNOWN_DW_OP (lit26, DW_OP_lit26) \
+ DWARF_ONE_KNOWN_DW_OP (lit27, DW_OP_lit27) \
+ DWARF_ONE_KNOWN_DW_OP (lit28, DW_OP_lit28) \
+ DWARF_ONE_KNOWN_DW_OP (lit29, DW_OP_lit29) \
+ DWARF_ONE_KNOWN_DW_OP (lit3, DW_OP_lit3) \
+ DWARF_ONE_KNOWN_DW_OP (lit30, DW_OP_lit30) \
+ DWARF_ONE_KNOWN_DW_OP (lit31, DW_OP_lit31) \
+ DWARF_ONE_KNOWN_DW_OP (lit4, DW_OP_lit4) \
+ DWARF_ONE_KNOWN_DW_OP (lit5, DW_OP_lit5) \
+ DWARF_ONE_KNOWN_DW_OP (lit6, DW_OP_lit6) \
+ DWARF_ONE_KNOWN_DW_OP (lit7, DW_OP_lit7) \
+ DWARF_ONE_KNOWN_DW_OP (lit8, DW_OP_lit8) \
+ DWARF_ONE_KNOWN_DW_OP (lit9, DW_OP_lit9) \
+ DWARF_ONE_KNOWN_DW_OP (lt, DW_OP_lt) \
+ DWARF_ONE_KNOWN_DW_OP (minus, DW_OP_minus) \
+ DWARF_ONE_KNOWN_DW_OP (mod, DW_OP_mod) \
+ DWARF_ONE_KNOWN_DW_OP (mul, DW_OP_mul) \
+ DWARF_ONE_KNOWN_DW_OP (ne, DW_OP_ne) \
+ DWARF_ONE_KNOWN_DW_OP (neg, DW_OP_neg) \
+ DWARF_ONE_KNOWN_DW_OP (nop, DW_OP_nop) \
+ DWARF_ONE_KNOWN_DW_OP (not, DW_OP_not) \
+ DWARF_ONE_KNOWN_DW_OP (or, DW_OP_or) \
+ DWARF_ONE_KNOWN_DW_OP (over, DW_OP_over) \
+ DWARF_ONE_KNOWN_DW_OP (pick, DW_OP_pick) \
+ DWARF_ONE_KNOWN_DW_OP (piece, DW_OP_piece) \
+ DWARF_ONE_KNOWN_DW_OP (plus, DW_OP_plus) \
+ DWARF_ONE_KNOWN_DW_OP (plus_uconst, DW_OP_plus_uconst) \
+ DWARF_ONE_KNOWN_DW_OP (push_object_address, DW_OP_push_object_address) \
+ DWARF_ONE_KNOWN_DW_OP (reg0, DW_OP_reg0) \
+ DWARF_ONE_KNOWN_DW_OP (reg1, DW_OP_reg1) \
+ DWARF_ONE_KNOWN_DW_OP (reg10, DW_OP_reg10) \
+ DWARF_ONE_KNOWN_DW_OP (reg11, DW_OP_reg11) \
+ DWARF_ONE_KNOWN_DW_OP (reg12, DW_OP_reg12) \
+ DWARF_ONE_KNOWN_DW_OP (reg13, DW_OP_reg13) \
+ DWARF_ONE_KNOWN_DW_OP (reg14, DW_OP_reg14) \
+ DWARF_ONE_KNOWN_DW_OP (reg15, DW_OP_reg15) \
+ DWARF_ONE_KNOWN_DW_OP (reg16, DW_OP_reg16) \
+ DWARF_ONE_KNOWN_DW_OP (reg17, DW_OP_reg17) \
+ DWARF_ONE_KNOWN_DW_OP (reg18, DW_OP_reg18) \
+ DWARF_ONE_KNOWN_DW_OP (reg19, DW_OP_reg19) \
+ DWARF_ONE_KNOWN_DW_OP (reg2, DW_OP_reg2) \
+ DWARF_ONE_KNOWN_DW_OP (reg20, DW_OP_reg20) \
+ DWARF_ONE_KNOWN_DW_OP (reg21, DW_OP_reg21) \
+ DWARF_ONE_KNOWN_DW_OP (reg22, DW_OP_reg22) \
+ DWARF_ONE_KNOWN_DW_OP (reg23, DW_OP_reg23) \
+ DWARF_ONE_KNOWN_DW_OP (reg24, DW_OP_reg24) \
+ DWARF_ONE_KNOWN_DW_OP (reg25, DW_OP_reg25) \
+ DWARF_ONE_KNOWN_DW_OP (reg26, DW_OP_reg26) \
+ DWARF_ONE_KNOWN_DW_OP (reg27, DW_OP_reg27) \
+ DWARF_ONE_KNOWN_DW_OP (reg28, DW_OP_reg28) \
+ DWARF_ONE_KNOWN_DW_OP (reg29, DW_OP_reg29) \
+ DWARF_ONE_KNOWN_DW_OP (reg3, DW_OP_reg3) \
+ DWARF_ONE_KNOWN_DW_OP (reg30, DW_OP_reg30) \
+ DWARF_ONE_KNOWN_DW_OP (reg31, DW_OP_reg31) \
+ DWARF_ONE_KNOWN_DW_OP (reg4, DW_OP_reg4) \
+ DWARF_ONE_KNOWN_DW_OP (reg5, DW_OP_reg5) \
+ DWARF_ONE_KNOWN_DW_OP (reg6, DW_OP_reg6) \
+ DWARF_ONE_KNOWN_DW_OP (reg7, DW_OP_reg7) \
+ DWARF_ONE_KNOWN_DW_OP (reg8, DW_OP_reg8) \
+ DWARF_ONE_KNOWN_DW_OP (reg9, DW_OP_reg9) \
+ DWARF_ONE_KNOWN_DW_OP (regx, DW_OP_regx) \
+ DWARF_ONE_KNOWN_DW_OP (rot, DW_OP_rot) \
+ DWARF_ONE_KNOWN_DW_OP (shl, DW_OP_shl) \
+ DWARF_ONE_KNOWN_DW_OP (shr, DW_OP_shr) \
+ DWARF_ONE_KNOWN_DW_OP (shra, DW_OP_shra) \
+ DWARF_ONE_KNOWN_DW_OP (skip, DW_OP_skip) \
+ DWARF_ONE_KNOWN_DW_OP (stack_value, DW_OP_stack_value) \
+ DWARF_ONE_KNOWN_DW_OP (swap, DW_OP_swap) \
+ DWARF_ONE_KNOWN_DW_OP (xderef, DW_OP_xderef) \
+ DWARF_ONE_KNOWN_DW_OP (xderef_size, DW_OP_xderef_size) \
+ DWARF_ONE_KNOWN_DW_OP (xor, DW_OP_xor) \
/* End of DW_OP_*. */
-#define ALL_KNOWN_DW_ORD \
- ONE_KNOWN_DW_ORD (col_major, DW_ORD_col_major) \
- ONE_KNOWN_DW_ORD (row_major, DW_ORD_row_major) \
+#define DWARF_ALL_KNOWN_DW_ORD \
+ DWARF_ONE_KNOWN_DW_ORD (col_major, DW_ORD_col_major) \
+ DWARF_ONE_KNOWN_DW_ORD (row_major, DW_ORD_row_major) \
/* End of DW_ORD_*. */
-#define ALL_KNOWN_DW_TAG \
- ONE_KNOWN_DW_TAG (GNU_BINCL, DW_TAG_GNU_BINCL) \
- ONE_KNOWN_DW_TAG (GNU_EINCL, DW_TAG_GNU_EINCL) \
- ONE_KNOWN_DW_TAG (GNU_call_site, DW_TAG_GNU_call_site) \
- ONE_KNOWN_DW_TAG (GNU_call_site_parameter, DW_TAG_GNU_call_site_parameter) \
- ONE_KNOWN_DW_TAG (GNU_formal_parameter_pack, DW_TAG_GNU_formal_parameter_pack) \
- ONE_KNOWN_DW_TAG (GNU_template_parameter_pack, DW_TAG_GNU_template_parameter_pack) \
- ONE_KNOWN_DW_TAG (GNU_template_template_param, DW_TAG_GNU_template_template_param) \
- ONE_KNOWN_DW_TAG (MIPS_loop, DW_TAG_MIPS_loop) \
- ONE_KNOWN_DW_TAG (access_declaration, DW_TAG_access_declaration) \
- ONE_KNOWN_DW_TAG (array_type, DW_TAG_array_type) \
- ONE_KNOWN_DW_TAG (base_type, DW_TAG_base_type) \
- ONE_KNOWN_DW_TAG (catch_block, DW_TAG_catch_block) \
- ONE_KNOWN_DW_TAG (class_template, DW_TAG_class_template) \
- ONE_KNOWN_DW_TAG (class_type, DW_TAG_class_type) \
- ONE_KNOWN_DW_TAG (common_block, DW_TAG_common_block) \
- ONE_KNOWN_DW_TAG (common_inclusion, DW_TAG_common_inclusion) \
- ONE_KNOWN_DW_TAG (compile_unit, DW_TAG_compile_unit) \
- ONE_KNOWN_DW_TAG (condition, DW_TAG_condition) \
- ONE_KNOWN_DW_TAG (const_type, DW_TAG_const_type) \
- ONE_KNOWN_DW_TAG (constant, DW_TAG_constant) \
- ONE_KNOWN_DW_TAG (dwarf_procedure, DW_TAG_dwarf_procedure) \
- ONE_KNOWN_DW_TAG (entry_point, DW_TAG_entry_point) \
- ONE_KNOWN_DW_TAG (enumeration_type, DW_TAG_enumeration_type) \
- ONE_KNOWN_DW_TAG (enumerator, DW_TAG_enumerator) \
- ONE_KNOWN_DW_TAG (file_type, DW_TAG_file_type) \
- ONE_KNOWN_DW_TAG (formal_parameter, DW_TAG_formal_parameter) \
- ONE_KNOWN_DW_TAG (format_label, DW_TAG_format_label) \
- ONE_KNOWN_DW_TAG (friend, DW_TAG_friend) \
- ONE_KNOWN_DW_TAG (function_template, DW_TAG_function_template) \
- ONE_KNOWN_DW_TAG (imported_declaration, DW_TAG_imported_declaration) \
- ONE_KNOWN_DW_TAG (imported_module, DW_TAG_imported_module) \
- ONE_KNOWN_DW_TAG (imported_unit, DW_TAG_imported_unit) \
- ONE_KNOWN_DW_TAG (inheritance, DW_TAG_inheritance) \
- ONE_KNOWN_DW_TAG (inlined_subroutine, DW_TAG_inlined_subroutine) \
- ONE_KNOWN_DW_TAG (interface_type, DW_TAG_interface_type) \
- ONE_KNOWN_DW_TAG (label, DW_TAG_label) \
- ONE_KNOWN_DW_TAG (lexical_block, DW_TAG_lexical_block) \
- ONE_KNOWN_DW_TAG (member, DW_TAG_member) \
- ONE_KNOWN_DW_TAG (module, DW_TAG_module) \
- ONE_KNOWN_DW_TAG (namelist, DW_TAG_namelist) \
- ONE_KNOWN_DW_TAG (namelist_item, DW_TAG_namelist_item) \
- ONE_KNOWN_DW_TAG (namespace, DW_TAG_namespace) \
- ONE_KNOWN_DW_TAG (packed_type, DW_TAG_packed_type) \
- ONE_KNOWN_DW_TAG (partial_unit, DW_TAG_partial_unit) \
- ONE_KNOWN_DW_TAG (pointer_type, DW_TAG_pointer_type) \
- ONE_KNOWN_DW_TAG (ptr_to_member_type, DW_TAG_ptr_to_member_type) \
- ONE_KNOWN_DW_TAG (reference_type, DW_TAG_reference_type) \
- ONE_KNOWN_DW_TAG (restrict_type, DW_TAG_restrict_type) \
- ONE_KNOWN_DW_TAG (rvalue_reference_type, DW_TAG_rvalue_reference_type) \
- ONE_KNOWN_DW_TAG (set_type, DW_TAG_set_type) \
- ONE_KNOWN_DW_TAG (shared_type, DW_TAG_shared_type) \
- ONE_KNOWN_DW_TAG (string_type, DW_TAG_string_type) \
- ONE_KNOWN_DW_TAG (structure_type, DW_TAG_structure_type) \
- ONE_KNOWN_DW_TAG (subprogram, DW_TAG_subprogram) \
- ONE_KNOWN_DW_TAG (subrange_type, DW_TAG_subrange_type) \
- ONE_KNOWN_DW_TAG (subroutine_type, DW_TAG_subroutine_type) \
- ONE_KNOWN_DW_TAG (template_alias, DW_TAG_template_alias) \
- ONE_KNOWN_DW_TAG (template_type_parameter, DW_TAG_template_type_parameter) \
- ONE_KNOWN_DW_TAG (template_value_parameter, DW_TAG_template_value_parameter) \
- ONE_KNOWN_DW_TAG (thrown_type, DW_TAG_thrown_type) \
- ONE_KNOWN_DW_TAG (try_block, DW_TAG_try_block) \
- ONE_KNOWN_DW_TAG (type_unit, DW_TAG_type_unit) \
- ONE_KNOWN_DW_TAG (typedef, DW_TAG_typedef) \
- ONE_KNOWN_DW_TAG (union_type, DW_TAG_union_type) \
- ONE_KNOWN_DW_TAG (unspecified_parameters, DW_TAG_unspecified_parameters) \
- ONE_KNOWN_DW_TAG (unspecified_type, DW_TAG_unspecified_type) \
- ONE_KNOWN_DW_TAG (variable, DW_TAG_variable) \
- ONE_KNOWN_DW_TAG (variant, DW_TAG_variant) \
- ONE_KNOWN_DW_TAG (variant_part, DW_TAG_variant_part) \
- ONE_KNOWN_DW_TAG (volatile_type, DW_TAG_volatile_type) \
- ONE_KNOWN_DW_TAG (with_stmt, DW_TAG_with_stmt) \
+#define DWARF_ALL_KNOWN_DW_TAG \
+ DWARF_ONE_KNOWN_DW_TAG (GNU_BINCL, DW_TAG_GNU_BINCL) \
+ DWARF_ONE_KNOWN_DW_TAG (GNU_EINCL, DW_TAG_GNU_EINCL) \
+ DWARF_ONE_KNOWN_DW_TAG (GNU_call_site, DW_TAG_GNU_call_site) \
+ DWARF_ONE_KNOWN_DW_TAG (GNU_call_site_parameter, DW_TAG_GNU_call_site_parameter) \
+ DWARF_ONE_KNOWN_DW_TAG (GNU_formal_parameter_pack, DW_TAG_GNU_formal_parameter_pack) \
+ DWARF_ONE_KNOWN_DW_TAG (GNU_template_parameter_pack, DW_TAG_GNU_template_parameter_pack) \
+ DWARF_ONE_KNOWN_DW_TAG (GNU_template_template_param, DW_TAG_GNU_template_template_param) \
+ DWARF_ONE_KNOWN_DW_TAG (MIPS_loop, DW_TAG_MIPS_loop) \
+ DWARF_ONE_KNOWN_DW_TAG (access_declaration, DW_TAG_access_declaration) \
+ DWARF_ONE_KNOWN_DW_TAG (array_type, DW_TAG_array_type) \
+ DWARF_ONE_KNOWN_DW_TAG (atomic_type, DW_TAG_atomic_type) \
+ DWARF_ONE_KNOWN_DW_TAG (base_type, DW_TAG_base_type) \
+ DWARF_ONE_KNOWN_DW_TAG (catch_block, DW_TAG_catch_block) \
+ DWARF_ONE_KNOWN_DW_TAG (class_template, DW_TAG_class_template) \
+ DWARF_ONE_KNOWN_DW_TAG (class_type, DW_TAG_class_type) \
+ DWARF_ONE_KNOWN_DW_TAG (common_block, DW_TAG_common_block) \
+ DWARF_ONE_KNOWN_DW_TAG (common_inclusion, DW_TAG_common_inclusion) \
+ DWARF_ONE_KNOWN_DW_TAG (compile_unit, DW_TAG_compile_unit) \
+ DWARF_ONE_KNOWN_DW_TAG (condition, DW_TAG_condition) \
+ DWARF_ONE_KNOWN_DW_TAG (const_type, DW_TAG_const_type) \
+ DWARF_ONE_KNOWN_DW_TAG (constant, DW_TAG_constant) \
+ DWARF_ONE_KNOWN_DW_TAG (dwarf_procedure, DW_TAG_dwarf_procedure) \
+ DWARF_ONE_KNOWN_DW_TAG (entry_point, DW_TAG_entry_point) \
+ DWARF_ONE_KNOWN_DW_TAG (enumeration_type, DW_TAG_enumeration_type) \
+ DWARF_ONE_KNOWN_DW_TAG (enumerator, DW_TAG_enumerator) \
+ DWARF_ONE_KNOWN_DW_TAG (file_type, DW_TAG_file_type) \
+ DWARF_ONE_KNOWN_DW_TAG (formal_parameter, DW_TAG_formal_parameter) \
+ DWARF_ONE_KNOWN_DW_TAG (format_label, DW_TAG_format_label) \
+ DWARF_ONE_KNOWN_DW_TAG (friend, DW_TAG_friend) \
+ DWARF_ONE_KNOWN_DW_TAG (function_template, DW_TAG_function_template) \
+ DWARF_ONE_KNOWN_DW_TAG (imported_declaration, DW_TAG_imported_declaration) \
+ DWARF_ONE_KNOWN_DW_TAG (imported_module, DW_TAG_imported_module) \
+ DWARF_ONE_KNOWN_DW_TAG (imported_unit, DW_TAG_imported_unit) \
+ DWARF_ONE_KNOWN_DW_TAG (inheritance, DW_TAG_inheritance) \
+ DWARF_ONE_KNOWN_DW_TAG (inlined_subroutine, DW_TAG_inlined_subroutine) \
+ DWARF_ONE_KNOWN_DW_TAG (interface_type, DW_TAG_interface_type) \
+ DWARF_ONE_KNOWN_DW_TAG (label, DW_TAG_label) \
+ DWARF_ONE_KNOWN_DW_TAG (lexical_block, DW_TAG_lexical_block) \
+ DWARF_ONE_KNOWN_DW_TAG (member, DW_TAG_member) \
+ DWARF_ONE_KNOWN_DW_TAG (module, DW_TAG_module) \
+ DWARF_ONE_KNOWN_DW_TAG (namelist, DW_TAG_namelist) \
+ DWARF_ONE_KNOWN_DW_TAG (namelist_item, DW_TAG_namelist_item) \
+ DWARF_ONE_KNOWN_DW_TAG (namespace, DW_TAG_namespace) \
+ DWARF_ONE_KNOWN_DW_TAG (packed_type, DW_TAG_packed_type) \
+ DWARF_ONE_KNOWN_DW_TAG (partial_unit, DW_TAG_partial_unit) \
+ DWARF_ONE_KNOWN_DW_TAG (pointer_type, DW_TAG_pointer_type) \
+ DWARF_ONE_KNOWN_DW_TAG (ptr_to_member_type, DW_TAG_ptr_to_member_type) \
+ DWARF_ONE_KNOWN_DW_TAG (reference_type, DW_TAG_reference_type) \
+ DWARF_ONE_KNOWN_DW_TAG (restrict_type, DW_TAG_restrict_type) \
+ DWARF_ONE_KNOWN_DW_TAG (rvalue_reference_type, DW_TAG_rvalue_reference_type) \
+ DWARF_ONE_KNOWN_DW_TAG (set_type, DW_TAG_set_type) \
+ DWARF_ONE_KNOWN_DW_TAG (shared_type, DW_TAG_shared_type) \
+ DWARF_ONE_KNOWN_DW_TAG (string_type, DW_TAG_string_type) \
+ DWARF_ONE_KNOWN_DW_TAG (structure_type, DW_TAG_structure_type) \
+ DWARF_ONE_KNOWN_DW_TAG (subprogram, DW_TAG_subprogram) \
+ DWARF_ONE_KNOWN_DW_TAG (subrange_type, DW_TAG_subrange_type) \
+ DWARF_ONE_KNOWN_DW_TAG (subroutine_type, DW_TAG_subroutine_type) \
+ DWARF_ONE_KNOWN_DW_TAG (template_alias, DW_TAG_template_alias) \
+ DWARF_ONE_KNOWN_DW_TAG (template_type_parameter, DW_TAG_template_type_parameter) \
+ DWARF_ONE_KNOWN_DW_TAG (template_value_parameter, DW_TAG_template_value_parameter) \
+ DWARF_ONE_KNOWN_DW_TAG (thrown_type, DW_TAG_thrown_type) \
+ DWARF_ONE_KNOWN_DW_TAG (try_block, DW_TAG_try_block) \
+ DWARF_ONE_KNOWN_DW_TAG (type_unit, DW_TAG_type_unit) \
+ DWARF_ONE_KNOWN_DW_TAG (typedef, DW_TAG_typedef) \
+ DWARF_ONE_KNOWN_DW_TAG (union_type, DW_TAG_union_type) \
+ DWARF_ONE_KNOWN_DW_TAG (unspecified_parameters, DW_TAG_unspecified_parameters) \
+ DWARF_ONE_KNOWN_DW_TAG (unspecified_type, DW_TAG_unspecified_type) \
+ DWARF_ONE_KNOWN_DW_TAG (variable, DW_TAG_variable) \
+ DWARF_ONE_KNOWN_DW_TAG (variant, DW_TAG_variant) \
+ DWARF_ONE_KNOWN_DW_TAG (variant_part, DW_TAG_variant_part) \
+ DWARF_ONE_KNOWN_DW_TAG (volatile_type, DW_TAG_volatile_type) \
+ DWARF_ONE_KNOWN_DW_TAG (with_stmt, DW_TAG_with_stmt) \
/* End of DW_TAG_*. */
-#define ALL_KNOWN_DW_VIRTUALITY \
- ONE_KNOWN_DW_VIRTUALITY (none, DW_VIRTUALITY_none) \
- ONE_KNOWN_DW_VIRTUALITY (pure_virtual, DW_VIRTUALITY_pure_virtual) \
- ONE_KNOWN_DW_VIRTUALITY (virtual, DW_VIRTUALITY_virtual) \
+#define DWARF_ALL_KNOWN_DW_VIRTUALITY \
+ DWARF_ONE_KNOWN_DW_VIRTUALITY (none, DW_VIRTUALITY_none) \
+ DWARF_ONE_KNOWN_DW_VIRTUALITY (pure_virtual, DW_VIRTUALITY_pure_virtual) \
+ DWARF_ONE_KNOWN_DW_VIRTUALITY (virtual, DW_VIRTUALITY_virtual) \
/* End of DW_VIRTUALITY_*. */
-#define ALL_KNOWN_DW_VIS \
- ONE_KNOWN_DW_VIS (exported, DW_VIS_exported) \
- ONE_KNOWN_DW_VIS (local, DW_VIS_local) \
- ONE_KNOWN_DW_VIS (qualified, DW_VIS_qualified) \
+#define DWARF_ALL_KNOWN_DW_VIS \
+ DWARF_ONE_KNOWN_DW_VIS (exported, DW_VIS_exported) \
+ DWARF_ONE_KNOWN_DW_VIS (local, DW_VIS_local) \
+ DWARF_ONE_KNOWN_DW_VIS (qualified, DW_VIS_qualified) \
/* End of DW_VIS_*. */
diff --git a/3rdparty/elfutils/libdw/libdw.h b/3rdparty/elfutils/libdw/libdw.h
index b2b2282..473e1a2 100644
--- a/3rdparty/elfutils/libdw/libdw.h
+++ b/3rdparty/elfutils/libdw/libdw.h
@@ -409,7 +409,8 @@ extern int dwarf_siblingof (Dwarf_Die *die, Dwarf_Die *result)
The current DWARF specification defines one type alias tag
(DW_TAG_typedef) and three qualifier type tags (DW_TAG_const_type,
- DW_TAG_volatile_type, DW_TAG_restrict_type). A future version of
+ DW_TAG_volatile_type, DW_TAG_restrict_type). DWARF5 defines one
+ other qualifier type tag (DW_TAG_atomic_type). A future version of
this function might peel other alias or qualifier type tags if a
future DWARF version or GNU extension defines other type aliases or
qualifier type tags that don't modify or change the structural
diff --git a/3rdparty/elfutils/libdw/libdwP.h b/3rdparty/elfutils/libdw/libdwP.h
index 5ab7219..2d233f6 100644
--- a/3rdparty/elfutils/libdw/libdwP.h
+++ b/3rdparty/elfutils/libdw/libdwP.h
@@ -1,5 +1,5 @@
/* Internal definitions for libdwarf.
- Copyright (C) 2002-2011, 2013, 2014 Red Hat, Inc.
+ Copyright (C) 2002-2011, 2013-2015 Red Hat, Inc.
This file is part of elfutils.
Written by Ulrich Drepper <drepper@redhat.com>, 2002.
@@ -97,6 +97,7 @@ enum
DWARF_E_IO_ERROR,
DWARF_E_INVALID_ELF,
DWARF_E_NO_DWARF,
+ DWARF_E_COMPRESSED_ERROR,
DWARF_E_NOELF,
DWARF_E_GETEHDR_ERROR,
DWARF_E_NOMEM,
@@ -128,6 +129,7 @@ enum
DWARF_E_INVALID_CFI,
DWARF_E_NO_ALT_DEBUGLINK,
DWARF_E_INVALID_OPCODE,
+ DWARF_E_NOT_CUDIE,
};
@@ -555,6 +557,7 @@ struct Dwarf_Die_Chain
};
extern int __libdw_visit_scopes (unsigned int depth,
struct Dwarf_Die_Chain *root,
+ struct Dwarf_Die_Chain *imports,
int (*previsit) (unsigned int depth,
struct Dwarf_Die_Chain *,
void *arg),
@@ -562,7 +565,7 @@ extern int __libdw_visit_scopes (unsigned int depth,
struct Dwarf_Die_Chain *,
void *arg),
void *arg)
- __nonnull_attribute__ (2, 3) internal_function;
+ __nonnull_attribute__ (2, 4) internal_function;
/* Parse a DWARF Dwarf_Block into an array of Dwarf_Op's,
and cache the result (via tsearch). */
@@ -724,6 +727,12 @@ cu_sec_idx (struct Dwarf_CU *cu)
return cu->type_offset == 0 ? IDX_debug_info : IDX_debug_types;
}
+static inline bool
+is_cudie (Dwarf_Die *cudie)
+{
+ return CUDIE (cudie->cu).addr == cudie->addr;
+}
+
/* Read up begin/end pair and increment read pointer.
- If it's normal range record, set up *BEGINP and *ENDP and return 0.
- If it's base address selection record, set up *BASEP and return 1.
diff --git a/3rdparty/elfutils/libdw/libdw_visit_scopes.c b/3rdparty/elfutils/libdw/libdw_visit_scopes.c
index 487375d..ac7e853 100644
--- a/3rdparty/elfutils/libdw/libdw_visit_scopes.c
+++ b/3rdparty/elfutils/libdw/libdw_visit_scopes.c
@@ -1,5 +1,5 @@
/* Helper functions to descend DWARF scope trees.
- Copyright (C) 2005,2006,2007 Red Hat, Inc.
+ Copyright (C) 2005,2006,2007,2015 Red Hat, Inc.
This file is part of elfutils.
This file is free software; you can redistribute it and/or modify
@@ -65,9 +65,10 @@ may_have_scopes (Dwarf_Die *die)
}
int
-__libdw_visit_scopes (depth, root, previsit, postvisit, arg)
+__libdw_visit_scopes (depth, root, imports, previsit, postvisit, arg)
unsigned int depth;
struct Dwarf_Die_Chain *root;
+ struct Dwarf_Die_Chain *imports;
int (*previsit) (unsigned int depth, struct Dwarf_Die_Chain *, void *);
int (*postvisit) (unsigned int depth, struct Dwarf_Die_Chain *, void *);
void *arg;
@@ -81,10 +82,21 @@ __libdw_visit_scopes (depth, root, previsit, postvisit, arg)
inline int recurse (void)
{
- return __libdw_visit_scopes (depth + 1, &child,
+ return __libdw_visit_scopes (depth + 1, &child, imports,
previsit, postvisit, arg);
}
+ /* Checks the given DIE hasn't been imported yet to prevent cycles. */
+ inline bool imports_contains (Dwarf_Die *die)
+ {
+ for (struct Dwarf_Die_Chain *import = imports; import != NULL;
+ import = import->parent)
+ if (import->die.addr == die->addr)
+ return true;
+
+ return false;
+ }
+
inline int walk_children ()
{
do
@@ -103,7 +115,17 @@ __libdw_visit_scopes (depth, root, previsit, postvisit, arg)
if (INTUSE(dwarf_formref_die) (attr, &child.die) != NULL
&& INTUSE(dwarf_child) (&child.die, &child.die) == 0)
{
+ if (imports_contains (&orig_child_die))
+ {
+ __libdw_seterrno (DWARF_E_INVALID_DWARF);
+ return -1;
+ }
+ struct Dwarf_Die_Chain *orig_imports = imports;
+ struct Dwarf_Die_Chain import = { .die = orig_child_die,
+ .parent = orig_imports };
+ imports = &import;
int result = walk_children ();
+ imports = orig_imports;
if (result != DWARF_CB_OK)
return result;
}
diff --git a/3rdparty/elfutils/libdw/memory-access.h b/3rdparty/elfutils/libdw/memory-access.h
index a53f791..a749b5a 100644
--- a/3rdparty/elfutils/libdw/memory-access.h
+++ b/3rdparty/elfutils/libdw/memory-access.h
@@ -40,13 +40,28 @@
#define len_leb128(var) ((8 * sizeof (var) + 6) / 7)
static inline size_t
-__libdw_max_len_leb128 (const unsigned char *addr, const unsigned char *end)
+__libdw_max_len_leb128 (const size_t type_len,
+ const unsigned char *addr, const unsigned char *end)
{
- const size_t type_len = len_leb128 (uint64_t);
const size_t pointer_len = likely (addr < end) ? end - addr : 0;
return likely (type_len <= pointer_len) ? type_len : pointer_len;
}
+static inline size_t
+__libdw_max_len_uleb128 (const unsigned char *addr, const unsigned char *end)
+{
+ const size_t type_len = len_leb128 (uint64_t);
+ return __libdw_max_len_leb128 (type_len, addr, end);
+}
+
+static inline size_t
+__libdw_max_len_sleb128 (const unsigned char *addr, const unsigned char *end)
+{
+ /* Subtract one step, so we don't shift into sign bit. */
+ const size_t type_len = len_leb128 (int64_t) - 1;
+ return __libdw_max_len_leb128 (type_len, addr, end);
+}
+
#define get_uleb128_step(var, addr, nth) \
do { \
unsigned char __b = *(addr)++; \
@@ -64,7 +79,7 @@ __libdw_get_uleb128 (const unsigned char **addrp, const unsigned char *end)
for the common single-byte case. */
get_uleb128_step (acc, *addrp, 0);
- const size_t max = __libdw_max_len_leb128 (*addrp - 1, end);
+ const size_t max = __libdw_max_len_uleb128 (*addrp - 1, end);
for (size_t i = 1; i < max; ++i)
get_uleb128_step (acc, *addrp, i);
/* Other implementations set VALUE to UINT_MAX in this
@@ -98,7 +113,7 @@ __libdw_get_sleb128 (const unsigned char **addrp, const unsigned char *end)
for the common single-byte case. */
get_sleb128_step (acc, *addrp, 0);
- const size_t max = __libdw_max_len_leb128 (*addrp - 1, end);
+ const size_t max = __libdw_max_len_sleb128 (*addrp - 1, end);
for (size_t i = 1; i < max; ++i)
get_sleb128_step (acc, *addrp, i);
/* Other implementations set VALUE to INT_MAX in this
diff --git a/3rdparty/elfutils/libdwfl/core-file.c b/3rdparty/elfutils/libdwfl/core-file.c
index 50031ae..bbe0899 100644
--- a/3rdparty/elfutils/libdwfl/core-file.c
+++ b/3rdparty/elfutils/libdwfl/core-file.c
@@ -1,5 +1,5 @@
/* Core file handling.
- Copyright (C) 2008-2010, 2013 Red Hat, Inc.
+ Copyright (C) 2008-2010, 2013, 2015 Red Hat, Inc.
This file is part of elfutils.
This file is free software; you can redistribute it and/or modify
@@ -161,6 +161,9 @@ dwfl_report_core_segments (Dwfl *dwfl, Elf *elf, size_t phnum, GElf_Phdr *notes)
/* Never read more than this much without mmap. */
#define MAX_EAGER_COST 8192
+/* Dwfl_Module_Callback passed to and called by dwfl_segment_report_module
+ to read in a segment as ELF image directly if possible or indicate an
+ attempt must be made to read in the while segment right now. */
static bool
core_file_read_eagerly (Dwfl_Module *mod,
void **userdata __attribute__ ((unused)),
@@ -174,6 +177,10 @@ core_file_read_eagerly (Dwfl_Module *mod,
{
Elf *core = arg;
+ /* The available buffer is often the whole segment when the core file
+ was mmap'd if used together with the dwfl_elf_phdr_memory_callback.
+ Which means that if it is complete we can just construct the whole
+ ELF image right now without having to read in anything more. */
if (whole <= *buffer_available)
{
/* All there ever was, we already have on hand. */
@@ -198,8 +205,9 @@ core_file_read_eagerly (Dwfl_Module *mod,
return *elfp != NULL;
}
- /* We don't have the whole file.
- Figure out if this is better than nothing. */
+ /* We don't have the whole file. Which either means the core file
+ wasn't mmap'd, but needs to still be read in, or that the segment
+ is truncated. Figure out if this is better than nothing. */
if (worthwhile == 0)
/* Caller doesn't think so. */
@@ -212,12 +220,16 @@ core_file_read_eagerly (Dwfl_Module *mod,
requires find_elf hook re-doing the magic to fall back if no file found
*/
- if (mod->build_id_len > 0)
- /* There is a build ID that could help us find the whole file,
- which might be more useful than what we have.
- We'll just rely on that. */
+ if (whole > MAX_EAGER_COST && mod->build_id_len > 0)
+ /* We can't cheaply read the whole file here, so we'd
+ be using a partial file. But there is a build ID that could
+ help us find the whole file, which might be more useful than
+ what we have. We'll just rely on that. */
return false;
+ /* The file is either small (most likely the vdso) or big and incomplete,
+ but we don't have a build-id. */
+
if (core->map_address != NULL)
/* It's cheap to get, so get it. */
return true;
@@ -576,7 +588,7 @@ dwfl_core_file_report (Dwfl *dwfl, Elf *elf, const char *executable)
INTDEF (dwfl_core_file_report)
NEW_VERSION (dwfl_core_file_report, ELFUTILS_0.158)
-#ifdef SHARED
+#ifdef SYMBOL_VERSIONING
int _compat_without_executable_dwfl_core_file_report (Dwfl *dwfl, Elf *elf);
COMPAT_VERSION_NEWPROTO (dwfl_core_file_report, ELFUTILS_0.146,
without_executable)
diff --git a/3rdparty/elfutils/libdwfl/cu.c b/3rdparty/elfutils/libdwfl/cu.c
index 5ce531b..5182054 100644
--- a/3rdparty/elfutils/libdwfl/cu.c
+++ b/3rdparty/elfutils/libdwfl/cu.c
@@ -1,5 +1,5 @@
/* Keeping track of DWARF compilation units in libdwfl.
- Copyright (C) 2005-2010 Red Hat, Inc.
+ Copyright (C) 2005-2010, 2015 Red Hat, Inc.
This file is part of elfutils.
This file is free software; you can redistribute it and/or modify
@@ -171,6 +171,29 @@ compare_cukey (const void *a, const void *b)
static Dwfl_Error
intern_cu (Dwfl_Module *mod, Dwarf_Off cuoff, struct dwfl_cu **result)
{
+ if (unlikely (cuoff + 4 >= mod->dw->sectiondata[IDX_debug_info]->d_size))
+ {
+ if (likely (mod->lazycu == 1))
+ {
+ /* This is the EOF marker. Now we have interned all the CUs.
+ One increment in MOD->lazycu counts not having hit EOF yet. */
+ *result = (void *) -1;
+ less_lazy (mod);
+ return DWFL_E_NOERROR;
+ }
+ else
+ {
+ /* Unexpected EOF, most likely a bogus aranges. */
+ return (DWFL_E (LIBDW, DWARF_E_INVALID_DWARF));
+ }
+ }
+
+ /* Make sure the cuoff points to a real DIE. */
+ Dwarf_Die cudie;
+ Dwarf_Die *die = INTUSE(dwarf_offdie) (mod->dw, cuoff, &cudie);
+ if (die == NULL)
+ return DWFL_E_LIBDW;
+
struct Dwarf_CU dwkey;
struct dwfl_cu key;
key.die.cu = &dwkey;
@@ -182,51 +205,33 @@ intern_cu (Dwfl_Module *mod, Dwarf_Off cuoff, struct dwfl_cu **result)
if (*found == &key || *found == NULL)
{
- if (unlikely (cuoff + 4 >= mod->dw->sectiondata[IDX_debug_info]->d_size))
- {
- /* This is the EOF marker. Now we have interned all the CUs.
- One increment in MOD->lazycu counts not having hit EOF yet. */
- *found = (void *) -1l;
- less_lazy (mod);
- }
- else
- {
- /* This is a new entry, meaning we haven't looked at this CU. */
-
- *found = NULL;
+ /* This is a new entry, meaning we haven't looked at this CU. */
- struct dwfl_cu *cu = malloc (sizeof *cu);
- if (unlikely (cu == NULL))
- return DWFL_E_NOMEM;
+ *found = NULL;
- cu->mod = mod;
- cu->next = NULL;
- cu->lines = NULL;
+ struct dwfl_cu *cu = malloc (sizeof *cu);
+ if (unlikely (cu == NULL))
+ return DWFL_E_NOMEM;
- /* XXX use non-searching lookup */
- Dwarf_Die *die = INTUSE(dwarf_offdie) (mod->dw, cuoff, &cu->die);
- if (die == NULL)
- {
- free (cu);
- return DWFL_E_LIBDW;
- }
- assert (die == &cu->die);
+ cu->mod = mod;
+ cu->next = NULL;
+ cu->lines = NULL;
+ cu->die = cudie;
- struct dwfl_cu **newvec = realloc (mod->cu, ((mod->ncu + 1)
- * sizeof (mod->cu[0])));
- if (newvec == NULL)
- {
- free (cu);
- return DWFL_E_NOMEM;
- }
- mod->cu = newvec;
+ struct dwfl_cu **newvec = realloc (mod->cu, ((mod->ncu + 1)
+ * sizeof (mod->cu[0])));
+ if (newvec == NULL)
+ {
+ free (cu);
+ return DWFL_E_NOMEM;
+ }
+ mod->cu = newvec;
- mod->cu[mod->ncu++] = cu;
- if (cu->die.cu->start == 0)
- mod->first_cu = cu;
+ mod->cu[mod->ncu++] = cu;
+ if (cu->die.cu->start == 0)
+ mod->first_cu = cu;
- *found = cu;
- }
+ *found = cu;
}
*result = *found;
@@ -275,7 +280,8 @@ __libdwfl_nextcu (Dwfl_Module *mod, struct dwfl_cu *lastcu,
if (result != DWFL_E_NOERROR)
return result;
- if ((*nextp)->next == NULL && nextoff == (Dwarf_Off) -1l)
+ if (*nextp != (void *) -1
+ && (*nextp)->next == NULL && nextoff == (Dwarf_Off) -1l)
(*nextp)->next = (void *) -1l;
}
diff --git a/3rdparty/elfutils/libdwfl/derelocate.c b/3rdparty/elfutils/libdwfl/derelocate.c
index da67908..439a24e 100644
--- a/3rdparty/elfutils/libdwfl/derelocate.c
+++ b/3rdparty/elfutils/libdwfl/derelocate.c
@@ -1,5 +1,5 @@
/* Recover relocatibility for addresses computed from debug information.
- Copyright (C) 2005-2010, 2013 Red Hat, Inc.
+ Copyright (C) 2005-2010, 2013, 2015 Red Hat, Inc.
This file is part of elfutils.
This file is free software; you can redistribute it and/or modify
@@ -80,7 +80,8 @@ cache_sections (Dwfl_Module *mod)
{
elf_error:
__libdwfl_seterrno (DWFL_E_LIBELF);
- return -1;
+ nrefs = -1;
+ goto free_refs;
}
bool check_reloc_sections = false;
@@ -112,7 +113,15 @@ cache_sections (Dwfl_Module *mod)
if (unlikely (name == NULL))
goto elf_error;
- struct secref *newref = alloca (sizeof *newref);
+ struct secref *newref = malloc (sizeof *newref);
+ if (unlikely (newref == NULL))
+ {
+ nomem:
+ __libdwfl_seterrno (DWFL_E_NOMEM);
+ nrefs = -1;
+ goto free_refs;
+ }
+
newref->scn = scn;
newref->relocs = NULL;
newref->name = name;
@@ -147,13 +156,13 @@ cache_sections (Dwfl_Module *mod)
}
mod->reloc_info = malloc (offsetof (struct dwfl_relocation, refs[nrefs]));
- if (mod->reloc_info == NULL)
- {
- __libdwfl_seterrno (DWFL_E_NOMEM);
- return -1;
- }
+ if (unlikely (mod->reloc_info == NULL))
+ goto nomem;
+
+ struct secref **sortrefs = malloc (nrefs * sizeof sortrefs[0]);
+ if (unlikely (sortrefs == NULL))
+ goto nomem;
- struct secref **sortrefs = alloca (nrefs * sizeof sortrefs[0]);
for (size_t i = nrefs; i-- > 0; refs = refs->next)
sortrefs[i] = refs;
assert (refs == NULL);
@@ -168,8 +177,11 @@ cache_sections (Dwfl_Module *mod)
mod->reloc_info->refs[i].relocs = sortrefs[i]->relocs;
mod->reloc_info->refs[i].start = sortrefs[i]->start;
mod->reloc_info->refs[i].end = sortrefs[i]->end;
+ free (sortrefs[i]);
}
+ free (sortrefs);
+
if (unlikely (check_reloc_sections))
{
/* There was a reloc section that preceded its target section.
@@ -199,6 +211,14 @@ cache_sections (Dwfl_Module *mod)
}
}
+free_refs:
+ while (refs != NULL)
+ {
+ struct secref *ref = refs;
+ refs = ref->next;
+ free (ref);
+ }
+
return nrefs;
}
@@ -266,6 +286,9 @@ dwfl_module_relocation_info (Dwfl_Module *mod, unsigned int idx,
static bool
check_module (Dwfl_Module *mod)
{
+ if (mod == NULL)
+ return true;
+
if (INTUSE(dwfl_module_getsymtab) (mod) < 0)
{
Dwfl_Error error = dwfl_errno ();
diff --git a/3rdparty/elfutils/libdwfl/dwfl_build_id_find_elf.c b/3rdparty/elfutils/libdwfl/dwfl_build_id_find_elf.c
index 062aad1..99a5059 100644
--- a/3rdparty/elfutils/libdwfl/dwfl_build_id_find_elf.c
+++ b/3rdparty/elfutils/libdwfl/dwfl_build_id_find_elf.c
@@ -1,5 +1,5 @@
/* Find an ELF file for a module from its build ID.
- Copyright (C) 2007-2010, 2014 Red Hat, Inc.
+ Copyright (C) 2007-2010, 2014, 2015 Red Hat, Inc.
This file is part of elfutils.
This file is free software; you can redistribute it and/or modify
@@ -37,9 +37,20 @@ internal_function
__libdwfl_open_by_build_id (Dwfl_Module *mod, bool debug, char **file_name,
const size_t id_len, const uint8_t *id)
{
+ /* We don't handle very short or really large build-ids. We need at
+ at least 3 and allow for up to 64 (normally ids are 20 long). */
+#define MIN_BUILD_ID_BYTES 3
+#define MAX_BUILD_ID_BYTES 64
+ if (id_len < MIN_BUILD_ID_BYTES || id_len > MAX_BUILD_ID_BYTES)
+ {
+ __libdwfl_seterrno (DWFL_E_WRONG_ID_ELF);
+ return -1;
+ }
+
/* Search debuginfo_path directories' .build-id/ subdirectories. */
- char id_name[sizeof "/.build-id/" + 1 + id_len * 2 + sizeof ".debug" - 1];
+ char id_name[sizeof "/.build-id/" + 1 + MAX_BUILD_ID_BYTES * 2
+ + sizeof ".debug" - 1];
strcpy (id_name, "/.build-id/");
int n = snprintf (&id_name[sizeof "/.build-id/" - 1],
4, "%02" PRIx8 "/", (uint8_t) id[0]);
@@ -55,12 +66,15 @@ __libdwfl_open_by_build_id (Dwfl_Module *mod, bool debug, char **file_name,
".debug");
const Dwfl_Callbacks *const cb = mod->dwfl->callbacks;
- char *path = strdupa ((cb->debuginfo_path ? *cb->debuginfo_path : NULL)
- ?: DEFAULT_DEBUGINFO_PATH);
+ char *path = strdup ((cb->debuginfo_path ? *cb->debuginfo_path : NULL)
+ ?: DEFAULT_DEBUGINFO_PATH);
+ if (path == NULL)
+ return -1;
int fd = -1;
char *dir;
- while (fd < 0 && (dir = strsep (&path, ":")) != NULL)
+ char *paths = path;
+ while (fd < 0 && (dir = strsep (&paths, ":")) != NULL)
{
if (dir[0] == '+' || dir[0] == '-')
++dir;
@@ -90,6 +104,8 @@ __libdwfl_open_by_build_id (Dwfl_Module *mod, bool debug, char **file_name,
free (name);
}
+ free (path);
+
/* If we simply found nothing, clear errno. If we had some other error
with the file, report that. Possibly this should treat other errors
like ENOENT too. But ignoring all errors could mask some that should
diff --git a/3rdparty/elfutils/libdwfl/dwfl_error.c b/3rdparty/elfutils/libdwfl/dwfl_error.c
index d9ca9e7..56ec2b0 100644
--- a/3rdparty/elfutils/libdwfl/dwfl_error.c
+++ b/3rdparty/elfutils/libdwfl/dwfl_error.c
@@ -1,5 +1,5 @@
/* Error handling in libdwfl.
- Copyright (C) 2005-2010 Red Hat, Inc.
+ Copyright (C) 2005-2015 Red Hat, Inc.
This file is part of elfutils.
This file is free software; you can redistribute it and/or modify
@@ -54,18 +54,31 @@ dwfl_errno (void)
INTDEF (dwfl_errno)
-static const struct msgtable
+struct msgtable
{
#define DWFL_ERROR(name, text) char msg_##name[sizeof text];
DWFL_ERRORS
#undef DWFL_ERROR
+};
+
+static const union
+{
+ struct msgtable table;
+ char strings[
+#define DWFL_ERROR(name, text) + sizeof text
+ DWFL_ERRORS
+#undef DWFL_ERROR
+ ];
} msgtable =
{
+ .table =
+ {
#define DWFL_ERROR(name, text) text,
- DWFL_ERRORS
+ DWFL_ERRORS
#undef DWFL_ERROR
+ }
};
-#define msgstr (&msgtable.msg_NOERROR[0])
+#define msgstr (msgtable.strings)
static const uint_fast16_t msgidx[] =
{
diff --git a/3rdparty/elfutils/libdwfl/dwfl_lineinfo.c b/3rdparty/elfutils/libdwfl/dwfl_lineinfo.c
index dfb27d8..7ddbfb0 100644
--- a/3rdparty/elfutils/libdwfl/dwfl_lineinfo.c
+++ b/3rdparty/elfutils/libdwfl/dwfl_lineinfo.c
@@ -1,5 +1,5 @@
/* Get information from a source line record returned by libdwfl.
- Copyright (C) 2005-2010 Red Hat, Inc.
+ Copyright (C) 2005-2010, 2015 Red Hat, Inc.
This file is part of elfutils.
This file is free software; you can redistribute it and/or modify
@@ -46,6 +46,12 @@ dwfl_lineinfo (Dwfl_Line *line, Dwarf_Addr *addr, int *linep, int *colp,
if (colp != NULL)
*colp = info->column;
+ if (unlikely (info->file >= info->files->nfiles))
+ {
+ __libdwfl_seterrno (DWFL_E (LIBDW, DWARF_E_INVALID_DWARF));
+ return NULL;
+ }
+
struct Dwarf_Fileinfo_s *file = &info->files->info[info->file];
if (mtime != NULL)
*mtime = file->mtime;
diff --git a/3rdparty/elfutils/libdwfl/dwfl_module_build_id.c b/3rdparty/elfutils/libdwfl/dwfl_module_build_id.c
index 350bbf8..c9a42ca 100644
--- a/3rdparty/elfutils/libdwfl/dwfl_module_build_id.c
+++ b/3rdparty/elfutils/libdwfl/dwfl_module_build_id.c
@@ -101,7 +101,7 @@ dwfl_module_build_id (Dwfl_Module *mod,
INTDEF (dwfl_module_build_id)
NEW_VERSION (dwfl_module_build_id, ELFUTILS_0.138)
-#ifdef SHARED
+#ifdef SYMBOL_VERSIONING
COMPAT_VERSION (dwfl_module_build_id, ELFUTILS_0.130, vaddr_at_end)
int
diff --git a/3rdparty/elfutils/libdwfl/dwfl_module_getdwarf.c b/3rdparty/elfutils/libdwfl/dwfl_module_getdwarf.c
index 494407d..dba9d66 100644
--- a/3rdparty/elfutils/libdwfl/dwfl_module_getdwarf.c
+++ b/3rdparty/elfutils/libdwfl/dwfl_module_getdwarf.c
@@ -1,5 +1,5 @@
/* Find debugging and symbol information for a module in libdwfl.
- Copyright (C) 2005-2012, 2014 Red Hat, Inc.
+ Copyright (C) 2005-2012, 2014, 2015 Red Hat, Inc.
This file is part of elfutils.
This file is free software; you can redistribute it and/or modify
@@ -368,34 +368,41 @@ find_prelink_address_sync (Dwfl_Module *mod, struct dwfl_file *file)
GElf_Addr undo_interp = 0;
{
- union
+ typedef union
{
Elf32_Phdr p32[phnum];
Elf64_Phdr p64[phnum];
} phdr;
- dst.d_buf = &phdr;
- dst.d_size = sizeof phdr;
+ phdr *phdrs = malloc (sizeof (phdr));
+ if (unlikely (phdrs == NULL))
+ return DWFL_E_NOMEM;
+ dst.d_buf = phdrs;
+ dst.d_size = sizeof (phdr);
if (unlikely (gelf_xlatetom (mod->main.elf, &dst, &src,
ehdr.e32.e_ident[EI_DATA]) == NULL))
- return DWFL_E_LIBELF;
+ {
+ free (phdrs);
+ return DWFL_E_LIBELF;
+ }
if (ehdr.e32.e_ident[EI_CLASS] == ELFCLASS32)
{
for (uint_fast16_t i = 0; i < phnum; ++i)
- if (phdr.p32[i].p_type == PT_INTERP)
+ if (phdrs->p32[i].p_type == PT_INTERP)
{
- undo_interp = phdr.p32[i].p_vaddr;
+ undo_interp = phdrs->p32[i].p_vaddr;
break;
}
}
else
{
for (uint_fast16_t i = 0; i < phnum; ++i)
- if (phdr.p64[i].p_type == PT_INTERP)
+ if (phdrs->p64[i].p_type == PT_INTERP)
{
- undo_interp = phdr.p64[i].p_vaddr;
+ undo_interp = phdrs->p64[i].p_vaddr;
break;
}
}
+ free (phdrs);
}
if (unlikely ((main_interp == 0) != (undo_interp == 0)))
@@ -405,16 +412,22 @@ find_prelink_address_sync (Dwfl_Module *mod, struct dwfl_file *file)
src.d_type = ELF_T_SHDR;
src.d_size = gelf_fsize (mod->main.elf, ELF_T_SHDR, shnum - 1, EV_CURRENT);
- union
+ typedef union
{
Elf32_Shdr s32[shnum - 1];
Elf64_Shdr s64[shnum - 1];
} shdr;
- dst.d_buf = &shdr;
- dst.d_size = sizeof shdr;
+ shdr *shdrs = malloc (sizeof (shdr));
+ if (unlikely (shdrs == NULL))
+ return DWFL_E_NOMEM;
+ dst.d_buf = shdrs;
+ dst.d_size = sizeof (shdr);
if (unlikely (gelf_xlatetom (mod->main.elf, &dst, &src,
ehdr.e32.e_ident[EI_DATA]) == NULL))
- return DWFL_E_LIBELF;
+ {
+ free (shdrs);
+ return DWFL_E_LIBELF;
+ }
/* Now we can look at the original section headers of the main file
before it was prelinked. First we'll apply our method to the main
@@ -457,7 +470,10 @@ find_prelink_address_sync (Dwfl_Module *mod, struct dwfl_file *file)
GElf_Shdr sh_mem;
GElf_Shdr *sh = gelf_getshdr (scn, &sh_mem);
if (unlikely (sh == NULL))
- return DWFL_E_LIBELF;
+ {
+ free (shdrs);
+ return DWFL_E_LIBELF;
+ }
consider_shdr (main_interp, sh->sh_type, sh->sh_flags,
sh->sh_addr, sh->sh_size);
}
@@ -468,19 +484,26 @@ find_prelink_address_sync (Dwfl_Module *mod, struct dwfl_file *file)
highest = 0;
if (ehdr.e32.e_ident[EI_CLASS] == ELFCLASS32)
for (size_t i = 0; i < shnum - 1; ++i)
- consider_shdr (undo_interp, shdr.s32[i].sh_type, shdr.s32[i].sh_flags,
- shdr.s32[i].sh_addr, shdr.s32[i].sh_size);
+ consider_shdr (undo_interp, shdrs->s32[i].sh_type,
+ shdrs->s32[i].sh_flags, shdrs->s32[i].sh_addr,
+ shdrs->s32[i].sh_size);
else
for (size_t i = 0; i < shnum - 1; ++i)
- consider_shdr (undo_interp, shdr.s64[i].sh_type, shdr.s64[i].sh_flags,
- shdr.s64[i].sh_addr, shdr.s64[i].sh_size);
+ consider_shdr (undo_interp, shdrs->s64[i].sh_type,
+ shdrs->s64[i].sh_flags, shdrs->s64[i].sh_addr,
+ shdrs->s64[i].sh_size);
if (highest > file->vaddr)
file->address_sync = highest;
else
- return DWFL_E_BAD_PRELINK;
+ {
+ free (shdrs);
+ return DWFL_E_BAD_PRELINK;
+ }
}
+ free (shdrs);
+
return DWFL_E_NOERROR;
}
@@ -1083,6 +1106,9 @@ find_symtab (Dwfl_Module *mod)
if (elf_strptr (mod->symfile->elf, strshndx, 0) == NULL)
{
elferr:
+ mod->symdata = NULL;
+ mod->syments = 0;
+ mod->first_global = 0;
mod->symerr = DWFL_E (LIBELF, elf_errno ());
goto aux_cleanup; /* This cleans up some more and tries find_dynsym. */
}
@@ -1109,7 +1135,8 @@ find_symtab (Dwfl_Module *mod)
// Sanity check number of symbols.
GElf_Shdr shdr_mem, *shdr = gelf_getshdr (symscn, &shdr_mem);
- if (mod->syments > mod->symdata->d_size / shdr->sh_entsize
+ if (shdr == NULL || shdr->sh_entsize == 0
+ || mod->syments > mod->symdata->d_size / shdr->sh_entsize
|| (size_t) mod->first_global > mod->syments)
goto elferr;
diff --git a/3rdparty/elfutils/libdwfl/dwfl_module_getsrc.c b/3rdparty/elfutils/libdwfl/dwfl_module_getsrc.c
index f6d8839..f7e340b 100644
--- a/3rdparty/elfutils/libdwfl/dwfl_module_getsrc.c
+++ b/3rdparty/elfutils/libdwfl/dwfl_module_getsrc.c
@@ -64,11 +64,11 @@ dwfl_module_getsrc (Dwfl_Module *mod, Dwarf_Addr addr)
l = idx;
}
- /* The last line which is less than or equal to addr is what we want,
- except with an end_sequence which can only be strictly equal. */
+ /* The last line which is less than or equal to addr is what
+ we want, unless it is the end_sequence which is after the
+ current line sequence. */
Dwarf_Line *line = &lines->info[l];
- if (line->addr == addr
- || (! line->end_sequence && line->addr < addr))
+ if (! line->end_sequence && line->addr <= addr)
return &cu->lines->idx[l];
}
diff --git a/3rdparty/elfutils/libdwfl/dwfl_report_elf.c b/3rdparty/elfutils/libdwfl/dwfl_report_elf.c
index 3a4ae2e..624284c 100644
--- a/3rdparty/elfutils/libdwfl/dwfl_report_elf.c
+++ b/3rdparty/elfutils/libdwfl/dwfl_report_elf.c
@@ -321,7 +321,7 @@ dwfl_report_elf (Dwfl *dwfl, const char *name, const char *file_name, int fd,
INTDEF (dwfl_report_elf)
NEW_VERSION (dwfl_report_elf, ELFUTILS_0.156)
-#ifdef SHARED
+#ifdef SYMBOL_VERSIONING
Dwfl_Module *
_compat_without_add_p_vaddr_dwfl_report_elf (Dwfl *dwfl, const char *name,
const char *file_name, int fd,
diff --git a/3rdparty/elfutils/libdwfl/dwfl_segment_report_module.c b/3rdparty/elfutils/libdwfl/dwfl_segment_report_module.c
index 898457f..a0f07ad 100644
--- a/3rdparty/elfutils/libdwfl/dwfl_segment_report_module.c
+++ b/3rdparty/elfutils/libdwfl/dwfl_segment_report_module.c
@@ -1,5 +1,5 @@
/* Sniff out modules from ELF headers visible in memory segments.
- Copyright (C) 2008-2012, 2014 Red Hat, Inc.
+ Copyright (C) 2008-2012, 2014, 2015 Red Hat, Inc.
This file is part of elfutils.
This file is free software; you can redistribute it and/or modify
@@ -36,7 +36,6 @@
#include <gelf.h>
#include <inttypes.h>
#include <sys/param.h>
-#include <alloca.h>
#include <endian.h>
#include <unistd.h>
#include <fcntl.h>
@@ -278,8 +277,13 @@ dwfl_segment_report_module (Dwfl *dwfl, int ndx, const char *name,
Elf *elf = NULL;
int fd = -1;
+ /* We might have to reserve some memory for the phdrs. Set to NULL
+ here so we can always safely free it. */
+ void *phdrsp = NULL;
+
inline int finish (void)
{
+ free (phdrsp);
release_buffer (&buffer, &buffer_available);
if (elf != NULL)
elf_end (elf);
@@ -400,14 +404,19 @@ dwfl_segment_report_module (Dwfl *dwfl, int ndx, const char *name,
xlatefrom.d_buf = ph_buffer;
- union
+ typedef union
{
Elf32_Phdr p32[phnum];
Elf64_Phdr p64[phnum];
- } phdrs;
+ } phdrsn;
+
+ phdrsp = malloc (sizeof (phdrsn));
+ if (unlikely (phdrsp == NULL))
+ return finish ();
+ phdrsn *phdrs = (phdrsn *) phdrsp;
- xlateto.d_buf = &phdrs;
- xlateto.d_size = sizeof phdrs;
+ xlateto.d_buf = phdrs;
+ xlateto.d_size = sizeof (phdrsn);
/* Track the bounds of the file visible in memory. */
GElf_Off file_trimmed_end = 0; /* Proper p_vaddr + p_filesz end. */
@@ -570,10 +579,10 @@ dwfl_segment_report_module (Dwfl *dwfl, int ndx, const char *name,
found_bias = false; /* Trigger error check. */
else
for (uint_fast16_t i = 0; i < phnum; ++i)
- consider_phdr (phdrs.p32[i].p_type,
- phdrs.p32[i].p_vaddr, phdrs.p32[i].p_memsz,
- phdrs.p32[i].p_offset, phdrs.p32[i].p_filesz,
- phdrs.p32[i].p_align);
+ consider_phdr (phdrs->p32[i].p_type,
+ phdrs->p32[i].p_vaddr, phdrs->p32[i].p_memsz,
+ phdrs->p32[i].p_offset, phdrs->p32[i].p_filesz,
+ phdrs->p32[i].p_align);
}
else
{
@@ -581,10 +590,10 @@ dwfl_segment_report_module (Dwfl *dwfl, int ndx, const char *name,
found_bias = false; /* Trigger error check. */
else
for (uint_fast16_t i = 0; i < phnum; ++i)
- consider_phdr (phdrs.p64[i].p_type,
- phdrs.p64[i].p_vaddr, phdrs.p64[i].p_memsz,
- phdrs.p64[i].p_offset, phdrs.p64[i].p_filesz,
- phdrs.p64[i].p_align);
+ consider_phdr (phdrs->p64[i].p_type,
+ phdrs->p64[i].p_vaddr, phdrs->p64[i].p_memsz,
+ phdrs->p64[i].p_offset, phdrs->p64[i].p_filesz,
+ phdrs->p64[i].p_align);
}
finish_portion (&ph_buffer, &ph_buffer_size);
@@ -687,8 +696,13 @@ dwfl_segment_report_module (Dwfl *dwfl, int ndx, const char *name,
}
if (invalid)
{
- free (build_id);
- return finish ();
+ /* The file was there, but the build_id didn't match. We
+ still want to report the module, but need to get the ELF
+ some other way if possible. */
+ close (fd);
+ fd = -1;
+ elf_end (elf);
+ elf = NULL;
}
}
@@ -735,38 +749,44 @@ dwfl_segment_report_module (Dwfl *dwfl, int ndx, const char *name,
const size_t dyn_entsize = (ei_class == ELFCLASS32
? sizeof (Elf32_Dyn) : sizeof (Elf64_Dyn));
+ void *dyns = NULL;
void *dyn_data = NULL;
size_t dyn_data_size = 0;
if (dyn_filesz != 0 && dyn_filesz % dyn_entsize == 0
&& ! read_portion (&dyn_data, &dyn_data_size, dyn_vaddr, dyn_filesz))
{
- union
+ typedef union
{
Elf32_Dyn d32[dyn_filesz / sizeof (Elf32_Dyn)];
Elf64_Dyn d64[dyn_filesz / sizeof (Elf64_Dyn)];
- } dyn;
+ } dynn;
+ dyns = malloc (sizeof (dynn));
+ if (unlikely (dyns == NULL))
+ return finish ();
+ dynn *dyn = (dynn *) dyns;
xlatefrom.d_type = xlateto.d_type = ELF_T_DYN;
xlatefrom.d_buf = (void *) dyn_data;
xlatefrom.d_size = dyn_filesz;
- xlateto.d_buf = &dyn;
- xlateto.d_size = sizeof dyn;
+ xlateto.d_buf = dyn;
+ xlateto.d_size = sizeof (dynn);
if (ei_class == ELFCLASS32)
{
if (elf32_xlatetom (&xlateto, &xlatefrom, ei_data) != NULL)
- for (size_t i = 0; i < dyn_filesz / sizeof dyn.d32[0]; ++i)
- if (consider_dyn (dyn.d32[i].d_tag, dyn.d32[i].d_un.d_val))
+ for (size_t i = 0; i < dyn_filesz / sizeof (Elf32_Dyn); ++i)
+ if (consider_dyn (dyn->d32[i].d_tag, dyn->d32[i].d_un.d_val))
break;
}
else
{
if (elf64_xlatetom (&xlateto, &xlatefrom, ei_data) != NULL)
- for (size_t i = 0; i < dyn_filesz / sizeof dyn.d64[0]; ++i)
- if (consider_dyn (dyn.d64[i].d_tag, dyn.d64[i].d_un.d_val))
+ for (size_t i = 0; i < dyn_filesz / sizeof (Elf64_Dyn); ++i)
+ if (consider_dyn (dyn->d64[i].d_tag, dyn->d64[i].d_un.d_val))
break;
}
}
+ free (dyns);
finish_portion (&dyn_data, &dyn_data_size);
/* We'll use the name passed in or a stupid default if not DT_SONAME. */
@@ -881,12 +901,12 @@ dwfl_segment_report_module (Dwfl *dwfl, int ndx, const char *name,
if (ei_class == ELFCLASS32)
for (uint_fast16_t i = 0; i < phnum; ++i)
- read_phdr (phdrs.p32[i].p_type, phdrs.p32[i].p_vaddr,
- phdrs.p32[i].p_offset, phdrs.p32[i].p_filesz);
+ read_phdr (phdrs->p32[i].p_type, phdrs->p32[i].p_vaddr,
+ phdrs->p32[i].p_offset, phdrs->p32[i].p_filesz);
else
for (uint_fast16_t i = 0; i < phnum; ++i)
- read_phdr (phdrs.p64[i].p_type, phdrs.p64[i].p_vaddr,
- phdrs.p64[i].p_offset, phdrs.p64[i].p_filesz);
+ read_phdr (phdrs->p64[i].p_type, phdrs->p64[i].p_vaddr,
+ phdrs->p64[i].p_offset, phdrs->p64[i].p_filesz);
}
else
{
diff --git a/3rdparty/elfutils/libdwfl/elf-from-memory.c b/3rdparty/elfutils/libdwfl/elf-from-memory.c
index b35fac7..ed8f6e9 100644
--- a/3rdparty/elfutils/libdwfl/elf-from-memory.c
+++ b/3rdparty/elfutils/libdwfl/elf-from-memory.c
@@ -1,5 +1,5 @@
/* Reconstruct an ELF file by reading the segments out of remote memory.
- Copyright (C) 2005-2011, 2014 Red Hat, Inc.
+ Copyright (C) 2005-2011, 2014, 2015 Red Hat, Inc.
This file is part of elfutils.
This file is free software; you can redistribute it and/or modify
@@ -63,11 +63,15 @@ elf_from_remote_memory (GElf_Addr ehdr_vma,
size_t maxread),
void *arg)
{
+ /* We might have to reserve some memory for the phdrs. Set to NULL
+ here so we can always safely free it. */
+ void *phdrsp = NULL;
+
/* First read in the file header and check its sanity. */
const size_t initial_bufsize = 256;
unsigned char *buffer = malloc (initial_bufsize);
- if (buffer == NULL)
+ if (unlikely (buffer == NULL))
{
no_memory:
__libdwfl_seterrno (DWFL_E_NOMEM);
@@ -80,6 +84,7 @@ elf_from_remote_memory (GElf_Addr ehdr_vma,
{
read_error:
free (buffer);
+ free (phdrsp);
__libdwfl_seterrno (nread < 0 ? DWFL_E_ERRNO : DWFL_E_TRUNCATED);
return NULL;
}
@@ -88,6 +93,7 @@ elf_from_remote_memory (GElf_Addr ehdr_vma,
{
bad_elf:
free (buffer);
+ free (phdrsp);
__libdwfl_seterrno (DWFL_E_BADELF);
return NULL;
}
@@ -172,6 +178,7 @@ elf_from_remote_memory (GElf_Addr ehdr_vma,
if (newbuf == NULL)
{
free (buffer);
+ free (phdrsp);
goto no_memory;
}
buffer = newbuf;
@@ -184,14 +191,22 @@ elf_from_remote_memory (GElf_Addr ehdr_vma,
xlatefrom.d_buf = buffer;
}
- union
+ typedef union
{
Elf32_Phdr p32[phnum];
Elf64_Phdr p64[phnum];
- } phdrs;
+ } phdrsn;
+
+ phdrsp = malloc (sizeof (phdrsn));
+ if (unlikely (phdrsp == NULL))
+ {
+ free (buffer);
+ goto no_memory;
+ }
+ phdrsn *phdrs = (phdrsn *) phdrsp;
- xlateto.d_buf = &phdrs;
- xlateto.d_size = sizeof phdrs;
+ xlateto.d_buf = phdrs;
+ xlateto.d_size = sizeof (phdrsn);
/* Scan for PT_LOAD segments to find the total size of the file image. */
size_t contents_size = 0;
@@ -234,9 +249,9 @@ elf_from_remote_memory (GElf_Addr ehdr_vma,
ehdr.e32.e_ident[EI_DATA]) == NULL)
goto libelf_error;
for (uint_fast16_t i = 0; i < phnum; ++i)
- if (phdrs.p32[i].p_type == PT_LOAD)
- if (handle_segment (phdrs.p32[i].p_vaddr, phdrs.p32[i].p_offset,
- phdrs.p32[i].p_filesz, phdrs.p32[i].p_memsz))
+ if (phdrs->p32[i].p_type == PT_LOAD)
+ if (handle_segment (phdrs->p32[i].p_vaddr, phdrs->p32[i].p_offset,
+ phdrs->p32[i].p_filesz, phdrs->p32[i].p_memsz))
goto bad_elf;
break;
@@ -245,9 +260,9 @@ elf_from_remote_memory (GElf_Addr ehdr_vma,
ehdr.e64.e_ident[EI_DATA]) == NULL)
goto libelf_error;
for (uint_fast16_t i = 0; i < phnum; ++i)
- if (phdrs.p64[i].p_type == PT_LOAD)
- if (handle_segment (phdrs.p64[i].p_vaddr, phdrs.p64[i].p_offset,
- phdrs.p64[i].p_filesz, phdrs.p64[i].p_memsz))
+ if (phdrs->p64[i].p_type == PT_LOAD)
+ if (handle_segment (phdrs->p64[i].p_vaddr, phdrs->p64[i].p_offset,
+ phdrs->p64[i].p_filesz, phdrs->p64[i].p_memsz))
goto bad_elf;
break;
@@ -276,7 +291,10 @@ elf_from_remote_memory (GElf_Addr ehdr_vma,
/* Now we know the size of the whole image we want read in. */
buffer = calloc (1, contents_size);
if (buffer == NULL)
- goto no_memory;
+ {
+ free (phdrsp);
+ goto no_memory;
+ }
switch (ehdr.e32.e_ident[EI_CLASS])
{
@@ -297,9 +315,9 @@ elf_from_remote_memory (GElf_Addr ehdr_vma,
case ELFCLASS32:
for (uint_fast16_t i = 0; i < phnum; ++i)
- if (phdrs.p32[i].p_type == PT_LOAD)
- if (handle_segment (phdrs.p32[i].p_vaddr, phdrs.p32[i].p_offset,
- phdrs.p32[i].p_filesz))
+ if (phdrs->p32[i].p_type == PT_LOAD)
+ if (handle_segment (phdrs->p32[i].p_vaddr, phdrs->p32[i].p_offset,
+ phdrs->p32[i].p_filesz))
goto read_error;
/* If the segments visible in memory didn't include the section
@@ -324,9 +342,9 @@ elf_from_remote_memory (GElf_Addr ehdr_vma,
case ELFCLASS64:
for (uint_fast16_t i = 0; i < phnum; ++i)
- if (phdrs.p64[i].p_type == PT_LOAD)
- if (handle_segment (phdrs.p64[i].p_vaddr, phdrs.p64[i].p_offset,
- phdrs.p64[i].p_filesz))
+ if (phdrs->p64[i].p_type == PT_LOAD)
+ if (handle_segment (phdrs->p64[i].p_vaddr, phdrs->p64[i].p_offset,
+ phdrs->p64[i].p_filesz))
goto read_error;
/* If the segments visible in memory didn't include the section
@@ -354,6 +372,9 @@ elf_from_remote_memory (GElf_Addr ehdr_vma,
break;
}
+ free (phdrsp);
+ phdrs = phdrsp = NULL;
+
/* Now we have the image. Open libelf on it. */
Elf *elf = elf_memory ((char *) buffer, contents_size);
diff --git a/3rdparty/elfutils/libdwfl/find-debuginfo.c b/3rdparty/elfutils/libdwfl/find-debuginfo.c
index 3f5314a..1faa494 100644
--- a/3rdparty/elfutils/libdwfl/find-debuginfo.c
+++ b/3rdparty/elfutils/libdwfl/find-debuginfo.c
@@ -1,5 +1,5 @@
/* Standard find_debuginfo callback for libdwfl.
- Copyright (C) 2005-2010, 2014 Red Hat, Inc.
+ Copyright (C) 2005-2010, 2014, 2015 Red Hat, Inc.
This file is part of elfutils.
This file is free software; you can redistribute it and/or modify
@@ -45,7 +45,7 @@ try_open (const struct stat64 *main_stat,
if (dir == NULL && subdir == NULL)
{
fname = strdup (debuglink);
- if (fname == NULL)
+ if (unlikely (fname == NULL))
return -1;
}
else if ((subdir == NULL ? asprintf (&fname, "%s/%s", dir, debuglink)
@@ -62,6 +62,7 @@ try_open (const struct stat64 *main_stat,
&& st.st_dev == main_stat->st_dev)
{
/* This is the main file by another name. Don't look at it again. */
+ free (fname);
close (fd);
errno = ENOENT;
fd = -1;
@@ -161,6 +162,7 @@ find_debuginfo_in_path (Dwfl_Module *mod, const char *file_name,
bool cancheck = debuglink_crc != (GElf_Word) 0;
const char *file_basename = file_name == NULL ? NULL : basename (file_name);
+ char *localname = NULL;
if (debuglink_file == NULL)
{
/* For a alt debug multi file we need a name, for a separate debug
@@ -172,7 +174,9 @@ find_debuginfo_in_path (Dwfl_Module *mod, const char *file_name,
}
size_t len = strlen (file_basename);
- char *localname = alloca (len + sizeof ".debug");
+ localname = malloc (len + sizeof ".debug");
+ if (unlikely (localname == NULL))
+ return -1;
memcpy (localname, file_basename, len);
memcpy (&localname[len], ".debug", sizeof ".debug");
debuglink_file = localname;
@@ -183,11 +187,17 @@ find_debuginfo_in_path (Dwfl_Module *mod, const char *file_name,
indicated by the debug directory path setting. */
const Dwfl_Callbacks *const cb = mod->dwfl->callbacks;
- char *path = strdupa ((cb->debuginfo_path ? *cb->debuginfo_path : NULL)
- ?: DEFAULT_DEBUGINFO_PATH);
+ char *localpath = strdup ((cb->debuginfo_path ? *cb->debuginfo_path : NULL)
+ ?: DEFAULT_DEBUGINFO_PATH);
+ if (unlikely (localpath == NULL))
+ {
+ free (localname);
+ return -1;
+ }
/* A leading - or + in the whole path sets whether to check file CRCs. */
bool defcheck = true;
+ char *path = localpath;
if (path[0] == '-' || path[0] == '+')
{
defcheck = path[0] == '+';
@@ -205,7 +215,13 @@ find_debuginfo_in_path (Dwfl_Module *mod, const char *file_name,
}
char *file_dirname = (file_basename == file_name ? NULL
- : strndupa (file_name, file_basename - 1 - file_name));
+ : strndup (file_name, file_basename - 1 - file_name));
+ if (file_basename != file_name && file_dirname == NULL)
+ {
+ free (localpath);
+ free (localname);
+ return -1;
+ }
char *p;
while ((p = strsep (&path, ":")) != NULL)
{
@@ -270,7 +286,7 @@ find_debuginfo_in_path (Dwfl_Module *mod, const char *file_name,
if (fd < 0)
{
if (errno != ENOENT && errno != ENOTDIR)
- return -1;
+ goto fail_free;
else
continue;
}
@@ -278,10 +294,13 @@ find_debuginfo_in_path (Dwfl_Module *mod, const char *file_name,
}
continue;
default:
- return -1;
+ goto fail_free;
}
if (validate (mod, fd, check, debuglink_crc))
{
+ free (localpath);
+ free (localname);
+ free (file_dirname);
*debuginfo_file_name = fname;
return fd;
}
@@ -291,6 +310,10 @@ find_debuginfo_in_path (Dwfl_Module *mod, const char *file_name,
/* No dice. */
errno = 0;
+fail_free:
+ free (localpath);
+ free (localname);
+ free (file_dirname);
return -1;
}
@@ -333,7 +356,7 @@ dwfl_standard_find_debuginfo (Dwfl_Module *mod,
debuglink_file, debuglink_crc,
debuginfo_file_name);
- if (fd < 0 && errno == 0)
+ if (fd < 0 && errno == 0 && file_name != NULL)
{
/* If FILE_NAME is a symlink, the debug file might be associated
with the symlink target name instead. */
diff --git a/3rdparty/elfutils/libdwfl/link_map.c b/3rdparty/elfutils/libdwfl/link_map.c
index eaf43b5..030c600 100644
--- a/3rdparty/elfutils/libdwfl/link_map.c
+++ b/3rdparty/elfutils/libdwfl/link_map.c
@@ -1,5 +1,5 @@
/* Report modules by examining dynamic linker data structures.
- Copyright (C) 2008-2014 Red Hat, Inc.
+ Copyright (C) 2008-2015 Red Hat, Inc.
This file is part of elfutils.
This file is free software; you can redistribute it and/or modify
@@ -58,8 +58,7 @@ auxv_format_probe (const void *auxv, size_t size,
inline bool check64 (size_t i)
{
/* The AUXV pointer might not even be naturally aligned for 64-bit
- data, because note payloads in a core file are not aligned.
- But we assume the data is 32-bit aligned. */
+ data, because note payloads in a core file are not aligned. */
uint64_t type = read_8ubyte_unaligned_noncvt (&u->a64[i].a_type);
uint64_t val = read_8ubyte_unaligned_noncvt (&u->a64[i].a_un.a_val);
@@ -83,15 +82,21 @@ auxv_format_probe (const void *auxv, size_t size,
inline bool check32 (size_t i)
{
- if (u->a32[i].a_type == BE32 (PROBE_TYPE)
- && u->a32[i].a_un.a_val == BE32 (PROBE_VAL32))
+ /* The AUXV pointer might not even be naturally aligned for 32-bit
+ data, because note payloads in a core file are not aligned. */
+
+ uint32_t type = read_4ubyte_unaligned_noncvt (&u->a32[i].a_type);
+ uint32_t val = read_4ubyte_unaligned_noncvt (&u->a32[i].a_un.a_val);
+
+ if (type == BE32 (PROBE_TYPE)
+ && val == BE32 (PROBE_VAL32))
{
*elfdata = ELFDATA2MSB;
return true;
}
- if (u->a32[i].a_type == LE32 (PROBE_TYPE)
- && u->a32[i].a_un.a_val == LE32 (PROBE_VAL32))
+ if (type == LE32 (PROBE_TYPE)
+ && val == LE32 (PROBE_VAL32))
{
*elfdata = ELFDATA2LSB;
return true;
@@ -285,19 +290,19 @@ report_r_debug (uint_fast8_t elfclass, uint_fast8_t elfdata,
{
if (elfdata == ELFDATA2MSB)
for (size_t i = 0; i < n; ++i)
- addrs[i] = BE32 (in->a32[i]);
+ addrs[i] = BE32 (read_4ubyte_unaligned_noncvt (&in->a32[i]));
else
for (size_t i = 0; i < n; ++i)
- addrs[i] = LE32 (in->a32[i]);
+ addrs[i] = LE32 (read_4ubyte_unaligned_noncvt (&in->a32[i]));
}
else
{
if (elfdata == ELFDATA2MSB)
for (size_t i = 0; i < n; ++i)
- addrs[i] = BE64 (in->a64[i]);
+ addrs[i] = BE64 (read_8ubyte_unaligned_noncvt (&in->a64[i]));
else
for (size_t i = 0; i < n; ++i)
- addrs[i] = LE64 (in->a64[i]);
+ addrs[i] = LE64 (read_8ubyte_unaligned_noncvt (&in->a64[i]));
}
return false;
@@ -369,7 +374,7 @@ report_r_debug (uint_fast8_t elfclass, uint_fast8_t elfdata,
const char *name1 = name == NULL ? "" : name;
r_debug_info_module = malloc (sizeof (*r_debug_info_module)
+ strlen (name1) + 1);
- if (r_debug_info_module == NULL)
+ if (unlikely (r_debug_info_module == NULL))
return release_buffer (result);
r_debug_info_module->fd = -1;
r_debug_info_module->elf = NULL;
@@ -856,18 +861,24 @@ dwfl_link_map_report (Dwfl *dwfl, const void *auxv, size_t auxv_size,
}
if (in_ok)
{
- union
+ typedef union
{
Elf32_Phdr p32;
Elf64_Phdr p64;
char data[phnum * phent];
- } buf;
+ } data_buf;
+ data_buf *buf = malloc (sizeof (data_buf));
+ if (unlikely (buf == NULL))
+ {
+ __libdwfl_seterrno (DWFL_E_NOMEM);
+ return false;
+ }
Elf_Data out =
{
.d_type = ELF_T_PHDR,
.d_version = EV_CURRENT,
.d_size = phnum * phent,
- .d_buf = &buf
+ .d_buf = buf
};
in.d_size = out.d_size;
if (likely ((elfclass == ELFCLASS32
@@ -879,7 +890,7 @@ dwfl_link_map_report (Dwfl *dwfl, const void *auxv, size_t auxv_size,
{
Elf32_Phdr p32[phnum];
Elf64_Phdr p64[phnum];
- } *u = (void *) &buf;
+ } *u = (void *) buf;
if (elfclass == ELFCLASS32)
{
for (size_t i = 0; i < phnum; ++i)
@@ -900,6 +911,7 @@ dwfl_link_map_report (Dwfl *dwfl, const void *auxv, size_t auxv_size,
(*memory_callback) (dwfl, -1, &in.d_buf, &in.d_size, 0, 0,
memory_callback_arg);
+ free (buf);
}
else
/* We could not read the executable's phdrs from the
@@ -943,18 +955,24 @@ dwfl_link_map_report (Dwfl *dwfl, const void *auxv, size_t auxv_size,
if ((*memory_callback) (dwfl, dyn_segndx, &in.d_buf, &in.d_size,
dyn_vaddr, dyn_filesz, memory_callback_arg))
{
- union
+ typedef union
{
Elf32_Dyn d32;
Elf64_Dyn d64;
char data[dyn_filesz];
- } buf;
+ } data_buf;
+ data_buf *buf = malloc (sizeof (data_buf));
+ if (unlikely (buf == NULL))
+ {
+ __libdwfl_seterrno (DWFL_E_NOMEM);
+ return false;
+ }
Elf_Data out =
{
.d_type = ELF_T_DYN,
.d_version = EV_CURRENT,
.d_size = dyn_filesz,
- .d_buf = &buf
+ .d_buf = buf
};
in.d_size = out.d_size;
if (likely ((elfclass == ELFCLASS32
@@ -966,7 +984,7 @@ dwfl_link_map_report (Dwfl *dwfl, const void *auxv, size_t auxv_size,
{
Elf32_Dyn d32[dyn_filesz / sizeof (Elf32_Dyn)];
Elf64_Dyn d64[dyn_filesz / sizeof (Elf64_Dyn)];
- } *u = (void *) &buf;
+ } *u = (void *) buf;
if (elfclass == ELFCLASS32)
{
size_t n = dyn_filesz / sizeof (Elf32_Dyn);
@@ -991,6 +1009,7 @@ dwfl_link_map_report (Dwfl *dwfl, const void *auxv, size_t auxv_size,
(*memory_callback) (dwfl, -1, &in.d_buf, &in.d_size, 0, 0,
memory_callback_arg);
+ free (buf);
}
}
}
diff --git a/3rdparty/elfutils/libdwfl/linux-kernel-modules.c b/3rdparty/elfutils/libdwfl/linux-kernel-modules.c
index e4065d8..236e2cd 100644
--- a/3rdparty/elfutils/libdwfl/linux-kernel-modules.c
+++ b/3rdparty/elfutils/libdwfl/linux-kernel-modules.c
@@ -1,5 +1,5 @@
/* Standard libdwfl callbacks for debugging the running Linux kernel.
- Copyright (C) 2005-2011, 2013, 2014 Red Hat, Inc.
+ Copyright (C) 2005-2011, 2013, 2014, 2015 Red Hat, Inc.
This file is part of elfutils.
This file is free software; you can redistribute it and/or modify
@@ -379,13 +379,16 @@ dwfl_linux_kernel_report_offline (Dwfl *dwfl, const char *release,
names. To handle that, we would have to look at the
__this_module.name contents in the module's text. */
- char name[f->fts_namelen - suffix + 1];
- for (size_t i = 0; i < f->fts_namelen - 3U; ++i)
- if (f->fts_name[i] == '-' || f->fts_name[i] == ',')
+ char *name = strndup (f->fts_name, f->fts_namelen - suffix);
+ if (unlikely (name == NULL))
+ {
+ __libdwfl_seterrno (DWFL_E_NOMEM);
+ result = -1;
+ break;
+ }
+ for (size_t i = 0; i < f->fts_namelen - suffix; ++i)
+ if (name[i] == '-' || name[i] == ',')
name[i] = '_';
- else
- name[i] = f->fts_name[i];
- name[f->fts_namelen - suffix] = '\0';
if (predicate != NULL)
{
@@ -394,17 +397,23 @@ dwfl_linux_kernel_report_offline (Dwfl *dwfl, const char *release,
if (want < 0)
{
result = -1;
+ free (name);
break;
}
if (!want)
- continue;
+ {
+ free (name);
+ continue;
+ }
}
if (dwfl_report_offline (dwfl, name, f->fts_path, -1) == NULL)
{
+ free (name);
result = -1;
break;
}
+ free (name);
}
continue;
@@ -698,7 +707,12 @@ dwfl_linux_kernel_find_elf (Dwfl_Module *mod,
two files when either a '_' or '-' appears in a module name, one using
only '_' and one only using '-'. */
- char alternate_name[namelen + 1];
+ char *alternate_name = malloc (namelen + 1);
+ if (unlikely (alternate_name == NULL))
+ {
+ free (modulesdir[0]);
+ return ENOMEM;
+ }
inline bool subst_name (char from, char to)
{
const char *n = memchr (module_name, from, namelen);
@@ -748,6 +762,7 @@ dwfl_linux_kernel_find_elf (Dwfl_Module *mod,
*file_name = strdup (f->fts_path);
fts_close (fts);
free (modulesdir[0]);
+ free (alternate_name);
if (fd < 0)
free (*file_name);
else if (*file_name == NULL)
@@ -773,6 +788,7 @@ dwfl_linux_kernel_find_elf (Dwfl_Module *mod,
fts_close (fts);
free (modulesdir[0]);
+ free (alternate_name);
errno = error;
return -1;
}
diff --git a/3rdparty/elfutils/libdwfl/segment.c b/3rdparty/elfutils/libdwfl/segment.c
index 9276917..2983cf2 100644
--- a/3rdparty/elfutils/libdwfl/segment.c
+++ b/3rdparty/elfutils/libdwfl/segment.c
@@ -1,5 +1,5 @@
/* Manage address space lookup table for libdwfl.
- Copyright (C) 2008, 2009, 2010, 2013 Red Hat, Inc.
+ Copyright (C) 2008, 2009, 2010, 2013, 2015 Red Hat, Inc.
This file is part of elfutils.
This file is free software; you can redistribute it and/or modify
@@ -50,7 +50,8 @@ static bool
insert (Dwfl *dwfl, size_t i, GElf_Addr start, GElf_Addr end, int segndx)
{
bool need_start = (i == 0 || dwfl->lookup_addr[i - 1] != start);
- bool need_end = (i >= dwfl->lookup_elts || dwfl->lookup_addr[i + 1] != end);
+ bool need_end = (i + 1 >= dwfl->lookup_elts
+ || dwfl->lookup_addr[i + 1] != end);
size_t need = need_start + need_end;
if (need == 0)
return false;
diff --git a/3rdparty/elfutils/libebl/eblcheckreloctargettype.c b/3rdparty/elfutils/libebl/eblcheckreloctargettype.c
index e135f8a..e0d57c1 100644
--- a/3rdparty/elfutils/libebl/eblcheckreloctargettype.c
+++ b/3rdparty/elfutils/libebl/eblcheckreloctargettype.c
@@ -1,5 +1,5 @@
/* Check whether a section type is a valid target for relocation.
- Copyright (C) 2014 Red Hat, Inc.
+ Copyright (C) 2014, 2015 Red Hat, Inc.
This file is part of elfutils.
This file is free software; you can redistribute it and/or modify
@@ -39,8 +39,16 @@ ebl_check_reloc_target_type (Ebl *ebl, Elf64_Word sh_type)
if (ebl->check_reloc_target_type (ebl, sh_type))
return true;
- if (sh_type == SHT_PROGBITS || sh_type == SHT_NOBITS)
- return true;
-
- return false;
+ switch (sh_type)
+ {
+ case SHT_PROGBITS:
+ case SHT_NOBITS:
+ case SHT_INIT_ARRAY:
+ case SHT_FINI_ARRAY:
+ case SHT_PREINIT_ARRAY:
+ return true;
+
+ default:
+ return false;
+ }
}
diff --git a/3rdparty/elfutils/libebl/eblobjnote.c b/3rdparty/elfutils/libebl/eblobjnote.c
index d1fe821..b9bf1c0 100644
--- a/3rdparty/elfutils/libebl/eblobjnote.c
+++ b/3rdparty/elfutils/libebl/eblobjnote.c
@@ -1,5 +1,5 @@
/* Print contents of object file note.
- Copyright (C) 2002, 2007, 2009, 2011 Red Hat, Inc.
+ Copyright (C) 2002, 2007, 2009, 2011, 2015 Red Hat, Inc.
This file is part of elfutils.
Written by Ulrich Drepper <drepper@redhat.com>, 2002.
@@ -33,6 +33,7 @@
#include <inttypes.h>
#include <stdio.h>
+#include <stdlib.h>
#include <string.h>
#include <libeblP.h>
@@ -165,7 +166,19 @@ ebl_object_note (ebl, name, type, descsz, desc)
.d_size = descsz,
.d_buf = (void *) desc
};
- uint32_t buf[descsz / 4];
+ /* Normally NT_GNU_ABI_TAG is just 4 words (16 bytes). If it
+ is much (4*) larger dynamically allocate memory to convert. */
+#define FIXED_TAG_BYTES 16
+ uint32_t sbuf[FIXED_TAG_BYTES];
+ uint32_t *buf;
+ if (unlikely (descsz / 4 > FIXED_TAG_BYTES))
+ {
+ buf = malloc (descsz);
+ if (unlikely (buf == NULL))
+ return;
+ }
+ else
+ buf = sbuf;
Elf_Data out =
{
.d_version = EV_CURRENT,
@@ -209,6 +222,8 @@ ebl_object_note (ebl, name, type, descsz, desc)
}
putchar_unlocked ('\n');
}
+ if (descsz / 4 > FIXED_TAG_BYTES)
+ free (buf);
break;
}
/* FALLTHROUGH */
diff --git a/3rdparty/elfutils/libebl/eblopenbackend.c b/3rdparty/elfutils/libebl/eblopenbackend.c
index 3a22f53..2766e7b 100644
--- a/3rdparty/elfutils/libebl/eblopenbackend.c
+++ b/3rdparty/elfutils/libebl/eblopenbackend.c
@@ -1,5 +1,5 @@
/* Generate ELF backend handle.
- Copyright (C) 2000-2014 Red Hat, Inc.
+ Copyright (C) 2000-2015 Red Hat, Inc.
This file is part of elfutils.
This file is free software; you can redistribute it and/or modify
@@ -135,6 +135,8 @@ static const struct
};
#define nmachines (sizeof (machines) / sizeof (machines[0]))
+/* No machine prefix should be larger than this. */
+#define MAX_PREFIX_LEN 16
/* Default callbacks. Mostly they just return the error value. */
static const char *default_object_type_name (int ignore, char *buf,
@@ -343,7 +345,11 @@ openbackend (elf, emulation, machine)
static const char version[] = MODVERSION;
const char *modversion;
ebl_bhinit_t initp;
- char symname[machines[cnt].prefix_len + sizeof "_init"];
+
+ // We use a static number to help the compiler see we don't
+ // overflow the stack with an arbitrary number.
+ assert (machines[cnt].prefix_len <= MAX_PREFIX_LEN);
+ char symname[MAX_PREFIX_LEN + sizeof "_init"];
strcpy (mempcpy (symname, machines[cnt].prefix,
machines[cnt].prefix_len), "_init");
diff --git a/3rdparty/elfutils/libebl/libebl.h b/3rdparty/elfutils/libebl/libebl.h
index 7c3c764..7dbf460 100644
--- a/3rdparty/elfutils/libebl/libebl.h
+++ b/3rdparty/elfutils/libebl/libebl.h
@@ -1,5 +1,5 @@
/* Interface for libebl.
- Copyright (C) 2000-2010, 2013, 2014 Red Hat, Inc.
+ Copyright (C) 2000-2010, 2013, 2014, 2015 Red Hat, Inc.
This file is part of elfutils.
This file is free software; you can redistribute it and/or modify
@@ -26,6 +26,19 @@
the GNU Lesser General Public License along with this program. If
not, see <http://www.gnu.org/licenses/>. */
+
+/* This is the interface for the Elfutils Backend Library.
+ It is a completely UNSUPPORTED interface. Don't use any libebl
+ function directly. These are only for internal elfutils backends
+ and tools. There is NO source or binary compatible guarantee.
+
+ The ABI of the backend modules is not guaranteed. Really, no guarantee
+ whatsoever. We are enforcing this in the code. The modules and their
+ users must match. No third-party EBL module are supported or allowed.
+ The only reason there are separate modules is to not have the code for
+ all architectures in all the binaries. */
+
+
#ifndef _LIBEBL_H
#define _LIBEBL_H 1
diff --git a/3rdparty/elfutils/libelf/elf.h b/3rdparty/elfutils/libelf/elf.h
index 40e87b2..39bafc2 100644
--- a/3rdparty/elfutils/libelf/elf.h
+++ b/3rdparty/elfutils/libelf/elf.h
@@ -1,5 +1,5 @@
/* This file defines standard ELF types, structures, and macros.
- Copyright (C) 1995-2014 Free Software Foundation, Inc.
+ Copyright (C) 1995-2015 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -249,6 +249,7 @@ typedef struct
#define EM_OPENRISC 92 /* OpenRISC 32-bit embedded processor */
#define EM_ARC_A5 93 /* ARC Cores Tangent-A5 */
#define EM_XTENSA 94 /* Tensilica Xtensa Architecture */
+#define EM_ALTERA_NIOS2 113 /* Altera Nios II */
#define EM_AARCH64 183 /* ARM AARCH64 */
#define EM_TILEPRO 188 /* Tilera TILEPro */
#define EM_MICROBLAZE 189 /* Xilinx MicroBlaze */
@@ -370,7 +371,7 @@ typedef struct
#define SHF_MASKPROC 0xf0000000 /* Processor-specific */
#define SHF_ORDERED (1 << 30) /* Special ordering requirement
(Solaris). */
-#define SHF_EXCLUDE (1 << 31) /* Section is excluded unless
+#define SHF_EXCLUDE (1U << 31) /* Section is excluded unless
referenced or allocated (Solaris).*/
/* Section group handling. */
@@ -1383,6 +1384,7 @@ typedef struct
#define EF_MIPS_64BIT_WHIRL 16
#define EF_MIPS_ABI2 32
#define EF_MIPS_ABI_ON32 64
+#define EF_MIPS_FP64 512 /* Uses FP64 (12 callee-saved). */
#define EF_MIPS_NAN2008 1024 /* Uses IEEE 754-2008 NaN encoding. */
#define EF_MIPS_ARCH 0xf0000000 /* MIPS architecture level. */
@@ -1631,9 +1633,10 @@ typedef struct
/* Legal values for p_type field of Elf32_Phdr. */
-#define PT_MIPS_REGINFO 0x70000000 /* Register usage information */
-#define PT_MIPS_RTPROC 0x70000001 /* Runtime procedure table. */
-#define PT_MIPS_OPTIONS 0x70000002
+#define PT_MIPS_REGINFO 0x70000000 /* Register usage information. */
+#define PT_MIPS_RTPROC 0x70000001 /* Runtime procedure table. */
+#define PT_MIPS_OPTIONS 0x70000002
+#define PT_MIPS_ABIFLAGS 0x70000003 /* FP mode requirement. */
/* Special program header types. */
@@ -1755,6 +1758,101 @@ typedef struct
typedef Elf32_Addr Elf32_Conflict;
+typedef struct
+{
+ /* Version of flags structure. */
+ Elf32_Half version;
+ /* The level of the ISA: 1-5, 32, 64. */
+ unsigned char isa_level;
+ /* The revision of ISA: 0 for MIPS V and below, 1-n otherwise. */
+ unsigned char isa_rev;
+ /* The size of general purpose registers. */
+ unsigned char gpr_size;
+ /* The size of co-processor 1 registers. */
+ unsigned char cpr1_size;
+ /* The size of co-processor 2 registers. */
+ unsigned char cpr2_size;
+ /* The floating-point ABI. */
+ unsigned char fp_abi;
+ /* Processor-specific extension. */
+ Elf32_Word isa_ext;
+ /* Mask of ASEs used. */
+ Elf32_Word ases;
+ /* Mask of general flags. */
+ Elf32_Word flags1;
+ Elf32_Word flags2;
+} Elf_MIPS_ABIFlags_v0;
+
+/* Values for the register size bytes of an abi flags structure. */
+
+#define MIPS_AFL_REG_NONE 0x00 /* No registers. */
+#define MIPS_AFL_REG_32 0x01 /* 32-bit registers. */
+#define MIPS_AFL_REG_64 0x02 /* 64-bit registers. */
+#define MIPS_AFL_REG_128 0x03 /* 128-bit registers. */
+
+/* Masks for the ases word of an ABI flags structure. */
+
+#define MIPS_AFL_ASE_DSP 0x00000001 /* DSP ASE. */
+#define MIPS_AFL_ASE_DSPR2 0x00000002 /* DSP R2 ASE. */
+#define MIPS_AFL_ASE_EVA 0x00000004 /* Enhanced VA Scheme. */
+#define MIPS_AFL_ASE_MCU 0x00000008 /* MCU (MicroController) ASE. */
+#define MIPS_AFL_ASE_MDMX 0x00000010 /* MDMX ASE. */
+#define MIPS_AFL_ASE_MIPS3D 0x00000020 /* MIPS-3D ASE. */
+#define MIPS_AFL_ASE_MT 0x00000040 /* MT ASE. */
+#define MIPS_AFL_ASE_SMARTMIPS 0x00000080 /* SmartMIPS ASE. */
+#define MIPS_AFL_ASE_VIRT 0x00000100 /* VZ ASE. */
+#define MIPS_AFL_ASE_MSA 0x00000200 /* MSA ASE. */
+#define MIPS_AFL_ASE_MIPS16 0x00000400 /* MIPS16 ASE. */
+#define MIPS_AFL_ASE_MICROMIPS 0x00000800 /* MICROMIPS ASE. */
+#define MIPS_AFL_ASE_XPA 0x00001000 /* XPA ASE. */
+#define MIPS_AFL_ASE_MASK 0x00001fff /* All ASEs. */
+
+/* Values for the isa_ext word of an ABI flags structure. */
+
+#define MIPS_AFL_EXT_XLR 1 /* RMI Xlr instruction. */
+#define MIPS_AFL_EXT_OCTEON2 2 /* Cavium Networks Octeon2. */
+#define MIPS_AFL_EXT_OCTEONP 3 /* Cavium Networks OcteonP. */
+#define MIPS_AFL_EXT_LOONGSON_3A 4 /* Loongson 3A. */
+#define MIPS_AFL_EXT_OCTEON 5 /* Cavium Networks Octeon. */
+#define MIPS_AFL_EXT_5900 6 /* MIPS R5900 instruction. */
+#define MIPS_AFL_EXT_4650 7 /* MIPS R4650 instruction. */
+#define MIPS_AFL_EXT_4010 8 /* LSI R4010 instruction. */
+#define MIPS_AFL_EXT_4100 9 /* NEC VR4100 instruction. */
+#define MIPS_AFL_EXT_3900 10 /* Toshiba R3900 instruction. */
+#define MIPS_AFL_EXT_10000 11 /* MIPS R10000 instruction. */
+#define MIPS_AFL_EXT_SB1 12 /* Broadcom SB-1 instruction. */
+#define MIPS_AFL_EXT_4111 13 /* NEC VR4111/VR4181 instruction. */
+#define MIPS_AFL_EXT_4120 14 /* NEC VR4120 instruction. */
+#define MIPS_AFL_EXT_5400 15 /* NEC VR5400 instruction. */
+#define MIPS_AFL_EXT_5500 16 /* NEC VR5500 instruction. */
+#define MIPS_AFL_EXT_LOONGSON_2E 17 /* ST Microelectronics Loongson 2E. */
+#define MIPS_AFL_EXT_LOONGSON_2F 18 /* ST Microelectronics Loongson 2F. */
+
+/* Masks for the flags1 word of an ABI flags structure. */
+#define MIPS_AFL_FLAGS1_ODDSPREG 1 /* Uses odd single-precision registers. */
+
+/* Object attribute values. */
+enum
+{
+ /* Not tagged or not using any ABIs affected by the differences. */
+ Val_GNU_MIPS_ABI_FP_ANY = 0,
+ /* Using hard-float -mdouble-float. */
+ Val_GNU_MIPS_ABI_FP_DOUBLE = 1,
+ /* Using hard-float -msingle-float. */
+ Val_GNU_MIPS_ABI_FP_SINGLE = 2,
+ /* Using soft-float. */
+ Val_GNU_MIPS_ABI_FP_SOFT = 3,
+ /* Using -mips32r2 -mfp64. */
+ Val_GNU_MIPS_ABI_FP_OLD_64 = 4,
+ /* Using -mfpxx. */
+ Val_GNU_MIPS_ABI_FP_XX = 5,
+ /* Using -mips32r2 -mfp64. */
+ Val_GNU_MIPS_ABI_FP_64 = 6,
+ /* Using -mips32r2 -mfp64 -mno-odd-spreg. */
+ Val_GNU_MIPS_ABI_FP_64A = 7,
+ /* Maximum allocated FP ABI value. */
+ Val_GNU_MIPS_ABI_FP_MAX = 7
+};
/* HPPA specific definitions. */
@@ -2096,6 +2194,8 @@ typedef Elf32_Addr Elf32_Conflict;
#define R_PPC_GOT_DTPREL16_LO 92 /* half16* (sym+add)@got@dtprel@l */
#define R_PPC_GOT_DTPREL16_HI 93 /* half16* (sym+add)@got@dtprel@h */
#define R_PPC_GOT_DTPREL16_HA 94 /* half16* (sym+add)@got@dtprel@ha */
+#define R_PPC_TLSGD 95 /* none (sym+add)@tlsgd */
+#define R_PPC_TLSLD 96 /* none (sym+add)@tlsld */
/* The remaining relocs are from the Embedded ELF ABI, and are not
in the SVR4 ELF ABI. */
@@ -2139,7 +2239,11 @@ typedef Elf32_Addr Elf32_Conflict;
/* PowerPC specific values for the Dyn d_tag field. */
#define DT_PPC_GOT (DT_LOPROC + 0)
-#define DT_PPC_NUM 1
+#define DT_PPC_OPT (DT_LOPROC + 1)
+#define DT_PPC_NUM 2
+
+/* PowerPC specific values for the DT_PPC_OPT Dyn entry. */
+#define PPC_OPT_TLS 1
/* PowerPC64 relocations defined by the ABIs */
#define R_PPC64_NONE R_PPC_NONE
@@ -2283,7 +2387,7 @@ typedef Elf32_Addr Elf32_Conflict;
#define DT_PPC64_OPD (DT_LOPROC + 1)
#define DT_PPC64_OPDSZ (DT_LOPROC + 2)
#define DT_PPC64_OPT (DT_LOPROC + 3)
-#define DT_PPC64_NUM 3
+#define DT_PPC64_NUM 4
/* PowerPC64 specific values for the DT_PPC64_OPT Dyn entry. */
#define PPC64_OPT_TLS 1
@@ -2362,6 +2466,20 @@ typedef Elf32_Addr Elf32_Conflict;
/* AArch64 relocs. */
#define R_AARCH64_NONE 0 /* No relocation. */
+
+/* ILP32 AArch64 relocs. */
+#define R_AARCH64_P32_ABS32 1 /* Direct 32 bit. */
+#define R_AARCH64_P32_COPY 180 /* Copy symbol at runtime. */
+#define R_AARCH64_P32_GLOB_DAT 181 /* Create GOT entry. */
+#define R_AARCH64_P32_JUMP_SLOT 182 /* Create PLT entry. */
+#define R_AARCH64_P32_RELATIVE 183 /* Adjust by program base. */
+#define R_AARCH64_P32_TLS_DTPMOD 184 /* Module number, 32 bit. */
+#define R_AARCH64_P32_TLS_DTPREL 185 /* Module-relative offset, 32 bit. */
+#define R_AARCH64_P32_TLS_TPREL 186 /* TP-relative offset, 32 bit. */
+#define R_AARCH64_P32_TLSDESC 187 /* TLS Descriptor. */
+#define R_AARCH64_P32_IRELATIVE 188 /* STT_GNU_IFUNC relocation. */
+
+/* LP64 AArch64 relocs. */
#define R_AARCH64_ABS64 257 /* Direct 64 bit. */
#define R_AARCH64_ABS32 258 /* Direct 32 bit. */
#define R_AARCH64_ABS16 259 /* Direct 16-bit. */
@@ -2479,9 +2597,9 @@ typedef Elf32_Addr Elf32_Conflict;
#define R_AARCH64_GLOB_DAT 1025 /* Create GOT entry. */
#define R_AARCH64_JUMP_SLOT 1026 /* Create PLT entry. */
#define R_AARCH64_RELATIVE 1027 /* Adjust by program base. */
-#define R_AARCH64_TLS_DTPMOD64 1028 /* Module number, 64 bit. */
-#define R_AARCH64_TLS_DTPREL64 1029 /* Module-relative offset, 64 bit. */
-#define R_AARCH64_TLS_TPREL64 1030 /* TP-relative offset, 64 bit. */
+#define R_AARCH64_TLS_DTPMOD 1028 /* Module number, 64 bit. */
+#define R_AARCH64_TLS_DTPREL 1029 /* Module-relative offset, 64 bit. */
+#define R_AARCH64_TLS_TPREL 1030 /* TP-relative offset, 64 bit. */
#define R_AARCH64_TLSDESC 1031 /* TLS Descriptor. */
#define R_AARCH64_IRELATIVE 1032 /* STT_GNU_IFUNC relocation. */
@@ -3132,6 +3250,58 @@ typedef Elf32_Addr Elf32_Conflict;
#define R_MICROBLAZE_TLSGOTTPREL32 28 /* TLS Offset From Thread Pointer. */
#define R_MICROBLAZE_TLSTPREL32 29 /* TLS Offset From Thread Pointer. */
+/* Legal values for d_tag (dynamic entry type). */
+#define DT_NIOS2_GP 0x70000002 /* Address of _gp. */
+
+/* Nios II relocations. */
+#define R_NIOS2_NONE 0 /* No reloc. */
+#define R_NIOS2_S16 1 /* Direct signed 16 bit. */
+#define R_NIOS2_U16 2 /* Direct unsigned 16 bit. */
+#define R_NIOS2_PCREL16 3 /* PC relative 16 bit. */
+#define R_NIOS2_CALL26 4 /* Direct call. */
+#define R_NIOS2_IMM5 5 /* 5 bit constant expression. */
+#define R_NIOS2_CACHE_OPX 6 /* 5 bit expression, shift 22. */
+#define R_NIOS2_IMM6 7 /* 6 bit constant expression. */
+#define R_NIOS2_IMM8 8 /* 8 bit constant expression. */
+#define R_NIOS2_HI16 9 /* High 16 bit. */
+#define R_NIOS2_LO16 10 /* Low 16 bit. */
+#define R_NIOS2_HIADJ16 11 /* High 16 bit, adjusted. */
+#define R_NIOS2_BFD_RELOC_32 12 /* 32 bit symbol value + addend. */
+#define R_NIOS2_BFD_RELOC_16 13 /* 16 bit symbol value + addend. */
+#define R_NIOS2_BFD_RELOC_8 14 /* 8 bit symbol value + addend. */
+#define R_NIOS2_GPREL 15 /* 16 bit GP pointer offset. */
+#define R_NIOS2_GNU_VTINHERIT 16 /* GNU C++ vtable hierarchy. */
+#define R_NIOS2_GNU_VTENTRY 17 /* GNU C++ vtable member usage. */
+#define R_NIOS2_UJMP 18 /* Unconditional branch. */
+#define R_NIOS2_CJMP 19 /* Conditional branch. */
+#define R_NIOS2_CALLR 20 /* Indirect call through register. */
+#define R_NIOS2_ALIGN 21 /* Alignment requirement for
+ linker relaxation. */
+#define R_NIOS2_GOT16 22 /* 16 bit GOT entry. */
+#define R_NIOS2_CALL16 23 /* 16 bit GOT entry for function. */
+#define R_NIOS2_GOTOFF_LO 24 /* %lo of offset to GOT pointer. */
+#define R_NIOS2_GOTOFF_HA 25 /* %hiadj of offset to GOT pointer. */
+#define R_NIOS2_PCREL_LO 26 /* %lo of PC relative offset. */
+#define R_NIOS2_PCREL_HA 27 /* %hiadj of PC relative offset. */
+#define R_NIOS2_TLS_GD16 28 /* 16 bit GOT offset for TLS GD. */
+#define R_NIOS2_TLS_LDM16 29 /* 16 bit GOT offset for TLS LDM. */
+#define R_NIOS2_TLS_LDO16 30 /* 16 bit module relative offset. */
+#define R_NIOS2_TLS_IE16 31 /* 16 bit GOT offset for TLS IE. */
+#define R_NIOS2_TLS_LE16 32 /* 16 bit LE TP-relative offset. */
+#define R_NIOS2_TLS_DTPMOD 33 /* Module number. */
+#define R_NIOS2_TLS_DTPREL 34 /* Module-relative offset. */
+#define R_NIOS2_TLS_TPREL 35 /* TP-relative offset. */
+#define R_NIOS2_COPY 36 /* Copy symbol at runtime. */
+#define R_NIOS2_GLOB_DAT 37 /* Create GOT entry. */
+#define R_NIOS2_JUMP_SLOT 38 /* Create PLT entry. */
+#define R_NIOS2_RELATIVE 39 /* Adjust by program base. */
+#define R_NIOS2_GOTOFF 40 /* 16 bit offset to GOT pointer. */
+#define R_NIOS2_CALL26_NOAT 41 /* Direct call in .noat section. */
+#define R_NIOS2_GOT_LO 42 /* %lo() of GOT entry. */
+#define R_NIOS2_GOT_HA 43 /* %hiadj() of GOT entry. */
+#define R_NIOS2_CALL_LO 44 /* %lo() of function GOT entry. */
+#define R_NIOS2_CALL_HA 45 /* %hiadj() of function GOT entry. */
+
/* TILEPro relocations. */
#define R_TILEPRO_NONE 0 /* No reloc */
#define R_TILEPRO_32 1 /* Direct 32 bit */
diff --git a/3rdparty/elfutils/libelf/elf32_getphdr.c b/3rdparty/elfutils/libelf/elf32_getphdr.c
index 1b82a48..38e489d 100644
--- a/3rdparty/elfutils/libelf/elf32_getphdr.c
+++ b/3rdparty/elfutils/libelf/elf32_getphdr.c
@@ -141,13 +141,20 @@ __elfw2(LIBELFBITS,getphdr_wrlock) (elf)
}
else
{
- if (ALLOW_UNALIGNED
- || ((uintptr_t) file_phdr
- & (__alignof__ (ElfW2(LIBELFBITS,Phdr)) - 1)) == 0)
+ bool copy = ! (ALLOW_UNALIGNED
+ || ((uintptr_t) file_phdr
+ & (__alignof__ (ElfW2(LIBELFBITS,Phdr))
+ - 1)) == 0);
+ if (! copy)
notcvt = file_phdr;
else
{
- notcvt = (ElfW2(LIBELFBITS,Phdr) *) alloca (size);
+ notcvt = (ElfW2(LIBELFBITS,Phdr) *) malloc (size);
+ if (unlikely (notcvt == NULL))
+ {
+ __libelf_seterrno (ELF_E_NOMEM);
+ goto out;
+ }
memcpy (notcvt, file_phdr, size);
}
@@ -162,6 +169,9 @@ __elfw2(LIBELFBITS,getphdr_wrlock) (elf)
CONVERT_TO (phdr[cnt].p_flags, notcvt[cnt].p_flags);
CONVERT_TO (phdr[cnt].p_align, notcvt[cnt].p_align);
}
+
+ if (copy)
+ free (notcvt);
}
}
}
diff --git a/3rdparty/elfutils/libelf/elf32_getshdr.c b/3rdparty/elfutils/libelf/elf32_getshdr.c
index 7417047..ee1aed8 100644
--- a/3rdparty/elfutils/libelf/elf32_getshdr.c
+++ b/3rdparty/elfutils/libelf/elf32_getshdr.c
@@ -111,15 +111,22 @@ load_shdr_wrlock (Elf_Scn *scn)
}
else
{
- if (ALLOW_UNALIGNED
- || ((uintptr_t) file_shdr
- & (__alignof__ (ElfW2(LIBELFBITS,Shdr)) - 1)) == 0)
+ bool copy = ! (ALLOW_UNALIGNED
+ || ((uintptr_t) file_shdr
+ & (__alignof__ (ElfW2(LIBELFBITS,Shdr)) - 1))
+ == 0);
+ if (! copy)
notcvt = (ElfW2(LIBELFBITS,Shdr) *)
((char *) elf->map_address
+ elf->start_offset + ehdr->e_shoff);
else
{
- notcvt = (ElfW2(LIBELFBITS,Shdr) *) alloca (size);
+ notcvt = (ElfW2(LIBELFBITS,Shdr) *) malloc (size);
+ if (unlikely (notcvt == NULL))
+ {
+ __libelf_seterrno (ELF_E_NOMEM);
+ goto out;
+ }
memcpy (notcvt, ((char *) elf->map_address
+ elf->start_offset + ehdr->e_shoff),
size);
@@ -153,6 +160,9 @@ load_shdr_wrlock (Elf_Scn *scn)
elf->state.ELFW(elf,LIBELFBITS).scns.data[cnt].shndx_index
= -1;
}
+
+ if (copy)
+ free (notcvt);
}
}
else if (likely (elf->fildes != -1))
diff --git a/3rdparty/elfutils/libelf/elf32_newphdr.c b/3rdparty/elfutils/libelf/elf32_newphdr.c
index 01038e7..f89153b 100644
--- a/3rdparty/elfutils/libelf/elf32_newphdr.c
+++ b/3rdparty/elfutils/libelf/elf32_newphdr.c
@@ -116,6 +116,17 @@ elfw2(LIBELFBITS,newphdr) (elf, count)
{
if (unlikely (count > SIZE_MAX / sizeof (ElfW2(LIBELFBITS,Phdr))))
{
+ __libelf_seterrno (ELF_E_INVALID_INDEX);
+ result = NULL;
+ goto out;
+ }
+
+ Elf_Scn *scn0 = &elf->state.ELFW(elf,LIBELFBITS).scns.data[0];
+ if (unlikely (count >= PN_XNUM && scn0->shdr.ELFW(e,LIBELFBITS) == NULL))
+ {
+ /* Something is wrong with section zero, but we need it to write
+ the extended phdr count. */
+ __libelf_seterrno (ELF_E_INVALID_SECTION_HEADER);
result = NULL;
goto out;
}
@@ -134,7 +145,6 @@ elfw2(LIBELFBITS,newphdr) (elf, count)
if (count >= PN_XNUM)
{
/* We have to write COUNT into the zeroth section's sh_info. */
- Elf_Scn *scn0 = &elf->state.ELFW(elf,LIBELFBITS).scns.data[0];
if (elf->state.ELFW(elf,LIBELFBITS).scns.cnt == 0)
{
assert (elf->state.ELFW(elf,LIBELFBITS).scns.max > 0);
diff --git a/3rdparty/elfutils/libelf/elf32_updatefile.c b/3rdparty/elfutils/libelf/elf32_updatefile.c
index 153e377..832f852 100644
--- a/3rdparty/elfutils/libelf/elf32_updatefile.c
+++ b/3rdparty/elfutils/libelf/elf32_updatefile.c
@@ -1,5 +1,5 @@
/* Write changed data structures.
- Copyright (C) 2000-2010, 2014 Red Hat, Inc.
+ Copyright (C) 2000-2010, 2014, 2015 Red Hat, Inc.
This file is part of elfutils.
Written by Ulrich Drepper <drepper@redhat.com>, 2000.
@@ -206,7 +206,12 @@ __elfw2(LIBELFBITS,updatemmap) (Elf *elf, int change_bo, size_t shnum)
return 1;
Elf_ScnList *list = &elf->state.ELFW(elf,LIBELFBITS).scns;
- Elf_Scn **scns = (Elf_Scn **) alloca (shnum * sizeof (Elf_Scn *));
+ Elf_Scn **scns = (Elf_Scn **) malloc (shnum * sizeof (Elf_Scn *));
+ if (unlikely (scns == NULL))
+ {
+ __libelf_seterrno (ELF_E_NOMEM);
+ return -1;
+ }
char *const shdr_start = ((char *) elf->map_address + elf->start_offset
+ ehdr->e_shoff);
char *const shdr_end = shdr_start + ehdr->e_shnum * ehdr->e_shentsize;
@@ -238,7 +243,12 @@ __elfw2(LIBELFBITS,updatemmap) (Elf *elf, int change_bo, size_t shnum)
< ((char *) elf->map_address + elf->start_offset
+ elf->maximum_size));
- void *p = alloca (sizeof (ElfW2(LIBELFBITS,Shdr)));
+ void *p = malloc (sizeof (ElfW2(LIBELFBITS,Shdr)));
+ if (unlikely (p == NULL))
+ {
+ __libelf_seterrno (ELF_E_NOMEM);
+ return -1;
+ }
scn->shdr.ELFW(e,LIBELFBITS)
= memcpy (p, scn->shdr.ELFW(e,LIBELFBITS),
sizeof (ElfW2(LIBELFBITS,Shdr)));
@@ -260,7 +270,7 @@ __elfw2(LIBELFBITS,updatemmap) (Elf *elf, int change_bo, size_t shnum)
> (char *) scn->data_list.data.d.d_buf))
{
void *p = malloc (scn->data_list.data.d.d_size);
- if (p == NULL)
+ if (unlikely (p == NULL))
{
__libelf_seterrno (ELF_E_NOMEM);
return -1;
@@ -357,7 +367,7 @@ __elfw2(LIBELFBITS,updatemmap) (Elf *elf, int change_bo, size_t shnum)
last_position += dl->data.d.d_size;
}
- else
+ else if (dl->data.d.d_size != 0)
last_position = mempcpy (last_position,
dl->data.d.d_buf,
dl->data.d.d_size);
@@ -421,12 +431,17 @@ __elfw2(LIBELFBITS,updatemmap) (Elf *elf, int change_bo, size_t shnum)
entry we now have to adjust the pointer again so
point to new place in the mapping. */
if (!elf->state.ELFW(elf,LIBELFBITS).shdr_malloced
- && (scn->shdr_flags & ELF_F_MALLOCED) == 0)
- scn->shdr.ELFW(e,LIBELFBITS) = &shdr_dest[scn->index];
+ && (scn->shdr_flags & ELF_F_MALLOCED) == 0
+ && scn->shdr.ELFW(e,LIBELFBITS) != &shdr_dest[scn->index])
+ {
+ free (scn->shdr.ELFW(e,LIBELFBITS));
+ scn->shdr.ELFW(e,LIBELFBITS) = &shdr_dest[scn->index];
+ }
scn->shdr_flags &= ~ELF_F_DIRTY;
}
}
+ free (scns);
}
/* That was the last part. Clear the overall flag. */
@@ -582,7 +597,7 @@ __elfw2(LIBELFBITS,updatefile) (Elf *elf, int change_bo, size_t shnum)
/* Allocate sufficient memory. */
tmp_phdr = (ElfW2(LIBELFBITS,Phdr) *)
malloc (sizeof (ElfW2(LIBELFBITS,Phdr)) * phnum);
- if (tmp_phdr == NULL)
+ if (unlikely (tmp_phdr == NULL))
{
__libelf_seterrno (ELF_E_NOMEM);
return 1;
@@ -640,17 +655,32 @@ __elfw2(LIBELFBITS,updatefile) (Elf *elf, int change_bo, size_t shnum)
#endif
ElfW2(LIBELFBITS,Shdr) *shdr_data;
+ ElfW2(LIBELFBITS,Shdr) *shdr_data_mem = NULL;
if (change_bo || elf->state.ELFW(elf,LIBELFBITS).shdr == NULL
|| (elf->flags & ELF_F_DIRTY))
- shdr_data = (ElfW2(LIBELFBITS,Shdr) *)
- alloca (shnum * sizeof (ElfW2(LIBELFBITS,Shdr)));
+ {
+ shdr_data_mem = (ElfW2(LIBELFBITS,Shdr) *)
+ malloc (shnum * sizeof (ElfW2(LIBELFBITS,Shdr)));
+ if (unlikely (shdr_data_mem == NULL))
+ {
+ __libelf_seterrno (ELF_E_NOMEM);
+ return -1;
+ }
+ shdr_data = shdr_data_mem;
+ }
else
shdr_data = elf->state.ELFW(elf,LIBELFBITS).shdr;
int shdr_flags = elf->flags;
/* Get all sections into the array and sort them. */
Elf_ScnList *list = &elf->state.ELFW(elf,LIBELFBITS).scns;
- Elf_Scn **scns = (Elf_Scn **) alloca (shnum * sizeof (Elf_Scn *));
+ Elf_Scn **scns = (Elf_Scn **) malloc (shnum * sizeof (Elf_Scn *));
+ if (unlikely (scns == NULL))
+ {
+ free (shdr_data_mem);
+ __libelf_seterrno (ELF_E_NOMEM);
+ return -1;
+ }
sort_sections (scns, list);
for (size_t cnt = 0; cnt < shnum; ++cnt)
@@ -685,7 +715,12 @@ __elfw2(LIBELFBITS,updatefile) (Elf *elf, int change_bo, size_t shnum)
(scn_start + dl->data.d.d_off)
- last_offset, fillbuf,
&filled) != 0))
- return 1;
+ {
+ fail_free:
+ free (shdr_data_mem);
+ free (scns);
+ return 1;
+ }
}
if ((scn->flags | dl->flags | elf->flags) & ELF_F_DIRTY)
@@ -714,10 +749,10 @@ __elfw2(LIBELFBITS,updatefile) (Elf *elf, int change_bo, size_t shnum)
if (dl->data.d.d_size > MAX_TMPBUF)
{
buf = malloc (dl->data.d.d_size);
- if (buf == NULL)
+ if (unlikely (buf == NULL))
{
__libelf_seterrno (ELF_E_NOMEM);
- return 1;
+ goto fail_free;
}
}
@@ -734,7 +769,7 @@ __elfw2(LIBELFBITS,updatefile) (Elf *elf, int change_bo, size_t shnum)
free (buf);
__libelf_seterrno (ELF_E_WRITE_ERROR);
- return 1;
+ goto fail_free;
}
if (buf != dl->data.d.d_buf && buf != tmpbuf)
@@ -759,7 +794,7 @@ __elfw2(LIBELFBITS,updatefile) (Elf *elf, int change_bo, size_t shnum)
if (unlikely (fill (elf->fildes, last_offset,
scn_start - last_offset, fillbuf,
&filled) != 0))
- return 1;
+ goto fail_free;
}
last_offset = scn_start + shdr->sh_size;
@@ -787,7 +822,7 @@ __elfw2(LIBELFBITS,updatefile) (Elf *elf, int change_bo, size_t shnum)
&& unlikely (fill (elf->fildes, last_offset,
shdr_offset - last_offset,
fillbuf, &filled) != 0))
- return 1;
+ goto fail_free;
/* Write out the section header table. */
if (shdr_flags & ELF_F_DIRTY
@@ -797,8 +832,11 @@ __elfw2(LIBELFBITS,updatefile) (Elf *elf, int change_bo, size_t shnum)
!= sizeof (ElfW2(LIBELFBITS,Shdr)) * shnum))
{
__libelf_seterrno (ELF_E_WRITE_ERROR);
- return 1;
+ goto fail_free;
}
+
+ free (shdr_data_mem);
+ free (scns);
}
/* That was the last part. Clear the overall flag. */
diff --git a/3rdparty/elfutils/libelf/elf32_updatenull.c b/3rdparty/elfutils/libelf/elf32_updatenull.c
index be4cea0..c59ffcb 100644
--- a/3rdparty/elfutils/libelf/elf32_updatenull.c
+++ b/3rdparty/elfutils/libelf/elf32_updatenull.c
@@ -1,5 +1,5 @@
/* Update data structures for changes.
- Copyright (C) 2000-2010 Red Hat, Inc.
+ Copyright (C) 2000-2010, 2015 Red Hat, Inc.
This file is part of elfutils.
Written by Ulrich Drepper <drepper@redhat.com>, 2000.
@@ -106,6 +106,14 @@ ELFW(default_ehdr,LIBELFBITS) (Elf *elf, ElfW2(LIBELFBITS,Ehdr) *ehdr,
elf->state.ELFW(elf,LIBELFBITS).ehdr_flags |= ELF_F_DIRTY;
}
+ /* If phnum is zero make sure e_phoff is also zero and not some random
+ value. That would cause trouble in update_file. */
+ if (ehdr->e_phnum == 0 && ehdr->e_phoff != 0)
+ {
+ ehdr->e_phoff = 0;
+ elf->state.ELFW(elf,LIBELFBITS).ehdr_flags |= ELF_F_DIRTY;
+ }
+
return 0;
}
@@ -202,6 +210,11 @@ __elfw2(LIBELFBITS,updatenull_wrlock) (Elf *elf, int *change_bop, size_t shnum)
assert (shdr != NULL);
ElfW2(LIBELFBITS,Word) sh_entsize = shdr->sh_entsize;
ElfW2(LIBELFBITS,Word) sh_align = shdr->sh_addralign ?: 1;
+ if (unlikely (! powerof2 (sh_align)))
+ {
+ __libelf_seterrno (ELF_E_INVALID_ALIGN);
+ return -1;
+ }
/* Set the sh_entsize value if we can reliably detect it. */
switch (shdr->sh_type)
@@ -318,9 +331,8 @@ __elfw2(LIBELFBITS,updatenull_wrlock) (Elf *elf, int *change_bop, size_t shnum)
if (elf->flags & ELF_F_LAYOUT)
{
size = MAX ((GElf_Word) size,
- shdr->sh_offset
- + (shdr->sh_type != SHT_NOBITS
- ? shdr->sh_size : 0));
+ (shdr->sh_type != SHT_NOBITS
+ ? shdr->sh_offset + shdr->sh_size : 0));
/* The alignment must be a power of two. This is a
requirement from the ELF specification. Additionally
@@ -328,7 +340,7 @@ __elfw2(LIBELFBITS,updatenull_wrlock) (Elf *elf, int *change_bop, size_t shnum)
enough for the largest alignment required by a data
block. */
if (unlikely (! powerof2 (shdr->sh_addralign))
- || unlikely (shdr->sh_addralign < sh_align))
+ || unlikely ((shdr->sh_addralign ?: 1) < sh_align))
{
__libelf_seterrno (ELF_E_INVALID_ALIGN);
return -1;
diff --git a/3rdparty/elfutils/libelf/elf_begin.c b/3rdparty/elfutils/libelf/elf_begin.c
index 30abe0b..f002ebf 100644
--- a/3rdparty/elfutils/libelf/elf_begin.c
+++ b/3rdparty/elfutils/libelf/elf_begin.c
@@ -1,5 +1,5 @@
/* Create descriptor for processing file.
- Copyright (C) 1998-2010, 2012, 2014 Red Hat, Inc.
+ Copyright (C) 1998-2010, 2012, 2014, 2015 Red Hat, Inc.
This file is part of elfutils.
Written by Ulrich Drepper <drepper@redhat.com>, 1998.
@@ -151,8 +151,8 @@ get_shnum (void *map_address, unsigned char *e_ident, int fildes, off_t offset,
if (likely (map_address != NULL) && e_ident[EI_DATA] == MY_ELFDATA
&& (ALLOW_UNALIGNED
- || (((size_t) ((char *) map_address + offset))
- & (__alignof__ (Elf32_Ehdr) - 1)) == 0))
+ || (((size_t) ((char *) map_address + ehdr.e32->e_shoff))
+ & (__alignof__ (Elf32_Shdr) - 1)) == 0))
/* We can directly access the memory. */
result = ((Elf32_Shdr *) ((char *) map_address + ehdr.e32->e_shoff
+ offset))->sh_size;
@@ -201,8 +201,8 @@ get_shnum (void *map_address, unsigned char *e_ident, int fildes, off_t offset,
Elf64_Xword size;
if (likely (map_address != NULL) && e_ident[EI_DATA] == MY_ELFDATA
&& (ALLOW_UNALIGNED
- || (((size_t) ((char *) map_address + offset))
- & (__alignof__ (Elf64_Ehdr) - 1)) == 0))
+ || (((size_t) ((char *) map_address + ehdr.e64->e_shoff))
+ & (__alignof__ (Elf64_Shdr) - 1)) == 0))
/* We can directly access the memory. */
size = ((Elf64_Shdr *) ((char *) map_address + ehdr.e64->e_shoff
+ offset))->sh_size;
@@ -306,17 +306,46 @@ file_read_elf (int fildes, void *map_address, unsigned char *e_ident,
/* This is a 32-bit binary. */
if (map_address != NULL && e_ident[EI_DATA] == MY_ELFDATA
&& (ALLOW_UNALIGNED
- || ((((uintptr_t) ehdr) & (__alignof__ (Elf32_Ehdr) - 1)) == 0
- && ((uintptr_t) ((char *) ehdr + ehdr->e_shoff)
- & (__alignof__ (Elf32_Shdr) - 1)) == 0
- && ((uintptr_t) ((char *) ehdr + ehdr->e_phoff)
- & (__alignof__ (Elf32_Phdr) - 1)) == 0)))
+ || (((uintptr_t) ehdr) & (__alignof__ (Elf32_Ehdr) - 1)) == 0))
{
/* We can use the mmapped memory. */
elf->state.elf32.ehdr = ehdr;
+ }
+ else
+ {
+ /* Copy the ELF header. */
+ elf->state.elf32.ehdr = memcpy (&elf->state.elf32.ehdr_mem, e_ident,
+ sizeof (Elf32_Ehdr));
- if (unlikely (ehdr->e_shoff >= maxsize)
- || unlikely (maxsize - ehdr->e_shoff
+ if (e_ident[EI_DATA] != MY_ELFDATA)
+ {
+ CONVERT (elf->state.elf32.ehdr_mem.e_type);
+ CONVERT (elf->state.elf32.ehdr_mem.e_machine);
+ CONVERT (elf->state.elf32.ehdr_mem.e_version);
+ CONVERT (elf->state.elf32.ehdr_mem.e_entry);
+ CONVERT (elf->state.elf32.ehdr_mem.e_phoff);
+ CONVERT (elf->state.elf32.ehdr_mem.e_shoff);
+ CONVERT (elf->state.elf32.ehdr_mem.e_flags);
+ CONVERT (elf->state.elf32.ehdr_mem.e_ehsize);
+ CONVERT (elf->state.elf32.ehdr_mem.e_phentsize);
+ CONVERT (elf->state.elf32.ehdr_mem.e_phnum);
+ CONVERT (elf->state.elf32.ehdr_mem.e_shentsize);
+ CONVERT (elf->state.elf32.ehdr_mem.e_shnum);
+ CONVERT (elf->state.elf32.ehdr_mem.e_shstrndx);
+ }
+ }
+
+ /* Don't precache the phdr pointer here.
+ elf32_getphdr will validate it against the size when asked. */
+
+ Elf32_Off e_shoff = elf->state.elf32.ehdr->e_shoff;
+ if (map_address != NULL && e_ident[EI_DATA] == MY_ELFDATA
+ && (ALLOW_UNALIGNED
+ || (((uintptr_t) ((char *) ehdr + e_shoff)
+ & (__alignof__ (Elf32_Shdr) - 1)) == 0)))
+ {
+ if (unlikely (e_shoff >= maxsize)
+ || unlikely (maxsize - e_shoff
< scncnt * sizeof (Elf32_Shdr)))
{
free_and_out:
@@ -325,10 +354,7 @@ file_read_elf (int fildes, void *map_address, unsigned char *e_ident,
return NULL;
}
elf->state.elf32.shdr
- = (Elf32_Shdr *) ((char *) ehdr + ehdr->e_shoff);
-
- /* Don't precache the phdr pointer here.
- elf32_getphdr will validate it against the size when asked. */
+ = (Elf32_Shdr *) ((char *) ehdr + e_shoff);
for (size_t cnt = 0; cnt < scncnt; ++cnt)
{
@@ -361,27 +387,6 @@ file_read_elf (int fildes, void *map_address, unsigned char *e_ident,
}
else
{
- /* Copy the ELF header. */
- elf->state.elf32.ehdr = memcpy (&elf->state.elf32.ehdr_mem, e_ident,
- sizeof (Elf32_Ehdr));
-
- if (e_ident[EI_DATA] != MY_ELFDATA)
- {
- CONVERT (elf->state.elf32.ehdr_mem.e_type);
- CONVERT (elf->state.elf32.ehdr_mem.e_machine);
- CONVERT (elf->state.elf32.ehdr_mem.e_version);
- CONVERT (elf->state.elf32.ehdr_mem.e_entry);
- CONVERT (elf->state.elf32.ehdr_mem.e_phoff);
- CONVERT (elf->state.elf32.ehdr_mem.e_shoff);
- CONVERT (elf->state.elf32.ehdr_mem.e_flags);
- CONVERT (elf->state.elf32.ehdr_mem.e_ehsize);
- CONVERT (elf->state.elf32.ehdr_mem.e_phentsize);
- CONVERT (elf->state.elf32.ehdr_mem.e_phnum);
- CONVERT (elf->state.elf32.ehdr_mem.e_shentsize);
- CONVERT (elf->state.elf32.ehdr_mem.e_shnum);
- CONVERT (elf->state.elf32.ehdr_mem.e_shstrndx);
- }
-
for (size_t cnt = 0; cnt < scncnt; ++cnt)
{
elf->state.elf32.scns.data[cnt].index = cnt;
@@ -402,24 +407,50 @@ file_read_elf (int fildes, void *map_address, unsigned char *e_ident,
/* This is a 64-bit binary. */
if (map_address != NULL && e_ident[EI_DATA] == MY_ELFDATA
&& (ALLOW_UNALIGNED
- || ((((uintptr_t) ehdr) & (__alignof__ (Elf64_Ehdr) - 1)) == 0
- && ((uintptr_t) ((char *) ehdr + ehdr->e_shoff)
- & (__alignof__ (Elf64_Shdr) - 1)) == 0
- && ((uintptr_t) ((char *) ehdr + ehdr->e_phoff)
- & (__alignof__ (Elf64_Phdr) - 1)) == 0)))
+ || (((uintptr_t) ehdr) & (__alignof__ (Elf64_Ehdr) - 1)) == 0))
{
/* We can use the mmapped memory. */
elf->state.elf64.ehdr = ehdr;
+ }
+ else
+ {
+ /* Copy the ELF header. */
+ elf->state.elf64.ehdr = memcpy (&elf->state.elf64.ehdr_mem, e_ident,
+ sizeof (Elf64_Ehdr));
- if (unlikely (ehdr->e_shoff >= maxsize)
- || unlikely (maxsize - ehdr->e_shoff
+ if (e_ident[EI_DATA] != MY_ELFDATA)
+ {
+ CONVERT (elf->state.elf64.ehdr_mem.e_type);
+ CONVERT (elf->state.elf64.ehdr_mem.e_machine);
+ CONVERT (elf->state.elf64.ehdr_mem.e_version);
+ CONVERT (elf->state.elf64.ehdr_mem.e_entry);
+ CONVERT (elf->state.elf64.ehdr_mem.e_phoff);
+ CONVERT (elf->state.elf64.ehdr_mem.e_shoff);
+ CONVERT (elf->state.elf64.ehdr_mem.e_flags);
+ CONVERT (elf->state.elf64.ehdr_mem.e_ehsize);
+ CONVERT (elf->state.elf64.ehdr_mem.e_phentsize);
+ CONVERT (elf->state.elf64.ehdr_mem.e_phnum);
+ CONVERT (elf->state.elf64.ehdr_mem.e_shentsize);
+ CONVERT (elf->state.elf64.ehdr_mem.e_shnum);
+ CONVERT (elf->state.elf64.ehdr_mem.e_shstrndx);
+ }
+ }
+
+ /* Don't precache the phdr pointer here.
+ elf64_getphdr will validate it against the size when asked. */
+
+ Elf64_Off e_shoff = elf->state.elf64.ehdr->e_shoff;
+ if (map_address != NULL && e_ident[EI_DATA] == MY_ELFDATA
+ && (ALLOW_UNALIGNED
+ || (((uintptr_t) ((char *) ehdr + e_shoff)
+ & (__alignof__ (Elf64_Shdr) - 1)) == 0)))
+ {
+ if (unlikely (e_shoff >= maxsize)
+ || unlikely (maxsize - e_shoff
< scncnt * sizeof (Elf64_Shdr)))
goto free_and_out;
elf->state.elf64.shdr
- = (Elf64_Shdr *) ((char *) ehdr + ehdr->e_shoff);
-
- /* Don't precache the phdr pointer here.
- elf64_getphdr will validate it against the size when asked. */
+ = (Elf64_Shdr *) ((char *) ehdr + e_shoff);
for (size_t cnt = 0; cnt < scncnt; ++cnt)
{
@@ -452,27 +483,6 @@ file_read_elf (int fildes, void *map_address, unsigned char *e_ident,
}
else
{
- /* Copy the ELF header. */
- elf->state.elf64.ehdr = memcpy (&elf->state.elf64.ehdr_mem, e_ident,
- sizeof (Elf64_Ehdr));
-
- if (e_ident[EI_DATA] != MY_ELFDATA)
- {
- CONVERT (elf->state.elf64.ehdr_mem.e_type);
- CONVERT (elf->state.elf64.ehdr_mem.e_machine);
- CONVERT (elf->state.elf64.ehdr_mem.e_version);
- CONVERT (elf->state.elf64.ehdr_mem.e_entry);
- CONVERT (elf->state.elf64.ehdr_mem.e_phoff);
- CONVERT (elf->state.elf64.ehdr_mem.e_shoff);
- CONVERT (elf->state.elf64.ehdr_mem.e_flags);
- CONVERT (elf->state.elf64.ehdr_mem.e_ehsize);
- CONVERT (elf->state.elf64.ehdr_mem.e_phentsize);
- CONVERT (elf->state.elf64.ehdr_mem.e_phnum);
- CONVERT (elf->state.elf64.ehdr_mem.e_shentsize);
- CONVERT (elf->state.elf64.ehdr_mem.e_shnum);
- CONVERT (elf->state.elf64.ehdr_mem.e_shstrndx);
- }
-
for (size_t cnt = 0; cnt < scncnt; ++cnt)
{
elf->state.elf64.scns.data[cnt].index = cnt;
@@ -749,10 +759,7 @@ read_long_names (Elf *elf)
}
/* NUL-terminate the string. */
- *runp = '\0';
-
- /* Skip the NUL byte and the \012. */
- runp += 2;
+ *runp++ = '\0';
/* A sanity check. Somebody might have generated invalid
archive. */
@@ -924,9 +931,16 @@ __libelf_next_arhdr_wrlock (elf)
INT_FIELD (ar_mode);
INT_FIELD (ar_size);
+ if (elf_ar_hdr->ar_size < 0)
+ {
+ __libelf_seterrno (ELF_E_INVALID_ARCHIVE);
+ return -1;
+ }
+
/* Truncated file? */
size_t maxsize;
- maxsize = elf->maximum_size - elf->state.ar.offset - sizeof (struct ar_hdr);
+ maxsize = (elf->start_offset + elf->maximum_size
+ - elf->state.ar.offset - sizeof (struct ar_hdr));
if ((size_t) elf_ar_hdr->ar_size > maxsize)
elf_ar_hdr->ar_size = maxsize;
diff --git a/3rdparty/elfutils/libelf/elf_getarsym.c b/3rdparty/elfutils/libelf/elf_getarsym.c
index 40633aa..8324244 100644
--- a/3rdparty/elfutils/libelf/elf_getarsym.c
+++ b/3rdparty/elfutils/libelf/elf_getarsym.c
@@ -1,5 +1,5 @@
/* Return symbol table of archive.
- Copyright (C) 1998-2000, 2002, 2005, 2009, 2012, 2014 Red Hat, Inc.
+ Copyright (C) 1998-2000, 2002, 2005, 2009, 2012, 2014, 2015 Red Hat, Inc.
This file is part of elfutils.
Written by Ulrich Drepper <drepper@redhat.com>, 1998.
@@ -106,6 +106,9 @@ elf_getarsym (elf, ptr)
/* In case we find no index remember this for the next call. */
elf->state.ar.ar_sym = (Elf_Arsym *) -1l;
+ /* We might have to allocate some temporary data for reading. */
+ void *temp_data = NULL;
+
struct ar_hdr *index_hdr;
if (elf->map_address == NULL)
{
@@ -210,7 +213,13 @@ elf_getarsym (elf, ptr)
if (elf->map_address == NULL)
{
- file_data = alloca (sz);
+ temp_data = malloc (sz);
+ if (unlikely (temp_data == NULL))
+ {
+ __libelf_seterrno (ELF_E_NOMEM);
+ goto out;
+ }
+ file_data = temp_data;
ar_sym_len += index_size - n * w;
Elf_Arsym *newp = (Elf_Arsym *) realloc (elf->state.ar.ar_sym,
@@ -246,7 +255,15 @@ elf_getarsym (elf, ptr)
file_data = (void *) (elf->map_address + off);
if (!ALLOW_UNALIGNED
&& ((uintptr_t) file_data & -(uintptr_t) n) != 0)
- file_data = memcpy (alloca (sz), elf->map_address + off, sz);
+ {
+ temp_data = malloc (sz);
+ if (unlikely (temp_data == NULL))
+ {
+ __libelf_seterrno (ELF_E_NOMEM);
+ goto out;
+ }
+ file_data = memcpy (temp_data, elf->map_address + off, sz);
+ }
str_data = (char *) (elf->map_address + off + sz);
}
@@ -299,6 +316,7 @@ elf_getarsym (elf, ptr)
result = elf->state.ar.ar_sym;
out:
+ free (temp_data);
rwlock_unlock (elf->lock);
}
diff --git a/3rdparty/elfutils/libelf/elf_getdata.c b/3rdparty/elfutils/libelf/elf_getdata.c
index 0aeb997..770e035 100644
--- a/3rdparty/elfutils/libelf/elf_getdata.c
+++ b/3rdparty/elfutils/libelf/elf_getdata.c
@@ -1,5 +1,5 @@
/* Return the next data element from the section after possibly converting it.
- Copyright (C) 1998-2005, 2006, 2007 Red Hat, Inc.
+ Copyright (C) 1998-2005, 2006, 2007, 2015 Red Hat, Inc.
This file is part of elfutils.
Written by Ulrich Drepper <drepper@redhat.com>, 1998.
@@ -83,8 +83,15 @@ const uint_fast8_t __libelf_type_aligns[EV_NUM - 1][ELFCLASSNUM - 1][ELF_T_NUM]
# define TYPE_ALIGNS(Bits) \
{ \
[ELF_T_ADDR] = __alignof__ (ElfW2(Bits,Addr)), \
+ [ELF_T_EHDR] = __alignof__ (ElfW2(Bits,Ehdr)), \
[ELF_T_HALF] = __alignof__ (ElfW2(Bits,Half)), \
+ [ELF_T_OFF] = __alignof__ (ElfW2(Bits,Off)), \
+ [ELF_T_PHDR] = __alignof__ (ElfW2(Bits,Phdr)), \
+ [ELF_T_SHDR] = __alignof__ (ElfW2(Bits,Shdr)), \
+ [ELF_T_SWORD] = __alignof__ (ElfW2(Bits,Sword)), \
[ELF_T_WORD] = __alignof__ (ElfW2(Bits,Word)), \
+ [ELF_T_XWORD] = __alignof__ (ElfW2(Bits,Xword)), \
+ [ELF_T_SXWORD] = __alignof__ (ElfW2(Bits,Sxword)), \
[ELF_T_SYM] = __alignof__ (ElfW2(Bits,Sym)), \
[ELF_T_SYMINFO] = __alignof__ (ElfW2(Bits,Syminfo)), \
[ELF_T_REL] = __alignof__ (ElfW2(Bits,Rel)), \
@@ -97,6 +104,8 @@ const uint_fast8_t __libelf_type_aligns[EV_NUM - 1][ELFCLASSNUM - 1][ELF_T_NUM]
[ELF_T_MOVE] = __alignof__ (ElfW2(Bits,Move)), \
[ELF_T_LIB] = __alignof__ (ElfW2(Bits,Lib)), \
[ELF_T_NHDR] = __alignof__ (ElfW2(Bits,Nhdr)), \
+ [ELF_T_GNUHASH] = __alignof__ (Elf32_Word), \
+ [ELF_T_AUXV] = __alignof__ (ElfW2(Bits,auxv_t)), \
}
[EV_CURRENT - 1] =
{
@@ -144,6 +153,25 @@ convert_data (Elf_Scn *scn, int version __attribute__ ((unused)), int eclass,
return;
}
+ /* Make sure the source is correctly aligned for the conversion
+ function to directly access the data elements. */
+ char *rawdata_source;
+ if (ALLOW_UNALIGNED ||
+ ((((size_t) (char *) scn->rawdata_base)) & (align - 1)) == 0)
+ rawdata_source = scn->rawdata_base;
+ else
+ {
+ rawdata_source = (char *) malloc (size);
+ if (rawdata_source == NULL)
+ {
+ __libelf_seterrno (ELF_E_NOMEM);
+ return;
+ }
+
+ /* The copy will be appropriately aligned for direct access. */
+ memcpy (rawdata_source, scn->rawdata_base, size);
+ }
+
/* Get the conversion function. */
#if EV_NUM != 2
fp = __elf_xfctstom[version - 1][__libelf_version - 1][eclass - 1][type];
@@ -151,7 +179,10 @@ convert_data (Elf_Scn *scn, int version __attribute__ ((unused)), int eclass,
fp = __elf_xfctstom[0][0][eclass - 1][type];
#endif
- fp (scn->data_base, scn->rawdata_base, size, 0);
+ fp (scn->data_base, rawdata_source, size, 0);
+
+ if (rawdata_source != scn->rawdata_base)
+ free (rawdata_source);
}
scn->data_list.data.d.d_buf = scn->data_base;
@@ -301,6 +332,20 @@ __libelf_set_rawdata_wrlock (Elf_Scn *scn)
else
scn->rawdata.d.d_type = shtype_map[LIBELF_EV_IDX][TYPEIDX (type)];
scn->rawdata.d.d_off = 0;
+
+ /* Make sure the alignment makes sense. d_align should be aligned both
+ in the section (trivially true since d_off is zero) and in the file.
+ Unfortunately we cannot be too strict because there are ELF files
+ out there that fail this requirement. We will try to fix those up
+ in elf_update when writing out the image. But for very large
+ alignment values this can bloat the image considerably. So here
+ just check and clamp the alignment value to not be bigger than the
+ actual offset of the data in the file. Given that there is always
+ at least an ehdr this will only trigger for alignment values > 64
+ which should be uncommon. */
+ align = align ?: 1;
+ if (align > offset)
+ align = offset;
scn->rawdata.d.d_align = align;
if (elf->class == ELFCLASS32
|| (offsetof (struct Elf, state.elf32.ehdr)
@@ -337,6 +382,44 @@ __libelf_set_rawdata (Elf_Scn *scn)
return result;
}
+void
+internal_function
+__libelf_set_data_list_rdlock (Elf_Scn *scn, int wrlocked)
+{
+ if (scn->rawdata.d.d_buf != NULL && scn->rawdata.d.d_size > 0)
+ {
+ Elf *elf = scn->elf;
+
+ /* Upgrade the lock to a write lock if necessary and check
+ nobody else already did the work. */
+ if (!wrlocked)
+ {
+ rwlock_unlock (elf->lock);
+ rwlock_wrlock (elf->lock);
+ if (scn->data_list_rear != NULL)
+ return;
+ }
+
+ /* Convert according to the version and the type. */
+ convert_data (scn, __libelf_version, elf->class,
+ (elf->class == ELFCLASS32
+ || (offsetof (struct Elf, state.elf32.ehdr)
+ == offsetof (struct Elf, state.elf64.ehdr))
+ ? elf->state.elf32.ehdr->e_ident[EI_DATA]
+ : elf->state.elf64.ehdr->e_ident[EI_DATA]),
+ scn->rawdata.d.d_size, scn->rawdata.d.d_type);
+ }
+ else
+ {
+ /* This is an empty or NOBITS section. There is no buffer but
+ the size information etc is important. */
+ scn->data_list.data.d = scn->rawdata.d;
+ scn->data_list.data.s = scn;
+ }
+
+ scn->data_list_rear = &scn->data_list;
+}
+
Elf_Data *
internal_function
__elf_getdata_rdlock (scn, data)
@@ -427,42 +510,10 @@ __elf_getdata_rdlock (scn, data)
empty in case the section has size zero (for whatever reason).
Now create the converted data in case this is necessary. */
if (scn->data_list_rear == NULL)
- {
- if (scn->rawdata.d.d_buf != NULL && scn->rawdata.d.d_size > 0)
- {
- if (!locked)
- {
- rwlock_unlock (elf->lock);
- rwlock_wrlock (elf->lock);
- if (scn->data_list_rear != NULL)
- goto pass;
- }
-
- /* Convert according to the version and the type. */
- convert_data (scn, __libelf_version, elf->class,
- (elf->class == ELFCLASS32
- || (offsetof (struct Elf, state.elf32.ehdr)
- == offsetof (struct Elf, state.elf64.ehdr))
- ? elf->state.elf32.ehdr->e_ident[EI_DATA]
- : elf->state.elf64.ehdr->e_ident[EI_DATA]),
- scn->rawdata.d.d_size, scn->rawdata.d.d_type);
- }
- else
- {
- /* This is an empty or NOBITS section. There is no buffer but
- the size information etc is important. */
- scn->data_list.data.d = scn->rawdata.d;
- scn->data_list.data.s = scn;
- }
-
- scn->data_list_rear = &scn->data_list;
- }
+ __libelf_set_data_list_rdlock (scn, locked);
- /* If no data is present we cannot return any. */
- if (scn->data_list_rear != NULL)
- pass:
- /* Return the first data element in the list. */
- result = &scn->data_list.data.d;
+ /* Return the first data element in the list. */
+ result = &scn->data_list.data.d;
out:
return result;
diff --git a/3rdparty/elfutils/libelf/elf_getdata_rawchunk.c b/3rdparty/elfutils/libelf/elf_getdata_rawchunk.c
index 63a9914..5cc11e7 100644
--- a/3rdparty/elfutils/libelf/elf_getdata_rawchunk.c
+++ b/3rdparty/elfutils/libelf/elf_getdata_rawchunk.c
@@ -79,9 +79,24 @@ elf_getdata_rawchunk (elf, offset, size, type)
rwlock_rdlock (elf->lock);
- /* If the file is mmap'ed we can use it directly. */
+ size_t align = __libelf_type_align (elf->class, type);
if (elf->map_address != NULL)
- rawchunk = elf->map_address + elf->start_offset + offset;
+ {
+ /* If the file is mmap'ed we can use it directly, if aligned for type. */
+ char *rawdata = elf->map_address + elf->start_offset + offset;
+ if (ALLOW_UNALIGNED ||
+ ((uintptr_t) rawdata & (align - 1)) == 0)
+ rawchunk = rawdata;
+ else
+ {
+ /* We allocate the memory and memcpy it to get aligned data. */
+ rawchunk = malloc (size);
+ if (rawchunk == NULL)
+ goto nomem;
+ memcpy (rawchunk, rawdata, size);
+ flags = ELF_F_MALLOCED;
+ }
+ }
else
{
/* We allocate the memory and read the data from the file. */
@@ -108,7 +123,6 @@ elf_getdata_rawchunk (elf, offset, size, type)
}
/* Copy and/or convert the data as needed for aligned native-order access. */
- size_t align = __libelf_type_align (elf->class, type);
void *buffer;
if (elf->state.elf32.ehdr->e_ident[EI_DATA] == MY_ELFDATA)
{
diff --git a/3rdparty/elfutils/libelf/elf_getphdrnum.c b/3rdparty/elfutils/libelf/elf_getphdrnum.c
index 63c27fb..f2fad87 100644
--- a/3rdparty/elfutils/libelf/elf_getphdrnum.c
+++ b/3rdparty/elfutils/libelf/elf_getphdrnum.c
@@ -80,23 +80,11 @@ __elf_getphdrnum_rdlock (elf, dst)
}
int
-elf_getphdrnum (elf, dst)
+__elf_getphdrnum_chk_rdlock (elf, dst)
Elf *elf;
size_t *dst;
{
- int result;
-
- if (elf == NULL)
- return -1;
-
- if (unlikely (elf->kind != ELF_K_ELF))
- {
- __libelf_seterrno (ELF_E_INVALID_HANDLE);
- return -1;
- }
-
- rwlock_rdlock (elf->lock);
- result = __elf_getphdrnum_rdlock (elf, dst);
+ int result = __elf_getphdrnum_rdlock (elf, dst);
/* Do some sanity checking to make sure phnum and phoff are consistent. */
Elf64_Off off = (elf->class == ELFCLASS32
@@ -105,14 +93,13 @@ elf_getphdrnum (elf, dst)
if (unlikely (off == 0))
{
*dst = 0;
- goto out;
+ return result;
}
if (unlikely (off >= elf->maximum_size))
{
__libelf_seterrno (ELF_E_INVALID_DATA);
- result = -1;
- goto out;
+ return -1;
}
/* Check for too many sections. */
@@ -121,15 +108,34 @@ elf_getphdrnum (elf, dst)
if (unlikely (*dst > SIZE_MAX / phdr_size))
{
__libelf_seterrno (ELF_E_INVALID_DATA);
- result = -1;
- goto out;
+ return -1;
}
/* Truncated file? Don't return more than can be indexed. */
if (unlikely (elf->maximum_size - off < *dst * phdr_size))
*dst = (elf->maximum_size - off) / phdr_size;
-out:
+ return result;
+}
+
+int
+elf_getphdrnum (elf, dst)
+ Elf *elf;
+ size_t *dst;
+{
+ int result;
+
+ if (elf == NULL)
+ return -1;
+
+ if (unlikely (elf->kind != ELF_K_ELF))
+ {
+ __libelf_seterrno (ELF_E_INVALID_HANDLE);
+ return -1;
+ }
+
+ rwlock_rdlock (elf->lock);
+ result = __elf_getphdrnum_chk_rdlock (elf, dst);
rwlock_unlock (elf->lock);
return result;
diff --git a/3rdparty/elfutils/libelf/elf_newdata.c b/3rdparty/elfutils/libelf/elf_newdata.c
index 90d1813..f6609a8 100644
--- a/3rdparty/elfutils/libelf/elf_newdata.c
+++ b/3rdparty/elfutils/libelf/elf_newdata.c
@@ -1,5 +1,5 @@
/* Create new, empty section data.
- Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc.
+ Copyright (C) 1998, 1999, 2000, 2001, 2002, 2015 Red Hat, Inc.
This file is part of elfutils.
Contributed by Ulrich Drepper <drepper@redhat.com>, 1998.
@@ -64,6 +64,25 @@ elf_newdata (Elf_Scn *scn)
rwlock_wrlock (scn->elf->lock);
+ /* data_read is set when data has been read from the ELF image or
+ when a new section has been created by elf_newscn. If data has
+ been read from the ELF image, then rawdata_base will point to raw
+ data. If data_read has been set by elf_newscn, then rawdata_base
+ will be NULL. data_list_rear will be set by elf_getdata if the
+ data has been converted, or by this function, elf_newdata, when
+ new data has been added.
+
+ Currently elf_getdata and elf_update rely on the fact that when
+ data_list_read is not NULL all they have to do is walk the data
+ list. They will ignore any (unread) raw data in that case.
+
+ So we need to make sure the data list is setup if there is
+ already data available. */
+ if (scn->data_read
+ && scn->rawdata_base != NULL
+ && scn->data_list_rear == NULL)
+ __libelf_set_data_list_rdlock (scn, 1);
+
if (scn->data_read && scn->data_list_rear == NULL)
{
/* This means the section was created by the user and this is the
@@ -73,6 +92,19 @@ elf_newdata (Elf_Scn *scn)
}
else
{
+ /* It would be more efficient to create new data without
+ reading/converting the data from the file. But then we
+ have to remember this. Currently elf_getdata and
+ elf_update rely on the fact that they don't have to
+ load/convert any data if data_list_rear is set. */
+ if (scn->data_read == 0)
+ {
+ if (__libelf_set_rawdata_wrlock (scn) != 0)
+ /* Something went wrong. The error value is already set. */
+ goto out;
+ __libelf_set_data_list_rdlock (scn, 1);
+ }
+
/* Create a new, empty data descriptor. */
result = (Elf_Data_List *) calloc (1, sizeof (Elf_Data_List));
if (result == NULL)
@@ -82,11 +114,6 @@ elf_newdata (Elf_Scn *scn)
}
result->flags = ELF_F_DIRTY | ELF_F_MALLOCED;
-
- if (scn->data_list_rear == NULL)
- /* We create new data without reading/converting the data from the
- file. That is fine but we have to remember this. */
- scn->data_list_rear = &scn->data_list;
}
/* Set the predefined values. */
diff --git a/3rdparty/elfutils/libelf/elf_strptr.c b/3rdparty/elfutils/libelf/elf_strptr.c
index 1f40429..e73bf36 100644
--- a/3rdparty/elfutils/libelf/elf_strptr.c
+++ b/3rdparty/elfutils/libelf/elf_strptr.c
@@ -1,5 +1,5 @@
/* Return string pointer from string section.
- Copyright (C) 1998, 1999, 2000, 2001, 2002, 2004, 2008, 2009 Red Hat, Inc.
+ Copyright (C) 1998-2002, 2004, 2008, 2009, 2015 Red Hat, Inc.
This file is part of elfutils.
Contributed by Ulrich Drepper <drepper@redhat.com>, 1998.
@@ -86,16 +86,19 @@ elf_strptr (elf, idx, offset)
}
}
+ size_t sh_size = 0;
if (elf->class == ELFCLASS32)
{
- if (unlikely (strscn->shdr.e32->sh_type != SHT_STRTAB))
+ Elf32_Shdr *shdr = strscn->shdr.e32 ?: __elf32_getshdr_rdlock (strscn);
+ if (unlikely (shdr->sh_type != SHT_STRTAB))
{
/* This is no string section. */
__libelf_seterrno (ELF_E_INVALID_SECTION);
goto out;
}
- if (unlikely (offset >= strscn->shdr.e32->sh_size))
+ sh_size = shdr->sh_size;
+ if (unlikely (offset >= shdr->sh_size))
{
/* The given offset is too big, it is beyond this section. */
__libelf_seterrno (ELF_E_OFFSET_RANGE);
@@ -104,14 +107,16 @@ elf_strptr (elf, idx, offset)
}
else
{
- if (unlikely (strscn->shdr.e64->sh_type != SHT_STRTAB))
+ Elf64_Shdr *shdr = strscn->shdr.e64 ?: __elf64_getshdr_rdlock (strscn);
+ if (unlikely (shdr->sh_type != SHT_STRTAB))
{
/* This is no string section. */
__libelf_seterrno (ELF_E_INVALID_SECTION);
goto out;
}
- if (unlikely (offset >= strscn->shdr.e64->sh_size))
+ sh_size = shdr->sh_size;
+ if (unlikely (offset >= shdr->sh_size))
{
/* The given offset is too big, it is beyond this section. */
__libelf_seterrno (ELF_E_OFFSET_RANGE);
@@ -129,12 +134,25 @@ elf_strptr (elf, idx, offset)
goto out;
}
- if (likely (strscn->rawdata_base != NULL))
- // XXX Is this correct if a file is read and then new data is added
- // XXX to the string section? Likely needs to check offset against
- // XXX size of rawdata_base buffer and then iterate over rest of the
- // XXX list.
- result = &strscn->rawdata_base[offset];
+ if (likely (strscn->data_list_rear == NULL))
+ {
+ // XXX The above is currently correct since elf_newdata will
+ // make sure to convert the rawdata into the datalist if
+ // necessary. But it would be more efficient to keep the rawdata
+ // unconverted and only then iterate over the rest of the (newly
+ // added data) list. Note that when the ELF file is mmapped
+ // rawdata_base can be set while rawdata.d hasn't been
+ // initialized yet (when data_read is zero). So we cannot just
+ // look at the rawdata.d.d_size.
+
+ /* Make sure the string is NUL terminated. Start from the end,
+ which very likely is a NUL char. */
+ if (likely (memrchr (&strscn->rawdata_base[offset],
+ '\0', sh_size - offset) != NULL))
+ result = &strscn->rawdata_base[offset];
+ else
+ __libelf_seterrno (ELF_E_INVALID_INDEX);
+ }
else
{
/* This is a file which is currently created. Use the list of
@@ -145,7 +163,16 @@ elf_strptr (elf, idx, offset)
if (offset >= (size_t) dl->data.d.d_off
&& offset < dl->data.d.d_off + dl->data.d.d_size)
{
- result = (char *) dl->data.d.d_buf + (offset - dl->data.d.d_off);
+ /* Make sure the string is NUL terminated. Start from
+ the end, which very likely is a NUL char. */
+ if (likely (memrchr ((char *) dl->data.d.d_buf
+ + (offset - dl->data.d.d_off), '\0',
+ (dl->data.d.d_size
+ - (offset - dl->data.d.d_off))) != NULL))
+ result = ((char *) dl->data.d.d_buf
+ + (offset - dl->data.d.d_off));
+ else
+ __libelf_seterrno (ELF_E_INVALID_INDEX);
break;
}
diff --git a/3rdparty/elfutils/libelf/elf_update.c b/3rdparty/elfutils/libelf/elf_update.c
index 54c20f5..9eb007b 100644
--- a/3rdparty/elfutils/libelf/elf_update.c
+++ b/3rdparty/elfutils/libelf/elf_update.c
@@ -1,5 +1,5 @@
/* Update data structures for changes and write them out.
- Copyright (C) 1999, 2000, 2001, 2002, 2004, 2005, 2006 Red Hat, Inc.
+ Copyright (C) 1999, 2000, 2001, 2002, 2004, 2005, 2006, 2015 Red Hat, Inc.
This file is part of elfutils.
Contributed by Ulrich Drepper <drepper@redhat.com>, 1999.
@@ -32,6 +32,7 @@
#endif
#include <libelf.h>
+#include <fcntl.h>
#include <unistd.h>
#include <sys/mman.h>
#include <sys/stat.h>
@@ -56,11 +57,22 @@ write_file (Elf *elf, off_t size, int change_bo, size_t shnum)
We cannot do this if this file is in an archive. We also don't
do it *now* if we are shortening the file since this would
prevent programs to use the data of the file in generating the
- new file. We truncate the file later in this case. */
+ new file. We truncate the file later in this case.
+
+ Note we use posix_fallocate to make sure the file content is really
+ there. Only using ftruncate might mean the file is extended, but space
+ isn't allocated yet. This might cause a SIGBUS once we write into
+ the mmapped space and the disk is full. Using fallocate might fail
+ on some file systems. posix_fallocate is required to extend the file
+ and allocate enough space even if the underlying filesystem would
+ normally return EOPNOTSUPP. Note that we do also need to ftruncate
+ in case the maximum_size isn't known and the file needs to be shorter
+ because posix_fallocate can only extend. */
if (elf->parent == NULL
&& (elf->maximum_size == ~((size_t) 0)
|| (size_t) size > elf->maximum_size)
- && unlikely (ftruncate (elf->fildes, size) != 0))
+ && unlikely (ftruncate (elf->fildes, size) != 0)
+ && unlikely (posix_fallocate (elf->fildes, 0, size) != 0))
{
__libelf_seterrno (ELF_E_WRITE_ERROR);
return -1;
@@ -94,6 +106,7 @@ write_file (Elf *elf, off_t size, int change_bo, size_t shnum)
size = -1;
}
+ /* Reduce the file size if necessary. */
if (size != -1
&& elf->parent == NULL
&& elf->maximum_size != ~((size_t) 0)
diff --git a/3rdparty/elfutils/libelf/gelf_getphdr.c b/3rdparty/elfutils/libelf/gelf_getphdr.c
index 3bf7123..1a6ee62 100644
--- a/3rdparty/elfutils/libelf/gelf_getphdr.c
+++ b/3rdparty/elfutils/libelf/gelf_getphdr.c
@@ -80,10 +80,8 @@ gelf_getphdr (elf, ndx, dst)
/* Test whether the index is ok. */
size_t phnum;
- if (ndx >= elf->state.elf32.ehdr->e_phnum
- && (elf->state.elf32.ehdr->e_phnum != PN_XNUM
- || __elf_getphdrnum_rdlock (elf, &phnum) != 0
- || (size_t) ndx >= phnum))
+ if (__elf_getphdrnum_chk_rdlock (elf, &phnum) != 0
+ || (size_t) ndx >= phnum)
{
__libelf_seterrno (ELF_E_INVALID_INDEX);
goto out;
@@ -122,10 +120,8 @@ gelf_getphdr (elf, ndx, dst)
/* Test whether the index is ok. */
size_t phnum;
- if (ndx >= elf->state.elf64.ehdr->e_phnum
- && (elf->state.elf64.ehdr->e_phnum != PN_XNUM
- || __elf_getphdrnum_rdlock (elf, &phnum) != 0
- || (size_t) ndx >= phnum))
+ if (__elf_getphdrnum_chk_rdlock (elf, &phnum) != 0
+ || (size_t) ndx >= phnum)
{
__libelf_seterrno (ELF_E_INVALID_INDEX);
goto out;
diff --git a/3rdparty/elfutils/libelf/gelf_xlate.c b/3rdparty/elfutils/libelf/gelf_xlate.c
index c417051..c5805e7 100644
--- a/3rdparty/elfutils/libelf/gelf_xlate.c
+++ b/3rdparty/elfutils/libelf/gelf_xlate.c
@@ -1,5 +1,5 @@
/* Transformation functions for ELF data types.
- Copyright (C) 1998,1999,2000,2002,2004,2005,2006,2007 Red Hat, Inc.
+ Copyright (C) 1998,1999,2000,2002,2004,2005,2006,2007,2015 Red Hat, Inc.
This file is part of elfutils.
Written by Ulrich Drepper <drepper@redhat.com>, 1998.
@@ -52,7 +52,8 @@ static void
(elf_cvt_Byte) (void *dest, const void *src, size_t n,
int encode __attribute__ ((unused)))
{
- memmove (dest, src, n);
+ if (n != 0)
+ memmove (dest, src, n);
}
diff --git a/3rdparty/elfutils/libelf/libelfP.h b/3rdparty/elfutils/libelf/libelfP.h
index 52cf745..3f4d654 100644
--- a/3rdparty/elfutils/libelf/libelfP.h
+++ b/3rdparty/elfutils/libelf/libelfP.h
@@ -511,6 +511,8 @@ extern Elf_Scn *__elf64_offscn_internal (Elf *__elf, Elf64_Off __offset)
attribute_hidden;
extern int __elf_getphdrnum_rdlock (Elf *__elf, size_t *__dst)
internal_function;
+extern int __elf_getphdrnum_chk_rdlock (Elf *__elf, size_t *__dst)
+ internal_function;
extern int __elf_getshdrnum_rdlock (Elf *__elf, size_t *__dst)
internal_function;
extern int __elf_getshdrstrndx_internal (Elf *__elf, size_t *__dst)
@@ -530,6 +532,12 @@ extern Elf_Data *__elf_getdata_rdlock (Elf_Scn *__scn, Elf_Data *__data)
internal_function;
extern Elf_Data *__elf_rawdata_internal (Elf_Scn *__scn, Elf_Data *__data)
attribute_hidden;
+/* Should be called to setup first section data element if
+ data_list_rear is NULL and we know data_read is set and there is
+ raw data available. Might upgrade the ELF lock from a read to a
+ write lock. If the lock is already a write lock set wrlocked. */
+extern void __libelf_set_data_list_rdlock (Elf_Scn *scn, int wrlocked)
+ internal_function;
extern char *__elf_strptr_internal (Elf *__elf, size_t __index,
size_t __offset) attribute_hidden;
extern Elf_Data *__elf32_xlatetom_internal (Elf_Data *__dest,
diff --git a/3rdparty/elfutils/libelf/nlist.c b/3rdparty/elfutils/libelf/nlist.c
index 41e5ff6..c7b32fd 100644
--- a/3rdparty/elfutils/libelf/nlist.c
+++ b/3rdparty/elfutils/libelf/nlist.c
@@ -1,5 +1,5 @@
/* Extract symbol list from binary.
- Copyright (C) 1998, 1999, 2000, 2001, 2002, 2005, 2007 Red Hat, Inc.
+ Copyright (C) 1998, 1999, 2000, 2001, 2002, 2005, 2007, 2015 Red Hat, Inc.
This file is part of elfutils.
Written by Ulrich Drepper <drepper@redhat.com>, 1998.
@@ -116,7 +116,11 @@ nlist (const char *filename, struct nlist *nl)
/* Re-get the section header in case we found only the dynamic symbol
table. */
if (scn == NULL)
- shdr = INTUSE(gelf_getshdr) (symscn, &shdr_mem);
+ {
+ shdr = INTUSE(gelf_getshdr) (symscn, &shdr_mem);
+ if (unlikely (shdr == NULL))
+ goto fail_close;
+ }
/* SHDR->SH_LINK now contains the index of the string section. */
/* Get the data for the symbol section. */
@@ -126,7 +130,7 @@ nlist (const char *filename, struct nlist *nl)
/* How many symbols are there? */
nsyms = (shdr->sh_size
- / INTUSE(gelf_fsize) (elf, ELF_T_SYM, 1, data->d_version));
+ / INTUSE(gelf_fsize) (elf, ELF_T_SYM, 1, EV_CURRENT));
/* Create the hash table. */
table = nlist_fshash_init (nsyms);
diff --git a/3rdparty/elfutils/libelf/version_xlate.h b/3rdparty/elfutils/libelf/version_xlate.h
index 16eaa19..9fe01c6 100644
--- a/3rdparty/elfutils/libelf/version_xlate.h
+++ b/3rdparty/elfutils/libelf/version_xlate.h
@@ -1,5 +1,5 @@
/* Conversion functions for versioning information.
- Copyright (C) 1998, 1999, 2000, 2002, 2003 Red Hat, Inc.
+ Copyright (C) 1998, 1999, 2000, 2002, 2003, 2015 Red Hat, Inc.
This file is part of elfutils.
Written by Ulrich Drepper <drepper@redhat.com>, 1998.
@@ -55,6 +55,11 @@ elf_cvt_Verdef (void *dest, const void *src, size_t len, int encode)
if (len == 0)
return;
+ /* Below we rely on the next field offsets to be correct, start by
+ copying over all data as is in case some data isn't translated.
+ We don't want to leave (undefined) garbage in the dest buffer. */
+ memmove (dest, src, len);
+
do
{
size_t aux_offset;
@@ -149,6 +154,11 @@ elf_cvt_Verneed (void *dest, const void *src, size_t len, int encode)
if (len == 0)
return;
+ /* Below we rely on the next field offsets to be correct, start by
+ copying over all data as is in case some data isn't translated.
+ We don't want to leave (undefined) garbage in the dest buffer. */
+ memmove (dest, src, len);
+
do
{
size_t aux_offset;
diff --git a/3rdparty/elfutils/qbs/imports/ElfUtilsProduct.qbs b/3rdparty/elfutils/qbs/imports/ElfUtilsProduct.qbs
index bcb0b74..9485b59 100644
--- a/3rdparty/elfutils/qbs/imports/ElfUtilsProduct.qbs
+++ b/3rdparty/elfutils/qbs/imports/ElfUtilsProduct.qbs
@@ -3,7 +3,7 @@ import qbs.FileInfo
Product {
Depends { name: "cpp" }
- version: "0.161"
+ version: "0.163"
cpp.cFlags: ["-std=gnu99"]
cpp.defines: ["HAVE_CONFIG_H", "_GNU_SOURCE"]
property string elfUtilsDir: FileInfo.joinPaths(path, "..", "..")
diff --git a/3rdparty/elfutils/version.h b/3rdparty/elfutils/version.h
index 7139c45..c3b8f52 100644
--- a/3rdparty/elfutils/version.h
+++ b/3rdparty/elfutils/version.h
@@ -30,7 +30,7 @@
#ifndef _ELFUTILS_VERSION_H
#define _ELFUTILS_VERSION_H 1
-#define _ELFUTILS_VERSION 161
+#define _ELFUTILS_VERSION 163
#define _ELFUTILS_PREREQ(major, minor) \
(_ELFUTILS_VERSION >= ((major) * 1000 + (minor)))