Port CMS specific patches from 5.34.21

This was done via:

```
git rebase -i  --ignore-whitespace --onto cms/v5-34-22 v5-34-21 cms-sw/cms/v5-34-21 
```

A few gotchas:

- skipped 2c774a3 Fix trampolines for ARM.
- skipped beb76f4 Revert "Fix trampolines for ARM."                                                                                                                                                                                             
- whitespace diff in d687335 Protect global list of functions from concurrent access
- empty fcdd7d3 Protect global list of TFormulaPrimitives
- empty 510ade2 Cintex fix order for multi-dim arrays.
- conflicts f54cb8f Thread safety fixes for TCint. Version in 5.34.22 is the correct one.
- empty 0e1e969 Make function static return values thread_safe
- empty 85117b7 Added missing locks when calling gCint
- conflict 67d0bd4 Make TClass::fIsAMethod setting thread safe. New version is the correct one.
- empty c9b6baa Call TROOT::GetGlobalFunction instead of GetListOfGlobalFunctions
- conflict 19c579b Lock access to gROOT->fGlobalFunctions. Just in a comment, new version is the correct one.
- empty 449ef7d Remove parentheses from destructor call to fix problem with clang 3.5