The Windows toolchain has been building libonnxruntime with exceptions enabled, unlike every other
platform. --disable_exceptions is inert at the cmake level: onnxruntime_DISABLE_EXCEPTIONS is a
dependent option that cmake forces off without onnxruntime_MINIMAL_BUILD, so the explicit
-fno-exceptions and *_NO_EXCEPTIONS flags this script passed were the only thing turning exceptions
off on Linux, macOS and Android, and nothing did the MSVC equivalent. A flags-only fix cannot work on
MSVC either, since cmake appends /EHsc after the caller's flags whenever the option is off.
The local patch that already lets build.py accept --disable_exceptions on its own now does the same
for cmake by making the option plain. Upstream's own handling then applies everywhere: -fno-exceptions
on clang, dropping /EHsc and setting _HAS_EXCEPTIONS=0 on MSVC, and the ORT, ONNX, MLAS and json
no-exception defines, so the script stops passing them itself. The patch also keeps unwind tables,
which upstream drops alongside exceptions. Firefox builds with -funwind-tables so the crash reporter
can walk stacks, and frames inside libonnxruntime should stay walkable too.
Differential Revision: https://phabricator.services.mozilla.com/D325059