Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 75028

Summary: app-editors/xemacs-21.4.21-r1 fails to build: Segmentation fault
Product: Gentoo Linux Reporter: Dirk Heinrichs <dirk.heinrichs.ext>
Component: Current packagesAssignee: XEmacs team <xemacs>
Status: CONFIRMED ---    
Severity: major CC: bugs.gentoo.org, eradicator, hardened, isidansick, jeremy_just, lssndrbarbieri, rose, tarmstro99
Priority: High    
Version: unspecified   
Hardware: x86   
OS: Linux   
Whiteboard:
Package list:
Runtime testing required: ---
Attachments: emerge info

Description Dirk Heinrichs 2004-12-20 02:46:32 UTC
I get this error message:

/bin/sh: line 1: 13095 Segmentation fault      ./xemacs -nd -batch -l /gentoo/build/portage/xemacs-21.4.15-r2/work/xemacs-21.4.15/src/../lisp/make-docfile.el -- -o ../lib-src/DOC -d /gentoo/build/portage/xemacs-21.4.15-r2/work/xemacs-21.4.15/src-i ../lib-src/../site-packages abbrev.c alloc.c blocktype.c buffer.c bytecode.c callint.c callproc.c casefiddle.c casetab.c chartab.c cmdloop.c cmds.c console.c console-stream.c data.c device.c dired.c doc.c doprnt.c dynarr.c editfns.c elhash.c emacs.c eval.c events.c filelock.c dumper.c balloon_help.c balloon-x.c postgresql.c menubar.c scrollbar.c dialog.c toolbar.c menubar-x.c scrollbar-x.c dialog-x.c toolbar-x.c gui-x.c mule.c mule-ccl.c mule-charset.c file-coding.c input-method-motif.c realpath.c inline.c linuxplay.c miscplay.c console-tty.c device-tty.c event-tty.c frame-tty.c objects-tty.c redisplay-tty.c cm.c terminfo.c gpmevent.c event-unixoid.c database.c sysdll.c emodules.c process-unix.c event-stream.c extents.c faces.c fileio.c filemode.c floatfns.c fns.c font-lock.c frame.c general.c glyphs.c glyphs-eimage.c glyphs-widget.c gui.c gutter.c hash.c imgproc.c indent.c insdel.c intl.c keymap.c line-number.c lread.c lstream.c macros.c marker.c md5.c minibuf.c objects.c opaque.c print.c process.c profile.c rangetab.c redisplay.c redisplay-output.c regex.c search.c select.c signal.c sound.c specifier.c strftime.c symbols.c syntax.c sysdep.c undo.c console-x.c device-x.c event-Xt.c frame-x.c glyphs-x.c objects-x.c redisplay-x.c select-x.c xgccache.c widget.c window.c
make[1]: *** [../lib-src/DOC] Error 139
make[1]: Leaving directory `/gentoo/build/portage/xemacs-21.4.15-r2/work/xemacs-21.4.15/src'
make: *** [src] Error 2


Reproducible: Always
Steps to Reproduce:
emerge xemacs

Actual Results:  
emerge stops 
 

Expected Results:  
xemacs should be compiled and installed. 
 

Portage 2.0.51-r8 (!/linux26-x86-2004.2.profile, gcc-3.4.3, 
glibc-2.3.4.20041102-r0, 2.6.9 i686) 
================================================================= 
System uname: 2.6.9 i686 Intel(R) Pentium(R) M processor 1500MHz 
Gentoo Base System version 1.6.8 
Python:              dev-lang/python-2.3.4 [2.3.4 (#1, Oct 21 2004, 14:22:16)] 
distcc 2.18.3 i686-pc-linux-gnu (protocols 1 and 2) (default port 3632) 
[disabled] 
ccache version 2.3 [enabled] 
dev-lang/python:     2.3.4 
sys-devel/autoconf:  2.59-r6, 2.13 
sys-devel/automake:  1.8.5-r2, 1.5, 1.4_p6, 1.6.3, 1.7.9, 1.9.3 
sys-devel/binutils:  2.15.92.0.2-r2 
sys-devel/libtool:   1.5.10-r2 
virtual/os-headers:  2.6.8.1-r1 
ACCEPT_KEYWORDS="x86 ~x86" 
AUTOCLEAN="yes" 
CFLAGS="-O3 -march=pentium4 -fomit-frame-pointer -pipe" 
CHOST="i686-pc-linux-gnu" 
CONFIG_PROTECT="/etc /usr/X11R6/lib/X11/xkb /usr/kde/2/share/config /usr/kde/3.3/env /usr/kde/3.3/share/config /usr/kde/3.3/shutdown /usr/kde/3/share/config /usr/share/config /usr/share/texmf/dvipdfm/config/ /usr/share/texmf/dvips/config/ /usr/share/texmf/tex/generic/config/ /usr/share/texmf/tex/platex/config/ /usr/share/texmf/xdvi/ /var/qmail/control" 
CONFIG_PROTECT_MASK="/etc/gconf /etc/terminfo /etc/env.d" 
CXXFLAGS="-O3 -march=pentium4 -fomit-frame-pointer -pipe" 
DISTDIR="/gentoo/distfiles" 
FEATURES="autoaddcvs ccache distlocks sandbox" 
GENTOO_MIRRORS="ftp://ftp-stud.fht-esslingen.de/pub/Mirrors/gentoo/ 
ftp://mirrors.sec.informatik.tu-darmstadt.de/gentoo/ 
http://ftp.easynet.nl/mirror/gentoo/ 
http://ftp.snt.utwente.nl/pub/os/linux/gentoo 
http://ftp.uni-erlangen.de/pub/mirrors/gentoo" 
MAKEOPTS="-j2" 
PKGDIR="/usr/portage/packages" 
PORTAGE_TMPDIR="/gentoo/build" 
PORTDIR="/usr/portage" 
PORTDIR_OVERLAY="/usr/local/portage" 
SYNC="rsync://rsync.gentoo.org/gentoo-portage" 
USE="X Xaw3d aalib acl alsa apm arts avi berkdb bitmap-fonts bluetooth cddb 
cdparanoia cdr crypt cups doc dvd emacs encodefoomaticdb ftp gdbm gif gnokii 
gphoto2 gpm gstreamer gtk2 guile hardened hbci icq imap imlib irda jpeg kde 
koffice-plugin lcms libg++ libwww mad maildir mbox mime motif mpeg mule 
ncurses nls no-old-linux noamazon noantlr nobcel nobeanutils 
nobshnocommonslogging nocommonsnet nojdepend nojsch nojython nolog4j nooro 
noregexp norhino noxalan noxerces nptl nptlonly objcofx oggvorbis opengl oss 
pam pcre pdflib perl perlsuid pic pie png postgres ppds pwdb python qt 
quicktime readline savedconfig sdl slang sms speex spell sse ssl tcltk tcpd 
tetex theora threads tiff truetype unicode wifi wxwindows x86 xine xml2 xmms 
xosd xprint xscreensaver xv zlib linguas_de"
Comment 1 Kalin KOZHUHAROV 2005-01-24 18:16:40 UTC
xemacs started segfaulting on startup some time ago on my laptop. As I don't use it too often, I have only a vague idea of when :-(

Trying to reemerge glibc,gcc,xemacs didin't help as now on `emerge xemacs -av` I get the following:
===============
...
[ebuild   R   ] app-editors/xemacs-21.4.15-r2  +X -Xaw3d -athena +berkdb -canna -dnd -freewnn -gpm -jpeg -ldap -motif +mule -nas -neXt -png -postgres -tiff -xface 0 kB 

....
Loading loadhist.el...
Loading loaddefs.el...
Loading site-load.el...

Bootstrapping from temacs...
Fatal error (11).

Your files have been auto-saved.
Use `M-x recover-session' to recover them.
[snip useless comments]
in case of future recurrance of the crash.

Lisp backtrace follows:

make[1]: *** [update-elc.stamp] Segmentation fault
make[1]: Leaving directory `/var/tmp/portage/xemacs-21.4.15-r2/work/xemacs-21.4.15/src'
make: *** [src] Error 2

!!! ERROR: app-editors/xemacs-21.4.15-r2 failed.
!!! Function src_compile, Line 168, Exitcode 2
!!! (no error message)
!!! If you need support, post the topmost build error, NOT this status message.
===========

I produces core after `ulimit -c unlimited` and here is what gdb says:
#0  0x402b3d61 in kill () from /lib/libc.so.6
(gdb) where
#0  0x402b3d61 in kill () from /lib/libc.so.6
#1  0x080b317f in fatal_error_signal ()
#2  0x0000000b in ?? ()
#3  0x00000001 in ?? ()
#4  0x402b5784 in bsearch () from /lib/libc.so.6
#5  0x080adae0 in init_editfns ()
#6  0x00000004 in ?? ()
#7  0x08ac884c in ?? ()
#8  0xffffffff in ?? ()
#9  0x080b3895 in xemacs_21_4_15_i686_pc_linux ()
#10 0x080b4b7e in main ()

Well, not too usefull. So I tried to emerge with -g ang here it goes:
(gdb) where
#0  0x402b3d61 in kill () from /lib/libc.so.6
#1  0x080b11a5 in fatal_error_signal (sig=11) at emacs.c:642
#2  <signal handler called>
#3  0x402f0c23 in strlen () from /lib/libc.so.6
#4  0x081b172e in init_system_name () at sysdep.c:2349
#5  0x080aa799 in init_editfns () at editfns.c:87
#6  0x080b23e0 in xemacs_21_4_15_i686_pc_linux (argc=10, argv=0x8aba8e0, envp=0xbfffe06c, restart=1) at emacs.c:2363
#7  0x080b30d1 in main (argc=5, argv=0xbfffe054, envp=0xbfffe06c) at emacs.c:2892
#8  0x402a0297 in __libc_start_main () from /lib/libc.so.6
#9  0x0807ffa1 in _start ()

No idea at all what to look after...# gcc -v
Reading specs from /usr/lib/gcc-lib/i686-pc-linux-gnu/3.3.5/specs
Configured with: /var/tmp/portage/gcc-3.3.5-r1/work/gcc-3.3.5/configure --enable-version-specific-runtime-libs --prefix=/usr --bindir=/usr/i686-pc-linux-gnu/gcc-bin/3.3.5 --includedir=/usr/lib/gcc-lib/i686-pc-linux-gnu/3.3.5/include --datadir=/usr/share/gcc-data/i686-pc-linux-gnu/3.3.5 --mandir=/usr/share/gcc-data/i686-pc-linux-gnu/3.3.5/man --infodir=/usr/share/gcc-data/i686-pc-linux-gnu/3.3.5/info --with-gxx-include-dir=/usr/lib/gcc-lib/i686-pc-linux-gnu/3.3.5/include/g++-v3 --host=i686-pc-linux-gnu --disable-altivec --enable-nls --without-included-gettext --enable-__cxa_atexit --enable-clocale=gnu --with-system-zlib --disable-checking --disable-werror --disable-libunwind-exceptions --enable-shared --enable-threads=posix --disable-multilib --disable-libgcj --enable-languages=c,c++
Thread model: posix
gcc version 3.3.5  (Gentoo Linux 3.3.5-r1, ssp-3.3.2-3, pie-8.7.7.1)
Comment 2 Kalin KOZHUHAROV 2005-01-24 22:30:33 UTC
Well, well, well...

After some unknown magic (a few unsuccesfull emerges and a few reboots) my already installed xemacs works again.

I tried to emerge xemacs again and this time I did it right.

Spooky at best.
Comment 3 Michael Labhard 2005-06-09 19:48:43 UTC
I see this error also:

gcc -c -O2 -fPIC  -Demacs -I. -DHAVE_CONFIG_H -I/usr/X11R6/include EmacsManager.c
../lib-src/make-dump-id
gcc -c -O2 -fPIC  -Demacs -I. -DHAVE_CONFIG_H -I/usr/X11R6/include dump-id.c
gcc -O2 -fPIC   -L/usr/X11R6/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 eldap.o postgresql.o menubar.o scrollbar.o
dialog.o toolbar.o menubar-x.o scrollbar-x.o dialog-x.o toolbar-x.o gui-x.o
realpath.o inline.o linuxplay.o nas.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 gpmevent.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 vm-limit.o  EmacsFrame.o EmacsShell.o
TopLevelEmacsShell.o TransientEmacsShell.o EmacsManager.o   dump-id.o
../lwlib/liblw.a  -laudio -lXm -ltiff -lpng -ljpeg -lz -lXpm -lXmu -lXt -lXext
-lX11 -lSM -lICE -lgdbm -lgdbm_compat -lgpm -lncurses -lpq -lldap -lm -lutil
./xemacs -nd -batch -l
/var/tmp/portage/xemacs-21.4.15-r3/work/xemacs-21.4.15/src/../lisp/update-elc.el
make[1]: *** [update-elc.stamp] Segmentation fault
make[1]: Leaving directory
`/var/tmp/portage/xemacs-21.4.15-r3/work/xemacs-21.4.15/src'


The command:

SANDBOX_DISABLED="1" emerge xemacs

Portage 2.0.51.19 (default-linux/amd64/2004.3, gcc-3.4.3,
glibc-2.3.4.20041102-r1, 2.6.9-gentoo-r1 x86_64)
=================================================================
System uname: 2.6.9-gentoo-r1 x86_64 AMD Opteron(tm) Processor 246
Gentoo Base System version 1.4.16
Python:              dev-lang/python-2.3.5 [2.3.5 (#1, May 14 2005, 12:28:21)]
ccache version 2.3 [enabled]
dev-lang/python:     2.3.5
sys-apps/sandbox:    [Not Present]
sys-devel/autoconf:  2.13, 2.59-r6
sys-devel/automake:  1.5, 1.8.5-r3, 1.6.3, 1.9.5, 1.7.9-r1, 1.4_p6
sys-devel/binutils:  2.15.92.0.2-r10
sys-devel/libtool:   1.5.16
virtual/os-headers:  2.6.8.1-r4
ACCEPT_KEYWORDS="amd64"
AUTOCLEAN="yes"
CFLAGS="-O2 -fPIC"
CHOST="x86_64-pc-linux-gnu"
CONFIG_PROTECT="/etc /opt/resin/conf /usr/kde/2/share/config /usr/kde/3.3/env
/usr/kde/3.3/share/config /usr/kde/3.3/shutdown /usr/kde/3/share/config
/usr/lib/X11/xkb /usr/lib/mozilla/defaults/pref /usr/share/config
/usr/share/texmf/dvipdfm/config/ /usr/share/texmf/dvips/config/
/usr/share/texmf/tex/generic/config/ /usr/share/texmf/tex/platex/config/
/usr/share/texmf/xdvi/ /var/qmail/control"
CONFIG_PROTECT_MASK="/etc/gconf /etc/terminfo /etc/env.d"
CXXFLAGS="-O2 -fPIC"
DISTDIR="/opt/no_archive/portage/distfiles"
FEATURES="autoaddcvs autoconfig buildpkg ccache distlocks sandbox sfperms strict"
GENTOO_MIRRORS="http://128.213.5.34/gentoo/"
MAKEOPTS="-j2"
PKGDIR="/opt/no_archive/portage/packages"
PORTAGE_TMPDIR="/var/tmp"
PORTDIR="/usr/portage"
PORTDIR_OVERLAY="/usr/local/portage"
SYNC="rsync://rsync.gentoo.org/gentoo-portage"
USE="amd64 X acpi alsa arts berkdb bitmap-fonts cdr crypt cups curl doc esd fam
flac font-server fortran gd gdbm gif gphoto2 gpm gtk imagemagick imlib ipv6 java
jp2 jpeg junit kde ldap libg++ libwww log4cpp lzw lzw-tiff mikmod motif mozilla
mp3 multilib mysql nas ncurses nls ogg opengl oss pam pdflib perl plotutils png
postgres python qt readline ruby sdl slang spell ssl svg tcltk tcpd tetex tiff
truetype truetype-fonts type1-fonts usb userlocales vorbis wxwindows xine
xinerama xml2 xmms xpm xrandr xv zlib userland_GNU kernel_linux elibc_glibc"
Unset:  ASFLAGS, CBUILD, CTARGET, LANG, LC_ALL, LDFLAGS, LINGUAS

Comment 4 Attila Stehr 2005-07-02 06:15:20 UTC
same problem with xemacs-21.4.15-r3 on AMD64

USE="mule" emerge -vuD xemacs


gcc -c -march=athlon64 -O3 -pipe -fomit-frame-pointer  -Demacs -I.
-DHAVE_CONFIG_H -I/usr/X11R6/include dump-id.c
gcc -march=athlon64 -O3 -pipe -fomit-frame-pointer   -L/usr/X11R6/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
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 gpmevent.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
vm-limit.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 -lgdbm_compat -lgpm -lncurses -lm -lutil
./xemacs -nd -batch -l
/var/tmp/portage/xemacs-21.4.15-r3/work/xemacs-21.4.15/src/../lisp/update-elc.el
make[1]: *** [update-elc.stamp] Segmentation fault


Portage 2.0.51.19 (default-linux/amd64/2005.0, gcc-3.4.3,
glibc-2.3.4.20041102-r1, 2.6.11-gentoo-r7 x86_64)
=================================================================
System uname: 2.6.11-gentoo-r7 x86_64 AMD Athlon(tm) 64 Processor 3000+
Gentoo Base System version 1.6.12
Python:              dev-lang/python-2.3.5 [2.3.5 (#1, May 30 2005, 19:34:17)]
dev-lang/python:     2.3.5
sys-apps/sandbox:    [Not Present]
sys-devel/autoconf:  2.13, 2.59-r6
sys-devel/automake:  1.8.5-r3, 1.6.3, 1.5, 1.7.9-r1, 1.4_p6, 1.9.5
sys-devel/binutils:  2.15.92.0.2-r10
sys-devel/libtool:   1.5.16
virtual/os-headers:  2.6.8.1-r4
ACCEPT_KEYWORDS="amd64"
AUTOCLEAN="yes"
CFLAGS="-march=athlon64 -O3 -pipe -fomit-frame-pointer"
CHOST="x86_64-pc-linux-gnu"
CONFIG_PROTECT="/etc /usr/kde/2/share/config /usr/kde/3/share/config
/usr/lib/X11/xkb /usr/share/config /usr/share/texmf/dvipdfm/config/
/usr/share/texmf/dvips/config/ /usr/share/texmf/tex/generic/config/
/usr/share/texmf/tex/platex/config/ /usr/share/texmf/xdvi/ /var/qmail/control"
CONFIG_PROTECT_MASK="/etc/gconf /etc/terminfo /usr/X11R6/bin/startx /etc/env.d"
CXXFLAGS="-march=athlon64 -O3 -pipe -fomit-frame-pointer"
DISTDIR="/usr/portage/distfiles"
FEATURES="autoaddcvs autoconfig candy ccache distlocks sandbox severe sfperms
strict test"
GENTOO_MIRRORS="http://pandemonium.tiscali.de/pub/gentoo/
ftp://ftp.tu-clausthal.de/pub/linux/gentoo/
ftp://ftp.gentoo.mesh-solutions.com/gentoo/
http://ftp-stud.fht-esslingen.de/pub/Mirrors/gentoo/"
LANG="de_DE@euro"
LC_ALL="de_DE@euro"
LINGUAS="de_DE@euro"
MAKEOPTS="-j2"
PKGDIR="/usr/portage/packages"
PORTAGE_TMPDIR="/var/tmp"
PORTDIR="/usr/portage"
SYNC="rsync://rsync.de.gentoo.org/gentoo-portage"
USE="X aac acpi alsa amd64 avi berkdb bitmap-fonts bzlib cdr crypt cups curl dga
directfb dlloader dts dvd dvdr dvdread eds emacs encode esd exif fam fbcon
ffmpeg font-server foomaticdb fortran gdbm gif gimpprint gnome gpm gstreamer gtk
gtk2 hal hardened howl imagemagick imlib ipv6 ithreads javascript jp2 jpeg lcms
libwww lzo lzw lzw-tiff mad matroska memlimit mikmod mmap mng mozdevelop mozsvg
mp3 mpeg ncurses nls nptl nvidia ogg oggvorbis on-the-fly-crypt openal opengl
oss pam pda pdflib perl png ppds python quicktime readline real sdl slang ssl
svg tcltk tcpd test tetex tga threads tidy tiff truetype truetype-fonts
type1-fonts unicode usb userlocales videos vorbis wmf xine xml2 xmms xpm xprint
xrandr xtermtoolbar xv xvid xvmc zlib linguas_de_DE@euro userland_GNU
kernel_linux elibc_glibc"
Unset:  ASFLAGS, CBUILD, CTARGET, LDFLAGS, PORTDIR_OVERLAY
Comment 5 Dirk Heinrichs 2005-10-20 06:15:30 UTC
Problem is still there in xemacs-21.4.15-r3. 
Comment 6 Dirk Heinrichs 2005-11-23 05:18:37 UTC
I gave it another try, after switching from hardened gcc to vanilla (3.4.4). 
Now xemacs compiles just fine. So it seems to be a hardened toolchain issue. 
Comment 7 Attila Stehr 2005-11-23 16:55:33 UTC
affirmed

hardened@gentoo.org added to CC list
Comment 8 Kevin F. Quinn (RETIRED) gentoo-dev 2005-11-26 02:47:11 UTC
Looks like something doesn't like PIE.  Try:

CFLAGS="-nopie" emerge xemacs

with the hardened compiler and report back, please.
Comment 9 Attila Stehr 2005-11-26 09:40:19 UTC
Okay, the "-nopie" did it :) ==>

CFLAGS="-nopie -march=athlon64 -O3 -ffast-math -funroll-all-loops -fpeel-loops
-ftracer -funswitch-loops -funit-at-a-time -pipe -fomit-frame-pointer"
CXXFLAGS="-nopie -march=athlon64 -O3 -ffast-math -funroll-all-loops -fpeel-loops
-ftracer -funswitch-loops -funit-at-a-time -pipe -fomit-frame-pointer" emerge
-vD xemacs

Can the ebuild file / source code altered that way that giving "-nopie" as CFLAG
is not needed?
Comment 10 Dirk Heinrichs 2005-11-28 02:42:59 UTC
Adding -nopie to CFLAGS works for me too. 
Comment 11 Hans de Graaff gentoo-dev 2007-01-07 15:31:35 UTC
Thanks everyone for the feedback, it's good to know that this issue is solved with the -nopie flag in CFLAGS. This is not something that can be put in the ebuild automatically, though, because it would silently subvert the purpose of being on a hardened profile. I will put a note about this issue in the ebuild, though.

I'm leaving this bug open for now as the real problem should still be solved. It would be great if someone on a hardened profile could do a bit more investigating to see if the actual cause of this crash be be found and fixed.
Comment 12 Kevin F. Quinn (RETIRED) gentoo-dev 2007-02-18 14:25:33 UTC
Ah; this one had dropped into the mists of time for us.  The '-nopie' confirms it's an incompatibility with the hardened toolchain.  If that incompatibility turns out to be too much trouble to solve, adding:

filter-flags -fPIE

to the ebuild will disable it.  However before that happens I wanted to determine what is causing the problem and whether it can be easily fixed.
Comment 13 Kevin F. Quinn (RETIRED) gentoo-dev 2007-02-18 15:59:44 UTC
ok; what's happening is that src/vm-limits.c:check_memory_limits is issuing a warning via (*warn_function)(), and the data used by the warning function has not been initialised (Vpending_warnings in eval.c) because src/eval.c:vars_of_eval hasn't yet been called.  This means it dereferences a null object which causes a segfault.

This is all because xemacs is doing it's own thing to work out memory limits.  In particular, it's using 'environ' to find the base of the heap (src/sysdep.c), which not a particularly good way of doing it - there's nothing to say that environ is at the bottom of the heap, which is what xemacs is assuming, and it's simply false for PIEs.

This was fixed for emacs itself, which (at least when built PIE) uses the 'data_start' symbol.

Of course really there are two problems:
(1) the use of 'environ' is relying on undefined behaviour
(2) the warning function is using un-initialised data.

I suggest chatting to upstream about it - perhaps if they're planning to import more recent code from the emacs base (src/sysdep.c is (c) 1995 in xemacs, (c) 2001 in emacs) this issue can be resolved in xemacs the same way it was in emacs.
Comment 14 Hans de Graaff gentoo-dev 2007-08-07 05:12:01 UTC
*** Bug 63358 has been marked as a duplicate of this bug. ***
Comment 15 Hans de Graaff gentoo-dev 2007-08-17 19:46:34 UTC
I've (finally...) posted a note about this to the XEmacs development list.
Comment 16 Jeremy Huddleston (RETIRED) gentoo-dev 2008-10-17 05:04:12 UTC
still on xemacs-21.4.21-r1 ... updating title...

any response from upstream?
Comment 17 Hans de Graaff gentoo-dev 2008-10-26 14:02:35 UTC
No response. XEmacs development is very slow at the moment, so I don't really expect this to get fixed any time soon.
Comment 18 Jérémy Just 2010-12-25 18:14:39 UTC
(In reply to comment #11)
> Thanks everyone for the feedback, it's good to know that this issue is solved
> with the -nopie flag in CFLAGS. This is not something that can be put in the
> ebuild automatically, though, because it would silently subvert the purpose of
> being on a hardened profile.

  I encountered the same bug with xemacs-21.4.22-r1 on PPC hardened, gcc-4.4.4. I tried the solution given for Emacs (see bug #345001), relying on changing the value of /proc/sys/kernel/randomize_va_space during the build, and it seems to work. The advantage over the NOPIE trick is that the resulting binary still have the PIE things inside.

  So, this is how I did it:
<<<<<<<<<<
# cat /proc/sys/kernel/randomize_va_space
2
# echo 0 > /proc/sys/kernel/randomize_va_space
# emerge --oneshot xemacs
# echo 2 > /proc/sys/kernel/randomize_va_space
>>>>>>>>>>

  The value '1' did not work, but '0' is fine. I don't know the difference and need to read a few things about the randomize_va_space kernel parameter.


  Could that be included in the ebuild without side effects?


<<<<<<<<<<<<<<<<<<<<<<<<<
Portage 2.1.9.25 (hardened/linux/powerpc/ppc32, gcc-4.4.4, glibc-2.11.2-r3,
2.6.28-hardened-r9 ppc)
=================================================================
System uname:
Linux-2.6.28-hardened-r9-ppc-7447A,_altivec_supported-with-gentoo-1.12.14
Timestamp of tree: Sat, 25 Dec 2010 15:15:03 +0000
app-shells/bash:     4.1_p7
dev-lang/python:     2.6.5-r3, 3.1.2-r4
dev-util/cmake:      2.8.1-r2
sys-apps/baselayout: 1.12.14-r1
sys-apps/sandbox:    2.4
sys-devel/autoconf:  2.13, 2.65-r1
sys-devel/automake:  1.9.6-r3, 1.10.3, 1.11.1
sys-devel/binutils:  2.20.1-r1
sys-devel/gcc:       4.4.4-r2
sys-devel/gcc-config: 1.4.1
sys-devel/libtool:   2.2.10
sys-devel/make:      3.81-r2
virtual/os-headers:  2.6.30-r1 (sys-kernel/linux-headers)
ACCEPT_KEYWORDS="ppc"
CBUILD="powerpc-unknown-linux-gnu"
CFLAGS="-O2 -mcpu=7450 -maltivec -mabi=altivec -fno-strict-aliasing -pipe"
CHOST="powerpc-unknown-linux-gnu"
CXXFLAGS="-O2 -mcpu=7450 -maltivec -mabi=altivec -fno-strict-aliasing -pipe"
FEATURES="assume-digests binpkg-logs distlocks fixlafiles fixpackages news
parallel-fetch protect-owned sfperms strict unknown-features-warn unmerge-logs
unmerge-orphans userfetch"
LDFLAGS="-Wl,-O1 -Wl,--as-needed"
LINGUAS="fr en"
MAKEOPTS="-j2"
USE="acl altivec apache2 bash-completion berkdb bzip2 cdr cgi clamav cli
cracklib crypt cxx dbm dri dvd dvdr fastcgi gd gdbm gif gmp gnutls gpm graphviz
hardened hardenedphp iconv imagemagick imap jpeg mbox modules mpeg mudflap mule
ncurses nptl nptlonly openmp pam pcre pdf perl pic png posix postgres ppc
python readline session spell ssl svg symlink sysfs tcpd tetex tiff urandom xml
xorg xpm zlib" ALSA_CARDS="aoa aoa-fabric-layout aoa-onyx aoa-soundbus
aoa-soundbus-i2s aoa-tas aoa-toonie powermac" ALSA_PCM_PLUGINS="adpcm alaw asym
copy dmix dshare dsnoop empty extplug file hooks iec958 ioplug ladspa lfloat
linear meter mmap_emul mulaw multi null plug rate route share shm softvol"
APACHE2_MODULES="actions alias auth_basic auth_digest authn_anon authn_default
authn_file authz_default authz_groupfile authz_host authz_owner authz_user
autoindex cache dbd deflate dir env expires file_cache filter headers ident
imagemap include info log_config logio mem_cache mime mime_magic negotiation
rewrite setenvif so speling status unique_id userdir usertrack vhost_alias cgi
fcgid" COLLECTD_PLUGINS="df interface irq load memory rrdtool swap syslog"
ELIBC="glibc" GPSD_PROTOCOLS="ashtech aivdm earthmate evermore fv18 garmin
garmintxt gpsclock itrax mtk3301 nmea ntrip navcom oceanserver oldstyle oncore
rtcm104v2 rtcm104v3 sirf superstar2 timing tsip tripmate tnt ubx"
INPUT_DEVICES="keyboard mouse" KERNEL="linux" LCD_DEVICES="ncurses text"
LINGUAS="fr en" PHP_TARGETS="php5-3" RUBY_TARGETS="ruby18" USERLAND="GNU"
VIDEO_CARDS="radeon fbdev dummy vga" XTABLES_ADDONS="quota2 psd pknock lscan
length2 ipv4options ipset ipp2p iface geoip fuzzy condition tee tarpit sysrq
steal rawnat logmark ipmark dhcpmac delude chaos account" 
Unset:  CPPFLAGS, CTARGET, EMERGE_DEFAULT_OPTS, FFLAGS, INSTALL_MASK, LANG,
LC_ALL, PORTAGE_BUNZIP2_COMMAND, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS,
PORTAGE_RSYNC_EXTRA_OPTS
>>>>>>>>>>>>>>>>>>>>>>>>>  
Comment 19 Hans de Graaff gentoo-dev 2011-08-07 08:14:22 UTC
*** Bug 377515 has been marked as a duplicate of this bug. ***
Comment 20 William Waisse 2011-08-14 19:02:58 UTC
same problem here ( hardened toolchain too )
but on app-editors/xemacs-21.4.22-r1 :

Testing for Lisp shadows ...
make[1]: *** [xemacs.dmp] Segmentation fault
make[1]: *** Deleting file `xemacs.dmp'
make[1]: Leaving directory `/var/tmp/portage/app-editors/xemacs-21.4.22-r1/work/xemacs-21.4.22/src'
Comment 21 Juergen Rose 2011-11-18 10:02:17 UTC
And also with xemacs-21.4.22-r2 on i686 there is the same problem.
Comment 22 Hans de Graaff gentoo-dev 2011-11-19 08:09:47 UTC
It would be interesting to know if xemacs 21.5.x has the same problem. So far I haven't seen reports about that version yet.
Comment 23 Michael Edenfield 2012-02-20 03:03:55 UTC
I am still getting the same behavior on 21.5.31 as with previous versions: with the hardened toolchain the ebuild either runs my CPU up to 100% and hangs, or segfaults almost immediately, depending on the state of PaX in my kernel. CFLAGS="-nopie" fixes the build.
Comment 24 mike 2012-09-15 14:10:07 UTC
Created attachment 323888 [details]
emerge info
Comment 25 mike 2012-09-15 14:10:39 UTC
(In reply to comment #24)
> Created attachment 323888 [details]
> emerge info

Same problem here after all with x86 with app-editors/xemacs-21.4.22-r2 on profile hardened/linux/x86. Error message is:

Loading site-load...
Finding pointers to doc strings...
Finding pointers to doc strings...done
Dumping under the name xemacs
Testing for Lisp shadows ...
make[1]: *** [xemacs.dmp] Segmentation fault
make[1]: *** Deleting file `xemacs.dmp'
make[1]: Leaving directory `/var/tmp/portage/app-editors/xemacs-21.4.22-r2/work/xemacs-21.4.22/src'
make: *** [src] Error 2
emake failed
 * ERROR: app-editors/xemacs-21.4.22-r2 failed (compile phase):
 *   emake failed
 * 
 * Call stack:
 *     ebuild.sh, line  85:  Called src_compile
 *   environment, line 2859:  Called die
 * The specific snippet of code:
 *       emake || die "emake failed"
 *
Comment 26 Magnus Granberg gentoo-dev 2013-01-12 13:49:03 UTC
The newer emacs have a workaround for hardened. Some one willing to test the workarond?
Comment 27 Hans de Graaff gentoo-dev 2013-01-13 10:04:56 UTC
(In reply to comment #26)
> The newer emacs have a workaround for hardened. Some one willing to test the
> workarond?

emacs != xemacs.
Comment 28 Toralf Förster gentoo-dev 2016-06-12 13:31:14 UTC
FWIW I can compile at my tinderbox app-editors/emacs-24.5-r1 w/o caring about -nopie (hardened 64 bit Gentoo).

But I do still run reliable into bug #540818, which can just be circumvented by emerging xemacs with -nopie.
Comment 29 Mats Lidell gentoo-dev 2017-12-11 22:20:31 UTC
The xemacs ebuilds have been modified to use -nopie which makes them build. This ticket is left open as a reminder, for nudging upstream or anyone else who has the know how, to solve the bigger problem with allowing XEmacs to be built with PIE.