[PATCH] D62768: [ELF] Don't create an output section named `/DISCARD/` if it is assigned to the special phdr `NONE`
Andrew Ng via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Jun 3 03:00:22 PDT 2019
andrewng added a comment.
George's comment reminds me why we didn't take this approach in the first place, as it doesn't work correctly for the following test case:
# REQUIRES: x86
# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t.o
# RUN: echo "PHDRS { \
# RUN: exec PT_LOAD FLAGS(0x4 | 0x1); \
# RUN: rodata PT_LOAD FLAGS(0x4); \
# RUN: } \
# RUN: SECTIONS { \
# RUN: .text : { *(.text) } :exec \
# RUN: /DISCARD/ : { *(.discard) } :rodata \
# RUN: .rodata : { *(.rodata) } \
# RUN: }" > %t.script
# RUN: ld.lld -o %t --script %t.script %t.o
# RUN: llvm-readelf -S -l %t | FileCheck --implicit-check-not=/DISCARD/ %s
## Check that /DISCARD/ phdr is assigned to subsequent sections.
# CHECK: Section Headers
# CHECK: .text
# CHECK-NEXT: .rodata
# CHECK: Segment Sections
# CHECK-NEXT: .text
# CHECK-NEXT: .rodata
.section .text,"ax"
ret
.section .rodata,"a"
.byte 0
.section .discard,"a"
.byte 0
However, this use case is a very unusual edge case, although bfd does handle it.
Repository:
rL LLVM
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D62768/new/
https://reviews.llvm.org/D62768
More information about the llvm-commits
mailing list