Commit 66cdc699 authored by Russ Cox's avatar Russ Cox

arm: fix build on android

R=kaib
CC=golang-dev
https://golang.org/cl/206059
parent fb94be55
...@@ -232,10 +232,10 @@ enum as ...@@ -232,10 +232,10 @@ enum as
#define D_SHIFT (D_NONE+19) #define D_SHIFT (D_NONE+19)
#define D_FPCR (D_NONE+20) #define D_FPCR (D_NONE+20)
#define D_REGREG (D_NONE+21) #define D_REGREG (D_NONE+21)
#define D_ADDR (D_NONE+22) #define D_ADDR (D_NONE+22)
#define D_SBIG (D_NONE+23) #define D_SBIG (D_NONE+23)
#define D_CONST2 (D_NONE+24) #define D_CONST2 (D_NONE+24)
/* name */ /* name */
...@@ -244,6 +244,9 @@ enum as ...@@ -244,6 +244,9 @@ enum as
#define D_AUTO (D_NONE+5) #define D_AUTO (D_NONE+5)
#define D_PARAM (D_NONE+6) #define D_PARAM (D_NONE+6)
/* internal only */
#define D_SIZE (D_NONE+40)
/* /*
* this is the ranlib header * this is the ranlib header
*/ */
......
...@@ -9,6 +9,7 @@ TARG=\ ...@@ -9,6 +9,7 @@ TARG=\
OFILES=\ OFILES=\
asm.$O\ asm.$O\
elf.$O\
enam.$O\ enam.$O\
lib.$O\ lib.$O\
list.$O\ list.$O\
...@@ -24,6 +25,7 @@ OFILES=\ ...@@ -24,6 +25,7 @@ OFILES=\
HFILES=\ HFILES=\
l.h\ l.h\
../5l/5.out.h\ ../5l/5.out.h\
../ld/elf.h\
$(TARG): $(OFILES) $(TARG): $(OFILES)
$(LD) -o $(TARG) -L"$(GOROOT)"/lib $(OFILES) -lbio -l9 $(LD) -o $(TARG) -L"$(GOROOT)"/lib $(OFILES) -lbio -l9
......
This diff is collapsed.
...@@ -127,6 +127,7 @@ struct Sym ...@@ -127,6 +127,7 @@ struct Sym
uchar reachable; uchar reachable;
int32 value; int32 value;
int32 sig; int32 sig;
int32 size;
uchar used; uchar used;
uchar thumb; // thumb code uchar thumb; // thumb code
uchar foreign; // called by arm if thumb, by thumb if arm uchar foreign; // called by arm if thumb, by thumb if arm
...@@ -470,13 +471,20 @@ int fninc(Sym *); ...@@ -470,13 +471,20 @@ int fninc(Sym *);
void thumbcount(void); void thumbcount(void);
void reachable(void); void reachable(void);
void fnptrs(void); void fnptrs(void);
void doelf(void);
uint32 linuxheadr(void);
void linuxphdr(int type, int flags, vlong foff, vlong addaddr(Sym *s, Sym *t);
vlong vaddr, vlong paddr, vlong addsize(Sym *s, Sym *t);
vlong filesize, vlong memsize, vlong align); vlong addstring(Sym *s, char *str);
void linuxshdr(char *name, uint32 type, vlong flags, vlong addr, vlong off, vlong adduint16(Sym *s, uint16 v);
vlong size, uint32 link, uint32 info, vlong align, vlong entsize); vlong adduint32(Sym *s, uint32 v);
int linuxstrtable(void); vlong adduint64(Sym *s, uint64 v);
vlong adduint8(Sym *s, uint8 v);
vlong adduintxx(Sym *s, uint64 v, int wid);
/* Native is little-endian */
#define LPUT(a) lputl(a)
#define WPUT(a) wputl(a)
#define VPUT(a) abort()
#endif #endif
...@@ -31,6 +31,7 @@ ...@@ -31,6 +31,7 @@
#define EXTERN #define EXTERN
#include "l.h" #include "l.h"
#include "../ld/lib.h" #include "../ld/lib.h"
#include "../ld/elf.h"
#include <ar.h> #include <ar.h>
#ifndef DEFAULT #ifndef DEFAULT
...@@ -223,9 +224,11 @@ main(int argc, char *argv[]) ...@@ -223,9 +224,11 @@ main(int argc, char *argv[])
INITRND = 1024; INITRND = 1024;
break; break;
case 6: /* arm elf */ case 6: /* arm elf */
HEADR = linuxheadr(); debug['d'] = 1; // no dynamic linking
elfinit();
HEADR = ELFRESERVE;
if(INITTEXT == -1) if(INITTEXT == -1)
INITTEXT = 0x8000; INITTEXT = 0x8000 + HEADR;
if(INITDAT == -1) if(INITDAT == -1)
INITDAT = 0; INITDAT = 0;
if(INITRND == -1) if(INITRND == -1)
...@@ -300,12 +303,15 @@ main(int argc, char *argv[]) ...@@ -300,12 +303,15 @@ main(int argc, char *argv[])
doprof2(); doprof2();
if(debug['u']) if(debug['u'])
reachable(); reachable();
doelf();
dodata(); dodata();
if(seenthumb && debug['f']) if(seenthumb && debug['f'])
fnptrs(); fnptrs();
follow(); follow();
if(firstp == P) if(firstp == P) {
goto out; diag("no code");
errorexit();
}
softfloat(); softfloat();
noops(); noops();
span(); span();
......
...@@ -92,6 +92,7 @@ dodata(void) ...@@ -92,6 +92,7 @@ dodata(void)
} }
while(v & 3) while(v & 3)
v++; v++;
s->size = v;
s->value = v; s->value = v;
if(v > MINSIZ) if(v > MINSIZ)
continue; continue;
...@@ -113,6 +114,7 @@ dodata(void) ...@@ -113,6 +114,7 @@ dodata(void)
continue; continue;
} }
v = s->value; v = s->value;
s->size = v;
s->value = orig; s->value = orig;
orig += v; orig += v;
} }
...@@ -130,6 +132,7 @@ dodata(void) ...@@ -130,6 +132,7 @@ dodata(void)
if(s->type != SBSS) if(s->type != SBSS)
continue; continue;
v = s->value; v = s->value;
s->size = v;
s->value = orig; s->value = orig;
orig += v; orig += v;
} }
......
...@@ -16,6 +16,7 @@ ...@@ -16,6 +16,7 @@
#define SYS_exit (SYS_BASE + 1) #define SYS_exit (SYS_BASE + 1)
#define SYS_write (SYS_BASE + 4) #define SYS_write (SYS_BASE + 4)
#define SYS_gettimeofday (SYS_BASE + 78)
#define SYS_clone (SYS_BASE + 120) #define SYS_clone (SYS_BASE + 120)
#define SYS_mmap2 (SYS_BASE + 192) #define SYS_mmap2 (SYS_BASE + 192)
#define SYS_gettid (SYS_BASE + 224) #define SYS_gettid (SYS_BASE + 224)
...@@ -60,6 +61,33 @@ TEXT ·mmap(SB),7,$0 ...@@ -60,6 +61,33 @@ TEXT ·mmap(SB),7,$0
SWI $0 SWI $0
RET RET
TEXT gettime(SB),7,$32
/* dummy version - return 0,0 */
MOVW $0, R1
MOVW 0(FP), R0
MOVW R1, 0(R0)
MOVW R1, 4(R0)
MOVW 4(FP), R0
MOVW R1, 0(R0)
/*
attempt at real version - seg faults
MOVW $8(SP), R0
MOVW $0, R1
MOVW $SYS_gettimeofday, R7
SWI $0
MOVW 0(FP), R0 // sec
MOVW 8(SP), R1
MOVW R1, 0(R0)
MOVW 4(FP), R0 // usec
MOVW 12(SP), R1
MOVW R1, 0(R0)
*/
RET
// int32 futex(int32 *uaddr, int32 op, int32 val, // int32 futex(int32 *uaddr, int32 op, int32 val,
// struct timespec *timeout, int32 *uaddr2, int32 val2); // struct timespec *timeout, int32 *uaddr2, int32 val2);
TEXT futex(SB),7,$0 TEXT futex(SB),7,$0
......
...@@ -133,7 +133,6 @@ fixedbugs/bug120.go ...@@ -133,7 +133,6 @@ fixedbugs/bug120.go
fixedbugs/bug121.go fixedbugs/bug121.go
fixedbugs/bug122.go fixedbugs/bug122.go
fixedbugs/bug123.go fixedbugs/bug123.go
fixedbugs/bug125.go
fixedbugs/bug126.go fixedbugs/bug126.go
fixedbugs/bug127.go fixedbugs/bug127.go
fixedbugs/bug128.go fixedbugs/bug128.go
...@@ -171,7 +170,6 @@ fixedbugs/bug161.go ...@@ -171,7 +170,6 @@ fixedbugs/bug161.go
fixedbugs/bug163.go fixedbugs/bug163.go
fixedbugs/bug164.go fixedbugs/bug164.go
fixedbugs/bug165.go fixedbugs/bug165.go
fixedbugs/bug166.go
fixedbugs/bug167.go fixedbugs/bug167.go
fixedbugs/bug168.go fixedbugs/bug168.go
fixedbugs/bug169.go fixedbugs/bug169.go
...@@ -287,7 +285,6 @@ method3.go ...@@ -287,7 +285,6 @@ method3.go
named1.go named1.go
nil.go nil.go
parentype.go parentype.go
peano.go
printbig.go printbig.go
range.go range.go
rename1.go rename1.go
...@@ -304,4 +301,3 @@ turing.go ...@@ -304,4 +301,3 @@ turing.go
utf.go utf.go
varinit.go varinit.go
vectors.go vectors.go
x.go
=========== 64bit.go
BUG: 64bit
=========== chan/nonblock.go
PASS
=========== cmp2.go
comparing uncomparable type []int
throw: interface compare
panic PC=xxx
[1] Segmentation fault "${@}"
=========== cmp3.go
comparing uncomparable type []int
throw: interface compare
panic PC=xxx
[1] Segmentation fault "${@}"
=========== cmp4.go
hash of unhashable type []int
throw: interface hash
panic PC=xxx
[1] Segmentation fault "${@}"
=========== cmp5.go
hash of unhashable type []int
throw: interface hash
panic PC=xxx
[1] Segmentation fault "${@}"
=========== fixedbugs/bug016.go
fixedbugs/bug016.go:11: constant -3 overflows uint
=========== fixedbugs/bug027.go
hi
0 44444
1 3333
2 222
3 11
4 0
0 44444
1 3333
2 222
3 11
4 0
=========== fixedbugs/bug067.go
ok
=========== fixedbugs/bug070.go
outer loop top k 0
inner loop top i 0
do break
broke
=========== fixedbugs/bug081.go
fixedbugs/bug081.go:9: fatal error: typecheck loop
=========== fixedbugs/bug093.go
M
=========== fixedbugs/bug113.go
interface is int, not int32
throw: interface conversion
panic PC=xxx
[1] Segmentation fault "${@}"
=========== fixedbugs/bug120.go
Bad float64 const: 123.5 want 123.5 got %¤
[1] Segmentation fault "${@}"
BUG: bug120
=========== fixedbugs/bug148.go
2 3
interface is main.T, not main.T
throw: interface conversion
panic PC=xxx
[1] Segmentation fault "${@}"
=========== fixedbugs/bug154.go
??none??: $GOROOT/pkg/linux_arm/strconv.a: failed to load: os.ERANGE
BUG: should not panic
=========== fixedbugs/bug206.go
??none??: $GOROOT/pkg/linux_arm/strconv.a: failed to load: os.ERANGE
BUG: bug206
=========== helloworld.go
hello, world
=========== interface/fail.go
*main.S is not main.I: missing method Foo
throw: interface conversion
panic PC=xxx
[1] Segmentation fault "${@}"
=========== interface/returntype.go
*main.S is not main.I2: missing method Name
throw: interface conversion
panic PC=xxx
[1] Segmentation fault "${@}"
=========== ken/intervar.go
print 1 bio 2 file 3 -- abc
=========== ken/label.go
100
=========== ken/rob1.go
9876543210
=========== ken/rob2.go
(defn foo (add 12 34))
=========== ken/simpprint.go
hello world
=========== ken/simpswitch.go
0out01out12out2aout34out4fiveout56out6aout78out89out9
=========== ken/string.go
abcxyz-abcxyz-abcxyz-abcxyz-abcxyz-abcxyz-abcxyz
=========== printbig.go
-9223372036854775808
9223372036854775807
=========== sigchld.go
survived SIGCHLD
=========== turing.go
Hello World!
...@@ -89,10 +89,6 @@ done | # clean up some stack noise ...@@ -89,10 +89,6 @@ done | # clean up some stack noise
/^\$RUNFILE: line 1: PID Trace\/breakpoint trap/d /^\$RUNFILE: line 1: PID Trace\/breakpoint trap/d
/^qemu: uncaught target signal 11 (Segmentation fault) - exiting/d' > run.out /^qemu: uncaught target signal 11 (Segmentation fault) - exiting/d' > run.out
case $failed in
1)
echo FAIL
esac
rm -f $RUNFILE $TMP1FILE $TMP2FILE *.$A $A.out rm -f $RUNFILE $TMP1FILE $TMP2FILE *.$A $A.out
diffmsg="" diffmsg=""
if ! diff run.out golden.out if ! diff run.out golden.out
...@@ -106,4 +102,8 @@ inbugs=$(sed '1,/^== bugs/d' run.out | grep -c '^BUG') ...@@ -106,4 +102,8 @@ inbugs=$(sed '1,/^== bugs/d' run.out | grep -c '^BUG')
echo 2>&1 $inbugs known bugs';' $notinbugs unexpected bugs$diffmsg echo 2>&1 $inbugs known bugs';' $notinbugs unexpected bugs$diffmsg
if [ "$failed" != "0" ]; then
echo FAILED
fi
exit $failed exit $failed
...@@ -13,7 +13,7 @@ X386) ...@@ -13,7 +13,7 @@ X386)
;; ;;
Xarm) Xarm)
export A=5 export A=5
export E="qemu-arm -cpu cortex-a8 " export E="${GORUN:-qemu-arm -cpu cortex-a8}"
;; ;;
*) *)
echo 1>&2 run: unsupported '$GOARCH' echo 1>&2 run: unsupported '$GOARCH'
...@@ -42,20 +42,18 @@ do ...@@ -42,20 +42,18 @@ do
dir=$(dirname $i) dir=$(dirname $i)
export D=$dir export D=$dir
sed '/^\/\//!q' $i | sed 's@//@@; $d' |sed 's|./\$A.out|$E &|' >$RUNFILE sed '/^\/\//!q' $i | sed 's@//@@; $d' |sed 's|./\$A.out|$E &|' >$RUNFILE
if ! sh $RUNFILE >$TMP1FILE 2>$TMP2FILE if ! sh $RUNFILE >$TMP1FILE 2>&1
then then
echo echo
echo "===========" $i echo "===========" $i
cat $TMP1FILE cat $TMP1FILE
cat $TMP2FILE
echo >&2 fail: $i echo >&2 fail: $i
touch $FAILEDFILE touch $FAILEDFILE
elif test -s $TMP1FILE || test -s $TMP2FILE elif test -s $TMP1FILE
then then
echo echo
echo "===========" $i echo "===========" $i
cat $TMP1FILE cat $TMP1FILE
cat $TMP2FILE
elif [ $dir = "bugs" ] elif [ $dir = "bugs" ]
then then
echo $i succeeded with no output. echo $i succeeded with no output.
...@@ -68,16 +66,27 @@ done | # clean up some stack noise ...@@ -68,16 +66,27 @@ done | # clean up some stack noise
s/^pc: 0x[0-9a-f]*/pc: xxx/ s/^pc: 0x[0-9a-f]*/pc: xxx/
/^Trace\/breakpoint trap/d /^Trace\/breakpoint trap/d
/^Trace\/BPT trap/d /^Trace\/BPT trap/d
s!'$GOROOT'!$GOROOT!g
/RUNFILE/ s/line 1: *[0-9]*/line 1: PID/ /RUNFILE/ s/line 1: *[0-9]*/line 1: PID/
/^\$RUNFILE: line 1: PID Trace\/breakpoint trap/d /^\$RUNFILE: line 1: PID Trace\/breakpoint trap/d
/^qemu: uncaught target signal 11 (Segmentation fault) - exiting/d' > run.out /^qemu: uncaught target signal 11 (Segmentation fault) - exiting/d' > run.out
failed=0 failed=0
if test -f $FAILEDFILE; then rm -f $RUNFILE $TMP1FILE $TMP2FILE *.$A $A.out
diffmsg=""
if ! diff run.out golden-arm.out
then
diffmsg="; test output differs"
failed=1 failed=1
rm -f $FAILEDFILE
fi fi
rm -f $RUNFILE $TMP1FILE $TMP2FILE *.$A $A.out notinbugs=$(sed '/^== bugs/q' run.out | grep -c '^BUG')
inbugs=$(sed '1,/^== bugs/d' run.out | grep -c '^BUG')
echo 2>&1 $inbugs known bugs';' $notinbugs unexpected bugs$diffmsg
if [ "$failed" != "0" ]; then
echo FAILED
fi
exit $failed exit $failed
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment