summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Christopher <echristo@gmail.com>2014-02-14 01:27:03 +0000
committerEric Christopher <echristo@gmail.com>2014-02-14 01:27:03 +0000
commit9330356642b3892a0b4134506c2c2b8d93cdec60 (patch)
treebdd5270a414cb98bca8d924f942a9a7b93ed4cf9
parent6df4eb9cf31536716f1eb9310a7e7cc7a01779ed (diff)
downloadclang-9330356642b3892a0b4134506c2c2b8d93cdec60.tar.gz
Add a command line option -gdwarf-aranges that will turn on emitting
the dwarf .debug_aranges section. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@201379 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--include/clang/Driver/CC1Options.td2
-rw-r--r--include/clang/Driver/Options.td1
-rw-r--r--lib/Driver/Tools.cpp7
-rw-r--r--test/Driver/debug-options.c6
4 files changed, 15 insertions, 1 deletions
diff --git a/include/clang/Driver/CC1Options.td b/include/clang/Driver/CC1Options.td
index c4d04e9e07..66674ab442 100644
--- a/include/clang/Driver/CC1Options.td
+++ b/include/clang/Driver/CC1Options.td
@@ -138,6 +138,8 @@ def split_dwarf : Flag<["-"], "split-dwarf">,
HelpText<"Split out the dwarf .dwo sections">;
def gnu_pubnames : Flag<["-"], "gnu-pubnames">,
HelpText<"Emit newer GNU style pubnames">;
+def arange_sections : Flag<["-"], "arange_sections">,
+ HelpText<"Emit DWARF .debug_arange sections">;
def fforbid_guard_variables : Flag<["-"], "fforbid-guard-variables">,
HelpText<"Emit an error if a C++ static local initializer would need a guard variable">;
def no_implicit_float : Flag<["-"], "no-implicit-float">,
diff --git a/include/clang/Driver/Options.td b/include/clang/Driver/Options.td
index ed0fc0315e..0877133da1 100644
--- a/include/clang/Driver/Options.td
+++ b/include/clang/Driver/Options.td
@@ -924,6 +924,7 @@ def gno_strict_dwarf : Flag<["-"], "gno-strict-dwarf">, Group<g_flags_Group>;
def gcolumn_info : Flag<["-"], "gcolumn-info">, Group<g_flags_Group>;
def gsplit_dwarf : Flag<["-"], "gsplit-dwarf">, Group<g_flags_Group>;
def ggnu_pubnames : Flag<["-"], "ggnu-pubnames">, Group<g_flags_Group>;
+def gdwarf_aranges : Flag<["-"], "gdwarf-aranges">, Group<g_flags_Group>;
def headerpad__max__install__names : Joined<["-"], "headerpad_max_install_names">;
def help : Flag<["-", "--"], "help">, Flags<[CC1Option]>,
HelpText<"Display available options">;
diff --git a/lib/Driver/Tools.cpp b/lib/Driver/Tools.cpp
index feac80df96..083bc48d69 100644
--- a/lib/Driver/Tools.cpp
+++ b/lib/Driver/Tools.cpp
@@ -2690,6 +2690,13 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA,
CmdArgs.push_back("-generate-gnu-dwarf-pub-sections");
}
+ // -gdwarf-aranges turns on the emission of the aranges section in the
+ // backend.
+ if (Args.hasArg(options::OPT_gdwarf_aranges)) {
+ CmdArgs.push_back("-backend-option");
+ CmdArgs.push_back("-generate-arange-section");
+ }
+
if (Args.hasFlag(options::OPT_fdebug_types_section,
options::OPT_fno_debug_types_section, false)) {
CmdArgs.push_back("-backend-option");
diff --git a/test/Driver/debug-options.c b/test/Driver/debug-options.c
index 8582896ca2..d18c26878a 100644
--- a/test/Driver/debug-options.c
+++ b/test/Driver/debug-options.c
@@ -50,6 +50,8 @@
//
// RUN: %clang -### -c -ggnu-pubnames %s 2>&1 | FileCheck -check-prefix=GOPT %s
//
+// RUN: %clang -### -c -gdwarf-aranges %s 2>&1 | FileCheck -check-prefix=GARANGE %s
+//
// RUN: %clang -### -fdebug-types-section %s 2>&1 \
// RUN: | FileCheck -check-prefix=FDTS %s
//
@@ -62,7 +64,7 @@
//
// G_DARWIN: "-cc1"
// G_DARWIN: "-gdwarf-2"
-//
+//
// G_D2: "-cc1"
// G_D2: "-gdwarf-2"
//
@@ -86,6 +88,8 @@
//
// GOPT: -generate-gnu-dwarf-pub-sections
//
+// GARANGE: -generate-arange-section
+//
// FDTS: "-backend-option" "-generate-type-units"
//
// NOFDTS-NOT: "-backend-option" "-generate-type-units"