azat updated this revision to Diff 462756.
azat added a comment.
Resubmit with fixed tests and using --plugin-opt
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D133092/new/
https://reviews.llvm.org/D133092
Files:
clang/lib/Driver/ToolChains/CommonArgs.cpp
clang/test/Driver/debug-options-aranges.c
Index: clang/test/Driver/debug-options-aranges.c
===================================================================
--- /dev/null
+++ clang/test/Driver/debug-options-aranges.c
@@ -0,0 +1,7 @@
+// REQUIRES: lld
+
+// Check that the linker plugin will get -generate-arange-section
+//
+// RUN: %clang -### -g -target x86_64-linux -flto -fuse-ld=lld
-gdwarf-aranges %s 2>&1 | FileCheck %s
+// RUN: %clang -### -g -target x86_64-linux -flto=thin -fuse-ld=lld
-gdwarf-aranges %s 2>&1 | FileCheck %s
+// CHECK: --plugin-opt=-generate-arange-section
Index: clang/lib/Driver/ToolChains/CommonArgs.cpp
===================================================================
--- clang/lib/Driver/ToolChains/CommonArgs.cpp
+++ clang/lib/Driver/ToolChains/CommonArgs.cpp
@@ -508,6 +508,14 @@
CmdArgs.push_back(Args.MakeArgString(Plugin));
}
+ // Note, this solution is far from perfect, better to encode it into IR
+ // metadata, but this may not be worth it, since it looks like aranges is on
+ // the way out.
+ if (Args.hasArg(options::OPT_gdwarf_aranges)) {
+ CmdArgs.push_back(
+ Args.MakeArgString("--plugin-opt=-generate-arange-section"));
+ }
+
// Try to pass driver level flags relevant to LTO code generation down to
// the plugin.
Index: clang/test/Driver/debug-options-aranges.c
===================================================================
--- /dev/null
+++ clang/test/Driver/debug-options-aranges.c
@@ -0,0 +1,7 @@
+// REQUIRES: lld
+
+// Check that the linker plugin will get -generate-arange-section
+//
+// RUN: %clang -### -g -target x86_64-linux -flto -fuse-ld=lld -gdwarf-aranges %s 2>&1 | FileCheck %s
+// RUN: %clang -### -g -target x86_64-linux -flto=thin -fuse-ld=lld -gdwarf-aranges %s 2>&1 | FileCheck %s
+// CHECK: --plugin-opt=-generate-arange-section
Index: clang/lib/Driver/ToolChains/CommonArgs.cpp
===================================================================
--- clang/lib/Driver/ToolChains/CommonArgs.cpp
+++ clang/lib/Driver/ToolChains/CommonArgs.cpp
@@ -508,6 +508,14 @@
CmdArgs.push_back(Args.MakeArgString(Plugin));
}
+ // Note, this solution is far from perfect, better to encode it into IR
+ // metadata, but this may not be worth it, since it looks like aranges is on
+ // the way out.
+ if (Args.hasArg(options::OPT_gdwarf_aranges)) {
+ CmdArgs.push_back(
+ Args.MakeArgString("--plugin-opt=-generate-arange-section"));
+ }
+
// Try to pass driver level flags relevant to LTO code generation down to
// the plugin.
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits