[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: [PATCH] polystrap-binfmt for preparing the build host



As can be seen in your script, the use of binfmt support is not
without problems.

+        case $ARCH in
+                alpha|amd64|arm|armeb|i386|m68k|mips|mipsel\
+		|powerpc|ppc64|sh4|sh4eb|sparc|sparc64)
+                	BINFMT_ARCH=$ARCH ;;
+                armel) 	BINFMT_ARCH=arm ;;
+                lpia)  	BINFMT_ARCH=i386 ;; # not yet verified FIXME
+                *) echo "unknown architecture: $ARCH"; exit 1;;
+        esac

The most prominent problem IMHO is that it requires a system-wide
setting, and that in turn ties a qemu arch name to a particular
distro/ABI version.

An alternative approach would be to stack another LD_PRELOAD hack,
whose job would be to wrap calls to exec calls and wrap them into a
suitable qemu invocation.

Doing so would require careful wrapping of all those *exec*, system,
posix_spawn*; it would be tedious to take care not to break the
semantics of those library calls, and the number of such calls
suggests that more of them will likely appear, breaking things as they
appear.  That is, while it is surely workable for the short term, it
looks like a costly hack, and we may want to avoid that.

Another approach would be to intercept the execve syscall itself,
using ptrace.  That would have lower dev and maintainance cost, but
higher runtime penalty.  This idea was implemented in the past in
subterfugue (http://subterfugue.org/) - which would provide at least a
prototyping platform if it had not suffered from bitrot.  This is
something I'm considering having a look at (I already have some old
patches addressing some of subterfugue's bitrot).

-- 
Yann


Reply to: