[CMake] Revert r200695 and fix the problem with missing -fno-function-sections in a different way.