<html>
    <head>
      <base href="http://llvm.org/bugs/" />
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW --- - cfi_startproc should emit a relocation at the actual location of the directive to to match gas(1) behavior"
   href="http://llvm.org/bugs/show_bug.cgi?id=19430">19430</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>cfi_startproc should emit a relocation at the actual location of the directive to to match gas(1) behavior
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>libraries
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>trunk
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>PC
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>All
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>normal
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>MC
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>qcolombet@apple.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvmbugs@cs.uiuc.edu
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>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 <<a href="mailto:echristo@gmail.com">echristo@gmail.com</a>>:
"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."</pre>
        </div>
      </p>
      <hr>
      <span>You are receiving this mail because:</span>
      
      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>