зеркало из https://github.com/microsoft/clang-1.git
add frontend support for -fdata-sections and -ffunction-sections,
patch by Sylvere Teissier! git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@101108 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Родитель
0b2bd47151
Коммит
bbea716832
|
@ -32,6 +32,7 @@ public:
|
|||
unsigned CXAAtExit : 1; /// Use __cxa_atexit for calling destructors.
|
||||
unsigned CXXCtorDtorAliases: 1; /// Emit complete ctors/dtors as linker
|
||||
/// aliases to base ctors when possible.
|
||||
unsigned DataSections : 1; /// Set when -fdata-sections is enabled
|
||||
unsigned DebugInfo : 1; /// Should generate deubg info (-g).
|
||||
unsigned DisableFPElim : 1; /// Set when -fomit-frame-pointer is enabled.
|
||||
unsigned DisableLLVMOpts : 1; /// Don't run any optimizations, for use in
|
||||
|
@ -39,6 +40,7 @@ public:
|
|||
/// internal state before optimizations are
|
||||
/// done.
|
||||
unsigned DisableRedZone : 1; /// Set when -mno-red-zone is enabled.
|
||||
unsigned FunctionSections : 1; /// Set when -ffunction-sections is enabled
|
||||
unsigned MergeAllConstants : 1; /// Merge identical constants.
|
||||
unsigned NoCommon : 1; /// Set when -fno-common or C++ is enabled.
|
||||
unsigned NoImplicitFloat : 1; /// Set when -mno-implicit-float is enabled.
|
||||
|
@ -88,10 +90,12 @@ public:
|
|||
AsmVerbose = 0;
|
||||
CXAAtExit = 1;
|
||||
CXXCtorDtorAliases = 0;
|
||||
DataSections = 0;
|
||||
DebugInfo = 0;
|
||||
DisableFPElim = 0;
|
||||
DisableLLVMOpts = 0;
|
||||
DisableRedZone = 0;
|
||||
FunctionSections = 0;
|
||||
MergeAllConstants = 1;
|
||||
NoCommon = 0;
|
||||
NoImplicitFloat = 0;
|
||||
|
|
|
@ -123,6 +123,10 @@ def fno_threadsafe_statics : Flag<"-fno-threadsafe-statics">,
|
|||
HelpText<"Do not emit code to make initialization of local statics thread safe">;
|
||||
def fdump_vtable_layouts : Flag<"-fdump-vtable-layouts">,
|
||||
HelpText<"Dump the layouts of all vtables that will be emitted in a translation unit">;
|
||||
def ffunction_sections : Flag<"-ffunction-sections">,
|
||||
HelpText<"Place each function in its own section (ELF Only)">;
|
||||
def fdata_sections : Flag<"-fdata-sections">,
|
||||
HelpText<"Place each data in its own section (ELF Only)">;
|
||||
def masm_verbose : Flag<"-masm-verbose">,
|
||||
HelpText<"Generate verbose assembly output">;
|
||||
def mcode_model : Separate<"-mcode-model">,
|
||||
|
|
|
@ -261,6 +261,9 @@ bool BackendConsumer::AddEmitPasses() {
|
|||
|
||||
TargetMachine::setAsmVerbosityDefault(CodeGenOpts.AsmVerbose);
|
||||
|
||||
TargetMachine::setFunctionSections(CodeGenOpts.FunctionSections);
|
||||
TargetMachine::setDataSections (CodeGenOpts.DataSections);
|
||||
|
||||
// FIXME: Parse this earlier.
|
||||
if (CodeGenOpts.RelocationModel == "static") {
|
||||
TargetMachine::setRelocationModel(llvm::Reloc::Static);
|
||||
|
|
|
@ -148,6 +148,10 @@ static void CodeGenOptsToArgs(const CodeGenOptions &Opts,
|
|||
// VerifyModule is only derived.
|
||||
// Inlining is only derived.
|
||||
|
||||
if (Opts.DataSections)
|
||||
Res.push_back("-fdata-sections");
|
||||
if (Opts.FunctionSections)
|
||||
Res.push_back("-ffunction-sections");
|
||||
if (Opts.AsmVerbose)
|
||||
Res.push_back("-masm-verbose");
|
||||
if (!Opts.CodeModel.empty()) {
|
||||
|
@ -803,6 +807,9 @@ static void ParseCodeGenArgs(CodeGenOptions &Opts, ArgList &Args,
|
|||
Opts.UnwindTables = Args.hasArg(OPT_munwind_tables);
|
||||
Opts.RelocationModel = getLastArgValue(Args, OPT_mrelocation_model, "pic");
|
||||
|
||||
Opts.FunctionSections = Args.hasArg(OPT_ffunction_sections);
|
||||
Opts.DataSections = Args.hasArg(OPT_fdata_sections);
|
||||
|
||||
Opts.MainFileName = getLastArgValue(Args, OPT_main_file_name);
|
||||
Opts.VerifyModule = !Args.hasArg(OPT_disable_llvm_verifier);
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче