aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMark Wielaard <mark@klomp.org>2020-09-23 16:41:06 +0200
committerAndreas K. Hüttel <dilfridge@gentoo.org>2021-01-23 20:19:25 +0200
commit25af7d21d1e7e9243a9e8b60d873a0cccc6342dd (patch)
tree66f8a17da999c7041e95b8570a3a3063e7ba37f8
parentbinutils: Handle DWARF5 DW_FORM_ref_addr and DW_UT_partial. (diff)
downloadbinutils-gdb-25af7d21d1e7e9243a9e8b60d873a0cccc6342dd.tar.gz
binutils-gdb-25af7d21d1e7e9243a9e8b60d873a0cccc6342dd.tar.bz2
binutils-gdb-25af7d21d1e7e9243a9e8b60d873a0cccc6342dd.zip
Sync libiberty and include with GCC for get_DW_UT_name.
This adds a get_DW_UT_name function to dwarfnames using dwarf2.def for use in binutils readelf to show the unit types in a DWARF5 header. include/ChangeLog: Sync with GCC * dwarf2.def: Add DWARF5 Unit type header encoding macros DW_UT_FIRST, DW_UT and DW_UT_END. * dwarf2.h (enum dwarf_unit_type): Removed and define using DW_UT_FIRST, DW_UT and DW_UT_END macros. (get_DW_UT_name): New function declaration. libiberty/ChangeLog: Sync with GCC * dwarfnames.c (get_DW_UT_name): Define using DW_UT_FIRST, DW_UT and DW_UT_END. (cherry picked from commit d7b477c541bd31045483f37345727bd8335a052a) (cherry picked from commit d89b66edf5baac6febf636c130c9a1b748c0ce97)
-rw-r--r--include/ChangeLog12
-rw-r--r--include/dwarf2.def11
-rw-r--r--include/dwarf2.h24
-rw-r--r--libiberty/ChangeLog9
-rw-r--r--libiberty/dwarfnames.c7
5 files changed, 50 insertions, 13 deletions
diff --git a/include/ChangeLog b/include/ChangeLog
index acdd85fc4d..5997c26899 100644
--- a/include/ChangeLog
+++ b/include/ChangeLog
@@ -1,3 +1,15 @@
+2020-11-15 Mark Wielaard <mark@klomp.org>
+
+ Backport from the mainline:
+ 2020-09-23 Mark Wielaard <mark@klomp.org>
+
+ Sync with GCC
+ * dwarf2.def: Add DWARF5 Unit type header encoding macros
+ DW_UT_FIRST, DW_UT and DW_UT_END.
+ * dwarf2.h (enum dwarf_unit_type): Removed and define using
+ DW_UT_FIRST, DW_UT and DW_UT_END macros.
+ (get_DW_UT_name): New function declaration.
+
2020-07-22 H.J. Lu <hongjiu.lu@intel.com>
PR ld/26262
diff --git a/include/dwarf2.def b/include/dwarf2.def
index d8a8cce794..13825a3eef 100644
--- a/include/dwarf2.def
+++ b/include/dwarf2.def
@@ -805,3 +805,14 @@ DW_IDX (DW_IDX_hi_user, 0x3fff)
DW_IDX (DW_IDX_GNU_internal, 0x2000)
DW_IDX (DW_IDX_GNU_external, 0x2001)
DW_END_IDX
+
+/* DWARF5 Unit type header encodings */
+DW_FIRST_UT (DW_UT_compile, 0x01)
+DW_UT (DW_UT_type, 0x02)
+DW_UT (DW_UT_partial, 0x03)
+DW_UT (DW_UT_skeleton, 0x04)
+DW_UT (DW_UT_split_compile, 0x05)
+DW_UT (DW_UT_split_type, 0x06)
+DW_UT (DW_UT_lo_user, 0x80)
+DW_UT (DW_UT_hi_user, 0xff)
+DW_END_UT
diff --git a/include/dwarf2.h b/include/dwarf2.h
index 882453dce0..3f271fb0f7 100644
--- a/include/dwarf2.h
+++ b/include/dwarf2.h
@@ -55,6 +55,7 @@
#define DW_CFA_DUP(name, value) , name = value
#define DW_IDX(name, value) , name = value
#define DW_IDX_DUP(name, value) , name = value
+#define DW_UT(name, value) , name = value
#define DW_FIRST_TAG(name, value) enum dwarf_tag { \
name = value
@@ -77,6 +78,9 @@
#define DW_FIRST_IDX(name, value) enum dwarf_name_index_attribute { \
name = value
#define DW_END_IDX };
+#define DW_FIRST_UT(name, value) enum dwarf_unit_type { \
+ name = value
+#define DW_END_UT };
#include "dwarf2.def"
@@ -94,6 +98,8 @@
#undef DW_END_CFA
#undef DW_FIRST_IDX
#undef DW_END_IDX
+#undef DW_FIRST_UT
+#undef DW_END_UT
#undef DW_TAG
#undef DW_TAG_DUP
@@ -108,6 +114,7 @@
#undef DW_CFA_DUP
#undef DW_IDX
#undef DW_IDX_DUP
+#undef DW_UT
/* Flag that tells whether entry has a child or not. */
#define DW_children_no 0
@@ -450,19 +457,6 @@ enum dwarf_range_list_entry
DW_RLE_start_end = 0x06,
DW_RLE_start_length = 0x07
};
-
-/* Unit types in unit_type unit header field. */
-enum dwarf_unit_type
- {
- DW_UT_compile = 0x01,
- DW_UT_type = 0x02,
- DW_UT_partial = 0x03,
- DW_UT_skeleton = 0x04,
- DW_UT_split_compile = 0x05,
- DW_UT_split_type = 0x06,
- DW_UT_lo_user = 0x80,
- DW_UT_hi_user = 0xff
- };
/* @@@ For use with GNU frame unwind information. */
@@ -534,6 +528,10 @@ extern const char *get_DW_CFA_name (unsigned int opc);
recognized. */
extern const char *get_DW_IDX_name (unsigned int idx);
+/* Return the name of a DW_UT_ constant, or NULL if the value is not
+ recognized. */
+extern const char *get_DW_UT_name (unsigned int ut);
+
#ifdef __cplusplus
}
#endif /* __cplusplus */
diff --git a/libiberty/ChangeLog b/libiberty/ChangeLog
index 19d2b702d6..42daff1594 100644
--- a/libiberty/ChangeLog
+++ b/libiberty/ChangeLog
@@ -1,3 +1,12 @@
+2020-11-15 Mark Wielaard <mark@klomp.org>
+
+ Backport from the mainline:
+ 2020-09-23 Mark Wielaard <mark@klomp.org>
+
+ Sync with GCC
+ * dwarfnames.c (get_DW_UT_name): Define using DW_UT_FIRST, DW_UT
+ and DW_UT_END.
+
2020-06-23 Nick Alcock <nick.alcock@oracle.com>
* bsearch_r.c: New file.
diff --git a/libiberty/dwarfnames.c b/libiberty/dwarfnames.c
index 968d191753..af11668b43 100644
--- a/libiberty/dwarfnames.c
+++ b/libiberty/dwarfnames.c
@@ -64,6 +64,11 @@ Boston, MA 02110-1301, USA. */
switch (idx) { \
DW_IDX (name, value)
#define DW_END_IDX } return 0; }
+#define DW_FIRST_UT(name, value) \
+ const char *get_DW_UT_name (unsigned int ut) { \
+ switch (ut) { \
+ DW_UT (name, value)
+#define DW_END_UT } return 0; }
#define DW_TAG(name, value) case name: return # name ;
#define DW_TAG_DUP(name, value)
@@ -78,6 +83,7 @@ Boston, MA 02110-1301, USA. */
#define DW_CFA_DUP(name, value)
#define DW_IDX(name, value) case name: return # name ;
#define DW_IDX_DUP(name, value)
+#define DW_UT(name, value) case name: return # name ;
#include "dwarf2.def"
@@ -95,6 +101,7 @@ Boston, MA 02110-1301, USA. */
#undef DW_END_CFA
#undef DW_FIRST_IDX
#undef DW_END_IDX
+#undef DW_END_UT
#undef DW_TAG
#undef DW_TAG_DUP