summaryrefslogtreecommitdiffstats
path: root/clang/lib
diff options
context:
space:
mode:
authorPeter Collingbourne <peter@pcc.me.uk>2018-07-17 23:17:16 +0000
committerPeter Collingbourne <peter@pcc.me.uk>2018-07-17 23:17:16 +0000
commit27242c0402f0cf5280ea5aba05d8f3a71e2e57fd (patch)
tree9bce1a1f356bccc1bb590792ff58c53c0f7c427a /clang/lib
parent4fd84c18df3e671e0a66fdf2abf9224b8868e0e4 (diff)
downloadbcm5719-llvm-27242c0402f0cf5280ea5aba05d8f3a71e2e57fd.tar.gz
bcm5719-llvm-27242c0402f0cf5280ea5aba05d8f3a71e2e57fd.zip
Teach Clang to emit address-significance tables.
By default, we emit an address-significance table on all ELF targets when the integrated assembler is enabled. The emission of an address-significance table can be controlled with the -faddrsig and -fno-addrsig flags. Differential Revision: https://reviews.llvm.org/D48155 llvm-svn: 337333
Diffstat (limited to 'clang/lib')
-rw-r--r--clang/lib/CodeGen/BackendUtil.cpp1
-rw-r--r--clang/lib/Driver/ToolChains/Clang.cpp5
-rw-r--r--clang/lib/Frontend/CompilerInvocation.cpp2
3 files changed, 8 insertions, 0 deletions
diff --git a/clang/lib/CodeGen/BackendUtil.cpp b/clang/lib/CodeGen/BackendUtil.cpp
index 226a27b2161..415bd962622 100644
--- a/clang/lib/CodeGen/BackendUtil.cpp
+++ b/clang/lib/CodeGen/BackendUtil.cpp
@@ -454,6 +454,7 @@ static void initTargetOptions(llvm::TargetOptions &Options,
Options.ExplicitEmulatedTLS = CodeGenOpts.ExplicitEmulatedTLS;
Options.DebuggerTuning = CodeGenOpts.getDebuggerTuning();
Options.EmitStackSizeSection = CodeGenOpts.StackSizeSection;
+ Options.EmitAddrsig = CodeGenOpts.Addrsig;
if (CodeGenOpts.EnableSplitDwarf)
Options.MCOptions.SplitDwarfFile = CodeGenOpts.SplitDwarfFile;
diff --git a/clang/lib/Driver/ToolChains/Clang.cpp b/clang/lib/Driver/ToolChains/Clang.cpp
index e7b15c7ad82..4db4dc19a8b 100644
--- a/clang/lib/Driver/ToolChains/Clang.cpp
+++ b/clang/lib/Driver/ToolChains/Clang.cpp
@@ -4777,6 +4777,11 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA,
}
}
+ if (Args.hasFlag(options::OPT_faddrsig, options::OPT_fno_addrsig,
+ getToolChain().getTriple().isOSBinFormatELF() &&
+ getToolChain().useIntegratedAs()))
+ CmdArgs.push_back("-faddrsig");
+
// Finally add the compile command to the compilation.
if (Args.hasArg(options::OPT__SLASH_fallback) &&
Output.getType() == types::TY_Object &&
diff --git a/clang/lib/Frontend/CompilerInvocation.cpp b/clang/lib/Frontend/CompilerInvocation.cpp
index d62429dc788..c26d5fb79b3 100644
--- a/clang/lib/Frontend/CompilerInvocation.cpp
+++ b/clang/lib/Frontend/CompilerInvocation.cpp
@@ -1119,6 +1119,8 @@ static bool ParseCodeGenArgs(CodeGenOptions &Opts, ArgList &Args, InputKind IK,
Opts.EmitVersionIdentMetadata = Args.hasFlag(OPT_Qy, OPT_Qn, true);
+ Opts.Addrsig = Args.hasArg(OPT_faddrsig);
+
return Success;
}
OpenPOWER on IntegriCloud