[llvm-bugs] [Bug 38750] New: [Linker script] reference to a dead section

via llvm-bugs llvm-bugs at lists.llvm.org
Tue Aug 28 17:14:59 PDT 2018


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

            Bug ID: 38750
           Summary: [Linker script] reference to a dead section
           Product: lld
           Version: unspecified
          Hardware: All
                OS: Windows NT
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: ELF
          Assignee: unassignedbugs at nondot.org
          Reporter: pshung807 at gmail.com
                CC: llvm-bugs at lists.llvm.org

Can lld support the case below?
The expected LMA of .text is 0x80000, but lld generates zero.
LLD discards empty SectionCommands in adjustSectionsBeforeSorting; thus those
empty OutputSection are not assigned address in assignAddress.

This feature is supported by bfd linker.



 3 # RUN: llvm-mc -filetype=obj -triple=riscv64- %s -o %t.o
  4 # RUN: echo "SECTIONS { \
  5 # RUN:  . = 0x00080000; \
  6 # RUN: .init  : { KEEP(*(.init )) } \
  7 # RUN:.text   : AT(ALIGN(LOADADDR (.init) + SIZEOF (.init),
ALIGNOF(.init))) { *(.text .text.* ) }\
  8 # RUN: }" > %t.script
  9 # RUN: ld.lld -o %t -T %t.script %t.o
 10 # RUN: llvm-readelf  -program-headers %t | FileCheck %s
 11 .text
 12 .global _start
 13 _start:
 14 nop
 15 nop
 16 #CHECK: Program Headers:
 17 #CHECK: Type           Offset   VirtAddr           PhysAddr          
FileSiz  MemSiz   Flg Align
 18 #CHECK-NEXT: LOAD      0x{{[0-9a-fA-F]+}}     0x0000000000080000
0x0000000000080000 0x000008 0x000008 R E 0x10

-- 
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/20180829/82caf345/attachment-0001.html>


More information about the llvm-bugs mailing list