Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 621866 - sys-boot/lilo-24.2 : /.../ld: /.../cc98Dqi5.o: relocation R_X86_64_32 against `.rodata.str1.1' can not be used when making a shared object; recompile with -fPIC
Summary: sys-boot/lilo-24.2 : /.../ld: /.../cc98Dqi5.o: relocation R_X86_64_32 against...
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal with 1 vote (vote)
Assignee: Tony Vroon (RETIRED)
URL:
Whiteboard:
Keywords:
: 640232 (view as bug list)
Depends on:
Blocks:
 
Reported: 2017-06-16 06:17 UTC by Toralf Förster
Modified: 2017-12-10 20:17 UTC (History)
6 users (show)

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


Attachments
emerge-info.txt (emerge-info.txt,6.24 KB, text/plain)
2017-06-16 06:17 UTC, Toralf Förster
Details
emerge-history.txt (emerge-history.txt,229.74 KB, text/plain)
2017-06-16 06:17 UTC, Toralf Förster
Details
environment (environment,88.96 KB, text/plain)
2017-06-16 06:17 UTC, Toralf Förster
Details
etc.portage.tbz2 (etc.portage.tbz2,22.66 KB, application/x-bzip)
2017-06-16 06:17 UTC, Toralf Förster
Details
sys-boot:lilo-24.2:20170616-031332.log (sys-boot:lilo-24.2:20170616-031332.log,3.05 KB, text/plain)
2017-06-16 06:17 UTC, Toralf Förster
Details
temp.tbz2 (temp.tbz2,22.56 KB, application/x-bzip)
2017-06-16 06:17 UTC, Toralf Förster
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Toralf Förster gentoo-dev 2017-06-16 06:17:26 UTC
make[1]: Entering directory '/var/tmp/portage/sys-boot/lilo-24.2/work/lilo-24.2/src'
x86_64-pc-linux-gnu-gcc -Wl,-O1 -Wl,--as-needed -fno-pic  -Os -Wall `if [ -f /usr/include/linux/version.h ]; then echo -DHAS_VERSION_H; fi` `if [ -f /usr/include/libdevmapper.h ]; then echo -DHAS_LIBDEVMAPPER_H; fi` -DLILO=0xbb920890 `( if [ -r $DESTDIR/etc/lilo.defines ]; then cat $DESTDIR/etc/lilo.defines; else echo -DBDATA -DDSECS=3 -DEVMS -DIGNORECASE -DLVM -DNOKEYBOARD -DONE_SHOT -DPASS160 -DREISERFS -DREWRITE_TABLE -DSOLO_CHAIN -DVERSION -DVIRTUAL -DMDPRAID ; fi ) | sed 's/-D/-DLCF_/g'` -Wl,-O1 -Wl,--as-needed -DSHS_MAIN -o version common.c
/usr/lib/gcc/x86_64-pc-linux-gnu/6.3.0/../../../../x86_64-pc-linux-gnu/bin/ld: /var/tmp/portage/sys-boot/lilo-24.2/temp/cc98Dqi5.o: relocation R_X86_64_32 against `.rodata.str1.1' can not be used when making a shared object; recompile with -fPIC
/var/tmp/portage/sys-boot/lilo-24.2/temp/cc98Dqi5.o: error adding symbols: Bad value
collect2: error: ld returned 1 exit status
make[1]: *** [Makefile:258: version] Error 1

  -------------------------------------------------------------------

  This is an unstable amd64 chroot image at a tinderbox (==build bot)
  name: 17.0-desktop-gnome-libressl_20170611-103213

  -------------------------------------------------------------------

gcc-config -l:
 [1] x86_64-pc-linux-gnu-6.3.0 *

Available Python interpreters, in order of preference:
  [1]   python3.4
  [2]   python2.7 (fallback)
  [3]   jython2.7 (fallback)

java-config:
The following VMs are available for generation-2:
*)	IcedTea JDK 3.4.0 [icedtea-bin-8]
Available Java Virtual Machines:
  [1]   icedtea-bin-8  system-vm
Comment 1 Toralf Förster gentoo-dev 2017-06-16 06:17:29 UTC
Created attachment 476674 [details]
emerge-info.txt
Comment 2 Toralf Förster gentoo-dev 2017-06-16 06:17:32 UTC
Created attachment 476676 [details]
emerge-history.txt
Comment 3 Toralf Förster gentoo-dev 2017-06-16 06:17:35 UTC
Created attachment 476678 [details]
environment
Comment 4 Toralf Förster gentoo-dev 2017-06-16 06:17:38 UTC
Created attachment 476680 [details]
etc.portage.tbz2
Comment 5 Toralf Förster gentoo-dev 2017-06-16 06:17:41 UTC
Created attachment 476682 [details]
sys-boot:lilo-24.2:20170616-031332.log
Comment 6 Toralf Förster gentoo-dev 2017-06-16 06:17:44 UTC
Created attachment 476684 [details]
temp.tbz2
Comment 7 Joshua Kinard gentoo-dev 2017-07-03 01:55:00 UTC
Ran into this when rebuilding my dev box using gcc-7.1.0 and the 17.0 profiles.  As the error message indicates, a temporary workaround is to add -fPIC to CFLAGS just for sys-boot/lilo, and it'll complete the build.  The resulting executable runs well enough to modify the MBR to boot, though I have not yet tried natively booting this system after its rebuild.
Comment 8 Petr Cerny [:hrosik] 2017-09-20 20:48:14 UTC
I've been bitten by this through a hardened profile. Removing

    # hardened automatic PIC plus PIE building should be suppressed
    # because of assembler instructions that cannot be compiled
    HARDENED_CFLAGS=$(test-flags-CC -fno-pic -nopie)

seems to produce a working lilo. Tony, what was the exact reason here - is there any chance it is an old surviving relict that can be removed?
Comment 9 Andre Müller 2017-11-17 08:49:52 UTC
This also fails with gcc-6.4.
Shouldn't this block gcc-6.4 stabilization (bug#630844) then?
Thanks.
Comment 10 csefko 2017-12-02 00:56:35 UTC
Hi,

I have just encountered the same problem. The latest Gentoo news recommends to move to a new profile and rebuild everything (emerge -e @world). Unfortunately lilo rebuild does not work (I even tried to add -fPIC to CFLAGS, CXXFLAGS and LDFLAGS, but maybe I am doing something wrong, because -fno-pic is always added). Any workarounds? When this will be fixed?

Thanks
Comment 11 Loacoon 2017-12-05 01:21:43 UTC
Hi,

I have the exact same problem as the previous commenter. I tried everything but it look like our CFLAGS are completely ignored. It's stuck to -fno-pic and it's set to -01 instead of -02 in my make.conf.
Comment 12 globus 2017-12-05 12:41:38 UTC
Hi, sorry my bad English.

lilo-24.0-r1 also does not compile (gcc 6.4, profile 17.0). To create a new bug or continue here?
Comment 13 junkmailnotread 2017-12-05 15:19:13 UTC
I have the same problem. As suggested previously, my workaround was to patch the ebuild file to remove all references to HARDENED_CFLAGS:

--- lilo-24.0-r1.ebuild	2017-02-28 19:50:50.000000000 +0000
+++ lilo-24.0-r1.ebuild	2017-12-02 12:01:14.605432719 +0000
@@ -49,10 +49,6 @@
 	# lilo needs this. bug #140209
 	export LC_ALL=C
 
-	# hardened automatic PIC plus PIE building should be suppressed
-	# because of assembler instructions that cannot be compiled PIC
-	HARDENED_CFLAGS=$(test-flags-CC -fno-pic -nopie)
-
 	# we explicitly prevent the custom CFLAGS for stability reasons
 	if use static; then
 		local target=alles
@@ -60,7 +56,7 @@
 		local target=all
 	fi
 
-	emake CC="$(tc-getCC) ${LDFLAGS} ${HARDENED_CFLAGS}" ${target} || die
+	emake CC="$(tc-getCC) ${LDFLAGS}" ${target} || die
 }
 
 src_install() {

This allows lilo-24.0-r1 to build and "emerge -e @world" to finish.
Comment 14 Tony Vroon (RETIRED) gentoo-dev 2017-12-07 16:04:52 UTC
(In reply to Petr Cerny [:hrosik] from comment #8)
> Tony, what was the exact reason here - is
> there any chance it is an old surviving relict that can be removed?

It is legacy code from a long long time ago, when this was the correct thing to do. My apologies for missing this bug report for so long. If I don't get around to it quickly, any dev reading this, please go ahead and commit the removal to all LILO ebuilds to restore full functionality.
Sorry.
Comment 15 Anthony Basile gentoo-dev 2017-12-07 20:57:16 UTC
(In reply to Tony Vroon from comment #14)
> (In reply to Petr Cerny [:hrosik] from comment #8)
> > Tony, what was the exact reason here - is
> > there any chance it is an old surviving relict that can be removed?
> 
> It is legacy code from a long long time ago, when this was the correct thing
> to do. My apologies for missing this bug report for so long. If I don't get
> around to it quickly, any dev reading this, please go ahead and commit the
> removal to all LILO ebuilds to restore full functionality.
> Sorry.

It broke one of my builds so I took care of it.
Comment 16 Anthony Basile gentoo-dev 2017-12-10 20:17:23 UTC
*** Bug 640232 has been marked as a duplicate of this bug. ***