[llvm-bugs] [Bug 52510] New: Load address range overlap reported when ALIGN is used with LMA and VMA regions

via llvm-bugs llvm-bugs at lists.llvm.org
Mon Nov 15 06:35:38 PST 2021


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

            Bug ID: 52510
           Summary: Load address range overlap reported when ALIGN is used
                    with LMA and VMA regions
           Product: lld
           Version: unspecified
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: ELF
          Assignee: unassignedbugs at nondot.org
          Reporter: konstantin.schwarz at hightec-rt.com
                CC: llvm-bugs at lists.llvm.org, smithp352 at googlemail.com

In the example shown below, the following error is reported:

ld.lld: error: section .data3 load address range overlaps with .data
>>> .data3 range is [0x8000005, 0x800000C]
>>> .data range is [0x8000008, 0x800000B]


linkerscript:
```
MEMORY
{
    CODE (rx) : ORIGIN = 0x08000000, LENGTH = 512K
    DATA (rw) : ORIGIN = 0x20000400, LENGTH = 95K
}

SECTIONS
{
    .text :
    {
        *(.text)
    } > CODE

    .data : ALIGN(8)
    {
        . += 4;
    } > DATA AT> CODE

    /* This section is needed to get a new program header created for .data3 */
    .data2 :
    {
        . += 8;
    } > DATA

    .data3 :
    {
        . += 8;
    } > DATA AT> CODE
}
```

source file:
```
.text
.globl _start
_start:
    nop
```

Looking at the ELF that we get when using `--no-check-sections`, we find the
following program headers:

```
Program Headers:
  Type           Offset             VirtAddr           PhysAddr
                 FileSiz            MemSiz              Flags  Align
  LOAD           0x0000000000001000 0x0000000008000000 0x0000000008000000
                 0x0000000000000001 0x0000000000000001  R E    0x1000
  LOAD           0x0000000000001400 0x0000000020000400 0x0000000008000008
                 0x0000000000000004 0x0000000000000004  R E    0x1000
  LOAD           0x0000000000001404 0x0000000020000404 0x0000000020000404
                 0x0000000000000008 0x0000000000000008  R E    0x1000
  LOAD           0x000000000000140c 0x000000002000040c 0x0000000008000005
                 0x0000000000000008 0x0000000000000008  R E    0x1000
```
, indicating that .data3 is not aware of the alignment requirement of .data

-- 
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/20211115/0722e289/attachment-0001.html>


More information about the llvm-bugs mailing list