1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
|
Libbsd includes a.out.h header to get some definitions like struct nlist, struct exec.
In Alpine x86_64 this header is provided by linux-headers package (linux/a.out.h),
in Ubuntu ppc64le it is provided by glibc (a.out.h), but in Alpine ppc64le it is not
available.
A workaround for this problem is to define the types that are being used
by libbsd instead of including the invalid header for ppc64le and s390x.
===
--- libbsd-0.8.3.orig/src/nlist.c
+++ libbsd-0.8.3/src/nlist.c
@@ -40,7 +40,49 @@ static char sccsid[] = "@(#)nlist.c 8.1 (Berkeley) 6/4/93";
#include <errno.h>
#include <fcntl.h>
+
+#if defined(__powerpc64__) || defined(__s390x__)
+// Copied from a.out.h, because it is not available on ppc64le with musl
+struct nlist
+{
+ union
+ {
+ char *n_name;
+ struct nlist *n_next;
+ long n_strx;
+ } n_un;
+ unsigned char n_type;
+ char n_other;
+ short n_desc;
+ unsigned long n_value;
+};
+
+struct exec
+{
+ unsigned long a_info; /* Use macros N_MAGIC, etc for access. */
+ unsigned int a_text; /* Length of text, in bytes. */
+ unsigned int a_data; /* Length of data, in bytes. */
+ unsigned int a_bss; /* Length of uninitialized data area for file, in bytes. */
+ unsigned int a_syms; /* Length of symbol table data in file, in bytes. */
+ unsigned int a_entry; /* Start address. */
+ unsigned int a_trsize;/* Length of relocation info for text, in bytes. */
+ unsigned int a_drsize;/* Length of relocation info for data, in bytes. */
+};
+
+#define N_UNDF 0
+#define N_ABS 2
+#define N_TEXT 4
+#define N_DATA 6
+#define N_BSS 8
+#define N_FN 15
+#define N_EXT 1
+#define N_STAB 0340
+
+#else
#include <linux/a.out.h>
+
+#endif
+
#include <stdio.h>
#include <string.h>
#include <unistd.h>
|