From 0f43a6daddd41722a4183a49b344f85b5aefbb33 Mon Sep 17 00:00:00 2001 From: Eric Christopher Date: Fri, 13 Sep 2013 22:37:55 +0000 Subject: [PATCH] Add support for -ggnu-pubnames matching the llvm support. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@190729 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/clang/Driver/CC1Options.td | 2 ++ include/clang/Driver/Options.td | 1 + lib/Driver/Tools.cpp | 6 ++++++ test/Driver/debug-options.c | 4 ++++ 4 files changed, 13 insertions(+) diff --git a/include/clang/Driver/CC1Options.td b/include/clang/Driver/CC1Options.td index d91001f8c7..d5a8b775d7 100644 --- a/include/clang/Driver/CC1Options.td +++ b/include/clang/Driver/CC1Options.td @@ -138,6 +138,8 @@ def dwarf_column_info : Flag<["-"], "dwarf-column-info">, HelpText<"Turn on column location information.">; 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 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 90e9faca22..95dd607c1c 100644 --- a/include/clang/Driver/Options.td +++ b/include/clang/Driver/Options.td @@ -852,6 +852,7 @@ def gstrict_dwarf : Flag<["-"], "gstrict-dwarf">, Group; def gno_strict_dwarf : Flag<["-"], "gno-strict-dwarf">, Group; def gcolumn_info : Flag<["-"], "gcolumn-info">, Group; def gsplit_dwarf : Flag<["-"], "gsplit-dwarf">, Group; +def ggnu_pubnames : Flag<["-"], "ggnu-pubnames">, 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 0d95ecdcf8..30ecdc05d3 100644 --- a/lib/Driver/Tools.cpp +++ b/lib/Driver/Tools.cpp @@ -2499,6 +2499,7 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA, if (Args.hasArg(options::OPT_gcolumn_info)) CmdArgs.push_back("-dwarf-column-info"); + // FIXME: Move backend command line options to the module. // -gsplit-dwarf should turn on -g and enable the backend dwarf // splitting and extraction. // FIXME: Currently only works on Linux. @@ -2509,6 +2510,11 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA, CmdArgs.push_back("-split-dwarf=Enable"); } + // -ggnu-pubnames turns on gnu style pubnames in the backend. + if (Args.hasArg(options::OPT_ggnu_pubnames)) { + CmdArgs.push_back("-backend-option"); + CmdArgs.push_back("-generate-gnu-dwarf-pub-sections"); + } Args.AddAllArgs(CmdArgs, options::OPT_fdebug_types_section); diff --git a/test/Driver/debug-options.c b/test/Driver/debug-options.c index 449d8a9bda..1f890b2e67 100644 --- a/test/Driver/debug-options.c +++ b/test/Driver/debug-options.c @@ -47,6 +47,8 @@ // RUN: -fno-debug-types-section %s 2>&1 \ // RUN: | FileCheck -check-prefix=GIGNORE %s // +// RUN: %clang -### -c -ggnu-pubnames %s 2>&1 | FileCheck -check-prefix=GOPT %s +// // G: "-cc1" // G: "-g" // @@ -78,3 +80,5 @@ // GLTO_NO-NOT: "-gline-tables-only" // // GIGNORE-NOT: "argument unused during compilation" +// +// GOPT: -generate-gnu-dwarf-pub-sections -- 2.40.0