help-guix
[Top][All Lists]
Advanced

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

Re: ABI mismatch on boot on arm32 system


From: Christoph Buck
Subject: Re: ABI mismatch on boot on arm32 system
Date: Wed, 30 Oct 2024 14:24:26 +0100
User-agent: mu4e 1.12.0; emacs 30.0.50


Efraim Flashner <efraim@flashner.co.il> writes:

> Can you run it again, but with i686 -> armhf, and x86_64 -> i686?
>

Hi Efraim!

Sure. No problem. Here we go:

cross compiled x86_64/i686 = 212719825 hash vs qemu i686  = 2434018 hash
cross compiled i686/arm* =  2434018 hash vs qemu arm = 2434018 hash

* This combination is run in qemu as well and then cross compiled using
  `with-target` because i don't have a native i686 architecture.

> My curiosity includes i686 -> x86_64, but I suspect it won't tell us
> anything we won't learn from the previous tests.

Unfortnuatly this combination crashes:

cross compiled i686/x86_x64* = 

--8<---------------cut here---------------start------------->8---
icepic@G16-Buck ~/guix/raspberry/touchscreen/abi-error/test/test-abi [env]$ 
./compile.sh
Backtrace:
In ice-9/boot-9.scm:
  2595:24 19 (call-with-deferred-observers _)
  3424:24 18 (_)
   222:17 17 (map1 (((test-systems))))
  3327:17 16 (resolve-interface (test-systems) #:select _ #:hide _ # ?)
In ice-9/threads.scm:
    390:8 15 (_ _)
In ice-9/boot-9.scm:
  3253:13 14 (_)
In ice-9/threads.scm:
    390:8 13 (_ _)
In ice-9/boot-9.scm:
  3544:20 12 (_)
   2836:4 11 (save-module-excursion _)
  3564:26 10 (_)
In unknown file:
           9 (primitive-load-path "test-systems" #<procedure ad7a0 a?>)
In ice-9/eval.scm:
   721:20  8 (primitive-eval (define-record-type* <test-system> # # ?))
In ice-9/psyntax.scm:
  1229:36  7 (expand-top-sequence (#<syntax:test-systems.scm:10:0 ?>) ?)
  1121:20  6 (parse _ (("placeholder" placeholder)) ((top) #(# # ?)) ?)
  1342:32  5 (syntax-type (#<syntax define-record-type*> #<synta?> ?) ?)
  1562:32  4 (expand-macro #<procedure bcc50 at ice-9/eval.scm:333:?> ?)
In ice-9/eval.scm:
   293:34  3 (_ #(#(#(#(#(#(#(#(#<directory ?> ?) ?) ?) ?) ?) ?) ?) ?))
   298:34  2 (_ #(#(#<directory (abi-records) 178c80>) ((#<s?> ?) ?)))
In unknown file:
           1 (string-hash "((device) (mount-point))" # #<undefined> #)
In ice-9/boot-9.scm:
  1685:16  0 (raise-exception _ #:continuable? _)

ice-9/boot-9.scm:1685:16: In procedure raise-exception:
Value out of range 1 to< 4294967295: 2305843009213693951
icepic@G16-Buck ~/guix/raspberry/touchscreen/abi-error/test/test-abi [env]$
--8<---------------cut here---------------end--------------->8---

Without further looking into this, i would hypothesize that during cross
compilation to x64 on i868, `target-most-positive-fixnum` returns a
number > 32bit which `string-hash` don't handle correct if executed on
i868.

To recap: For me, it looks like as if `string-hash` is not implemented
in a plaform independent way but uses a platform specific data type size
somewhere in its implementation. As long as bit mode(x64,x32) during
cross-compilation and execution is the same, it works (crosscompilation
on x64 and execution on arm64 is ok as well as crosscompilation on i868
and exection on arm32, see above). As soon as the bit mode is different,
the resulting hashes are different or the exeuction crashes.

I can debug into guiles `string-hash` function to find out where the
difference comes from. But i first need to figure out how to setup gdb
correctly.

But for me it sound like that a sensible bugfix for this issue (and i
think it is a bug/issue ;) ) would be using a platform independent
hashing algorithm implemented in plain guile without relying on native c
functions. If during compilation calucataed hashes are stored in the
compiled module one must assume that the hashes are always the same
independent of the architecture. Cross compilation will not work
reliable as soons as this assumption is broken, because compilation and
execution might happend on different platforms.

-- 
Best regards

Christoph



reply via email to

[Prev in Thread] Current Thread [Next in Thread]