[SLOF] [PATCH] paflof: Use CFLAGS from make.rules instead of completely redefining them

Thomas Huth thuth at redhat.com
Thu Aug 25 23:50:38 AEST 2016


It's cumbersome to change the CFLAGS in multiple places in case they
have to be changed. So let's use the global CFLAGS from make.rules
for building Paflof, too. Since the global rules use some additional
compiler warning flags, fix the now occuring compiler warnings in
the Paflof code, too (mostly about missing or wrong prototypes).

Signed-off-by: Thomas Huth <thuth at redhat.com>
---
 slof/Makefile.inc | 4 +---
 slof/allocator.c  | 9 +++++----
 slof/ppc64.c      | 9 +++++----
 slof/ppc64.h      | 2 +-
 4 files changed, 12 insertions(+), 12 deletions(-)

diff --git a/slof/Makefile.inc b/slof/Makefile.inc
index 8ad3337..d7a6b38 100644
--- a/slof/Makefile.inc
+++ b/slof/Makefile.inc
@@ -27,9 +27,7 @@ INCLBRDDIR ?= $(TOPBRDDIR)/include
 
 
 CPPFLAGS += -I. -I$(INCLCMNDIR) -I$(INCLBRDDIR) -I$(INCLCMNDIR)/$(CPUARCH)
-CFLAGS  = -DTARG=$(TARG) -static -Wall -W -std=gnu99 \
-	  -O2 -fomit-frame-pointer -msoft-float $(FLAG) $(CPUARCHDEF) \
-	  -fno-stack-protector -fno-strict-aliasing 
+CFLAGS  += -DTARG=$(TARG) -static -std=gnu99 $(FLAG) $(CPUARCHDEF)
 ASFLAGS = -Wa,-mpower4 -Wa,-mregnames $(FLAG) $(CPUARCHDEF)
 
 LDFLAGS += -static -nostdlib -Wl,-q,-n
diff --git a/slof/allocator.c b/slof/allocator.c
index 279b50b..e8f8858 100644
--- a/slof/allocator.c
+++ b/slof/allocator.c
@@ -17,6 +17,7 @@
 #include <stdlib.h>
 #include <stdbool.h>
 #include <helpers.h>
+#include <allocator.h>
 
 #undef DEBUG
 //#define DEBUG
@@ -45,17 +46,17 @@ struct bitmap {
 #define BM_WORD_MODULO(n)  (n % BM_WORD_BITS)
 #define BM_NUM_BITS(reqsize, bsize)     ((reqsize / bsize) + (reqsize % bsize? 1 : 0))
 
-void bm_clear_bit(unsigned long *bmw, int n)
+static void bm_clear_bit(unsigned long *bmw, int n)
 {
 	BM_WORD(bmw, n) &= ~BIT(BM_WORD_MODULO(n));
 }
 
-void bm_set_bit(unsigned long *bmw, int n)
+static void bm_set_bit(unsigned long *bmw, int n)
 {
 	BM_WORD(bmw, n) |= BIT(BM_WORD_MODULO(n));
 }
 
-bool bm_test_bit(unsigned long *bmw, int n)
+static bool bm_test_bit(unsigned long *bmw, int n)
 {
 #ifdef DEBUG
 	//printf("BMW %x, bitpos %d, value %d\n", &BM_WORD(bmw, n), n, !!(BM_WORD(bmw, n) & BIT(BM_WORD_MODULO(n))));
@@ -64,7 +65,7 @@ bool bm_test_bit(unsigned long *bmw, int n)
 }
 
 /* Improvement: can use FFS routines to get faster results */
-int bm_find_bits(struct bitmap *bm, unsigned int n_bits)
+static int bm_find_bits(struct bitmap *bm, unsigned int n_bits)
 {
 	unsigned int i, j, total_bits;
 	int found = -1;
diff --git a/slof/ppc64.c b/slof/ppc64.c
index 619d95e..4fc92b9 100644
--- a/slof/ppc64.c
+++ b/slof/ppc64.c
@@ -10,8 +10,11 @@
  *     IBM Corporation - initial implementation
  *****************************************************************************/
 
+#include <unistd.h>
 #include <cpu.h>
 
+void asm_cout(long Character,long UART,long NVRAM);
+
 /* the exception frame should be page aligned
  * the_exception_frame is used by the handler to store a copy of all
  * registers after an exception; this copy can then be used by paflof's
@@ -45,8 +48,7 @@ extern void io_putchar(unsigned char);
 extern unsigned long call_c(cell arg0, cell arg1, cell arg2, cell entry);
 
 
-long
-writeLogByte_wrapper(long x, long y)
+static long writeLogByte_wrapper(long x, long y)
 {
 	unsigned long result;
 
@@ -66,8 +68,7 @@ writeLogByte_wrapper(long x, long y)
  * @param count number of bytes to be written
  * @return      the number of bytes that have been written successfully
  */
-int
-write(int fd, const void *buf, int count)
+ssize_t write(int fd, const void *buf, size_t count)
 {
 	int i;
 	char *ptr = (char *)buf;
diff --git a/slof/ppc64.h b/slof/ppc64.h
index 59a1b90..e3a2cd2 100644
--- a/slof/ppc64.h
+++ b/slof/ppc64.h
@@ -34,7 +34,7 @@ extern cell the_mem[];   /* Space for the dictionary / the HERE pointer */
 extern cell *restrict dp;
 extern cell *restrict rp;
 
-void client_entry_point();
+void client_entry_point(void);
 
 extern unsigned long call_client(cell);
 extern long c_romfs_lookup(long, long, void *);
-- 
1.8.3.1



More information about the SLOF mailing list