summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexey Neyman <stilor@att.net>2017-01-28 21:33:43 (GMT)
committerGitHub <noreply@github.com>2017-01-28 21:33:43 (GMT)
commitd0682f9ad5492ea541edb77d1c39d82144477b8a (patch)
tree80adb198f805f8c2b8057dc12c03dd557a5062af
parent0636034688b0d03577ae1b543c92ebab90d14c68 (diff)
parentd7b043e360dbf261ddb97accf5c454d3cf88f92e (diff)
Merge pull request #563 from stilor/musl-mips-refix
Add a workaround for musl in build scripts
-rw-r--r--patches/strace/4.15/020-use-asm-sgidefs.h.patch67
-rw-r--r--scripts/build/arch.sh5
-rw-r--r--scripts/build/arch/mips.sh19
-rw-r--r--scripts/build/libc/musl.sh3
4 files changed, 27 insertions, 67 deletions
diff --git a/patches/strace/4.15/020-use-asm-sgidefs.h.patch b/patches/strace/4.15/020-use-asm-sgidefs.h.patch
deleted file mode 100644
index 06ae5a3..0000000
--- a/patches/strace/4.15/020-use-asm-sgidefs.h.patch
+++ /dev/null
@@ -1,67 +0,0 @@
-diff -urpN strace-4.15.orig/configure strace-4.15/configure
---- strace-4.15.orig/configure 2016-12-14 01:17:44.000000000 -0800
-+++ strace-4.15/configure 2017-01-19 22:32:20.167896014 -0800
-@@ -8775,7 +8775,7 @@ $as_echo_n "checking for _MIPS_SIM... "
- if ${st_cv__MIPS_SIM+:} false; then :
- $as_echo_n "(cached) " >&6
- else
-- if ac_fn_c_compute_int "$LINENO" "_MIPS_SIM" "st_cv__MIPS_SIM" "#include <sgidefs.h>"; then :
-+ if ac_fn_c_compute_int "$LINENO" "_MIPS_SIM" "st_cv__MIPS_SIM" "#include <asm/sgidefs.h>"; then :
-
- else
- as_fn_error $? "_MIPS_SIM cannot be determined" "$LINENO" 5
-@@ -8792,7 +8792,7 @@ if ${st_cv_mips_abi+:} false; then :
- else
- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
- /* end confdefs.h. */
--#include <sgidefs.h>
-+#include <asm/sgidefs.h>
- int
- main ()
- {
-@@ -8806,7 +8806,7 @@ if ac_fn_c_try_compile "$LINENO"; then :
- else
- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
- /* end confdefs.h. */
--#include <sgidefs.h>
-+#include <asm/sgidefs.h>
- int
- main ()
- {
-@@ -8820,7 +8820,7 @@ if ac_fn_c_try_compile "$LINENO"; then :
- else
- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
- /* end confdefs.h. */
--#include <sgidefs.h>
-+#include <asm/sgidefs.h>
- int
- main ()
- {
-diff -urpN strace-4.15.orig/configure.ac strace-4.15/configure.ac
---- strace-4.15.orig/configure.ac 2016-12-07 02:59:52.000000000 -0800
-+++ strace-4.15/configure.ac 2017-01-19 22:32:35.768433437 -0800
-@@ -212,20 +212,20 @@ MIPS_ABI=
- if test "$arch" = mips; then
- AC_CACHE_CHECK([for _MIPS_SIM], [st_cv__MIPS_SIM],
- [AC_COMPUTE_INT([st_cv__MIPS_SIM], [_MIPS_SIM],
-- [#include <sgidefs.h>],
-+ [#include <asm/sgidefs.h>],
- [AC_MSG_ERROR([_MIPS_SIM cannot be determined])])])
-
- AC_CACHE_CHECK([for MIPS ABI], [st_cv_mips_abi],
- [AC_COMPILE_IFELSE(
-- [AC_LANG_PROGRAM([[#include <sgidefs.h>]],
-+ [AC_LANG_PROGRAM([[#include <asm/sgidefs.h>]],
- [[int i[_MIPS_SIM == _MIPS_SIM_ABI32 ? 1 : - 1];]])],
- [st_cv_mips_abi=o32],
- [AC_COMPILE_IFELSE(
-- [AC_LANG_PROGRAM([[#include <sgidefs.h>]],
-+ [AC_LANG_PROGRAM([[#include <asm/sgidefs.h>]],
- [[int i[_MIPS_SIM == _MIPS_SIM_NABI32 ? 1 : - 1];]])],
- [st_cv_mips_abi=n32],
- [AC_COMPILE_IFELSE(
-- [AC_LANG_PROGRAM([[#include <sgidefs.h>]],
-+ [AC_LANG_PROGRAM([[#include <asm/sgidefs.h>]],
- [[int i[_MIPS_SIM == _MIPS_SIM_ABI64 ? 1 : - 1];]])],
- [st_cv_mips_abi=n64],
- [st_cv_mips_abi=unknown])])])])
diff --git a/scripts/build/arch.sh b/scripts/build/arch.sh
index 3d3611b..75d3e21 100644
--- a/scripts/build/arch.sh
+++ b/scripts/build/arch.sh
@@ -64,5 +64,10 @@ CT_DoArchMUSLHeaderDir() {
:;
}
+# MUSL: Perform any final adjustments on the installed libc/headers
+CT_DoArchMUSLPostInstall() {
+ :;
+}
+
# Override from the actual arch implementation as needed.
. "${CT_LIB_DIR}/scripts/build/arch/${CT_ARCH}.sh"
diff --git a/scripts/build/arch/mips.sh b/scripts/build/arch/mips.sh
index 6097c89..f91a80a 100644
--- a/scripts/build/arch/mips.sh
+++ b/scripts/build/arch/mips.sh
@@ -69,3 +69,22 @@ CT_DoArchUClibcCflags() {
esac
done
}
+
+CT_DoArchMUSLPostInstall() {
+ # GDB and MUSL maintainers seem to disagree on whether <sgidefs.h>
+ # is to be provided as a part of C library. GDB guys think it is
+ # a C library responsibility, while MUSL authors think GDB should
+ # not be using <sgidefs.h>. Neither side is willing to reach out
+ # to the other and negotiate the needed changes, and I don't want
+ # to play the middle man. Hence, provide our own wrapper for
+ # for <sgidefs.h> - the only solution short of telling MUSL users
+ # stop using it. This is why MUSL is experimental in ct-ng and
+ # will likely remain in that status.
+ # References:
+ # http://www.openwall.com/lists/musl/2017/01/26/2
+ # https://sourceware.org/ml/gdb-patches/2017-01/msg00469.html
+ # https://www.sourceware.org/ml/libc-alpha/2004-11/msg00034.html
+ if [ ! -r "${CT_HEADERS_DIR}/sgidefs.h" ]; then
+ echo "#include <asm/sgidefs.h> // Redirected by ct-ng" > "${CT_HEADERS_DIR}/sgidefs.h"
+ fi
+}
diff --git a/scripts/build/libc/musl.sh b/scripts/build/libc/musl.sh
index 9bbd95a..4ccb84c 100644
--- a/scripts/build/libc/musl.sh
+++ b/scripts/build/libc/musl.sh
@@ -154,6 +154,9 @@ do_libc_backend_once() {
;;
esac
done
+
+ # Any additional actions for this architecture
+ CT_DoArchMUSLPostInstall
fi
CT_EndStep