Fix Hadrian build with Stack (#17189)