[llvm-bugs] [Bug 37608] New: LLD does not update section start address

via llvm-bugs llvm-bugs at lists.llvm.org
Mon May 28 02:57:19 PDT 2018


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

            Bug ID: 37608
           Summary: LLD does not update section start address
           Product: lld
           Version: unspecified
          Hardware: Other
                OS: other
            Status: NEW
          Severity: normal
          Priority: P
         Component: ELF
          Assignee: unassignedbugs at nondot.org
          Reporter: eblot.ml at gmail.com
                CC: llvm-bugs at lists.llvm.org

Created attachment 20346
  --> https://bugs.llvm.org/attachment.cgi?id=20346&action=edit
Sample code to reproduce the issue

Hi,

Using LLD 6.0.0 (host: macOS, target: armv7em bare metal), it seems LLD fails
to properly compute the start address of some of the successive sections, for
example in the following subset:

    .pstack :
    {
        . = ALIGN(8);
        __process_stack_base__ = .;
        . += __process_stack_size__;
        . = ALIGN(8);
        __process_stack_end__ = .;
    } > ram0

    .mstack :
    {
        . = ALIGN(8);
        __main_stack_base__ = .;
        . += __main_stack_size__;
        . = ALIGN(8);
        __main_stack_end__ = .;
    } > ram0


I expect that __main_stack_base__ is given an address equal of greater than
__process_stack_end__.

However:

Stack map with LLVM/LLD
20000000 B __main_stack_base__
20000000 B __process_stack_base__

While:

Stack map with GNU/LD
20000400 B __main_stack_base__
20000000 B __process_stack_base__

The proper address can be obtained by forcing the start address this way:

    .mstack :
    {
        . = __process_stack_end__;
        . = ALIGN(8);
        __main_stack_base__ = .;
        . += __main_stack_size__;
        . = ALIGN(8);
        __main_stack_end__ = .;
    } > ram0

but it seems awkward.

I'm attaching a tiny tarball file w/ a build.sh script that reproduces the
issue with a very trivial application.

-- 
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/20180528/213e617b/attachment.html>


More information about the llvm-bugs mailing list