This reverts a side effect introduced in the code cleanup patch D43571: LLD started to emit empty output sections that are explicitly assigned to a segment. This patch fixes the issue by removing the !sec.phdrs.empty() special case from isDiscardable. As compensation, we add an early phdrs propagation step (see the inline comment). This is similar to one that we do in adjustSectionsAfterSorting. Differential revision: https://reviews.llvm.org/D92301
25 lines
644 B
Plaintext
25 lines
644 B
Plaintext
# REQUIRES: x86
|
|
|
|
# RUN: echo '.section .text,"ax"; .quad 0' > %t.s
|
|
# RUN: echo '.section .foo,"ax"; .quad 0' >> %t.s
|
|
# RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %t.s -o %t.o
|
|
# RUN: ld.lld --hash-style=sysv -o %t1 --script %s %t.o -shared
|
|
# RUN: llvm-readelf -l %t1 | FileCheck %s
|
|
|
|
# CHECK: Segment Sections...
|
|
# CHECK-NEXT: 00 .dynsym .hash .dynstr .foo .text .dynamic
|
|
# CHECK-NEXT: 01 .foo
|
|
# CHECK-NEXT: 02 .foo
|
|
|
|
PHDRS {
|
|
ph_write PT_LOAD FLAGS(2);
|
|
ph_exec PT_LOAD FLAGS(1);
|
|
ph_note PT_NOTE;
|
|
}
|
|
|
|
SECTIONS {
|
|
.bar : { *(.bar) } : ph_exec : ph_note
|
|
.foo : { *(.foo) }
|
|
.text : { *(.text) } : ph_write
|
|
}
|