Port GNU Objcopy -G/--keep-global-symbol(s).
This is slightly different than the already-implemented --globalize-symbol, which marks a symbol as global when copying. When --keep-global-symbol (alias -G) is used, *only* those symbols marked will stay global, and all other globals are demoted to local. (Also note that it doesn't *promote* a symbol to global). Additionally, there is a pluralized version of the flag --keep-global-symbols, which effectively applies --keep-global-symbol for every non-comment in a file.
I see what you're doing with this CHECK pattern, but I think it will false positive if we for some reason create additional symbols, although I guess I could be persuaded that this is not an issue to worry about.
I think you should probably also check the total symbol count. With that, I think this pattern becomes valid.