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

no debug info for stack guard checks #62480

Open
nickdesaulniers opened this issue May 1, 2023 · 4 comments
Open

no debug info for stack guard checks #62480

nickdesaulniers opened this issue May 1, 2023 · 4 comments

Comments

@nickdesaulniers
Copy link
Member

nickdesaulniers commented May 1, 2023

Consider the following:

// clang -fstack-protector-strong -O2 -mstack-protector-guard-reg=gs -mstack-protector-guard-symbol=__stack_chk_guard -fno-pie -g
void foo (int*);

void bar (int x) {
    int y [x];
    foo(y);
}

It looks like the following assembler is lacking debug info:

        movq    __stack_chk_guard@GOTPCREL(%rip), %rbx
        movq    %gs:(%rbx), %rax
        movq    %rax, -16(%rbp)
...
        callq   __stack_chk_fail@PLT

This is more easily visible in Godbolt: https://godbolt.org/z/cnozfa15E

@llvmbot
Copy link
Collaborator

llvmbot commented May 1, 2023

@llvm/issue-subscribers-debuginfo

@jmorse
Copy link
Member

jmorse commented May 2, 2023

What would be your preferred source location for the stack check setup -- presumably the same as the prologue?

Putting a source location on the call to __stack_chk_fail is slightly more tricky seeing how multiple return paths presumably branch to the call. Possibly the closing brace of the function would be most appropriate, however I'm not sure if that's available so late in compilation.

@nickdesaulniers
Copy link
Member Author

What would be your preferred source location for the stack check setup -- presumably the same as the prologue?

SGTM

Perhaps the epilog can be reused for __stack_chk_fail if available?

@nickdesaulniers
Copy link
Member Author

Also, it looks like -g1 changes the debug info associated? (The coverage looks better with -g1 than -g2).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants