Index: include/clang/Driver/Options.td =================================================================== --- include/clang/Driver/Options.td +++ include/clang/Driver/Options.td @@ -1161,6 +1161,7 @@ def gsplit_dwarf : Flag<["-"], "gsplit-dwarf">, Group; def ggnu_pubnames : Flag<["-"], "ggnu-pubnames">, Group; def gdwarf_aranges : Flag<["-"], "gdwarf-aranges">, Group; +def gdwarf_accel_tables : Flag<["-"], "gdwarf-accel-tables">, Group; def gmodules : Flag <["-"], "gmodules">, Group, HelpText<"Generate debug info with external references to clang modules" " or precompiled headers">; Index: lib/Driver/Tools.cpp =================================================================== --- lib/Driver/Tools.cpp +++ lib/Driver/Tools.cpp @@ -3876,6 +3876,14 @@ CmdArgs.push_back("-split-dwarf=Enable"); } + // -gdwarf-accel-tables should turn on -g and enable the genereation of the + // dwarf acceleration tables in the backend. + if (Args.hasArg(options::OPT_gdwarf_accel_tables)) { + DebugInfoKind = CodeGenOptions::LimitedDebugInfo; + CmdArgs.push_back("-backend-option"); + CmdArgs.push_back("-dwarf-accel-tables=Enable"); + } + // After we've dealt with all combinations of things that could // make DebugInfoKind be other than None or DebugLineTablesOnly, // figure out if we need to "upgrade" it to standalone debug info. Index: test/Driver/dwarf-accel.c =================================================================== --- /dev/null +++ test/Driver/dwarf-accel.c @@ -0,0 +1,6 @@ +// Check that -gdwarf-accel-tables requests the emission of the accelerator tables +// +// RUN: %clang -target x86_64-unknown-linux-gnu -gdwarf-accel-tables -c -### %s 2> %t +// RUN: FileCheck -check-prefix=CHECK < %t %s +// +// CHECK: -dwarf-accel-tables=Enable