This is an archive of the discontinued LLVM Phabricator instance.

Emit .eh_frame with relocations to functions, rather than sections
ClosedPublic

Authored by olista01 on Oct 30 2014, 3:46 AM.

Details

Reviewers
olista01
Summary

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.

Diff Detail

Event Timeline

olista01 updated this revision to Diff 15565.Oct 30 2014, 3:46 AM
olista01 retitled this revision from to Emit .eh_frame with relocations to functions, rather than sections.
olista01 updated this object.
olista01 edited the test plan for this revision. (Show Details)
olista01 set the repository for this revision to rL LLVM.
olista01 added a subscriber: Unknown Object (MLST).

Hi Oliver,

Looks reasonable to me, with the comment below.

cheers,
--renato

lib/MC/MCParser/AsmParser.cpp
498

I'd call it something similar FuncSymbol to help identify it with it use.

Committed as r221150, with your suggested change.

olista01 accepted this revision.Nov 3 2014, 4:13 AM
olista01 added a reviewer: olista01.
This revision is now accepted and ready to land.Nov 3 2014, 4:13 AM
olista01 closed this revision.Nov 3 2014, 4:14 AM