[llvm-bugs] [Bug 37607] New: LLD does not create segments for output sections coming after .ARM.attributes in linkerscript

via llvm-bugs llvm-bugs at lists.llvm.org
Mon May 28 02:50:29 PDT 2018


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

            Bug ID: 37607
           Summary: LLD does not create segments for output sections
                    coming after .ARM.attributes in linkerscript
           Product: lld
           Version: unspecified
          Hardware: PC
                OS: Windows NT
            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

LLD does not create segments for output sections coming after .ARM.attributes
section patterns in linkerscripts.

Consider the following assembler file and linker script:

// test.s
.global _start
_start:
nop


// linker.script
ENTRY(_start)

SECTIONS {

        .ARM.attributes : { *(.ARM.attributes) }

        .text : {
                *(.text*)
        }
}

llvm-readelf gives the following output:

Section Headers:
  [Nr] Name              Type            Addr     Off    Size   ES Flg Lk Inf
Al
  [ 0]                   NULL            00000000 000000 000000 00      0   0 
0
  [ 1] .ARM.attributes   ARM_ATTRIBUTES  00000000 000094 000030 00      0   0 
1
  [ 2] .comment          PROGBITS        00000000 0000c4 000064 01  MS  0   0 
1
  [ 3] .symtab           SYMTAB          00000000 000128 000030 10      5   2 
4
  [ 4] .shstrtab         STRTAB          00000000 000158 00003a 00      0   0 
1
  [ 5] .strtab           STRTAB          00000000 000192 00000d 00      0   0 
1
  [ 6] .text             PROGBITS        00000010 0001a0 000004 00  AX  0   0 
4
[...]

Program Headers:
  Type           Offset   VirtAddr   PhysAddr   FileSiz MemSiz  Flg Align
  GNU_STACK      0x000000 0x00000000 0x00000000 0x00000 0x00000 RW  0

 Section to Segment mapping:
  Segment Sections...
   00     

[...]

Reordering the output section description into

// linker2.script
ENTRY(_start)

SECTIONS {

        .text : {
                *(.text*)
        }
        .ARM.attributes : { *(.ARM.attributes) }
}

gives the expected result:

[...]
Program Headers:
  Type           Offset   VirtAddr   PhysAddr   FileSiz MemSiz  Flg Align
  LOAD           0x001000 0x00000000 0x00000000 0x00004 0x00004 R E 0x1000
  GNU_STACK      0x000000 0x00000000 0x00000000 0x00000 0x00000 RW  0

 Section to Segment mapping:
  Segment Sections...
   00     .text 
   01   
[...]

arm-none-eabi-ld.bfd produces the expected output with both linkerscripts.

-- 
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/7702ce1d/attachment.html>


More information about the llvm-bugs mailing list