Emit .eh_frame with relocations to functions, rather than sections
authorOliver Stannard <oliver.stannard@arm.com>
Mon, 3 Nov 2014 12:02:51 +0000 (12:02 +0000)
committerOliver Stannard <oliver.stannard@arm.com>
Mon, 3 Nov 2014 12:02:51 +0000 (12:02 +0000)
commitb63d71ef813d48a5d07b92c9d911635b3163facf
tree1b5f416d0f28f7847293188b358c9d19686cba27
parent89a66f4ae58fb984b8121b38a69477960cd843cd
Emit .eh_frame with relocations to functions, rather than sections

When LLVM emits DWARF call frame information, it currently creates a local,
section-relative symbol in the code section, which is pointed to by a
relocation on the .eh_frame section. However, for C++ we emit some functions in
section groups, and the SysV ABI has some rules to make it easier to remove
these sections
(http://www.sco.com/developers/gabi/latest/ch4.sheader.html#section_group_rules):

  A symbol table entry with STB_LOCAL binding that is defined relative to one
  of a group's sections, and that is contained in a symbol table section that is
  not part of the group, must be discarded if the group members are discarded.
  References to this symbol table entry from outside the group are not allowed.

This means that we need to use the function symbol for the relocation, not a
temporary symbol.

There was a comment in the code claiming that the local symbol was used to
avoid creating a relocation, but a relocation must be created anyway as the
code and CFI are in different sections.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@221150 91177308-0d34-0410-b5e6-96231b3b80d8
include/llvm/MC/MCObjectStreamer.h
include/llvm/MC/MCStreamer.h
lib/CodeGen/AsmPrinter/ARMException.cpp
lib/CodeGen/AsmPrinter/DwarfCFIException.cpp
lib/MC/MCAsmStreamer.cpp
lib/MC/MCObjectStreamer.cpp
lib/MC/MCParser/AsmParser.cpp
lib/MC/MCStreamer.cpp
test/DebugInfo/AArch64/eh_frame.s
test/DebugInfo/AArch64/eh_frame_personality.ll