Merge "Support building elfutils against musl" am: 462e61fb7e
Original change: https://android-review.googlesource.com/c/platform/external/elfutils/+/1819989
Change-Id: Ibc52cc12db64932c010408428a0d643589f21e19
diff --git a/Android.bp b/Android.bp
index 2ca70cc..27fc03b 100644
--- a/Android.bp
+++ b/Android.bp
@@ -90,6 +90,11 @@
enabled: false,
},
},
+ musl: {
+ cflags: [
+ "-include AndroidFixup.h",
+ ],
+ },
},
visibility: [
@@ -112,6 +117,9 @@
android: {
export_include_dirs: ["bionic-fixup"],
},
+ musl: {
+ export_include_dirs: ["bionic-fixup"],
+ },
},
visibility: [":__subpackages__"],
}
@@ -123,6 +131,12 @@
darwin: {
enabled: false,
},
+ musl: {
+ static_libs: [
+ "libfts",
+ "libz",
+ ],
+ },
},
srcs: [
"backends/*.c",
@@ -149,6 +163,8 @@
"libdwfl/debuginfod-client.c",
"libdwfl/elf-from-memory.c",
"libdwfl/link_map.c",
+ // These depend on argp which doesn't exist in musl
+ "libdwfl/argp-std.c",
// Those are common source files actually used as headers and not
// compiled standalone.
"backends/common-reloc.c",
@@ -168,5 +184,8 @@
static_libs: [
"libelf"
],
+ whole_static_libs: [
+ "libeu",
+ ],
compile_multilib: "64",
}
diff --git a/config.h b/config.h
index ee0d24f..b39476f 100644
--- a/config.h
+++ b/config.h
@@ -56,7 +56,9 @@
#define HAVE_DECL_STRERROR_R 1
/* Define to 1 if you have the <error.h> header file. */
+#if defined(__BIONIC__) || defined(__GLIBC__)
#define HAVE_ERROR_H 1
+#endif
/* Define to 1 if you have the <err.h> header file. */
#define HAVE_ERR_H 1
@@ -143,7 +145,9 @@
#define STDC_HEADERS 1
/* Define to 1 if strerror_r returns char *. */
+#if defined(__GLIBC__) || defined(__BIONIC__)
#define STRERROR_R_CHAR_P 1
+#endif
/* Support bzip2 decompression via -lbz2. */
/* #undef USE_BZLIB */
diff --git a/lib/Android.bp b/lib/Android.bp
index 86ad65e..9016e29 100644
--- a/lib/Android.bp
+++ b/lib/Android.bp
@@ -6,5 +6,9 @@
name: "libeu",
defaults: ["elfutils_defaults"],
srcs: ["*.c"],
- exclude_srcs: ["dynamicsizehash*.c"],
+ exclude_srcs: [
+ "color.c", // uses argp
+ "dynamicsizehash*.c",
+ "printversion.c", // uses argp
+ ],
}
diff --git a/libcpu/Android.bp b/libcpu/Android.bp
index 9a73dcb..b36ac5f 100644
--- a/libcpu/Android.bp
+++ b/libcpu/Android.bp
@@ -49,6 +49,11 @@
static_libs: [
"libeu",
],
+ target: {
+ musl: {
+ static_libs: ["libobstack"],
+ },
+ },
}
genrule {
diff --git a/patches/config.h.patch b/patches/config.h.patch
index c8e933e..25c4185 100644
--- a/patches/config.h.patch
+++ b/patches/config.h.patch
@@ -1,5 +1,5 @@
diff --git b/config.h a/config.h
-index 3ce5c686..ee0d24fa 100644
+index 3ce5c686..b39476f6 100644
--- b/config.h
+++ a/config.h
@@ -29,7 +29,7 @@
@@ -11,7 +11,17 @@
/* Define if the GNU dcgettext() function is already present or preinstalled.
*/
-@@ -65,7 +65,7 @@
+@@ -56,7 +56,9 @@
+ #define HAVE_DECL_STRERROR_R 1
+
+ /* Define to 1 if you have the <error.h> header file. */
++#if defined(__BIONIC__) || defined(__GLIBC__)
+ #define HAVE_ERROR_H 1
++#endif
+
+ /* Define to 1 if you have the <err.h> header file. */
+ #define HAVE_ERR_H 1
+@@ -65,7 +67,7 @@
#define HAVE_FALLTHROUGH 1
/* Defined if __attribute__((gcc_struct)) is supported */
@@ -20,7 +30,17 @@
/* Define if the GNU gettext() function is already present or preinstalled. */
#define HAVE_GETTEXT 1
-@@ -170,13 +170,15 @@
+@@ -143,7 +145,9 @@
+ #define STDC_HEADERS 1
+
+ /* Define to 1 if strerror_r returns char *. */
++#if defined(__GLIBC__) || defined(__BIONIC__)
+ #define STRERROR_R_CHAR_P 1
++#endif
+
+ /* Support bzip2 decompression via -lbz2. */
+ /* #undef USE_BZLIB */
+@@ -170,13 +174,15 @@
`char[]'. */
#define YYTEXT_POINTER 1