summaryrefslogtreecommitdiff
path: root/sys/src/cmd/6l
diff options
context:
space:
mode:
authorcinap_lenrek <cinap_lenrek@felloff.net>2015-08-16 13:41:14 +0200
committercinap_lenrek <cinap_lenrek@felloff.net>2015-08-16 13:41:14 +0200
commitcf74c80e7b38a6ae521da16d4bdf84783ef320e7 (patch)
tree5d9d8893786d8ab5067181e2938e9498bb4d73e9 /sys/src/cmd/6l
parent0b48d5fdbfd91033765acbbc66e820a363a5d660 (diff)
6l: fix vlong byte order when running on big endian machine (thanks erik quanstro)
Diffstat (limited to 'sys/src/cmd/6l')
-rw-r--r--sys/src/cmd/6l/l.h1
-rw-r--r--sys/src/cmd/6l/obj.c19
2 files changed, 18 insertions, 2 deletions
diff --git a/sys/src/cmd/6l/l.h b/sys/src/cmd/6l/l.h
index ef2f436dd..39037c5a2 100644
--- a/sys/src/cmd/6l/l.h
+++ b/sys/src/cmd/6l/l.h
@@ -354,6 +354,7 @@ vlong entryvalue(void);
void errorexit(void);
void export(void);
int find1(long, int);
+int find1v(vlong, int);
int find2(long, int);
void follow(void);
void gethunk(void);
diff --git a/sys/src/cmd/6l/obj.c b/sys/src/cmd/6l/obj.c
index 8035ae1e9..0353e2c30 100644
--- a/sys/src/cmd/6l/obj.c
+++ b/sys/src/cmd/6l/obj.c
@@ -1417,12 +1417,14 @@ nuxiinit(void)
if(i < 1)
inuxi1[i] = c;
inuxi4[i] = c;
- inuxi8[i] = c;
- inuxi8[i+4] = c+4;
fnuxi4[i] = c;
fnuxi8[i] = c;
fnuxi8[i+4] = c+4;
}
+
+ for(i=0; i<8; i++)
+ inuxi8[i] = find1v(0x0807060504030201LL, i+1);
+
if(debug['v']) {
Bprint(&bso, "inuxi = ");
for(i=0; i<1; i++)
@@ -1461,6 +1463,19 @@ find1(long l, int c)
}
int
+find1v(vlong l, int c)
+{
+ char *p;
+ int i;
+
+ p = (char*)&l;
+ for(i=0; i<8; i++)
+ if(*p++ == c)
+ return i;
+ return 0;
+}
+
+int
find2(long l, int c)
{
short *p;