This is a redo of D63612.
Two problems came up on some bots:
- __builtin_umull_overflow was not declared. This is likely due to an older clang or gcc, so add a guard with __has_builtin and fallback to a division in the event the builtin doesn't exist;
- contradicting definition for malloc, etc. This is AFAIU due to the fact that we ended up transitively including stdlib.h in the .inc due to it being the flags parser header: so move the include to the cc instead.
This should fix the issues, but since those didn't come up in my local
tests it's mostly guesswork.
Rest is the same!