For benchmarking purposes, I'd like to call uconv from a Rust program.
Since building uconv separately from Gecko hasn't really been
maintained, I figured that I'd export a small number of C-linkage
functions from libxul, dynamically link with libxul as built as part
of Linux x86_64 Firefox and call NS_InitMinimalXPCOM() once before
calling my exported test functions.

I can get Cargo to link my Rust program with libxul, but upon running
the program, it crashes immediately with "signal: 11, SIGSEGV: invalid
memory reference" even if I don't even try to call into libxul at all.

Is there some easily-addressable obvious reason for the process dying
due to just dynamically linking with libxul without even calling into
it? Related to jemalloc and/or static initializers maybe? (I'm
expecting that if this was about duplicate symbols due to two copies
of the Rust standard library or jemalloc, the linker would barf, but
I'm not sure if that's a correct expectation.)

Am I correct to expect that if the program didn't crash right away,
NS_InitMinimalXPCOM() would get just enough infrastructure running to
make do_CreateInstance work?

(FWIW, calling into system iconv and system ICU works fine.)

-- 
Henri Sivonen
hsivo...@hsivonen.fi
https://hsivonen.fi/
_______________________________________________
dev-platform mailing list
dev-platform@lists.mozilla.org
https://lists.mozilla.org/listinfo/dev-platform

Reply via email to