Re: make on Debian 9.2 failing

Lehner Georg <[email protected]> Sun, 3 Dec 2017 17:56:42 -0600
Newsgroups gmane.linux.lib.dietlibc
Organization MagmaSoft
Message-ID <[email protected]>
On 12/02/2017 09:39 PM, Thorsten Glaser wrote:
> On Sat, 2 Dec 2017, Lehner Georg wrote:
>
>> /usr/bin/ld: bin-x86_64/dietlibc.a(stackgap.o): relocation R_X86_64_32 against
>> `.rodata.str1.1' can not be used when making a shared object; recompile with
>> -fPIC
> You need -fno-pie; use the Debian dietlibc source package as reference.
>
> bye,
> //mirabilos

Hi Thorsten,

I could not find usage of -fno-pie in the Debian source package and 
adding it to EXTRACFLAGS did not work out.

In fact, I succeeded by *removing* -fno-pie in the line where stackgap.o 
is compiled, see the patch below.

I was than able to compile dietlibc with or without the "PIE" line (line 
number 98 in `Makefile`)

make for dynamic libraries fails, but I am interested only in static 
linking at this moment.

If pie is default on x86_64, why does this break builds now?  Why would 
I want to disable PIE?

Best Regards,

   Georg

PS.: Patch for CVS Makefile on Debian 9.2

Index: Makefile
===================================================================
RCS file: /cvs/dietlibc/Makefile,v
retrieving revision 1.216
diff -u -r1.216 Makefile
--- Makefile    6 Mar 2017 14:22:08 -0000    1.216
+++ Makefile    3 Dec 2017 23:16:20 -0000
@@ -592,7 +592,7 @@
  # WANT_SSP
  # This facepalm brought to you by: Ubuntu!
  $(PICODIR)/stackgap.o: EXTRACFLAGS:=-fno-stack-protector
-$(OBJDIR)/stackgap.o: EXTRACFLAGS:=-fno-stack-protector -fno-pie
+$(OBJDIR)/stackgap.o: EXTRACFLAGS:=-fno-stack-protector
  $(OBJDIR)/stackgap-pie.o: EXTRACFLAGS:=-fno-stack-protector 
-Dstackgap=stackgap_pie -fpie -fvisibility=hidden

  $(OBJDIR)/stackgap.o $(OBJDIR)/stackgap-pie.o $(PICODIR)/stackgap.o: 
lib/stackgap-common.h

-- 
Georg Lehner
MagmaSoft Internet Services
http://magma-soft.at/
mailto:[email protected]