ref: 0d6153841d81c5a7b7c850f1ee63677ec493b227
parent: 2c2cf405d21514116fc928df8583280f3b03b6bf
author: Jacob Moody <moody@posixcafe.org>
date: Wed Apr 24 18:18:41 EDT 2024
ja, jc, jl: properly make riscv64 the default Stop checking argv0, just use a flag. Add shell scripts to invoke in 32 bit mode.
--- /dev/null
+++ b/rc/bin/ia
@@ -1,0 +1,2 @@
+#!/bin/rc
+exec ja -i $*
--- /dev/null
+++ b/rc/bin/ic
@@ -1,0 +1,2 @@
+#!/bin/rc
+exec jc -i $*
--- /dev/null
+++ b/rc/bin/il
@@ -1,0 +1,2 @@
+#!/bin/rc
+exec jl -i $*
--- a/sys/src/cmd/ja/lex.c
+++ b/sys/src/cmd/ja/lex.c
@@ -9,14 +9,7 @@
char *p;
int nout, nproc, status, i, c;
- thechar = 'i';
- p = strrchr(argv[0], '/');
- if(p == nil)
- p = argv[0];
- else
- p++;
- if(*p == 'j')
- thechar = 'j';
+ thechar = 'j';
memset(debug, 0, sizeof(debug));
cinit();
outfile = 0;
@@ -44,12 +37,12 @@
break;
} ARGEND
+ if(debug['i'])
+ thechar = 'i';
if(*argv == 0) {
print("usage: %ca [-options] file.s\n", thechar);
errorexit();
}
- if(debug['j'])
- thechar = 'j';
thestring = (thechar == 'j'? "riscv64" : "riscv");
if(argc > 1 && systemtype(Windows)){
print("can't assemble multiple files on windows\n");
--- a/sys/src/cmd/jc/txt.c
+++ b/sys/src/cmd/jc/txt.c
@@ -15,19 +15,12 @@
maxregalloc = atoi(p);
if (maxregalloc < REGALLOC || maxregalloc >= NREG)
maxregalloc = REGALLOC;
- thechar = 'i';
- p = strrchr(argv[0], '/');
- if(p == nil)
- p = argv[0];
- else
- p++;
- if(*p == 'j')
- thechar = 'j';
+ thechar = 'j';
oargc = argc;
oargv = argv;
ARGBEGIN {
- case 'j':
- thechar = 'j';
+ case 'i':
+ thechar = 'i';
break;
case 'o':
case 'D':
--- a/sys/src/cmd/jl/obj.c
+++ b/sys/src/cmd/jl/obj.c
@@ -8,8 +8,8 @@
char *noname = "<none>";
char symname[] = SYMDEF;
-char thechar = 'i';
-char *thestring = "riscv";
+char thechar = 'j';
+char *thestring = "riscv64";
/*
* -H1 -R4 is headerless (-R8 for jl)
@@ -50,15 +50,8 @@
INITDAT = -1;
INITRND = -1;
INITENTRY = 0;
- ptrsize = 4;
+ ptrsize = 8;
- a = strrchr(argv[0], '/');
- if(a == nil)
- a = argv[0];
- else
- a++;
- if(*a == 'j')
- thechar = 'j';
ARGBEGIN {
default:
c = ARGC();
@@ -99,18 +92,16 @@
HEADTYPE = atolwhex(a);
break;
} ARGEND
-
USED(argc);
+ if(debug['i']){
+ thechar = 'i';
+ thestring = "riscv";
+ ptrsize = 4;
+ }
if(*argv == 0) {
diag("usage: %cl [-options] objects", thechar);
errorexit();
- }
- if(debug['j'])
- thechar = 'j';
- if(thechar == 'j'){
- thestring = "riscv64";
- ptrsize = 8;
}
if(!debug['9'] && !debug['U'] && !debug['B'])
debug[DEFAULT] = 1;