Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [PATCH] libscrypt: -fPIC is needed to build for MIPS
@ 2017-03-14 15:40 Vicente Olivert Riera
  2017-03-14 21:21 ` Thomas Petazzoni
  0 siblings, 1 reply; 2+ messages in thread
From: Vicente Olivert Riera @ 2017-03-14 15:40 UTC (permalink / raw)
  To: buildroot

The error looks like this:

ld: crypto_scrypt-nosse.o: relocation R_MIPS_26 against `a local symbol'
can not be used when making a shared object; recompile with -fPIC
crypto_scrypt-nosse.o: error adding symbols: Bad value
collect2: error: ld returned 1 exit status

Adding -fPIC to CFLAGS fixes the problem.

Fixes:
  http://autobuild.buildroot.net/results/967ad7fae0137f64b165c986c251d143ac825147

Signed-off-by: Vicente Olivert Riera <Vincent.Riera@imgtec.com>
---
 package/libscrypt/libscrypt.mk | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/package/libscrypt/libscrypt.mk b/package/libscrypt/libscrypt.mk
index 8f72d67..cb3d69b 100644
--- a/package/libscrypt/libscrypt.mk
+++ b/package/libscrypt/libscrypt.mk
@@ -17,8 +17,16 @@ endef
 LIBSCRYPT_POST_PATCH_HOOKS += LIBSCRYPT_DISABLE_STACK_PROTECTOR
 endif
 
+LIBSCRYPT_CFLAGS = $(TARGET_CFLAGS)
+
+# -fPIC is needed to build for MIPS
+ifeq ($(BR2_mips)$(BR2_mipsel)$(BR2_mips64)$(BR2_mips64el),y)
+LIBSCRYPT_CFLAGS += -fPIC
+endif
+
 define LIBSCRYPT_BUILD_CMDS
-	$(TARGET_MAKE_ENV) $(MAKE) -C $(@D) $(TARGET_CONFIGURE_OPTS)
+	$(TARGET_MAKE_ENV) $(MAKE) -C $(@D) $(TARGET_CONFIGURE_OPTS) \
+		CFLAGS="$(LIBSCRYPT_CFLAGS)"
 endef
 
 define LIBSCRYPT_INSTALL_STAGING_CMDS
-- 
2.10.2

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* [Buildroot] [PATCH] libscrypt: -fPIC is needed to build for MIPS
  2017-03-14 15:40 [Buildroot] [PATCH] libscrypt: -fPIC is needed to build for MIPS Vicente Olivert Riera
@ 2017-03-14 21:21 ` Thomas Petazzoni
  0 siblings, 0 replies; 2+ messages in thread
From: Thomas Petazzoni @ 2017-03-14 21:21 UTC (permalink / raw)
  To: buildroot

Hello,

On Tue, 14 Mar 2017 15:40:02 +0000, Vicente Olivert Riera wrote:

> +# -fPIC is needed to build for MIPS
> +ifeq ($(BR2_mips)$(BR2_mipsel)$(BR2_mips64)$(BR2_mips64el),y)
> +LIBSCRYPT_CFLAGS += -fPIC
> +endif

This is not really the proper fix, because:

 1. -fPIC is not only needed for MIPS.

 2. The Makefile already passes -fPIC, but it gets overridden because
    Buildroot passes its own CFLAGS.

So I believe the patch proposed by Stefan S?rensen at
http://patchwork.ozlabs.org/patch/738605/ is a more appropriate
solution.

Thanks!

Thomas
-- 
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2017-03-14 21:21 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-03-14 15:40 [Buildroot] [PATCH] libscrypt: -fPIC is needed to build for MIPS Vicente Olivert Riera
2017-03-14 21:21 ` Thomas Petazzoni

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox