Add back a patch wrongly removed by rBb9c37608a9e9, and add another fix, for gcc11 build support. Re {T95206}.