[PATCH/libgpg-error] syscfg: Add Emscript arch.
NIIBE Yutaka
gniibe at fsij.org
Tue Apr 14 04:12:49 CEST 2026
Hello,
Thank you for your challenge.
Clément Péron wrote:
> * src/syscfg/lock-obj-pub.lock-obj-pub.wasm32-unknown-emscripten.h: New.
> * src/Makefile.am (lock_obj_pub): Add it.
Great. I think that your intention is building gpg-error for the host
of wasm32-unknown-emscripten.
The files are src/syscfg/* are old ones by old method. We moved to the
new method generating the header at build time, if possible. We use
src/gen-lock-obj.sh for cross compiling.
With the patch (to relax a constraint of section .bss):
==========================
diff --git a/src/gen-lock-obj.sh b/src/gen-lock-obj.sh
index 6e78c5f..a8d9352 100755
--- a/src/gen-lock-obj.sh
+++ b/src/gen-lock-obj.sh
@@ -73,7 +73,7 @@ pthread_mutex_t mtx = PTHREAD_MUTEX_INITIALIZER;
EOF
if $CC -c conftest.$ac_ext; then :
- ac_mtx_size=$($OBJDUMP -j .bss -t conftest.$ac_objext \
+ ac_mtx_size=$($OBJDUMP -t conftest.$ac_objext \
| $AWK $AWK_OPTION '
/mtx$/ { mtx_size = int("0x" $5) }
END { print mtx_size }')
==========================
The command line:
LOCK_ABI_VERSION=1 host=wasm32-unknown-emscripten \
host_alias=wasm32_unknown-emscripten \
CC=emcc OBJDUMP=llvm-objdump ac_ext=c ac_objext=o
AWK=gawk ./gen-lock-obj.sh
works well for me. (I learned that wasm-objdump is not compatible to
GNU objdump, so, I use llvm-objdump here.)
So, I'm considering this patch to configure.ac:
==========================
diff --git a/configure.ac b/configure.ac
index d83e7e5..a339dba 100644
--- a/configure.ac
+++ b/configure.ac
@@ -632,7 +632,7 @@ if test x"$gl_use_threads" = xno; then
AC_MSG_NOTICE([generated src/lock-obj-pub.native.h for $host])
elif test x$cross_compiling = xyes; then
case $host in
- *-*-gnu* | *-*-linux-gnu* | *-*-linux-musl*)
+ *-*-gnu* | *-*-linux-gnu* | *-*-linux-musl* | wasm*)
AC_CHECK_TOOL(OBJDUMP, [objdump])
if test -n "$OBJDUMP"; then
lock_obj_h_generated=yes
==========================
With those patches, by supplying CC=emcc OBJDUMP=llvm-objdump to
configure, we will be able to build for the host of
wasm32_unknown-emscripten.
--
More information about the Gnupg-devel
mailing list