Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[DebugInfo] -gpubnames option support in Driver #25

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 10 additions & 7 deletions clang/lib/Driver/ToolChains/ClassicFlang.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -329,16 +329,16 @@ void ClassicFlang::ConstructJob(Compilation &C, const JobAction &JA,

// Last argument of -g/-gdwarfX should be taken.
Arg *GArg = Args.getLastArg(options::OPT_g_Flag);
Arg *GDwarfArg = Args.getLastArg(options::OPT_gdwarf_2,
options::OPT_gdwarf_3,
options::OPT_gdwarf_4,
options::OPT_gdwarf_5);
Arg *GDwarfArg = Args.getLastArg(options::OPT_gdwarf_2, options::OPT_gdwarf_3,
options::OPT_gdwarf_4, options::OPT_gdwarf_5,
options::OPT_gpubnames);

if (GArg || GDwarfArg) {

for (auto Arg : Args.filtered(options::OPT_g_Flag, options::OPT_gdwarf_2,
options::OPT_gdwarf_3, options::OPT_gdwarf_4,
options::OPT_gdwarf_5)) {
for (auto Arg :
Args.filtered(options::OPT_g_Flag, options::OPT_gdwarf_2,
options::OPT_gdwarf_3, options::OPT_gdwarf_4,
options::OPT_gdwarf_5, options::OPT_gpubnames)) {
Arg->claim();
}

Expand All @@ -355,6 +355,9 @@ void ClassicFlang::ConstructJob(Compilation &C, const JobAction &JA,
CommonCmdArgs.push_back("0x1000000");
else if (GDwarfArg->getOption().matches(options::OPT_gdwarf_5)) // -gdwarf-5
CommonCmdArgs.push_back("0x2000000");
else if (GDwarfArg->getOption().matches(
options::OPT_gpubnames)) // -gpubnames
CommonCmdArgs.push_back("0x40000000");
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@SouraVX , thanks for adding me as a reviewer. The only thing I cannot figure out is where the value of 0x4000000 comes from?
Perhaps I am looking in a wrong place, but the only place where I found the dwarf flags with similar values to these is here and the value of 040000000 is described as "Do not generate include file tables". Can you point me to the code or documentation of this flag value, please?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @michalpasztamobica for reviewing this. This PR is pretty old and hence might be missing pieces(Apologies for that) . In this PR intent is to use/bind an available bit to this option more details: https://github.com/flang-compiler/flang/blob/master/tools/flang2/docs/xflag.n#L3306 bit.
This piece of diff is missing from flang-compiler/flang#934, I'll update the PR soon.

diff --git a/tools/flang2/docs/xflag.n b/tools/flang2/docs/xflag.n
index 2ad1b02e..eddf910b 100644
--- a/tools/flang2/docs/xflag.n
+++ b/tools/flang2/docs/xflag.n
@@ -3254,7 +3254,7 @@ Generating eh_frame.
 .XB 0x20000000:
 Generating eh_frame with .cfi directives: requires 120,0x10000000 to be on
 .XB 0x40000000
-AVAILABLE
+Generate .debug_names/.debug_pubnames section.
 .XB 0x80000000:
 no license check in executable.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Modifications/rebase Done @michalpasztamobica . Now you can apply these 2 PR in order and test :)
Order: Apply this one first -> then 934. Build and test.

}

// -Mipa has no effect
Expand Down