compile target arm and thumb files with O3, fall back to O2 for cpp files

Change-Id: I1f580d9ecfbc92f5be853a6325045a5a865fbfda