<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 - incorrect external symbol address"
   href="https://bugs.llvm.org/show_bug.cgi?id=39862">39862</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>incorrect external symbol address
          </td>
        </tr>

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

        <tr>
          <th>Version</th>
          <td>unspecified
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>All
          </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>ELF
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>andrew@ziglang.org
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org, peter.smith@linaro.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Linker script:

ENTRY(_start)

SECTIONS {
    . = 0x0000;

    .text : ALIGN(4K) {
        KEEP(*(.text.boot))
        *(.text)
    }

    .rodata : ALIGN(4K) {
        *(.rodata)
    }

    .data : ALIGN(4K) {
        *(.data)
    }

    __bss_start = .;
    .bss : ALIGN(4K) {
        *(COMMON)
        *(.bss)
    }
    __bss_end = .;

    __debug_info_start = .;
    .debug_info : {
        KEEP(*(.debug_info))
    }
    __debug_info_end = .;
    __debug_abbrev_start = .;
    .debug_abbrev : {
        KEEP(*(.debug_abbrev))
    }
    __debug_abbrev_end = .;
    __debug_str_start = .;
    .debug_str : {
        KEEP(*(.debug_str))
    }
    __debug_str_end = .;
    __debug_line_start = .;
    .debug_line : {
        KEEP(*(.debug_line))
    }
    __debug_line_end = .;
    __debug_ranges_start = .;
    .debug_ranges : {
        KEEP(*(.debug_ranges))
    }
    __debug_ranges_end = .;
}

When I run the program, the address of __debug_info_start is *after* the
address of __debug_info_end:
00000000000350c0 g       .bss   0000000000000000 __debug_info_start
000000000000a789 g       .debug_info    0000000000000000 __debug_info_end


Command line
lld -error-limit=0 -T src/linker.ld --gc-sections -m aarch64linux -static -o
/home/andy/dev/clashos/zig-cache/clashos -rpath
/nix/store/a9v8hmmzyccs8gp6h1ny3kanjwqm6vzb-tmpAoeu/lib64 -rpath
/nix/store/a9v8hmmzyccs8gp6h1ny3kanjwqm6vzb-tmpAoeu/lib -L
/nix/store/dvsdkffaawy8vc71d0igmz1gahmhb750-lld-7.0.0-dev/lib -L
/nix/store/prsq15n5kbwrmn7iq7w62qsw13wd8qi7-lldb-5.0.2/lib -L
/nix/store/dvsdkffaawy8vc71d0igmz1gahmhb750-lld-7.0.0-dev/lib -L
/nix/store/prsq15n5kbwrmn7iq7w62qsw13wd8qi7-lldb-5.0.2/lib
/home/andy/dev/clashos/zig-cache/clashos.o
/home/andy/.local/share/zig/stage1/artifact/jXTdLj1hUxUbbDErAEPzHYHkobbXdNJP-PinpFset1D-MKi7sWxn37lBWVAHzwug/builtin.a
/home/andy/.local/share/zig/stage1/artifact/UTpuM9AclGrEmJo7_fvkjlx-9ozix41gyVNF7HoRXzZitF86iR0ep8e3-gAMiC7z/compiler_rt.a
--allow-shlib-undefined


When I link with gnu binutils instead of LLD, it works correctly:
00000000000350c0 g       .bss 0000000000000000 __debug_info_start
000000000003f849 g       .bss 0000000000000000 __debug_info_end</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>