<html>
    <head>
      <base href="https://bugs.llvm.org/">
    </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 - [ELF] - DefinedSynthetic symbols has incorrect values."
   href="https://bugs.llvm.org/show_bug.cgi?id=32031">32031</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>[ELF] - DefinedSynthetic symbols has incorrect values.
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>lld
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>unspecified
          </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>enhancement
          </td>
        </tr>

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

        <tr>
          <th>Component</th>
          <td>ELF
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>grimar@accesssoftek.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Testcase below shows the issue. Symbols barsym and barsym1 should be equal.
Currently them are not. That happens because we calculate barsym1 value too
early, when OutSecOff is not yet set. So it end up with wrong VA.
One of ideas how to fix that was in <a href="https://reviews.llvm.org/D29391">https://reviews.llvm.org/D29391</a>, but
another solution was landed, I wonder if there is another simple way.

# REQUIRES: x86
# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t
# RUN: echo "SECTIONS { barsym1 = barsym; .bar : { *(.bar*) } }" > %t.script
# RUN: ld.lld %t --script %t.script -o %t1
# RUN: llvm-readobj -symbols %t1 | FileCheck %s

# CHECK:     Symbol {
# CHECK:      Name: barsym
# CHECK-NEXT: Value: 0x[[VAL:.*]]
# CHECK:      Name: barsym1
# CHECK-NEXT: Value: 0x[[VAL]]

.section .bar.1, "a"
.quad 0

.section .bar.2, "a"
.quad 0
.global barsym
barsym:</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>