[Skiboot] [PATCH 2/7] external/pflash: Fixup LDFLAGS

Cyril Bur cyril.bur at au1.ibm.com
Wed Oct 14 15:40:05 AEDT 2015


In order to be able to compile for something that isn't the default for the
compiler one should be able to use CFLAGS and LDFLAGS on commandline.
ie build a 64bit binary with a compiler which builds by default 32bit or
the opposite endian for which the compiler is configured.

Currently the common/rules.mk ignores LDFLAGS when it shouldn't and pflash
sets LDFLAGS for something which only applies to the final link.

This patch addresses both those issues.

Signed-off-by: Cyril Bur <cyril.bur at au1.ibm.com>
---
 external/common/rules.mk | 2 +-
 external/pflash/rules.mk | 5 ++---
 2 files changed, 3 insertions(+), 4 deletions(-)

diff --git a/external/common/rules.mk b/external/common/rules.mk
index bc565e8..79078e5 100644
--- a/external/common/rules.mk
+++ b/external/common/rules.mk
@@ -32,5 +32,5 @@ common/arch_flash_common.o: common/arch_flash_common.c .FORCE
 	$(CROSS_COMPILE)gcc $(CFLAGS) -c $< -o $@
 
 common/arch_flash.o: $(ARCH_OBJS)
-	$(CROSS_COMPILE)ld -r $(ARCH_OBJS) -o $@
+	$(CROSS_COMPILE)ld $(LDFLAGS) -r $(ARCH_OBJS) -o $@
 
diff --git a/external/pflash/rules.mk b/external/pflash/rules.mk
index d60e276..003758a 100644
--- a/external/pflash/rules.mk
+++ b/external/pflash/rules.mk
@@ -1,7 +1,6 @@
 .DEFAULT_GOAL := all
 
-CFLAGS  = -O2 -Wall -I.
-LDFLAGS	= -lrt
+override CFLAGS  += -O2 -Wall -I.
 OBJS    = pflash.o progress.o version.o
 OBJS	+= libflash/libflash.o libflash/libffs.o libflash/ecc.o libflash/blocklevel.o libflash/file.o
 OBJS	+= common/arch_flash.o
@@ -22,5 +21,5 @@ version.c: make_version.sh .version
 	$(CC) $(CFLAGS) -c $< -o $@
 
 $(EXE): $(OBJS)
-	$(CC) $(CFLAGS) $^ $(LDFLAGS) -o $@
+	$(CC) $(CFLAGS) $^ -lrt -o $@
 
-- 
2.6.1



More information about the Skiboot mailing list