Fix build errors and kernel crash on boot with gcc 4.7+

Backports to fix unknown CPU architecture build errors and kernel panic on boot with gcc 4.7+