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: [email protected]
          Reporter: [email protected]
                CC: [email protected]

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.
_______________________________________________
llvm-bugs mailing list
[email protected]
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to