diff options
Diffstat (limited to 'main/libbsd/fix-build-with-musl-on-ppc64le-s390x.patch')
-rw-r--r-- | main/libbsd/fix-build-with-musl-on-ppc64le-s390x.patch | 61 |
1 files changed, 61 insertions, 0 deletions
diff --git a/main/libbsd/fix-build-with-musl-on-ppc64le-s390x.patch b/main/libbsd/fix-build-with-musl-on-ppc64le-s390x.patch new file mode 100644 index 0000000000..0216ef5cf7 --- /dev/null +++ b/main/libbsd/fix-build-with-musl-on-ppc64le-s390x.patch @@ -0,0 +1,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> |