[LLVMbugs] [Bug 19430] New: cfi_startproc should emit a relocation at the actual location of the directive to to match gas(1) behavior

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Mon Apr 14 18:18:39 PDT 2014


http://llvm.org/bugs/show_bug.cgi?id=19430

            Bug ID: 19430
           Summary: cfi_startproc should emit a relocation at the actual
                    location of the directive to to match gas(1) behavior
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: MC
          Assignee: unassignedbugs at nondot.org
          Reporter: qcolombet at apple.com
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified

Currently .cfi_startproc is bound to the last seen symbol.

This was causing a crash when a cfi_startproc was used before any symbol was
defined (see r206236).
Thus, one has to define a symbol before using .cfi_startproc in an assembly
file.

To match gas(1), we should be emit the relocation based on the location of the
directive, not the last symbol.

More information from Eric Christopher <echristo at gmail.com>:
"gas appears to create a symbol for the .cfi_startproc and makes the
relocation relative to it:

.text
.space 1000
.cfi_startproc
.space 1000
.globl _someFunction
_someFunction :
 .cfi_def_cfa_offset 16
 .cfi_offset %rbp,-16
 .cfi_def_cfa_register rbp
 ret
 .cfi_endproc

RELOCATION RECORDS FOR [.eh_frame]:
OFFSET           TYPE              VALUE
0000000000000020 R_X86_64_PC32     .text+0x00000000000003e8

which holds up if you do:

.text
.space 1000
.globl _someFunction
_someFunction :
 .space 1000
 .cfi_startproc
 .cfi_def_cfa_offset 16
 .cfi_offset %rbp,-16
 .cfi_def_cfa_register rbp
 ret
 .cfi_endproc

RELOCATION RECORDS FOR [.eh_frame]:
OFFSET           TYPE              VALUE
0000000000000024 R_X86_64_PC32     .text+0x00000000000007d0

which seems to say that to be compatible we'll need to do the
relocation for the .cfi_startproc we need to emit it at the location
of the directive and not at the last known symbol."

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20140415/2ee1c1b0/attachment.html>


More information about the llvm-bugs mailing list