Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 116537 - app-emulation/xen-3.0.0-r1 -fPIC
Summary: app-emulation/xen-3.0.0-r1 -fPIC
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: New packages (show other bugs)
Hardware: AMD64 Linux
: High major (vote)
Assignee: Chris Bainbridge (RETIRED)
URL:
Whiteboard:
Keywords:
: 114657 (view as bug list)
Depends on:
Blocks:
 
Reported: 2005-12-23 13:16 UTC by Nicolai Guido Klausen
Modified: 2006-04-10 06:54 UTC (History)
3 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
fPIC patch (xen-fPIC.patch,336 bytes, patch)
2006-01-26 13:56 UTC, Simon Stelling (RETIRED)
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Nicolai Guido Klausen 2005-12-23 13:16:47 UTC
.opic libxenctrl.so -lz -lxenctrl
ln -sf libxenguest.so.3.0.0 libxenguest.so.3.0
ln -sf libxenguest.so.3.0 libxenguest.so
make[2]: `libxenguest.so.3.0' is up to date.
make[2]: `libxenguest.so.3.0.0' is up to date.
make[2]: Leaving directory `/var/tmp/portage/xen-3.0.0-r1/work/xen-3.0-testing-20051206/tools/libxc'
make[1]: Leaving directory `/var/tmp/portage/xen-3.0.0-r1/work/xen-3.0-testing-20051206/tools/libxc'
make[1]: Entering directory `/var/tmp/portage/xen-3.0.0-r1/work/xen-3.0-testing-20051206/tools/xenstore'
gcc  -DPIC -march=athlon64 -O2 -pipe -mno-tls-direct-seg-refs -fno-pie -fno-stack-protector -Wdeclaration-after-statement  -m64 -Wdeclaration-after-statement  -m64 -Wall  -Werror -Wp,-MD,.xs.opic.d  -I../../tools/libxc -I. -fPIC -c -o xs.opic xs.c
gcc  -DPIC -march=athlon64 -O2 -pipe -mno-tls-direct-seg-refs -fno-pie -fno-stack-protector -Wdeclaration-after-statement  -m64 -Wdeclaration-after-statement  -m64 -Wall  -Werror -Wp,-MD,.xs_lib.opic.d  -I../../tools/libxc -I. -fPIC -c -o xs_lib.opic xs_lib.c
gcc -march=athlon64 -O2 -pipe -mno-tls-direct-seg-refs -fno-pie -fno-stack-protector -Wdeclaration-after-statement  -m64 -Wdeclaration-after-statement  -m64 -Wall  -Werror -Wp,-MD,.libxenstore.so.d  -I../../tools/libxc -I.   -m64  -L../../tools/libxc -Wl,-soname -Wl,libxenstore.so -shared -o libxenstore.so xs.opic xs_lib.opic -lpthread
gcc  -march=athlon64 -O2 -pipe -mno-tls-direct-seg-refs -fno-pie -fno-stack-protector -Wdeclaration-after-statement  -m64 -Wdeclaration-after-statement  -m64 -Wall  -Werror -Wp,-MD,.xenstored_core.o.d  -I../../tools/libxc -I. -c -o xenstored_core.o xenstored_core.c
gcc  -march=athlon64 -O2 -pipe -mno-tls-direct-seg-refs -fno-pie -fno-stack-protector -Wdeclaration-after-statement  -m64 -Wdeclaration-after-statement  -m64 -Wall  -Werror -Wp,-MD,.xenstored_watch.o.d  -I../../tools/libxc -I. -c -o xenstored_watch.o xenstored_watch.c
gcc  -march=athlon64 -O2 -pipe -mno-tls-direct-seg-refs -fno-pie -fno-stack-protector -Wdeclaration-after-statement  -m64 -Wdeclaration-after-statement  -m64 -Wall  -Werror -Wp,-MD,.xenstored_domain.o.d  -I../../tools/libxc -I. -c -o xenstored_domain.o xenstored_domain.c
gcc  -march=athlon64 -O2 -pipe -mno-tls-direct-seg-refs -fno-pie -fno-stack-protector -Wdeclaration-after-statement  -m64 -Wdeclaration-after-statement  -m64 -Wall  -Werror -Wp,-MD,.xenstored_transaction.o.d  -I../../tools/libxc -I. -c -o xenstored_transaction.o xenstored_transaction.c
gcc  -march=athlon64 -O2 -pipe -mno-tls-direct-seg-refs -fno-pie -fno-stack-protector -Wdeclaration-after-statement  -m64 -Wdeclaration-after-statement  -m64 -Wall  -Werror -Wp,-MD,.xs_lib.o.d  -I../../tools/libxc -I. -c -o xs_lib.o xs_lib.c
gcc  -march=athlon64 -O2 -pipe -mno-tls-direct-seg-refs -fno-pie -fno-stack-protector -Wdeclaration-after-statement  -m64 -Wdeclaration-after-statement  -m64 -Wall  -Werror -Wp,-MD,.talloc.o.d  -I../../tools/libxc -I. -c -o talloc.o talloc.c
gcc  -march=athlon64 -O2 -pipe -mno-tls-direct-seg-refs -fno-pie -fno-stack-protector -Wdeclaration-after-statement  -m64 -Wdeclaration-after-statement  -m64 -Wall  -Werror -Wp,-MD,.utils.o.d  -I../../tools/libxc -I. -c -o utils.o utils.c
gcc  -march=athlon64 -O2 -pipe -mno-tls-direct-seg-refs -fno-pie -fno-stack-protector -Wdeclaration-after-statement  -m64 -Wdeclaration-after-statement  -m64 -Wall  -Werror -Wp,-MD,.tdb.o.d  -I../../tools/libxc -I. -c -o tdb.o tdb.c
gcc   -m64  -L../../tools/libxc  xenstored_core.o xenstored_watch.o xenstored_domain.o xenstored_transaction.o xs_lib.o talloc.o utils.o tdb.o   -lxenctrl -o xenstored
/usr/lib/gcc/x86_64-pc-linux-gnu/3.4.4/../../../../x86_64-pc-linux-gnu/bin/ld: xenstored_core.o: relocation R_X86_64_32 against `a local symbol' can not be used when making a shared object; recompile with -fPIC
xenstored_core.o: could not read symbols: Bad value
collect2: ld returned 1 exit status
make[1]: *** [xenstored] Error 1
make[1]: Leaving directory `/var/tmp/portage/xen-3.0.0-r1/work/xen-3.0-testing-20051206/tools/xenstore'
make: *** [all] Error 2
make: Leaving directory `/var/tmp/portage/xen-3.0.0-r1/work/xen-3.0-testing-20051206/tools'



# emerge --info
Portage 2.0.53 (default-linux/amd64/2005.1, gcc-3.4.4, glibc-2.3.5-r2, 2.6.14-gentoo-r2 x86_64)
=================================================================
System uname: 2.6.14-gentoo-r2 x86_64 AMD Athlon(tm) 64 Processor 3000+
Gentoo Base System version 1.6.13
dev-lang/python:     2.3.5-r2, 2.4.2
sys-apps/sandbox:    1.2.12
sys-devel/autoconf:  2.13, 2.59-r6
sys-devel/automake:  1.4_p6, 1.5, 1.6.3, 1.7.9-r1, 1.8.5-r3, 1.9.6-r1
sys-devel/binutils:  2.16.1
sys-devel/libtool:   1.5.20
virtual/os-headers:  2.6.11-r2
ACCEPT_KEYWORDS="amd64"
AUTOCLEAN="yes"
CBUILD="x86_64-pc-linux-gnu"
CFLAGS="-march=athlon64 -O2 -pipe -mno-tls-direct-seg-refs"
CHOST="x86_64-pc-linux-gnu"
CONFIG_PROTECT="/etc /usr/kde/2/share/config /usr/kde/3.4/env /usr/kde/3.4/share/config /usr/kde/3.4/shutdown /usr/kde/3/share/config /usr/lib/X11/xkb /usr/lib64/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="-march=athlon64 -O2 -pipe -mno-tls-direct-seg-refs"
DISTDIR="/usr/portage/distfiles"
FEATURES="autoconfig distlocks sandbox sfperms strict"
GENTOO_MIRRORS="http://distfiles.gentoo.org http://distro.ibiblio.org/pub/linux/distributions/gentoo"
PKGDIR="/usr/portage/packages"
PORTAGE_TMPDIR="/var/tmp"
PORTDIR="/usr/portage"
SYNC="rsync://rsync.gentoo.org/gentoo-portage"
USE="amd64 X a52 aac alsa auctex avi bash-completion berkdb bitmap-fonts browserplugin bzip2 ccache cdda cddb cdparanoia chroot cpudetection cracklib crosscompile crypt css cups curl curlwrappers custom-cflags doc dpms dvb dvd dvdr dvdread dvi eds emacs emboss emul-linux-x86 encode expat fame fbcon fbsplash fftw firefox foomaticdb fortran freetype gdbm gif glx gnutls gpm gstreamer gtk2 hardened hpn iconv imlib jpeg kde lame latex lcd libwww lm_sensors logitech-mouse lzw lzw-tiff mime mjpeg mod mozsvg mp3 mp4live mpeg mpeg2 mpeg4 mplayer mythtv ncurses nls nptl nptlonly nsplugin nvidia offensive oggvorbis opengl openssh openssl pam pdflib perl player plugin png posix ppds python qt quicktime rar readline real reiserfs sdl sftp speex spell ssl stream subversion svg svgz tcpd tetex theora tiff transcode truetype truetype-fonts type1 type1-fonts udev unicode usb userlocales utf8 v4l v4l2 vcd vlm xml2 xosd xpm xv xvmc zlib userland_GNU kernel_linux elibc_glibc"
Unset:  ASFLAGS, CTARGET, LANG, LC_ALL, LDFLAGS, LINGUAS, MAKEOPTS, PORTDIR_OVERLAY
Comment 1 Danny van Dyk (RETIRED) gentoo-dev 2005-12-23 14:32:44 UTC
[snip]
> gcc  -march=athlon64 -O2 -pipe -mno-tls-direct-seg-refs -fno-pie
> -fno-stack-protector -Wdeclaration-after-statement  -m64
> -Wdeclaration-after-statement  -m64 -Wall  -Werror -Wp,-MD,.tdb.o.d 
> -I../../tools/libxc -I. -c -o tdb.o tdb.c
^^^ Uh, -fno-pie. You use a hardened compiler here perhaps?

> gcc   -m64  -L../../tools/libxc  xenstored_core.o xenstored_watch.o
> xenstored_domain.o xenstored_transaction.o xs_lib.o talloc.o utils.o tdb.o  
> -lxenctrl -o xenstored
> /usr/lib/gcc/x86_64-pc-linux-gnu/3.4.4/../../../../x86_64-pc-linux-gnu/bin/ld:
> xenstored_core.o: relocation R_X86_64_32 against `a local symbol' can not be
> used when making a shared object; recompile with -fPIC
> xenstored_core.o: could not read symbols: Bad value
> collect2: ld returned 1 exit status
^^^ Very odd: If this isn't a hardened compiler, i don't know what happens here.
It tries to create an executable file (xenstored), but complains about the
object files being no-PIC, so it fails to create a shared object. Only with
the hardened compiler specs it creates PIE (Position Independent Executables)
which are essentially executable shared objects.

Solar: right?

Nicolai: Do you use a hardened compiler? If you don't know how to check, please
run: gcc-config -c and attach its output here. Thank you!
Comment 2 Nicolai Guido Klausen 2005-12-24 06:09:14 UTC
I was using the default setting:

gcc-config -l
 [1] x86_64-pc-linux-gnu-3.4.4 *
 [2] x86_64-pc-linux-gnu-3.4.4-hardenednopie
 [3] x86_64-pc-linux-gnu-3.4.4-hardenednopiessp
 [4] x86_64-pc-linux-gnu-3.4.4-hardenednossp
 [5] x86_64-pc-linux-gnu-3.4.4-vanilla

Changed it to x86_64-pc-linux-gnu-3.4.4-vanilla. This fix the problem. I think a check on what gcc-profile is usede, is needed to mark this bug fixed.

-------
Change en profile til vanilla, gave a new one new one:

mv ps/user.ps.new ps/user.ps
latex src/interface.tex >/dev/null
if [ -e interface.toc ] ; then latex src/interface.tex >/dev/null ; fi
install -d -m0755 ps
dvips -Ppdf -G0 -o ps/interface.ps.new interface.dvi
This is dvips(k) 5.92b Copyright 2002 Radical Eye Software (www.radicaleye.com)
' TeX output 2005.12.24:1345' -> ps/interface.ps.new
<tex.pro><alt-rule.pro><texc.pro><8r.enc><aae443f0.enc><bbad153f.enc>
<f7b6d320.enc><texps.pro><special.pro>. <cmmi8.pfb><cmr10.pfb><cmsy10.pfb>
<cmmi10.pfb>[1<figs/xenlogo.eps>] [2] [1] [2] [1] [2] [3] [4] [5] [6] [7] [8]
[9] [10] [11] [12] [13] [14] [15] [16] [17] [18] [19] [20] [21] [22] [23]
[24] [25]
mv ps/interface.ps.new ps/interface.ps
install -d -m0755 pdf
ps2pdf ps/user.ps pdf/user.pdf.new
make: *** [pdf/user.pdf] Segmentation fault
rm user.dvi interface.dvi
make: Leaving directory `/var/tmp/portage/xen-3.0.0-r1/work/xen-3.0-testing-20051206/doc                                           s'

This new bug was fixed by recompiling ghostscript useing the vanila profile.

An't the default gcc profile suppose to the one whit the heigest change of correct compilation?

Comment 3 Chris Bainbridge (RETIRED) gentoo-dev 2005-12-24 14:18:20 UTC
The xen ebuild does 'filter-flags -fPIE -fstack-protector' because xen won't compile with them. xen itself tries to disable these flags in xen/arch/x86/Rules.mk. I assume one of these is messing up on amd64... 
Comment 4 Chris Bainbridge (RETIRED) gentoo-dev 2005-12-24 14:29:34 UTC
btw, I don't have amd64 to test, so if someone could tell me exactly what the fix is that would be good ;-) also there is a bug open to test xen on amd64 (#114620).
Comment 5 Simon Stelling (RETIRED) gentoo-dev 2006-01-26 13:32:31 UTC
*** Bug 114657 has been marked as a duplicate of this bug. ***
Comment 6 Simon Stelling (RETIRED) gentoo-dev 2006-01-26 13:56:11 UTC
Created attachment 78219 [details, diff]
fPIC patch

the patch is quite simple, however this does only half of the trick. The ebuild fails later on in src_install(!!) when trying to link:

ld   -m elf_x86_64 -T x86_64/xen.lds -N \
    boot/x86_64.o /var/tmp/portage/xen-3.0.0-r2/work/xen-3.0-testing-20051206/xen/common/common.o /var/tmp/portage/xen-3.0.0-r2/work/xen-3.0-testing-20051206/xen/drivers/char/driver.o /var/tmp/portage/xen-3.0.0-r2/work/xen-3.0-testing-20051206/xen/drivers/acpi/driver.o /var/tmp/portage/xen-3.0.0-r2/work/xen-3.0-testing-20051206/xen/arch/x86/arch.o -o /var/tmp/portage/xen-3.0.0-r2/work/xen-3.0-testing-20051206/xen/xen-syms
/var/tmp/portage/xen-3.0.0-r2/work/xen-3.0-testing-20051206/xen/common/common.o: In function `add_entry':
/var/tmp/portage/xen-3.0.0-r2/work/xen-3.0-testing-20051206/xen/common/ac_timer.c:129: undefined reference to `debugtrace_dump'/var/tmp/portage/xen-3.0.0-r2/work/xen-3.0-testing-20051206/xen/common/ac_timer.c:129: relocation truncated to fit: R_X86_64_PLT32 against undefined symbol `debugtrace_dump'
/var/tmp/portage/xen-3.0.0-r2/work/xen-3.0-testing-20051206/xen/common/common.o: In function `set_ac_timer':
/var/tmp/portage/xen-3.0.0-r2/work/xen-3.0-testing-20051206/xen/common/ac_timer.c:171: undefined reference to `debugtrace_dump'/var/tmp/portage/xen-3.0.0-r2/work/xen-3.0-testing-20051206/xen/common/ac_timer.c:171: relocation truncated to fit: R_X86_64_PLT32 against undefined symbol `debugtrace_dump'
[...]
Comment 7 Chris Bainbridge (RETIRED) gentoo-dev 2006-04-10 06:54:55 UTC
I'm hoping this is fixed in 3.0.2. Since we now have xen-tools for the userspace stuff, I've enabled the pie and ssp cflags in that ebuild. It doesn't actually work yet (http://bugzilla.xensource.com/bugzilla/show_bug.cgi?id=609), but it should when the register clobbering is fixed.