Github messages for voidlinux
 help / color / mirror / Atom feed
* [PR PATCH] gcompat: update to 0.4.0, add libucontext, fix on ppc*
@ 2019-11-10 15:09 voidlinux-github
  2019-11-10 15:10 ` voidlinux-github
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: voidlinux-github @ 2019-11-10 15:09 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 378 bytes --]

There is a new pull request by q66 against master on the void-packages repository

https://github.com/void-ppc/void-packages gcompat
https://github.com/void-linux/void-packages/pull/16320

gcompat: update to 0.4.0, add libucontext, fix on ppc*
The ppc fix is currently being upstreamed.

A patch file from https://github.com/void-linux/void-packages/pull/16320.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-gcompat-16320.patch --]
[-- Type: text/x-diff, Size: 4944 bytes --]

From 0d9efe4bf04cf1e7af4c737f405e85ea0190d471 Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Sun, 10 Nov 2019 15:43:50 +0100
Subject: [PATCH] gcompat: update to 0.4.0, add libucontext, fix on ppc*

---
 .../gcompat/patches/ppc-libc_start_main.patch | 67 +++++++++++++++++++
 srcpkgs/gcompat/template                      | 24 +++++--
 2 files changed, 87 insertions(+), 4 deletions(-)
 create mode 100644 srcpkgs/gcompat/patches/ppc-libc_start_main.patch

diff --git a/srcpkgs/gcompat/patches/ppc-libc_start_main.patch b/srcpkgs/gcompat/patches/ppc-libc_start_main.patch
new file mode 100644
index 00000000000..518292745f7
--- /dev/null
+++ b/srcpkgs/gcompat/patches/ppc-libc_start_main.patch
@@ -0,0 +1,67 @@
+From d30e49d10cefeb2748373127e1d1aba1184f653d Mon Sep 17 00:00:00 2001
+From: q66 <daniel@octaforge.org>
+Date: Sun, 10 Nov 2019 15:32:28 +0100
+Subject: [PATCH 1/1] internal: add a wrapper for __libc_start_main for
+ PowerPC(64(le))
+
+This is necessary because the musl and glibc function signatures
+differ significantly.
+---
+ libgcompat/internal.c | 41 +++++++++++++++++++++++++++++++++++++++++
+ 1 file changed, 41 insertions(+)
+
+diff --git a/libgcompat/internal.c b/libgcompat/internal.c
+index 450c5e4..53ac429 100644
+--- libgcompat/internal.c
++++ libgcompat/internal.c
+@@ -2,6 +2,47 @@
+ #include <stdio.h>
+ #include <stdlib.h>
+ 
++#if defined(__powerpc__)
++
++/* On PowerPC as well as ppc64, we need to fix up __libc_start_main as the
++ * glibc and musl versions have wildly different signatures, which would
++ * result in the arguments to __libc_start_main being completely wrong.
++ *
++ * Using dlsym in this context is mildly questionable as this is before
++ * the full initialization has been done, but there is no better way.
++ */
++
++#include <dlfcn.h>
++
++struct startup_info {
++	void *sda_base;
++	void *f_main;
++	void *f_init;
++	void *f_fini;
++};
++
++typedef int (*start_main_t)(void *mf, int argc, char **argv);
++
++/*
++ * ref: https://git.musl-libc.org/cgit/musl/tree/crt/crt1.c?id=90251cf
++ * ref: https://git.musl-libc.org/cgit/musl/tree/src/env/__libc_start_main.c?id=90251cf#n71
++ * ref: https://github.com/bminor/glibc/blob/5cb226d/sysdeps/unix/sysv/linux/powerpc/libc-start.c#L36
++ */
++int __libc_start_main(void *argc, void *argv, void *ev, void *auxv, void *fini,
++                      struct startup_info *si, long *p)
++{
++	(void)argc;
++	(void)argv;
++	(void)ev;
++	(void)auxv;
++	(void)fini;
++	/* argc/argv from the stack, main from startup_info */
++	start_main_t mainf = (start_main_t)dlsym(RTLD_NEXT, "__libc_start_main");
++	return mainf(si->f_main, *p, (void *)(p + 1));
++}
++
++#endif /* defined(__powerpc__) */
++
+ void GCOMPAT__panic(const char *fmt, ...)
+ {
+ 	va_list va;
+-- 
+2.23.0
+
diff --git a/srcpkgs/gcompat/template b/srcpkgs/gcompat/template
index caac77ba63f..237f97bd5e9 100644
--- a/srcpkgs/gcompat/template
+++ b/srcpkgs/gcompat/template
@@ -1,6 +1,6 @@
 # Template file for 'gcompat'
 pkgname=gcompat
-version=0.3.0
+version=0.4.0
 revision=1
 build_style=gnu-makefile
 short_desc="Compatibility layer to allow running glibc binaries on musl systems"
@@ -8,7 +8,15 @@ maintainer="Daniel James <djames@orcadian.net>"
 license="ISC"
 homepage="https://code.foxkit.us/adelie/gcompat"
 distfiles="https://distfiles.AdelieLinux.org/source/${pkgname}/${pkgname}-${version}.tar.xz"
-checksum=31bb3ead012e23a1f3b4bedc8a376655d3b65c66d37e6acc865a9b72163f50ea
+checksum=9903fac7b70de3ba7736ae2987fa00bbafff7bfcf6a9c88731c292dff19e44e2
+
+build_options="libucontext"
+desc_option_libucontext="Build with ucontext support via libucontext"
+
+case "$XBPS_TARGET_MACHINE" in
+	mips*) ;;
+	*) build_options_default+=" libucontext" ;;
+esac
 
 # https://sourceware.org/glibc/wiki/ABIList
 # https://wiki.linaro.org/RikuVoipio/LdSoTable
@@ -28,14 +36,22 @@ case "${XBPS_TARGET_MACHINE}" in
 	x86_64-musl) _glibc="ld-linux-x86-64.so.2" _musl="ld-musl-x86_64.so.1";;
 	ppc64le-musl) _glibc="ld64.so.2" _musl="ld-musl-powerpc64le.so.1";;
 	ppc64-musl) _glibc="ld64.so.2" _musl="ld-musl-powerpc64.so.1";;
+	ppc-musl) _glibc="ld.so.1" _musl="ld-musl-powerpc.so.1";;
 	*-musl) broken="Template does not yet recognize this arch, please fix";;
 	*) broken="Only for musl libc";;
 esac
 
 make_build_args="LINKER_PATH=/usr/lib/${_musl} LOADER_NAME=${_glibc}
- LIBGCOMPAT_PATH=/usr/lib/libgcompat.so.0 LOADER_PATH=/usr/lib/${LOADER_NAME}"
+ LIBGCOMPAT_PATH=/usr/lib/libgcompat.so.0 LOADER_PATH=/usr/lib/${LOADER_NAME}
+ WITH_OBSTACK=no"
 make_install_args="LINKER_PATH=/usr/lib/${_musl} LOADER_NAME=${_glibc}
- LIBGCOMPAT_PATH=/usr/lib/libgcompat.so.0 LOADER_PATH=/usr/lib/${LOADER_NAME}"
+ LIBGCOMPAT_PATH=/usr/lib/libgcompat.so.0 LOADER_PATH=/usr/lib/${LOADER_NAME}
+ WITH_OBSTACK=no"
+
+if [ "$build_option_libucontext" ]; then
+	makedepends+=" libucontext-devel"
+	make_build_args+=" WITH_LIBUCONTEXT=1"
+fi
 
 post_install() {
 	vlicense LICENSE

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2019-11-11 18:29 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-11-10 15:09 [PR PATCH] gcompat: update to 0.4.0, add libucontext, fix on ppc* voidlinux-github
2019-11-10 15:10 ` voidlinux-github
2019-11-10 15:23 ` voidlinux-github
2019-11-10 16:49 ` voidlinux-github
2019-11-11 18:07 ` [PR PATCH] [Updated] [pending other PRs] " voidlinux-github
2019-11-11 18:07 ` voidlinux-github
2019-11-11 18:27 ` voidlinux-github
2019-11-11 18:29 ` [PR PATCH] [Merged]: " voidlinux-github

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).