Merged with upstream Jan 30: 117cc3fca2732f8

Merged with the upstream changes up to Jan 30th, at the point of
hash: 117cc3fca2732f8

Retained the changes needed to precompile M routines with GTM.
Updated to upstream hash 117cc3fc.