diff options
author | Khem Raj <raj.khem@gmail.com> | 2021-04-20 11:28:37 -0700 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2021-04-23 10:12:10 +0100 |
commit | 70a757bbecf242566d02a0d4ef801930a5ffefdf (patch) | |
tree | c24ec3fbaab877000bd28b5aa2f9d081bb163b79 | |
parent | c13be2e1dc927b92297d27dd6bfd1fe0b1b95efe (diff) | |
download | poky-70a757bbecf242566d02a0d4ef801930a5ffefdf.tar.gz |
binutils: Fix linking failures when using dwarf-5
Since GCC 11 will switch to dwarf-5 as default, this patch will be
required soon
(From OE-Core rev: 9dc9bf85f53c6712dd047df5fd718e9895946fd5)
Signed-off-by: Khem Raj <raj.khem@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r-- | meta/recipes-devtools/binutils/binutils-2.36.inc | 1 | ||||
-rw-r--r-- | meta/recipes-devtools/binutils/binutils/0017-Add-support-for-the-DW_FORM_strx-forms-to-the-BFD-li.patch | 183 |
2 files changed, 184 insertions, 0 deletions
diff --git a/meta/recipes-devtools/binutils/binutils-2.36.inc b/meta/recipes-devtools/binutils/binutils-2.36.inc index d2ededb728..beddf601fd 100644 --- a/meta/recipes-devtools/binutils/binutils-2.36.inc +++ b/meta/recipes-devtools/binutils/binutils-2.36.inc | |||
@@ -35,5 +35,6 @@ SRC_URI = "\ | |||
35 | file://0014-Fix-rpath-in-libtool-when-sysroot-is-enabled.patch \ | 35 | file://0014-Fix-rpath-in-libtool-when-sysroot-is-enabled.patch \ |
36 | file://0015-sync-with-OE-libtool-changes.patch \ | 36 | file://0015-sync-with-OE-libtool-changes.patch \ |
37 | file://0016-Check-for-clang-before-checking-gcc-version.patch \ | 37 | file://0016-Check-for-clang-before-checking-gcc-version.patch \ |
38 | file://0017-Add-support-for-the-DW_FORM_strx-forms-to-the-BFD-li.patch \ | ||
38 | " | 39 | " |
39 | S = "${WORKDIR}/git" | 40 | S = "${WORKDIR}/git" |
diff --git a/meta/recipes-devtools/binutils/binutils/0017-Add-support-for-the-DW_FORM_strx-forms-to-the-BFD-li.patch b/meta/recipes-devtools/binutils/binutils/0017-Add-support-for-the-DW_FORM_strx-forms-to-the-BFD-li.patch new file mode 100644 index 0000000000..b4880e0d14 --- /dev/null +++ b/meta/recipes-devtools/binutils/binutils/0017-Add-support-for-the-DW_FORM_strx-forms-to-the-BFD-li.patch | |||
@@ -0,0 +1,183 @@ | |||
1 | From a50c11a7a47b26e6a3e095dfb72aa2e465919fb6 Mon Sep 17 00:00:00 2001 | ||
2 | From: Nick Clifton <nickc@redhat.com> | ||
3 | Date: Fri, 5 Mar 2021 17:06:59 +0000 | ||
4 | Subject: [PATCH] Add support for the DW_FORM_strx* forms to the BFD library. | ||
5 | |||
6 | PR 27521 | ||
7 | * dwarf2.c (is_str_attr): Add DW_FORM_strx* forms. | ||
8 | (read_indexed_string): Placeholder function. | ||
9 | (read_attribute_value): Handle DW_FORM_strx* and DW_FORM_addrx* | ||
10 | forms. | ||
11 | |||
12 | Upstream-Status: Backport [https://sourceware.org/bugzilla/show_bug.cgi?id=27521] | ||
13 | Signed-off-by: Khem Raj <raj.khem@gmail.com> | ||
14 | --- | ||
15 | bfd/dwarf2.c | 105 ++++++++++++++++++++++++++++++++------------------- | ||
16 | 1 file changed, 67 insertions(+), 38 deletions(-) | ||
17 | |||
18 | diff --git a/bfd/dwarf2.c b/bfd/dwarf2.c | ||
19 | index 5651696c0f7..5ffcd93f54c 100644 | ||
20 | --- a/bfd/dwarf2.c | ||
21 | +++ b/bfd/dwarf2.c | ||
22 | @@ -1160,8 +1160,23 @@ read_abbrevs (bfd *abfd, bfd_uint64_t offset, struct dwarf2_debug *stash, | ||
23 | static inline bfd_boolean | ||
24 | is_str_attr (enum dwarf_form form) | ||
25 | { | ||
26 | - return (form == DW_FORM_string || form == DW_FORM_strp | ||
27 | - || form == DW_FORM_line_strp || form == DW_FORM_GNU_strp_alt); | ||
28 | + return (form == DW_FORM_string | ||
29 | + || form == DW_FORM_strp | ||
30 | + || form == DW_FORM_strx | ||
31 | + || form == DW_FORM_strx1 | ||
32 | + || form == DW_FORM_strx2 | ||
33 | + || form == DW_FORM_strx3 | ||
34 | + || form == DW_FORM_strx4 | ||
35 | + || form == DW_FORM_line_strp | ||
36 | + || form == DW_FORM_GNU_strp_alt); | ||
37 | +} | ||
38 | + | ||
39 | +static const char * | ||
40 | +read_indexed_string (bfd_uint64_t index ATTRIBUTE_UNUSED, | ||
41 | + struct comp_unit * unit ATTRIBUTE_UNUSED) | ||
42 | +{ | ||
43 | + /* FIXME: Add support for indexed strings. */ | ||
44 | + return "<indexed strings not yet supported>"; | ||
45 | } | ||
46 | |||
47 | /* Read and fill in the value of attribute ATTR as described by FORM. | ||
48 | @@ -1192,6 +1207,9 @@ read_attribute_value (struct attribute * attr, | ||
49 | |||
50 | switch (form) | ||
51 | { | ||
52 | + case DW_FORM_flag_present: | ||
53 | + attr->u.val = 1; | ||
54 | + break; | ||
55 | case DW_FORM_ref_addr: | ||
56 | /* DW_FORM_ref_addr is an address in DWARF2, and an offset in | ||
57 | DWARF3. */ | ||
58 | @@ -1237,15 +1255,32 @@ read_attribute_value (struct attribute * attr, | ||
59 | info_ptr = read_n_bytes (info_ptr, info_ptr_end, blk); | ||
60 | attr->u.blk = blk; | ||
61 | break; | ||
62 | + case DW_FORM_ref1: | ||
63 | + case DW_FORM_flag: | ||
64 | + case DW_FORM_data1: | ||
65 | + case DW_FORM_addrx1: | ||
66 | + attr->u.val = read_1_byte (abfd, info_ptr, info_ptr_end); | ||
67 | + info_ptr += 1; | ||
68 | + break; | ||
69 | case DW_FORM_data2: | ||
70 | + case DW_FORM_ref2: | ||
71 | attr->u.val = read_2_bytes (abfd, info_ptr, info_ptr_end); | ||
72 | info_ptr += 2; | ||
73 | break; | ||
74 | + case DW_FORM_addrx3: | ||
75 | + attr->u.val = read_4_bytes (abfd, info_ptr, info_ptr_end); | ||
76 | + attr->u.val &= 0xffffff; | ||
77 | + info_ptr += 3; | ||
78 | + break; | ||
79 | + case DW_FORM_ref4: | ||
80 | case DW_FORM_data4: | ||
81 | + case DW_FORM_addrx4: | ||
82 | attr->u.val = read_4_bytes (abfd, info_ptr, info_ptr_end); | ||
83 | info_ptr += 4; | ||
84 | break; | ||
85 | case DW_FORM_data8: | ||
86 | + case DW_FORM_ref8: | ||
87 | + case DW_FORM_ref_sig8: | ||
88 | attr->u.val = read_8_bytes (abfd, info_ptr, info_ptr_end); | ||
89 | info_ptr += 8; | ||
90 | break; | ||
91 | @@ -1265,6 +1300,33 @@ read_attribute_value (struct attribute * attr, | ||
92 | attr->u.str = read_alt_indirect_string (unit, info_ptr, info_ptr_end, &bytes_read); | ||
93 | info_ptr += bytes_read; | ||
94 | break; | ||
95 | + case DW_FORM_strx1: | ||
96 | + attr->u.val = read_1_byte (abfd, info_ptr, info_ptr_end); | ||
97 | + info_ptr += 1; | ||
98 | + attr->u.str = (char *) read_indexed_string (attr->u.val, unit); | ||
99 | + break; | ||
100 | + case DW_FORM_strx2: | ||
101 | + attr->u.val = read_2_bytes (abfd, info_ptr, info_ptr_end); | ||
102 | + info_ptr += 2; | ||
103 | + attr->u.str = (char *) read_indexed_string (attr->u.val, unit); | ||
104 | + break; | ||
105 | + case DW_FORM_strx3: | ||
106 | + attr->u.val = read_4_bytes (abfd, info_ptr, info_ptr_end); | ||
107 | + info_ptr += 3; | ||
108 | + attr->u.val &= 0xffffff; | ||
109 | + attr->u.str = (char *) read_indexed_string (attr->u.val, unit); | ||
110 | + break; | ||
111 | + case DW_FORM_strx4: | ||
112 | + attr->u.val = read_4_bytes (abfd, info_ptr, info_ptr_end); | ||
113 | + info_ptr += 4; | ||
114 | + attr->u.str = (char *) read_indexed_string (attr->u.val, unit); | ||
115 | + break; | ||
116 | + case DW_FORM_strx: | ||
117 | + attr->u.val = _bfd_safe_read_leb128 (abfd, info_ptr, &bytes_read, | ||
118 | + FALSE, info_ptr_end); | ||
119 | + info_ptr += bytes_read; | ||
120 | + attr->u.str = (char *) read_indexed_string (attr->u.val, unit); | ||
121 | + break; | ||
122 | case DW_FORM_exprloc: | ||
123 | case DW_FORM_block: | ||
124 | amt = sizeof (struct dwarf_block); | ||
125 | @@ -1287,48 +1349,14 @@ read_attribute_value (struct attribute * attr, | ||
126 | info_ptr = read_n_bytes (info_ptr, info_ptr_end, blk); | ||
127 | attr->u.blk = blk; | ||
128 | break; | ||
129 | - case DW_FORM_data1: | ||
130 | - attr->u.val = read_1_byte (abfd, info_ptr, info_ptr_end); | ||
131 | - info_ptr += 1; | ||
132 | - break; | ||
133 | - case DW_FORM_flag: | ||
134 | - attr->u.val = read_1_byte (abfd, info_ptr, info_ptr_end); | ||
135 | - info_ptr += 1; | ||
136 | - break; | ||
137 | - case DW_FORM_flag_present: | ||
138 | - attr->u.val = 1; | ||
139 | - break; | ||
140 | case DW_FORM_sdata: | ||
141 | attr->u.sval = _bfd_safe_read_leb128 (abfd, info_ptr, &bytes_read, | ||
142 | TRUE, info_ptr_end); | ||
143 | info_ptr += bytes_read; | ||
144 | break; | ||
145 | - case DW_FORM_udata: | ||
146 | - attr->u.val = _bfd_safe_read_leb128 (abfd, info_ptr, &bytes_read, | ||
147 | - FALSE, info_ptr_end); | ||
148 | - info_ptr += bytes_read; | ||
149 | - break; | ||
150 | - case DW_FORM_ref1: | ||
151 | - attr->u.val = read_1_byte (abfd, info_ptr, info_ptr_end); | ||
152 | - info_ptr += 1; | ||
153 | - break; | ||
154 | - case DW_FORM_ref2: | ||
155 | - attr->u.val = read_2_bytes (abfd, info_ptr, info_ptr_end); | ||
156 | - info_ptr += 2; | ||
157 | - break; | ||
158 | - case DW_FORM_ref4: | ||
159 | - attr->u.val = read_4_bytes (abfd, info_ptr, info_ptr_end); | ||
160 | - info_ptr += 4; | ||
161 | - break; | ||
162 | - case DW_FORM_ref8: | ||
163 | - attr->u.val = read_8_bytes (abfd, info_ptr, info_ptr_end); | ||
164 | - info_ptr += 8; | ||
165 | - break; | ||
166 | - case DW_FORM_ref_sig8: | ||
167 | - attr->u.val = read_8_bytes (abfd, info_ptr, info_ptr_end); | ||
168 | - info_ptr += 8; | ||
169 | - break; | ||
170 | case DW_FORM_ref_udata: | ||
171 | + case DW_FORM_udata: | ||
172 | + case DW_FORM_addrx: | ||
173 | attr->u.val = _bfd_safe_read_leb128 (abfd, info_ptr, &bytes_read, | ||
174 | FALSE, info_ptr_end); | ||
175 | info_ptr += bytes_read; | ||
176 | @@ -1361,6 +1389,7 @@ read_attribute_value (struct attribute * attr, | ||
177 | info_ptr = read_n_bytes (info_ptr, info_ptr_end, blk); | ||
178 | attr->u.blk = blk; | ||
179 | break; | ||
180 | + | ||
181 | default: | ||
182 | _bfd_error_handler (_("DWARF error: invalid or unhandled FORM value: %#x"), | ||
183 | form); | ||