https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113233
--- Comment #8 from GCC Commits <cvs-commit at gcc dot gnu.org> --- The releases/gcc-13 branch has been updated by LuluCheng <chengl...@gcc.gnu.org>: https://gcc.gnu.org/g:4736b317047ae6b04f7609843f21cb68fef6a0c1 commit r13-8545-g4736b317047ae6b04f7609843f21cb68fef6a0c1 Author: Lulu Cheng <chengl...@loongson.cn> Date: Fri Mar 15 16:23:05 2024 +0800 LoongArch: gcc13: Implement option save/restore. LTO option streaming and target attributes both require per-function target configuration, which is achieved via option save/restore. We implement TARGET_OPTION_{SAVE,RESTORE} to switch the la_target context in addition to other automatically maintained option states (via the "Save" option property in the .opt files). PR target/113233 gcc/ChangeLog: * config/loongarch/genopts/loongarch.opt.in: Mark options with the "Save" property. * config/loongarch/loongarch-opts.cc (loongarch_update_gcc_opt_status): Update the value of the la_target to global_options. * config/loongarch/loongarch-opts.h (loongarch_update_gcc_opt_status): Add a function declaration. * config/loongarch/loongarch.cc (loongarch_option_override_internal): Call the function loongarch_update_gcc_opt_status. (loongarch_option_save): New functions. (loongarch_option_restore): Likewise. (TARGET_OPTION_SAVE): Define macro. (TARGET_OPTION_RESTORE): Likewise. * config/loongarch/loongarch.opt: Regenerate. (cherry picked from commit ea2a9c76a1dcffbbec6e53655bef9236d3a8e691)