shithub: riscv

Download patch

ref: 95db2e9ddeaa3e85d4c7867541da72476db4a3c8
parent: c6b757504d33feb7ed968208b4a2215d9bf2b202
author: Jacob Moody <moody@posixcafe.org>
date: Thu May 16 23:01:25 EDT 2024

jl: add headerless with padded segments

--- a/sys/src/cmd/jl/asm.c
+++ b/sys/src/cmd/jl/asm.c
@@ -83,10 +83,13 @@
 	case 2:
 	case 3:
 	case 5:
-	case 6:
 		OFFSET = HEADR+textsize;
 		seek(cout, OFFSET, 0);
 		break;
+	case 6: /* headerless, padded segments */
+		OFFSET = rnd(HEADR+textsize, INITRND);
+		seek(cout, OFFSET, 0);
+		break;
 	}
 	for(t = 0; t < datsize; t += sizeof(buf)-100) {
 		if(datsize-t > sizeof(buf)-100)
@@ -111,8 +114,11 @@
 		case 2:
 		case 1:
 		case 5:
-		case 6:
 			OFFSET = HEADR+textsize+datsize;
+			seek(cout, OFFSET, 0);
+			break;
+		case 6: /* headerless, padded segments */
+			OFFSET += rnd(datsize, INITRND);
 			seek(cout, OFFSET, 0);
 			break;
 		}
--- a/sys/src/cmd/jl/obj.c
+++ b/sys/src/cmd/jl/obj.c
@@ -119,6 +119,7 @@
 		errorexit();
 
 	case 1:	/* headerless */
+	case 6: /* headerless, padded segments */
 		HEADR = 0;
 		if(INITTEXT == -1)
 			INITTEXT = 0;