1 |
commit: 1f60892479e9e14d72f33c6ae9dfae7d9c67660d |
2 |
Author: Dan Robertson <dan <AT> dlrobertson <DOT> com> |
3 |
AuthorDate: Sun May 17 02:01:39 2020 +0000 |
4 |
Commit: Anthony G. Basile <blueness <AT> gentoo <DOT> org> |
5 |
CommitDate: Mon May 25 23:40:51 2020 +0000 |
6 |
URL: https://gitweb.gentoo.org/proj/musl.git/commit/?id=1f608924 |
7 |
|
8 |
dev-util/dwarves: patch for musl build |
9 |
|
10 |
Signed-off-by: Dan Robertson <dan <AT> dlrobertson.com> |
11 |
Signed-off-by: Anthony G. Basile <blueness <AT> gentoo.org> |
12 |
|
13 |
dev-util/dwarves/Manifest | 1 + |
14 |
dev-util/dwarves/dwarves-1.17.ebuild | 46 +++++ |
15 |
.../dwarves/files/dwarves-1.10-python-import.patch | 15 ++ |
16 |
dev-util/dwarves/files/dwarves-1.17-musl.patch | 190 +++++++++++++++++++++ |
17 |
dev-util/dwarves/metadata.xml | 5 + |
18 |
5 files changed, 257 insertions(+) |
19 |
|
20 |
diff --git a/dev-util/dwarves/Manifest b/dev-util/dwarves/Manifest |
21 |
new file mode 100644 |
22 |
index 0000000..d9e3668 |
23 |
--- /dev/null |
24 |
+++ b/dev-util/dwarves/Manifest |
25 |
@@ -0,0 +1 @@ |
26 |
+DIST dwarves-1.17.tar.xz 309028 BLAKE2B 600d095359fa1ef208cc83655761505a07512faf9957144cc5fdd9e69bef98be3afc8b29a4c13aa0246aa43fdc9b4906de95f37c86fc6790ece52a79e3b13695 SHA512 8916ea24316efe1eb322d045fb2d81c230905f2fe33942eac641e9e0311f33a3bcf55be454eac32781799c255303bafacd8f1bd1b3ec08f0dae4d5f38d8186ba |
27 |
|
28 |
diff --git a/dev-util/dwarves/dwarves-1.17.ebuild b/dev-util/dwarves/dwarves-1.17.ebuild |
29 |
new file mode 100644 |
30 |
index 0000000..b507d41 |
31 |
--- /dev/null |
32 |
+++ b/dev-util/dwarves/dwarves-1.17.ebuild |
33 |
@@ -0,0 +1,46 @@ |
34 |
+# Copyright 1999-2020 Gentoo Authors |
35 |
+# Distributed under the terms of the GNU General Public License v2 |
36 |
+ |
37 |
+EAPI=6 |
38 |
+ |
39 |
+PYTHON_COMPAT=( python3_{6,7,8} ) |
40 |
+inherit multilib cmake-utils python-single-r1 |
41 |
+ |
42 |
+DESCRIPTION="pahole (Poke-a-Hole) and other DWARF2 utilities" |
43 |
+HOMEPAGE="https://git.kernel.org/cgit/devel/pahole/pahole.git/" |
44 |
+ |
45 |
+LICENSE="GPL-2" # only |
46 |
+SLOT="0" |
47 |
+KEYWORDS="~amd64 ~x86 ~arm64" |
48 |
+IUSE="debug" |
49 |
+REQUIRED_USE="${PYTHON_REQUIRED_USE}" |
50 |
+ |
51 |
+RDEPEND="${PYTHON_DEPS} |
52 |
+ >=dev-libs/elfutils-0.178 |
53 |
+ sys-libs/zlib" |
54 |
+DEPEND="${RDEPEND}" |
55 |
+ |
56 |
+if [[ ${PV//_p} == ${PV} ]]; then |
57 |
+ SRC_URI="http://fedorapeople.org/~acme/dwarves/${P}.tar.xz" |
58 |
+else |
59 |
+ SRC_URI="https://dev.gentoo.org/~zzam/${PN}/${P}.tar.xz" |
60 |
+fi |
61 |
+ |
62 |
+DOCS=( README README.ctracer NEWS ) |
63 |
+ |
64 |
+PATCHES=( |
65 |
+ "${FILESDIR}"/${PN}-1.10-python-import.patch |
66 |
+ "${FILESDIR}"/${PN}-1.17-musl.patch |
67 |
+ |
68 |
+) |
69 |
+ |
70 |
+src_configure() { |
71 |
+ local mycmakeargs=( "-D__LIB=$(get_libdir)" ) |
72 |
+ cmake-utils_src_configure |
73 |
+} |
74 |
+ |
75 |
+src_test() { :; } |
76 |
+ |
77 |
+src_install() { |
78 |
+ cmake-utils_src_install |
79 |
+} |
80 |
|
81 |
diff --git a/dev-util/dwarves/files/dwarves-1.10-python-import.patch b/dev-util/dwarves/files/dwarves-1.10-python-import.patch |
82 |
new file mode 100644 |
83 |
index 0000000..e308ac6 |
84 |
--- /dev/null |
85 |
+++ b/dev-util/dwarves/files/dwarves-1.10-python-import.patch |
86 |
@@ -0,0 +1,15 @@ |
87 |
+https://bugs.gentoo.org/show_bug.cgi?id=423817 |
88 |
+ |
89 |
+--- dwarves-1.10/ostra/ostra-cg |
90 |
++++ dwarves-1.10/ostra/ostra-cg |
91 |
+@@ -10,7 +10,9 @@ |
92 |
+ # under the terms of version 2 of the GNU General Public License as |
93 |
+ # published by the Free Software Foundation. |
94 |
+ |
95 |
+-import sys, datetime, os, ostra |
96 |
++import sys |
97 |
++sys.path.insert(0, "/usr/share/dwarves/runtime/python") |
98 |
++import datetime, os, ostra |
99 |
+ |
100 |
+ class_def = None |
101 |
+ |
102 |
|
103 |
diff --git a/dev-util/dwarves/files/dwarves-1.17-musl.patch b/dev-util/dwarves/files/dwarves-1.17-musl.patch |
104 |
new file mode 100644 |
105 |
index 0000000..12dd516 |
106 |
--- /dev/null |
107 |
+++ b/dev-util/dwarves/files/dwarves-1.17-musl.patch |
108 |
@@ -0,0 +1,190 @@ |
109 |
+diff --git a/CMakeLists.txt b/CMakeLists.txt |
110 |
+index 2d23226..1798a96 100644 |
111 |
+--- a/CMakeLists.txt |
112 |
++++ b/CMakeLists.txt |
113 |
+@@ -74,6 +74,35 @@ if (NOT HAVE_REALLOCARRAY_SUPPORT) |
114 |
+ set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DCOMPAT_NEED_REALLOCARRAY") |
115 |
+ endif() |
116 |
+ |
117 |
++CHECK_C_SOURCE_COMPILES( |
118 |
++" |
119 |
++#include <obstack.h> |
120 |
++int main(void) |
121 |
++{ |
122 |
++ _obstack_begin(0, 0, 0, NULL, NULL); |
123 |
++ return 0; |
124 |
++} |
125 |
++" LIBC_IMPLEMENTS_OBSTACK) |
126 |
++if (NOT LIBC_IMPLEMENTS_OBSTACK) |
127 |
++ find_package(OBSTACK) |
128 |
++endif() |
129 |
++ |
130 |
++CHECK_C_SOURCE_COMPILES( |
131 |
++" |
132 |
++#include <obstack.h> |
133 |
++int main(void) |
134 |
++{ |
135 |
++ int argc=1; |
136 |
++ char *argv[]={\"argp\"}; |
137 |
++ argp_parse(0,argc,&argv,0,0,0); return 0; |
138 |
++ return 0; |
139 |
++} |
140 |
++" LIBC_IMPLEMENTS_ARGP) |
141 |
++ |
142 |
++if (NOT LIBC_IMPLEMENTS_ARGP) |
143 |
++ find_package(ARGP) |
144 |
++endif() |
145 |
++ |
146 |
+ set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64") |
147 |
+ |
148 |
+ file(GLOB libbpf_sources "lib/bpf/src/*.c") |
149 |
+@@ -91,7 +120,8 @@ set_target_properties(dwarves PROPERTIES VERSION 1.0.0 SOVERSION 1) |
150 |
+ set_target_properties(dwarves PROPERTIES INTERFACE_LINK_LIBRARIES "") |
151 |
+ target_include_directories(dwarves PRIVATE |
152 |
+ ${CMAKE_CURRENT_SOURCE_DIR}/lib/bpf/include/uapi) |
153 |
+-target_link_libraries(dwarves ${DWARF_LIBRARIES} ${ZLIB_LIBRARIES}) |
154 |
++target_link_libraries(dwarves ${DWARF_LIBRARIES} ${ZLIB_LIBRARIES} |
155 |
++ ${ARGP_LIBRARY} ${OBSTACK_LIBRARY}) |
156 |
+ |
157 |
+ set(dwarves_emit_LIB_SRCS dwarves_emit.c) |
158 |
+ add_library(dwarves_emit SHARED ${dwarves_emit_LIB_SRCS}) |
159 |
+diff --git a/cmake/modules/FindARGP.cmake b/cmake/modules/FindARGP.cmake |
160 |
+new file mode 100644 |
161 |
+index 0000000..aa7984f |
162 |
+--- /dev/null |
163 |
++++ b/cmake/modules/FindARGP.cmake |
164 |
+@@ -0,0 +1,17 @@ |
165 |
++# - Find argp |
166 |
++# If argp_parse is not implemented by libc find |
167 |
++# a standalone version. |
168 |
++ |
169 |
++message(STATUS "Checking availability of standalone argp library") |
170 |
++ |
171 |
++find_path(ARGP_INCLUDE_DIR argp.h |
172 |
++ /usr/include |
173 |
++ /usr/local/include |
174 |
++ /usr/include/libdwarf |
175 |
++ ~/usr/local/include |
176 |
++) |
177 |
++ |
178 |
++find_library(ARGP_LIBRARY |
179 |
++ NAMES argp |
180 |
++ PATHS /usr/lib /usr/local/lib /usr/lib64 /usr/local/lib64 ~/usr/local/lib ~/usr/local/lib64 |
181 |
++) |
182 |
+diff --git a/cmake/modules/FindOBSTACK.cmake b/cmake/modules/FindOBSTACK.cmake |
183 |
+new file mode 100644 |
184 |
+index 0000000..905fc4c |
185 |
+--- /dev/null |
186 |
++++ b/cmake/modules/FindOBSTACK.cmake |
187 |
+@@ -0,0 +1,19 @@ |
188 |
++# - Find obstack |
189 |
++# If obstack is not implemented by libc find |
190 |
++# a standalone version. |
191 |
++ |
192 |
++message(STATUS "Checking availability of standalone obstack library") |
193 |
++ |
194 |
++INCLUDE(CheckLibraryExists) |
195 |
++ |
196 |
++find_path(OBSTACK_INCLUDE_DIR obstack.h |
197 |
++ /usr/include |
198 |
++ /usr/local/include |
199 |
++ /usr/include/libdwarf |
200 |
++ ~/usr/local/include |
201 |
++) |
202 |
++ |
203 |
++find_library(OBSTACK_LIBRARY |
204 |
++ NAMES obstack |
205 |
++ PATHS /usr/lib /usr/local/lib /usr/lib64 /usr/local/lib64 ~/usr/local/lib ~/usr/local/lib64 |
206 |
++) |
207 |
+diff --git a/dtagnames.c b/dtagnames.c |
208 |
+index 0ffcbf7..1629fb3 100644 |
209 |
+--- a/dtagnames.c |
210 |
++++ b/dtagnames.c |
211 |
+@@ -14,9 +14,11 @@ |
212 |
+ |
213 |
+ static void print_malloc_stats(void) |
214 |
+ { |
215 |
++#ifdef __GLIBC__ |
216 |
+ struct mallinfo m = mallinfo(); |
217 |
+ |
218 |
+ fprintf(stderr, "size: %u\n", m.uordblks); |
219 |
++#endif |
220 |
+ } |
221 |
+ |
222 |
+ static int class__tag_name(struct tag *tag, struct cu *cu __unused, |
223 |
+diff --git a/dutil.h b/dutil.h |
224 |
+index 0f5f74a..3d771c4 100644 |
225 |
+--- a/dutil.h |
226 |
++++ b/dutil.h |
227 |
+@@ -15,6 +15,7 @@ |
228 |
+ #include <elf.h> |
229 |
+ #include <gelf.h> |
230 |
+ #include <asm/bitsperlong.h> |
231 |
++#include <linux/stddef.h> |
232 |
+ #include "rbtree.h" |
233 |
+ |
234 |
+ #define BITS_PER_LONG __BITS_PER_LONG |
235 |
+diff --git a/dwarves.c b/dwarves.c |
236 |
+index eb7885f..a437761 100644 |
237 |
+--- a/dwarves.c |
238 |
++++ b/dwarves.c |
239 |
+@@ -14,6 +14,7 @@ |
240 |
+ #include <fcntl.h> |
241 |
+ #include <fnmatch.h> |
242 |
+ #include <libelf.h> |
243 |
++#include <limits.h> |
244 |
+ #include <search.h> |
245 |
+ #include <stdio.h> |
246 |
+ #include <stdarg.h> |
247 |
+diff --git a/dwarves_fprintf.c b/dwarves_fprintf.c |
248 |
+index b8124a1..310631e 100644 |
249 |
+--- a/dwarves_fprintf.c |
250 |
++++ b/dwarves_fprintf.c |
251 |
+@@ -1910,7 +1910,11 @@ void cus__print_error_msg(const char *progname, const struct cus *cus, |
252 |
+ void dwarves__fprintf_init(uint16_t user_cacheline_size) |
253 |
+ { |
254 |
+ if (user_cacheline_size == 0) { |
255 |
++#ifdef __GLIBC__ |
256 |
+ long sys_cacheline_size = sysconf(_SC_LEVEL1_DCACHE_LINESIZE); |
257 |
++#else |
258 |
++ long sys_cacheline_size = 0; |
259 |
++#endif |
260 |
+ |
261 |
+ if (sys_cacheline_size > 0) |
262 |
+ cacheline_size = sys_cacheline_size; |
263 |
+diff --git a/dwarves_reorganize.c b/dwarves_reorganize.c |
264 |
+index bae5b6e..62616f3 100644 |
265 |
+--- a/dwarves_reorganize.c |
266 |
++++ b/dwarves_reorganize.c |
267 |
+@@ -10,6 +10,7 @@ |
268 |
+ #include "list.h" |
269 |
+ #include "dwarves_reorganize.h" |
270 |
+ #include "dwarves.h" |
271 |
++#include "dutil.h" |
272 |
+ |
273 |
+ static void class__recalc_holes(struct class *class) |
274 |
+ { |
275 |
+diff --git a/hash.h b/hash.h |
276 |
+index d3aa416..b1bd419 100644 |
277 |
+--- a/hash.h |
278 |
++++ b/hash.h |
279 |
+@@ -15,6 +15,7 @@ |
280 |
+ */ |
281 |
+ |
282 |
+ #include <stdint.h> |
283 |
++#include <sys/reg.h> |
284 |
+ |
285 |
+ /* 2^31 + 2^29 - 2^25 + 2^22 - 2^19 - 2^16 + 1 */ |
286 |
+ #define GOLDEN_RATIO_PRIME_32 0x9e370001UL |
287 |
+diff --git a/lib/bpf/src/libbpf.c b/lib/bpf/src/libbpf.c |
288 |
+index 514b1a5..b187734 100644 |
289 |
+--- a/lib/bpf/src/libbpf.c |
290 |
++++ b/lib/bpf/src/libbpf.c |
291 |
+@@ -32,6 +32,7 @@ |
292 |
+ #include <linux/filter.h> |
293 |
+ #include <linux/list.h> |
294 |
+ #include <linux/limits.h> |
295 |
++#include <linux/stddef.h> |
296 |
+ #include <linux/perf_event.h> |
297 |
+ #include <linux/ring_buffer.h> |
298 |
+ #include <linux/version.h> |
299 |
|
300 |
diff --git a/dev-util/dwarves/metadata.xml b/dev-util/dwarves/metadata.xml |
301 |
new file mode 100644 |
302 |
index 0000000..6f49eba |
303 |
--- /dev/null |
304 |
+++ b/dev-util/dwarves/metadata.xml |
305 |
@@ -0,0 +1,5 @@ |
306 |
+<?xml version="1.0" encoding="UTF-8"?> |
307 |
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd"> |
308 |
+<pkgmetadata> |
309 |
+<!-- maintainer-needed --> |
310 |
+</pkgmetadata> |