Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 102156 - synaptics 0.14.3 - adding '-fno-pic' fails on amd64, creates unnecessary textrels on x86
Summary: synaptics 0.14.3 - adding '-fno-pic' fails on amd64, creates unnecessary text...
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: New packages (show other bugs)
Hardware: All Linux
: High normal (vote)
Assignee: X11 External Driver Maintainers
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-08-11 14:33 UTC by disperato
Modified: 2005-12-15 16:17 UTC (History)
3 users (show)

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


Attachments
Build shared library for X's dlloader, properly PIC (synaptics-0.14.3-r1.ebuild,2.46 KB, text/plain)
2005-09-08 11:56 UTC, Kevin F. Quinn (RETIRED)
Details

Note You need to log in before you can comment on or make changes to this bug.
Description disperato 2005-08-11 14:33:54 UTC
synclient.o: relocation R_X86_64_32 against 'a local symbol' can not be used
when making a shared object; recompile with -fPIC

but -fPIC is already listed in the flags in the Makefile:
CDEBUGFLAGS = -fPIC
...
CFLAGS = $(CDEBUGFLAGS) and other stuff from ebuilds (nothing modified)

Reproducible: Always
Steps to Reproduce:
1. emerge synaptics
2.
3.




please forgive me for put the bug in "Major" category.
IMHO the "-fPIC" issue it's something we should solve not just for this package
but for the compiler gcc-3.4.4 or the distro layout: it's too often on the forum
and bugzilla for amd64 and often not fixable by changing the CFLAGS in Makefile.
Comment 1 Jakub Moc (RETIRED) gentoo-dev 2005-08-11 14:35:19 UTC
emerge --info missing.
Comment 2 disperato 2005-08-11 14:58:26 UTC
(In reply to comment #1)
> emerge --info missing.

sorry, my fault. It's here (the portage dirs have been customized but work
perfectly with ebuilds, binaries, sync, etc.).

Gentoo Base System version 1.6.13
Portage 2.0.51.22-r2 (default-linux/amd64/2005.0, gcc-3.4.4, glibc-2.3.5-r1,
2.6.12-gentoo-r7 x86_64)
=================================================================
System uname: 2.6.12-gentoo-r7 x86_64 AMD Athlon(tm) 64 Processor 3000+
ccache version 2.4 [enabled]
dev-lang/python:     2.3.4-r1, 2.4.1-r1
sys-apps/sandbox:    1.2.11
sys-devel/autoconf:  2.13, 2.59-r7
sys-devel/automake:  1.4_p6, 1.5, 1.6.3, 1.7.9-r1, 1.8.5-r3, 1.9.6
sys-devel/binutils:  2.16.1
sys-devel/libtool:   1.5.18-r1
virtual/os-headers:  2.6.11-r2
ACCEPT_KEYWORDS="amd64 ~amd64"
AUTOCLEAN="yes"
CBUILD="x86_64-pc-linux-gnu"
CFLAGS="-march=athlon64 -O2 -pipe -fomit-frame-pointer"
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
/var/qmail/control"
CONFIG_PROTECT_MASK="/etc/gconf /etc/terminfo /etc/texmf/web2c /etc/env.d"
CXXFLAGS="-march=athlon64 -O2 -pipe -fomit-frame-pointer"
DISTDIR="/sync/tmp/distfiles"
FEATURES="autoconfig ccache distcc distlocks sandbox sfperms strict"
GENTOO_MIRRORS="http://ftp.unina.it/pub/linux/distributions/gentoo
http://distfiles.gentoo.org http://www.ibiblio.org/pub/Linux/distributions/gentoo"
MAKEOPTS="-j2"
PKGDIR="/sync/tmp/packages"
PORTAGE_TMPDIR="/sync/tmp"
PORTDIR="/sync/portage"
SYNC="rsync://rsync.europe.gentoo.org/gentoo-portage"
USE="amd64 X a52 aac aalib acl acpi apm audiofile avi bash-completion bcmath
berkdb bindist bitmap-fonts blas bmp browserplugin bzip2 caps cdparanoia cdr
clibpdf crypt cscope ctype cups curl dbx diet dio directfb doc dv dvb dvd dvdr
dvdread eds emul-linux-86 encode esd examples exif expat fam fbcon ffmpeg fftw
flac flash foomaticdb fortran gd gdbm ggi gif ginac glut gmp gnutls gphoto2 gpm
gstreamer gtk gtk2 gtkhtml guile hal hardened hardenedphp hyperwave-api iconv
ieee1394 imagemagick imlib inifile innodb ipv6 jabber java javascript jikes jpeg
junit ladcca lcms ldap libcaca libwww lm_sensors lzw lzw-tiff m17n-lib mad mhash
mikmod mime ming mng motif mozilla mp3 mpeg mpi msession mysql mysqli ncurses
nls ofx ogg openal-opengl opengl osc oss pam pcmcia pcntl pcre pdflib perl php
plotutils png portaudio ppds prelude profile python qdbm qt quicktime radius
readline recode ruby samba sapdb scanner sdl sharedext shorten simplexml sndfile
speex spell spl sqlite ssl svg szip tcltk tcp tcpd test tetex theora threads
tidy tiff tokenizer truetype truetype-fonts type1-fonts unicode usb userlocales
vcd videos vorbis wddx wifi wmf xine xml xml2 xmlrpc xmms xosd xpm xsl xv xvid
zlib userland_GNU kernel_linux elibc_glibc"
Unset:  ASFLAGS, CTARGET, LANG, LC_ALL, LDFLAGS, LINGUAS, PORTDIR_OVERLAY
Comment 3 Homer Parker (RETIRED) gentoo-dev 2005-08-13 11:18:29 UTC
Odd, compiles and works fine here.. I first emerged it July 26th. Just
re-emerged it to be sure, worked fine.

[ebuild   R   ] x11-misc/synaptics-0.14.3  -dlloader 0 kB

emerge --info
Portage 2.0.51.22-r2 (default-linux/amd64/2005.1, gcc-3.4.4, glibc-2.3.5-r1,
2.6.12-gentoo-r7 x86_64)
=================================================================
System uname: 2.6.12-gentoo-r7 x86_64 AMD Athlon(tm) 64 Processor 3200+
Gentoo Base System version 1.6.13
dev-lang/python:     2.3.5, 2.4.1-r1
sys-apps/sandbox:    1.2.12
sys-devel/autoconf:  2.13, 2.59-r7
sys-devel/automake:  1.4_p6, 1.5, 1.6.3, 1.7.9-r1, 1.8.5-r3, 1.9.6
sys-devel/binutils:  2.15.92.0.2-r2, 2.16-r1, 2.16.1
sys-devel/libtool:   1.5.18-r1
virtual/os-headers:  2.6.11-r2
ACCEPT_KEYWORDS="amd64 ~amd64"
AUTOCLEAN="yes"
CBUILD="x86_64-pc-linux-gnu"
CFLAGS="-march=k8 -fomit-frame-pointer -O2 -pipe"
CHOST="x86_64-pc-linux-gnu"
CONFIG_PROTECT="/etc /usr/kde/2/share/config /usr/kde/3/share/config
/usr/lib/X11/xkb /usr/lib64/mozilla/defaults/pref /usr/share/config
/var/qmail/control"
CONFIG_PROTECT_MASK="/etc/gconf /etc/splash /etc/terminfo /etc/env.d"
CXXFLAGS="-march=k8 -fomit-frame-pointer -O2 -pipe"
DISTDIR="/usr/portage/distfiles"
FEATURES="autoconfig buildpkg ccache distlocks fixpackages sandbox sfperms strict"
GENTOO_MIRRORS="ftp://gentoo.netnitco.net/pub/mirrors/gentoo/source/
ftp://mirrors.tds.net/gentoo ftp://gentoo.ccccom.com"
MAKEOPTS="-j3"
PKGDIR="/usr/portage/packages"
PORTAGE_TMPDIR="/var/tmp"
PORTDIR="/usr/portage"
PORTDIR_OVERLAY="/usr/local/portage"
SYNC="rsync://192.168.1.2/gentoo-portage"
USE="amd64 X acpi alsa avi bash-completion berkdb bonobo browserplugin bzip2 cdr
crypt cups curl dbus dga directfb dvd dvdread eds encode esd ethereal exif flac
foomaticdb ftp gdbm geoip gif gmp gnome gnome-print gnomedb gphoto2 gps
gstreamer gtk gtk2 gtkhtml hal howl ieee1394 imagemagick imap imlib java
javascript john jpeg lm_sensors logrotate lzo lzw lzw-tiff mad memlimit mmap
mozilla moznocompose moznoirc moznomail mp3 mpeg mpi msession ncurses nls
no-old-linux nodrm nptl nptlonly nsplugin offensive ogg opengl oss pam pcmcia
pcntl pcre pdflib perl pic png pnp posix ppds python quicktime readline rtc
samba sasl sdl session sharedmem sockets speex spell ssl sysvipc szip tcltk tcpd
tidy tiff truetype truetype-fonts type1-fonts usb userlocales vcd vim-with-x
vorbis wifi wxwindows xml2 xmms xpm xv xvid xvmc zlib userland_GNU kernel_linux
elibc_glibc"
Unset:  ASFLAGS, CTARGET, LANG, LC_ALL, LDFLAGS, LINGUAS
Comment 4 Simon Stelling (RETIRED) gentoo-dev 2005-08-13 12:36:53 UTC
disperato, can you please post a bit more of the compile error? about 10 lines
above is probably enough
Comment 5 disperato 2005-08-15 07:41:36 UTC
(In reply to comment #4)
> disperato, can you please post a bit more of the compile error? about 10 lines
> above is probably enough

Of course :) It's here:

...cut...
x86_64-pc-linux-gnu-gcc -c -march=athlon64 -O2 -pipe -fomit-frame-pointer
-pedantic -Wall -Wpointer-arith -fno-merge-constants -fno-pic -I.
-IXincludes/usr/X11R6/include/X11 -IXincludes/usr/X11R6/include/X11/extensions
-IXincludes/usr/X11R6/lib64/Server/include -Dlinux -D_POSIX_C_SOURCE=199309L
-D_POSIX_SOURCE -D_XOPEN_SOURCE -D_BSD_SOURCE -D_SVID_SOURCE  -D_GNU_SOURCE 
-DSHAPE -DXINPUT -DXKB -DLBX -DXAPPGROUP -DXCSECURITY -DTOGCUP   -DDPMSExtension
 -DPIXPRIV -DPANORAMIX  -DRENDER -DGCCUSESGAS -DAVOID_GLYPHBLT -DPIXPRIV
-DSINGLEDEPTH -DXFreeXDGA -DXvExtension -DXFree86LOADER  -DXFree86Server
-DXF86VIDMODE  -DSMART_SCHEDULE -DBUILDDEBUG -DX_BYTE_ORDER=X_LITTLE_ENDIAN
-DNDEBUG -D__x86_64__ -D_XSERVER64 -DFUNCPROTO=15 -DNARROWPROTO -DIN_MODULE
-DXFree86Module -DVERSION="\"0.14.3\""  alpscomm.c

x86_64-pc-linux-gnu-gcc -march=athlon64 -O2 -pipe -fomit-frame-pointer -pedantic
-Wall -Wpointer-arith -fno-merge-constants -fno-pic -DVERSION="\"0.14.3\""
-IXincludes/usr/X11R6/include -c -o synclient.o synclient.c

x86_64-pc-linux-gnu-gcc -march=athlon64 -O2 -pipe -fomit-frame-pointer -pedantic
-Wall -Wpointer-arith -fno-merge-constants -fno-pic -DVERSION="\"0.14.3\""
-IXincludes/usr/X11R6/include -c -o syndaemon.o syndaemon.c

rm -f synaptics_drv.o

ld -r  synaptics.o ps2comm.o eventcomm.o psmcomm.o alpscomm.o -o synaptics_drv.o

x86_64-pc-linux-gnu-gcc -o synclient synclient.o -lm

/usr/lib/gcc/x86_64-pc-linux-gnu/3.4.4/../../../../x86_64-pc-linux-gnu/bin/ld:
synclient.o: relocation R_X86_64_32 against `a local symbol' can not be used
when making a shared object; recompile with -fPIC

synclient.o: could not read symbols: Bad value

collect2: ld returned 1 exit status

make: *** [synclient] Error 1



!!! ERROR: x11-misc/synaptics-0.14.3 failed.

!!! Function src_compile, Line 33, Exitcode 2

!!! (no error message)

!!! If you need support, post the topmost build error, NOT this status message.
Comment 6 disperato 2005-08-28 10:00:32 UTC
please look at the bug #93862: the solution it's the same :)
you can also find an explanation there.
Thanks to tips from other users I solved by:
adding -fPIC to CFLAGS
adding -hardened to USE flags
*both* necessary (I first tried with the only -hardened and it fails) and both,
temporarely added to /etc/make.conf (no command line)

emerge gcc (updated to 3.4.4-r1)
emerge synaptics

synaptics compiled and works fine!
the same for mplayer, bug #93862: ok now!
thanks
Comment 7 Simon Stelling (RETIRED) gentoo-dev 2005-08-28 10:25:46 UTC
adding -fPIC to CFLAGS is not an acceptable solution and will cause breakage
with other packages, so this is far from solved
Comment 8 Simon Stelling (RETIRED) gentoo-dev 2005-09-07 13:28:52 UTC
works fine here too, however, in comment 5 there is:

x86_64-pc-linux-gnu-gcc -c -march=athlon64 -O2 -pipe -fomit-frame-pointer
-pedantic -Wall -Wpointer-arith -fno-merge-constants -fno-pic -I.

hardened people: Do you set that flag?
Comment 9 Kevin F. Quinn (RETIRED) gentoo-dev 2005-09-07 23:47:38 UTC
Short answer - no,  Long answer - we never set -fPIC, but we do set -fPIE unless
one or more of static, shared, ostdlib, nostartfiles, -fno-PIC, -fno-pic, -fPIC,
-fpic, -fno-PIE, -fno-pie, -nopie are set, or we're building the kernel. Here,
the -fno-pic stops it setting -fPIE.  In general hardened want -fPIC for
libraries, -fPIE for applications. PIE is similar to PIC.  Note that you won't
see what the hardened compiler gets up to in make logs - the flag twiddling is
behind-the-scenes specs file stuff.

An easy way to check whether the hardened compiler makes a difference is to
switch between -hardened (Default on hardened systems) and -vanilla (default on
non-hardened systems) using gcc-config and try it both ways - no need to waste
time re-building gcc.

From comment #6 it looks like the problem persists when using a vanilla
compiler, unless -fPIC is appended.

disperato: just to re-affirm, because it's important - adding "-fPIC" to CFLAGS
will break things big-time, so take that out of CFLAGS before you emerge
anything else :)
Comment 10 Kevin F. Quinn (RETIRED) gentoo-dev 2005-09-08 11:56:13 UTC
Created attachment 67952 [details]
Build shared library for X's dlloader, properly PIC

I had a further look at this today, and created the attached revised ebuild for
consideration.

The main reason for modifying the ebuild is to eliminate "text relocations"
(i.e. non-PIC code) from the shared library built for the dlloader in Xorg.

Shared libraries should be PIC (whether a system is "hardened" or not), and
when building modules for X to be loaded via the dlloader, the modules are
shared libraries.  However the upstream build only makes the old elf-loader
style modules, which are simply partially-linked collections of objects and
which are not PIC.

The attached ebuild extends the existing dlloader support with improved
integration with the existing makefile.  This eliminates the need for
overriding src_compile and simplifies src_install, which is nice.  I've
explained the modifications the ebuild makes to the Makefile in the ebuild
itself.

As far as the elf-loader is concerned, the ebuild should generate the same
object collection as it did previously.
Comment 11 solar (RETIRED) gentoo-dev 2005-11-25 11:35:38 UTC
This bug appears to be fixed.
Can it be closed?
Comment 12 Kevin F. Quinn (RETIRED) gentoo-dev 2005-11-26 01:39:44 UTC
Solution provided so hardened team have done their bit.  Over to package
maintainer to patch or push upstream as they see fit.
(btw textrel issue is not amd64-specific; same on x86)
Comment 13 Seemant Kulleen (RETIRED) gentoo-dev 2005-12-09 07:32:08 UTC
I've added a Makefile patch in 0.14.4 (added to cvs 6 minutes ago or so) that
I'll be pushing upstream to the synaptics maintainers. Closing bug.
Comment 14 Kevin F. Quinn (RETIRED) gentoo-dev 2005-12-09 08:05:43 UTC
Adding '-fno-pic' unconditionally to the client compilation flags causes
textrels in the client apps when built with the hardened compiler.
Comment 15 Seemant Kulleen (RETIRED) gentoo-dev 2005-12-15 16:17:13 UTC
0.14.4-r1 has no more -fno-pic as you (kevin) and I discussed with upstream