diff mbox

[2/2] package/aespipe: fix host compile

Message ID 20161217071659.3975-2-bernd.kuhls@t-online.de
State Accepted
Commit cb33a7d6bd89306635749b497cd004e986bcd7e5
Headers show

Commit Message

Bernd Kuhls Dec. 17, 2016, 7:16 a.m. UTC
Building host-aespipe fails on

$ cat /etc/debian_version
stretch/sid

at linking stage:

/usr/bin/gcc -L/home/buildroot/br6/output/host/lib -L/home/buildroot/br6/output/host/usr/lib -Wl,-rpath,/home/buildroot/br6/output/host/usr/lib -o aespipe aespipe.o aes-amd64.o md5-amd64.o md5-2x-amd64.o aes-intel64.o sha512.o rmd160.o
/usr/bin/ld: aes-amd64.o: relocation R_X86_64_32S against `.rodata' can not be used when making a shared object; recompile with -fPIC

Fix is also used in Debian:
https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=837393

Signed-off-by: Bernd Kuhls <bernd.kuhls@t-online.de>
---
 package/aespipe/aespipe.mk | 4 ++++
 1 file changed, 4 insertions(+)

Comments

Peter Korsgaard Dec. 17, 2016, 7:56 a.m. UTC | #1
>>>>> "Bernd" == Bernd Kuhls <bernd.kuhls@t-online.de> writes:

 > Building host-aespipe fails on
 > $ cat /etc/debian_version
 > stretch/sid

 > at linking stage:

 > /usr/bin/gcc -L/home/buildroot/br6/output/host/lib
 > -L/home/buildroot/br6/output/host/usr/lib
 > -Wl,-rpath,/home/buildroot/br6/output/host/usr/lib -o aespipe
 > aespipe.o aes-amd64.o md5-amd64.o md5-2x-amd64.o aes-intel64.o
 > sha512.o rmd160.o
 > /usr/bin/ld: aes-amd64.o: relocation R_X86_64_32S against `.rodata'
 > can not be used when making a shared object; recompile with -fPIC

 > Fix is also used in Debian:
 > https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=837393

Ahh, so we will start to see various fallout of them enabling -fPIE by
default?

If it happends to a lot of packages, then I think we should do it
globally in HOST_CFLAGS / HOST_LDFLAGS, but I have committed this for
now after adding a comment explaining why, thanks.


 > Signed-off-by: Bernd Kuhls <bernd.kuhls@t-online.de>
 > ---
 >  package/aespipe/aespipe.mk | 4 ++++
 >  1 file changed, 4 insertions(+)

 > diff --git a/package/aespipe/aespipe.mk b/package/aespipe/aespipe.mk
 > index 6a38556..3a95469 100644
 > --- a/package/aespipe/aespipe.mk
 > +++ b/package/aespipe/aespipe.mk
 > @@ -9,5 +9,9 @@ AESPIPE_SOURCE = aespipe-v$(AESPIPE_VERSION).tar.bz2
 >  AESPIPE_SITE = http://loop-aes.sourceforge.net/aespipe
 >  AESPIPE_LICENSE = GPL
 
 > +HOST_AESPIPE_CONF_ENV = \
 > +	CFLAGS="$(HOST_CFLAGS) -no-pie" \
 > +	LDFLAGS="$(HOST_LDFLAGS) -no-pie"
 > +
 >  $(eval $(autotools-package))
 >  $(eval $(host-autotools-package))
 > -- 
 > 2.10.2

 > _______________________________________________
 > buildroot mailing list
 > buildroot@busybox.net
 > http://lists.busybox.net/mailman/listinfo/buildroot
Thomas Petazzoni Dec. 17, 2016, 2:59 p.m. UTC | #2
Hello,

On Sat, 17 Dec 2016 08:16:59 +0100, Bernd Kuhls wrote:

> +HOST_AESPIPE_CONF_ENV = \
> +	CFLAGS="$(HOST_CFLAGS) -no-pie" \
> +	LDFLAGS="$(HOST_LDFLAGS) -no-pie"

I reverted this patch as it breaks the build on systems where gcc does
not understand -no-pie:

  http://autobuild.buildroot.net/?reason=host-aespipe-2.4d

A better solution is needed for this problem.

Best regards,

Thomas
Peter Korsgaard Dec. 17, 2016, 4:55 p.m. UTC | #3
>>>>> "Thomas" == Thomas Petazzoni <thomas.petazzoni@free-electrons.com> writes:

 > Hello,
 > On Sat, 17 Dec 2016 08:16:59 +0100, Bernd Kuhls wrote:

 >> +HOST_AESPIPE_CONF_ENV = \
 >> +	CFLAGS="$(HOST_CFLAGS) -no-pie" \
 >> +	LDFLAGS="$(HOST_LDFLAGS) -no-pie"

 > I reverted this patch as it breaks the build on systems where gcc does
 > not understand -no-pie:

 >   http://autobuild.buildroot.net/?reason=host-aespipe-2.4d

Crap, so the option is also a Debian specific change? :/

 > A better solution is needed for this problem.

We could do something like the kernel's cc-option to see if HOSTCC
accepts -no-pie - And if so, unconditionally add it to HOST_CFLAGS /
HOST_LDFLAGS.

cc-option is defined in scripts/Kbuild.include:

# cc-option
# Usage: cflags-y += $(call cc-option,-march=winchip-c6,-march=i586)

cc-option = $(call try-run,\
        $(CC) $(KBUILD_CPPFLAGS) $(CC_OPTION_CFLAGS) $(1) -c -x c /dev/null -o "$$TMP",$(1),$(2))
Bernd Kuhls May 28, 2017, 3:32 p.m. UTC | #4
Am Sat, 17 Dec 2016 17:55:02 +0100 schrieb Peter Korsgaard:

>>>>>> "Thomas" == Thomas Petazzoni
>>>>>> <thomas.petazzoni-wi1
+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org>
>>>>>> writes:
> 
>  > Hello,
>  > On Sat, 17 Dec 2016 08:16:59 +0100, Bernd Kuhls wrote:
> 
>  >> +HOST_AESPIPE_CONF_ENV = \ +	CFLAGS="$(HOST_CFLAGS) -no-pie" \
>  >> +	LDFLAGS="$(HOST_LDFLAGS) -no-pie"
> 
>  > I reverted this patch as it breaks the build on systems where gcc
>  > does not understand -no-pie:
> 
>  >   http://autobuild.buildroot.net/?reason=host-aespipe-2.4d
> 
> Crap, so the option is also a Debian specific change? :/
> 
>  > A better solution is needed for this problem.

Hi,

any progress on this issue? I just stumbled across it while building an 
allyesconfig setup on the next branch.

Regards, Bernd
diff mbox

Patch

diff --git a/package/aespipe/aespipe.mk b/package/aespipe/aespipe.mk
index 6a38556..3a95469 100644
--- a/package/aespipe/aespipe.mk
+++ b/package/aespipe/aespipe.mk
@@ -9,5 +9,9 @@  AESPIPE_SOURCE = aespipe-v$(AESPIPE_VERSION).tar.bz2
 AESPIPE_SITE = http://loop-aes.sourceforge.net/aespipe
 AESPIPE_LICENSE = GPL
 
+HOST_AESPIPE_CONF_ENV = \
+	CFLAGS="$(HOST_CFLAGS) -no-pie" \
+	LDFLAGS="$(HOST_LDFLAGS) -no-pie"
+
 $(eval $(autotools-package))
 $(eval $(host-autotools-package))