[llvm-bugs] [Bug 39862] New: incorrect external symbol address

via llvm-bugs llvm-bugs at lists.llvm.org
Sun Dec 2 20:18:32 PST 2018


https://bugs.llvm.org/show_bug.cgi?id=39862

            Bug ID: 39862
           Summary: incorrect external symbol address
           Product: lld
           Version: unspecified
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: ELF
          Assignee: unassignedbugs at nondot.org
          Reporter: andrew at ziglang.org
                CC: llvm-bugs at lists.llvm.org, peter.smith at linaro.org

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

-- 
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/20181203/1900b753/attachment.html>


More information about the llvm-bugs mailing list