tech-toolchain archive

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

-current gcc optimizations and XEmacs



All,

I am having problems building editors/xemacs on a -current amd64 system

% uname -a
NetBSD Anscharte.nt.e-technik.tu-darmstadt.de 7.99.39 NetBSD 7.99.39 (HP2170P) #1: Mon Oct 17 13:36:49 CEST 2016 hauke%Anscharte.nt.e-technik.tu-darmstadt.de@localhost:/var/obj/netbsd-builds/developer/amd64/sys/arch/amd64/compile/HP2170P amd64
% fgrep GCC /etc/release
            HAVE_GCC = '53'
               MKGCC = 'yes'
           MKGCCCMDS = 'yes'
%

Built with -O2 (the default), the freshly built xemacs will hang indefinitely at

--- xemacs ---
gcc -O2 -pipe -Wall -Wno-error -g3 -Dunix -I/usr/pkg/include -I/usr/include -L/usr/pkg/lib -Wl,-R/usr/pkg/lib -L/usr/lib -Wl,-R/usr/lib -L/usr/pkg/lib -L/usr/pkg/lib -Wl,-R/usr/pkg/lib:/usr/pkg/lib -L/usr/X11R7/lib -L/usr/pkg/lib -Wl,-R/usr/pkg/lib -L/usr/lib -Wl,-R/usr/lib -Wl,-export-dynamic -o xemacs abbrev.o alloc.o blocktype.o buffer.o bytecode.o callint.o callproc.o casefiddle.o casetab.o chartab.o cmdloop.o cmds.o console.o console-stream.o data.o device.o dired.o doc.o doprnt.o dynarr.o editfns.o elhash.o emacs.o eval.o events.o filelock.o dumper.o balloon_help.o balloon-x.o dgif_lib.o gif_io.o menubar.o scrollbar.o dialog.o toolbar.o menubar-x.o scrollbar-x.o dialog-x.o toolbar-x.o gui-x.o mule.o mule-ccl.o mule-charset.o file-coding.o input-method-xlib.o realpath.o inline.o linuxplay.o miscplay.o console-tty.o device-tty.o event-tty.o frame-tty.o objects-tty.o redisplay-tty.o cm.o terminfo.o event-unixoid.o database.o sysdll.o emodules.o process-unix.o event-stream.o extents.o faces.o fileio.o filemode.o floatfns.o fns.o font-lock.o frame.o general.o glyphs.o glyphs-eimage.o glyphs-widget.o gui.o gutter.o hash.o imgproc.o indent.o insdel.o intl.o keymap.o line-number.o lread.o lstream.o macros.o marker.o md5.o minibuf.o objects.o opaque.o print.o process.o profile.o rangetab.o redisplay.o redisplay-output.o regex.o search.o select.o signal.o sound.o specifier.o strftime.o symbols.o syntax.o sysdep.o undo.o console-x.o device-x.o event-Xt.o frame-x.o glyphs-x.o objects-x.o redisplay-x.o select-x.o xgccache.o widget.o window.o lastfile.o gmalloc.o vm-limit.o ralloc.o EmacsFrame.o EmacsShell.o TopLevelEmacsShell.o TransientEmacsShell.o EmacsManager.o dump-id.o ../lwlib/liblw.a -lXaw -ltiff -lpng -ljpeg -lz -lXpm -lXmu -lXt -lXext -lX11 -lSM -lICE -lgdbm -lossaudio -ltermcap -lintl -lm -lutil -lossaudio
--- update-elc.stamp ---
./xemacs -nd -batch -l /var/obj/pkgsrc/editors/xemacs/work/xemacs-21.4.24/src/../lisp/update-elc.el
^C

Started under gdb(1) I get

(gdb) run
Starting program: /var/obj/pkgsrc/editors/xemacs/work/xemacs-21.4.24/src/xemacs -nd -batch -l /var/obj/pkgsrc/editors/xemacs/work/xemacs-21.4.24/src/../lisp/update-elc.el
^C
Program received signal SIGINT, Interrupt.
0x00000000005639f5 in calloc (nmemb=<optimized out>, size=1) at gmalloc.c:1180
1180      __ptr_t result = malloc (nmemb * size);
(gdb) bt
#0 0x00000000005639f5 in calloc (nmemb=<optimized out>, size=1) at gmalloc.c:1180
#1  0x0000000000446746 in xcalloc (elsize=1, nelem=24) at alloc.c:258
#2  xmalloc_and_zero (size=size@entry=24) at alloc.c:267
#3 0x0000000000468464 in Dynarr_newf (elsize=elsize@entry=8) at dynarr.c:130
#4  0x0000000000449d5b in reinit_alloc_once_early () at alloc.c:3907
#5  0x0000000000449dcb in init_alloc_once_early () at alloc.c:3937
#6 0x00000000004707f0 in xemacs_21_4_24_x86_64__netbsd (argc=5, argv=0x7f7fff59ea58, envp=<optimized out>, restart=restart@entry=0)
    at emacs.c:1328
#7 0x0000000000575476 in main (argc=<optimized out>, argv=<optimized out>, envp=0x7f7fff59ea88) at emacs.c:2829
(gdb)

and xemacs appears to be stuck in what looks like a malloc(3) wrapper

<snip from gmalloc.c>
   1175 /* Allocate an array of NMEMB elements each SIZE bytes long.
   1176    The entire array is initialized to zeros.  */
   1177 __ptr_t
   1178 calloc (__malloc_size_t nmemb, __malloc_size_t size)
   1179 {
   1180   __ptr_t result = malloc (nmemb * size);
   1181
   1182   if (result != NULL)
   1183     (void) memset (result, 0, nmemb * size);
   1184
   1185   return result;
   1186 }
</snip>

Building with "-Os" or "-O1" via a hacks.mk file gets me over this hang, but the resulting xemacs then fails compiling an elisp file further down the package build:

[...]
Compiling /var/obj/pkgsrc/editors/xemacs/work/xemacs-21.4.24/lisp/bytecomp.el... While compiling toplevel forms in file /var/obj/pkgsrc/editors/xemacs/work/xemacs-21.4.24/lisp/bytecomp.el:
  !! Invalid read syntax ((")"))
>>Error occurred processing /var/obj/pkgsrc/editors/xemacs/work/xemacs-21.4.24/lisp/bytecomp.el:
Invalid read syntax: ")"
Done
*** [update-elc.stamp] Error code 1

Building with "-O0" completes the package build successfully, as does (surprise!) building with "-O3". Both binarieas work fine.

The "-fno-optimize-strlen" hack applied by editors/emacs2{5,6} (on gcc v5, editors/emacs2{1,2] just build with "-O0") did not make a difference for xemacs.

Anything else I could check or provide? Any insights?

Cheerio,
hauke

--
     The ASCII Ribbon Campaign                    Hauke Fath
()     No HTML/RTF in email	        Institut für Nachrichtentechnik
/\     No Word docs in email                     TU Darmstadt
     Respect for open standards              Ruf +49-6151-16-3281


Home | Main Index | Thread Index | Old Index