================
@@ -46,16 +46,23 @@ std::string BitcodeCompiler::getThinLTOOutputFile(StringRef 
path) {
 
 lto::Config BitcodeCompiler::createConfig() {
   lto::Config c;
-  c.Options = initTargetOptionsFromCodeGenFlags();
-  c.Options.EmitAddrsig = true;
+  bool emitAsm = ctx.config.emit == EmitKind::ASM;
+  c.ModifyTargetOptions = [emitAsm](TargetOptions &options) {
+    options.EmitAddrsig = true;
+    // Always emit a section per function/datum with LTO. LLVM LTO should get
+    // most of the benefit of linker GC, but there are still opportunities for
+    // ICF.
+    options.FunctionSections = true;
+    options.DataSections = true;
+
+    if (emitAsm) {
----------------
nikic wrote:

braces

https://github.com/llvm/llvm-project/pull/179509
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to