Subject: bug#28308: Build failure on FreeBSD/aarch64

From: Gergely Czuczy <[email-masked]>
Date: Thu, 31 Aug 2017 18:34:37 +0200

Hello,

Emacs was broken on FreeBSD/aarch64 due to the sbrk issue (it got 
obsoleted on the platform), however the latest git checkout seems to 
build so far, up to a point, where it segfaults. So, the issue with it 
is not sbrk. Here are the build logs:

mv -f emacs bootstrap-emacs
gmake -C ../lisp compile-first EMACS="../src/bootstrap-emacs"
gmake[4]: Entering directory '/usr/ports/editors/emacs-devel/work/emacs-f44184f/lisp'
EMACSLOADPATH= '../src/bootstrap-emacs' -batch --no-site-file --no-site-lisp --eval '(setq load-prefer-newer t)'  -f batch-byte-compile emacs-lisp/macroexp.el
Fatal error 11: Segmentation faultgmake[4]: *** [Makefile:297: emacs-lisp/macroexp.elc] Segmentation fault (core dumped)
gmake[4]: Leaving directory '/usr/ports/editors/emacs-devel/work/emacs-f44184f/lisp'
gmake[3]: *** [Makefile:739: bootstrap-emacs] Error 2
gmake[3]: Leaving directory '/usr/ports/editors/emacs-devel/work/emacs-f44184f/src'
gmake[2]: *** [Makefile:416: src] Error 2
gmake[2]: Leaving directory '/usr/ports/editors/emacs-devel/work/emacs-f44184f'

-emacs.corepine64:/usr/ports/editors/emacs-devel# lldb work/emacs-f44184f/src/bootstrap-emacs -c work/emacs-f44184f/lisp/bootstrap-
(lldb) target create "work/emacs-f44184f/src/bootstrap-emacs" --core "work/emacs-f44184f/lisp/bootstrap-emacs.core"
Core file '/usr/ports/editors/emacs-devel/work/emacs-f44184f/lisp/bootstrap-emacs.core' (aarch64) was loaded.
(lldb) bt
* thread #1, name = 'bootstrap-emacs', stop reason = signal SIGSEGV
   * frame #0: 0x0000000000158584 bootstrap-emacs`oblookup + 120
     frame #1: 0x000000000015843c bootstrap-emacs`intern_1 + 92
     frame #2: 0x00000000000fb0cc bootstrap-emacs`Fdo_auto_save + 220
     frame #3: 0x00000000000c5bd8 bootstrap-emacs`shut_down_emacs + 216
     frame #4: 0x00000000000c5a04 bootstrap-emacs`terminate_due_to_signal + 128
     frame #5: 0x00000000000df574 bootstrap-emacs`deliver_fatal_thread_signal + 128
     frame #6: 0x00000000000e0ec8 bootstrap-emacs`handle_sigsegv + 164
     frame #7: 0x00000000404cfe80 libthr.so.3`handle_signal(actp=0x0000000000539600, sig=11, info=0x0000000000539670, ucp=0x00000000005396c0) at thr_sig.c:244
     frame #8: 0x00000000404cf5a4 libthr.so.3`thr_sighandler(sig=11, info=0x0000000000539670, _ucp=0x00000000005396c0) at thr_sig.c:189
     frame #9: 0x0000fffffffff000
     frame #10: 0x0000000000040190 bootstrap-emacs`__start + 376
     frame #11: 0x00000000401c0018 ld-elf.so.1`.rtld_start at rtld_start.S:41

This was produced on -CURRENT if that matters:
FreeBSD build-pine64.bealak.harmless.hu 12.0-CURRENT FreeBSD 12.0-CURRENT #0 r322723M: Tue Aug 22 07:25:52 CEST 2017     [email-masked]:/tank/rpi3/crochet/work.pine64vanilla/obj/arm64.aarch64/tank/rpi3/src/sys/GENERIC-NODEBUG  arm64

So, I think this is a different kind of a fault, not related to sbrk, but it pretty much shouldn't do this.

Could you please guys take a look at it?

Best regards,
Gergely

PS: For the record here's the FreeBSD-sude report: https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=221961