llvm-project/lld/test/ELF/linkerscript/segment-none.s

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

40 lines
1.2 KiB
ArmAsm
Raw Normal View History

# REQUIRES: x86
# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t.o
## Test that section .foo is not placed in any segment when assigned to segment
## NONE in the linker script and segment NONE is not defined.
# RUN: echo "PHDRS {text PT_LOAD;} \
# RUN: SECTIONS { \
# RUN: .text : {*(.text .text*)} :text \
# RUN: .foo : {*(.foo)} :NONE \
# RUN: }" > %t.script
# RUN: ld.lld -o %t --script %t.script %t.o
# RUN: llvm-readelf -S -l %t | FileCheck %s
## Test that section .foo is placed in segment NONE when assigned to segment
## NONE in the linker script and segment NONE is defined.
# RUN: echo "PHDRS {text PT_LOAD; NONE PT_LOAD;} \
# RUN: SECTIONS { \
# RUN: .text : {*(.text .text*)} :text \
# RUN: .foo : {*(.foo)} :NONE \
# RUN: }" > %t.script
# RUN: ld.lld -o %t --script %t.script %t.o
# RUN: llvm-readelf -S -l %t | FileCheck --check-prefix=DEFINED %s
# CHECK: Section to Segment mapping:
# CHECK-NEXT: Segment Sections...
[llvm-readobj] Display sections that do not belong to a segment in the section-mapping Summary: The following patch adds the "None" line to the section to segment mapping dump. That line lists the sections that do not belong to any segment. I realize that this change differs from GNU readelf which does not display the latter information. I'd rather not add this "feature" under a command line option. I think that might introduce confusion, since users would have to make an additional decision as to if they want to see all of the section-to-segment map or just a subset of it. Another option is to only print the "None" line if the `--section-mapping` option is passed; however, that might also introduce some confusion, because the section-to-segment map would be different between`--program-headers` and the `--section-mapping` output. While the difference is just the "None" line, it seems that if we choose to display the segment-to-section mapping, then we should always display the whole map including the sections that do not belong to segments. ``` Section to Segment mapping: Segment Sections... 00 01 .interp 02 .interp .note.ABI-tag .gnu.hash 03 .init_array .fini_array .dynamic 04 .dynamic 05 .note.ABI-tag 06 .eh_frame_hdr 07 08 .init_array .fini_array .dynamic .got None .comment .symtab .strtab .shstrtab <--- THIS LINE ``` Reviewers: grimar, rupprecht, jhenderson, espindola Reviewed By: rupprecht Subscribers: khemant, emaste, arichardson, llvm-commits Differential Revision: https://reviews.llvm.org/D57700 llvm-svn: 353217
2019-02-06 05:01:01 +08:00
# CHECK: None {{.*}}.foo
# DEFINED: Section to Segment mapping:
# DEFINED-NEXT: Segment Sections...
# DEFINED-NEXT: 00 .text
# DEFINED-NEXT: 01 .foo
.global _start
_start:
nop
.section .foo,"a"
foo:
.long 0