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

            Bug ID: 47853
           Summary: Section will not fit if sections added in linker
                    script are not increasingly ordered by vma or lma
           Product: lld
           Version: unspecified
          Hardware: PC
                OS: Windows NT
            Status: NEW
          Severity: normal
          Priority: P
         Component: All Bugs
          Assignee: [email protected]
          Reporter: [email protected]
                CC: [email protected], [email protected]

Hi, 

The following happens: 

error: section '.Section Name' will not fit in region 'Memory Region Name':
overflowed by <n> bytes

When using lld with a linker script where sections that have load or virtual
memory address specified and are not in ascending order of the load memory
address inside the linker script.

The RAM ends at 0xfff00 as specified in the memory region. When it checks if
the size of RAM is not exceeded, the current position will start at 0xFFEDC so, 
0xFFEDC + 0xa +0x1e = 0xfff04 for the code bellow.

If section1 size is 0xa and size of section2 is 0x1e The error message will be
that RAM was overflowed by 4 bytes. 

Example:

MEMORY
{

        RAM : ORIGIN = 0xF3F00, LENGTH = 49152
}
SECTIONS
{
    .stack 0xFFEDC (NOLOAD) : AT(0xFFEDC)
        {
                _stack = .;
        } > RAM
    .section1 0xffd00 : AT(0xffd00)
        {
                KEEP(*(.section1))
        } >RAM
    .section2 0xffd40 : AT(0xffd40)
        {
                KEEP(*(.section2))
        } >RAM
}

While specifying the sections in increasing order by lma works fine.  
This happens with lld 10.0.0. 

Apologies if this is a duplicate or you do not consider it a bug, but I did not
find a reference to this. 

Best regards, 
Robert

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to