i#1566 software divide on ARM: use libgcc divide emulation code

Adds gcc runtime code under third_party/libgcc to supply software divide
emulation for ARM, where we can't rely on hardware integer divide support.
The GPL "GCC Runtime Library Exception" allows us to link these files into
our BSD library.

Imports 4 assembly files and 1 extracted C routine from libgcc.  The
assembly files are built in separate passes due to label conflicts.

Fixes #1566

Review-URL: https://codereview.appspot.com/186420043
i#1551 port to ARM: implement _start

Implements _start for -early early injection support on ARM.
Fix style violations
Fix noisy encoding log by making DOLOG match the level of interior logs.
i#1551 port to ARM: implement (naive) memcpy and memset

We need our own memcpy and memset to avoid pulling in libc's version.
We have optimized x86 versions in x86.asm.
This commit adds initial naive unoptimized ARM versions.

Also fixes a bug in the ARM safe_read_asm.
i#1551 port to ARM: fix ARM release-build warnings

Fixes several warnings that show up in ARM release builds.

Review-URL: https://codereview.appspot.com/184580043
i#1551 port to ARM: TLS init for early injection

The app has not set up its TLS, leaving DR with no slot for swapping.
Strangely, tpidrro is not zero, so we add an explicit tls_early_init()
which calls SYS_set_tls on a static buffer to serve us until the app sets
up its TLS.

Review-URL: https://codereview.appspot.com/190200043
i#1551 port to ARM: implement branch query routines

Implements the branch query routines instr_is_{call,cbr,mbr,ubr} for ARM.
Eliminates the opcode_is_() versions (as we need to examine operands or
predicates on ARM), replacing them with _arch() versions
that can assume the opcode is decoded.

Adds new Thumb opcodes OP_cbz and OP_b_short.  OP_b_short splits the 16-bit
encoding ("b.n") from the 32-bit ("b.w"), as automatically figuring out
which to use at encode time would essentially implement OP_jmp_short which
is non-trivial (i#56).

Implements instr_is_cit_short().  We'll need to mangle OP_cbz and OP_cbnz
like we do for OP_jecxz today.

Implements instr_is_return(), which we define as either read lr and write
pc or pop into pc.

Review-URL: https://codereview.appspot.com/185540043
i#1551 port to ARM: fix uninitialized opnd.aux.flags

Review-URL: https://codereview.appspot.com/187360043
i#1551 Port DynamoRIO to ARM: update reg_get_size for special regs on ARM

Review-URL: https://codereview.appspot.com/189150043
i#1551 Port DynamoRIO to ARM: implement naive insert_parameter_preparation
- implement a naive version of insert_parameter_preparation to handle reg args

Review-URL: https://codereview.appspot.com/185520043
i#1551 Port DynamoRIO to ARM: fix release build error on arm/mangle.c

Review-URL: https://codereview.appspot.com/183590043
i#1574 missing defines: define X86_32 and X86_64 inside core

Ensure X86_32 and X86_64 are defined internally, as we've started using them.
This fixes a failure in -early due to __udivdi3 and __umoddi3 turning into
imports, and a build failure in append_prepare_fcache_return().

Fixes #1574

Review-URL: https://codereview.appspot.com/191100043
i#1551 port to ARM: implement find_syscall_num and instr_is_mov_constant

Implements find_syscall_num() for ARM by sharing the x86 code via
mangle_shared.c.  Adds a new DR_REG_SYSNUM define.

Implements instr_is_mov_constant() for ARM, which is needed for
find_syscall_num().  It considers OP_mov, OP_movs, OP_movw, OP_mvn,
OP_mvns, or OP_eor where the sources equal the destination and there is no
shift (the last mainly for symmetry with x86).

Review-URL: https://codereview.appspot.com/186460043
i#1551 port to ARM: implement ignore_reachability during encoding

Disable immediate range checks for TYPE_J for
instr_encode_ignore_reachability() (in particular, for each exit cti, which
temporarily holds the (often unreachable) app target).

Review-URL: https://codereview.appspot.com/191110043
i#1551 port to ARM: add XINST_CREATE_nop() and XINST_CREATE_jump_short()

Adds new cross-platform instruction creation routines XINST_CREATE_nop()
and XINST_CREATE_jump_short().

Review-URL: https://codereview.appspot.com/192010043
i#1551 Port DynamoRIO to ARM: implement fcache enter/return help routines on ARM
- implement fcache enter/return help routines
- add REG_DCXT and REG_DCXT_PROT

Review-URL: https://codereview.appspot.com/186410043
i#1551 port to ARM: syscall mangling

Share code with x86 in mangle_shared.c, changing the arch-specific routine
to mangle_shared_arch().

For ARM inlined syscalls, we assume we don't have to restore the stolen reg
as it's higher than any syscall param or number.  Plus we assume
callee-saved regs will survive.  If the stolen reg is caller-saved, we swap
it w/ a callee-saved reg.

Review-URL: https://codereview.appspot.com/183640043
i#1551 Port DynamoRIO to ARM: fix possible cross-compile failure on ARM
- add macro guard in third_party/libgcc/arm/lib1funcs.S

Review-URL: https://codereview.appspot.com/183610045
i#1551 port to ARM: downgrade dump_mcontext() SIMD assert

Logging hits this assert; downgrading so we can make progress.

Review-URL: https://codereview.appspot.com/192770043