azat created this revision. Herald added a subscriber: inglorion. Herald added a project: All. azat requested review of this revision. Herald added subscribers: cfe-commits, MaskRay. Herald added a project: clang.
Right now in case of LTO the section is not emited: $ cat test.c void __attribute__((optnone)) bar() { } void __attribute__((optnone)) foo() { bar(); } int main() { foo(); } $ clang -flto=thin -gdwarf-aranges -g -O3 test.c $ eu-readelf -waranges a.out | fgrep -c -e foo -e bar 0 $ clang -gdwarf-aranges -g -O3 test.c $ eu-readelf -waranges a.out | fgrep -c -e foo -e bar 2 Fix this by passing explicitly -mllvm -generate-arange-section. P.S. although this looks like a hack, since none of -mllvm was passed to the lld before. Signed-off-by: Azat Khuzhin <a.khuz...@semrush.com> Suggested-by: OCHyams <orlando.hy...@sony.com> Repository: rG LLVM Github Monorepo https://reviews.llvm.org/D133092 Files: clang/lib/Driver/ToolChains/CommonArgs.cpp Index: clang/lib/Driver/ToolChains/CommonArgs.cpp =================================================================== --- clang/lib/Driver/ToolChains/CommonArgs.cpp +++ clang/lib/Driver/ToolChains/CommonArgs.cpp @@ -506,6 +506,9 @@ Suffix, Plugin); CmdArgs.push_back(Args.MakeArgString(Plugin)); + } else if (Args.hasArg(options::OPT_gdwarf_aranges)) { + CmdArgs.push_back(Args.MakeArgString("-mllvm")); + CmdArgs.push_back(Args.MakeArgString("-generate-arange-section")); } // Try to pass driver level flags relevant to LTO code generation down to
Index: clang/lib/Driver/ToolChains/CommonArgs.cpp =================================================================== --- clang/lib/Driver/ToolChains/CommonArgs.cpp +++ clang/lib/Driver/ToolChains/CommonArgs.cpp @@ -506,6 +506,9 @@ Suffix, Plugin); CmdArgs.push_back(Args.MakeArgString(Plugin)); + } else if (Args.hasArg(options::OPT_gdwarf_aranges)) { + CmdArgs.push_back(Args.MakeArgString("-mllvm")); + CmdArgs.push_back(Args.MakeArgString("-generate-arange-section")); } // Try to pass driver level flags relevant to LTO code generation down to
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits