[Lldb-commits] [PATCH] D71789: [lldb] Refactor thread-step-out-ret-addr-check test to use .data instead of stack variable

Pavel Labath via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Sat Dec 21 01:37:58 PST 2019


labath added subscribers: MaskRay, krytarowski.
labath added a comment.

I don't really understand what's going on, but it seems that the lack of the `.note.GNU-stack` section causes the data section to be executable too (at least on my machine, anyway). Which means that using the data address will not help. :( I'm cc'ing some people who know more about dynamic linkers to see if anyone can explain this behavior...

One sure way to get a non-executable memory address would be to allocate something on the heap (in the C file), but I think @jankratochvil's approach of adding the .note.GNU-stack is simpler, and so far it seems that it works everywhere. The section directive will trip up the non-linux assemblers though, so it needs to be `#ifdef __linux__` (afaict `#ifdefs` work just fine in asm files when invoking the processing through clang)...



================
Comment at: lldb/test/Shell/Unwind/Inputs/thread-step-out-ret-addr-check.s:18
 
         add $0x10, %rsp
         ret
----------------
This should be 0x08, or you'll should push one more value to stack in asm_main.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D71789/new/

https://reviews.llvm.org/D71789





More information about the lldb-commits mailing list