[PATCH] D133875: [clang] fix generation of .debug_aranges with LTO (resubmit)
Azat Khuzhin via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Wed Sep 14 13:51:17 PDT 2022
azat updated this revision to Diff 460212.
azat added a comment.
Use --plugin-opt=-generate-arange-section instead.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D133875/new/
https://reviews.llvm.org/D133875
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,8 @@
+// Check that lld will emit dwarf aranges.
+
+// RUN: %clang -### -target x86_64-unknown-linux -c -gdwarf-aranges %s 2>&1 | FileCheck -check-prefix=GARANGE %s
+// RUN: %clang -### -target x86_64-unknown-linux -flto -gdwarf-aranges %s 2>&1 | FileCheck -check-prefix=PLUGIN_GARANGE %s
+// RUN: %clang -### -target x86_64-unknown-linux -flto=thin -gdwarf-aranges %s 2>&1 | FileCheck -check-prefix=PLUGIN_GARANGE %s
+//
+// GARANGE: -generate-arange-section
+// PLUGIN_GARANGE: --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,13 @@
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.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D133875.460212.patch
Type: text/x-patch
Size: 1412 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20220914/320475ef/attachment.bin>
More information about the cfe-commits
mailing list