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: unassignedb...@nondot.org
          Reporter: eblot...@gmail.com
                CC: llvm-bugs@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.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to