Subject: bug#57789: Emacs 28.1 clone build with native compilation crashes on s390x

From: Rob Browning <[email-masked]>
Date: Sun, 05 Jan 2025 13:18:55 -0600

Pip Cet <[email-masked]> writes:

> Same compiler?  Is ASLR in use?

Should be roughly the same compiler, both are building a "current"
unstable tree, and I build the one on zelenka a few days ago and the
mmdebstrap one the day before yesterday.  Not sure offhand wrt ASLR.

> In any case, I'm always interested in weird machines, even if they're
> virtual, so I'd appreciate such instructions.

OK, so if you have access to a Debian host with recent enough versions
(fwiw, I was likely using trixie (testing) versions of debvm and
mmdebstrap), this should work.

As root:
  apt install qemu-system-s390x debvm mmdebstrap

As not:
  mkdir test-s390x && cd test-s390x

  # ssh key is optional (ssh logins may have a bit nicer terminal behavior)
  # and this uses the "unstable" release by default, could change it to
  # testing by adding an "-r testing".  I tested with unstable.
  debvm-create \
    -h s390x --architecture s390x -z 8G -o root.ext4 \
    -k ~/.ssh/SOMETHING.pub \
    -- \
    --include dialog \
    --include locales \
    --include zstd \
    --include linux-image-generic \
    --include ncurses-term \
    --include emacs-nox \
    --include git

  # --sshport is of course optional too, and smp 4 allows it to use 4
  # host cores (niced since this may take a while...).
  nice debvm-run -i root.ext4 --sshport 1234 -- -smp 4 -m 4096

Now you're in the vm in the terminal (as root):

  # Edit sources.list to add a deb-src line corresponding to the
  # existing deb line, e.g. change it to say:
  #   deb http://deb.debian.org/debian unstable main
  #   deb-src http://deb.debian.org/debian unstable main
  emacs /etc/apt/sources.list

  apt update
  apt build-dep emacs
  apt install libgccjit-14-dev # discovered current build-dep is stale
  git clone ...
  ... debug ...
  shutdown -h now

> Can you disassemble the Fwhile, eval_sub, and visit_static_gc_roots
> functions?  I assume s390 disassembled code isn't too hard to read...

I'll plan to try that later, along with retrieving the requested
backtraces.

> Random aside: is 0x2aa1c3705ca a likely S390 program counter?  The
> number looks familiar because it looks similar to a Lisp_Object
> representing a symbol on x86-64 without ASLR (an example would be
> 0x2aaa8dac00e8).  I guess it's just a coincidence though.

Hmm, I know very little about the s390x architecture.

-- 
Rob Browning
rlb @defaultvalue.org and @debian.org
GPG as of 2011-07-10 E6A9 DA3C C9FD 1FF8 C676 D2C4 C0F0 39E9 ED1B 597A
GPG as of 2002-11-03 14DD 432F AE39 534D B592 F9A0 25C8 D377 8C7E 73A4