* [Buildroot] [PATCH 1/2] package/Makefile.in: add host-cc-option macro
@ 2017-07-03 8:41 Arnout Vandecappelle
2017-07-03 8:41 ` [Buildroot] [PATCH 2/2] package/aespipe: fix host compile Arnout Vandecappelle
` (2 more replies)
0 siblings, 3 replies; 10+ messages in thread
From: Arnout Vandecappelle @ 2017-07-03 8:41 UTC (permalink / raw)
To: buildroot
This macro allows to test if HOSTCC supports a specific option. It is
needed to pass '-no-pie' on recent Debian, Ubuntu and Gentoo hosts.
Signed-off-by: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be>
---
package/Makefile.in | 21 +++++++++++++++++++++
1 file changed, 21 insertions(+)
diff --git a/package/Makefile.in b/package/Makefile.in
index 8087bde999..2dabfd69b2 100644
--- a/package/Makefile.in
+++ b/package/Makefile.in
@@ -222,6 +222,27 @@ HOST_CFLAGS += $(HOST_CPPFLAGS)
HOST_CXXFLAGS += $(HOST_CFLAGS)
HOST_LDFLAGS += -L$(HOST_DIR)/lib -L$(HOST_DIR)/usr/lib -Wl,-rpath,$(HOST_DIR)/usr/lib
+# The macros below are taken from linux 4.11 and adapted slightly.
+# Copy more when needed.
+
+# try-run
+# Usage: option = $(call try-run, $(CC)...-o "$$TMP",option-ok,otherwise)
+# Exit code chooses option. "$$TMP" is can be used as temporary file and
+# is automatically cleaned up.
+try-run = $(shell set -e; \
+ TMP="$$(tempfile)"; \
+ if ($(1)) >/dev/null 2>&1; \
+ then echo "$(2)"; \
+ else echo "$(3)"; \
+ fi; \
+ rm -f "$$TMP")
+
+# host-cc-option
+# Usage: HOST_FOO_CFLAGS += $(call host-cc-option,-no-pie,)
+host-cc-option = $(call try-run,\
+ $(HOSTCC) $(HOST_CFLAGS) $(1) -c -x c /dev/null -o "$$TMP",$(1),$(2))
+
+
# host-intltool should be executed with the system perl, so we save
# the path to the system perl, before a host-perl built by Buildroot
# might get installed into $(HOST_DIR)/usr/bin and therefore appears
--
2.13.2
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [Buildroot] [PATCH 2/2] package/aespipe: fix host compile
2017-07-03 8:41 [Buildroot] [PATCH 1/2] package/Makefile.in: add host-cc-option macro Arnout Vandecappelle
@ 2017-07-03 8:41 ` Arnout Vandecappelle
2017-07-25 22:14 ` Peter Korsgaard
2017-07-22 21:36 ` [Buildroot] [PATCH 1/2] package/Makefile.in: add host-cc-option macro Thomas Petazzoni
2017-07-25 22:13 ` Peter Korsgaard
2 siblings, 1 reply; 10+ messages in thread
From: Arnout Vandecappelle @ 2017-07-03 8:41 UTC (permalink / raw)
To: buildroot
From: Bernd Kuhls <bernd.kuhls@t-online.de>
Building host-aespipe fails on Debian stretch 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
The same problem apparently exists on recent Ubuntu and Gentoo.
Fix is also used in Debian:
https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=837393
[Peter: add comment explaining why]
[Arnout: use host-cc-option to discover if -no-pie is available;
cfr. 57b628a932b9b4a3c4bf80f4c82a81da5adcb173]
Signed-off-by: Bernd Kuhls <bernd.kuhls@t-online.de>
Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
Signed-off-by: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be>
---
package/aespipe/aespipe.mk | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/package/aespipe/aespipe.mk b/package/aespipe/aespipe.mk
index 6a38556ef1..5ef95d5206 100644
--- a/package/aespipe/aespipe.mk
+++ b/package/aespipe/aespipe.mk
@@ -9,5 +9,15 @@ AESPIPE_SOURCE = aespipe-v$(AESPIPE_VERSION).tar.bz2
AESPIPE_SITE = http://loop-aes.sourceforge.net/aespipe
AESPIPE_LICENSE = GPL
+# Recent Debian, Gentoo and Ubuntu enable -fPIE by default, breaking the build:
+# https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=837393
+# https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=835148
+# Older gcc versions however don't support the -no-pie flag, so we have to
+# check its availability.
+HOST_AESPIPE_NO_PIE_FLAG = $(call host-cc-option,-no-pie)
+HOST_AESPIPE_CONF_ENV = \
+ CFLAGS="$(HOST_CFLAGS) $(HOST_AESPIPE_NO_PIE_FLAG)" \
+ LDFLAGS="$(HOST_LDFLAGS) $(HOST_AESPIPE_NO_PIE_FLAG)"
+
$(eval $(autotools-package))
$(eval $(host-autotools-package))
--
2.13.2
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [Buildroot] [PATCH 1/2] package/Makefile.in: add host-cc-option macro
2017-07-03 8:41 [Buildroot] [PATCH 1/2] package/Makefile.in: add host-cc-option macro Arnout Vandecappelle
2017-07-03 8:41 ` [Buildroot] [PATCH 2/2] package/aespipe: fix host compile Arnout Vandecappelle
@ 2017-07-22 21:36 ` Thomas Petazzoni
2017-07-25 22:13 ` Peter Korsgaard
2 siblings, 0 replies; 10+ messages in thread
From: Thomas Petazzoni @ 2017-07-22 21:36 UTC (permalink / raw)
To: buildroot
Hello,
On Mon, 3 Jul 2017 10:41:06 +0200, Arnout Vandecappelle
(Essensium/Mind) wrote:
> This macro allows to test if HOSTCC supports a specific option. It is
> needed to pass '-no-pie' on recent Debian, Ubuntu and Gentoo hosts.
>
> Signed-off-by: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be>
> ---
> package/Makefile.in | 21 +++++++++++++++++++++
> 1 file changed, 21 insertions(+)
Both applied. Thanks!
Thomas
--
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Buildroot] [PATCH 1/2] package/Makefile.in: add host-cc-option macro
2017-07-03 8:41 [Buildroot] [PATCH 1/2] package/Makefile.in: add host-cc-option macro Arnout Vandecappelle
2017-07-03 8:41 ` [Buildroot] [PATCH 2/2] package/aespipe: fix host compile Arnout Vandecappelle
2017-07-22 21:36 ` [Buildroot] [PATCH 1/2] package/Makefile.in: add host-cc-option macro Thomas Petazzoni
@ 2017-07-25 22:13 ` Peter Korsgaard
2 siblings, 0 replies; 10+ messages in thread
From: Peter Korsgaard @ 2017-07-25 22:13 UTC (permalink / raw)
To: buildroot
>>>>> "Arnout" == Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be> writes:
> This macro allows to test if HOSTCC supports a specific option. It is
> needed to pass '-no-pie' on recent Debian, Ubuntu and Gentoo hosts.
> Signed-off-by: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be>
Committed to 2017.02.x and 2017.05.x, thanks.
--
Bye, Peter Korsgaard
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Buildroot] [PATCH 2/2] package/aespipe: fix host compile
2017-07-03 8:41 ` [Buildroot] [PATCH 2/2] package/aespipe: fix host compile Arnout Vandecappelle
@ 2017-07-25 22:14 ` Peter Korsgaard
0 siblings, 0 replies; 10+ messages in thread
From: Peter Korsgaard @ 2017-07-25 22:14 UTC (permalink / raw)
To: buildroot
>>>>> "Arnout" == Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be> writes:
> From: Bernd Kuhls <bernd.kuhls@t-online.de>
> Building host-aespipe fails on Debian stretch 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
> The same problem apparently exists on recent Ubuntu and Gentoo.
> Fix is also used in Debian:
> https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=837393
> [Peter: add comment explaining why]
> [Arnout: use host-cc-option to discover if -no-pie is available;
> cfr. 57b628a932b9b4a3c4bf80f4c82a81da5adcb173]
> Signed-off-by: Bernd Kuhls <bernd.kuhls@t-online.de>
> Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
> Signed-off-by: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be>
Committed to 2017.02.x and 2017.05.x, thanks.
--
Bye, Peter Korsgaard
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Buildroot] [PATCH 2/2] package/aespipe: fix host compile
2016-12-17 16:55 ` Peter Korsgaard
@ 2017-05-28 15:32 ` Bernd Kuhls
0 siblings, 0 replies; 10+ messages in thread
From: Bernd Kuhls @ 2017-05-28 15:32 UTC (permalink / raw)
To: buildroot
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
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Buildroot] [PATCH 2/2] package/aespipe: fix host compile
2016-12-17 14:59 ` Thomas Petazzoni
@ 2016-12-17 16:55 ` Peter Korsgaard
2017-05-28 15:32 ` Bernd Kuhls
0 siblings, 1 reply; 10+ messages in thread
From: Peter Korsgaard @ 2016-12-17 16:55 UTC (permalink / raw)
To: buildroot
>>>>> "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))
--
Bye, Peter Korsgaard
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Buildroot] [PATCH 2/2] package/aespipe: fix host compile
2016-12-17 7:16 ` [Buildroot] [PATCH 2/2] package/aespipe: fix host compile Bernd Kuhls
2016-12-17 7:56 ` Peter Korsgaard
@ 2016-12-17 14:59 ` Thomas Petazzoni
2016-12-17 16:55 ` Peter Korsgaard
1 sibling, 1 reply; 10+ messages in thread
From: Thomas Petazzoni @ 2016-12-17 14:59 UTC (permalink / raw)
To: buildroot
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
--
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Buildroot] [PATCH 2/2] package/aespipe: fix host compile
2016-12-17 7:16 ` [Buildroot] [PATCH 2/2] package/aespipe: fix host compile Bernd Kuhls
@ 2016-12-17 7:56 ` Peter Korsgaard
2016-12-17 14:59 ` Thomas Petazzoni
1 sibling, 0 replies; 10+ messages in thread
From: Peter Korsgaard @ 2016-12-17 7:56 UTC (permalink / raw)
To: buildroot
>>>>> "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 at busybox.net
> http://lists.busybox.net/mailman/listinfo/buildroot
--
Bye, Peter Korsgaard
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Buildroot] [PATCH 2/2] package/aespipe: fix host compile
2016-12-17 7:16 [Buildroot] [PATCH 1/2] package/aespipe: bump version to 2.4d Bernd Kuhls
@ 2016-12-17 7:16 ` Bernd Kuhls
2016-12-17 7:56 ` Peter Korsgaard
2016-12-17 14:59 ` Thomas Petazzoni
0 siblings, 2 replies; 10+ messages in thread
From: Bernd Kuhls @ 2016-12-17 7:16 UTC (permalink / raw)
To: buildroot
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(+)
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
^ permalink raw reply related [flat|nested] 10+ messages in thread
end of thread, other threads:[~2017-07-25 22:14 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-07-03 8:41 [Buildroot] [PATCH 1/2] package/Makefile.in: add host-cc-option macro Arnout Vandecappelle
2017-07-03 8:41 ` [Buildroot] [PATCH 2/2] package/aespipe: fix host compile Arnout Vandecappelle
2017-07-25 22:14 ` Peter Korsgaard
2017-07-22 21:36 ` [Buildroot] [PATCH 1/2] package/Makefile.in: add host-cc-option macro Thomas Petazzoni
2017-07-25 22:13 ` Peter Korsgaard
-- strict thread matches above, loose matches on Subject: below --
2016-12-17 7:16 [Buildroot] [PATCH 1/2] package/aespipe: bump version to 2.4d Bernd Kuhls
2016-12-17 7:16 ` [Buildroot] [PATCH 2/2] package/aespipe: fix host compile Bernd Kuhls
2016-12-17 7:56 ` Peter Korsgaard
2016-12-17 14:59 ` Thomas Petazzoni
2016-12-17 16:55 ` Peter Korsgaard
2017-05-28 15:32 ` Bernd Kuhls
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.