libbsd: unbreak musl

This commit is contained in:
Jürgen Buchmüller 2015-10-31 14:43:02 +01:00
parent a1f453a102
commit 28c5e70b6f
2 changed files with 68 additions and 2 deletions

View file

@ -0,0 +1,67 @@
--- include/bsd/nlist.h 2013-10-10 08:14:26.000000000 +0200
+++ include/bsd/nlist.h 2015-10-31 14:32:06.038427778 +0100
@@ -28,7 +28,53 @@
#define LIBBSD_NLIST_H
#include <sys/cdefs.h>
+#if defined(__GLIBC__)
#include <a.out.h>
+#else
+/* Just the bare necessities for musl libc */
+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. */
+};
+
+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;
+};
+
+#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_TYPE 036
+#define N_STAB 0340
+#define N_INDR 0xa
+#define N_SETA 0x14 /* Absolute set element symbol. */
+#define N_SETT 0x16 /* Text set element symbol. */
+#define N_SETD 0x18 /* Data set element symbol. */
+#define N_SETB 0x1A /* Bss set element symbol. */
+#define N_SETV 0x1C /* Pointer to set vector in data area. */
+
+#endif /* !defined(__GLIBC__) */
__BEGIN_DECLS
extern int nlist(const char *filename, struct nlist *list);
--- src/nlist.c 2015-10-31 14:36:20.857402580 +0100
+++ src/nlist.c 2015-10-31 14:24:23.407473525 +0100
@@ -40,7 +40,7 @@
#include <arpa/inet.h>
#include <errno.h>
-#include <a.out.h>
+#include "nlist.h"
#include <stdio.h>
#include <string.h>
#include <unistd.h>

View file

@ -1,7 +1,7 @@
# Template file for 'libbsd'
pkgname=libbsd
version=0.7.0
revision=2
revision=3
build_style=gnu-configure
short_desc="Provides useful functions commonly found on BSD system"
maintainer="Juan RP <xtraeme@voidlinux.eu>"
@ -15,7 +15,6 @@ post_extract() {
*-musl)
sed -i '1i#include <fcntl.h>' src/flopen.c src/nlist.c
sed -i '/#error/d' src/funopen.c
sed -i 's,<a.out.h>,<linux/a.out.h>,g' src/nlist.c
;;
esac
}