[llvm-bugs] [Bug 36799] New: LLD produces error when using explicit memory regions

via llvm-bugs llvm-bugs at lists.llvm.org
Mon Mar 19 08:25:41 PDT 2018


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

            Bug ID: 36799
           Summary: LLD produces error when using explicit memory regions
           Product: lld
           Version: unspecified
          Hardware: PC
                OS: Windows NT
            Status: NEW
          Severity: normal
          Priority: P
         Component: ELF
          Assignee: unassignedbugs at nondot.org
          Reporter: konstantin.schwarz at hightec-rt.com
                CC: llvm-bugs at lists.llvm.org

The following test case cannot be linked with lld:

// test.s
.text
.globl _start
_start:

.section .bar,"a"
  .quad 0
.section .foo,"a"
  .quad 1


// linker.script

MEMORY
{
  ram (rwx): org = 0x0, len = 96K
}

ENTRY(_start)

SECTIONS
{
  .bar :
  {
    *(.bar)
    . += 0x4;
  } > ram 

  .foo : ALIGN(8) 
  {
    *(.foo)
  } > ram
}

$ llvm-mc -filetype=obj -triple=x86_64-pc-linux test.s -o test.o
$ ld.lld -T linker.script --Map=test.map test.o
produces the following error:
ld.lld: error: section .foo file range overlaps with .comment
>>> .foo range is [0x1010, 0x1017]
>>> .comment range is [0x1014, 0x1089]

Linking with ld.bfd gives the following map file:

Memory Configuration

Name             Origin             Length             Attributes
ram              0x0000000000000000 0x0000000000018000 xrw
*default*        0x0000000000000000 0xffffffffffffffff

Linker script and memory map


.text           0x0000000000000000        0x0
 .text          0x0000000000000000        0x0 test.o

.bar            0x0000000000000000        0xc
 *(.bar)
 .bar           0x0000000000000000        0x8 test.o
                0x000000000000000c                . = (. + 0x4)
 *fill*         0x0000000000000008        0x4 

.foo            0x0000000000000010        0x8
 *(.foo)
 .foo           0x0000000000000010        0x8 test.o

-- 
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/20180319/bb641bb6/attachment.html>


More information about the llvm-bugs mailing list