[CodeGen] Emit necessary .note sections for -fsplit-stack
authorThan McIntosh <thanm@google.com>
Wed, 27 Sep 2017 19:34:00 +0000 (19:34 +0000)
committerThan McIntosh <thanm@google.com>
Wed, 27 Sep 2017 19:34:00 +0000 (19:34 +0000)
commitdee2cf67eafd0313a5f0f163b9cbe6c71228ae34
treed7d27d63cac4f03f7cfcf069d49e1400c46b97e4
parent93e33f8fb3dbc3d08ff5c99b184648f5e52265a0
[CodeGen] Emit necessary .note sections for -fsplit-stack

Summary:
According to https://gcc.gnu.org/wiki/SplitStacks, the linker expects a zero-sized .note.GNU-split-stack section if split-stack is used (and also .note.GNU-no-split-stack section if it also contains non-split-stack functions), so it can handle the cases where a split-stack function calls non-split-stack function.

This change adds the sections if needed.

Fixes PR #34670.

Reviewers: thanm, rnk, luqmana

Reviewed By: rnk

Subscribers: llvm-commits

Patch by Cherry Zhang <cherryyz@google.com>

Differential Revision: https://reviews.llvm.org/D38051

llvm-svn: 314335
llvm/include/llvm/CodeGen/MachineModuleInfo.h
llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
llvm/lib/CodeGen/MachineModuleInfo.cpp
llvm/lib/CodeGen/PrologEpilogInserter.cpp
llvm/test/CodeGen/X86/segmented-stacks.ll