Skip to contentSkip to conversation

silo: Build with -fno-PIC to reduce size

PATCH In review Matt Turner 1 participant 6 messages Apr 5, 2020 Alpha port

lore
Share & tools
lore

Matt Turner

author maintainer
#0 lore raw

PATCH 1/5 silo: Build with -fno-PIC to reduce size

Otherwise the resulting image will be too large:

| ./util second.map second.aout second2.aout second.b second.b2 | Distance between two changes larger than 63K 3 84553 0

---
 Rules.make | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Rules.make +1 -1
index 0f176db..3d0efe7 100644
@@ -19,7 +19,7 @@ cc-option-yn = $(shell if $(CC) $(CFLAGS) $(1) -S -o /dev/null -xc /dev/null \
 		> /dev/null 2>&1; then echo "y"; else echo "n"; fi;)
 
 CFLAGS = -Os -Wall -I. -I../include -fomit-frame-pointer \
-	-fno-strict-aliasing -DSMALL_RELOC=$(SMALL_RELOC) \
+	-fno-strict-aliasing -fno-PIC -DSMALL_RELOC=$(SMALL_RELOC) \
 	-DLARGE_RELOC=$(LARGE_RELOC)
 HOSTCFLAGS = -O2 -Wall
 
Signature · 1 line
2.24.1
author maintainer
#1 lore raw

PATCH 2/5 silo: Build with -U_FORTIFY_SOURCE

Otherwise the build will fail:

| ld: decompnet.o: in function `error':
| decomp.c:(.text+0x4dc): undefined reference to `__longjmp_chk'

---
 Rules.make | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
Rules.make +2 -1
index 3d0efe7..9739f7a 100644
@@ -19,7 +19,8 @@ cc-option-yn = $(shell if $(CC) $(CFLAGS) $(1) -S -o /dev/null -xc /dev/null \
 		> /dev/null 2>&1; then echo "y"; else echo "n"; fi;)
 
 CFLAGS = -Os -Wall -I. -I../include -fomit-frame-pointer \
-	-fno-strict-aliasing -fno-PIC -DSMALL_RELOC=$(SMALL_RELOC) \
+	-fno-strict-aliasing -fno-PIC -U_FORTIFY_SOURCE \
+	-DSMALL_RELOC=$(SMALL_RELOC) \
 	-DLARGE_RELOC=$(LARGE_RELOC)
 HOSTCFLAGS = -O2 -Wall
 
Signature · 1 line
2.24.1
author maintainer
#2 lore raw

PATCH 3/5 silo: Fix misleading indentation

In reply to Matt Turner
---
 common/stringops1.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
common/stringops1.c +1 -1
index 08ed4be..6edac96 100644
@@ -74,7 +74,7 @@ int strlen(const char *s)
 {
 	const char *sc;
 	for (sc = s; *sc != '\0'; ++sc);
-		return sc - s;
+	return sc - s;
 }
 
 int strncmp(const char *cs, const char *ct, size_t count)
Signature · 1 line
2.24.1
author maintainer
#3 lore raw

PATCH 4/5 second: Fix typo'd operator

In reply to Matt Turner
---
 second/disk.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
second/disk.c +1 -1
index 40234b3..b81a465 100644
@@ -293,7 +293,7 @@ int silo_disk_read(char *buff, int size, unsigned long long offset)
 	if (!net) {
 	    if (prom_vers != PROM_P1275) {
 		    if (((romvec->pv_printrev >> 16) < 2 || 
-		         ((romvec->pv_printrev >> 16) == 2 && (romvec->pv_printrev && 0xffff) < 6)) 
+		         ((romvec->pv_printrev >> 16) == 2 && (romvec->pv_printrev & 0xffff) < 6))
 		        && offset >= 0x40000000) {
 		    	printf ("Buggy old PROMs don't allow reading past 1GB from start of the disk. Send complaints to SMCC\n");
 	    		return -1;
Signature · 1 line
2.24.1
author maintainer
#4 lore raw

PATCH 5/5 second/util: Remove unused shadowed variables

In reply to Matt Turner
---
 second/util.c | 2 --
 1 file changed, 2 deletions(-)
second/util.c +0 -2
index 3346823..3469c34 100644
@@ -120,8 +120,6 @@ int main(int argc, char **argv)
     int end, rodata_start, rodata_end;
     int net = 0;
     int i = 1;
-    char sym[256];
-    unsigned int addr;
 
     if (!strcmp (argv[i], "-a")) {
 	net = 1;
Signature · 1 line
2.24.1