Split out the C-- preprocessor, and make it pass -g0
Previously, C-- was processed with the C preprocessor program. This means that it inherited flags passed via -optc. A flag that is somewhat often passed through -optc is -g. At certain -g levels (>=2), GCC starts emitting defines *after* preprocessing, for the purposes of debug info generation. This is not useful for the C-- compiler, and, in fact, causes lexer errors. We can suppress this effect (safely, if supported) via -g0. As a workaround, in older versions of GCC (<=10), GCC only emitted defines if a certain set of -g*3 flags was passed. Newer versions check the debug level. For the former, we filter out those -g*3 flags and, for the latter, we specify -g0 on top of that. As a compatible and effective solution, this change adds a C-- preprocessor distinct from the C compiler and preprocessor, but that keeps its flags. The command line produced for C-- preprocessing now looks like: $pgmCmmP $optCs_without_g3 $g0_if_supported $optCmmP Closes: #24474
Showing
- compiler/GHC/Driver/Pipeline/Execute.hs 1 addition, 1 deletioncompiler/GHC/Driver/Pipeline/Execute.hs
- compiler/GHC/Driver/Session.hs 27 additions, 4 deletionscompiler/GHC/Driver/Session.hs
- compiler/GHC/Iface/Recomp/Flags.hs 7 additions, 1 deletioncompiler/GHC/Iface/Recomp/Flags.hs
- compiler/GHC/Settings.hs 16 additions, 0 deletionscompiler/GHC/Settings.hs
- compiler/GHC/Settings/IO.hs 8 additions, 0 deletionscompiler/GHC/Settings/IO.hs
- compiler/GHC/SysTools/Cpp.hs 15 additions, 2 deletionscompiler/GHC/SysTools/Cpp.hs
- compiler/GHC/SysTools/Tasks.hs 19 additions, 0 deletionscompiler/GHC/SysTools/Tasks.hs
- configure.ac 13 additions, 0 deletionsconfigure.ac
- distrib/configure.ac.in 6 additions, 0 deletionsdistrib/configure.ac.in
- docs/users_guide/phases.rst 19 additions, 1 deletiondocs/users_guide/phases.rst
- hadrian/bindist/Makefile 3 additions, 0 deletionshadrian/bindist/Makefile
- hadrian/bindist/config.mk.in 3 additions, 0 deletionshadrian/bindist/config.mk.in
- hadrian/cfg/default.host.target.in 1 addition, 0 deletionshadrian/cfg/default.host.target.in
- hadrian/cfg/default.target.in 1 addition, 0 deletionshadrian/cfg/default.target.in
- hadrian/src/Rules/Generate.hs 6 additions, 0 deletionshadrian/src/Rules/Generate.hs
- m4/fp_cmm_cpp_cmd_with_args.m4 67 additions, 0 deletionsm4/fp_cmm_cpp_cmd_with_args.m4
- m4/fp_settings.m4 15 additions, 0 deletionsm4/fp_settings.m4
- m4/fp_setup_windows_toolchain.m4 2 additions, 0 deletionsm4/fp_setup_windows_toolchain.m4
- m4/ghc_toolchain.m4 2 additions, 0 deletionsm4/ghc_toolchain.m4
- m4/prep_target_file.m4 2 additions, 0 deletionsm4/prep_target_file.m4
Loading
Please register or sign in to comment