Porting Go to ARMv4
===================
I am currently running Go produced code happily on ARMv4T. Would it be
ok to submit these as CLs after the Go 1.3 release?
Invidual items list their relevant patches, a combined patch is found on:
http://s.violetti.org/armv4_all.diff.txt
Patch: Supporting code for different ARM variants
-------------------------------------------------
Issue 7211:
https://code.google.com/p/go/issues/detail?id=7211
Created a patch for build tags like "armv6". Currently it supports:
+ GOARM=N -> Build tag armvN
+ GO386=X -> Build tag X
http://s.violetti.org/go_build_gosubarch.diff.txt
Patch: Lack of CLZ
------------------
CLZ is available only on ARMv5, it is not generated by the compilers,
but present in udiv in runtime/vlop_arm.s and
math/big/arith_arm.s. Created armv4 specific versions of those files.
http://s.violetti.org/armv4_math_big_no_clz.diff.txt
http://s.violetti.org/armv4_runtime_no_clz.diff.txt
Patch: MULAWT (smlawt) in udiv assembler source
-----------------------------------------------
MULAWT (smlawt) is only present in ARMv5E and higher. Even plain ARMv5
and ARMvT lack it. Patched armv5 specific udiv source to emulate it.
http://s.violetti.org/armv5_runtime_mulawt_requires_armv5te.diff.txt
Patch: liblink do not generate indirect register calls as BLX on ARMv4
----------------------------------------------------------------------
BLX rX is written as MOVW PC, LR; MOVW rX. PC on ARMv4. This does not
support Thumb interworking (there are slower variants with
interworking), but Thumb interworking is not needed for calls inside
the toolchain.
In buildop the size of affected ABLS variants is bumped to 8 and in
asmout they are rewritten.
Alternative failed approaches were: rewriting the call in progedit
results in errors as it ceases to be considered a call. Adding a NOP
in progedit results in invalid jump offsets.
http://s.violetti.org/armv4_liblink_patch_blx.diff.txt
Patch: cgo support
------------------
Cgo assembler has BLX. Provide ARMv4 specific alternative.
This needs more testing.
http://s.violetti.org/armv4_runtime_cgo_no_blx.diff.txt
Note: runtime搓reakpoint broken - no BKPT
-----------------------------------------
Debugging with gdb works fine, but the runtime asm_arm.s has BKPT
in runtime搓reakpoint which is not supported.
Note: Thumb support
-------------------
There is currently commented out Thumb code in
pkg/runtime/rt0_linux_arm.s, if enabled it would need fixes for both
plain ARMv5 and ARMv4.
Note: 5c generates PLD
----------------------
PLD is an ARMv5E instruction, but it appears as a NOP on systems not
supporting it.
Note: Atomic ops for 64 bit types require Linux kernel >=3.1
------------------------------------------------------------
64 bit atomic operations are emulated on Linux on ARMv4 and ARMv5 with
__kuser_cmpxchg64 that is present from version 3.1 onwards. With older
kernels the assembler code containing ARMv6 specific things gets called.
This results in a SIGILL in check64 with older kernels when trying to
use 64 bit atomic operations.
ps. Thanks for Aram for help on #go-nuts
- Taru Karttunen